Преглед на файлове

Merge branch 'dev' of http://git.xayunmei.com/SH-Arbitrate/Mediation-Backend into qtz1

qitz преди 2 години
родител
ревизия
2b5765d935
променени са 22 файла, в които са добавени 528 реда и са изтрити 123 реда
  1. 8
    4
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/flow/CaseFlowController.java
  2. 32
    12
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
  3. 17
    7
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java
  4. 23
    1
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
  5. 24
    0
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java
  6. 1
    1
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
  7. 93
    13
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
  8. 24
    11
      ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java
  9. 28
    0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/flow/MsBaseCaseFlow.java
  10. 4
    0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/flow/MsCaseFlowMapper.java
  11. 8
    0
      ruoyi-system/src/main/java/com/ruoyi/system/service/flow/CaseFlowService.java
  12. 8
    0
      ruoyi-system/src/main/java/com/ruoyi/system/service/flow/CaseFlowServiceImpl.java
  13. 3
    0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
  14. 24
    1
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/miniprogress/IdentityAuthentication.java
  15. 10
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAffiliate.java
  16. 7
    1
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationVO.java
  17. 19
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseBatchInsertVO.java
  18. 10
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseLogRecordMapper.java
  19. 2
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java
  20. 16
    2
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java
  21. 158
    69
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java
  22. 9
    1
      ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

+ 8
- 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/flow/CaseFlowController.java Целия файл

@@ -5,10 +5,7 @@ import com.ruoyi.system.domain.vo.flow.MsCaseFlowSearchVO;
5 5
 import com.ruoyi.system.domain.vo.flow.MsCaseFlowVO;
6 6
 import com.ruoyi.system.service.flow.CaseFlowService;
7 7
 import org.springframework.beans.factory.annotation.Autowired;
8
-import org.springframework.web.bind.annotation.PostMapping;
9
-import org.springframework.web.bind.annotation.RequestBody;
10
-import org.springframework.web.bind.annotation.RequestMapping;
11
-import org.springframework.web.bind.annotation.RestController;
8
+import org.springframework.web.bind.annotation.*;
12 9
 
13 10
 import static com.ruoyi.common.core.domain.AjaxResult.success;
14 11
 
@@ -28,6 +25,13 @@ public class CaseFlowController {
28 25
     public Object queryCaseFlowInfo(@RequestBody MsCaseFlowSearchVO caseFlowSearchVO) {
29 26
         return caseFlowService.queryCaseFlowInfo(caseFlowSearchVO);
30 27
     }
28
+    /**
29
+     * 查询案件流程信息
30
+     */
31
+    @GetMapping("/selectCaseFlow")
32
+    public AjaxResult selectCaseFlow() {
33
+        return caseFlowService.selectCaseFlow();
34
+    }
31 35
 
32 36
     /**
33 37
      * 新增或编辑案件流程节点信息

+ 32
- 12
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java Целия файл

@@ -1,17 +1,7 @@
1 1
 package com.ruoyi.web.controller.system;
2 2
 
3
-import java.util.List;
4
-import java.util.Set;
5
-
6
-import com.ruoyi.system.service.ISysUserService;
7
-import com.ruoyi.system.service.flow.CaseFlowService;
8
-import com.ruoyi.wisdomarbitrate.domain.dto.miniprogress.IdentityAuthentication;
9
-import com.ruoyi.wisdomarbitrate.service.miniprogress.IdentityAuthenticationService;
10
-import org.springframework.beans.factory.annotation.Autowired;
11
-import org.springframework.web.bind.annotation.GetMapping;
12
-import org.springframework.web.bind.annotation.PostMapping;
13
-import org.springframework.web.bind.annotation.RequestBody;
14
-import org.springframework.web.bind.annotation.RestController;
3
+import cn.hutool.core.util.StrUtil;
4
+import cn.hutool.crypto.digest.MD5;
15 5
 import com.ruoyi.common.constant.Constants;
16 6
 import com.ruoyi.common.core.domain.AjaxResult;
17 7
 import com.ruoyi.common.core.domain.entity.SysMenu;
@@ -20,7 +10,20 @@ import com.ruoyi.common.core.domain.model.LoginBody;
20 10
 import com.ruoyi.common.utils.SecurityUtils;
21 11
 import com.ruoyi.framework.web.service.SysLoginService;
22 12
 import com.ruoyi.framework.web.service.SysPermissionService;
13
+import com.ruoyi.framework.web.service.TokenService;
23 14
 import com.ruoyi.system.service.ISysMenuService;
15
+import com.ruoyi.system.service.ISysUserService;
16
+import com.ruoyi.system.service.flow.CaseFlowService;
17
+import com.ruoyi.wisdomarbitrate.domain.dto.miniprogress.IdentityAuthentication;
18
+import com.ruoyi.wisdomarbitrate.service.miniprogress.IdentityAuthenticationService;
19
+import org.springframework.beans.factory.annotation.Autowired;
20
+import org.springframework.web.bind.annotation.GetMapping;
21
+import org.springframework.web.bind.annotation.PostMapping;
22
+import org.springframework.web.bind.annotation.RequestBody;
23
+import org.springframework.web.bind.annotation.RestController;
24
+
25
+import java.util.List;
26
+import java.util.Set;
24 27
 
25 28
 /**
26 29
  * 登录验证
@@ -43,6 +46,8 @@ public class SysLoginController {
43 46
     private ISysUserService sysUserService;
44 47
     @Autowired
45 48
     private CaseFlowService caseFlowService;
49
+    @Autowired
50
+    private TokenService tokenService;
46 51
     /**
47 52
      * 登录方法
48 53
      *
@@ -102,4 +107,19 @@ public class SysLoginController {
102 107
         List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
103 108
         return AjaxResult.success(menuService.buildMenus(menus));
104 109
     }
110
+    /**sso登录接口*/
111
+    @PostMapping("login/sso")
112
+    public AjaxResult loginSSO( @RequestBody LoginBody loginBody){
113
+        if(StrUtil.isEmpty(loginBody.getUsername()) || StrUtil.isEmpty(loginBody.getTicket())
114
+                || StrUtil.isEmpty(loginBody.getRoleName()) ){
115
+            return AjaxResult.error("参数错误");
116
+        }
117
+      return   loginService.loginSSO(loginBody);
118
+
119
+    }
120
+
121
+    public static void main(String[] args) {
122
+        System.out.println( MD5.create().digestHex("BMceshi" ));
123
+    }
105 124
 }
125
+

+ 17
- 7
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsCaseApplicationController.java Целия файл

