From 17ed15f08e362adb62ae79a0619833b6e3b82169 Mon Sep 17 00:00:00 2001 From: buaixuexideshitongxue <2936013465@qq.com> Date: Thu, 11 Jun 2026 12:04:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=A2=AB=E6=8A=95=E8=AF=89=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E6=94=B9=E4=B8=BA=E6=B6=89=E5=8F=8A=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=EF=BC=8C=E5=8F=AF=E4=BB=A5=E9=80=89=E4=B8=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ComplaintCollectionUpdateParam.java | 4 +- .../ComplaintCollectionAddRequest.java | 12 +-- .../ComplaintCollectionUpdateRequest.java | 12 +-- .../ComplaintCollectionDetailVo.java | 6 ++ .../ComplaintCollectionServiceImpl.java | 98 +++++++++++++++---- .../mapper/ComplaintCollectionMapper.xml | 2 +- 6 files changed, 102 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/biutag/supervision/pojo/param/ComplaintCollection/ComplaintCollectionUpdateParam.java b/src/main/java/com/biutag/supervision/pojo/param/ComplaintCollection/ComplaintCollectionUpdateParam.java index 1a9f6d8..31ebe5f 100644 --- a/src/main/java/com/biutag/supervision/pojo/param/ComplaintCollection/ComplaintCollectionUpdateParam.java +++ b/src/main/java/com/biutag/supervision/pojo/param/ComplaintCollection/ComplaintCollectionUpdateParam.java @@ -48,10 +48,10 @@ public class ComplaintCollectionUpdateParam { @Schema(description = "联系电话") private String responderPhone; - @Schema(description = "被投诉二级机构Id") + @Schema(description = "涉及二级机构Id") private String secondDepartId; - @Schema(description = "被投诉二级机构") + @Schema(description = "涉及二级机构") private String secondDepartName; @Schema(description = "来信内容") diff --git a/src/main/java/com/biutag/supervision/pojo/request/complaintCollection/ComplaintCollectionAddRequest.java b/src/main/java/com/biutag/supervision/pojo/request/complaintCollection/ComplaintCollectionAddRequest.java index 6954832..442b672 100644 --- a/src/main/java/com/biutag/supervision/pojo/request/complaintCollection/ComplaintCollectionAddRequest.java +++ b/src/main/java/com/biutag/supervision/pojo/request/complaintCollection/ComplaintCollectionAddRequest.java @@ -54,11 +54,11 @@ public class ComplaintCollectionAddRequest implements ParamChecked { @Schema(description = "联系电话") private String responderPhone; - @Schema(description = "被投诉二级机构Id") - private String secondDepartId; + @Schema(description = "涉及单位Id") + private String involveDepartId; - @Schema(description = "被投诉二级机构") - private String secondDepartName; + @Schema(description = "涉及单位名称") + private String involveDepartName; @Schema(description = "来信内容") private String thingDesc; @@ -163,8 +163,8 @@ public class ComplaintCollectionAddRequest implements ParamChecked { if (StrUtil.isNotBlank(responderIdCode) && !IdcardUtil.isValidCard(responderIdCode)){ throw new IllegalArgumentException("身份证格式不对!"); } - if (StrUtil.hasBlank(secondDepartId,secondDepartName)) { - throw new IllegalArgumentException("被投诉二级机构不能为空"); + if (StrUtil.hasBlank(involveDepartId,involveDepartName)) { + throw new IllegalArgumentException("涉及单位不能为空"); } if (StrUtil.isBlank(thingDesc)) { diff --git a/src/main/java/com/biutag/supervision/pojo/request/complaintCollection/ComplaintCollectionUpdateRequest.java b/src/main/java/com/biutag/supervision/pojo/request/complaintCollection/ComplaintCollectionUpdateRequest.java index db658fd..527babe 100644 --- a/src/main/java/com/biutag/supervision/pojo/request/complaintCollection/ComplaintCollectionUpdateRequest.java +++ b/src/main/java/com/biutag/supervision/pojo/request/complaintCollection/ComplaintCollectionUpdateRequest.java @@ -42,11 +42,11 @@ public class ComplaintCollectionUpdateRequest implements ParamChecked { @Schema(description = "联系电话") private String responderPhone; - @Schema(description = "被投诉二级机构Id") - private String secondDepartId; + @Schema(description = "被投诉机构Id") + private String involveDepartId; - @Schema(description = "被投诉二级机构") - private String secondDepartName; + @Schema(description = "被投诉机构") + private String involveDepartName; @Schema(description = "来信内容") private String thingDesc; @@ -91,8 +91,8 @@ public class ComplaintCollectionUpdateRequest implements ParamChecked { && StrUtil.isBlank(responderName) && StrUtil.isBlank(responderIdCode) && StrUtil.isBlank(responderPhone) - && StrUtil.isBlank(secondDepartId) - && StrUtil.isBlank(secondDepartName) + && StrUtil.isBlank(involveDepartId) + && StrUtil.isBlank(involveDepartName) && StrUtil.isBlank(thingDesc) && CollectionUtil.isEmpty(involveProblemIdList) && StrUtil.isBlank(repeatt) diff --git a/src/main/java/com/biutag/supervision/pojo/vo/complaintCollection/ComplaintCollectionDetailVo.java b/src/main/java/com/biutag/supervision/pojo/vo/complaintCollection/ComplaintCollectionDetailVo.java index 6272fef..6239b70 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/complaintCollection/ComplaintCollectionDetailVo.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/complaintCollection/ComplaintCollectionDetailVo.java @@ -41,6 +41,12 @@ public class ComplaintCollectionDetailVo { @Schema(description = "联系电话") private String responderPhone; + @Schema(description = "涉及单位ID") + private String involveDepartId; + + @Schema(description = "涉及单位名称") + private String involveDepartName; + @Schema(description = "被投诉二级机构ID") private String secondDepartId; diff --git a/src/main/java/com/biutag/supervision/service/complaintCollection/ComplaintCollectionServiceImpl.java b/src/main/java/com/biutag/supervision/service/complaintCollection/ComplaintCollectionServiceImpl.java index 5dd1757..30e6fc2 100644 --- a/src/main/java/com/biutag/supervision/service/complaintCollection/ComplaintCollectionServiceImpl.java +++ b/src/main/java/com/biutag/supervision/service/complaintCollection/ComplaintCollectionServiceImpl.java @@ -119,10 +119,32 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic } } SupDepartQueryParam supDepartQueryParam = new SupDepartQueryParam(); - supDepartQueryParam.setId(request.getSecondDepartId()); + supDepartQueryParam.setId(request.getInvolveDepartId()); List supDepartList = supDepartResourceService.query(supDepartQueryParam); - if (CollectionUtil.isEmpty(supDepartList) || supDepartList.get(0).getLevel()!=2){ - throw new IllegalStateException("请选择正确的二级机构"); + if (CollectionUtil.isEmpty(supDepartList)) { + throw new IllegalStateException("请选择正确的涉及单位"); + } + SupDepart supDepart = supDepartList.get(0); + String secondDepartId = null; + String secondDepartName = null; + String thirdDepartId = null; + String thirdDepartName = null; + + if (supDepart.getLevel() == 3) { + // 查出父级2级 + SupDepartQueryParam parentParam = new SupDepartQueryParam(); + parentParam.setId(supDepart.getPid()); + List parentList = supDepartResourceService.query(parentParam); + SupDepart parent = CollectionUtil.isNotEmpty(parentList) ? parentList.get(0) : null; + thirdDepartId = supDepart.getId(); + thirdDepartName = supDepart.getShortName(); + secondDepartId = parent != null ? parent.getId() : null; + secondDepartName = parent != null ? parent.getShortName() : null; + } else if (supDepart.getLevel() == 2) { + secondDepartId = supDepart.getId(); + secondDepartName = supDepart.getShortName(); + } else { + throw new IllegalStateException("涉及单位只支持2级或3级"); } // 手动创建 ComplaintCollection,只设置特有字段 ComplaintCollection complaintCollection = new ComplaintCollection(); @@ -133,8 +155,10 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic complaintCollection.setLeadApproval(request.getLeadApproval()); complaintCollection.setTag(request.getTag()); complaintCollection.setHandleMethod(request.getHandleMethod()); - complaintCollection.setSecondDepartId(request.getSecondDepartId()); - complaintCollection.setSecondDepartName(request.getSecondDepartName()); + complaintCollection.setSecondDepartId(secondDepartId); + complaintCollection.setSecondDepartName(secondDepartName); + complaintCollection.setThirdDepartId(thirdDepartId); + complaintCollection.setThirdDepartName(thirdDepartName); // 生成编号 if (StrUtil.isBlank(request.getOriginId())) { complaintCollection.setOriginId(SfssUtil.generateIdWithPrefix(request.getSourceTable())); @@ -204,11 +228,42 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic if (!exists) { throw new NoSuchElementException("未找到可修改信息"); } - SupDepartQueryParam supDepartQueryParam = new SupDepartQueryParam(); - supDepartQueryParam.setId(request.getSecondDepartId()); - List supDepartList = supDepartResourceService.query(supDepartQueryParam); - if (CollectionUtil.isEmpty(supDepartList) || supDepartList.get(0).getLevel()!=2){ - throw new IllegalStateException("请选择正确的二级机构"); + // 涉及单位校验(可以是2级或3级) + String involveDepartId = request.getInvolveDepartId(); + String involveDepartName = request.getInvolveDepartName(); + String secondDepartId = null; + String secondDepartName = null; + String thirdDepartId = null; + String thirdDepartName = null; + + if (StrUtil.isNotBlank(involveDepartId)) { + // 先查出自己 + SupDepartQueryParam departParam = new SupDepartQueryParam(); + departParam.setId(involveDepartId); + List departList = supDepartResourceService.query(departParam); + if (CollectionUtil.isEmpty(departList)) { + throw new IllegalStateException("请选择正确的涉及机构"); + } + SupDepart depart = departList.get(0); + + // 再查出父级 + SupDepartQueryParam parentParam = new SupDepartQueryParam(); + parentParam.setId(depart.getPid()); + List parentList = supDepartResourceService.query(parentParam); + SupDepart parent = CollectionUtil.isNotEmpty(parentList) ? parentList.get(0) : null; + + // 根据级别判断 + if (depart.getLevel() == 3) { + thirdDepartId = depart.getId(); + thirdDepartName = depart.getShortName(); + secondDepartId = parent != null ? parent.getId() : null; + secondDepartName = parent != null ? parent.getShortName() : null; + } else if (depart.getLevel() == 2) { + secondDepartId = depart.getId(); + secondDepartName = depart.getShortName(); + } else { + throw new IllegalStateException("涉及机构只支持2级或3级"); + } } // 手动创建 ComplaintCollectionUpdateParam,只设置特有字段 ComplaintCollectionUpdateParam updateParam = new ComplaintCollectionUpdateParam(); @@ -224,8 +279,10 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic // tag 处理 updateParam.setTags(request.getTags()); updateParam.setHandleMethod(request.getHandleMethod()); - updateParam.setSecondDepartId(request.getSecondDepartId()); - updateParam.setSecondDepartName(request.getSecondDepartName()); + updateParam.setSecondDepartId(secondDepartId); + updateParam.setSecondDepartName(secondDepartName); + updateParam.setThirdDepartId(thirdDepartId); + updateParam.setThirdDepartName(thirdDepartName); // 5) 更新(只更新非空字段) boolean ok = complaintCollectionResourceService.updateSelectiveById(updateParam); if (!ok) { @@ -238,7 +295,8 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic negativeDto.setDiscoveryTime(request.getDiscoveryTime()); negativeDto.setInvolveProblem(request.getInvolveProblemIdList()); negativeDto.setThingDesc(request.getThingDesc()); - negativeDto.setInvolveDepartId(request.getSecondDepartId()); + negativeDto.setInvolveDepartId(request.getInvolveDepartId()); + negativeDto.setInvolveDepartName(request.getInvolveDepartName()); // 问题来源 if (ComplaintCollectionSourceTableEnum.LEADER_ASSIGN.getCode().equals(request.getSourceTable())) { negativeDto.setProblemSourcesCode(request.getSourceTableSubOne()); @@ -671,6 +729,8 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic vo.setInvolveProblem(negative.getInvolveProblem()); vo.setBusinessTypeCode(negative.getBusinessTypeCode()); vo.setBusinessTypeName(negative.getBusinessTypeName()); + vo.setInvolveDepartId(negative.getInvolveDepartId()); + vo.setInvolveDepartName(negative.getInvolveDepartName()); } } @@ -724,10 +784,14 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic // 业务类别 dto.setBusinessTypeCode(request.getBusinessTypeCode()); - // 涉及单位 - 使用被投诉二级机构 - dto.setInvolveDepartId(request.getSecondDepartId()); - dto.setInvolveDepartName(request.getSecondDepartName()); - + // 设置涉及单位到 negativeDto(优先使用3级,没有就用2级) + if (StrUtil.isNotBlank(complaintCollection.getThirdDepartId())) { + dto.setInvolveDepartId(complaintCollection.getThirdDepartId()); + dto.setInvolveDepartName(complaintCollection.getThirdDepartName()); + } else { + dto.setInvolveDepartId(complaintCollection.getSecondDepartId()); + dto.setInvolveDepartName(complaintCollection.getSecondDepartName()); + } // 内容描述 dto.setThingDesc(request.getThingDesc()); diff --git a/src/main/resources/mapper/ComplaintCollectionMapper.xml b/src/main/resources/mapper/ComplaintCollectionMapper.xml index b075086..4c3a6b1 100644 --- a/src/main/resources/mapper/ComplaintCollectionMapper.xml +++ b/src/main/resources/mapper/ComplaintCollectionMapper.xml @@ -224,7 +224,7 @@ n.check_status_desc AS checkStatusDesc, -- 涉及单位名称:如果部门是3级则拼接父级名称 CONCAT( - CASE WHEN sd_involve.level = 3 THEN CONCAT(sd_parent.name, '/') ELSE '' END, + CASE WHEN sd_involve.level = 3 THEN CONCAT(sd_parent.short_name, '/') ELSE '' END, n.involveDepartName ) AS involveDepartName, n.handle_second_depart_id AS handleSecondDepartId,