Просмотр исходного кода

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

hejinbo 2 лет назад
Родитель
Сommit
365409ab6d

+ 14
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationLogController.java Просмотреть файл

@@ -1,5 +1,6 @@
1 1
 package com.ruoyi.web.controller.wisdomarbitrate;
2 2
 
3
+import com.ruoyi.common.annotation.Anonymous;
3 4
 import com.ruoyi.common.core.domain.AjaxResult;
4 5
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
5 6
 import com.ruoyi.wisdomarbitrate.domain.vo.UpdateSubmitVO;
@@ -89,5 +90,18 @@ public class CaseApplicationLogController {
89 90
         }
90 91
         return caseApplicationLogService.updateAudit(vo);
91 92
     }
93
+    /**
94
+     * 查询该版本及之前版本案件进行对比
95
+     * @author wangqiong
96
+     * @date 2023/11/17
97
+     **/
98
+    @Anonymous
99
+    @PostMapping("/selectCompareCase")
100
+    public AjaxResult selectCompareCase(@RequestBody UpdateSubmitVO vo){
101
+        if(vo.getCaseId()==null || vo.getVersion()==null ){
102
+            return AjaxResult.error("参数校验错误");
103
+        }
104
+        return caseApplicationLogService.selectCompareCase(vo);
105
+    }
92 106
   
93 107
 }

+ 49
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/ObjectFieldUtils.java Просмотреть файл

@@ -0,0 +1,49 @@
1
+package com.ruoyi.common.utils;
2
+
3
+import java.lang.reflect.Field;
4
+
5
+/**
6
+ * 反射工具类
7
+ */
8
+public class ObjectFieldUtils {
9
+    public static String getValue(Object obj,String fieldName){
10
+        Field field=null;
11
+        try{
12
+            field=obj.getClass().getDeclaredField(fieldName);
13
+            field.setAccessible(true);
14
+            return String.valueOf(field.get(obj)==null?"":field.get(obj));
15
+        }catch (Exception e){
16
+            if(obj.getClass().getSuperclass()!=Object.class){
17
+                try{
18
+                    field=obj.getClass().getSuperclass().getDeclaredField(fieldName);
19
+                    field.setAccessible(true);
20
+                    return String.valueOf(field.get(obj)==null?"":field.get(obj));
21
+                }catch (Exception e1){
22
+                    e.printStackTrace();
23
+                }
24
+            }
25
+            e.printStackTrace();
26
+        }
27
+        return null;
28
+    }
29
+
30
+    public static void setValue(Object obj,String fieldName,Object value){
31
+        Field field=null;
32
+        try{
33
+            field=obj.getClass().getDeclaredField(fieldName);
34
+            field.setAccessible(true);
35
+            field.set(obj,value);
36
+        }catch (Exception e){
37
+            if(obj.getClass().getSuperclass()!=Object.class){
38
+                try{
39
+                    field=obj.getClass().getSuperclass().getDeclaredField(fieldName);
40
+                    field.setAccessible(true);
41
+                    field.set(obj,value);
42
+                }catch (Exception e1){
43
+                    e.printStackTrace();
44
+                }
45
+            }
46
+            e.printStackTrace();
47
+        }
48
+    }
49
+}

+ 12
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAffiliate.java Просмотреть файл