@@ -79,8 +79,18 @@ public class MsCaseApplicationController extends BaseController {
79 79
         if(caseApplication.getAffiliate()==null||caseApplication.getAffiliate().getOrganizeFlag()==null){
80 80
             error("参数校验失败");
81 81
         }
82
+        AjaxResult ajaxResult = AjaxResult.success();
83
+        ajaxResult.put("caseNum",caseApplicationService.insert(caseApplication));
84
+        return ajaxResult;
85
+    }
86
+    /**
87
+     * 批量新增案件
88
+     */
89
+    @PostMapping("/batchInsert")
90
+    public AjaxResult batchInsert(@RequestBody MsCaseBatchInsertVO list )
91
+    {
82 92
 
83
-        return success(caseApplicationService.insert(caseApplication));
93
+        return caseApplicationService.batchInsert(list);
84 94
     }
85 95
 
86 96
     /**
@@ -90,10 +100,10 @@ public class MsCaseApplicationController extends BaseController {
90 100
     public AjaxResult getInfoByIdCard(@RequestParam(value = "idCard" ,required = false) String idCard)
91 101
     {
92 102
         if(StrUtil.isEmpty(idCard)){
93
-            error("身份证号不能为空");
103
+           return error("身份证号不能为空");
94 104
         }
95 105
         if(!IdcardUtil.isValidCard(idCard)){
96
-            error("身份证不合法,请输入正确的身份证号");
106
+          return   error("身份证不合法,请输入正确的身份证号");
97 107
         }
98 108
         AjaxResult ajax = AjaxResult.success();
99 109
         Map<String, String> identityNumMap = IdCardUtils.getBirAgeSex(idCard);
@@ -140,12 +150,12 @@ public class MsCaseApplicationController extends BaseController {
140 150
      * 根据id查询案件
141 151
      */
142 152
     @GetMapping("/selectById")
143
-    public AjaxResult selectById(@RequestParam Long id )
153
+    public AjaxResult selectById(@RequestParam(required = false) Long id ,@RequestParam(required = false) String caseNum  )
144 154
     {
145
-        if(id==null){
146
-            error("id不能为空");
155
+        if(id==null && caseNum==null ){
156
+            error("参数校验失败");
147 157
         }
148
-        return success(caseApplicationService.selectById(id));
158
+        return success(caseApplicationService.selectById(id,caseNum));
149 159
     }
150 160
     /**
151 161
      * 案件压缩包导入

+ 23
- 1
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java Целия файл

@@ -63,8 +63,12 @@ public class SysUser extends BaseEntity
63 63
 
64 64
 
65 65
     /** 用户身份证号 */
66
-    @Excel(name = "身份证号")
67 66
     private String idCard;
67
+    /** 身份类别,0-身份证,1-护照,默认0 */
68
+    private Integer idType;
69
+    /** 国籍,0-国内,1-国外,默认0 */
70
+
71
+    private Integer nationality;
68 72
 
69 73
     /** 用户邮箱 */
70 74
     @Excel(name = "用户邮箱")
@@ -136,6 +140,22 @@ public class SysUser extends BaseEntity
136 140
         this.userId = userId;
137 141
     }
138 142
 
143
+    public Integer getIdType() {
144
+        return idType;
145
+    }
146
+
147
+    public void setIdType(Integer idType) {
148
+        this.idType = idType;
149
+    }
150
+
151
+    public Integer getNationality() {
152
+        return nationality;
153
+    }
154
+
155
+    public void setNationality(Integer nationality) {
156
+        this.nationality = nationality;
157
+    }
158
+
139 159
     public Long getUserId()
