diff --git a/src/main/java/com/biutag/supervision/config/MybatisPlusConfig.java b/src/main/java/com/biutag/supervision/config/MybatisPlusConfig.java index 6b04844..03642be 100644 --- a/src/main/java/com/biutag/supervision/config/MybatisPlusConfig.java +++ b/src/main/java/com/biutag/supervision/config/MybatisPlusConfig.java @@ -15,9 +15,9 @@ public class MybatisPlusConfig { @Bean public MybatisPlusInterceptor mybatisPlusInterceptor() { MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor()); interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); // 如果配置多个插件, 切记分页最后添加 // 如果有多数据源可以不配具体类型, 否则都建议配上具体的 DbType - interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor()); return interceptor; } diff --git a/src/main/java/com/biutag/supervision/flow/action/FirstDistributeAction.java b/src/main/java/com/biutag/supervision/flow/action/FirstDistributeAction.java index 061d6fa..cb3df2f 100644 --- a/src/main/java/com/biutag/supervision/flow/action/FirstDistributeAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/FirstDistributeAction.java @@ -13,7 +13,7 @@ import com.biutag.supervision.pojo.entity.SupDepart; import com.biutag.supervision.service.NegativeService; import com.biutag.supervision.service.NegativeWorkService; import com.biutag.supervision.service.SupDepartService; -import jakarta.validation.Validator; +import jakarta.validation.ValidationException; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; import org.springframework.validation.annotation.Validated; @@ -50,6 +50,11 @@ public class FirstDistributeAction implements Action { } public void updateNegative(String negativeId, String nextFlowKey, @Validated FirstDistributeData distributeData, boolean thirdHandling) { + // 防御 + if (StrUtil.isBlank(negativeId)) { + throw new ValidationException("negativeId不能为空"); + } + LocalDateTime now = LocalDateTime.now(); LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() .set(Negative::getHostLevel, distributeData.getHostLevel()) @@ -61,7 +66,26 @@ public class FirstDistributeAction implements Action { .set(Negative::getUpdTime, now) // 市局下发意见 .set(Negative::getFirstDistributeComments, distributeData.getFirstDistributeComments()) + .set(Negative::getInvolveDepartId, distributeData.getInvolveDepartId()) + .set(Negative::getInvolveDepartName, distributeData.getInvolveDepartName()) .eq(Negative::getId, negativeId); + // 涉及单位重新更新 + String involveDepartId = distributeData.getInvolveDepartId(); + if (StrUtil.isBlank(involveDepartId)) { + throw new ValidationException("涉及单位不能为空"); + } + SupDepart depart = departService.getById(involveDepartId); + if (depart == null) { + throw new ValidationException("涉及单位不存在"); + } + if (DepartLevelEnum.SECOND.getValue().equals(depart.getLevel())) { + updateWrapper.set(Negative::getSecondInvolveDepartId, depart.getId()); + } else if (DepartLevelEnum.THREE.getValue().equals(depart.getLevel())) { + updateWrapper.set(Negative::getThreeInvolveDepartId, depart.getId()); + updateWrapper.set(Negative::getSecondInvolveDepartId, depart.getPid()); + } else { + throw new RuntimeException("涉及单位请选择二级或三级单位"); + } if (TimeLimitEnum.OTHER.getValue().equals(distributeData.getTimeLimit())) { updateWrapper.set(Negative::getMaxSignDuration, distributeData.getMaxSignDuration()) .set(Negative::getMaxHandleDuration, distributeData.getMaxHandleDuration()) diff --git a/src/main/java/com/biutag/supervision/pojo/dto/flow/FirstDistributeData.java b/src/main/java/com/biutag/supervision/pojo/dto/flow/FirstDistributeData.java index efac917..f27fc59 100644 --- a/src/main/java/com/biutag/supervision/pojo/dto/flow/FirstDistributeData.java +++ b/src/main/java/com/biutag/supervision/pojo/dto/flow/FirstDistributeData.java @@ -1,5 +1,6 @@ package com.biutag.supervision.pojo.dto.flow; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Getter; import lombok.Setter; @@ -36,4 +37,10 @@ public class FirstDistributeData { // 市局下发意见 private String firstDistributeComments; + @Schema(description = "涉及单位名称") + private String involveDepartName; + + @Schema(description = "涉及单位id") + private String involveDepartId; + }