From 5e28b190395f4cb1a9fa18061d90e87bb306229f Mon Sep 17 00:00:00 2001 From: wxc <191104855@qq.com> Date: Fri, 20 Dec 2024 17:54:36 +0800 Subject: [PATCH] 241220 --- sql/20241220.sql | 5 +++ .../controller/work/NegativeController.java | 38 +++++++++++++++++- .../flow/action/ApplyCompletionAction.java | 14 ++++++- .../supervision/flow/action/SaveAction.java | 26 +++++++++--- .../action/SecondLocalProcessingAction.java | 10 ++++- .../mapper/NegativeFileMapper.java | 7 ++++ .../supervision/pojo/domain/NegativeVo.java | 3 +- .../pojo/dto/NegativeSpotCheckDto.java | 21 ++++++++++ .../supervision/pojo/dto/flow/VerifyData.java | 3 ++ .../supervision/pojo/entity/Negative.java | 18 +++++++++ .../supervision/pojo/entity/NegativeFile.java | 1 - .../supervision/pojo/vo/NegativeFileVo.java | 38 ++++++++++++++++++ .../supervision/service/FileService.java | 4 -- .../service/NegativeFileService.java | 5 ++- .../supervision/service/NegativeService.java | 40 +++++++++---------- .../supervision/service/UserLoginService.java | 1 + 16 files changed, 194 insertions(+), 40 deletions(-) create mode 100644 sql/20241220.sql create mode 100644 src/main/java/com/biutag/supervision/pojo/dto/NegativeSpotCheckDto.java create mode 100644 src/main/java/com/biutag/supervision/pojo/vo/NegativeFileVo.java diff --git a/sql/20241220.sql b/sql/20241220.sql new file mode 100644 index 0000000..c763ef7 --- /dev/null +++ b/sql/20241220.sql @@ -0,0 +1,5 @@ +ALTER TABLE `negative`.`negative` + ADD COLUMN `spot_check_flag` tinyint NULL COMMENT '是否抽检' AFTER `second_involve_depart_id`, + ADD COLUMN `spot_check_result` varchar(255) NULL COMMENT '抽检结果' AFTER `spot_check_flag`, + ADD COLUMN `spot_check_desc` text NULL COMMENT '抽检情况' AFTER `spot_check_result`, + ADD COLUMN `unrectify_reason` text NULL COMMENT '未整改原因' AFTER `spot_check_desc`; \ No newline at end of file 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 c049cee..0530980 100644 --- a/src/main/java/com/biutag/supervision/controller/work/NegativeController.java +++ b/src/main/java/com/biutag/supervision/controller/work/NegativeController.java @@ -11,10 +11,12 @@ import com.biutag.supervision.common.validation.EditGroup; import com.biutag.supervision.constants.AppConstants; import com.biutag.supervision.constants.enums.*; import com.biutag.supervision.flow.FlowService; +import com.biutag.supervision.flow.action.ApplyCompletionAction; import com.biutag.supervision.pojo.Result; import com.biutag.supervision.pojo.domain.NegativeDetail; import com.biutag.supervision.pojo.dto.ActionDto; import com.biutag.supervision.pojo.dto.NegativeDto; +import com.biutag.supervision.pojo.dto.NegativeSpotCheckDto; import com.biutag.supervision.pojo.entity.*; import com.biutag.supervision.pojo.model.UserAuth; import com.biutag.supervision.pojo.param.NegativeQueryParam; @@ -29,6 +31,7 @@ import org.springframework.web.bind.annotation.*; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; +import java.util.Objects; @RequiredArgsConstructor @RequestMapping("negative") @@ -47,6 +50,10 @@ public class NegativeController { private final NegativeWorkService negativeWorkService; + private final NegativeScoreService negativeScoreService; + + private final SupDepartService departService; + @GetMapping public Result> list(NegativeQueryParam queryParam) { return Result.success(negativeQueryService.page(queryParam)); @@ -75,6 +82,17 @@ public class NegativeController { 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()) @@ -213,12 +231,28 @@ public class NegativeController { return Result.success(completionVo); } - private final NegativeScoreService negativeScoreService; - @PostMapping("score/calculate") public Result calculateScore() { negativeScoreService.updateNegativeScore(); return Result.success(); } + private final ApplyCompletionAction applyCompletionAction; + + @PostMapping("{id}/spotCheck") + @Transactional(rollbackFor = Exception.class) + public Result spotCheck(@PathVariable String id, @RequestBody NegativeSpotCheckDto dto) { + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(Negative::getId, id) + .set(Negative::getSpotCheckFlag, true) + .set(Negative::getSpotCheckResult, dto.getSpotCheckResult()) + .set(Negative::getSpotCheckDesc, dto.getSpotCheckDesc()); + negativeService.update(updateWrapper); + if (Objects.nonNull(dto.getVerifyData())) { + Negative negative = negativeService.getById(id); + applyCompletionAction.updateNegative(negative, dto.getVerifyData()); + } + return Result.success(); + } + } 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 63b5f63..a4e9bcb 100644 --- a/src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java @@ -62,6 +62,7 @@ public class ApplyCompletionAction implements Action { LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() .eq(Negative::getId, actionDto.getNegativeId()) + .set(Negative::getProcessingStatus, ProcessingStatusEnum.approval.name()) .set(Negative::getFlowKey, negative.getIsSecondHandle() ? FlowNodeEnum.FIRST_APPROVE.getKey() : FlowNodeEnum.SECOND_APPROVE.getKey()) // 当前处理对象 .set(Negative::getCurrentProcessingObject, negative.getIsSecondHandle() ? "市局专班" : String.format("%s专班", negative.getHandleSecondDepartName())) @@ -75,7 +76,6 @@ public class ApplyCompletionAction implements Action { LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() .eq(Negative::getId, negative.getId()) .set(Negative::getUpdTime, now) - .set(Negative::getProcessingStatus, ProcessingStatusEnum.approval.name()) .set(Negative::getCheckStatus, verifyData.getCheckStatus()) .set(Negative::getCheckStatusDesc, verifyData.getCheckStatusDesc()) .set(Negative::getCheckStatusName, verifyData.getCheckStatusName()) @@ -85,7 +85,19 @@ public class ApplyCompletionAction implements Action { .set(Negative::getCaseNumber, verifyData.getCaseNumber()) .set(Negative::getRectifyDesc, verifyData.getRectifyDesc()) .set(Negative::getInvolveDepartId, verifyData.getInvolveDepartId()) + .set(Negative::getUnrectifyReason, verifyData.getUnrectifyReason()) .set(Negative::getInvolveDepartName, departService.getById(verifyData.getInvolveDepartId()).getShortName()); + // 涉及单位 + SupDepart depart = departService.getById(verifyData.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("涉及单位请选择二级或三级单位"); + } // 未整改 if (IsRectifyEnum.NOT.getValue().equals(verifyData.getIsRectifyCode())) { updateWrapper.set(Negative::getRectifyRestrictionDays, verifyData.getRectifyRestrictionDays()); diff --git a/src/main/java/com/biutag/supervision/flow/action/SaveAction.java b/src/main/java/com/biutag/supervision/flow/action/SaveAction.java index 27f67f2..da3c851 100644 --- a/src/main/java/com/biutag/supervision/flow/action/SaveAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/SaveAction.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.biutag.supervision.constants.enums.DepartLevelEnum; import com.biutag.supervision.constants.enums.InspectCaseEnum; import com.biutag.supervision.constants.enums.IsRectifyEnum; import com.biutag.supervision.pojo.dto.ActionDto; @@ -45,14 +46,31 @@ public class SaveAction implements Action { } public void updateNegative(String negativeId, VerifyData verifyData) { + if (StrUtil.isBlank(verifyData.getInvolveDepartId())) { + throw new RuntimeException("涉及单位不能为空!"); + } LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() .eq(Negative::getId, negativeId) .set(Negative::getUpdTime, LocalDateTime.now()) - .set(Negative::getCheckStatusDesc, verifyData.getCheckStatusDesc()) .set(Negative::getCaseNumber, verifyData.getCaseNumber()) .set(Negative::getCheckStatus, verifyData.getCheckStatus()) + .set(Negative::getCheckStatusDesc, verifyData.getCheckStatusDesc()) .set(Negative::getRectifyDesc, verifyData.getRectifyDesc()) + .set(Negative::getUnrectifyReason, verifyData.getUnrectifyReason()) .set(Negative::getCheckStatusName, verifyData.getCheckStatusName()); + // 涉及单位 + SupDepart depart = departService.getById(verifyData.getInvolveDepartId()); + updateWrapper.set(Negative::getInvolveDepartId, verifyData.getInvolveDepartId()) + .set(Negative::getInvolveDepartName, depart.getShortName()); + 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("涉及单位请选择二级或三级单位"); + } // 核查情况是否属实 if (InspectCaseEnum.isItTure(verifyData.getCheckStatus())) { updateWrapper.set(Negative::getIsRectifyCode, verifyData.getIsRectifyCode()) @@ -63,12 +81,8 @@ public class SaveAction implements Action { updateWrapper.set(Negative::getRectifyRestrictionDays, verifyData.getRectifyRestrictionDays()); } } - if (StrUtil.isNotBlank(verifyData.getInvolveDepartId())) { - SupDepart depart = departService.getById(verifyData.getInvolveDepartId()); - updateWrapper.set(Negative::getInvolveDepartId, verifyData.getInvolveDepartId()) - .set(Negative::getInvolveDepartName, depart.getShortName()); - } negativeService.update(updateWrapper); + /** * 如果涉及不为空,则先删除原有数据,再新增 */ diff --git a/src/main/java/com/biutag/supervision/flow/action/SecondLocalProcessingAction.java b/src/main/java/com/biutag/supervision/flow/action/SecondLocalProcessingAction.java index 9ed071b..385a4b8 100644 --- a/src/main/java/com/biutag/supervision/flow/action/SecondLocalProcessingAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/SecondLocalProcessingAction.java @@ -1,6 +1,7 @@ package com.biutag.supervision.flow.action; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.biutag.supervision.constants.enums.HostLevelEnums; import com.biutag.supervision.constants.enums.ProcessingStatusEnum; import com.biutag.supervision.pojo.dto.ActionDto; import com.biutag.supervision.pojo.entity.Negative; @@ -22,12 +23,17 @@ public class SecondLocalProcessingAction implements Action { } public void updateNegative(ActionDto actionDto) { - negativeService.update(new LambdaUpdateWrapper() + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() .set(Negative::getFlowKey, actionDto.getNextFlowKey()) .set(Negative::getIsSecondHandle, true) .set(Negative::getProcessingStatus, ProcessingStatusEnum.processing.name()) .set(Negative::getUpdTime, LocalDateTime.now()) - .eq(Negative::getId, actionDto.getNegativeId())); + .eq(Negative::getId, actionDto.getNegativeId()); + Negative negative = negativeService.getById(actionDto.getNegativeId()); + if (HostLevelEnums.THREE.getValue().equals(negative.getHostLevel())) { + updateWrapper.set(Negative::getHostLevel, HostLevelEnums.SECOND.getValue()); + } + negativeService.update(); } } diff --git a/src/main/java/com/biutag/supervision/mapper/NegativeFileMapper.java b/src/main/java/com/biutag/supervision/mapper/NegativeFileMapper.java index 47d9c46..a07870d 100644 --- a/src/main/java/com/biutag/supervision/mapper/NegativeFileMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/NegativeFileMapper.java @@ -2,7 +2,14 @@ package com.biutag.supervision.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.biutag.supervision.pojo.entity.NegativeFile; +import com.biutag.supervision.pojo.vo.NegativeFileVo; +import org.apache.ibatis.annotations.Select; + +import java.util.List; public interface NegativeFileMapper extends BaseMapper { + + @Select("select f.*, c.class_title file_class_title from negative_file f left join file_class c on f.file_class_id = c.id where f.negtiveId = #{negativeId}") + List selectList(String negativeId); } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/domain/NegativeVo.java b/src/main/java/com/biutag/supervision/pojo/domain/NegativeVo.java index 51a3867..d1cb6e8 100644 --- a/src/main/java/com/biutag/supervision/pojo/domain/NegativeVo.java +++ b/src/main/java/com/biutag/supervision/pojo/domain/NegativeVo.java @@ -5,6 +5,7 @@ import com.biutag.supervision.pojo.entity.FileClass; import com.biutag.supervision.pojo.entity.NegativeFile; import com.biutag.supervision.pojo.entity.NegativeScorePolice; import com.biutag.supervision.pojo.entity.NegativeThingFile; +import com.biutag.supervision.pojo.vo.NegativeFileVo; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Getter; import lombok.Setter; @@ -198,7 +199,7 @@ public class NegativeVo { private List blameLeaders = new ArrayList<>(); // 办结佐证材料 - private List files = new ArrayList<>(); + private List files = new ArrayList<>(); private List thingFiles = new ArrayList<>(); diff --git a/src/main/java/com/biutag/supervision/pojo/dto/NegativeSpotCheckDto.java b/src/main/java/com/biutag/supervision/pojo/dto/NegativeSpotCheckDto.java new file mode 100644 index 0000000..b4a52e4 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/dto/NegativeSpotCheckDto.java @@ -0,0 +1,21 @@ +package com.biutag.supervision.pojo.dto; + +import com.biutag.supervision.pojo.dto.flow.VerifyData; +import lombok.Getter; +import lombok.Setter; + +/** + * @author wxc + * @date 2024/12/19 + */ +@Setter +@Getter +public class NegativeSpotCheckDto { + + private String spotCheckResult; + + private String spotCheckDesc; + + private VerifyData verifyData; + +} diff --git a/src/main/java/com/biutag/supervision/pojo/dto/flow/VerifyData.java b/src/main/java/com/biutag/supervision/pojo/dto/flow/VerifyData.java index 14ad7c8..06be451 100644 --- a/src/main/java/com/biutag/supervision/pojo/dto/flow/VerifyData.java +++ b/src/main/java/com/biutag/supervision/pojo/dto/flow/VerifyData.java @@ -51,6 +51,9 @@ public class VerifyData { // 问题整改情况 private String rectifyDesc; + // 未整改原因 + private String unrectifyReason; + @Size(min = 1) private List blames = new ArrayList<>(); diff --git a/src/main/java/com/biutag/supervision/pojo/entity/Negative.java b/src/main/java/com/biutag/supervision/pojo/entity/Negative.java index 35eeb09..ad6161e 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/Negative.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/Negative.java @@ -279,4 +279,22 @@ public class Negative { // 市局下发意见 private String firstDistributeComments; + // 是否抽检 + private Boolean spotCheckFlag; + + // 抽检结果 + private String spotCheckResult; + + // 抽检情况 + private String spotCheckDesc; + + // 未整改原因 + private String unrectifyReason; + + // 二级部门 + private String secondInvolveDepartId; + + // 三级部门 + private String threeInvolveDepartId; + } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/entity/NegativeFile.java b/src/main/java/com/biutag/supervision/pojo/entity/NegativeFile.java index 8dd298e..0417b93 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/NegativeFile.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/NegativeFile.java @@ -1,6 +1,5 @@ package com.biutag.supervision.pojo.entity; -import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import lombok.Getter; diff --git a/src/main/java/com/biutag/supervision/pojo/vo/NegativeFileVo.java b/src/main/java/com/biutag/supervision/pojo/vo/NegativeFileVo.java new file mode 100644 index 0000000..5ba65fc --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/vo/NegativeFileVo.java @@ -0,0 +1,38 @@ +package com.biutag.supervision.pojo.vo; + +import lombok.Getter; +import lombok.Setter; + +import java.time.LocalDateTime; + +/** + * @author wxc + * @date 2024/12/20 + */ +@Setter +@Getter +public class NegativeFileVo { + + private String id; + + private String fileId; + + private String filePath; + + private String negtiveId; + + private String type; + + private LocalDateTime crtTime; + + private String crtUser; + + private String fileName; + + private String status; + + private Integer fileClassId; + + private String fileClassTitle; + +} diff --git a/src/main/java/com/biutag/supervision/service/FileService.java b/src/main/java/com/biutag/supervision/service/FileService.java index f969293..e3ffbef 100644 --- a/src/main/java/com/biutag/supervision/service/FileService.java +++ b/src/main/java/com/biutag/supervision/service/FileService.java @@ -3,19 +3,15 @@ package com.biutag.supervision.service; import cn.hutool.core.io.FileUtil; import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpUtil; -import com.biutag.supervision.pojo.Result; -import com.biutag.supervision.pojo.vo.FileVo; import com.github.tobato.fastdfs.domain.fdfs.StorePath; import com.github.tobato.fastdfs.service.FastFileStorageClient; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.io.InputStream; -import java.io.OutputStream; @RequiredArgsConstructor @Service diff --git a/src/main/java/com/biutag/supervision/service/NegativeFileService.java b/src/main/java/com/biutag/supervision/service/NegativeFileService.java index 665ef40..9041c9c 100644 --- a/src/main/java/com/biutag/supervision/service/NegativeFileService.java +++ b/src/main/java/com/biutag/supervision/service/NegativeFileService.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.biutag.supervision.pojo.entity.NegativeFile; import com.biutag.supervision.mapper.NegativeFileMapper; import com.biutag.supervision.pojo.vo.FileVo; +import com.biutag.supervision.pojo.vo.NegativeFileVo; import org.springframework.stereotype.Service; import java.util.List; @@ -13,8 +14,8 @@ import java.util.List; @Service public class NegativeFileService extends ServiceImpl { - public List list(String negativeId) { - return list(new LambdaQueryWrapper().eq(NegativeFile::getNegtiveId, negativeId)); + public List list(String negativeId) { + return baseMapper.selectList(negativeId); } public boolean remove(String negativeId) { diff --git a/src/main/java/com/biutag/supervision/service/NegativeService.java b/src/main/java/com/biutag/supervision/service/NegativeService.java index ae9da90..9e27b83 100644 --- a/src/main/java/com/biutag/supervision/service/NegativeService.java +++ b/src/main/java/com/biutag/supervision/service/NegativeService.java @@ -26,6 +26,7 @@ import com.biutag.supervision.pojo.dto.flow.VerifyData; import com.biutag.supervision.pojo.dto.jwdc.NegativeApiDto; import com.biutag.supervision.pojo.entity.*; import com.biutag.supervision.pojo.model.UserAuth; +import com.biutag.supervision.pojo.vo.NegativeFileVo; import com.biutag.supervision.util.SpringUtil; import com.biutag.supervision.util.TimeUtil; import lombok.RequiredArgsConstructor; @@ -80,7 +81,7 @@ public class NegativeService extends ServiceImpl { Negative negative = getById(id); List flows = negativeHistoryService.listByNegativeId(id); AtomicReference flowKey = new AtomicReference<>(negative.getFlowKey()); - List files = fileService.list(id); + List files = fileService.list(id); List thingFiles = thingFileService.list(id); if (Objects.nonNull(workId)) { Optional.ofNullable(workService.getById(workId)).map(NegativeWork::getFlowKey).filter(StrUtil::isNotBlank).ifPresent(flowKey::set); @@ -164,26 +165,6 @@ public class NegativeService extends ServiceImpl { return getOne(new LambdaUpdateWrapper().eq(Negative::getOriginId, originId)); } - public boolean saveNegative(NegativeDto negativeDto) { - Negative negative = new Negative(); - BeanUtil.copyProperties(negativeDto, negative); - if (StrUtil.isBlank(negativeDto.getOriginId())) { - String originId = generateOriginId(negativeDto.getProblemSourcesCode(), negativeDto.getBusinessTypeCode()); - negative.setOriginId(originId); // 如果是空就生成随机的线索源 - } - LocalDateTime now = LocalDateTime.now(); - negative.setId(IdUtil.getSnowflakeNextIdStr()) // negative唯一标识 雪花 - .setProcessingStatus(ProcessingStatusEnum.completed.name()) - .setFlowKey(FlowNodeEnum.COMPLETED.getKey()) // 市局下发 - .setCrtDepartLevel(DepartLevelEnum.FIRST.getValue()) - .setCrtTime(now) - .setUpdTime(now); - if (CollectionUtil.isNotEmpty(negativeDto.getInvolveProblem())) { - negative.setInvolveProblem(String.join(",", negativeDto.getInvolveProblem())); - } - return save(negative); - } - @Transactional(rollbackFor = Exception.class) public Negative save(NegativeDto negativeDto) { Negative negative = new Negative(); @@ -192,6 +173,16 @@ public class NegativeService extends ServiceImpl { String originId = generateOriginId(negativeDto.getProblemSourcesCode(), negativeDto.getBusinessTypeCode()); negative.setOriginId(originId); // 如果是空就生成随机的线索源 } + // 涉及单位 + SupDepart depart = departService.getById(negative.getInvolveDepartId()); + if (DepartLevelEnum.SECOND.getValue().equals(depart.getLevel())) { + negative.setSecondInvolveDepartId(depart.getId()); + } else if (DepartLevelEnum.THREE.getValue().equals(depart.getLevel())) { + negative.setThreeInvolveDepartId(depart.getId()); + negative.setSecondInvolveDepartId(depart.getPid()); + } else { + throw new RuntimeException("涉及单位请选择二级或三级单位"); + } LocalDateTime now = LocalDateTime.now(); UserAuth user = UserContextHolder.getCurrentUser(); boolean secondFlag = user.getRoleCodes().contains(RoleCodeEnum.SECOND_ADMIN.getCode()); @@ -308,6 +299,13 @@ public class NegativeService extends ServiceImpl { departId = dept.getId(); departName = dept.getShortName(); roleCode = RoleCodeEnum.THREE_ADMIN.getCode(); + // 涉及单位 + if (DepartLevelEnum.SECOND.getValue().equals(dept.getLevel())) { + negative.setSecondInvolveDepartId(dept.getId()); + } else if (DepartLevelEnum.THREE.getValue().equals(dept.getLevel())) { + negative.setThreeInvolveDepartId(dept.getId()); + negative.setSecondInvolveDepartId(dept.getPid()); + } } else { log.error("未匹配上单位:{}, code: {}", item.getDepartName(), item.getDepartCode()); departId = AppConstants.ROOT_DEPART_ID; diff --git a/src/main/java/com/biutag/supervision/service/UserLoginService.java b/src/main/java/com/biutag/supervision/service/UserLoginService.java index 11e10f4..20d7967 100644 --- a/src/main/java/com/biutag/supervision/service/UserLoginService.java +++ b/src/main/java/com/biutag/supervision/service/UserLoginService.java @@ -43,4 +43,5 @@ public class UserLoginService { .setAuthDepartIds(departAuthorities.stream().map(NegDepartAuthority::getDepartId).toList()); return userAuth; } + }