140 160
     {
141 161
         return userId;
@@ -361,6 +381,8 @@ public class SysUser extends BaseEntity
361 381
             .append("deptIds", getDeptIds())
362 382
             .append("userName", getUserName())
363 383
             .append("idCard", getIdCard())
384
+            .append("idType", getIdType())
385
+            .append("nationality", getNationality())
364 386
             .append("nickName", getNickName())
365 387
             .append("email", getEmail())
366 388
             .append("phonenumber", getPhonenumber())

+ 24
- 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java Целия файл

@@ -26,12 +26,36 @@ public class LoginBody
26 26
      * 唯一标识
27 27
      */
28 28
     private String uuid;
29
+    /**
30
+     * 密文:BM+用户名用MD5加密
31
+     */
32
+    private String ticket;
33
+    /**
34
+     * 角色名,申请人,被申请人,委托代理人
35
+     */
36
+    private String roleName;
37
+
38
+    public String getRoleName() {
39
+        return roleName;
40
+    }
41
+
42
+    public void setRoleName(String roleName) {
43
+        this.roleName = roleName;
44
+    }
29 45
 
30 46
     public String getUsername()
31 47
     {
32 48
         return username;
33 49
     }
34 50
 
51
+    public String getTicket() {
52
+        return ticket;
53
+    }
54
+
55
+    public void setTicket(String ticket) {
56
+        this.ticket = ticket;
57
+    }
58
+
35 59
     public void setUsername(String username)
36 60
     {
37 61
         this.username = username;

+ 1
- 1
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java Целия файл

@@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
111 111
                 // 过滤请求
112 112
                 .authorizeRequests()
113 113
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
114
-                .antMatchers("/login", "/register", "/captchaImage","/uploadPath/**","/websocket/**").permitAll()
114
+                .antMatchers("/login","/login/sso", "/register", "/captchaImage","/uploadPath/**","/websocket/**").permitAll()
115 115
                 // 静态资源,可匿名访问
116 116
                 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
117 117
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

+ 93
- 13
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java Целия файл

@@ -1,33 +1,35 @@
1 1
 package com.ruoyi.framework.web.service;
2 2
 
3
-import javax.annotation.Resource;
4
-import org.springframework.beans.factory.annotation.Autowired;
5
-import org.springframework.security.authentication.AuthenticationManager;
6
-import org.springframework.security.authentication.BadCredentialsException;
7
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
8
-import org.springframework.security.core.Authentication;
9
-import org.springframework.stereotype.Component;
3
+import cn.hutool.crypto.digest.MD5;
10 4
 import com.ruoyi.common.constant.CacheConstants;
11 5
 import com.ruoyi.common.constant.Constants;
12 6
 import com.ruoyi.common.constant.UserConstants;
7
+import com.ruoyi.common.core.domain.AjaxResult;
13 8
 import com.ruoyi.common.core.domain.entity.SysUser;
9
+import com.ruoyi.common.core.domain.model.LoginBody;
14 10
 import com.ruoyi.common.core.domain.model.LoginUser;
15 11
 import com.ruoyi.common.core.redis.RedisCache;
16 12
 import com.ruoyi.common.exception.ServiceException;
17
-import com.ruoyi.common.exception.user.BlackListException;
18
-import com.ruoyi.common.exception.user.CaptchaException;
19
-import com.ruoyi.common.exception.user.CaptchaExpireException;
20
-import com.ruoyi.common.exception.user.UserNotExistsException;
21
-import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
13
+import com.ruoyi.common.exception.user.*;
22 14
 import com.ruoyi.common.utils.DateUtils;
23 15
 import com.ruoyi.common.utils.MessageUtils;
16
+import com.ruoyi.common.utils.SecurityUtils;
24 17
 import com.ruoyi.common.utils.StringUtils;
25 18
 import com.ruoyi.common.utils.ip.IpUtils;
26 19
 import com.ruoyi.framework.manager.AsyncManager;
27 20
 import com.ruoyi.framework.manager.factory.AsyncFactory;
28 21
 import com.ruoyi.framework.security.context.AuthenticationContextHolder;
22
+import com.ruoyi.system.mapper.SysRoleMapper;
29 23
 import com.ruoyi.system.service.ISysConfigService;
30 24
 import com.ruoyi.system.service.ISysUserService;
25
+import org.springframework.beans.factory.annotation.Autowired;
26
+import org.springframework.security.authentication.AuthenticationManager;
27
+import org.springframework.security.authentication.BadCredentialsException;
28
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
29
+import org.springframework.security.core.Authentication;
30
+import org.springframework.stereotype.Component;
31
+
32
+import javax.annotation.Resource;
31 33
 
32 34
 /**
33 35
  * 登录校验方法
@@ -51,6 +53,8 @@ public class SysLoginService
51 53
 
52 54
     @Autowired
53 55
     private ISysConfigService configService;
56
+    @Autowired
57
+    private SysRoleMapper roleMapper;
54 58
 
55 59
     /**
56 60
      * 登录验证
@@ -63,7 +67,6 @@ public class SysLoginService
63 67
      */
64 68
     public String login(String username, String password, String code, String uuid)
65 69
     {
66
-        // 验证码校验
67 70
         validateCaptcha(username, code, uuid);
68 71
         // 登录前置校验
69 72
         loginPreCheck(username, password);
@@ -99,6 +102,45 @@ public class SysLoginService
99 102
         // 生成token
100 103
         return tokenService.createToken(loginUser);
101 104
     }
105
+    /**
106
+     * 无需验证码登录
107
+     * 重写login方法将验证码模块去掉
108
+     * @param username
109
+     * @param password
110
+     * @param uuid
111
+     * @return
112
+     */
113
+    public String loginNoCaptcha(String username, String password,  String uuid)
114
+    {
115
+        // 用户验证
116
+        Authentication authentication = null;
117
+        try
118
+        {
119
+            UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
120
+            AuthenticationContextHolder.setContext(authenticationToken);
121
+            // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
122
+            authentication = authenticationManager.authenticate(authenticationToken);
123
+        }
124
+        catch (Exception e)
125
+        {
126
+            if (e instanceof BadCredentialsException)
127
+            {
128
+                AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
129
+                throw new UserPasswordNotMatchException();
130
+            }
131
+            else
132
+            {
133
+                AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
134
+                throw new ServiceException(e.getMessage());
135
+            }
136
+        }
137
+        AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
138
+        LoginUser loginUser = (LoginUser) authentication.getPrincipal();
139
+        recordLoginInfo(loginUser.getUserId());
140
+        // 生成token
141
+        return tokenService.createToken(loginUser);
142
+    }
143
+
102 144
 
103 145
     /**
104 146
      * 校验验证码
@@ -178,4 +220,42 @@ public class SysLoginService
178 220
         sysUser.setLoginDate(DateUtils.getNowDate());
179 221
         userService.updateUserProfile(sysUser);
180 222
     }
223
+
224
+    public AjaxResult loginSSO(LoginBody loginBody) {
225
+        // MD5加密并和Ticket比对
226
+        String currentTicket = MD5.create().digestHex("BM" + loginBody.getUsername());
227
+        if(!currentTicket.equals(loginBody.getTicket())){
228
+            return AjaxResult.error("ticket校验失败");
229
+        }
230
+        AjaxResult ajax = AjaxResult.success();
231
+        String username = loginBody.getUsername();
232
+        // 根据用户名获取用户信息,如果用户不存在则新增用户
233
+        SysUser user = userService.selectUserByUserName(username);
234
+        if(user==null){
235
+            // 新增用户
236
+            user = new SysUser();
237
+            user.setUserName(username);
238
+            user.setPassword(SecurityUtils.encryptPassword("abc123456"));
239
+            user.setNickName(username);
240
+            // 代理人角色相当于申请人角色
241
+            if(loginBody.getRoleName().contains("代理人")){
242
+                loginBody.setRoleName("申请人");
243
+            }
244
+            // 根据角色名查询角色id
245
+            Long roleIdByName = roleMapper.selectRoleIdByName(loginBody.getRoleName());
246
+            if(roleIdByName==null){
247
+                return AjaxResult.error("角色不存在");
248
+            }
249
+            user.setRoleIds( new Long[]{roleIdByName});
250
+            userService.insertUser(user);
251
+
252
+        }// 生成token
253
+        LoginUser loginUser = new LoginUser();
254
+        loginUser.setUser(user);
255
+        loginUser.setUserId(user.getUserId());
256
+        String token = tokenService.createToken(loginUser);
257
+        ajax.put("userName", user.getUserName());
258
+        ajax.put(Constants.TOKEN, token);
259
+        return ajax;
260
+    }
181 261
 }

+ 24
- 11
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java Целия файл

@@ -1,14 +1,5 @@
1 1
 package com.ruoyi.framework.web.service;
2 2
 
3
-import java.util.HashMap;
4
-import java.util.Map;
5
-import java.util.concurrent.TimeUnit;
6
-import javax.servlet.http.HttpServletRequest;
7
-import org.slf4j.Logger;
8
-import org.slf4j.LoggerFactory;
9
-import org.springframework.beans.factory.annotation.Autowired;
10
-import org.springframework.beans.factory.annotation.Value;
11
-import org.springframework.stereotype.Component;
12 3
 import com.ruoyi.common.constant.CacheConstants;
13 4
 import com.ruoyi.common.constant.Constants;
14 5
 import com.ruoyi.common.core.domain.model.LoginUser;
@@ -22,6 +13,16 @@ import eu.bitwalker.useragentutils.UserAgent;
22 13
 import io.jsonwebtoken.Claims;
23 14
 import io.jsonwebtoken.Jwts;
24 15
 import io.jsonwebtoken.SignatureAlgorithm;
16
+import org.slf4j.Logger;
17
+import org.slf4j.LoggerFactory;
18
+import org.springframework.beans.factory.annotation.Autowired;
19
+import org.springframework.beans.factory.annotation.Value;
20
+import org.springframework.stereotype.Component;
21
+
22
+import javax.servlet.http.HttpServletRequest;
23
+import java.util.HashMap;
24
+import java.util.Map;
25
+import java.util.concurrent.TimeUnit;
25 26
 
26 27
 /**
27 28
  * token验证处理
@@ -119,6 +120,8 @@ public class TokenService
119 120
         refreshToken(loginUser);
120 121
 
121 122
         Map<String, Object> claims = new HashMap<>();
123
+        claims.put("userName",loginUser.getUsername());
124
+        claims.put("userId",loginUser.getUserId());
122 125
         claims.put(Constants.LOGIN_USER_KEY, token);
123 126
         return createToken(claims);
124 127
     }
@@ -207,14 +210,24 @@ public class TokenService
207 210
         Claims claims = parseToken(token);
208 211
         return claims.getSubject();
209 212
     }
210
-
213
+    /**
214
+     * 从令牌中获取用户名
215
+     *
216
+     * @param token 令牌
217
+     * @return 用户名
218
+     */
219
+    public String getUserNameFromToken(String token)
220
+    {
221
+        Claims claims = parseToken(token);
222
+        return claims.get("userName").toString();
223
+    }
211 224
     /**
212 225
      * 获取请求token
213 226
      *
214 227
      * @param request
215 228
      * @return token
216 229
      */
217
-    private String getToken(HttpServletRequest request)
230
+    public String getToken(HttpServletRequest request)
218 231
     {
219 232
         String token = request.getHeader(header);
220 233
         if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX))

+ 28
- 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/flow/MsBaseCaseFlow.java Целия файл

@@ -0,0 +1,28 @@
1
+package com.ruoyi.system.domain.vo.flow;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Builder;
5
+import lombok.Data;
6
+import lombok.NoArgsConstructor;
7
+
8
+
9
+@AllArgsConstructor
10
+@NoArgsConstructor
11
+@Builder
12
+@Data
13
+public class MsBaseCaseFlow {
14
+    /**
15
+     * 主键id
16
+     */
17
+    private Integer id;
18
+
19
+    /**
20
+     * 顺序
21
+     */
22
+    private Integer sort;
23
+
24
+    /**
25
+     * 案件状态名称
26
+     */
27
+    private String caseStatusName;
28
+}

+ 4
- 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/flow/MsCaseFlowMapper.java Целия файл

@@ -1,6 +1,7 @@
1 1
 package com.ruoyi.system.mapper.flow;
2 2
 
3 3
 import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
4
+import com.ruoyi.system.domain.vo.flow.MsBaseCaseFlow;
4 5
 import com.ruoyi.system.domain.vo.flow.MsCaseFlowVO;
5 6
 import org.apache.ibatis.annotations.Select;
6 7
 import tk.mybatis.mapper.common.Mapper;
@@ -25,4 +26,7 @@ public interface MsCaseFlowMapper extends Mapper<MsCaseFlow> {
25 26
 
26 27
     @Select("SELECT r.role_name as roleName ,f.node_name as nodeName ,f.case_status_name as caseStatusName FROM ms_case_flow f left join ms_case_flow_role_related fr on f.id  = fr.flow_id  left join ms_sys_role r on fr.roleid  = r.role_id  WHERE f.id  = #{caseFlowId} ")
27 28
     List<MsCaseFlowVO> selectFlowRole(Integer caseFlowId);
29
+    @Select("select f1.id,f1.case_status_name caseStatusName,f1.sort from ms_case_flow f1 order by f1.sort")
30
+
31
+    List<MsBaseCaseFlow> selectCaseFlow();
28 32
 }

+ 8
- 0
ruoyi-system/src/main/java/com/ruoyi/system/service/flow/CaseFlowService.java Целия файл

@@ -1,5 +1,6 @@
1 1
 package com.ruoyi.system.service.flow;
2 2
 
3
+import com.ruoyi.common.core.domain.AjaxResult;
3 4
 import com.ruoyi.system.domain.vo.flow.MsCaseFlowSearchVO;
4 5
 import com.ruoyi.system.domain.vo.flow.MsCaseFlowVO;
5 6
 
@@ -12,6 +13,11 @@ public interface CaseFlowService {
12 13
      * @return
13 14
      */
14 15
     Object queryCaseFlowInfo(MsCaseFlowSearchVO caseFlowSearchVO);
16
+    /**
17
+     * 查询案件流程信息
18
+     * @return
19
+     */
20
+    AjaxResult selectCaseFlow();
15 21
 
16 22
     /**
17 23
      * 新增或编辑案件流程节点信息
@@ -40,4 +46,6 @@ public interface CaseFlowService {
40 46
      * @return
41 47
      */
42 48
     Set<Integer> getCaseStatusIdByRoleKey(Set<String> roles);
49
+
50
+
43 51
 }

+ 8
- 0
ruoyi-system/src/main/java/com/ruoyi/system/service/flow/CaseFlowServiceImpl.java Целия файл

@@ -2,10 +2,12 @@ package com.ruoyi.system.service.flow;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.ruoyi.common.core.domain.AjaxResult;
5 6
 import com.ruoyi.common.core.domain.entity.SysRole;
6 7
 import com.ruoyi.common.core.page.TableDataInfo;
7 8
 import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
8 9
 import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleRelated;
10
+import com.ruoyi.system.domain.vo.flow.MsBaseCaseFlow;
9 11
 import com.ruoyi.system.domain.vo.flow.MsCaseFlowSearchVO;
10 12
 import com.ruoyi.system.domain.vo.flow.MsCaseFlowVO;
11 13
 import com.ruoyi.system.mapper.SysRoleMapper;
@@ -95,6 +97,12 @@ public class CaseFlowServiceImpl implements CaseFlowService {
95 97
         }
96 98
     }
