diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java index 71bec6b..47b916a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java @@ -222,14 +222,13 @@ public class DeptIdentifyController extends BaseController { /** * 根据模板id查询模板字段列表 - * @param templateManage + * @param id * @return */ @GetMapping("/getTemplateInfoById") - public AjaxResult getTemplateInfoById(@RequestBody TemplateManage templateManage){ - if(templateManage.getId()==null){ - return error("参数校验错误"); - } + public AjaxResult getTemplateInfoById(@RequestParam("id") Long id){ + TemplateManage templateManage = new TemplateManage(); + templateManage.setId(id); List fatchRuleList = deptIdentifyService.getTemplateInfoById(templateManage); return AjaxResult.success(fatchRuleList); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index d3f24a0..28441b8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -1093,7 +1093,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { if(CollectionUtil.isNotEmpty(caseApplication.getColumnValues())) { // 修改自定义字段 for (ColumnValue columnValue : caseApplication.getColumnValues()) { - columnValueMapper.updateColumnValue(columnValue); + if(StrUtil.isNotEmpty(columnValue.getValue())) { + columnValueMapper.updateColumnValue(columnValue); + } } } // 修改记录表状态为同意提交修改的内容 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java index 476daaa..d78af0b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java @@ -32,6 +32,7 @@ import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils; import org.apache.pdfbox.pdmodel.PDDocument; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import java.io.*; @@ -93,7 +94,7 @@ public class CaseZipImportImpl { private Integer maxCaseNum; private Integer maxBatchNumber; - +@Transactional public AjaxResult zipImport(MultipartFile file, Long templateId) { UUID uuid = UUID.randomUUID(); // todo @@ -166,22 +167,30 @@ public class CaseZipImportImpl { throw new ServiceException("未找到文件夹"); } File[] files = directory.listFiles(); - CaseZipImportTask caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchMap, fatchRuleMap, userMap, dictDataList, files , deptMap,SecurityUtils.getLoginUser()); - Future> future = ThreadPoolUtil.submit(caseZipImportTask); + CaseZipImportTask caseZipImportTask = null; + try { + caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchMap, fatchRuleMap, userMap, dictDataList, files , deptMap, SecurityUtils.getLoginUser()); + } catch (Exception e) { + return error("导入失败"); + } + Future> future = ThreadPoolUtil.submit(caseZipImportTask); try { if(future.get()!=null){ return success("导入成功"); } } catch (InterruptedException e) { e.printStackTrace(); + return success("导入失败"); } catch (ExecutionException e) { + e.printStackTrace(); + return success("导入失败"); } - return error("无可导入的案件"); + return error("导入失败"); } - + @Transactional public CaseApplication buildCaseInfo(File file, Long templateId, List fatchRuleList, Map> fatchRuleMap, Map fatchMap, Map userMap, List dictDataList, Map deptMap,LoginUser loginUser) { // fileMap> Map fileMap = findFile(file, fatchRuleList); @@ -288,57 +297,106 @@ public class CaseZipImportImpl { caseApplication.setCaseAttachList(caseAttachs); // 案件压缩包导入 caseApplication.setImportFlag(2); - caseApplicationMapper.insertCaseApplication(caseApplication); + // 多线程执行 +// List execList = new ArrayList<>(); +// if (CollectionUtil.isNotEmpty(addUsers)) { +// Function, Integer> function = userMapper::batchSave; +// execList.add(new MultipleThreadListParam(function, addUsers)); +// } +// if (CollectionUtil.isNotEmpty(userRoleList)) { +// Function, Integer> function = userRoleMapper::batchUserRole; +// execList.add(new MultipleThreadListParam(function, userRoleList)); +// +// } +// if (CollectionUtil.isNotEmpty(sysDepts)) { +// Function, Integer> function = sysDeptMapper::batchSave; +// execList.add(new MultipleThreadListParam(function, sysDepts)); +// +// } +// if (CollectionUtil.isNotEmpty(caseApplications)) { +// Function, Integer> function = caseApplicationMapper::batchSave; +// execList.add(new MultipleThreadListParam(function, caseApplications)); +// Function, Integer> functionLog = caseApplicationLogMapper::batchSave; +// execList.add(new MultipleThreadListParam(functionLog, caseApplications)); +// +// } +// if (CollectionUtil.isNotEmpty(caseAffiliates)) { +// Function, Integer> function = caseAffiliateMapper::batchCaseAffiliate; +// execList.add(new MultipleThreadListParam(function, caseAffiliates)); +// Function, Integer> functionLog = caseAffiliateLogMapper::batchCaseAffiliate; +// execList.add(new MultipleThreadListParam(functionLog, caseAffiliates)); +// } +// if (CollectionUtil.isNotEmpty(caseAttachs)) { +// Function, Integer> function = caseAttachMapper::batchSave; +// execList.add(new MultipleThreadListParam(function, caseAttachs)); +// Function, Integer> functionLog = caseAttachLogMapper::batchSave; +// execList.add(new MultipleThreadListParam(functionLog, caseAttachs)); +// } +// if (CollectionUtil.isNotEmpty(columnValueList)) { +// Function, Integer> function = columnValueMapper::batchSave; +// execList.add(new MultipleThreadListParam(function, columnValueList)); +// Function, Integer> functionLog = columnValueLogMapper::batchSave; +// execList.add(new MultipleThreadListParam(functionLog, columnValueList)); +// } +// if (CollectionUtil.isNotEmpty(execList)) { +// MultipleThreadWorkUtil.execListFun(execList.toArray(new MultipleThreadListParam[execList.size()])); +// } // 多线程执行 ThreadPoolUtil.execute(() -> { - caseApplicationLogMapper.insert(caseApplication); - // 多线程执行 - if (CollectionUtil.isNotEmpty(addUsers)) { - userMapper.batchSave(addUsers); + try { + caseApplicationMapper.insertCaseApplication(caseApplication); + caseApplicationLogMapper.insert(caseApplication); + // 多线程执行 + if (CollectionUtil.isNotEmpty(addUsers)) { + userMapper.batchSave(addUsers); - } - if (CollectionUtil.isNotEmpty(userRoleList)) { - userRoleMapper.batchUserRole(userRoleList); + } + if (CollectionUtil.isNotEmpty(userRoleList)) { + userRoleMapper.batchUserRole(userRoleList); - } - if (CollectionUtil.isNotEmpty(sysDepts)) { - sysDeptMapper.batchSave(sysDepts); + } + if (CollectionUtil.isNotEmpty(sysDepts)) { + sysDeptMapper.batchSave(sysDepts); - } - if (CollectionUtil.isNotEmpty(caseApplication.getCaseAffiliates())) { - caseAffiliateMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates()); - caseAffiliateLogMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates()); - } - if (CollectionUtil.isNotEmpty(caseAttachs)) { - caseAttachMapper.batchSave(caseAttachs); - caseAttachLogMapper.batchSave(caseAttachs); + } + if (CollectionUtil.isNotEmpty(caseApplication.getCaseAffiliates())) { + caseAffiliateMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates()); + caseAffiliateLogMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates()); + } + if (CollectionUtil.isNotEmpty(caseAttachs)) { + caseAttachMapper.batchSave(caseAttachs); + caseAttachLogMapper.batchSave(caseAttachs); - } - if (CollectionUtil.isNotEmpty(columnValueList)) { - columnValueMapper.batchSave(columnValueList); - columnValueLogMapper.batchSave(columnValueList); - } - // 新增日志 - CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, "",loginUser); - // 发送短信 - if (CollectionUtil.isNotEmpty(smsRequestList)) { - Map sendRecordMap = null; - if (CollectionUtil.isNotEmpty(smsSendRecordList)) { - sendRecordMap = smsSendRecordList.stream().collect(Collectors.toMap(SmsSendRecord::getCaseId, Function.identity())); - for (SmsUtils.SendSmsRequest sendSmsRequest : smsRequestList) { - Boolean aBoolean = SmsUtils.sendSms(request); - if (sendRecordMap != null && sendRecordMap.containsKey(sendSmsRequest.getCaseId())) { - if (aBoolean) { - sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(1); - } else { - sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(0); + } + if (CollectionUtil.isNotEmpty(columnValueList)) { + columnValueMapper.batchSave(columnValueList); + columnValueLogMapper.batchSave(columnValueList); + } + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, "",loginUser); + // 发送短信 + if (CollectionUtil.isNotEmpty(smsRequestList)) { + Map sendRecordMap = null; + if (CollectionUtil.isNotEmpty(smsSendRecordList)) { + sendRecordMap = smsSendRecordList.stream().collect(Collectors.toMap(SmsSendRecord::getCaseId, Function.identity())); + for (SmsUtils.SendSmsRequest sendSmsRequest : smsRequestList) { + Boolean aBoolean = SmsUtils.sendSms(request); + if (sendRecordMap != null && sendRecordMap.containsKey(sendSmsRequest.getCaseId())) { + if (aBoolean) { + sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(1); + } else { + sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(0); + } } } + smsRecordMapper.batchSaveSmsSendRecord(smsSendRecordList); } - smsRecordMapper.batchSaveSmsSendRecord(smsSendRecordList); + + } - - + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("导入失败,请检查抓取规则是否正确"); } }); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/task/CaseZipImportTask.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/task/CaseZipImportTask.java index cef7c34..a1d04ec 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/task/CaseZipImportTask.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/task/CaseZipImportTask.java @@ -49,16 +49,20 @@ public class CaseZipImportTask implements Callable> { @Override public List call() { List caseApplications = new ArrayList<>(); - for (File file1 : files) { - if (file1.isDirectory() && file1.listFiles() != null) { + try { + for (File file1 : files) { + if (file1.isDirectory() && file1.listFiles() != null) { - for (File file2 : file1.listFiles()) { - CaseApplication caseApplication = caseZipImportImpl.buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, fatchMap, userMap, dictDataList, deptMap, loginUser); - if (caseApplication != null) { - caseApplications.add(caseApplication); + for (File file2 : file1.listFiles()) { + CaseApplication caseApplication = caseZipImportImpl.buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, fatchMap, userMap, dictDataList, deptMap, loginUser); + if (caseApplication != null) { + caseApplications.add(caseApplication); + } } } } + } catch (Exception e) { + throw new RuntimeException("导入失败"); } return caseApplications; diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationLogMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationLogMapper.xml index b1b4945..5aca5c5 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationLogMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationLogMapper.xml @@ -204,23 +204,23 @@ delete from case_application_log l where l.id in - - #{id} + + #{item} ; delete from case_affiliate_log l where l.case_appli_log_id in - - #{id} + + #{item} ; delete from case_attach_log l where l.case_appli_log_id in - - #{id} + + #{item} ; delete from column_value_log l where l.case_appli_log_id in - - #{id} + + #{item} ; diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml index f95d31a..b354bce 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml @@ -5,54 +5,54 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - + + - - - - + + + + - - - - - + + + + + - - - - - + + + + + - - + + @@ -368,6 +368,114 @@ JOIN case_affiliate ca ON ca.case_appli_id = c.id AND ca.identity_type=1 WHERE r.create_by=#{loginUserName} AND ca.identity_type=1 + and c.id not in( + + + + select c.id + from case_application c + JOIN case_affiliate ca ON ca.case_appli_id = c.id + + + + + or (ca.identity_num=#{idCard} AND ca.identity_type=2 + and (c.case_status=4 or c.case_status=17) + ) + + + + or ( ca.identity_type=1 and + c.case_status in (7,13,17,18) + and + instr (c.arbitrator_id,#{userId})>0) + + + + or (ca.identity_type=1) + + + + or (ca.identity_type=1 + and c.case_status =#{financeStatus} + ) + + + + or ( + ca.application_organ_id in + #{deptId} + + AND ca.identity_type=1 + and c.case_status in (0,9) + ) + + + + union + + + + + + select c.id + from case_application c + JOIN case_affiliate ca ON ca.case_appli_id =c.id AND ca.identity_type = 1 + + + (c.case_status <= 10 or c.case_status=31) AND + ca.identity_type=1 + + + AND ca.application_organ_id = #{applicationOrganId} + + + union + + + + + + SELECT + c.id + FROM + case_application c + JOIN case_affiliate ca ON ca.case_appli_id = c.id AND ca.identity_type = 1 + JOIN case_application_log l on l.case_appli_id=c.id and l.update_submit_status not in(1, 2) and + l.version + = ( + SELECT + max( version ) version + FROM + case_application_log + WHERE case_appli_id = c.id + ) + WHERE + ca.identity_type=1 + and c.case_status in (1,5,8,9,11,14,15,16,17,31) + union + + SELECT + l.case_appli_id id + FROM + case_application c + JOIN case_application_log l ON c.id = l.case_appli_id + JOIN case_affiliate_log ca ON ca.case_appli_log_id = l.id + AND ca.identity_type = 1 + WHERE + l.update_submit_status IN ( 1, 2 ) and ca.identity_type=1 + + + AND l.version = ( + SELECT + max( version ) version + FROM + case_application_log + WHERE + c.id = case_appli_id) + + + ) @@ -391,13 +499,13 @@ - select DISTINCT(c.id) id,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method , CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理' ELSE '无审理方式' END arbitratMethodName, c.case_status , - CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费' + CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费' when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核' when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理' when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书' @@ -408,9 +516,11 @@ ELSE '无案件状态' END caseStatusName, c.hear_date ,c.arbitrat_claims , - c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable , + c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag + ,c.fee_payable , c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time ,c.lock_status, - 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 + 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 from case_log_record r join case_application c on r.case_appli_id=c.id JOIN case_affiliate ca ON ca.case_appli_id = c.id AND ca.identity_type=1 @@ -423,10 +533,10 @@ AND c.case_num = #{caseNum} - AND ca.application_organ_id=#{nameId} AND ca.identity_type=1 + AND ca.application_organ_id=#{nameId} AND ca.identity_type=1 - AND r.create_by=#{loginUserName} AND ca.identity_type=1 + AND r.create_by=#{loginUserName} AND ca.identity_type=1 @@ -443,7 +553,8 @@ from( select t.id,t.case_num ,t.case_subject_amount ,t.register_date ,t.arbitrat_method, t.arbitratMethodName,t.case_status,t.caseStatusName,t.hear_date ,t.arbitrat_claims , - t.loan_start_date ,t.loan_end_date ,t.claim_princi_owed ,t.claim_interest_owed ,t.claim_liquid_damag,t.fee_payable , + t.loan_start_date ,t.loan_end_date ,t.claim_princi_owed ,t.claim_interest_owed + ,t.claim_liquid_damag,t.fee_payable , t.begin_video_date ,t.online_video_person ,t.contract_number ,t.create_by ,t.create_time , t.update_by ,t.update_time , t.arbitrator_name,t.name,t.application_organ_id,t.applicantName, t.arbitrator_id,t.identity_num , t.identity_type,t.filearbitra_url,t.lock_status,t.version @@ -480,7 +591,7 @@ AND c.case_num = #{caseNum} - AND ca.application_organ_id=#{nameId} AND ca.identity_type=1 + AND ca.application_organ_id=#{nameId} AND ca.identity_type=1 and c.case_status in @@ -521,7 +632,7 @@ - or (t.identity_type=1 and t.case_status =#{financeStatus}) + or (t.identity_type=1 and t.case_status =#{financeStatus}) @@ -565,7 +676,8 @@ - select DISTINCT(t.id),t.case_status,t.application_organ_id, t.arbitrator_id,t.identity_num , t.identity_type from( + select DISTINCT(t.id),t.case_status,t.application_organ_id, t.arbitrator_id,t.identity_num , + t.identity_type from( select c.id , c.case_status,ca.application_organ_id, c.arbitrator_id,ca.identity_num , ca.identity_type @@ -612,7 +724,7 @@ - or ( t.identity_type=1 and t.case_status =#{financeStatus}) + or ( t.identity_type=1 and t.case_status =#{financeStatus}) @@ -651,12 +763,12 @@ ca.identity_type=1 and c.case_status in (1,5,8,9,11,14,15,16,17,31) - + AND c.case_status = #{caseStatus} @@ -665,7 +777,7 @@ AND ca.application_organ_id=#{nameId} AND ca.identity_type=1 union - select c.id , + select c.id , c.case_status,ca.application_organ_id, c.arbitrator_id,ca.identity_num , ca.identity_type FROM @@ -694,7 +806,7 @@ ELSE '无审理方式' END arbitratMethodName, c.case_status , - CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费' + CASE c.case_status when 0 then '立案申请' when 1 then '待立案审查' when 2 then '待缴费' when 3 then '待缴费确认' when 4 then '待案件质证' when 5 then '待组庭审核' when 6 then '待组庭确定' when 7 then '待审核仲裁方式' when 8 then '待开庭审理' when 9 then '待书面审理' when 10 then '待生成仲裁文书' when 11 then '待核验仲裁文书' @@ -705,9 +817,11 @@ ELSE '无案件状态' END caseStatusName, c.hear_date ,c.arbitrat_claims , - c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable , + c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag + ,c.fee_payable , c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time ,c.lock_status, - 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 + 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 case_application_log where case_appli_id=c.id order by version desc limit 1) as version,(select update_submit_status from case_application_log where case_appli_id=c.id order by version desc limit 1) as updateSubmitStatus,c.batch_number @@ -726,7 +840,7 @@ AND c.case_num = #{caseNum} - AND ca.application_organ_id=#{nameId} AND ca.identity_type=1 + AND ca.application_organ_id=#{nameId} AND ca.identity_type=1 and c.case_status in @@ -791,7 +905,7 @@