diff --git a/sql/1128.sql b/sql/1128.sql new file mode 100644 index 0000000..d0cebad --- /dev/null +++ b/sql/1128.sql @@ -0,0 +1,22 @@ +INSERT INTO `negative`.`flow_action`(`id`, `action_key`, `flow_key`, `next_flow_key`, `button_label`, `button_type`, `plain`, `sort`, `action_name`, `validate_form`, `do_close`, `open_dialog`) VALUES (24, 'update_verify', 'second_approve', NULL, '修改核查内容', 'primary', 1, 1, '修改核查内容', 1, NULL, NULL); +INSERT INTO `negative`.`flow_action`(`id`, `action_key`, `flow_key`, `next_flow_key`, `button_label`, `button_type`, `plain`, `sort`, `action_name`, `validate_form`, `do_close`, `open_dialog`) VALUES (25, 'update_verify', 'first_approve', NULL, '修改核查内容', 'primary', 1, 1, '修改核查内容', 1, NULL, NULL); + +ALTER TABLE `negative`.`model` + ADD COLUMN `warning_handling` varchar(255) COMMENT '预警问题处置', + ADD COLUMN `handle_depart_id` varchar(40) COMMENT '指定办理单位', + ADD COLUMN `business_type_code` varchar(255) COMMENT '业务类型', + ADD COLUMN `police_type` varchar(255) COMMENT '警种', + ADD COLUMN `involve_problem` text COMMENT '涉嫌问题'; + +CREATE TABLE `model_problem_type` ( + `id` int NOT NULL AUTO_INCREMENT, + `model_id` int DEFAULT NULL, + `oneLevelCode` varchar(255) CHARACTER DEFAULT NULL, + `twoLevelCode` varchar(255) CHARACTER DEFAULT NULL, + `oneLevelContent` varchar(255) CHARACTER DEFAULT NULL, + `twoLevelContent` varchar(255) CHARACTER DEFAULT NULL, + `threeLevelCode` varchar(255) DEFAULT NULL, + `threeLevelContent` varchar(255) DEFAULT NULL, + `threeLevelContentOther` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT COMMENT='问题清单人员关联问题表'; \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/constants/enums/AccountabilityTargetEnum.java b/src/main/java/com/biutag/supervision/constants/enums/AccountabilityTargetEnum.java new file mode 100644 index 0000000..ba60d9b --- /dev/null +++ b/src/main/java/com/biutag/supervision/constants/enums/AccountabilityTargetEnum.java @@ -0,0 +1,21 @@ +package com.biutag.supervision.constants.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author wxc + * @date 2024/11/28 + */ +@AllArgsConstructor +public enum AccountabilityTargetEnum { + + PERSONAL("1"), + + PERSONAL_AND_DEPARTMENT("2"), + DEPARTMENT("3"); + + @Getter + private String value; + +} diff --git a/src/main/java/com/biutag/supervision/constants/enums/BlameType.java b/src/main/java/com/biutag/supervision/constants/enums/BlameType.java new file mode 100644 index 0000000..a082cc4 --- /dev/null +++ b/src/main/java/com/biutag/supervision/constants/enums/BlameType.java @@ -0,0 +1,10 @@ +package com.biutag.supervision.constants.enums; + +/** + * @author wxc + * @date 2024/11/28 + */ +public enum BlameType { + personal, + department +} diff --git a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelController.java b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelController.java index 9911300..62014ce 100644 --- a/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelController.java +++ b/src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelController.java @@ -1,15 +1,18 @@ package com.biutag.supervision.controller.sensitivePerception; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.biutag.supervision.mapper.ModelClassMapper; import com.biutag.supervision.pojo.Result; +import com.biutag.supervision.pojo.dto.ModelDto; import com.biutag.supervision.pojo.entity.Model; import com.biutag.supervision.pojo.model.ModelClassModel; import com.biutag.supervision.pojo.param.ModelQueryParam; import com.biutag.supervision.pojo.vo.ModelTree; import com.biutag.supervision.service.ModelService; +import com.biutag.supervision.util.JSON; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; @@ -57,13 +60,23 @@ public class ModelController { } @PostMapping - public Result add(@RequestBody Model model) { - return Result.success(modelService.saveModel(model)); + public Result add(@RequestBody ModelDto modelDto) { + Model model = new Model(); + BeanUtil.copyProperties(modelDto, model); + if (Objects.nonNull(modelDto.getInvolveProblem())) { + model.setInvolveProblem(JSON.toJSONString(modelDto.getInvolveProblem())); + } + return Result.success(modelService.saveModel(model, modelDto.getProblems())); } @PutMapping - public Result update(@RequestBody Model model) { - modelService.updateModel(model); + public Result update(@RequestBody ModelDto modelDto) { + Model model = new Model(); + BeanUtil.copyProperties(modelDto, model); + if (Objects.nonNull(modelDto.getInvolveProblem())) { + model.setInvolveProblem(JSON.toJSONString(modelDto.getInvolveProblem())); + } + modelService.updateModel(model, modelDto.getProblems()); return Result.success(model); } diff --git a/src/main/java/com/biutag/supervision/controller/system/PoliceController.java b/src/main/java/com/biutag/supervision/controller/system/PoliceController.java index c54ae56..29b1254 100644 --- a/src/main/java/com/biutag/supervision/controller/system/PoliceController.java +++ b/src/main/java/com/biutag/supervision/controller/system/PoliceController.java @@ -160,23 +160,17 @@ public class PoliceController { SupPolice supPolice = policeService.getByIdCode(list.get(i).getIdCode()); if (supPolice == null) { supPolice = new SupPolice(); - supPolice.setName(police.getName()); - supPolice.setIdCode(police.getIdCode()); - supPolice.setEmpNo(police.getEmpNo()); - supPolice.setOrgId(depart.getId()); - + } + supPolice.setName(police.getName()); + supPolice.setIdCode(police.getIdCode()); + supPolice.setEmpNo(police.getEmpNo()); + supPolice.setOrgId(depart.getId()); + if (police.getEmpNo().contains("A")) { + supPolice.setPersonType("3"); } else { - supPolice.setName(police.getName()); - supPolice.setIdCode(police.getIdCode()); - supPolice.setEmpNo(police.getEmpNo()); - supPolice.setOrgId(depart.getId()); - if (police.getEmpNo().contains("A")) { - supPolice.setPersonType("3"); - } else { - supPolice.setPersonType("1"); - } - policeService.updateById(supPolice); + supPolice.setPersonType("1"); } + policeService.saveOrUpdate(supPolice); if ("三级机构专班".equals(police.getRole()) || "二级机构专班".equals(police.getRole())) { String userId = saveOrUpdateUser(police); // 角色 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 a953bf0..673942b 100644 --- a/src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java @@ -49,19 +49,25 @@ public class ApplyCompletionAction implements Action { //validator.validate(verifyData); // 新增审批数据 Negative negative = negativeService.getById(actionDto.getNegativeId()); - updateNegative(actionDto.getNegativeId(), verifyData, negative); + updateNegative(negative, verifyData); doneWork(actionDto.getWorkId()); addWork(actionDto.getNegativeId(), actionDto.getWorkId(), // 是否是本级办理 negative.getIsSecondHandle() ? RoleCodeEnum.FIRST_ADMIN.getCode() : RoleCodeEnum.SECOND_ADMIN.getCode(), negative); + + addApprove(negative); + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() + .set(Negative::getFlowKey, negative.getIsSecondHandle() ? FlowNodeEnum.FIRST_APPROVE.getKey() : FlowNodeEnum.SECOND_APPROVE.getKey()) + // 当前处理对象 + .set(Negative::getCurrentProcessingObject, negative.getIsSecondHandle() ? "市局专班" : String.format("%s专班", negative.getHandleSecondDepartName())); + negativeService.update(updateWrapper); } - public void updateNegative(String negativeId, VerifyData verifyData, Negative negative) { + public void updateNegative(Negative negative, VerifyData verifyData) { LocalDateTime now = LocalDateTime.now(); LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() - .eq(Negative::getId, negativeId) - .set(Negative::getFlowKey, negative.getIsSecondHandle() ? FlowNodeEnum.FIRST_APPROVE.getKey() : FlowNodeEnum.SECOND_APPROVE.getKey()) + .eq(Negative::getId, negative.getId()) .set(Negative::getUpdTime, now) .set(Negative::getProcessingStatus, ProcessingStatusEnum.approval.name()) .set(Negative::getCheckStatus, verifyData.getCheckStatus()) @@ -71,9 +77,7 @@ public class ApplyCompletionAction implements Action { .set(Negative::getIsRectifyName, verifyData.getIsRectifyName()) .set(Negative::getAccountabilityTarget, verifyData.getAccountabilityTarget()) .set(Negative::getCaseNumber, verifyData.getCaseNumber()) - .set(Negative::getRectifyDesc, verifyData.getRectifyDesc()) - // 当前处理对象 - .set(Negative::getCurrentProcessingObject, negative.getIsSecondHandle() ? "市局专班" : String.format("%s专班", negative.getHandleSecondDepartName())); + .set(Negative::getRectifyDesc, verifyData.getRectifyDesc()); // 未整改 if (IsRectifyEnum.NOT.getValue().equals(verifyData.getIsRectifyCode())) { updateWrapper.set(Negative::getRectifyRestrictionDays, verifyData.getRectifyRestrictionDays()); @@ -82,21 +86,25 @@ public class ApplyCompletionAction implements Action { if (!verifyData.getBlames().isEmpty()) { List problemRelations = new ArrayList<>(); - List negativeBlames = verifyData.getBlames().stream().map(item -> { + List blames = verifyData.getBlames(); + if (AccountabilityTargetEnum.PERSONAL.getValue().equals(verifyData.getAccountabilityTarget())) { + blames = verifyData.getBlames().stream().filter(item -> BlameType.personal.name().equals(item.getType())).toList(); + }else if (AccountabilityTargetEnum.DEPARTMENT.getValue().equals(verifyData.getAccountabilityTarget())) { + blames = verifyData.getBlames().stream().filter(item -> BlameType.department.name().equals(item.getType())).toList(); + } + List negativeBlames = blames.stream().map(item -> { NegativeBlame negativeBlame = new NegativeBlame(); BeanUtil.copyProperties(item, negativeBlame); - if(verifyData != null && verifyData.getBlameLeaders() != null) { - List blameLeaders = verifyData.getBlameLeaders().stream() - .filter(leader -> leader.getBlameIdCodes().contains(item.getBlameIdCode())) - .toList(); - if(!blameLeaders.isEmpty()) { - BeanUtil.copyProperties(blameLeaders.get(0), negativeBlame); - } + List blameLeaders = verifyData.getBlameLeaders().stream() + .filter(leader -> leader.getBlameIdCodes().contains(item.getBlameIdCode())) + .toList(); + if(!blameLeaders.isEmpty()) { + BeanUtil.copyProperties(blameLeaders.get(0), negativeBlame); } negativeBlame .setBlameId(IdUtil.getSnowflakeNextIdStr()) - .setNegativeId(negativeId) + .setNegativeId(negative.getId()) .setCrtTime(now) .setUpdTime(now); @@ -105,18 +113,18 @@ public class ApplyCompletionAction implements Action { BeanUtil.copyProperties(problem, problemRelation); problemRelation.setId(IdUtil.fastSimpleUUID()); problemRelation.setBlameId(negativeBlame.getBlameId()); - problemRelation.setNegativeId(negativeId); + problemRelation.setNegativeId(negative.getId()); return problemRelation; }).toList()); return negativeBlame; }).toList(); // 先删除 - negativeBlameService.remove(negativeId); + negativeBlameService.remove(negative.getId()); // 新增涉及人员 negativeBlameService.saveBatch(negativeBlames); // 新增涉及人员问题类型 // 先删除 - negativeProblemRelationService.remove(negativeId); + negativeProblemRelationService.remove(negative.getId()); if (!problemRelations.isEmpty()) { // 新增 negativeProblemRelationService.saveBatch(problemRelations); @@ -124,26 +132,30 @@ public class ApplyCompletionAction implements Action { } if (!verifyData.getFiles().isEmpty()) { // 先删除 - fileService.remove(negativeId); + fileService.remove(negative.getId()); // 新增 - fileService.saveBatch(verifyData.getFiles(), negativeId); + fileService.saveBatch(verifyData.getFiles(), negative.getId()); } - aproveService.remove(negativeId); + + } + + public void addApprove(Negative negative) { + aproveService.remove(negative.getId()); // 不是二级机构本级办理 if (!negative.getIsSecondHandle()) { NegativeApprove approve1 = new NegativeApprove() - .setNegativeId(negativeId) + .setNegativeId(negative.getId()) .setActionKey(FlowActionEnum.SECOND_APPROVE.getKey()) - .setCreateTime(now); + .setCreateTime(LocalDateTime.now()); aproveService.save(approve1); } // 三级审批 所队一>二級机构一>市局 if (!ApprovalFlowEnum.SECOND_APPROVAL.getValue().equals(negative.getApprovalFlow())) { NegativeApprove approve2 = new NegativeApprove() - .setNegativeId(negativeId) + .setNegativeId(negative.getId()) .setActionKey(FlowActionEnum.FIRST_APPROVE.getKey()) - .setCreateTime(now); + .setCreateTime(LocalDateTime.now()); aproveService.save(approve2); } } diff --git a/src/main/java/com/biutag/supervision/flow/action/UpdateVerifyAction.java b/src/main/java/com/biutag/supervision/flow/action/UpdateVerifyAction.java new file mode 100644 index 0000000..37375ea --- /dev/null +++ b/src/main/java/com/biutag/supervision/flow/action/UpdateVerifyAction.java @@ -0,0 +1,30 @@ +package com.biutag.supervision.flow.action; + +import cn.hutool.core.bean.BeanUtil; +import com.biutag.supervision.pojo.dto.ActionDto; +import com.biutag.supervision.pojo.dto.flow.VerifyData; +import com.biutag.supervision.pojo.entity.Negative; +import com.biutag.supervision.service.NegativeService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * @author wxc + * @date 2024/11/28 + */ +@RequiredArgsConstructor +@Component +public class UpdateVerifyAction implements Action { + + private final NegativeService negativeService; + + private final ApplyCompletionAction applyCompletionAction; + + @Override + public void next(ActionDto actionDto) { + VerifyData verifyData = BeanUtil.toBean(actionDto.getData(), VerifyData.class); + // 新增审批数据 + Negative negative = negativeService.getById(actionDto.getNegativeId()); + applyCompletionAction.updateNegative(negative, verifyData); + } +} diff --git a/src/main/java/com/biutag/supervision/mapper/ModelProblemTypeMapper.java b/src/main/java/com/biutag/supervision/mapper/ModelProblemTypeMapper.java new file mode 100644 index 0000000..4b7016b --- /dev/null +++ b/src/main/java/com/biutag/supervision/mapper/ModelProblemTypeMapper.java @@ -0,0 +1,8 @@ +package com.biutag.supervision.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.supervision.pojo.entity.ModelProblemType; + +public interface ModelProblemTypeMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/dto/ModelClueTaskDistribute.java b/src/main/java/com/biutag/supervision/pojo/dto/ModelClueTaskDistribute.java index cb2252d..b55e4ae 100644 --- a/src/main/java/com/biutag/supervision/pojo/dto/ModelClueTaskDistribute.java +++ b/src/main/java/com/biutag/supervision/pojo/dto/ModelClueTaskDistribute.java @@ -43,6 +43,16 @@ public class ModelClueTaskDistribute { @NotBlank private String approvalFlow; + private String handleDepartId; + + // 业务类型 + private String businessTypeCode; + + // 警种 + private String policeType; + + private String involveProblem; + private List thingFiles = new ArrayList<>(); diff --git a/src/main/java/com/biutag/supervision/pojo/dto/ModelDto.java b/src/main/java/com/biutag/supervision/pojo/dto/ModelDto.java new file mode 100644 index 0000000..8d487d0 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/dto/ModelDto.java @@ -0,0 +1,84 @@ +package com.biutag.supervision.pojo.dto; + +import com.biutag.supervision.pojo.dto.flow.VerifyData; +import lombok.Getter; +import lombok.Setter; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Setter +@Getter +public class ModelDto { + + private Integer id; + + private String modelName; + + private Integer classId; + + private String icon; + + private String remarks; + + // 分发方式 + private String distributionMethod; + + // 分发周期 + private String distributionCycle; + + // 分发周期 周 + private String distributionCycleDayOfWeek; + + // 分发周期 时间 + private String distributionCycleTime; + + // 分发周期,cron 表达式 + private String distributionCycleExpression; + + // 限时 + private String timeLimit; + + private Integer maxSignDuration; + + private Integer maxHandleDuration; + + private Integer maxExtensionDuration; + + private String distributionFlow; + + private String approvalFlow; + + + private String createDepartId; + + private String createDepartName; + + // 建模方式 + private String modelingMethod; + + // 模型数据类型 + private String modelDataType; + + private String modelSql; + + private Integer riskScoreRuleId; + + // 预警问题处置 + private String warningHandling; + + private String handleDepartId; + + // 业务类型 + private String businessTypeCode; + + // 警种 + private String policeType; + + private List> involveProblem; + + // 问题类型 + private List problems = new ArrayList<>(); + +} \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/entity/Model.java b/src/main/java/com/biutag/supervision/pojo/entity/Model.java index 63ca1ee..183dd33 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/Model.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/Model.java @@ -3,11 +3,14 @@ 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 com.biutag.supervision.pojo.dto.flow.VerifyData; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Getter; import lombok.Setter; import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; @Setter @Getter @@ -97,4 +100,14 @@ public class Model { // 预警问题处置 private String warningHandling; + private String handleDepartId; + + // 业务类型 + private String businessTypeCode; + + // 警种 + private String policeType; + + private String involveProblem; + } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/entity/ModelClue.java b/src/main/java/com/biutag/supervision/pojo/entity/ModelClue.java index 857d94c..667febc 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/ModelClue.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/ModelClue.java @@ -73,7 +73,6 @@ public class ModelClue { // 任务ID private Integer taskId; - // 总警情数 @TableField(exist = false) private Long zjjs; diff --git a/src/main/java/com/biutag/supervision/pojo/entity/ModelProblemType.java b/src/main/java/com/biutag/supervision/pojo/entity/ModelProblemType.java new file mode 100644 index 0000000..1e4ce80 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/entity/ModelProblemType.java @@ -0,0 +1,51 @@ +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; +import lombok.Setter; + +import java.time.LocalDateTime; + +@Setter +@Getter +public class ModelProblemType { + + // + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + // + @TableField("model_id") + private Integer modelId; + + // + @TableField("oneLevelCode") + private String oneLevelCode; + + // + @TableField("twoLevelCode") + private String twoLevelCode; + + // + @TableField("oneLevelContent") + private String oneLevelContent; + + // + @TableField("twoLevelContent") + private String twoLevelContent; + + // + @TableField("threeLevelCode") + private String threeLevelCode; + + // + @TableField("threeLevelContent") + private String threeLevelContent; + + // + @TableField("threeLevelContentOther") + private String threeLevelContentOther; + +} \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/entity/NegativeProblemRelation.java b/src/main/java/com/biutag/supervision/pojo/entity/NegativeProblemRelation.java index 16e82cb..8a8b2ce 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/NegativeProblemRelation.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/NegativeProblemRelation.java @@ -44,7 +44,7 @@ public class NegativeProblemRelation { private String threeLevelContent; // 其他内容 - @TableField("threeLevelContent") + @TableField("threeLevelContentOther") private String threeLevelContentOther; } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/service/ModelClueService.java b/src/main/java/com/biutag/supervision/service/ModelClueService.java index 57bc8e6..4da1bb0 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClueService.java +++ b/src/main/java/com/biutag/supervision/service/ModelClueService.java @@ -123,7 +123,12 @@ public class ModelClueService extends ServiceImpl { model.setMaxExtensionDuration(taskDistribute.getMaxExtensionDuration()); model.setApprovalFlow(taskDistribute.getApprovalFlow()); model.setDistributionFlow(taskDistribute.getDistributionFlow()); - + if (StrUtil.isNotBlank(taskDistribute.getHandleDepartId())) { + model.setHandleDepartId(taskDistribute.getHandleDepartId()); + } + model.setBusinessTypeCode(taskDistribute.getBusinessTypeCode()); + model.setPoliceType(taskDistribute.getPoliceType()); + model.setInvolveProblem(taskDistribute.getInvolveProblem()); return distribution(modelClues, model, taskDistribute.getTaskName(), taskDistribute.getThingFiles()); } @@ -154,9 +159,16 @@ public class ModelClueService extends ServiceImpl { // 问题来源 negative.setProblemSources(ProblemSourcesEnum.LMGZ.getLabel()); negative.setProblemSourcesCode(ProblemSourcesEnum.LMGZ.getValue()); - // TODO 业务类别 涉及问题 - negative.setBusinessTypeCode(BusinessTypeEnum.QT.getValue()); - negative.setBusinessTypeName(BusinessTypeEnum.QT.getLabel()); + + if (StrUtil.isNotBlank(model.getBusinessTypeCode())) { + negative.setBusinessTypeCode(model.getBusinessTypeCode()); + } else { + negative.setBusinessTypeCode(BusinessTypeEnum.QT.getValue()); + negative.setBusinessTypeName(BusinessTypeEnum.QT.getLabel()); + } + negative.setBusinessTypeCode(model.getPoliceType()); + + //negative.setInvolveProblem(JSON.parseArray(model.getInvolveProblem(), Map.class)); // 涉及单位 negative.setInvolveDepartId(item.getInvolveDepartId()); negative.setInvolveDepartName(item.getInvolveDepartName()); @@ -168,6 +180,7 @@ public class ModelClueService extends ServiceImpl { negative.setThingDesc(item.getThingDesc()); // 主办层级 negative.setHostLevel(HostLevelEnums.THREE.getValue()); + negative.setThingFiles(thingFiles); // 办理单位 SupDepart depart = departService.getById(item.getInvolveDepartId()); if (depart.getLevel().equals(DepartLevelEnum.SECOND.getValue())) { diff --git a/src/main/java/com/biutag/supervision/service/ModelProblemTypeService.java b/src/main/java/com/biutag/supervision/service/ModelProblemTypeService.java new file mode 100644 index 0000000..aa6aeba --- /dev/null +++ b/src/main/java/com/biutag/supervision/service/ModelProblemTypeService.java @@ -0,0 +1,16 @@ +package com.biutag.supervision.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.supervision.pojo.entity.ModelProblemType; +import com.biutag.supervision.mapper.ModelProblemTypeMapper; +import org.springframework.stereotype.Service; + +@Service +public class ModelProblemTypeService extends ServiceImpl { + + public boolean remove(Integer modelId) { + return remove(new LambdaQueryWrapper().eq(ModelProblemType::getModelId, modelId)); + } + +} diff --git a/src/main/java/com/biutag/supervision/service/ModelService.java b/src/main/java/com/biutag/supervision/service/ModelService.java index 4e470fd..60c650d 100644 --- a/src/main/java/com/biutag/supervision/service/ModelService.java +++ b/src/main/java/com/biutag/supervision/service/ModelService.java @@ -1,5 +1,6 @@ package com.biutag.supervision.service; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -7,11 +8,14 @@ import com.biutag.supervision.common.UserContextHolder; import com.biutag.supervision.constants.enums.DistributionCycleEnum; import com.biutag.supervision.constants.enums.DistributionMethodEnum; import com.biutag.supervision.mapper.ModelMapper; +import com.biutag.supervision.pojo.dto.flow.VerifyData; import com.biutag.supervision.pojo.entity.Model; +import com.biutag.supervision.pojo.entity.ModelProblemType; import com.biutag.supervision.pojo.model.UserAuth; import com.biutag.supervision.util.ExpressionBuilder; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; import java.util.List; @@ -20,32 +24,56 @@ import java.util.List; @Service public class ModelService extends ServiceImpl { + private final ModelProblemTypeService modelProblemTypeService; + public List listByDistributionMethodOfNegative() { return list(new LambdaQueryWrapper().eq(Model::getDistributionMethod, DistributionMethodEnum.NEGATIVE_DISTRIBUTE.getValue())); } - public boolean saveModel(Model model) { + @Transactional(rollbackFor = Exception.class) + public boolean saveModel(Model model, List problems) { if (StrUtil.isNotBlank(model.getDistributionCycle()) && DistributionMethodEnum.NEGATIVE_DISTRIBUTE.getValue().equals(model.getDistributionMethod())) { String expression = DistributionCycleEnum.day.name().equals(model.getDistributionCycle()) ? ExpressionBuilder.build(model.getDistributionCycleTime()) : ExpressionBuilder.build(model.getDistributionCycleTime(), model.getDistributionCycleDayOfWeek()); model.setDistributionCycleExpression(expression); } + model.setCreateTime(LocalDateTime.now()); model.setUpdateTime(LocalDateTime.now()); UserAuth user = UserContextHolder.getCurrentUser(); model.setCreateDepartId(user.getDepartId()); model.setCreateDepartName(user.getDepartName()); boolean save = save(model); + if (!problems.isEmpty()) { + List problemTypes = problems.stream().map(item -> { + ModelProblemType modelProblemType = new ModelProblemType(); + BeanUtil.copyProperties(item, modelProblemType); + modelProblemType.setModelId(model.getId()); + return modelProblemType; + }).toList(); + modelProblemTypeService.saveBatch(problemTypes); + } return save; } - public boolean updateModel(Model model) { + @Transactional(rollbackFor = Exception.class) + public boolean updateModel(Model model, List problems) { if (StrUtil.isNotBlank(model.getDistributionCycle()) && DistributionMethodEnum.NEGATIVE_DISTRIBUTE.getValue().equals(model.getDistributionMethod())) { String expression = DistributionCycleEnum.day.name().equals(model.getDistributionCycle()) ? ExpressionBuilder.build(model.getDistributionCycleTime()) : ExpressionBuilder.build(model.getDistributionCycleTime(), model.getDistributionCycleDayOfWeek()); model.setDistributionCycleExpression(expression); } model.setUpdateTime(LocalDateTime.now()); + modelProblemTypeService.remove(model.getId()); + if (!problems.isEmpty()) { + List problemTypes = problems.stream().map(item -> { + ModelProblemType modelProblemType = new ModelProblemType(); + BeanUtil.copyProperties(item, modelProblemType); + modelProblemType.setModelId(model.getId()); + return modelProblemType; + }).toList(); + modelProblemTypeService.saveBatch(problemTypes); + } return updateById(model); } @@ -53,4 +81,5 @@ public class ModelService extends ServiceImpl { return removeById(modelId); } + } diff --git a/src/test/java/com/biutag/supervision/tools/GenCodeTests.java b/src/test/java/com/biutag/supervision/tools/GenCodeTests.java index 882be5f..ce63b26 100644 --- a/src/test/java/com/biutag/supervision/tools/GenCodeTests.java +++ b/src/test/java/com/biutag/supervision/tools/GenCodeTests.java @@ -25,7 +25,7 @@ public class GenCodeTests { @Test public void genEntity() throws TemplateException, IOException { - String tableName = "negative_countersign"; + String tableName = "model_problem_type"; String tableSchema = "negative"; boolean genMapper = true; boolean genService = true;