97 99
 
100
+    @Override
101
+    public AjaxResult selectCaseFlow() {
102
+        List<MsBaseCaseFlow> caseFlows = msCaseFlowMapper.selectCaseFlow();
103
+        return AjaxResult.success(caseFlows);
104
+    }
105
+
98 106
     /**
99 107
      * 查询流程信息相关的角色信息
100 108
      *

+ 3
- 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java Целия файл

@@ -8,6 +8,7 @@ import com.ruoyi.common.core.domain.entity.SysRole;
8 8
 import com.ruoyi.common.core.domain.entity.SysUser;
9 9
 import com.ruoyi.common.core.domain.entity.SysUserDept;
10 10
 import com.ruoyi.common.exception.ServiceException;
11
+import com.ruoyi.common.utils.DateUtils;
11 12
 import com.ruoyi.common.utils.SecurityUtils;
12 13
 import com.ruoyi.common.utils.StringUtils;
13 14
 import com.ruoyi.common.utils.bean.BeanValidators;
@@ -241,6 +242,8 @@ public class SysUserServiceImpl implements ISysUserService {
241 242
     @Transactional
242 243
     public AjaxResult insertUser(SysUser user) {
243 244
         // 新增用户信息
245
+        user.setCreateBy("admin");
246
+        user.setCreateTime(DateUtils.getNowDate());
244 247
         int rows = userMapper.insertUser(user);
245 248
         // 新增用户部门关联
246 249
         if(CollectionUtil.isNotEmpty(user.getDeptIds())) {

+ 24
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/miniprogress/IdentityAuthentication.java Целия файл

@@ -1,7 +1,6 @@
1 1
 package com.ruoyi.wisdomarbitrate.domain.dto.miniprogress;
2 2
 
3 3
 import com.fasterxml.jackson.annotation.JsonFormat;
4
-import com.ruoyi.common.annotation.Excel;
5 4
 import com.ruoyi.common.core.domain.BaseEntity;
6 5
 import lombok.Data;
7 6
 
@@ -20,6 +19,14 @@ public class IdentityAuthentication   extends BaseEntity {
20 19
     private String name;
21 20
     /** 身份证号 */
