Browse Source

fit: 模型超市-新增/编辑模型时,新增指定下发单位、新增业务类型、涉嫌问题、涉及警种、问题类型的选项;

fit: 人工核验-任务下发,新增指定下发单位、新增业务类型、涉嫌问题、涉及警种、问题类型的选项;
fit: 问题流程办理新增“修改核查内容”功能,二级机构、市局专班可对派出所提交情况进行修改
main
wxc 1 year ago
parent
commit
b236333f3d
  1. 22
      sql/1128.sql
  2. 21
      src/main/java/com/biutag/supervision/constants/enums/AccountabilityTargetEnum.java
  3. 10
      src/main/java/com/biutag/supervision/constants/enums/BlameType.java
  4. 21
      src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelController.java
  5. 24
      src/main/java/com/biutag/supervision/controller/system/PoliceController.java
  6. 64
      src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java
  7. 30
      src/main/java/com/biutag/supervision/flow/action/UpdateVerifyAction.java
  8. 8
      src/main/java/com/biutag/supervision/mapper/ModelProblemTypeMapper.java
  9. 10
      src/main/java/com/biutag/supervision/pojo/dto/ModelClueTaskDistribute.java
  10. 84
      src/main/java/com/biutag/supervision/pojo/dto/ModelDto.java
  11. 13
      src/main/java/com/biutag/supervision/pojo/entity/Model.java
  12. 1
      src/main/java/com/biutag/supervision/pojo/entity/ModelClue.java
  13. 51
      src/main/java/com/biutag/supervision/pojo/entity/ModelProblemType.java
  14. 2
      src/main/java/com/biutag/supervision/pojo/entity/NegativeProblemRelation.java
  15. 21
      src/main/java/com/biutag/supervision/service/ModelClueService.java
  16. 16
      src/main/java/com/biutag/supervision/service/ModelProblemTypeService.java
  17. 33
      src/main/java/com/biutag/supervision/service/ModelService.java
  18. 2
      src/test/java/com/biutag/supervision/tools/GenCodeTests.java

22
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='问题清单人员关联问题表';

21
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;
}

10
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
}

21
src/main/java/com/biutag/supervision/controller/sensitivePerception/ModelController.java

