18792927508 преди 2 години
родител
ревизия
1da61f526d

+ 4
- 5
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java Целия файл

@@ -222,14 +222,13 @@ public class DeptIdentifyController extends BaseController {
222 222
 
223 223
     /**
224 224
      * 根据模板id查询模板字段列表
225
-     * @param templateManage
225
+     * @param id
226 226
      * @return
227 227
      */
228 228
     @GetMapping("/getTemplateInfoById")
229
-    public AjaxResult getTemplateInfoById(@RequestBody  TemplateManage templateManage){
230
-        if(templateManage.getId()==null){
231
-            return error("参数校验错误");
232
-        }
229
+    public AjaxResult getTemplateInfoById(@RequestParam("id") Long id){
230
+        TemplateManage templateManage = new TemplateManage();
231
+        templateManage.setId(id);
233 232
         List<FatchRule> fatchRuleList = deptIdentifyService.getTemplateInfoById(templateManage);
234 233
         return AjaxResult.success(fatchRuleList);
235 234
     }

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

@@ -1093,7 +1093,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1093 1093
             if(CollectionUtil.isNotEmpty(caseApplication.getColumnValues())) {
1094 1094
                 // 修改自定义字段
1095 1095
                 for (ColumnValue columnValue : caseApplication.getColumnValues()) {
1096
-                    columnValueMapper.updateColumnValue(columnValue);
1096
+                    if(StrUtil.isNotEmpty(columnValue.getValue())) {
1097
+                        columnValueMapper.updateColumnValue(columnValue);
1098
+                    }
1097 1099
                 }
1098 1100
             }
1099 1101
             // 修改记录表状态为同意提交修改的内容

+ 103
- 45
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java Целия файл

@@ -32,6 +32,7 @@ import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils;
32 32
 import org.apache.pdfbox.pdmodel.PDDocument;
33 33
 import org.springframework.beans.factory.annotation.Autowired;
34 34
 import org.springframework.stereotype.Service;
35
+import org.springframework.transaction.annotation.Transactional;
35 36
 import org.springframework.web.multipart.MultipartFile;
36 37
 
37 38
 import java.io.*;
@@ -93,7 +94,7 @@ public class CaseZipImportImpl {
93 94
     private Integer maxCaseNum;
94 95
     private Integer maxBatchNumber;
95 96
 
96
-
97
+@Transactional
97 98
     public AjaxResult zipImport(MultipartFile file, Long templateId) {
98 99
         UUID uuid = UUID.randomUUID();
99 100
         // todo
@@ -166,22 +167,30 @@ public class CaseZipImportImpl {
166 167
             throw new ServiceException("未找到文件夹");
167 168
         }
168 169
         File[] files = directory.listFiles();
169
-            CaseZipImportTask caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchMap, fatchRuleMap, userMap, dictDataList, files , deptMap,SecurityUtils.getLoginUser());
170
-        Future<List<CaseApplication>> future = ThreadPoolUtil.submit(caseZipImportTask);
170
+    CaseZipImportTask caseZipImportTask = null;
171
+    try {
172
+        caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchMap, fatchRuleMap, userMap, dictDataList, files , deptMap, SecurityUtils.getLoginUser());
173
+    } catch (Exception e) {
174
+        return error("导入失败");
175
+    }
176
+    Future<List<CaseApplication>> future = ThreadPoolUtil.submit(caseZipImportTask);
171 177
         try {
172 178
             if(future.get()!=null){
173 179
                 return success("导入成功");
174 180
             }
175 181
         } catch (InterruptedException e) {
176 182
             e.printStackTrace();
183
+            return success("导入失败");
177 184
         } catch (ExecutionException e) {
185
+
178 186
             e.printStackTrace();
187
+            return success("导入失败");
179 188
         }
180
-        return error("无可导入的案件");
189
+        return error("导入失败");
181 190
 
182 191
 
183 192
     }
184
-
193
+    @Transactional
185 194
     public CaseApplication buildCaseInfo(File file, Long templateId, List<FatchRule> fatchRuleList, Map<String, List<FatchRule>> fatchRuleMap, Map<String, String> fatchMap, Map<String, SysUser> userMap, List<SysDictData> dictDataList, Map<String, Long> deptMap,LoginUser loginUser) {
186 195
         // fileMap<caseId, List<File>>
187 196
         Map<String, String> fileMap = findFile(file, fatchRuleList);
@@ -288,57 +297,106 @@ public class CaseZipImportImpl {
288 297
                 caseApplication.setCaseAttachList(caseAttachs);
289 298
                 // 案件压缩包导入
290 299
                 caseApplication.setImportFlag(2);
291
-                caseApplicationMapper.insertCaseApplication(caseApplication);
300
+                // 多线程执行
301
+//                List<MultipleThreadListParam> execList = new ArrayList<>();
302
+//                if (CollectionUtil.isNotEmpty(addUsers)) {
303
+//                    Function<List<SysUser>, Integer> function = userMapper::batchSave;
304
+//                    execList.add(new MultipleThreadListParam(function, addUsers));
305
+//                }
306
+//                if (CollectionUtil.isNotEmpty(userRoleList)) {
307
+//                    Function<List<SysUserRole>, Integer> function = userRoleMapper::batchUserRole;
308
+//                    execList.add(new MultipleThreadListParam(function, userRoleList));
309
+//
310
+//                }
311
+//                if (CollectionUtil.isNotEmpty(sysDepts)) {
312
+//                    Function<List<SysDept>, Integer> function = sysDeptMapper::batchSave;
313
+//                    execList.add(new MultipleThreadListParam(function, sysDepts));
314
+//
315
+//                }
316
+//                if (CollectionUtil.isNotEmpty(caseApplications)) {
317
+//                    Function<List<CaseApplication>, Integer> function = caseApplicationMapper::batchSave;
318
+//                    execList.add(new MultipleThreadListParam(function, caseApplications));
319
+//                    Function<List<CaseApplication>, Integer> functionLog = caseApplicationLogMapper::batchSave;
320
+//                    execList.add(new MultipleThreadListParam(functionLog, caseApplications));
321
+//
322
+//                }
323
+//                if (CollectionUtil.isNotEmpty(caseAffiliates)) {
324
+//                    Function<List<CaseAffiliate>, Integer> function = caseAffiliateMapper::batchCaseAffiliate;
325
+//                    execList.add(new MultipleThreadListParam(function, caseAffiliates));
326
+//                    Function<List<CaseAffiliate>, Integer> functionLog = caseAffiliateLogMapper::batchCaseAffiliate;
327
+//                    execList.add(new MultipleThreadListParam(functionLog, caseAffiliates));
328
+//                }
329
+//                if (CollectionUtil.isNotEmpty(caseAttachs)) {
330
+//                    Function<List<CaseAttach>, Integer> function = caseAttachMapper::batchSave;
331
+//                    execList.add(new MultipleThreadListParam(function, caseAttachs));
332
+//                    Function<List<CaseAttach>, Integer> functionLog = caseAttachLogMapper::batchSave;
333
+//                    execList.add(new MultipleThreadListParam(functionLog, caseAttachs));
334
+//                }
335
+//                if (CollectionUtil.isNotEmpty(columnValueList)) {
336
+//                    Function<List<ColumnValue>, Integer> function = columnValueMapper::batchSave;
337
+//                    execList.add(new MultipleThreadListParam(function, columnValueList));
338
+//                    Function<List<ColumnValue>, Integer> functionLog = columnValueLogMapper::batchSave;
339
+//                    execList.add(new MultipleThreadListParam(functionLog, columnValueList));
340
+//                }
341
+//                if (CollectionUtil.isNotEmpty(execList)) {
342
+//                    MultipleThreadWorkUtil.execListFun(execList.toArray(new MultipleThreadListParam[execList.size()]));
343
+//                }
292 344
                 // 多线程执行
293 345
                 ThreadPoolUtil.execute(() -> {
294
-                    caseApplicationLogMapper.insert(caseApplication);
295
-                    // 多线程执行
296
-                    if (CollectionUtil.isNotEmpty(addUsers)) {
297
-                        userMapper.batchSave(addUsers);
346
+                    try {
347
+                        caseApplicationMapper.insertCaseApplication(caseApplication);
348
+                        caseApplicationLogMapper.insert(caseApplication);
349
+                        // 多线程执行
350
+                        if (CollectionUtil.isNotEmpty(addUsers)) {
351
+                            userMapper.batchSave(addUsers);
298 352
 
299
-                    }
300
-                    if (CollectionUtil.isNotEmpty(userRoleList)) {
301
-                        userRoleMapper.batchUserRole(userRoleList);
353
+                        }
354
+                        if (CollectionUtil.isNotEmpty(userRoleList)) {
355
+                            userRoleMapper.batchUserRole(userRoleList);
302 356
 
303
-                    }
304
-                    if (CollectionUtil.isNotEmpty(sysDepts)) {
305
-                        sysDeptMapper.batchSave(sysDepts);
357
+                        }
358
+                        if (CollectionUtil.isNotEmpty(sysDepts)) {
359
+                            sysDeptMapper.batchSave(sysDepts);
306 360
 
307
-                    }
308
-                    if (CollectionUtil.isNotEmpty(caseApplication.getCaseAffiliates())) {
309
-                        caseAffiliateMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates());
310
-                        caseAffiliateLogMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates());
311
-                    }
312
-                    if (CollectionUtil.isNotEmpty(caseAttachs)) {
313
-                        caseAttachMapper.batchSave(caseAttachs);
314
-                        caseAttachLogMapper.batchSave(caseAttachs);
361
+                        }
362
+                        if (CollectionUtil.isNotEmpty(caseApplication.getCaseAffiliates())) {
363
+                            caseAffiliateMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates());
364
+                            caseAffiliateLogMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates());
365
+                        }
366
+                        if (CollectionUtil.isNotEmpty(caseAttachs)) {
367
+                            caseAttachMapper.batchSave(caseAttachs);
368
+                            caseAttachLogMapper.batchSave(caseAttachs);
315 369
 
316
-                    }
317
-                    if (CollectionUtil.isNotEmpty(columnValueList)) {
318
-                        columnValueMapper.batchSave(columnValueList);
319
-                        columnValueLogMapper.batchSave(columnValueList);
320
-                    }
321
-                    // 新增日志
322
-                    CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, "",loginUser);
323
-                    // 发送短信
324
-                    if (CollectionUtil.isNotEmpty(smsRequestList)) {
325
-                        Map<Long, SmsSendRecord> sendRecordMap = null;
326
-                        if (CollectionUtil.isNotEmpty(smsSendRecordList)) {
327
-                            sendRecordMap = smsSendRecordList.stream().collect(Collectors.toMap(SmsSendRecord::getCaseId, Function.identity()));
328
-                            for (SmsUtils.SendSmsRequest sendSmsRequest : smsRequestList) {
329
-                                Boolean aBoolean = SmsUtils.sendSms(request);
330
-                                if (sendRecordMap != null && sendRecordMap.containsKey(sendSmsRequest.getCaseId())) {
331
-                                    if (aBoolean) {
332
-                                        sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(1);
333
-                                    } else {
334
-                                        sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(0);
370
+                        }
371
+                        if (CollectionUtil.isNotEmpty(columnValueList)) {
372
+                            columnValueMapper.batchSave(columnValueList);
373
+                            columnValueLogMapper.batchSave(columnValueList);
374
+                        }
375
+                        // 新增日志
376
+                        CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, "",loginUser);
377
+                        // 发送短信
378
+                        if (CollectionUtil.isNotEmpty(smsRequestList)) {
379
+                            Map<Long, SmsSendRecord> sendRecordMap = null;
380
+                            if (CollectionUtil.isNotEmpty(smsSendRecordList)) {
381
+                                sendRecordMap = smsSendRecordList.stream().collect(Collectors.toMap(SmsSendRecord::getCaseId, Function.identity()));
382
+                                for (SmsUtils.SendSmsRequest sendSmsRequest : smsRequestList) {
383
+                                    Boolean aBoolean = SmsUtils.sendSms(request);
384
+                                    if (sendRecordMap != null && sendRecordMap.containsKey(sendSmsRequest.getCaseId())) {
385
+                                        if (aBoolean) {
386
+                                            sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(1);
387
+                                        } else {
388
+                                            sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(0);
389
+                                        }
335 390
                                     }
336 391
                                 }
392
+                                smsRecordMapper.batchSaveSmsSendRecord(smsSendRecordList);
337 393
                             }
338
-                            smsRecordMapper.batchSaveSmsSendRecord(smsSendRecordList);
339
-                        }
340 394
 
341 395
 
396
+                        }
397
+                    } catch (Exception e) {
398
+                        e.printStackTrace();
399
+                        throw new RuntimeException("导入失败,请检查抓取规则是否正确");
342 400
                     }
343 401
 
344 402
                 });

+ 10
- 6
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/task/CaseZipImportTask.java Целия файл

@@ -49,16 +49,20 @@ public class CaseZipImportTask implements Callable<List<CaseApplication>> {
49 49
     @Override
50 50
     public List<CaseApplication> call() {
51 51
         List<CaseApplication> caseApplications = new ArrayList<>();
52
-        for (File file1 : files) {
53
-            if (file1.isDirectory() && file1.listFiles() != null) {
52
+        try {
53
+            for (File file1 : files) {
54
+                if (file1.isDirectory() && file1.listFiles() != null) {
54 55
 
55
-                for (File file2 : file1.listFiles()) {
56
-                    CaseApplication caseApplication = caseZipImportImpl.buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, fatchMap, userMap, dictDataList, deptMap, loginUser);
57
-                    if (caseApplication != null) {
58
-                        caseApplications.add(caseApplication);
56
+                    for (File file2 : file1.listFiles()) {
57
+                        CaseApplication caseApplication = caseZipImportImpl.buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, fatchMap, userMap, dictDataList, deptMap, loginUser);
58
+                        if (caseApplication != null) {
59
+                            caseApplications.add(caseApplication);
60
+                        }
59 61
                     }
60 62
                 }
61 63
             }
64
+        } catch (Exception e) {
65
+            throw new RuntimeException("导入失败");
62 66
         }
63 67
 
64 68
         return caseApplications;

+ 8
- 8
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationLogMapper.xml Целия файл

@@ -204,23 +204,23 @@
204 204
     <delete id="batchDeleteLog">
205 205
 
206 206
         delete from case_application_log l where l.id in
207
-        <foreach collection="ids" item="id" separator=",">
208
-            #{id}
207
+        <foreach collection="ids" item="item" open="(" separator="," close=")">
208
+            #{item}
209 209
         </foreach>
210 210
         ;
211 211
         delete from case_affiliate_log l where l.case_appli_log_id in
212
-        <foreach collection="ids" item="id" separator=",">
213
-            #{id}
212
+        <foreach collection="ids" item="item" open="(" separator="," close=")">
213
+            #{item}
214 214
         </foreach>
215 215
         ;
216 216
         delete from case_attach_log l where l.case_appli_log_id in
217
-        <foreach collection="ids" item="id" separator=",">
218
-            #{id}
217
+        <foreach collection="ids" item="item" open="(" separator="," close=")">
218
+            #{item}
219 219
         </foreach>
220 220
         ;
221 221
         delete from column_value_log l where l.case_appli_log_id in
222
-        <foreach collection="ids" item="id" separator=",">
223
-            #{id}
222
+        <foreach collection="ids" item="item" open="(" separator="," close=")">
223
+            #{item}
224 224
         </foreach>
225 225
         ;
226 226
     </delete>

+ 251
- 123
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml Целия файл

@@ -5,54 +5,54 @@
5 5
 <mapper namespace="com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper">
6 6
 
7 7
     <resultMap type="CaseApplication" id="CaseApplicationResult">
8
-        <id     property="id"       column="id"      />
9
-        <result property="caseNum"       column="case_num"      />
10
-        <result property="caseName"       column="case_name"      />
11
-        <result property="caseSubjectAmount"     column="case_subject_amount"    />
12
-        <result property="registerDate"     column="register_date"    />
13
-        <result property="arbitratMethod"        column="arbitrat_method"        />
14
-        <result property="caseStatus"  column="case_status"  />
15
-        <result property="hearDate"          column="hear_date"          />
16
-        <result property="arbitratClaims"       column="arbitrat_claims"       />
17
-        <result property="loanStartDate"     column="loan_start_date"     />
18
-        <result property="loanEndDate"       column="loan_end_date"       />
19
-        <result property="claimPrinciOwed"      column="claim_princi_owed"     />
20
-        <result property="claimInterestOwed"      column="claim_interest_owed"     />
21
-        <result property="claimLiquidDamag"    column="claim_liquid_damag"   />
22
-
23
-        <result property="feePayable"          column="fee_payable"          />
24
-        <result property="beginVideoDate"     column="begin_video_date"     />
25
-        <result property="onlineVideoPerson"       column="online_video_person"       />
26
-        <result property="contractNumber"      column="contract_number"     />
27
-        <result property="caseStatusName"      column="caseStatusName"     />
28
-        <result property="createBy"     column="create_by"    />
29
-        <result property="createTime"   column="create_time"  />
30
-        <result property="updateBy"     column="update_by"    />
31
-        <result property="updateTime"   column="update_time"  />
32
-        <result property="arbitratMethodName"   column="arbitratMethodName"  />
33
-
34
-        <result property="applicantIsWrittenHear"   column="appli_iswrit_hear"  />
35
-        <result property="respondentIsWrittenHear"   column="respon_isWrit_hear"  />
36
-
37
-        <result property="isAbsence"   column="is_absence"  />
38
-        <result property="responCrossOpin"   column="respon_cross_opin"  />
39
-        <result property="applicaCrossOpin"   column="applica_cross_opin"  />
40
-        <result property="responDefenOpini"   column="respon_defen_opini"  />
41
-
42
-        <result property="arbitratorId"   column="arbitrator_id"  />
43
-        <result property="arbitratorName"   column="arbitrator_name"  />
44
-        <result property="paymentStatus"   column="payment_status"  />
45
-        <result property="paymentStatusName"   column="paymentStatusName"  />
46
-        <result property="filearbitraUrl"   column="filearbitra_url"  />
47
-
48
-        <result property="requestRule"   column="request_rule"  />
49
-        <result property="properPreser"   column="proper_preser"  />
50
-        <result property="adjudicaCounter"   column="adjudica_counter"  />
51
-        <result property="lockStatus"   column="lock_status"  />
52
-        <result property="facts"   column="facts"  />
53
-
54
-        <result property="batchNumber"   column="batch_number"  />
55
-        <result property="mediationAgreement"   column="mediation_agreement"  />
8
+        <id property="id" column="id"/>
9
+        <result property="caseNum" column="case_num"/>
10
+        <result property="caseName" column="case_name"/>
11
+        <result property="caseSubjectAmount" column="case_subject_amount"/>
12
+        <result property="registerDate" column="register_date"/>
13
+        <result property="arbitratMethod" column="arbitrat_method"/>
14
+        <result property="caseStatus" column="case_status"/>
15
+        <result property="hearDate" column="hear_date"/>
16
+        <result property="arbitratClaims" column="arbitrat_claims"/>
17
+        <result property="loanStartDate" column="loan_start_date"/>
18
+        <result property="loanEndDate" column="loan_end_date"/>
19
+        <result property="claimPrinciOwed" column="claim_princi_owed"/>
20
+        <result property="claimInterestOwed" column="claim_interest_owed"/>
21
+        <result property="claimLiquidDamag" column="claim_liquid_damag"/>
22
+
23
+        <result property="feePayable" column="fee_payable"/>
24
+        <result property="beginVideoDate" column="begin_video_date"/>
25
+        <result property="onlineVideoPerson" column="online_video_person"/>
26
+        <result property="contractNumber" column="contract_number"/>
27
+        <result property="caseStatusName" column="caseStatusName"/>
28
+        <result property="createBy" column="create_by"/>
29
+        <result property="createTime" column="create_time"/>
30
+        <result property="updateBy" column="update_by"/>
31
+        <result property="updateTime" column="update_time"/>
32
+        <result property="arbitratMethodName" column="arbitratMethodName"/>
33
+
34
+        <result property="applicantIsWrittenHear" column="appli_iswrit_hear"/>
35
+        <result property="respondentIsWrittenHear" column="respon_isWrit_hear"/>
36
+
37
+        <result property="isAbsence" column="is_absence"/>
38
+        <result property="responCrossOpin" column="respon_cross_opin"/>
39
+        <result property="applicaCrossOpin" column="applica_cross_opin"/>
40
+        <result property="responDefenOpini" column="respon_defen_opini"/>
41
+
42
+        <result property="arbitratorId" column="arbitrator_id"/>
43
+        <result property="arbitratorName" column="arbitrator_name"/>
44
+        <result property="paymentStatus" column="payment_status"/>
45
+        <result property="paymentStatusName" column="paymentStatusName"/>
46
+        <result property="filearbitraUrl" column="filearbitra_url"/>
47
+
48
+        <result property="requestRule" column="request_rule"/>
49
+        <result property="properPreser" column="proper_preser"/>
50
+        <result property="adjudicaCounter" column="adjudica_counter"/>
51
+        <result property="lockStatus" column="lock_status"/>
52
+        <result property="facts" column="facts"/>
53
+
54
+        <result property="batchNumber" column="batch_number"/>
55
+        <result property="mediationAgreement" column="mediation_agreement"/>
56 56
     </resultMap>
57 57
 
58 58
 
@@ -368,6 +368,114 @@
368 368
                 JOIN case_affiliate ca ON ca.case_appli_id = c.id AND ca.identity_type=1
369 369
                 WHERE
370 370
                  r.create_by=#{loginUserName}  AND ca.identity_type=1
371
+                 and c.id not in(
372
+                <trim suffixOverrides="union">
373
+                <!--被申请人,仲裁员,部门长,财务,代理人案件-->
374
+                <if test="isOtherRole!=null and isOtherRole==1">
375
+                    select c.id
376
+                    from case_application c
377
+                    JOIN case_affiliate ca ON ca.case_appli_id = c.id
378
+                    <where>
379
+                        <!--根据角色和状态过滤-->
380
+                        <!--被申请人-->
381
+                        <if test="idCard != null and idCard != ''">
382
+                            or (ca.identity_num=#{idCard} AND ca.identity_type=2
383
+                            and (c.case_status=4 or c.case_status=17)
384
+                            )
385
+                        </if>
386
+                        <!--仲裁员-->
387
+                        <if test="userId != null and userId != ''">
388
+                            or ( ca.identity_type=1 and
389
+                            c.case_status in (7,13,17,18)
390
+                            and
391
+                            instr (c.arbitrator_id,#{userId})>0)
392
+                        </if>
393
+                        <!--部门长-->
394
+                        <if test="deptHeadStatus != null and deptHeadStatus.size() > 0">
395
+                            or (ca.identity_type=1)
396
+                        </if>
397
+                        <!--财务-->
398
+                        <if test="financeStatus != null and financeStatus != ''">
399
+                            or (ca.identity_type=1
400
+                            and c.case_status =#{financeStatus}
401
+                            )
402
+                        </if>
403
+                        <!--代理人-->
404
+                        <if test="agentDeptIds != null and agentDeptIds.size()>0">
405
+                            or (
406
+                            ca.application_organ_id in
407
+                            <foreach item="deptId" collection="agentDeptIds" open="(" separator="," close=")">#{deptId}
408
+                            </foreach>
409
+                            AND ca.identity_type=1
410
+                            and c.case_status in (0,9)
411
+                            )
412
+
413
+                        </if>
414
+                    </where>
415
+                    union
416
+                </if>
417
+                <if test="applicationOrganId != null and applicationOrganId != ''">
418
+
419
+
420
+                    <!--申请人案件-->
421
+                    select c.id
422
+                    from case_application c
423
+                    JOIN case_affiliate ca ON ca.case_appli_id =c.id AND ca.identity_type = 1
424
+
425
+                    <where>
426
+                        (c.case_status &lt;= 10 or c.case_status=31) AND
427
+                        ca.identity_type=1
428
+
429
+                        <if test="applicationOrganId != null and applicationOrganId != ''">
430
+                            AND ca.application_organ_id = #{applicationOrganId}
431
+                        </if>
432
+                    </where>
433
+                    union
434
+                </if>
435
+                <!--秘书案件-->
436
+                <if test="deptIds != null and deptIds.size() > 0">
437
+
438
+                    <!--秘书主表案件-->
439
+                    SELECT
440
+                    c.id
441
+                    FROM
442
+                    case_application c
443
+                    JOIN case_affiliate ca ON ca.case_appli_id = c.id AND ca.identity_type = 1
444
+                    JOIN case_application_log l on l.case_appli_id=c.id and l.update_submit_status not in(1, 2) and
445
+                    l.version
446
+                    = (
447
+                    SELECT
448
+                    max( version ) version
449
+                    FROM
450
+                    case_application_log
451
+                    WHERE case_appli_id = c.id
452
+                    )
453
+                    WHERE
454
+                    ca.identity_type=1
455
+                    and c.case_status in (1,5,8,9,11,14,15,16,17,31)
456
+                    union
457
+                    <!--秘书审核案件-->
458
+                    SELECT
459
+                    l.case_appli_id id
460
+                    FROM
461
+                    case_application c
462
+                    JOIN case_application_log l ON c.id = l.case_appli_id
463
+                    JOIN case_affiliate_log ca ON ca.case_appli_log_id = l.id
464
+                    AND ca.identity_type = 1
465
+                    WHERE
466
+                    l.update_submit_status IN ( 1, 2 ) and ca.identity_type=1
467
+
468
+                    <!-- 查询该案件的最新记录 -->
469
+                    AND l.version = (
470
+                    SELECT
471
+                    max( version ) version
472
+                    FROM
473
+                    case_application_log
474
+                    WHERE
475
+                    c.id = case_appli_id)
476
+                </if>
477
+                </trim>
478
+                )
371 479
             </if>
372 480
 
373 481
         </trim>
@@ -391,13 +499,13 @@
391 499
     </select>
392 500
 
393 501
 
394
-    <select id="selectHandledCase"  resultMap="CaseApplicationResult">
502
+    <select id="selectHandledCase" resultMap="CaseApplicationResult">
395 503
         select DISTINCT(c.id) id,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method ,
396 504
         CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
397 505
         ELSE '无审理方式'
398 506
         END arbitratMethodName,
399 507
         c.case_status ,
400
-        CASE c.case_status  when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
508
+        CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
401 509
         when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
402 510
         when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
403 511
         when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
@@ -408,9 +516,11 @@
408 516
         ELSE '无案件状态'
409 517
         END caseStatusName,
410 518
         c.hear_date ,c.arbitrat_claims ,
411
-        c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable ,
519
+        c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag
520
+        ,c.fee_payable ,
412 521
         c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time ,c.lock_status,
413
-        c.update_by ,c.update_time , c.arbitrator_name,ca.application_organ_id applicationOrganId ,ca.application_organ_name as applicantName,c.filearbitra_url,c.version
522
+        c.update_by ,c.update_time , c.arbitrator_name,ca.application_organ_id applicationOrganId
523
+        ,ca.application_organ_name as applicantName,c.filearbitra_url,c.version
414 524
         from case_log_record r
415 525
         join case_application c on r.case_appli_id=c.id
416 526
         JOIN case_affiliate ca ON ca.case_appli_id = c.id AND ca.identity_type=1
@@ -423,10 +533,10 @@
423 533
                 AND c.case_num = #{caseNum}
424 534
             </if>
425 535
             <if test="nameId != null and nameId != ''">
426
-                AND ca.application_organ_id=#{nameId}  AND ca.identity_type=1
536
+                AND ca.application_organ_id=#{nameId} AND ca.identity_type=1
427 537
             </if>
428 538
             <if test="loginUserName != null and loginUserName != ''">
429
-                AND r.create_by=#{loginUserName}  AND ca.identity_type=1
539
+                AND r.create_by=#{loginUserName} AND ca.identity_type=1
430 540
             </if>
431 541
 
432 542
         </where>
@@ -443,7 +553,8 @@
443 553
         from(
444 554
         select t.id,t.case_num ,t.case_subject_amount ,t.register_date ,t.arbitrat_method,
445 555
         t.arbitratMethodName,t.case_status,t.caseStatusName,t.hear_date ,t.arbitrat_claims ,
446
-        t.loan_start_date ,t.loan_end_date ,t.claim_princi_owed ,t.claim_interest_owed ,t.claim_liquid_damag,t.fee_payable ,
556
+        t.loan_start_date ,t.loan_end_date ,t.claim_princi_owed ,t.claim_interest_owed
557
+        ,t.claim_liquid_damag,t.fee_payable ,
447 558
         t.begin_video_date ,t.online_video_person ,t.contract_number ,t.create_by ,t.create_time ,
448 559
         t.update_by ,t.update_time , t.arbitrator_name,t.name,t.application_organ_id,t.applicantName,
449 560
         t.arbitrator_id,t.identity_num , t.identity_type,t.filearbitra_url,t.lock_status,t.version
@@ -480,7 +591,7 @@
480 591
                 AND c.case_num = #{caseNum}
481 592
             </if>
482 593
             <if test="nameId != null and nameId != ''">
483
-                AND ca.application_organ_id=#{nameId}  AND ca.identity_type=1
594
+                AND ca.application_organ_id=#{nameId} AND ca.identity_type=1
484 595
             </if>
485 596
             <if test="caseStatusList != null and caseStatusList.size() > 0">
486 597
                 and c.case_status in
@@ -521,7 +632,7 @@
521 632
             </if>
522 633
             <!--财务-->
523 634
             <if test="financeStatus != null and financeStatus != ''">
524
-                or  (t.identity_type=1 and t.case_status =#{financeStatus})
635
+                or (t.identity_type=1 and t.case_status =#{financeStatus})
525 636
 
526 637
 
527 638
             </if>
@@ -565,7 +676,8 @@
565 676
         <trim suffixOverrides="union">
566 677
             <!--被申请人,仲裁员,部门长,财务,代理人案件-->
567 678
             <if test="isOtherRole!=null and isOtherRole==1">
568
-                select  DISTINCT(t.id),t.case_status,t.application_organ_id, t.arbitrator_id,t.identity_num , t.identity_type from(
679
+                select DISTINCT(t.id),t.case_status,t.application_organ_id, t.arbitrator_id,t.identity_num ,
680
+                t.identity_type from(
569 681
                 select c.id ,
570 682
                 c.case_status,ca.application_organ_id,
571 683
                 c.arbitrator_id,ca.identity_num , ca.identity_type
@@ -612,7 +724,7 @@
612 724
                     </if>
613 725
                     <!--财务-->
614 726
                     <if test="financeStatus != null and financeStatus != ''">
615
-                        or   ( t.identity_type=1 and t.case_status =#{financeStatus})
727
+                        or ( t.identity_type=1 and t.case_status =#{financeStatus})
616 728
 
617 729
                     </if>
618 730
                     <!--代理人-->
@@ -651,12 +763,12 @@
651 763
                 ca.identity_type=1
652 764
 
653 765
                 and c.case_status in (1,5,8,9,11,14,15,16,17,31)
654
-      <!--          <if test="deptIds != null and deptIds.size() > 0">
655
-                    and ca.application_organ_id in
656
-                    <foreach item="item" collection="deptIds" open="(" separator="," close=")">
657
-                        #{item}
658
-                    </foreach>
659
-                </if> -->
766
+                <!--          <if test="deptIds != null and deptIds.size() > 0">
767
+                              and ca.application_organ_id in
768
+                              <foreach item="item" collection="deptIds" open="(" separator="," close=")">
769
+                                  #{item}
770
+                              </foreach>
771
+                          </if> -->
660 772
                 <if test="caseStatus != null">
661 773
                     AND c.case_status = #{caseStatus}
662 774
                 </if>
@@ -665,7 +777,7 @@
665 777
                     AND ca.application_organ_id=#{nameId} AND ca.identity_type=1
666 778
                 </if>
667 779
                 union
668
-            select  c.id ,
780
+                select c.id ,
669 781
                 c.case_status,ca.application_organ_id,
670 782
                 c.arbitrator_id,ca.identity_num , ca.identity_type
671 783
                 FROM
@@ -694,7 +806,7 @@
694 806
         ELSE '无审理方式'
695 807
         END arbitratMethodName,
696 808
         c.case_status ,
697
-        CASE c.case_status  when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
809
+        CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
698 810
         when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
699 811
         when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
700 812
         when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
@@ -705,9 +817,11 @@
705 817
         ELSE '无案件状态'
706 818
         END caseStatusName,
707 819
         c.hear_date ,c.arbitrat_claims ,
708
-        c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable ,
820
+        c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag
821
+        ,c.fee_payable ,
709 822
         c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time ,c.lock_status,
710
-        c.update_by ,c.update_time , c.arbitrator_name,ca.application_organ_id applicationOrganId ,ca.application_organ_name as applicantName,c.filearbitra_url,(select version from
823
+        c.update_by ,c.update_time , c.arbitrator_name,ca.application_organ_id applicationOrganId
824
+        ,ca.application_organ_name as applicantName,c.filearbitra_url,(select version from
711 825
         case_application_log where case_appli_id=c.id order by version desc limit 1) as version,(select
712 826
         update_submit_status from case_application_log where case_appli_id=c.id order by version desc limit 1)
713 827
         as updateSubmitStatus,c.batch_number
@@ -726,7 +840,7 @@
726 840
                 AND c.case_num = #{caseNum}
727 841
             </if>
728 842
             <if test="nameId != null and nameId != ''">
729
-                AND ca.application_organ_id=#{nameId}  AND ca.identity_type=1
843
+                AND ca.application_organ_id=#{nameId} AND ca.identity_type=1
730 844
             </if>
731 845
             <if test="caseStatusList != null and caseStatusList.size() > 0">
732 846
                 and c.case_status in
@@ -791,7 +905,7 @@
791 905
 
792 906
 
793 907
     <select id="selectCaseApplicationCount" parameterType="CaseApplication" resultType="int">
794
-        select count(1) from  case_application c
908
+        select count(1) from case_application c
795 909
         <where>
796 910
             <if test="caseNum != null and caseNum != ''">
797 911
                 AND c.case_num = #{caseNum}
@@ -875,7 +989,7 @@
875 989
         id,
876 990
         case_name ,
877 991
         case_num,
878
-       case_subject_amount,
992
+        case_subject_amount,
879 993
         register_date,
880 994
         arbitrat_method,
881 995
         case_status,
@@ -900,49 +1014,49 @@
900 1014
         create_by,
901 1015
         import_flag,
902 1016
         version,
903
-       template_id,
1017
+        template_id,
904 1018
         facts,
905 1019
         mediation_agreement,
906 1020
         batch_number,
907 1021
         create_time
908 1022
         )values
909 1023
         <foreach item="item" index="index" collection="list" separator=",">
910
-        (
911
-        #{item.id},
912
-        #{item.caseName},
913
-        #{item.caseNum},
914
-        #{item.caseSubjectAmount},
915
-        sysdate(),
916
-        #{item.arbitratMethod},
917
-        #{item.caseStatus},
918
-        #{item.hearDate},
919
-        #{item.arbitratClaims},
920
-        #{item.requestRule},
921
-       #{item.loanStartDate},
922
-        #{item.loanEndDate},
923
-        #{item.claimPrinciOwed},
924
-
925
-        #{item.claimInterestOwed},
926
-        #{item.claimLiquidDamag},
927
-        #{item.feePayable},
928
-        #{item.beginVideoDate},
929
-        #{item.onlineVideoPerson},
930
-
931
-        #{item.contractNumber},
932
-
933
-       #{item.adjudicaCounter},
934
-        #{item.properPreser},
935
-
936
-        #{item.createBy},
937
-        #{item.importFlag},
938
-        #{item.version},
939
-       #{item.templateId},
940
-
941
-        #{item.facts},
942
-        #{item.mediationAgreement},
943
-        #{item.batchNumber},
944
-        sysdate()
945
-        )
1024
+            (
1025
+            #{item.id},
1026
+            #{item.caseName},
1027
+            #{item.caseNum},
1028
+            #{item.caseSubjectAmount},
1029
+            sysdate(),
1030
+            #{item.arbitratMethod},
1031
+            #{item.caseStatus},
1032
+            #{item.hearDate},
1033
+            #{item.arbitratClaims},
1034
+            #{item.requestRule},
1035
+            #{item.loanStartDate},
1036
+            #{item.loanEndDate},
1037
+            #{item.claimPrinciOwed},
1038
+
1039
+            #{item.claimInterestOwed},
1040
+            #{item.claimLiquidDamag},
1041
+            #{item.feePayable},
1042
+            #{item.beginVideoDate},
1043
+            #{item.onlineVideoPerson},
1044
+
1045
+            #{item.contractNumber},
1046
+
1047
+            #{item.adjudicaCounter},
1048
+            #{item.properPreser},
1049
+
1050
+            #{item.createBy},
1051
+            #{item.importFlag},
1052
+            #{item.version},
1053
+            #{item.templateId},
1054
+
1055
+            #{item.facts},
1056
+            #{item.mediationAgreement},
1057
+            #{item.batchNumber},
1058
+            sysdate()
1059
+            )
946 1060
         </foreach>;
947 1061
     </insert>
948 1062
 
@@ -962,7 +1076,9 @@
962 1076
             <if test="claimLiquidDamag != null ">claim_liquid_damag = #{claimLiquidDamag},</if>
963 1077
             <if test="feePayable != null ">fee_payable = #{feePayable},</if>
964 1078
             <if test="beginVideoDate != null ">begin_video_date = #{beginVideoDate},</if>
965
-            <if test="onlineVideoPerson != null  and onlineVideoPerson != ''">online_video_person = #{onlineVideoPerson},</if>
1079
+            <if test="onlineVideoPerson != null  and onlineVideoPerson != ''">online_video_person =
1080
+                #{onlineVideoPerson},
1081
+            </if>
966 1082
 
967 1083
             <if test="contractNumber != null  and contractNumber != ''">contract_number = #{contractNumber},</if>
968 1084
 
@@ -978,8 +1094,10 @@
978 1094
             <if test="updateBy != null  and updateBy != ''">update_by = #{updateBy},</if>
979 1095
             <if test="caseNum != null and caseNum != ''">case_num = #{caseNum},</if>
980 1096
             <if test="version != null ">version = #{version},</if>
981
-             <if test="facts != null and facts != ''">facts = #{facts},</if>
982
-            <if test="mediationAgreement != null and mediationAgreement != ''">mediation_agreement = #{mediationAgreement},</if>
1097
+            <if test="facts != null and facts != ''">facts = #{facts},</if>
1098
+            <if test="mediationAgreement != null and mediationAgreement != ''">mediation_agreement =
1099
+                #{mediationAgreement},
1100
+            </if>
983 1101
             update_time = sysdate()
984 1102
         </set>
985 1103
         where id = #{id}
@@ -1003,13 +1121,17 @@
1003 1121
             <if test="isAbsence != null">is_absence = #{isAbsence},</if>
1004 1122
             <if test="appliIsAbsen != null">appli_is_absen = #{appliIsAbsen},</if>
1005 1123
             <if test="responCrossOpin != null  and responCrossOpin != ''">respon_cross_opin = #{responCrossOpin},</if>
1006
-            <if test="applicaCrossOpin != null  and applicaCrossOpin != ''">applica_cross_opin = #{applicaCrossOpin},</if>
1007
-            <if test="responDefenOpini != null  and responDefenOpini != ''">respon_defen_opini = #{responDefenOpini},</if>
1124
+            <if test="applicaCrossOpin != null  and applicaCrossOpin != ''">applica_cross_opin = #{applicaCrossOpin},
1125
+            </if>
1126
+            <if test="responDefenOpini != null  and responDefenOpini != ''">respon_defen_opini = #{responDefenOpini},
1127
+            </if>
1008 1128
             <if test="objectionAddEviden != null">objection_add_eviden = #{objectionAddEviden},</if>
1009 1129
             <if test="openCourtHear != null">open_court_hear = #{openCourtHear},</if>
1010 1130
             <if test="hearDate != null">hear_date = #{hearDate},</if>
1011 1131
             <if test="filearbitraUrl != null  and filearbitraUrl != ''">filearbitra_url = #{filearbitraUrl},</if>
1012
-            <if test="adjudicaCounterReason != null  and adjudicaCounterReason != ''">adjudica_counter_reason = #{adjudicaCounterReason},</if>
1132
+            <if test="adjudicaCounterReason != null  and adjudicaCounterReason != ''">adjudica_counter_reason =
1133
+                #{adjudicaCounterReason},
1134
+            </if>
1013 1135
         </set>
1014 1136
         where id = #{id}
1015 1137
     </update>
@@ -1064,7 +1186,7 @@
1064 1186
         END arbitratMethodName,
1065 1187
         c.case_name,
1066 1188
         c.case_status ,
1067
-        CASE c.case_status  when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
1189
+        CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
1068 1190
         when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
1069 1191
         when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
1070 1192
         when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
@@ -1075,10 +1197,13 @@
1075 1197
         ELSE '无案件状态'
1076 1198
         END caseStatusName,
1077 1199
         c.hear_date ,c.arbitrat_claims ,
1078
-        c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable ,
1079
-        c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time ,c.request_rule,c.adjudica_counter,c.proper_preser,
1200
+        c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag
1201
+        ,c.fee_payable ,
1202
+        c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time
1203
+        ,c.request_rule,c.adjudica_counter,c.proper_preser,
1080 1204
         c.is_absence ,c.respon_cross_opin ,c.applica_cross_opin ,c.respon_defen_opini ,
1081
-        c.update_by ,c.update_time,c.arbitrator_id,c.arbitrator_name,ca.application_organ_id applicationOrganId ,ca.application_organ_name as applicantName,
1205
+        c.update_by ,c.update_time,c.arbitrator_id,c.arbitrator_name,ca.application_organ_id applicationOrganId
1206
+        ,ca.application_organ_name as applicantName,
1082 1207
         c.batch_number,
1083 1208
         c.facts,
1084 1209
         c.appli_iswrit_hear,c.respon_isWrit_hear,
@@ -1099,7 +1224,7 @@
1099 1224
         ELSE '无审理方式'
1100 1225
         END arbitratMethodName,
1101 1226
         c.case_status ,
1102
-        CASE c.case_status  when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
1227
+        CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费'
1103 1228
         when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核'
1104 1229
         when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理'
1105 1230
         when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书'
@@ -1110,10 +1235,13 @@
1110 1235
         ELSE '无案件状态'
1111 1236
         END caseStatusName,
1112 1237
         c.hear_date ,c.arbitrat_claims ,
1113
-        c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable ,
1114
-        c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time ,c.request_rule,c.adjudica_counter,c.proper_preser,
1238
+        c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag
1239
+        ,c.fee_payable ,
1240
+        c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time
1241
+        ,c.request_rule,c.adjudica_counter,c.proper_preser,
1115 1242
         c.is_absence ,c.respon_cross_opin ,c.applica_cross_opin ,c.respon_defen_opini ,
1116
-        c.update_by ,c.update_time,c.arbitrator_id,c.arbitrator_name,ca.application_organ_id applicationOrganId ,ca.application_organ_name as applicantName,
1243
+        c.update_by ,c.update_time,c.arbitrator_id,c.arbitrator_name,ca.application_organ_id applicationOrganId
1244
+        ,ca.application_organ_name as applicantName,
1117 1245
         c.batch_number,
1118 1246
         c.facts,
1119 1247
         c.mediation_agreement,c.template_id templateId