22 21
     private String identityNo;
22
+    /**
23
+     *  身份类别,0-身份证,1-护照,默认0
24
+     */
25
+    private Integer idType;
26
+    /**
27
+     * 国籍,0-国内,1-国外,默认0
28
+     */
29
+    private Integer nationality;
23 30
     /**
24 31
      * 短信验证码
25 32
      */
@@ -104,6 +111,22 @@ public class IdentityAuthentication   extends BaseEntity {
104 111
         return userId;
105 112
     }
106 113
 
114
+    public Integer getIdType() {
115
+        return idType;
116
+    }
117
+
118
+    public void setIdType(Integer idType) {
119
+        this.idType = idType;
120
+    }
121
+
122
+    public Integer getNationality() {
123
+        return nationality;
124
+    }
125
+
126
+    public void setNationality(Integer nationality) {
127
+        this.nationality = nationality;
128
+    }
129
+
107 130
     public void setUserId(Long userId) {
108 131
         this.userId = userId;
109 132
     }

+ 10
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseAffiliate.java Целия файл

@@ -154,4 +154,14 @@ public class MsCaseAffiliate {
154 154
      */
155 155
     @Column(name = "is_sign_respon")
156 156
     private Integer isSignRespon;
157
+    /**
158
+     * 身份类别,0-身份证,1-护照,默认0
159
+     */
160
+    @Column(name = "id_type")
161
+    private Integer idType;
162
+    /**
163
+     * 国籍,0-国内,1-国外,默认0
164
+     */
165
+    @Column(name = "nationality")
166
+    private Integer nationality;
157 167
 }

+ 7
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationVO.java Целия файл

@@ -1,5 +1,6 @@
1 1
 package com.ruoyi.wisdomarbitrate.domain.vo.mscase;
2 2
 
3
+import com.fasterxml.jackson.annotation.JsonFormat;
3 4
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
4 5
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
5 6
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
@@ -7,6 +8,7 @@ import lombok.AllArgsConstructor;
7 8
 import lombok.Data;
8 9
 import lombok.NoArgsConstructor;
9 10
 
11
+import java.util.Date;
10 12
 import java.util.List;
11 13
 
12 14
 /**
@@ -77,6 +79,10 @@ public class MsCaseApplicationVO extends MsCaseApplication {
77 79
      * 签名按钮显示,0-显示,1-不显示
78 80
      */
79 81
     private Integer signButtonFlag;
80
-
82
+    /**
83
+     * 结束时间
84
+     */
85
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
86
+    private Date endTime;
81 87
 
82 88
 }

+ 19
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseBatchInsertVO.java Целия файл

@@ -0,0 +1,19 @@
1
+package com.ruoyi.wisdomarbitrate.domain.vo.mscase;
2
+
3
+import lombok.Data;
4
+
5
+import java.io.Serializable;
6
+import java.util.List;
7
+
8
+/**
9
+ * @Classname MsCaseBatchInsertVO
10
+ * @Description 批量新增案件
11
+ * @Version 1.0.0
12
+ * @Date 2024/3/11 10:04
13
+ * @Created wangqiong
14
+ */
15
+@Data
16
+public class MsCaseBatchInsertVO implements Serializable {
17
+    private static final long serialVersionUID = 1L;
18
+    private List<MsCaseApplicationVO> list;
19
+}

+ 10
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseLogRecordMapper.java Целия файл

@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param;
6 6
 import org.apache.ibatis.annotations.Select;
7 7
 import tk.mybatis.mapper.common.Mapper;
8 8
 
9
+import java.util.Date;
9 10
 import java.util.List;
10 11
 