@ -1,15 +1,18 @@
package com.biutag.supervision.controller.sensitivePerception; package com.biutag.supervision.controller.sensitivePerception;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.mapper.ModelClassMapper; import com.biutag.supervision.mapper.ModelClassMapper;
import com.biutag.supervision.pojo.Result; 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.entity.Model;
import com.biutag.supervision.pojo.model.ModelClassModel; import com.biutag.supervision.pojo.model.ModelClassModel;
import com.biutag.supervision.pojo.param.ModelQueryParam; import com.biutag.supervision.pojo.param.ModelQueryParam;
import com.biutag.supervision.pojo.vo.ModelTree; import com.biutag.supervision.pojo.vo.ModelTree;
import com.biutag.supervision.service.ModelService; import com.biutag.supervision.service.ModelService;
import com.biutag.supervision.util.JSON;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -57,13 +60,23 @@ public class ModelController {
} }
@PostMapping @PostMapping
public Result<Boolean> add(@RequestBody Model model) { public Result<Boolean> add(@RequestBody ModelDto modelDto) {
return Result.success(modelService.saveModel(model)); 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 @PutMapping
public Result<Model> update(@RequestBody Model model) { public Result<Model> update(@RequestBody ModelDto modelDto) {
modelService.updateModel(model); 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); return Result.success(model);
} }

24
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()); SupPolice supPolice = policeService.getByIdCode(list.get(i).getIdCode());
if (supPolice == null) { if (supPolice == null) {
supPolice = new SupPolice(); supPolice = new SupPolice();
supPolice.setName(police.getName()); }
supPolice.setIdCode(police.getIdCode()); supPolice.setName(police.getName());
supPolice.setEmpNo(police.getEmpNo()); supPolice.setIdCode(police.getIdCode());
supPolice.setOrgId(depart.getId()); supPolice.setEmpNo(police.getEmpNo());
supPolice.setOrgId(depart.getId());
if (police.getEmpNo().contains("A")) {
supPolice.setPersonType("3");
} else { } else {
supPolice.setName(police.getName()); supPolice.setPersonType("1");
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);
} }
policeService.saveOrUpdate(supPolice);
if ("三级机构专班".equals(police.getRole()) || "二级机构专班".equals(police.getRole())) { if ("三级机构专班".equals(police.getRole()) || "二级机构专班".equals(police.getRole())) {
String userId = saveOrUpdateUser(police); String userId = saveOrUpdateUser(police);
// 角色 // 角色

64
src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java

@ -49,19 +49,25 @@ public class ApplyCompletionAction implements Action {
//validator.validate(verifyData); //validator.validate(verifyData);
// 新增审批数据 // 新增审批数据
Negative negative = negativeService.getById(actionDto.getNegativeId()); Negative negative = negativeService.getById(actionDto.getNegativeId());
updateNegative(actionDto.getNegativeId(), verifyData, negative); updateNegative(negative, verifyData);
doneWork(actionDto.getWorkId()); doneWork(actionDto.getWorkId());
addWork(actionDto.getNegativeId(), actionDto.getWorkId(), addWork(actionDto.getNegativeId(), actionDto.getWorkId(),
// 是否是本级办理 // 是否是本级办理
negative.getIsSecondHandle() ? RoleCodeEnum.FIRST_ADMIN.getCode() : RoleCodeEnum.SECOND_ADMIN.getCode(), negative.getIsSecondHandle() ? RoleCodeEnum.FIRST_ADMIN.getCode() : RoleCodeEnum.SECOND_ADMIN.getCode(),
negative); negative);
addApprove(negative);
LambdaUpdateWrapper<Negative> updateWrapper = new LambdaUpdateWrapper<Negative>()
.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(); LocalDateTime now = LocalDateTime.now();
LambdaUpdateWrapper<Negative> updateWrapper = new LambdaUpdateWrapper<Negative>() LambdaUpdateWrapper<Negative> updateWrapper = new LambdaUpdateWrapper<Negative>()
.eq(Negative::getId, negativeId) .eq(Negative::getId, negative.getId())
.set(Negative::getFlowKey, negative.getIsSecondHandle() ? FlowNodeEnum.FIRST_APPROVE.getKey() : FlowNodeEnum.SECOND_APPROVE.getKey())
.set(Negative::getUpdTime, now) .set(Negative::getUpdTime, now)
.set(Negative::getProcessingStatus, ProcessingStatusEnum.approval.name()) .set(Negative::getProcessingStatus, ProcessingStatusEnum.approval.name())
.set(Negative::getCheckStatus, verifyData.getCheckStatus()) .set(Negative::getCheckStatus, verifyData.getCheckStatus())
@ -71,9 +77,7 @@ public class ApplyCompletionAction implements Action {
.set(Negative::getIsRectifyName, verifyData.getIsRectifyName()) .set(Negative::getIsRectifyName, verifyData.getIsRectifyName())
.set(Negative::getAccountabilityTarget, verifyData.getAccountabilityTarget()) .set(Negative::getAccountabilityTarget, verifyData.getAccountabilityTarget())
.set(Negative::getCaseNumber, verifyData.getCaseNumber()) .set(Negative::getCaseNumber, verifyData.getCaseNumber())
.set(Negative::getRectifyDesc, verifyData.getRectifyDesc()) .set(Negative::getRectifyDesc, verifyData.getRectifyDesc());
// 当前处理对象
.set(Negative::getCurrentProcessingObject, negative.getIsSecondHandle() ? "市局专班" : String.format("%s专班", negative.getHandleSecondDepartName()));
// 未整改 // 未整改
if (IsRectifyEnum.NOT.getValue().equals(verifyData.getIsRectifyCode())) { if (IsRectifyEnum.NOT.getValue().equals(verifyData.getIsRectifyCode())) {
updateWrapper.set(Negative::getRectifyRestrictionDays, verifyData.getRectifyRestrictionDays()); updateWrapper.set(Negative::getRectifyRestrictionDays, verifyData.getRectifyRestrictionDays());
@ -82,21 +86,25 @@ public class ApplyCompletionAction implements Action {
if (!verifyData.getBlames().isEmpty()) { if (!verifyData.getBlames().isEmpty()) {
List<NegativeProblemRelation> problemRelations = new ArrayList<>(); List<NegativeProblemRelation> problemRelations = new ArrayList<>();
List<NegativeBlame> negativeBlames = verifyData.getBlames().stream().map(item -> { List<VerifyData.Blame> 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<NegativeBlame> negativeBlames = blames.stream().map(item -> {
NegativeBlame negativeBlame = new NegativeBlame(); NegativeBlame negativeBlame = new NegativeBlame();
BeanUtil.copyProperties(item, negativeBlame); BeanUtil.copyProperties(item, negativeBlame);
if(verifyData != null && verifyData.getBlameLeaders() != null) { List<VerifyData.BlameLeader> blameLeaders = verifyData.getBlameLeaders().stream()
List<VerifyData.BlameLeader> blameLeaders = verifyData.getBlameLeaders().stream() .filter(leader -> leader.getBlameIdCodes().contains(item.getBlameIdCode()))
.filter(leader -> leader.getBlameIdCodes().contains(item.getBlameIdCode())) .toList();
.toList(); if(!blameLeaders.isEmpty()) {
if(!blameLeaders.isEmpty()) { BeanUtil.copyProperties(blameLeaders.get(0), negativeBlame);
BeanUtil.copyProperties(blameLeaders.get(0), negativeBlame);
}
} }
negativeBlame negativeBlame
.setBlameId(IdUtil.getSnowflakeNextIdStr()) .setBlameId(IdUtil.getSnowflakeNextIdStr())
.setNegativeId(negativeId) .setNegativeId(negative.getId())
.setCrtTime(now) .setCrtTime(now)
.setUpdTime(now); .setUpdTime(now);
@ -105,18 +113,18 @@ public class ApplyCompletionAction implements Action {
BeanUtil.copyProperties(problem, problemRelation); BeanUtil.copyProperties(problem, problemRelation);
problemRelation.setId(IdUtil.fastSimpleUUID()); problemRelation.setId(IdUtil.fastSimpleUUID());
problemRelation.setBlameId(negativeBlame.getBlameId()); problemRelation.setBlameId(negativeBlame.getBlameId());
problemRelation.setNegativeId(negativeId); problemRelation.setNegativeId(negative.getId());
return problemRelation; return problemRelation;
}).toList()); }).toList());
return negativeBlame; return negativeBlame;
}).toList(); }).toList();
// 先删除 // 先删除
negativeBlameService.remove(negativeId); negativeBlameService.remove(negative.getId());
// 新增涉及人员 // 新增涉及人员
negativeBlameService.saveBatch(negativeBlames); negativeBlameService.saveBatch(negativeBlames);
// 新增涉及人员问题类型 // 新增涉及人员问题类型
// 先删除 // 先删除
negativeProblemRelationService.remove(negativeId); negativeProblemRelationService.remove(negative.getId());
if (!problemRelations.isEmpty()) { if (!problemRelations.isEmpty()) {
// 新增 // 新增
negativeProblemRelationService.saveBatch(problemRelations); negativeProblemRelationService.saveBatch(problemRelations);
@ -124,26 +132,30 @@ public class ApplyCompletionAction implements Action {
} }
if (!verifyData.getFiles().isEmpty()) { 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()) { if (!negative.getIsSecondHandle()) {
NegativeApprove approve1 = new NegativeApprove() NegativeApprove approve1 = new NegativeApprove()
.setNegativeId(negativeId) .setNegativeId(negative.getId())
.setActionKey(FlowActionEnum.SECOND_APPROVE.getKey()) .setActionKey(FlowActionEnum.SECOND_APPROVE.getKey())
.setCreateTime(now); .setCreateTime(LocalDateTime.now());
aproveService.save(approve1); aproveService.save(approve1);
} }
// 三级审批 所队一>二級机构一>市局 // 三级审批 所队一>二級机构一>市局
if (!ApprovalFlowEnum.SECOND_APPROVAL.getValue().equals(negative.getApprovalFlow())) { if (!ApprovalFlowEnum.SECOND_APPROVAL.getValue().equals(negative.getApprovalFlow())) {
NegativeApprove approve2 = new NegativeApprove() NegativeApprove approve2 = new NegativeApprove()
.setNegativeId(negativeId) .setNegativeId(negative.getId())
.setActionKey(FlowActionEnum.FIRST_APPROVE.getKey()) .setActionKey(FlowActionEnum.FIRST_APPROVE.getKey())
.setCreateTime(now); .setCreateTime(LocalDateTime.now());
aproveService.save(approve2); aproveService.save(approve2);
} }
} }

30
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);
}
}

