diff --git a/sql/1027.sql b/sql/1027.sql new file mode 100644 index 0000000..1e0fc67 --- /dev/null +++ b/sql/1027.sql @@ -0,0 +1,21 @@ +UPDATE negative_work w + LEFT JOIN negative n ON w.create_time = n.crtTime + AND n.involveDepartId = w.depart_id + SET w.negative_id = n.id +WHERE + w.negative_id IS NULL + AND n.id IS NOT NULL; + +UPDATE negative +SET handle_three_depart_id = involveDepartId, + handle_three_depart_name = involveDepartName +WHERE + crtTime > '2024-10-25 19:00:00' + AND handle_three_depart_id IS NULL; + +// 删除数据 +DELETE +FROM + negative_work +WHERE + negative_id IS NULL; \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/constants/enums/ProblemSourcesEnum.java b/src/main/java/com/biutag/supervision/constants/enums/ProblemSourcesEnum.java index 82bf7e8..9bc160e 100644 --- a/src/main/java/com/biutag/supervision/constants/enums/ProblemSourcesEnum.java +++ b/src/main/java/com/biutag/supervision/constants/enums/ProblemSourcesEnum.java @@ -24,7 +24,7 @@ public enum ProblemSourcesEnum { SJJD("审计监督", "26"), - JWDC("警务调查", "2"), + JWDC("警务评议", "2"), JYDC("警意调查", "3"), CFJD("持法监督", "4"), JCKH("检查考核", "8"), diff --git a/src/main/java/com/biutag/supervision/controller/api/jwdc/NegativeApiController.java b/src/main/java/com/biutag/supervision/controller/api/jwdc/NegativeApiController.java index 8079b74..ec40c46 100644 --- a/src/main/java/com/biutag/supervision/controller/api/jwdc/NegativeApiController.java +++ b/src/main/java/com/biutag/supervision/controller/api/jwdc/NegativeApiController.java @@ -1,11 +1,11 @@ package com.biutag.supervision.controller.api.jwdc; +import com.alibaba.fastjson.JSON; import com.biutag.supervision.pojo.domain.Blame; import com.biutag.supervision.pojo.dto.jwdc.NegativeApiDto; import com.biutag.supervision.pojo.entity.Negative; import com.biutag.supervision.service.NegativeBlameService; import com.biutag.supervision.service.NegativeService; -import com.biutag.supervision.util.JSON; import jakarta.validation.Valid; import jakarta.validation.constraints.NotBlank; import lombok.RequiredArgsConstructor; @@ -43,7 +43,7 @@ public class NegativeApiController { return new ArrayList<>(); } List list = negativeBlameService.list(negative.getId()); - log.info("警务调查责任民警查询,返回结果: {}", JSON.toJSONString(list)); + log.info("警务调查责任民警查询,返回结果数量: {}", list.size()); return list; } } diff --git a/src/main/java/com/biutag/supervision/controller/data/DataCaseVerifController.java b/src/main/java/com/biutag/supervision/controller/data/DataCaseVerifController.java index 4220db4..9ca59c1 100644 --- a/src/main/java/com/biutag/supervision/controller/data/DataCaseVerifController.java +++ b/src/main/java/com/biutag/supervision/controller/data/DataCaseVerifController.java @@ -62,14 +62,14 @@ public class DataCaseVerifController { @Override public void invoke(DataCaseVerifImportDto data, AnalysisContext analysisContext) { String secondDepartId = secondDeparts.stream() - .filter(item -> item.getShortName().equals(data.getInvolveSecondDepartName())).findFirst() + .filter(item -> item.getShortName().equals(data.getSecondDepartName())).findFirst() .map(SupDepart::getId).orElse(""); - data.setInvolveSecondDepartName(secondDepartId); + data.setSecondDepartId(secondDepartId); if (StrUtil.isNotBlank(secondDepartId)) { String complainedThirdDepartId = departService.list(new LambdaQueryWrapper().eq(SupDepart::getPid, secondDepartId) - .like(SupDepart::getShortName, data.getInvolveThirdDepartName())) + .like(SupDepart::getShortName, data.getThirdDepartName())) .stream().findFirst().map(SupDepart::getId).orElse(""); - data.setInvolveThirdDepartName(complainedThirdDepartId); + data.setThirdDepartId(complainedThirdDepartId); } Set> validate = validator.validate(data); if (!validate.isEmpty()) { diff --git a/src/main/java/com/biutag/supervision/controller/data/DataPetitionComplaintController.java b/src/main/java/com/biutag/supervision/controller/data/DataPetitionComplaintController.java index ea1de35..893fbad 100644 --- a/src/main/java/com/biutag/supervision/controller/data/DataPetitionComplaintController.java +++ b/src/main/java/com/biutag/supervision/controller/data/DataPetitionComplaintController.java @@ -86,12 +86,12 @@ public class DataPetitionComplaintController { String secondDepartId = secondDeparts.stream() .filter(item -> item.getShortName().equals(data.getInvolveSecondDepartName())).findFirst() .map(SupDepart::getId).orElse(""); - data.setInvolveSecondDepartName(secondDepartId); + data.setInvolveSecondDepartId(secondDepartId); if (StrUtil.isNotBlank(secondDepartId)) { String complainedThirdDepartId = departService.list(new LambdaQueryWrapper().eq(SupDepart::getPid, secondDepartId) .like(SupDepart::getShortName, data.getInvolveThirdDepartName())) .stream().findFirst().map(SupDepart::getId).orElse(""); - data.setInvolveThirdDepartName(complainedThirdDepartId); + data.setInvolveThirdDepartId(complainedThirdDepartId); } Set> validate = validator.validate(data); if (!validate.isEmpty()) { diff --git a/src/main/java/com/biutag/supervision/controller/datav/DataVController.java b/src/main/java/com/biutag/supervision/controller/datav/DataVController.java index 69ac723..e0a8d29 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/DataVController.java +++ b/src/main/java/com/biutag/supervision/controller/datav/DataVController.java @@ -1,13 +1,19 @@ package com.biutag.supervision.controller.datav; +import cn.hutool.core.util.NumberUtil; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.biutag.supervision.pojo.Result; +import com.biutag.supervision.pojo.entity.DataCaseVerif; import com.biutag.supervision.service.DataCaseVerifService; import lombok.RequiredArgsConstructor; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.math.BigDecimal; import java.util.Date; /** @@ -22,22 +28,22 @@ public class DataVController { private final DataCaseVerifService dataCaseVerifService; @GetMapping("caseVerif") - public Result caseVerif(Date beginTime, Date endTime) { - long total = dataCaseVerifService.count(); + public Result caseVerif(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + long total = dataCaseVerifService.count(new LambdaQueryWrapper().between(DataCaseVerif::getDiscoveryTime, beginTime, endTime)); long confirmed = 0; JSONObject overview = new JSONObject() // 案件总数(起) .fluentPut("total", total) // 查实案件数 - .fluentPut("confirmed", "") + .fluentPut("confirmed", 0) // 查处问题(个) .fluentPut("investigateAndPunish", 0) // 问责人次 - .fluentPut("wzrc", 0) + .fluentPut("accountablePeopleNumber", 0) // 问责单位数 - .fluentPut("wzdws", 0) + .fluentPut("accountableDepartNumber", 0) // 查实率 - .fluentPut("confirmedRate", confirmed / total * 100 + "%"); + .fluentPut("confirmedRate", total == 0 ? 0 : BigDecimal.valueOf(NumberUtil.div(confirmed, total) * 100).intValue()); JSONObject data = new JSONObject().fluentPut("overview", overview); return Result.success(data); } diff --git a/src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java b/src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java index daf0866..e602321 100644 --- a/src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java @@ -2,6 +2,7 @@ package com.biutag.supervision.flow.action; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.biutag.supervision.constants.AppConstants; @@ -91,7 +92,7 @@ public class ApplyCompletionAction implements Action { negativeBlame.setAssistStartTime(item.getAssistTime().get(0)) .setAssistEndTime(item.getAssistTime().get(1)); } - problemRelations.addAll(item.getProblems().stream().map(problem -> { + problemRelations.addAll(item.getProblems().stream().filter(problem -> StrUtil.isNotBlank(problem.getOneLevelCode())).map(problem -> { NegativeProblemRelation problemRelation = new NegativeProblemRelation(); BeanUtil.copyProperties(problem, problemRelation); problemRelation.setId(IdUtil.fastSimpleUUID()); @@ -106,9 +107,9 @@ public class ApplyCompletionAction implements Action { // 新增涉及人员 negativeBlameService.saveBatch(negativeBlames); // 新增涉及人员问题类型 + // 先删除 + negativeProblemRelationService.remove(negativeId); if (!problemRelations.isEmpty()) { - // 先删除 - negativeProblemRelationService.remove(negativeId); // 新增 negativeProblemRelationService.saveBatch(problemRelations); } diff --git a/src/main/java/com/biutag/supervision/pojo/domain/Blame.java b/src/main/java/com/biutag/supervision/pojo/domain/Blame.java index a2e6f96..d301431 100644 --- a/src/main/java/com/biutag/supervision/pojo/domain/Blame.java +++ b/src/main/java/com/biutag/supervision/pojo/domain/Blame.java @@ -105,11 +105,11 @@ public class Blame { private String assistCaseName; // 帮扶结束时间 - @JsonFormat(pattern = "YYYY-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime assistEndTime; // 帮扶开始时间 - @JsonFormat(pattern = "YYYY-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime assistStartTime; // 责任领导 @@ -165,8 +165,10 @@ public class Blame { // 统计人员类型 1 民警 2 其他 private String statisticsPersonType; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime crtTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime updTime; private String status; diff --git a/src/main/java/com/biutag/supervision/pojo/dto/DataCaseVerifImportDto.java b/src/main/java/com/biutag/supervision/pojo/dto/DataCaseVerifImportDto.java index d6461e4..69283b7 100644 --- a/src/main/java/com/biutag/supervision/pojo/dto/DataCaseVerifImportDto.java +++ b/src/main/java/com/biutag/supervision/pojo/dto/DataCaseVerifImportDto.java @@ -49,18 +49,16 @@ public class DataCaseVerifImportDto { private String policeTypeName; // 被投诉机构 + private String secondDepartId; + @ExcelProperty({"问题基本信息", "涉及单位(二级机构)"}) - private String involveSecondDepartName; + private String secondDepartName; // 被投诉机构 @ExcelProperty({"问题基本信息", "涉及单位(三级机构)"}) - private String involveThirdDepartName; - - - @NotBlank(message = "涉及二级机构为空或与系统未匹配上") - private String involveSecondDepartId; + private String thirdDepartName; - private String involveThirdDepartId; + private String thirdDepartId; // 具体内容 @ExcelProperty({"问题基本信息", "具体内容"}) diff --git a/src/main/java/com/biutag/supervision/pojo/dto/DataPetitionComplaintImportDto.java b/src/main/java/com/biutag/supervision/pojo/dto/DataPetitionComplaintImportDto.java index c365005..9d7c986 100644 --- a/src/main/java/com/biutag/supervision/pojo/dto/DataPetitionComplaintImportDto.java +++ b/src/main/java/com/biutag/supervision/pojo/dto/DataPetitionComplaintImportDto.java @@ -64,7 +64,7 @@ public class DataPetitionComplaintImportDto { @ExcelProperty({"信访基本信息", "业务类别"}) private String businessTypeName; - @NotBlank(message = "被投诉二级机构为空或与系统未匹配上") + @ExcelProperty({"信访基本信息", "被投诉二级机构"}) private String involveSecondDepartName; // 被投诉机构 diff --git a/src/main/java/com/biutag/supervision/pojo/entity/DataCaseVerif.java b/src/main/java/com/biutag/supervision/pojo/entity/DataCaseVerif.java index 3d05ef8..3fab562 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/DataCaseVerif.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/DataCaseVerif.java @@ -50,11 +50,15 @@ public class DataCaseVerif { @TableField("police_type_name") private String policeTypeName; - // 涉及单位 - @TableField("involve_depart_name") - private String involveDepartName; + // 涉及单位 二级 + private String secondDepartId; - private String involveDepartId; + private String secondDepartName; + + // 所对 + private String thirdDepartId; + + private String thirdDepartName; // 事情简述 @TableField("thing_desc") diff --git a/src/main/java/com/biutag/supervision/pojo/entity/DataPetitionComplaint.java b/src/main/java/com/biutag/supervision/pojo/entity/DataPetitionComplaint.java index e7990d1..2e8fd6b 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/DataPetitionComplaint.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/DataPetitionComplaint.java @@ -44,11 +44,11 @@ public class DataPetitionComplaint { // 缠访闹访 @TableField("entanglement_visits") - private String entanglementVisits; + private Boolean entanglementVisits; // 群众集访 @TableField("mass_visits") - private String massVisits; + private Boolean massVisits; // 涉嫌问题 @TableField("involve_problem") @@ -69,13 +69,15 @@ public class DataPetitionComplaint { //--------------------- - // 涉及单位 - @TableField("involve_depart_id") - private String involveDepartId; + // 涉及单位 二级 + private String secondDepartId; - // 涉及单位 - @TableField("involve_depart_name") - private String involveDepartName; + private String secondDepartName; + + // 所对 + private String thirdDepartId; + + private String thirdDepartName; private LocalDateTime createTime; diff --git a/src/main/java/com/biutag/supervision/pojo/param/NegativeQueryParam.java b/src/main/java/com/biutag/supervision/pojo/param/NegativeQueryParam.java index f27366a..c9a519e 100644 --- a/src/main/java/com/biutag/supervision/pojo/param/NegativeQueryParam.java +++ b/src/main/java/com/biutag/supervision/pojo/param/NegativeQueryParam.java @@ -44,4 +44,8 @@ public class NegativeQueryParam extends BasePage { // 是否超时 private Boolean timeoutFlag; + private String involveDepartId; + + private String handleDepartId; + } diff --git a/src/main/java/com/biutag/supervision/service/DataCaseVerifService.java b/src/main/java/com/biutag/supervision/service/DataCaseVerifService.java index adaf85c..0ce6268 100644 --- a/src/main/java/com/biutag/supervision/service/DataCaseVerifService.java +++ b/src/main/java/com/biutag/supervision/service/DataCaseVerifService.java @@ -50,13 +50,6 @@ public class DataCaseVerifService extends ServiceImpl page(NegativeQueryParam param) { UserAuth user = UserContextHolder.getCurrentUser(); if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) && (user.getRoleCodes().isEmpty() || user.getAuthSources().isEmpty() || user.getAuthDepartIds().isEmpty())) { @@ -72,6 +76,21 @@ public class NegativeQueryService { queryWrapper.isNotNull(Negative::getCompleteDate).apply("TIMESTAMPDIFF(HOUR, crtTime, completeDate) <= 72"); } } + // 涉及单位 + if (StrUtil.isNotBlank(param.getInvolveDepartId())) { + List departIds = departService.getAllNodeIds(param.getInvolveDepartId()); + queryWrapper.in(Negative::getInvolveDepartId, departIds); + } + // 办理单位 + if (StrUtil.isNotBlank(param.getHandleDepartId())) { + List nodes = departService.getAllNode(List.of(param.getHandleDepartId())); + List secondIds = nodes.stream().filter(node -> DepartLevelEnum.SECOND.getValue().equals(node.getLevel())).map(DepartTree::getId).toList(); + if (!secondIds.isEmpty()) { + queryWrapper.in(Negative::getHandleSecondDepartId, secondIds); + } else { + queryWrapper.in(Negative::getHandleThreeDepartId, nodes.stream().filter(node -> DepartLevelEnum.THREE.getValue().equals(node.getLevel())).map(DepartTree::getId).toList()); + } + } Page page = negativeService.page(Page.of(param.getCurrent(), param.getSize()), queryWrapper); long l = System.currentTimeMillis(); List list = page.getRecords().stream().map(item -> { diff --git a/src/main/java/com/biutag/supervision/service/NegativeService.java b/src/main/java/com/biutag/supervision/service/NegativeService.java index aa23628..946f425 100644 --- a/src/main/java/com/biutag/supervision/service/NegativeService.java +++ b/src/main/java/com/biutag/supervision/service/NegativeService.java @@ -158,8 +158,8 @@ public class NegativeService extends ServiceImpl { } NegativeWork work = new NegativeWork() - .setNegativeId(negative.getId()). - setStatus(WorkStatusEnum.todo.name()) + .setNegativeId(negative.getId()) + .setStatus(WorkStatusEnum.todo.name()) .setDepartId(AppConstants.ROOT_DEPART_ID) .setDepartName(AppConstants.ROOT_DEPART_NAME) .setRoleCode(RoleCodeEnum.FIRST_ADMIN.getCode()) @@ -186,10 +186,13 @@ public class NegativeService extends ServiceImpl { public boolean saveByJwdc(List list) { LocalDateTime now = LocalDateTime.now(); list.forEach(item -> { + if (exists(item.getOriginId())) { + throw new RuntimeException("样本源头编号已存在请核实"); + } SupDepart dept = departService.getByJwpyCode(item.getDepartCode()); Negative negative = new Negative(); - - negative.setId(IdUtil.getSnowflakeNextIdStr()) + BeanUtil.copyProperties(item, negative); + negative .setBusinessTypeCode(NegativeApiDto.BusinessType.getCode(item.getBusinessTypeName())) .setPoliceType(NegativeApiDto.BusinessType.getPoliceType(item.getBusinessTypeName())) .setPoliceTypeName(NegativeApiDto.BusinessType.getPoliceTypeName(item.getBusinessTypeName())) @@ -203,6 +206,7 @@ public class NegativeService extends ServiceImpl { .setMaxExtensionDuration(TimeLimitEnum.WORK_137.getMaxHandleDuration()) .setApprovalFlow(ApprovalFlowEnum.SECOND_APPROVAL.getValue()) .setFirstDistributeTime(now) + .setProcessingStatus(ProcessingStatusEnum.signing.name()) // 完成状态 0-待完善 1-已完善 .setCompleteStatus("0") .setTaskId("api") @@ -216,35 +220,44 @@ public class NegativeService extends ServiceImpl { involveProblem.put("dictValue", "1"); negative.setInvolveProblem(JSON.toJSONString(Collections.singletonList(involveProblem))); - NegativeWork work = new NegativeWork(); if (Objects.nonNull(dept)) { negative.setInvolveDepartId(dept.getId()) - .setInvolveDepartName(dept.getName()) + .setInvolveDepartName(dept.getShortName()) .setFlowKey(FlowNodeEnum.THREE_SIGN.getKey()); - work.setNegativeId(negative.getId()) - .setStatus(WorkStatusEnum.todo.name()) - .setDepartId(dept.getId()) - .setDepartName(dept.getName()) - .setRoleCode(RoleCodeEnum.THREE_ADMIN.getCode()) - .setProblemSourcesCode(negative.getProblemSourcesCode()) - .setUpdateTime(now) - .setCreateTime(now); + } + save(negative); + // 新增work + String departId; + String departName; + String roleCode; + if (Objects.nonNull(dept)) { + departId = dept.getId(); + departName = dept.getShortName(); + roleCode = RoleCodeEnum.THREE_ADMIN.getCode(); } else { log.error("未匹配上单位:{}, code: {}", item.getDepartName(), item.getDepartCode()); - work.setNegativeId(negative.getId()) - .setStatus(WorkStatusEnum.todo.name()) - .setDepartId(AppConstants.ROOT_DEPART_ID) - .setDepartName(AppConstants.ROOT_DEPART_NAME) - .setRoleCode(RoleCodeEnum.FIRST_ADMIN.getCode()) - .setUpdateTime(now) - .setCreateTime(now); + departId = AppConstants.ROOT_DEPART_ID; + departName = AppConstants.ROOT_DEPART_NAME; + roleCode = RoleCodeEnum.FIRST_ADMIN.getCode(); } - save(negative); + NegativeWork work = new NegativeWork() + .setNegativeId(negative.getId()) + .setDepartId(departId) + .setDepartName(departName) + .setRoleCode(roleCode) + .setProblemSourcesCode(negative.getProblemSourcesCode()) + .setStatus(WorkStatusEnum.todo.name()) + .setUpdateTime(now) + .setCreateTime(now); workService.save(work); }); return true; } + public boolean exists(String originId) { + return exists(new LambdaUpdateWrapper().eq(Negative::getOriginId, originId)); + } + /** * 生成样本源头编号 * @param problemSourcesCode @@ -255,7 +268,7 @@ public class NegativeService extends ServiceImpl { StrUtil.isBlank(businessTypeCode) ? "" : BusinessTypeEnum.get(businessTypeCode).getKey(), DateUtil.format(new Date(), DatePattern.PURE_DATE_FORMAT), RandomUtil.randomString(4)); - if (exists(new LambdaUpdateWrapper().eq(Negative::getOriginId, originId))) { + if (exists(originId)) { return generateOriginId(problemSourcesCode, businessTypeCode); } return originId; diff --git a/src/main/java/com/biutag/supervision/service/SupDepartService.java b/src/main/java/com/biutag/supervision/service/SupDepartService.java index d7d307d..2232439 100644 --- a/src/main/java/com/biutag/supervision/service/SupDepartService.java +++ b/src/main/java/com/biutag/supervision/service/SupDepartService.java @@ -44,40 +44,35 @@ public class SupDepartService extends ServiceImpl { return list(new LambdaQueryWrapper().in(SupDepart::getLevel, levels).eq(SupDepart::getStatus, StatusEnum.ENABLE.getValue()).orderByAsc(SupDepart::getOrderNo)); } - public List listAndChildrenIds(String departId) { - return listAndChildrenIds(List.of(departId)); + public List getAllNodeIds(String departId) { + return getAllNodeIds(List.of(departId)); } - public List listAndChildrenIds(List departIds) { - List list = buildTree(); - List ids = new ArrayList<>(); - listAndChildrenIds(departIds, list, ids); - return ids; + public List getAllNodeIds(List departIds) { + return getAllNode(departIds).stream().map(DepartTree::getId).toList(); } - private List listAndChildrenIds(List departIds, List list, List ids) { - list.forEach(item -> { + public List getAllNode(List departIds) { + List treeList = buildTree(); + List nodes = new ArrayList<>(); + getAllNodeRecursive(departIds, treeList, nodes); + return nodes; + } + + private void getAllNodeRecursive(List departIds, List treeList, List nodes) { + treeList.forEach(item -> { if (departIds.contains(item.getId())) { - listAndChildrenIds(ids, item); + getAllNodeRecursive(item, nodes); } else { - listAndChildrenIds(departIds, item.getChildren(), ids); + getAllNodeRecursive(departIds, item.getChildren(), nodes); } }); - return ids; } - private void listAndChildrenIds(List ids, DepartTree departTree) { - ids.add(departTree.getId()); - listAndChildrenIds(ids, departTree.getChildren()); - } - - private void listAndChildrenIds(List ids, List list) { - if (list.isEmpty()) { - return; - } - ids.addAll(list.stream().map(DepartTree::getId).toList()); - list.forEach(item -> { - listAndChildrenIds(ids, item.getChildren()); + private void getAllNodeRecursive(DepartTree tree, List nodes) { + nodes.add(tree); + tree.getChildren().forEach(item -> { + getAllNodeRecursive(item, nodes); }); } diff --git a/src/main/java/com/biutag/supervision/service/SupPoliceService.java b/src/main/java/com/biutag/supervision/service/SupPoliceService.java index 7c76285..40a97c6 100644 --- a/src/main/java/com/biutag/supervision/service/SupPoliceService.java +++ b/src/main/java/com/biutag/supervision/service/SupPoliceService.java @@ -9,7 +9,6 @@ import com.biutag.supervision.common.UserContextHolder; import com.biutag.supervision.constants.AppConstants; import com.biutag.supervision.constants.enums.RoleCodeEnum; import com.biutag.supervision.mapper.SupPoliceMapper; -import com.biutag.supervision.pojo.entity.SupDepart; import com.biutag.supervision.pojo.entity.SupPolice; import com.biutag.supervision.pojo.model.PoliceModel; import com.biutag.supervision.pojo.model.UserAuth; @@ -35,7 +34,7 @@ public class SupPoliceService extends ServiceImpl { if (user.getAuthDepartIds().isEmpty() || user.getRoleCodes().isEmpty() || !user.getRoleCodes().contains(RoleCodeEnum.SECOND_ADMIN.getCode()) && !user.getRoleCodes().contains(RoleCodeEnum.THREE_ADMIN.getCode())) { return new Page().setTotal(0).setRecords(new ArrayList<>()); } - List orgIds = departService.listAndChildrenIds(user.getAuthDepartIds()); + List orgIds = departService.getAllNodeIds(user.getAuthDepartIds()); queryWrapper.in("p.org_id", orgIds); } queryWrapper.like(StrUtil.isNotBlank(param.getName()), "p.name", StrUtil.trim(param.getName())); @@ -44,7 +43,7 @@ public class SupPoliceService extends ServiceImpl { queryWrapper.like(StrUtil.isNotBlank(param.getPhone()), "p.phone", StrUtil.trim(param.getPhone())); if (StrUtil.isNotBlank(param.getDepartId())) { if (Objects.nonNull(param.getDepartBranch()) && param.getDepartBranch()) { - List orgIds = departService.listAndChildrenIds(param.getDepartId()); + List orgIds = departService.getAllNodeIds(param.getDepartId()); queryWrapper.in("p.org_id", orgIds); } else { queryWrapper.eq("p.org_id", param.getDepartId()); @@ -59,17 +58,17 @@ public class SupPoliceService extends ServiceImpl { } public List listAllByDepartId(String departId) { - List departIds = departService.listAndChildrenIds(List.of(departId)); + List departIds = departService.getAllNodeIds(List.of(departId)); return list(new LambdaQueryWrapper().in(SupPolice::getOrgId, departIds)); } public List listLeaderByDepartId(String departId) { - List departIds = departService.listAndChildrenIds(List.of(departId)); + List departIds = departService.getAllNodeIds(List.of(departId)); return list(new LambdaQueryWrapper().in(SupPolice::getOrgId, departIds).isNotNull(SupPolice::getPhone)); } public Boolean exists(String departId) { - List orgIds = departService.listAndChildrenIds(departId); + List orgIds = departService.getAllNodeIds(departId); if (orgIds.isEmpty()) { return false; }