From fca5555a8fb0cbbea55a03a130e2ca41e5844e60 Mon Sep 17 00:00:00 2001 From: wxc <191104855@qq.com> Date: Tue, 7 Apr 2026 10:44:55 +0800 Subject: [PATCH] com.biutag.supervision.controller.work.NegativeController#update --- .../controller/work/NegativeController.java | 49 +---------- .../supervision/service/NegativeService.java | 88 ++++++++++++++----- 2 files changed, 68 insertions(+), 69 deletions(-) diff --git a/src/main/java/com/biutag/supervision/controller/work/NegativeController.java b/src/main/java/com/biutag/supervision/controller/work/NegativeController.java index ea59b28..1ad8335 100644 --- a/src/main/java/com/biutag/supervision/controller/work/NegativeController.java +++ b/src/main/java/com/biutag/supervision/controller/work/NegativeController.java @@ -1,6 +1,5 @@ package com.biutag.supervision.controller.work; -import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -26,7 +25,6 @@ import com.biutag.supervision.pojo.request.negative.ReportGenerationRequest; import com.biutag.supervision.pojo.vo.NegativeConfirmationCompletionVo; import com.biutag.supervision.pojo.vo.NegativeQueryVo; import com.biutag.supervision.service.*; -import com.biutag.supervision.util.JSON; import io.swagger.v3.oas.annotations.Operation; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; @@ -59,7 +57,6 @@ public class NegativeController { private final NegativeScoreService negativeScoreService; - private final SupDepartService departService; private final DataCaseVerifService dataCaseVerifService; @@ -108,51 +105,7 @@ public class NegativeController { @PutMapping public Result update(@Validated(EditGroup.class) @RequestBody NegativeDto negativeDto) { - if (StrUtil.isBlank(negativeDto.getId())) { - throw new RuntimeException("数据异常,请系统联系管理员【问题ID为空】"); - } - LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); - // 涉及单位 - SupDepart depart = departService.getById(negativeDto.getInvolveDepartId()); - if (DepartLevelEnum.SECOND.getValue().equals(depart.getLevel())) { - updateWrapper.set(Negative::getSecondInvolveDepartId, depart.getId()) - .set(Negative::getThreeInvolveDepartId, null); - } else if (DepartLevelEnum.THREE.getValue().equals(depart.getLevel())) { - updateWrapper.set(Negative::getSecondInvolveDepartId, depart.getPid()) - .set(Negative::getThreeInvolveDepartId, depart.getId()); - } else { - throw new RuntimeException("涉及单位请选择二级或三级单位"); - } - updateWrapper.eq(Negative::getId, negativeDto.getId()) - .set(Negative::getProblemSources, negativeDto.getProblemSources()) - .set(Negative::getProblemSourcesCode, negativeDto.getProblemSourcesCode()) - .set(Negative::getBusinessTypeCode, negativeDto.getBusinessTypeCode()) - .set(Negative::getCaseNumber, negativeDto.getCaseNumber()) - .set(Negative::getInvolveProblem, JSON.toJSONString(negativeDto.getInvolveProblem())) - .set(Negative::getPoliceType, negativeDto.getPoliceType()) - .set(Negative::getPoliceTypeName, negativeDto.getPoliceTypeName()) - .set(Negative::getDiscoveryTime, negativeDto.getDiscoveryTime()) - .set(Negative::getHappenTime, negativeDto.getHappenTime()) - .set(Negative::getResponderName, negativeDto.getResponderName()) - .set(Negative::getContactPhone, negativeDto.getContactPhone()) - .set(Negative::getThingDesc, negativeDto.getThingDesc()) - .set(Negative::getSpecialSupervision, negativeDto.getSpecialSupervision()) - .set(Negative::getReportNumber, negativeDto.getReportNumber()) - .set(StrUtil.isNotEmpty(negativeDto.getReportId()),Negative::getReportId,negativeDto.getReportId()) - .set(Negative::getInvolveDepartId, negativeDto.getInvolveDepartId()) - .set(Negative::getInvolveDepartName, depart.getShortName()) - // 涉嫌问题 - .set(Negative::getInvolveProblem, CollectionUtil.isNotEmpty(negativeDto.getInvolveProblem()) ? String.join(",", negativeDto.getInvolveProblem()) : null) - .set(Negative::getUpdUser, UserContextHolder.getCurrentUser().getNickName()) - .set(Negative::getUpdTime, LocalDateTime.now()); - if (CollectionUtil.isNotEmpty(negativeDto.getInvolveProblem())) { - updateWrapper.set(Negative::getInvolveProblem, String.join(",", negativeDto.getInvolveProblem())); - } else { - updateWrapper.set(Negative::getInvolveProblem, null); - } - negativeService.update(updateWrapper); - // 更新问题来源 - negativeWorkService.update(new LambdaUpdateWrapper().set(NegativeWork::getProblemSourcesCode, negativeDto.getProblemSourcesCode()).eq(NegativeWork::getNegativeId, negativeDto.getId())); + negativeService.updateNegative(negativeDto); return Result.success(); } diff --git a/src/main/java/com/biutag/supervision/service/NegativeService.java b/src/main/java/com/biutag/supervision/service/NegativeService.java index a3e7024..2704fe9 100644 --- a/src/main/java/com/biutag/supervision/service/NegativeService.java +++ b/src/main/java/com/biutag/supervision/service/NegativeService.java @@ -112,7 +112,7 @@ public class NegativeService extends ServiceImpl { .stream().map(leaderIdCode -> { VerifyData.BlameLeader blameLeader = new VerifyData.BlameLeader(); List blames = blameList.stream().filter(blameObj -> leaderIdCode.equals(blameObj.getLeadIdCode())).toList(); - // 取第一个 + // 取第一? Blame blame = blames.get(0); BeanUtil.copyProperties(blame, blameLeader); blameLeader.setBlameIdCodes(blames.stream().map(Blame::getBlameIdCode).toList()); @@ -133,7 +133,7 @@ public class NegativeService extends ServiceImpl { .setFlowActions(flowActions) .setApproves(approveService.list(id)) .setIsFav(favService.existsByCurrentUser(id)); - // 签收退回 + // 签收退? if (!flows.isEmpty() && AppConstants.SIGN_RETURN_ACTION_NAME.equals(flows.get(flows.size() - 1).getActionName())) { detail.setSignReturns(signReturnService.list(id)); } @@ -146,11 +146,11 @@ public class NegativeService extends ServiceImpl { if (FlowNodeEnum.isSignFlow(negative.getFlowKey())) { detail.setMaxDuration(NumberUtil.mul(negative.getMaxSignDuration(), TimeUtil.SECONDS_OF_A_DAY).longValue()); } - // 未延期 + // 未延? else if (Objects.isNull(negative.getExtensionDays())) { detail.setMaxDuration(NumberUtil.mul(negative.getMaxHandleDuration(), TimeUtil.SECONDS_OF_A_DAY).longValue()); } else { - // 已延期 + // 已延? Integer maxDuration = negative.getMaxHandleDuration() + negative.getExtensionDays(); detail.setMaxDuration(NumberUtil.mul(maxDuration, TimeUtil.SECONDS_OF_A_DAY).longValue()); } @@ -160,7 +160,7 @@ public class NegativeService extends ServiceImpl { negative.getExtensionDays(), negative.getFlowKey())); } - // 判断当前是否 是认定办结环节 + // 判断当前是否 是认定办结环? if (Objects.nonNull(workId)) { Boolean confirmationCompletionFlag = (ApprovalFlowEnum.SECOND_APPROVAL.getValue().equals(negative.getApprovalFlow()) && FlowNodeEnum.SECOND_APPROVE.getKey().equals(negative.getFlowKey())) || FlowNodeEnum.FIRST_APPROVE.getKey().equals(negative.getFlowKey()); @@ -189,7 +189,7 @@ public class NegativeService extends ServiceImpl { if (StrUtil.isBlank(negativeDto.getOriginId())) { String originId = generateOriginId(negativeDto.getProblemSourcesCode(), negativeDto.getBusinessTypeCode()); - negative.setOriginId(originId); // 如果是空就生成随机的线索源 + negative.setOriginId(originId); // 如果是空就生成随机的线索? } if (StrUtil.isNotBlank(negativeDto.getBusinessTypeCode())) { @@ -206,7 +206,7 @@ public class NegativeService extends ServiceImpl { negative.setThreeInvolveDepartId(depart.getId()); negative.setSecondInvolveDepartId(depart.getPid()); } else { - throw new RuntimeException("涉及单位请选择二级或三级单位"); + throw new RuntimeException("涉及单位请选择二级或三级单?); } LocalDateTime now = LocalDateTime.now(); boolean secondFlag = false; @@ -240,7 +240,7 @@ public class NegativeService extends ServiceImpl { log.warn("未获取到用户上下文,问题ID:{}", negative.getId()); } } - save(negative); // 添加一条 negative 数据 + save(negative); // 添加一?negative 数据 negativeDto.setId(negative.getId()); if (!negativeDto.getThingFiles().isEmpty()) { List files = negativeDto.getThingFiles().stream().map(item -> { @@ -270,7 +270,7 @@ public class NegativeService extends ServiceImpl { .setProblemSourcesCode(negative.getProblemSourcesCode()) .setUpdateTime(now) .setCreateTime(now); - workService.save(work); // 添加一条 negative_work 数据 工作状态 + workService.save(work); // 添加一?negative_work 数据 工作状�? FirstDistributeData firstDistributeData = new FirstDistributeData(); BeanUtil.copyProperties(negativeDto, firstDistributeData); @@ -282,7 +282,7 @@ public class NegativeService extends ServiceImpl { .setWorkId(work.getId()) .setNextFlowKey(FlowNodeEnum.SECOND_SIGN.getKey()) .setData(firstDistributeData); - SpringUtil.getBean(FlowService.class).execute(actionDto); // 创建一条历史数据 + SpringUtil.getBean(FlowService.class).execute(actionDto); // 创建一条历史数? return negative; } @@ -301,10 +301,10 @@ public class NegativeService extends ServiceImpl { .setBusinessTypeCode(businessTypeCode) .setPoliceType(NegativeApiDto.BusinessType.getPoliceType(item.getBusinessTypeName())) .setPoliceTypeName(NegativeApiDto.BusinessType.getPoliceTypeName(item.getBusinessTypeName())) - // 导入的数据都是警务调查 + // 导入的数据都是警务调? .setProblemSources(ProblemSourcesEnum.JWDC.getLabel()) .setProblemSourcesCode(ProblemSourcesEnum.JWDC.getValue()) - // 警务调查默认为137工作制 + // 警务调查默认?37工作? .setTimeLimit(TimeLimitEnum.WORK_137.getValue()) .setMaxSignDuration(TimeLimitEnum.WORK_137.getMaxSignDuration()) .setMaxHandleDuration(TimeLimitEnum.WORK_137.getMaxHandleDuration()) @@ -341,7 +341,7 @@ public class NegativeService extends ServiceImpl { .setCurrentProcessingObject(String.format("%s专班", dept.getShortName())); } } - // jwpy直接算现场督察大队 + // jwpy直接算现场督察大? negative.setIssuingDepartId(JWPY_DEPARTID); negative.setIssuingDepartName(JWPY_DEPART_NAME); save(negative); @@ -373,7 +373,7 @@ public class NegativeService extends ServiceImpl { .setCreateTime(now); workService.save(firstWork); } else { - log.error("未匹配上单位:{}, code: {}", item.getDepartName(), item.getDepartCode()); + log.error("未匹配上单位:{}?code: {}", item.getDepartName(), item.getDepartCode()); departId = AppConstants.ROOT_DEPART_ID; departName = AppConstants.ROOT_DEPART_NAME; roleCode = RoleCodeEnum.FIRST_ADMIN.getCode(); @@ -417,17 +417,17 @@ public class NegativeService extends ServiceImpl { public boolean remove(String id) { removeById(id); negativeHistoryService.removeById(id); - // 工作表 + // 工作? workService.remove(new LambdaQueryWrapper().eq(NegativeWork::getNegativeId, id)); - // 收藏表 + // 收藏? favService.remove(new LambdaQueryWrapper().eq(NegativeFav::getNegativeId, id)); - // 事件详情描述表 + // 事件详情描述? thingFileService.remove(new LambdaQueryWrapper().eq(NegativeThingFile::getNegativeId, id)); // 涉及人员 blameService.remove(id); // 核查附件 fileService.remove(new LambdaQueryWrapper().eq(NegativeFile::getNegtiveId, id)); - // 签收退回 + // 签收退? signReturnService.remove(new LambdaQueryWrapper().eq(NegativeSignReturn::getNegativeId, id)); // 申请延期 extensionApplyService.remove(new LambdaQueryWrapper().eq(NegativeExtensionApply::getNegativeId, id)); @@ -442,7 +442,7 @@ public class NegativeService extends ServiceImpl { if (CollUtil.isEmpty(histories) || CollUtil.isEmpty(applys)) { return; } - // 1. 按部门 + // 1. 按部? Map countersignHistoryMap = new HashMap<>(); for (NegativeHistory history : histories) { if ("提交会签".equals(history.getActionName()) && StrUtil.isNotBlank(history.getDepartName())) { @@ -452,7 +452,7 @@ public class NegativeService extends ServiceImpl { if (countersignHistoryMap.isEmpty()) { return; } - // 2. 回填会签人信息 校验部门 + // 2. 回填会签人信? 校验部门 for (CountersignApply apply : applys) { List countersigns = apply.getCountersigns(); if (CollUtil.isEmpty(countersigns)) { @@ -475,8 +475,54 @@ public class NegativeService extends ServiceImpl { } } } - } + }\r\n @Transactional(rollbackFor = Exception.class)\r\n public void updateNegative(NegativeDto negativeDto) { + if (StrUtil.isBlank(negativeDto.getId())) { + throw new RuntimeException("数据异常,请系统联系管理员【问题ID为空?); + } + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + // 涉及单位 + SupDepart depart = departService.getById(negativeDto.getInvolveDepartId()); + if (DepartLevelEnum.SECOND.getValue().equals(depart.getLevel())) { + updateWrapper.set(Negative::getSecondInvolveDepartId, depart.getId()) + .set(Negative::getThreeInvolveDepartId, null); + } else if (DepartLevelEnum.THREE.getValue().equals(depart.getLevel())) { + updateWrapper.set(Negative::getSecondInvolveDepartId, depart.getPid()) + .set(Negative::getThreeInvolveDepartId, depart.getId()); + } else { + throw new RuntimeException("涉及单位请选择二级或三级单?); + } + updateWrapper.eq(Negative::getId, negativeDto.getId()) + .set(Negative::getProblemSources, negativeDto.getProblemSources()) + .set(Negative::getProblemSourcesCode, negativeDto.getProblemSourcesCode()) + .set(Negative::getBusinessTypeCode, negativeDto.getBusinessTypeCode()) + .set(Negative::getCaseNumber, negativeDto.getCaseNumber()) + .set(Negative::getInvolveProblem, com.biutag.supervision.util.JSON.toJSONString(negativeDto.getInvolveProblem())) + .set(Negative::getPoliceType, negativeDto.getPoliceType()) + .set(Negative::getPoliceTypeName, negativeDto.getPoliceTypeName()) + .set(Negative::getDiscoveryTime, negativeDto.getDiscoveryTime()) + .set(Negative::getHappenTime, negativeDto.getHappenTime()) + .set(Negative::getResponderName, negativeDto.getResponderName()) + .set(Negative::getContactPhone, negativeDto.getContactPhone()) + .set(Negative::getThingDesc, negativeDto.getThingDesc()) + .set(Negative::getSpecialSupervision, negativeDto.getSpecialSupervision()) + .set(Negative::getReportNumber, negativeDto.getReportNumber()) + .set(StrUtil.isNotEmpty(negativeDto.getReportId()),Negative::getReportId,negativeDto.getReportId()) + .set(Negative::getInvolveDepartId, negativeDto.getInvolveDepartId()) + .set(Negative::getInvolveDepartName, depart.getShortName()) + // 涉嫌问题 + .set(Negative::getInvolveProblem, CollectionUtil.isNotEmpty(negativeDto.getInvolveProblem()) ? String.join(",", negativeDto.getInvolveProblem()) : null) + .set(Negative::getUpdUser, UserContextHolder.getCurrentUser().getNickName()) + .set(Negative::getUpdTime, LocalDateTime.now()); + if (CollectionUtil.isNotEmpty(negativeDto.getInvolveProblem())) { + updateWrapper.set(Negative::getInvolveProblem, String.join(",", negativeDto.getInvolveProblem())); + } else { + updateWrapper.set(Negative::getInvolveProblem, null); + } + update(updateWrapper); + // 更新问题来源 + workService.update(new LambdaUpdateWrapper().set(NegativeWork::getProblemSourcesCode, negativeDto.getProblemSourcesCode()).eq(NegativeWork::getNegativeId, negativeDto.getId())); + } }