8
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<ModelProblemType> {
}

10
src/main/java/com/biutag/supervision/pojo/dto/ModelClueTaskDistribute.java

@ -43,6 +43,16 @@ public class ModelClueTaskDistribute {
@NotBlank @NotBlank
private String approvalFlow; private String approvalFlow;
private String handleDepartId;
// 业务类型
private String businessTypeCode;
// 警种
private String policeType;
private String involveProblem;
private List<FileVo> thingFiles = new ArrayList<>(); private List<FileVo> thingFiles = new ArrayList<>();

84
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<Map<String, String>> involveProblem;
// 问题类型
private List<VerifyData.Problem> problems = new ArrayList<>();
}

13
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.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.biutag.supervision.pojo.dto.flow.VerifyData;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@Setter @Setter
@Getter @Getter
@ -97,4 +100,14 @@ public class Model {
// 预警问题处置 // 预警问题处置
private String warningHandling; private String warningHandling;
private String handleDepartId;
// 业务类型
private String businessTypeCode;
// 警种
private String policeType;
private String involveProblem;
} }

1
src/main/java/com/biutag/supervision/pojo/entity/ModelClue.java

@ -73,7 +73,6 @@ public class ModelClue {
// 任务ID // 任务ID
private Integer taskId; private Integer taskId;
// 总警情数 // 总警情数
@TableField(exist = false) @TableField(exist = false)
private Long zjjs; private Long zjjs;

51
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;
}