11 12
 public interface MsCaseLogRecordMapper extends Mapper<MsCaseLogRecord> {
@@ -33,4 +34,13 @@ public interface MsCaseLogRecordMapper extends Mapper<MsCaseLogRecord> {
33 34
 
34 35
     @Select("SELECT group_concat( DISTINCT t.createNickName) createNickName,t.nodeName content,t.nodeId,t.sort ,t.caseStatusName  FROM (SELECT l.create_nick_name createNickName ,f.node_name nodeName,f.node_id nodeId, f.sort, f.case_status_name caseStatusName FROM ms_case_log_record l left join ms_case_flow f on l.case_node  = f.node_id WHERE l.case_appli_id  = #{caseAppliId} and f.node_name is not null ) t group by t.nodeName,t.nodeId,t.sort ,t.caseStatusName   order by t.sort ")
35 36
     List<MsCaseLogRecordVO> selectCaseLogRecordListCaseProgress(Long caseAppliId);
37
+
38
+    /**
39
+     * 根据案件id查询结束时间
40
+     * @param caseAppliId
41
+     * @param caseStatusName
42
+     * @return
43
+     */
44
+    @Select("SELECT create_time endTime  FROM  ms_case_log_record where case_appli_id=#{caseAppliId} and case_status_name=#{caseStatusName} order by create_time desc limit 1")
45
+    Date selectEndTimeByCaseId(@Param("caseAppliId") Long caseAppliId, @Param("caseStatusName") String caseStatusName);
36 46
 }

+ 2
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java Целия файл

@@ -161,6 +161,8 @@ public class WeChatUserServiceImpl implements WeChatUserService {
161 161
             sysUser.setPhonenumber(ientityAuthentication.getPhone());
162 162
             sysUser.setEmail(ientityAuthentication.getEmail());
163 163
             sysUser.setCreateBy(ientityAuthentication.getUserName());
164
+            sysUser.setIdType(ientityAuthentication.getIdType());
165
+            sysUser.setNationality(ientityAuthentication.getNationality());
164 166
             sysUser.setPassword(SecurityUtils.encryptPassword(ientityAuthentication.getPassWord()));
165 167
             int row = sysUserMapper.insertUser(sysUser);
166 168
             if(row<1) {

+ 16
- 2
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java Целия файл

@@ -40,14 +40,27 @@ public interface MsCaseApplicationService {
40 40
      * @param id
41 41
      * @return
42 42
      */
43
-    MsCaseApplicationVO selectById(Long id);
43
+    MsCaseApplicationVO selectById(Long id ,String caseNum );
44 44
 
45 45
     /**
46 46
      * 新增案件
47 47
      * @param caseApplication
48 48
      * @return
49 49
      */
50
-    int insert(MsCaseApplicationVO caseApplication);
50
+    String insert(MsCaseApplicationVO caseApplication);
51
+
52
+    /**
53
+     * 新增案件
54
+     * @param caseApplication
55
+     * @param caseFlow
56
+     */
57
+     String insert(MsCaseApplicationVO caseApplication, MsCaseFlow caseFlow);
58
+    /**
59
+     * 批量新增案件
60
+     * @param vo
61
+     * @return
62
+     */
63
+    AjaxResult batchInsert(MsCaseBatchInsertVO vo);
51 64
     /**
52 65
      * 新增用户
53 66
      * @param affiliate
@@ -243,4 +256,5 @@ public interface MsCaseApplicationService {
243 256
      */
244 257
     List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord);
245 258
 
259
+
246 260
 }

+ 158
- 69
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java Целия файл

@@ -158,22 +158,20 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
158 158
      */
159 159
     @Override
160 160
     public List<MsCaseApplicationVO> list(MsCaseApplicationReq req) {
161
-        // admin查询所有案件
162
-        if (StrUtil.equals(SecurityUtils.getUsername(), "admin")) {
163
-            startPage();
164
-            List<MsCaseApplicationVO> list = msCaseApplicationMapper.list(req, null);
165
-            for (MsCaseApplicationVO vo : list) {
166
-                    vo.setSignButtonFlag(0);
167
-            }
168
-            return list;
169
-        }
161
+
170 162
         // 根据用户查询角色
171 163
         LoginUser loginUser = SecurityUtils.getLoginUser();
172 164
         // 根据id查询用户
173 165
         SysUser sysUser = sysUserMapper.selectUserById(loginUser.getUserId());
174 166
         List<SysRole> roles = loginUser.getUser().getRoles();
175
-        if (CollectionUtil.isEmpty(roles)) {
176
-            throw new ServiceException("该用户未指定角色");
167
+        if (StrUtil.equals(SecurityUtils.getUsername(), "admin")||CollectionUtil.isEmpty(roles)) {
168
+            // 如果角色为空,按admin处理,查所有案件
169
+            startPage();
170
+            List<MsCaseApplicationVO> list = msCaseApplicationMapper.list(req, null);
171
+            for (MsCaseApplicationVO vo : list) {
172
+                vo.setSignButtonFlag(0);
173
+            }
174
+            return list;
177 175
         }
178 176
         req.setUserName(SecurityUtils.getUsername());
179 177
         req.setContactTelphoneAgent(sysUser.getPhonenumber());
@@ -353,10 +351,29 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
353 351
         return vo;
354 352
     }
355 353
 
354
+    /**
355
+     * 根据案件id或者案件编号查询详情
356
+     * @param id
357
+     * @param caseNum
358
+     * @param
359
+     * @return
360
+     */
356 361
     @Override
357
-    public MsCaseApplicationVO selectById(Long id) {
362
+    public MsCaseApplicationVO selectById(Long id,String caseNum ) {
363
+        // 根据案件id或者案件编号查询详情
358 364
         MsCaseApplicationVO vo = new MsCaseApplicationVO();
359
-        MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id);
365
+        MsCaseApplication caseApplication = null;
366
+        if(id!=null) {
367
+             caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id);
368
+        }else {
369
+            // 根据案件编号查
370
+            Example example = new Example(MsCaseApplication.class);
371
+            example.createCriteria().andEqualTo("caseNum", caseNum);
372
+            caseApplication = msCaseApplicationMapper.selectOneByExample(example);
373
+        }
374
+        if(caseApplication==null){
375
+            return vo;
376
+        }
360 377
         BeanUtil.copyProperties(caseApplication, vo);
361 378
         // 查询案件相关人员
362 379
         MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(id);
@@ -369,6 +386,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
369 386
         vo.setColumnValueList(columnValueVOS);
370 387
         // 查询拒绝原因
371 388
         vo.setReason(auditMapper.selectByCaseId(id,caseApplication.getCaseFlowId()));
389
+        // todo 在日志表查詢结束时间返回
390
+        vo.setEndTime(caseLogRecordMapper.selectEndTimeByCaseId(caseApplication.getId(),"结束"));
372 391
         return vo;
373 392
     }
374 393
 
@@ -380,21 +399,36 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
380 399
      */
381 400
     @Transactional
382 401
     @Override
383
-    public int insert(MsCaseApplicationVO caseApplication) {
384
-        if (caseApplication.getId() == null) {
385
-            caseApplication.setId(IdWorkerUtil.getId());
386
-        }
402
+    public String insert(MsCaseApplicationVO caseApplication) {
387 403
 
388
-        // 根据角色获取案件流程
389
-        List<MsCaseFlow> caseFlows=  selectCaseFlows();
404
+
405
+        // todo 第三方调用该接口,未绑定角色,暂时不根据角色查询流程,根据角色获取案件流程
406
+       /** List<MsCaseFlow> caseFlows=  selectCaseFlows();
390 407
         if (CollectionUtil.isEmpty(caseFlows)) {
391
-            throw new ServiceException("该角色绑定案件流程");
408
+            throw new ServiceException("该角色绑定案件流程");
392 409
         }
410
+        */
393 411
         // 设置模板id,根据机构代码查询模板
394
-        Long templateId =  templateManageMapper.selectByCreditCode(creditCode);
412
+        Long templateId = getTemplate();
395 413
         caseApplication.setTemplateId(templateId);
414
+        // 获取第一个流程节点
415
+        MsCaseFlow caseFlow =  getCaseFlow();
416
+        return   insert(caseApplication,caseFlow);
396 417
 
397
-        MsCaseFlow caseFlow = caseFlows.get(0);
418
+    }
419
+
420
+    /**
421
+     * 新增案件
422
+     * @param caseApplication
423
+     * @param caseFlow
424
+     * @return
425
+     */
426
+    @Transactional
427
+    @Override
428
+    public String insert(MsCaseApplicationVO caseApplication, MsCaseFlow caseFlow) {
429
+        if (caseApplication.getId() == null) {
430
+            caseApplication.setId(IdWorkerUtil.getId());
431
+        }
398 432
         caseApplication.setCaseStatusName(caseFlow.getCaseStatusName());
399 433
         caseApplication.setCaseFlowId(caseFlow.getId());
400 434
         caseApplication.setCreateTime(new Date());
@@ -416,51 +450,51 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
416 450
         if (msCaseApplicationMapper.insertSelective(caseApplication) > 0) {
417 451
             List<MsCaseAttach> caseAttachList = caseApplication.getCaseAttachList();
418 452
             // 保存案件相关人员
419
-                // 设置申请机构
420
-                if (StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==1) {
421
-                    // 组装申请机构
422
-                   // insertDept(affiliate);
423
-                    // 新增申请机构和代理人
424
-                    caseApplicationService.insertAgentUser(affiliate);
425
-                }else if(StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==0){
426
-                    // 查询申请人角色id
427
-                    Long roleId = roleMapper.selectRoleIdByName("申请人");
428
-                    caseApplicationService.insertApplicantUser(affiliate,false,roleId);
429
-                    caseApplicationService.insertApplicantUser(affiliate,true,roleId);
430
-
453
+            // 设置申请机构
454
+            if (StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==1) {
455
+                // 组装申请机构
456
+                // insertDept(affiliate);
457
+                // 新增申请机构和代理人
458
+                caseApplicationService.insertAgentUser(affiliate);
459
+            }else if(StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==0){
460
+                // 查询申请人角色id
461
+                Long roleId = roleMapper.selectRoleIdByName("申请人");
462
+                caseApplicationService.insertApplicantUser(affiliate,false,roleId);
463
+                caseApplicationService.insertApplicantUser(affiliate,true,roleId);
431 464
 
432
-                }
433
-                // 压缩包导入,则根据身份证号获取性别和出生日期
434
-                if (caseApplication.isImportFlag() && StrUtil.isNotEmpty(affiliate.getRespondentIdentityNum())) {
435
-                    setBirthByIdentityNum(affiliate);
436
-                }
437
-                if (StrUtil.isNotEmpty(affiliate.getAgentEmail())) {
438
-                    affiliate.setAgentEmail(affiliate.getAgentEmail().replace("\n", "").replaceAll("\\s", ""));
439
-                }
440
-                if (StrUtil.isNotEmpty(affiliate.getRespondentEmail())) {
441
-                    affiliate.setRespondentEmail(affiliate.getRespondentEmail().replace("\n", "").replaceAll("\\s", ""));
442
-                }
443
-                    msCaseAffiliateMapper.insert(affiliate);
444
-                     // 批量生成调解申请书
445
-                    MsCaseApplicationReq req = new MsCaseApplicationReq();
446
-                        req.setCaseFlowId(caseFlow.getId());
447
-                    if(!caseApplication.isImportFlag()) {
448
-                      req.setId(caseApplication.getId());
449
-                    }else {
450
-                        // 压缩包导入
451
-                        req.setBatchNumber(caseApplication.getBatchNumber());
452
-                    }
453
-                    // 生成调解申请书
454
-                    if(affiliate.getOrganizeFlag()==0){
455
-                        // 自然人
456
-                        req.setTemplateType(TemplateTypeEnum.PERSON_MEDIATION_APPLICATION.getCode());
457
-                    }else {
458
-                        // 机构
459
-                        req.setTemplateType(TemplateTypeEnum.MEDIATION_APPLICATION.getCode());
460
-                    }
461
-                    req.setTemplateId(String.valueOf(templateId));
462 465
 
463
-                    caseApplicationService.generateApplication(req);
466
+            }
467
+            // 压缩包导入,则根据身份证号获取性别和出生日期
468
+            if (caseApplication.isImportFlag() && StrUtil.isNotEmpty(affiliate.getRespondentIdentityNum())) {
469
+                setBirthByIdentityNum(affiliate);
470
+            }
471
+            if (StrUtil.isNotEmpty(affiliate.getAgentEmail())) {
472
+                affiliate.setAgentEmail(affiliate.getAgentEmail().replace("\n", "").replaceAll("\\s", ""));
473
+            }
474
+            if (StrUtil.isNotEmpty(affiliate.getRespondentEmail())) {
475
+                affiliate.setRespondentEmail(affiliate.getRespondentEmail().replace("\n", "").replaceAll("\\s", ""));
476
+            }
477
+            msCaseAffiliateMapper.insert(affiliate);
478
+            // 批量生成调解申请书
479
+            MsCaseApplicationReq req = new MsCaseApplicationReq();
480
+            req.setCaseFlowId(caseFlow.getId());
481
+            if(!caseApplication.isImportFlag()) {
482
+                req.setId(caseApplication.getId());
483
+            }else {
484
+                // 压缩包导入
485
+                req.setBatchNumber(caseApplication.getBatchNumber());
486
+            }
487
+            // 生成调解申请书
488
+            if(affiliate.getOrganizeFlag()==0){
489
+                // 自然人
490
+                req.setTemplateType(TemplateTypeEnum.PERSON_MEDIATION_APPLICATION.getCode());
491
+            }else {
492
+                // 机构
493
+                req.setTemplateType(TemplateTypeEnum.MEDIATION_APPLICATION.getCode());
494
+            }
495
+            req.setTemplateId(String.valueOf(caseApplication.getTemplateId()));
496
+            // todo 部署放开
497
+            caseApplicationService.generateApplication(req);
464 498
             // 保存案件附件
465 499
             if (CollectionUtil.isNotEmpty(caseAttachList)) {
466 500
                 for (MsCaseAttach caseAttach : caseAttachList) {
@@ -482,10 +516,61 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
482 516
                 columnValueMapper.batchSave(columnValueList);
483 517
             }
484 518
             CaseLogUtils.insertCaseLog(caseApplication.getId(), 0, "新增案件", "");
485
-            return 1;
519
+            return caseApplication.getCaseNum();
520
+        }
521
+
522
+        return "";
523
+    }
524
+
525
+    /**
526
+     * 获取第一个流程节点
527
+     * @return
528
+     */
529
+    private MsCaseFlow getCaseFlow() {
530
+
531
+        //  查询所有流程节点
532
+        Example flowExample = new Example(MsCaseFlow.class);
533
+        flowExample.setOrderByClause("sort asc");
534
+        List<MsCaseFlow> caseFlows = caseFlowMapper.selectByExample(flowExample);
535
+        if (CollectionUtil.isEmpty(caseFlows)) {
536
+            throw new ServiceException("请先配置流程");
486 537
         }
538
+        return caseFlows.get(0);
539
+    }
540
+
541
+    /**
542
+     * 获取模板id
543
+     * @return
544
+     */
545
+    private Long getTemplate() {
487 546
 
488
-        return 0;
547
+       return templateManageMapper.selectByCreditCode(creditCode);
548
+    }
549
+
550
+    /**
551
+     * 批量新增
552
+     * @param vo
553
+     * @return
554
+     */
555
+    @Transactional
556
+    @Override
557
+    public AjaxResult batchInsert(MsCaseBatchInsertVO vo) {
558
+        if(CollectionUtil.isEmpty(vo.getList())){
559
+            return AjaxResult.error("案件不能为空");
560
+        }
561
+        // 设置模板id,根据机构代码查询模板
562
+        Long templateId = getTemplate();
563
+        // 获取第一个流程节点
564
+        MsCaseFlow caseFlow =  getCaseFlow();
565
+        List<String> caseNumList = new ArrayList<>();
566
+        for (MsCaseApplicationVO caseApplicationVO : vo.getList()) {
567
+            caseApplicationVO.setTemplateId(templateId);
568
+            String caseNum = caseApplicationService.insert(caseApplicationVO, caseFlow);
569
+            caseNumList.add(caseNum);
570
+        }
571
+        AjaxResult success = AjaxResult.success();
572
+        success.put("caseNumList",caseNumList);
573
+        return success;
489 574
     }
490 575
 
491 576
     /**
@@ -518,6 +603,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
518 603
                 sysUser.setNickName(name);
519 604
                 sysUser.setPhonenumber(phone);
520 605
                 sysUser.setPassword(SecurityUtils.encryptPassword("abc123456"));
606
+                sysUser.setIdType(affiliate.getIdType());
607
+                sysUser.setNationality(affiliate.getNationality());
521 608
                 sysUser.setCreateBy(SecurityUtils.getUsername());
522 609
                 userMapper.insertUser(sysUser);
523 610
                 userRoleMapper.insertUserRole(sysUser.getUserId(), roleId);
@@ -565,7 +652,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
565 652
         example.createCriteria().andIn("roleid", roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()));
566 653
         List<MsCaseFlowRoleRelated> caseFlowRoleRelatedList = caseFlowRoleRelatedMapper.selectByExample(example);
567 654
         if (CollectionUtil.isEmpty(caseFlowRoleRelatedList)) {
568
-            throw new ServiceException("该角色绑定案件流程");
655
+            throw new ServiceException("该角色绑定案件流程");
569 656
         }
570 657
         Example flowExample = new Example(MsCaseFlow.class);
571 658
         flowExample.setOrderByClause("sort asc");
@@ -1672,7 +1759,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1672 1759
         if (CollectionUtil.isEmpty(users)) {
1673 1760
             return AjaxResult.error("暂无调解员");
1674 1761
         }
1675
-        // todo 根据角色查询是否已经选择了调解员进行回显
1762
+        //  根据角色查询是否已经选择了调解员进行回显
1676 1763
         List<Long> userIds = users.stream().map(SysUser::getUserId).collect(Collectors.toList());
1677 1764
         //  状态为未结束的是待办数量,结束的是已办数量
1678 1765
         Map<Long, List<MsCaseApplication>> caseMap=null;
@@ -3887,6 +3974,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
3887 3974
             agentUser.setNickName(affiliate.getNameAgent());
3888 3975
             agentUser.setPhonenumber(affiliate.getContactTelphoneAgent());
3889 3976
             agentUser.setPassword(SecurityUtils.encryptPassword("abc123456"));
3977
+            agentUser.setNationality(affiliate.getNationality());
3978
+            agentUser.setIdType(affiliate.getIdType());
3890 3979
          //   agentUser.setDeptId(Long.valueOf(affiliate.getApplicationId()));
3891 3980
             userMapper.insertUser(agentUser);
3892 3981
             userRoleMapper.insertUserRole(agentUser.getUserId(), roleId);

+ 9
- 1
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml Целия файл

@@ -9,6 +9,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
9 9
         <result property="userName"     column="user_name"    />
10 10
         <result property="nickName"     column="nick_name"    />
11 11
 		<result property="idCard"    column="id_card" />
12
+		<result property="idType"    column="id_type" />
13
+		<result property="nationality"    column="nationality" />
12 14
         <result property="email"        column="email"        />
13 15
         <result property="phonenumber"  column="phonenumber"  />
14 16
         <result property="sex"          column="sex"          />
@@ -50,7 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
50 52
 	
51 53
 	<sql id="selectUserVo">
52 54
         select u.user_id, u.user_name, u.nick_name,u.specialty, u.id_card,u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
53
-        r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,u.id_card
55
+        r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,u.id_card,u.id_type,u.nationality
54 56
         from ms_sys_user u
55 57
 		    left join ms_sys_user_role ur on u.user_id = ur.user_id
56 58
 		    left join ms_sys_role r on r.role_id = ur.role_id
@@ -200,6 +202,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
200 202
  			<if test="userName != null and userName != ''">user_name,</if>
201 203
  			<if test="nickName != null and nickName != ''">nick_name,</if>
202 204
  			<if test="idCard != null and idCard != ''">id_card,</if>
205
+ 			<if test="idType != null ">id_type,</if>
206
+ 			<if test="nationality != null ">nationality,</if>
203 207
  			<if test="email != null and email != ''">email,</if>
204 208
  			<if test="avatar != null and avatar != ''">avatar,</if>
205 209
  			<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
@@ -216,6 +220,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
216 220
             <if test="userName != null and userName != ''">#{userName},</if>
217 221
             <if test="nickName != null and nickName != ''">#{nickName},</if>
218 222
             <if test="idCard != null and idCard != ''">#{idCard},</if>
223
+            <if test="idType != null ">#{idType},</if>
224
+            <if test="nationality != null ">#{nationality},</if>
219 225
             <if test="email != null and email != ''">#{email},</if>
220 226
             <if test="avatar != null and avatar != ''">#{avatar},</if>
221 227
             <if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
@@ -272,6 +278,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
272 278
            <if test="userName != null and userName != ''">user_name = #{userName},</if>
273 279
            <if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
274 280
            <if test="idCard != null and idCard != ''">id_card = #{idCard},</if>
281
+           <if test="idType != null">id_type = #{idType},</if>
282
+           <if test="nationality != null">nationality = #{nationality},</if>
275 283
            <if test="email != null ">email = #{email},</if>
276 284
            <if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
277 285
            <if test="sex != null and sex != ''">sex = #{sex},</if>