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