2
src/main/java/com/biutag/supervision/pojo/entity/NegativeProblemRelation.java

@ -44,7 +44,7 @@ public class NegativeProblemRelation {
private String threeLevelContent; private String threeLevelContent;
// 其他内容 // 其他内容
@TableField("threeLevelContent") @TableField("threeLevelContentOther")
private String threeLevelContentOther; private String threeLevelContentOther;
} }

21
src/main/java/com/biutag/supervision/service/ModelClueService.java

@ -123,7 +123,12 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
model.setMaxExtensionDuration(taskDistribute.getMaxExtensionDuration()); model.setMaxExtensionDuration(taskDistribute.getMaxExtensionDuration());
model.setApprovalFlow(taskDistribute.getApprovalFlow()); model.setApprovalFlow(taskDistribute.getApprovalFlow());
model.setDistributionFlow(taskDistribute.getDistributionFlow()); 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()); return distribution(modelClues, model, taskDistribute.getTaskName(), taskDistribute.getThingFiles());
} }
@ -154,9 +159,16 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
// 问题来源 // 问题来源
negative.setProblemSources(ProblemSourcesEnum.LMGZ.getLabel()); negative.setProblemSources(ProblemSourcesEnum.LMGZ.getLabel());
negative.setProblemSourcesCode(ProblemSourcesEnum.LMGZ.getValue()); negative.setProblemSourcesCode(ProblemSourcesEnum.LMGZ.getValue());
// TODO 业务类别 涉及问题
negative.setBusinessTypeCode(BusinessTypeEnum.QT.getValue()); if (StrUtil.isNotBlank(model.getBusinessTypeCode())) {
negative.setBusinessTypeName(BusinessTypeEnum.QT.getLabel()); 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.setInvolveDepartId(item.getInvolveDepartId());
negative.setInvolveDepartName(item.getInvolveDepartName()); negative.setInvolveDepartName(item.getInvolveDepartName());
@ -168,6 +180,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
negative.setThingDesc(item.getThingDesc()); negative.setThingDesc(item.getThingDesc());
// 主办层级 // 主办层级
negative.setHostLevel(HostLevelEnums.THREE.getValue()); negative.setHostLevel(HostLevelEnums.THREE.getValue());
negative.setThingFiles(thingFiles);
// 办理单位 // 办理单位
SupDepart depart = departService.getById(item.getInvolveDepartId()); SupDepart depart = departService.getById(item.getInvolveDepartId());
if (depart.getLevel().equals(DepartLevelEnum.SECOND.getValue())) { if (depart.getLevel().equals(DepartLevelEnum.SECOND.getValue())) {

16
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<ModelProblemTypeMapper, ModelProblemType> {
public boolean remove(Integer modelId) {
return remove(new LambdaQueryWrapper<ModelProblemType>().eq(ModelProblemType::getModelId, modelId));
}
}

33
src/main/java/com/biutag/supervision/service/ModelService.java

@ -1,5 +1,6 @@
package com.biutag.supervision.service; package com.biutag.supervision.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.DistributionCycleEnum;
import com.biutag.supervision.constants.enums.DistributionMethodEnum; import com.biutag.supervision.constants.enums.DistributionMethodEnum;
import com.biutag.supervision.mapper.ModelMapper; 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.Model;
import com.biutag.supervision.pojo.entity.ModelProblemType;
import com.biutag.supervision.pojo.model.UserAuth; import com.biutag.supervision.pojo.model.UserAuth;
import com.biutag.supervision.util.ExpressionBuilder; import com.biutag.supervision.util.ExpressionBuilder;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@ -20,32 +24,56 @@ import java.util.List;
@Service @Service
public class ModelService extends ServiceImpl<ModelMapper, Model> { public class ModelService extends ServiceImpl<ModelMapper, Model> {
private final ModelProblemTypeService modelProblemTypeService;
public List<Model> listByDistributionMethodOfNegative() { public List<Model> listByDistributionMethodOfNegative() {
return list(new LambdaQueryWrapper<Model>().eq(Model::getDistributionMethod, DistributionMethodEnum.NEGATIVE_DISTRIBUTE.getValue())); return list(new LambdaQueryWrapper<Model>().eq(Model::getDistributionMethod, DistributionMethodEnum.NEGATIVE_DISTRIBUTE.getValue()));
} }
public boolean saveModel(Model model) { @Transactional(rollbackFor = Exception.class)
public boolean saveModel(Model model, List<VerifyData.Problem> problems) {
if (StrUtil.isNotBlank(model.getDistributionCycle()) && DistributionMethodEnum.NEGATIVE_DISTRIBUTE.getValue().equals(model.getDistributionMethod())) { if (StrUtil.isNotBlank(model.getDistributionCycle()) && DistributionMethodEnum.NEGATIVE_DISTRIBUTE.getValue().equals(model.getDistributionMethod())) {
String expression = DistributionCycleEnum.day.name().equals(model.getDistributionCycle()) ? ExpressionBuilder.build(model.getDistributionCycleTime()) : String expression = DistributionCycleEnum.day.name().equals(model.getDistributionCycle()) ? ExpressionBuilder.build(model.getDistributionCycleTime()) :
ExpressionBuilder.build(model.getDistributionCycleTime(), model.getDistributionCycleDayOfWeek()); ExpressionBuilder.build(model.getDistributionCycleTime(), model.getDistributionCycleDayOfWeek());
model.setDistributionCycleExpression(expression); model.setDistributionCycleExpression(expression);
} }
model.setCreateTime(LocalDateTime.now()); model.setCreateTime(LocalDateTime.now());
model.setUpdateTime(LocalDateTime.now()); model.setUpdateTime(LocalDateTime.now());
UserAuth user = UserContextHolder.getCurrentUser(); UserAuth user = UserContextHolder.getCurrentUser();
model.setCreateDepartId(user.getDepartId()); model.setCreateDepartId(user.getDepartId());
model.setCreateDepartName(user.getDepartName()); model.setCreateDepartName(user.getDepartName());
boolean save = save(model); boolean save = save(model);
if (!problems.isEmpty()) {
List<ModelProblemType> 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; return save;
} }
public boolean updateModel(Model model) { @Transactional(rollbackFor = Exception.class)
public boolean updateModel(Model model, List<VerifyData.Problem> problems) {
if (StrUtil.isNotBlank(model.getDistributionCycle()) && DistributionMethodEnum.NEGATIVE_DISTRIBUTE.getValue().equals(model.getDistributionMethod())) { if (StrUtil.isNotBlank(model.getDistributionCycle()) && DistributionMethodEnum.NEGATIVE_DISTRIBUTE.getValue().equals(model.getDistributionMethod())) {
String expression = DistributionCycleEnum.day.name().equals(model.getDistributionCycle()) ? ExpressionBuilder.build(model.getDistributionCycleTime()) : String expression = DistributionCycleEnum.day.name().equals(model.getDistributionCycle()) ? ExpressionBuilder.build(model.getDistributionCycleTime()) :
ExpressionBuilder.build(model.getDistributionCycleTime(), model.getDistributionCycleDayOfWeek()); ExpressionBuilder.build(model.getDistributionCycleTime(), model.getDistributionCycleDayOfWeek());
model.setDistributionCycleExpression(expression); model.setDistributionCycleExpression(expression);
} }
model.setUpdateTime(LocalDateTime.now()); model.setUpdateTime(LocalDateTime.now());
modelProblemTypeService.remove(model.getId());
if (!problems.isEmpty()) {
List<ModelProblemType> 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); return updateById(model);
} }
@ -53,4 +81,5 @@ public class ModelService extends ServiceImpl<ModelMapper, Model> {
return removeById(modelId); return removeById(modelId);
} }
} }

2
src/test/java/com/biutag/supervision/tools/GenCodeTests.java

@ -25,7 +25,7 @@ public class GenCodeTests {
@Test @Test
public void genEntity() throws TemplateException, IOException { public void genEntity() throws TemplateException, IOException {
String tableName = "negative_countersign"; String tableName = "model_problem_type";
String tableSchema = "negative"; String tableSchema = "negative";
boolean genMapper = true; boolean genMapper = true;
boolean genService = true; boolean genService = true;

Loading…
Cancel
Save