From 70ec1eca00c62b03215971b8a0aec23b840a8e8b Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Wed, 12 Jun 2024 09:37:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=BD=AE=E6=B5=81=E7=A8=8B=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zc/business/controller/DcEventProcessController.java | 6 +++++- .../main/java/com/zc/business/domain/DcEventProcess.java | 4 ++++ .../com/zc/business/service/impl/DcEventServiceImpl.java | 6 ++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcEventProcessController.java b/zc-business/src/main/java/com/zc/business/controller/DcEventProcessController.java index 594dba25..91683789 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcEventProcessController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcEventProcessController.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.exception.file.InvalidExtensionException; @@ -104,8 +105,11 @@ public class DcEventProcessController extends BaseController // @PreAuthorize("@ss.hasPermi('system:process:add')") @Log(title = "事件处理流程", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody DcEventProcess dcEventProcess){ + public AjaxResult add(@RequestBody @Valid DcEventProcess dcEventProcess){ DcEvent dcEvent = dcEventService.selectDcEventById(dcEventProcess.getEventId()); + if (dcEvent == null){ + return AjaxResult.error("事件信息有误!"); + } if (dcEvent.getEventState() == 2){ return AjaxResult.error("事件已结束,无法进行操作!"); } diff --git a/zc-business/src/main/java/com/zc/business/domain/DcEventProcess.java b/zc-business/src/main/java/com/zc/business/domain/DcEventProcess.java index 649c2ea1..c1435ef4 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcEventProcess.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcEventProcess.java @@ -9,7 +9,9 @@ import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; import org.springframework.web.multipart.MultipartFile; +import javax.validation.constraints.Max; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; /** * 事件处理流程对象 dc_event_process @@ -28,6 +30,7 @@ public class DcEventProcess /** $column.columnComment */ @ApiModelProperty(value="事件ID") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + @NotBlank(message = "事件ID不能为空") private String eventId; /** $column.columnComment */ @@ -73,6 +76,7 @@ public class DcEventProcess /** $column.columnComment */ @ApiModelProperty("内容") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + @Size(max = 500, message = "内容不能超过500个字符") private String context; /** $column.type */ diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java index 46786c06..1781c875 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java @@ -102,9 +102,11 @@ public class DcEventServiceImpl extends ServiceImpl impl @Override public DcEvent selectDcEventById(String id) { DcEvent dcEvent = dcEventMapper.selectDcEventById(id); + if (dcEvent != null){ + List processConfigList = dcProcessConfigMapper.selectDcProcessConfigByEventType(Math.toIntExact(dcEvent.getEventType())); + dcEvent.setProcessConfigList(processConfigList); + } - List processConfigList = dcProcessConfigMapper.selectDcProcessConfigByEventType(Math.toIntExact(dcEvent.getEventType())); - dcEvent.setProcessConfigList(processConfigList); return dcEvent; }