From 01fd6157e1bd3d3777c4ebdf66b6bf9de59ed91d Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Tue, 10 Oct 2023 20:53:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=BB=84=E7=BB=87=E6=9C=BA?= =?UTF-8?q?=E6=9E=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CaseApplicationController.java | 6 ++--- .../impl/CaseApplicationServiceImpl.java | 24 +++++++++++++------ .../wisdomarbitrate/CaseApplicationMapper.xml | 12 ++++++---- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index 543c4f9..33cd573 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -1,5 +1,6 @@ package com.ruoyi.web.controller.wisdomarbitrate; +import cn.hutool.core.util.StrUtil; import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; @@ -47,10 +48,7 @@ public class CaseApplicationController extends BaseController { @PostMapping("/addCaseApplication") public AjaxResult addCaseApplication(@Validated @RequestBody CaseApplication caseApplication) { - int caseApplicationCount = caseApplicationService.selectCaseApplicationCount(caseApplication); - if(caseApplicationCount>0){ - return error("新增立案申请'" + caseApplication.getCaseNum() + "'案件编号已存在"); - } + caseApplication.setCreateBy(getUsername()); return toAjax(caseApplicationService.insertcaseApplication(caseApplication)); } 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 4866118..27b9298 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 @@ -72,25 +72,24 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { List caseAffiliates = caseApplication.getCaseAffiliates(); Map deptMap =new HashMap<>(); if (caseAffiliates != null && caseAffiliates.size() > 0) { - if(StrUtil.isNotEmpty(caseApplication.getName())) { // 查询所有的组织机构,组装成map List deptList = sysDeptMapper.selectDeptList(new SysDept()); if (CollectionUtil.isEmpty(deptList)) { deptList = new ArrayList<>(); } - deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId)); - } + deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId,(oldV,newV)->newV)); + for (CaseAffiliate caseAffiliate : caseAffiliates) { caseAffiliate.setCaseAppliId(caseApplication.getId()); - if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseApplication.getName())) { + if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) { // 将组织机构id设为申请人名称 if (deptMap.containsKey(caseApplication.getName())) { - caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName()))); + caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName()))); } else { // 如果不存在则新增 SysDept dept = new SysDept(); dept.setParentId(0L); - dept.setDeptName(caseApplication.getName()); + dept.setDeptName(caseAffiliate.getName()); dept.setAncestors("0"); dept.setOrderNum(1); dept.setStatus("0"); @@ -227,12 +226,23 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { List caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); if(caseAffiliatListeselect!=null){ + // 查询组织机构 + List sysDepts = sysDeptMapper.selectDeptList(new SysDept()); + Map deptMap=new HashMap<>(); + if(CollectionUtil.isNotEmpty(sysDepts)){ + for (SysDept sysDept : sysDepts) { + deptMap.put(String.valueOf(sysDept.getDeptId()),sysDept.getDeptName()); + } + } StringBuffer applicantName = new StringBuffer(); StringBuffer respondentName = new StringBuffer(); for (int i = 0; i < caseAffiliatListeselect.size(); i++){ CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(i); int identityType = caseAffiliateselect.getIdentityType(); if(identityType==1){ + if(StrUtil.isNotEmpty(caseAffiliateselect.getName())&&deptMap.containsKey(caseAffiliateselect.getName())){ + caseAffiliateselect.setName(deptMap.get(caseAffiliateselect.getName())); + } applicantName.append(caseAffiliateselect.getName()).append(",");; }else if(identityType==2){ respondentName.append(caseAffiliateselect.getName()).append(",");; @@ -258,7 +268,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { List deptList = sysDeptMapper.selectDeptList(new SysDept()); Map deptMap =new HashMap<>(); if(CollectionUtil.isNotEmpty(deptList)) { - deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId)); + deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId,(oldV,newV)->newV)); } List caseApplicationListinsert = new ArrayList<>(); for (int i = 0; i < caseApplicationList.size(); i++){ diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml index 0e8219b..6048e88 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml @@ -55,10 +55,10 @@ 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.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time , - c.update_by ,c.update_time , c.arbitrator_name,d.dept_name as name + c.update_by ,c.update_time , c.arbitrator_name,d.dept_name as applicantName from case_application c LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1 - LEFT JOIN sys_dept d ON ca.NAME = d.dept_id + LEFT JOIN sys_dept d ON ca.NAME = d.dept_id and ca.name=d.dept_id AND c.case_status = #{caseStatus} @@ -206,8 +206,10 @@ 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.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time , - c.update_by ,c.update_time,c.arbitrator_id,c.arbitrator_name + c.update_by ,c.update_time,c.arbitrator_id,c.arbitrator_name,d.dept_name as applicantName from case_application c + LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1 + LEFT JOIN sys_dept d ON ca.NAME = d.dept_id and ca.name=d.dept_id AND c.id = #{id} @@ -236,8 +238,10 @@ p.payment_status , CASE p.payment_status when 1 then '已支付' when 0 then '未支付' ELSE '无支付状态' - END paymentStatusName + END paymentStatusName,d.dept_name as applicantName from case_application c left join case_payment_record p on c.id = p.case_id + LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1 + LEFT JOIN sys_dept d ON ca.NAME = d.dept_id and ca.name=d.dept_id where c.case_status = 3 and p.payment_status = 1 AND c.id = #{id} -- 2.54.0