@@ -56,6 +56,18 @@ public class CaseAffiliate   extends BaseEntity {
56 56
      * 版本号
57 57
      */
58 58
     private Integer version;
59
+    /**
60
+     * 改变的字段
61
+     */
62
+    private String changeColumn;
63
+
64
+    public String getChangeColumn() {
65
+        return changeColumn;
66
+    }
67
+
68
+    public void setChangeColumn(String changeColumn) {
69
+        this.changeColumn = changeColumn;
70
+    }
59 71
 
60 72
     public Long getCaseAppliLogId() {
61 73
         return caseAppliLogId;

+ 34
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CompareCaseVO.java Просмотреть файл

@@ -0,0 +1,34 @@
1
+package com.ruoyi.wisdomarbitrate.domain.vo;
2
+
3
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
4
+import lombok.AllArgsConstructor;
5
+import lombok.Builder;
6
+import lombok.Data;
7
+import lombok.NoArgsConstructor;
8
+
9
+import java.util.List;
10
+
11
+/**
12
+ * 案件前后对比
13
+ * @author wangqiong
14
+ */
15
+@Data
16
+@Builder
17
+@NoArgsConstructor
18
+@AllArgsConstructor
19
+public class CompareCaseVO {
20
+    /**
21
+     * 该版本前的案件
22
+     */
23
+    private CaseApplication beforeCase;
24
+    /**
25
+     * 该版本后的案件
26
+     */
27
+    private CaseApplication afterCase;
28
+    /**
29
+     * 变化字段,多个用,拼接
30
+     */
31
+    private String changeColumn;
32
+
33
+
34
+}

+ 1
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAffiliateLogMapper.java Просмотреть файл

@@ -17,7 +17,7 @@ public interface CaseAffiliateLogMapper {
17 17
     void batchDeletecaseAffiliate(@Param("ids") List<Long> ids);
18 18
 
19 19
 
20
-    List<CaseAffiliate>  selectCaseAffiliate(CaseAffiliate caseAffiliate);
20
+    List<CaseAffiliate>  selectCaseAffiliate(@Param("caseAppliLogId") Long caseAppliLogId);
21 21
     CaseAffiliate  selectCaseAffiliateByIdentityType(@Param("caseAppliLogId") Long caseAppliLogId, @Param("identityType")int identityType);
22 22
 
23 23
     int updataCaseAffiliate(CaseAffiliate caseAffiliate);

+ 1
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAffiliateMapper.java Просмотреть файл

@@ -34,5 +34,5 @@ public interface CaseAffiliateMapper {
34 34
      * 批量修改
35 35
      * @param affiliateLogList
36 36
      */
37
-    void updataCaseAffiliateByCaseId(@Param("caseAppliId")Long caseAppliId,@Param("list") List<CaseAffiliate> affiliateLogList);
37
+    void updateCaseAffiliateByCaseId(@Param("caseAppliId")Long caseAppliId,@Param("list") List<CaseAffiliate> affiliateLogList);
38 38
 }

+ 1
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/CaseApplicationLogService.java Просмотреть файл

@@ -54,4 +54,5 @@ public interface CaseApplicationLogService {
54 54
     AjaxResult updateAudit(UpdateSubmitVO vo);
55 55
 
56 56
 
57
+    AjaxResult selectCompareCase(UpdateSubmitVO vo);
57 58
 }

+ 177
- 14
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationLogServiceImpl.java Просмотреть файл

@@ -1,22 +1,30 @@
1 1
 package com.ruoyi.wisdomarbitrate.service.impl;
2 2
 
3
+import cn.hutool.core.collection.CollectionUtil;
4
+import cn.hutool.core.util.StrUtil;
3 5
 import com.ruoyi.common.core.domain.AjaxResult;
4 6
 import com.ruoyi.common.enums.UpdateSubmitStatus;
5 7
 import com.ruoyi.common.enums.YesOrNoEnum;
8
+import com.ruoyi.common.utils.ObjectFieldUtils;
9
+import com.ruoyi.common.utils.SmsUtils;
6 10
 import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
7 11
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
12
+import com.ruoyi.wisdomarbitrate.domain.SmsSendRecord;
13
+import com.ruoyi.wisdomarbitrate.domain.vo.CompareCaseVO;
8 14
 import com.ruoyi.wisdomarbitrate.domain.vo.UpdateSubmitVO;
9
-import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateLogMapper;
10
-import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper;
11
-import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationLogMapper;
12
-import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
15
+import com.ruoyi.wisdomarbitrate.mapper.*;
13 16
 import com.ruoyi.wisdomarbitrate.service.CaseApplicationLogService;
14 17
 import org.springframework.beans.factory.annotation.Autowired;
15 18
 import org.springframework.stereotype.Service;
16 19
 import org.springframework.transaction.annotation.Transactional;
17 20
 
21
+import java.util.Date;
18 22
 import java.util.List;
23
+import java.util.Map;
19 24
 import java.util.Objects;
25
+import java.util.stream.Collectors;
26
+
27
+import static com.ruoyi.common.utils.SecurityUtils.getUsername;
20 28
 
21 29
 /**
22 30
  * @author wangqiong
@@ -33,6 +41,8 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
33 41
     private CaseAffiliateLogMapper caseAffiliateLogMapper;
34 42
     @Autowired
35 43
     private CaseAffiliateMapper caseAffiliateMapper;
44
+    @Autowired
45
+    private SmsRecordMapper smsRecordMapper;
36 46
     @Override
37 47
     public int insert(CaseApplication caseApplicationLog) {
38 48
         return caseApplicationLogMapper.insert(caseApplicationLog);
@@ -70,7 +80,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
70 80
             return AjaxResult.error("案件不存在");
71 81
         }
72 82
         // 如果秘书没有审核,将撤销状态改为同意撤销,否则改为撤销
73
-        if(caseApplication.getUpdateSubmitStatus()!=null && caseApplication.getUpdateSubmitStatus()>UpdateSubmitStatus.REVOKE.getCode()){
83
+        if(caseApplication.getUpdateSubmitStatus()!=null && !caseApplication.getUpdateSubmitStatus().equals(UpdateSubmitStatus.AGREE.getCode())){
74 84
             agreeRevoke(vo);
75 85
 
76 86
         }else {
@@ -106,20 +116,25 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
106 116
                 vo.setUpdateSubmitStatus(UpdateSubmitStatus.AGREE.getCode());
107 117
                 caseApplicationLogMapper.updateStatus(vo);
108 118
                 // 根据caseLogId查询相关人员表
109
-                CaseAffiliate caseAffiliate = new CaseAffiliate();
110
-                caseAffiliate.setCaseAppliLogId(caseApplicationLog.getCaseLogId());
111
-                List<CaseAffiliate> affiliateLogList = caseAffiliateLogMapper.selectCaseAffiliate(caseAffiliate);
119
+                List<CaseAffiliate> affiliateLogList = caseAffiliateLogMapper.selectCaseAffiliate(caseApplicationLog.getCaseLogId());
112 120
                 caseApplicationLog.setId(caseApplicationLog.getCaseAppliId());
113 121
                 // 更新案件主表
114 122
                 caseApplicationMapper.updataCaseApplication(caseApplicationLog);
115 123
 
116 124
                 // 更新相关人员主表
117
-                caseAffiliateMapper.updataCaseAffiliateByCaseId(caseApplicationLog.getCaseAppliId(), affiliateLogList);
125
+                if(CollectionUtil.isNotEmpty(affiliateLogList)){
126
+                    for (CaseAffiliate caseAffiliate : affiliateLogList) {
127
+                       caseAffiliateMapper.updataCaseAffiliate(caseAffiliate);
128
+                    }
129
+                }
130
+             //   caseAffiliateMapper.updateCaseAffiliateByCaseId(caseApplicationLog.getCaseAppliId(), affiliateLogList);
118 131
             } else {
119 132
                 // 拒绝,将日志表改版本的状态改为拒绝
120 133
                 vo.setUpdateSubmitStatus(UpdateSubmitStatus.REFUSE.getCode());
121 134
                 caseApplicationLogMapper.updateStatus(vo);
122
-                // todo 给申请人发送短信
135
+               return sendAuditMessage(vo);
136
+
137
+
123 138
                 // 修改案件表的版本号
124 139
                  //  caseApplicationMapper.updateVersionById(vo.getCaseId(),vo.getVersion());
125 140
 
@@ -139,6 +154,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
139 154
                 // 拒绝撤销,将日志表改版本的状态改为拒绝撤销
140 155
                 vo.setUpdateSubmitStatus(UpdateSubmitStatus.REFUSE_REVOKE.getCode());
141 156
                 caseApplicationLogMapper.updateStatus(vo);
157
+                return sendAuditMessage(vo);
142 158
                 // 修改案件表的版本号
143 159
              //   caseApplicationMapper.updateVersionById(vo.getCaseId(),vo.getVersion());
144 160
             }
@@ -147,6 +163,150 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
147 163
        return AjaxResult.success();
148 164
     }
149 165
 
166
+    /**
167
+     * 给申请人发送短信
168
+     * @param vo
169
+     * @return
170
+     */
171
+    private AjaxResult sendAuditMessage(UpdateSubmitVO vo) {
172
+        // 查询申请人
173
+        CaseApplication logCase = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion());
174
+        if(logCase == null){
175
+            return AjaxResult.success();
176
+        }
177
+        CaseAffiliate caseAffiliate = caseAffiliateLogMapper.selectCaseAffiliateByIdentityType(logCase.getCaseLogId(), 1);
178
+        if(caseAffiliate == null){
179
+            return AjaxResult.success();
180
+        }
181
+
182
+        // todo 给申请人发送短信
183
+        SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
184
+        request.setTemplateId("1996949");
185
+        request.setPhone(caseAffiliate.getContactTelphone());
186
+        request.setTemplateParamSet(new String[]{caseAffiliate.getName(), logCase.getCaseNum(),vo.getReason()});
187
+        Boolean aBoolean = SmsUtils.sendSms(request);
188
+        //保存短信发送记录
189
+        SmsSendRecord smsSendRecord = new SmsSendRecord();
190
+        smsSendRecord.setCaseId(caseAffiliate.getCaseAppliId());
191
+        CaseApplication caseApplication = new CaseApplication();
192
+        caseApplication.setId(caseAffiliate.getCaseAppliId());
193
+        caseApplication = caseApplicationMapper.selectCaseApplication(caseApplication);
194
+        smsSendRecord.setCaseNum(caseApplication.getCaseNum());
195
+        smsSendRecord.setPhone(request.getPhone());
196
+        smsSendRecord.setSendTime(new Date());
197
+        // 1996949 审核案件结果通知 尊敬的{1}用户,您的{2}仲裁案件,审核未通过,理由为{3},请知晓,如非本人操作,请忽略本短信
198
+        String content = "尊敬的" + caseAffiliate.getName() + ",您的"+logCase.getCaseNum()+"仲裁案件,审核未通过,理由为"+vo.getReason()+",请知晓,如非本人操作,请忽略本短信。";
199
+        smsSendRecord.setSendContent(content);
200
+        smsSendRecord.setCreateBy(getUsername());
201
+        if (aBoolean) {
202
+            smsSendRecord.setSendStatus(1);
203
+        } else {
204
+            smsSendRecord.setSendStatus(0);
205
+        }
206
+        smsRecordMapper.saveSmsSendRecord(smsSendRecord);
207
+        return AjaxResult.success();
208
+    }
209
+
210
+    @Override
211
+    public AjaxResult selectCompareCase(UpdateSubmitVO vo) {
212
+        // 查询当前版本号和上一个版本号的案件
213
+        CaseApplication afterCase = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion());
214
+        CaseApplication beforeCase = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion() - 1);
215
+        // 查询案件关联人员
216
+        beforeCase.setCaseAffiliates(caseAffiliateLogMapper.selectCaseAffiliate(beforeCase.getCaseLogId()));
217
+        afterCase.setCaseAffiliates(caseAffiliateLogMapper.selectCaseAffiliate(afterCase.getCaseLogId()));
218
+        CompareCaseVO compareCaseVO = new CompareCaseVO();
219
+        compareCaseVO.setBeforeCase(beforeCase);
220
+        compareCaseVO.setAfterCase(afterCase);
221
+        // 对比两个版本修改的字段
222
+        String[] columns = {"caseLogId","caseSubjectAmount", "caseName"};
223
+        String[] affiliateColumns = {"identityNum", "workAddress"};
224
+        StringBuilder changeColumn = new StringBuilder();
225
+        for (String column : columns) {
226
+            String beforeValue = ObjectFieldUtils.getValue(beforeCase, column);
227
+            String afterValue = ObjectFieldUtils.getValue(afterCase, column);
228
+            if (StrUtil.isEmpty(beforeValue) && StrUtil.isNotEmpty(afterValue)) {
229
+                changeColumn.append(column).append(",");
230
+                continue;
231
+            }
232
+            if (StrUtil.isNotEmpty(beforeValue) && StrUtil.isEmpty(afterValue)) {
233
+                changeColumn.append(column).append(",");
234
+                continue;
235
+            }
236
+            if (StrUtil.isNotEmpty(beforeValue) && StrUtil.isNotEmpty(afterValue) && !Objects.equals(beforeValue, afterValue)) {
237
+                changeColumn.append(column).append(",");
238
+                continue;
239
+
240
+            }
241
+
242
+        }
243
+        List<CaseAffiliate> beforeCaseCaseAffiliates = beforeCase.getCaseAffiliates();
244
+        List<CaseAffiliate> afterCaseCaseAffiliates = afterCase.getCaseAffiliates();
245
+        Map<Integer, CaseAffiliate> beforeCaseCaseAffiliateMap = null;
246
+        if (CollectionUtil.isNotEmpty(beforeCaseCaseAffiliates)) {
247
+            // 转为map
248
+            beforeCaseCaseAffiliateMap = beforeCaseCaseAffiliates.stream().collect(Collectors.toMap(CaseAffiliate::getIdentityType, v -> v, (n1, n2) -> n2));
249
+        }
250
+        StringBuilder affiliateChangeColumn;
251
+        // 如果上一个版本和现版本有一个为空,那么所有字段都修改
252
+        if (beforeCaseCaseAffiliates != null && afterCaseCaseAffiliates == null) {
253
+            affiliateChangeColumn = new StringBuilder();
254
+            for (String column : affiliateColumns) {
255
+
256
+                affiliateChangeColumn.append(column).append(",");
257
+            }
258
+
259
+        }
260
+        else if (beforeCaseCaseAffiliates == null && afterCaseCaseAffiliates != null) {
261
+            affiliateChangeColumn = new StringBuilder();
262
+            for (String column : affiliateColumns) {
263
+
264
+                affiliateChangeColumn.append(column).append(",");
265
+            }
266
+        } else if (beforeCaseCaseAffiliates != null && afterCaseCaseAffiliates != null) {
267
+            for (CaseAffiliate afterCaseCaseAffiliate : afterCaseCaseAffiliates) {
268
+                // 找到相同身份类型的数据,进行对比
269
+                affiliateChangeColumn = new StringBuilder();
270
+                int identityType = afterCaseCaseAffiliate.getIdentityType();
271
+                if (beforeCaseCaseAffiliateMap != null && beforeCaseCaseAffiliateMap.containsKey(identityType)) {
272
+                    CaseAffiliate beforeCaseCaseAffiliate = beforeCaseCaseAffiliateMap.get(identityType);
273
+                    for (String column : affiliateColumns) {
274
+                        String beforeValue = ObjectFieldUtils.getValue(beforeCaseCaseAffiliate, column);
275
+                        String afterValue = ObjectFieldUtils.getValue(afterCaseCaseAffiliate, column);
276
+                        if (StrUtil.isEmpty(beforeValue) && StrUtil.isNotEmpty(afterValue)) {
277
+                            affiliateChangeColumn.append(column).append(",");
278
+                            continue;
279
+                        }
280
+                        if (StrUtil.isNotEmpty(beforeValue) && StrUtil.isEmpty(afterValue)) {
281
+                            affiliateChangeColumn.append(column).append(",");
282
+                            continue;
283
+                        }
284
+                        if (StrUtil.isNotEmpty(beforeValue) && StrUtil.isNotEmpty(afterValue) && !Objects.equals(beforeValue, afterValue)) {
285
+                            affiliateChangeColumn.append(column).append(",");
286
+                            continue;
287
+
288
+                        }
289
+
290
+                    }
291
+
292
+
293
+                } else {
294
+                    for (String column : affiliateColumns) {
295
+
296
+                        affiliateChangeColumn.append(column).append(",");
297
+                    }
298
+                }
299
+                afterCaseCaseAffiliate.setChangeColumn(affiliateChangeColumn.toString());
300
+
301
+            }
302
+
303
+
304
+        }
305
+        compareCaseVO.setChangeColumn(changeColumn.toString());
306
+
307
+        return AjaxResult.success(compareCaseVO);
308
+    }
309
+
150 310
     /**
151 311
      * 同意撤销
152 312
      * @param vo
@@ -161,14 +321,17 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
161 321
         vo.setUpdateSubmitStatus(UpdateSubmitStatus.AGREE_REVOKE.getCode());
162 322
         caseApplicationLogMapper.updateStatus(vo);
163 323
         // 根据caseLogId查询相关人员表
164
-        CaseAffiliate caseAffiliate = new CaseAffiliate();
165
-        caseAffiliate.setCaseAppliLogId(caseApplicationLog.getCaseLogId());
166
-        List<CaseAffiliate> affiliateLogList = caseAffiliateLogMapper.selectCaseAffiliate(caseAffiliate);
324
+        List<CaseAffiliate> affiliateLogList = caseAffiliateLogMapper.selectCaseAffiliate(caseApplicationLog.getCaseLogId());
167 325
         caseApplicationLog.setId(caseApplicationLog.getCaseAppliId());
168 326
         // 更新案件主表
169 327
         caseApplicationMapper.updataCaseApplication(caseApplicationLog);
170 328
 
171 329
         // 更新相关人员主表
172
-        caseAffiliateMapper.updataCaseAffiliateByCaseId(caseApplicationLog.getCaseAppliId(), affiliateLogList);
330
+        if(CollectionUtil.isNotEmpty(affiliateLogList)){
331
+            for (CaseAffiliate caseAffiliate : affiliateLogList) {
332
+                caseAffiliateMapper.updataCaseAffiliate(caseAffiliate);
333
+            }
334
+        }
335
+       // caseAffiliateMapper.updateCaseAffiliateByCaseId(caseApplicationLog.getCaseAppliId(), affiliateLogList);
173 336
     }
174 337
 }

+ 23
- 6
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java Просмотреть файл

@@ -188,6 +188,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
188 188
                     caseApplication.setDeptIds(deptIds);
189 189
                 }
190 190
                 if ("申请人".equals(role.getRoleName())) {
191
+                    caseApplication.setIsOtherRole(1);
191 192
                     // 查询有关的用户部门
192 193
                     caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
193 194
                 }
@@ -263,6 +264,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
263 264
                 caseApplication.setDeptIds(deptIds);
264 265
             }
265 266
             if ("申请人".equals(role.getRoleName())) {
267
+                caseApplication.setIsOtherRole(1);
266 268
                 // 查询角色有关的用户部门
267 269
                 caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
268 270
             }
@@ -1084,7 +1086,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1084 1086
         }
1085 1087
         caseApplication.setVersion(maxVersion+1);
1086 1088
         // 将修改提交状态改为未提交
1087
-        caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
1089
+       // caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
1088 1090
         // 修改案件表的版本号
1089 1091
      //   caseApplicationMapper.updateVersionById(caseApplication.getId(),caseApplication.getVersion());
1090 1092
 
@@ -1233,7 +1235,16 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1233 1235
 
1234 1236
     @Override
1235 1237
     public CaseApplication selectCaseApplication(CaseApplication caseApplication) {
1236
-        CaseApplication caseApplicationselect=caseApplicationLogMapper.selectByCaseIdAndVersion(caseApplication.getId(),caseApplication.getVersion());
1238
+        CaseApplication caseApplicationselect=new CaseApplication();
1239
+        if(caseApplication.getVersion()!=null) {
1240
+             caseApplicationselect=caseApplicationLogMapper.selectByCaseIdAndVersion(caseApplication.getId(),caseApplication.getVersion());
1241
+
1242
+        }
1243
+        else {
1244
+             caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
1245
+
1246
+
1247
+        }
1237 1248
         caseApplicationselect.setId(caseApplication.getId());
1238 1249
 
1239 1250
 
@@ -1264,9 +1275,16 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1264 1275
             }
1265 1276
         }
1266 1277
         caseApplicationselect.setCaseAttachList(caseAttachList);
1267
-        CaseAffiliate caseAffiliateLog = new CaseAffiliate();
1268
-        caseAffiliateLog.setCaseAppliLogId(caseApplicationselect.getCaseLogId());
1269
-        List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateLogMapper.selectCaseAffiliate(caseAffiliateLog);
1278
+        List<CaseAffiliate> caseAffiliatListeselect;
1279
+        if(caseApplication.getVersion()!=null) {
1280
+            caseAffiliatListeselect = caseAffiliateLogMapper.selectCaseAffiliate(caseApplicationselect.getCaseLogId());
1281
+
1282
+        }else {
1283
+            CaseAffiliate caseAffiliate = new CaseAffiliate();
1284
+            caseAffiliate.setCaseAppliId(caseApplication.getId());
1285
+            caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
1286
+        }
1287
+
1270 1288
         if (caseAffiliatListeselect != null) {
1271 1289
             // 查询组织机构
1272 1290
             List<SysDept> sysDepts = sysDeptMapper.selectDeptList(new SysDept());
@@ -1289,7 +1307,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1289 1307
                     ;
1290 1308
                 } else if (identityType == 2) {
1291 1309
                     respondentName.append(caseAffiliateselect.getName()).append(",");
1292
-                    ;
1293 1310
                 }
1294 1311
             }
1295 1312
             caseApplicationselect.setApplicantName(applicantName.toString());

+ 1
- 1
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml Просмотреть файл

@@ -120,7 +120,7 @@
120 120
 
121 121
             application_organ_id= #{item.applicationOrganId},
122 122
             application_organ_name= #{item.applicationOrganName},
123
-            name = #{name},
123
+            name = #{item.name},
124 124
             identity_num = #{item.identityNum},
125 125
             contact_telphone = #{item.contactTelphone},
126 126
             contact_address = #{item.contactAddress},

+ 109
- 97
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml Просмотреть файл

@@ -58,7 +58,7 @@
58 58
         t1.filearbitra_url,t1.lock_status,t1.version,t1.updateSubmitStatus
59 59
         from(
60 60
         <trim suffixOverrides="union">
61
-                <!--被申请人,仲裁员,部门长,财务,代理人案件-->
61
+                <!--申请人,被申请人,仲裁员,部门长,财务,代理人案件-->
62 62
             <if test="isOtherRole!=null and isOtherRole==1">
63 63
 
64 64
                 select t.id,t.caseLogId,t.case_num ,t.case_subject_amount ,t.register_date ,t.arbitrat_method,
@@ -125,7 +125,13 @@
125 125
                         and
126 126
                         instr (t.arbitrator_id,#{userId})>0)
127 127
                     </if>
128
+                    <!--申请人-->
129
+                    <if test="applicationOrganId != null and applicationOrganId != ''">
130
+                        or ( t.application_organ_id = #{applicationOrganId} AND t.identity_type=1
131
+                        <!--暂时改为可以查询到生成裁决书之前所有的案件状态-->
132
+                        and (t.case_status &lt;= 10 or t.case_status=31))
128 133
 
134
+                    </if>
129 135
                     <!--部门长-->
130 136
                     <if test="deptHeadStatus != null and deptHeadStatus.size() > 0">
131 137
                         or (t.identity_type=1 and t.case_status in
@@ -152,61 +158,61 @@
152 158
                 </where>
153 159
                 union
154 160
             </if>
155
-            <if test="applicationOrganId != null and applicationOrganId != ''">
161
+<!--            <if test="applicationOrganId != null and applicationOrganId != ''">-->
156 162
 
157 163
 
158
-                <!--申请人案件-->
159
-                select c.id ,l.id AS caseLogId,c.case_num ,l.case_subject_amount ,c.register_date ,c.arbitrat_method ,
160
-                CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
161
-                ELSE '无审理方式'
162
-                END arbitratMethodName,
163
-                c.case_status ,
164
-                CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
165
-                when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
166
-                when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
167
-                when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
168
-                when 12 then '待审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'
169
-                when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'
170
-                when 31 then '待修改开庭时间'
171
-                ELSE '无案件状态'
172
-                END caseStatusName,
173
-                c.hear_date ,l.arbitrat_claims ,
174
-                l.loan_start_date ,l.loan_end_date ,l.claim_princi_owed ,l.claim_interest_owed ,l.claim_liquid_damag
175
-                ,l.fee_payable ,
176
-                c.begin_video_date ,c.online_video_person ,l.contract_number ,c.create_by ,c.create_time ,
177
-                c.update_by ,c.update_time , c.arbitrator_name,ca.name,ca.application_organ_id,ca.application_organ_name
178
-                as
179
-                applicantName,
180
-                c.arbitrator_id,ca.identity_num , ca.identity_type,c.filearbitra_url,c.lock_status,l.version,l.update_submit_status as updateSubmitStatus
181
-                from case_application c
182
-                JOIN case_application_log l ON c.id = l.case_appli_id
183
-                JOIN case_affiliate_log ca ON ca.case_appli_log_id = l.id AND ca.identity_type = 1
184
-
185
-                <where>
186
-                    (c.case_status &lt;= 10 or c.case_status=31) AND ca.identity_type=1
187
-                    and l.version=(SELECT
188
-                    max( version ) version
189
-                    FROM
190
-                    case_application_log where case_appli_id = c.id and update_submit_status not in(4,5))
191
-                    <if test="applicationOrganId != null and applicationOrganId != ''">
192
-                        AND ca.application_organ_id = #{applicationOrganId}
193
-                    </if>
194
-                    <if test="caseStatus != null">
195
-                        AND c.case_status = #{caseStatus}
196
-                    </if>
197
-                    <if test="caseNum != null and caseNum != ''">
198
-                        AND c.case_num = #{caseNum}
199
-                    </if>
200
-                    <if test="nameId != null and nameId != ''">
201
-                        AND ca.application_organ_id=#{nameId}
202
-                    </if>
164
+<!--                &lt;!&ndash;申请人案件&ndash;&gt;-->
165
+<!--                select c.id ,l.id AS caseLogId,c.case_num ,l.case_subject_amount ,c.register_date ,c.arbitrat_method ,-->
166
+<!--                CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'-->
167
+<!--                ELSE '无审理方式'-->
168
+<!--                END arbitratMethodName,-->
169
+<!--                c.case_status ,-->
170
+<!--                CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'-->
171
+<!--                when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'-->
172
+<!--                when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'-->
173
+<!--                when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'-->
174
+<!--                when 12 then '待审核仲裁文书' when 13 then '待仲裁文书签名' when 14 then '待仲裁文书用印'-->
175
+<!--                when 15 then '待仲裁文书送达' when 16 then '待案件归档' when 17 then '已归档'-->
176
+<!--                when 31 then '待修改开庭时间'-->
177
+<!--                ELSE '无案件状态'-->
178
+<!--                END caseStatusName,-->
179
+<!--                c.hear_date ,l.arbitrat_claims ,-->
180
+<!--                l.loan_start_date ,l.loan_end_date ,l.claim_princi_owed ,l.claim_interest_owed ,l.claim_liquid_damag-->
181
+<!--                ,l.fee_payable ,-->
182
+<!--                c.begin_video_date ,c.online_video_person ,l.contract_number ,c.create_by ,c.create_time ,-->
183
+<!--                c.update_by ,c.update_time , c.arbitrator_name,ca.name,ca.application_organ_id,ca.application_organ_name-->
184
+<!--                as-->
185
+<!--                applicantName,-->
186
+<!--                c.arbitrator_id,ca.identity_num , ca.identity_type,c.filearbitra_url,c.lock_status,l.version,l.update_submit_status as updateSubmitStatus-->
187
+<!--                from case_application c-->
188
+<!--                JOIN case_application_log l ON c.id = l.case_appli_id-->
189
+<!--                JOIN case_affiliate_log ca ON ca.case_appli_log_id = l.id AND ca.identity_type = 1-->
190
+
191
+<!--                <where>-->
192
+<!--                    (c.case_status &lt;= 10 or c.case_status=31) AND ca.identity_type=1-->
193
+<!--                    and l.version=(SELECT-->
194
+<!--                    max( version ) version-->
195
+<!--                    FROM-->
196
+<!--                    case_application_log where case_appli_id = c.id and update_submit_status not in(4,5))-->
197
+<!--                    <if test="applicationOrganId != null and applicationOrganId != ''">-->
198
+<!--                        AND ca.application_organ_id = #{applicationOrganId}-->
199
+<!--                    </if>-->
200
+<!--                    <if test="caseStatus != null">-->
201
+<!--                        AND c.case_status = #{caseStatus}-->
202
+<!--                    </if>-->
203
+<!--                    <if test="caseNum != null and caseNum != ''">-->
204
+<!--                        AND c.case_num = #{caseNum}-->
205
+<!--                    </if>-->
206
+<!--                    <if test="nameId != null and nameId != ''">-->
207
+<!--                        AND ca.application_organ_id=#{nameId}-->
208
+<!--                    </if>-->
203 209
 
204
-                    <if test="lockStatus != null">
205
-                        AND c.lock_status = #{lockStatus}
206
-                    </if>
207
-                </where>
208
-                union
209
-            </if>
210
+<!--                    <if test="lockStatus != null">-->
211
+<!--                        AND c.lock_status = #{lockStatus}-->
212
+<!--                    </if>-->
213
+<!--                </where>-->
214
+<!--                union-->
215
+<!--            </if>-->
210 216
             <!--秘书案件-->
211 217
             <if test="deptIds != null and deptIds.size() > 0">
212 218
 
@@ -300,9 +306,15 @@
300 306
                 FROM
301 307
                 case_application_log
302 308
                 WHERE case_appli_id = c.id
303
-                and update_submit_status not IN ( 1, 2 ))
309
+                 )
304 310
                 WHERE
305 311
                 ca.identity_type=1 and c.case_status in (1,5,11,15,16,17,31)
312
+                <if test="caseStatusList != null and caseStatusList.size() > 0">
313
+                    and c.case_status in
314
+                    <foreach item="caseStatus" collection="caseStatusList" open="(" separator="," close=")">
315
+                        #{caseStatus}
316
+                    </foreach>
317
+                </if>
306 318
                 <if test="deptIds != null and deptIds.size() > 0">
307 319
                     and ca.application_organ_id in
308 320
                     <foreach item="item" collection="deptIds" open="(" separator="," close=")">
@@ -435,7 +447,7 @@
435 447
                 FROM
436 448
                 case_application_log
437 449
                 WHERE
438
-                update_submit_status IN ( 1, 2 ) and c.id = l.case_appli_id)
450
+                update_submit_status IN ( 1, 2 ) and c.id = case_appli_id)
439 451
             </if>
440 452
         </trim>
441 453
         ) t1
@@ -667,13 +679,13 @@
667 679
 <!--                </foreach> )-->
668 680
 <!--            </if>-->
669 681
             <!--申请人-->
670
-<!--            <if test="applicationOrganId != null and applicationOrganId != ''">-->
671
-<!--                or ( t.application_organ_id = #{applicationOrganId} AND t.identity_type=1-->
672
-<!--                &lt;!&ndash;暂时改为可以查询到生成裁决书之前所有的案件状态&ndash;&gt;-->
673
-<!--                and (t.case_status &lt;= 10 or t.case_status=31))-->
674
-<!--            &lt;!&ndash; and t.case_status in (0,2,17))&ndash;&gt;-->
682
+            <if test="applicationOrganId != null and applicationOrganId != ''">
683
+                or ( t.application_organ_id = #{applicationOrganId} AND t.identity_type=1
684
+                <!--暂时改为可以查询到生成裁决书之前所有的案件状态-->
685
+                and (t.case_status &lt;= 10 or t.case_status=31))
686
+            <!-- and t.case_status in (0,2,17))-->
675 687
 
676
-<!--         </if>-->
688
+         </if>
677 689
          <!--部门长-->
678 690
             <if test="deptHeadStatus != null and deptHeadStatus.size() > 0">
679 691
                 or (t.identity_type=1 and t.case_status in
@@ -699,40 +711,40 @@
699 711
         </where>
700 712
             union
701 713
         </if>
702
-            <if test="applicationOrganId != null and applicationOrganId != ''">
703
-                <!--申请人案件-->
704
-
705
-                select l.case_appli_id id ,
706
-                c.case_status,ca.application_organ_id,
707
-                c.arbitrator_id,ca.identity_num , ca.identity_type
708
-                from case_application c
709
-                JOIN case_application_log l ON c.id = l.case_appli_id
710
-                JOIN case_affiliate_log ca ON ca.case_appli_log_id = l.id AND ca.identity_type = 1
711
-                <where>
712
-                    (c.case_status &lt;= 10 or c.case_status=31) AND ca.identity_type=1
713
-                    and l.version=(SELECT
714
-                    max( version ) version
715
-                    FROM
716
-                    case_application_log where case_appli_id = c.id and update_submit_status not in(4,5))
717
-                    <if test="applicationOrganId != null and applicationOrganId != ''">
718
-                        AND ca.application_organ_id = #{applicationOrganId}
719
-                    </if>
720
-                    <if test="caseStatus != null">
721
-                        AND c.case_status = #{caseStatus}
722
-                    </if>
723
-                    <if test="caseNum != null and caseNum != ''">
724
-                        AND c.case_num = #{caseNum}
725
-                    </if>
726
-                    <if test="nameId != null and nameId != ''">
727
-                        AND ca.application_organ_id=#{nameId}
728
-                    </if>
714
+<!--            <if test="applicationOrganId != null and applicationOrganId != ''">-->
715
+<!--                &lt;!&ndash;申请人案件&ndash;&gt;-->
716
+
717
+<!--                select l.case_appli_id id ,-->
718
+<!--                c.case_status,ca.application_organ_id,-->
719
+<!--                c.arbitrator_id,ca.identity_num , ca.identity_type-->
720
+<!--                from case_application c-->
721
+<!--                JOIN case_application_log l ON c.id = l.case_appli_id-->
722
+<!--                JOIN case_affiliate_log ca ON ca.case_appli_log_id = l.id AND ca.identity_type = 1-->
723
+<!--                <where>-->
724
+<!--                    (c.case_status &lt;= 10 or c.case_status=31) AND ca.identity_type=1-->
725
+<!--                    and l.version=(SELECT-->
726
+<!--                    max( version ) version-->
727
+<!--                    FROM-->
728
+<!--                    case_application_log where case_appli_id = c.id and update_submit_status not in(4,5))-->
729
+<!--                    <if test="applicationOrganId != null and applicationOrganId != ''">-->
730
+<!--                        AND ca.application_organ_id = #{applicationOrganId}-->
731
+<!--                    </if>-->
732
+<!--                    <if test="caseStatus != null">-->
733
+<!--                        AND c.case_status = #{caseStatus}-->
734
+<!--                    </if>-->
735
+<!--                    <if test="caseNum != null and caseNum != ''">-->
736
+<!--                        AND c.case_num = #{caseNum}-->
737
+<!--                    </if>-->
738
+<!--                    <if test="nameId != null and nameId != ''">-->
739
+<!--                        AND ca.application_organ_id=#{nameId}-->
740
+<!--                    </if>-->
729 741
 
730
-                    <if test="lockStatus != null">
731
-                        AND c.lock_status = #{lockStatus}
732
-                    </if>
733
-                </where>
734
-                union
735
-            </if>
742
+<!--                    <if test="lockStatus != null">-->
743
+<!--                        AND c.lock_status = #{lockStatus}-->
744
+<!--                    </if>-->
745
+<!--                </where>-->
746
+<!--                union-->
747
+<!--            </if>-->
736 748
             <!--秘书案件-->
737 749
             <if test="deptIds != null and deptIds.size() > 0">
738 750
 
@@ -742,14 +754,14 @@
742 754
                 FROM
743 755
                 case_application c
744 756
                 JOIN case_affiliate ca ON ca.case_appli_id = c.id AND ca.identity_type = 1
745
-                JOIN case_application_log l on l.case_appli_id=c.id and l.update_submit_status not in(1,4) and l.version
757
+                JOIN case_application_log l on l.case_appli_id=c.id and l.update_submit_status not in(1,2) and l.version
746 758
                 = (
747 759
                 SELECT
748 760
                 max( version ) version
749 761
                 FROM
750 762
                 case_application_log
751 763
                 WHERE case_appli_id = c.id
752
-                and update_submit_status not IN ( 1, 4 ))
764
+               )
753 765
                 WHERE
754 766
                 ca.identity_type=1 and c.case_status in (1,5,11,15,16,17,31)
755 767
                 <if test="deptIds != null and deptIds.size() > 0">
@@ -807,7 +819,7 @@
807 819
                 FROM
808 820
                 case_application_log
809 821
                 WHERE
810
-                update_submit_status IN ( 1, 4 ) and c.id = l.case_appli_id)
822
+                update_submit_status IN ( 1, 4 ) and c.id = case_appli_id)
811 823
 
812 824
             </if>
813 825
         </trim>