Browse Source

处置流程参数校验

develop
lau572 6 months ago
parent
commit
70ec1eca00
  1. 6
      zc-business/src/main/java/com/zc/business/controller/DcEventProcessController.java
  2. 4
      zc-business/src/main/java/com/zc/business/domain/DcEventProcess.java
  3. 6
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

6
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("事件已结束,无法进行操作!");
}

4
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 */

6
zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

@ -102,9 +102,11 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
@Override
public DcEvent selectDcEventById(String id) {
DcEvent dcEvent = dcEventMapper.selectDcEventById(id);
if (dcEvent != null){
List<DcProcessConfig> processConfigList = dcProcessConfigMapper.selectDcProcessConfigByEventType(Math.toIntExact(dcEvent.getEventType()));
dcEvent.setProcessConfigList(processConfigList);
}
List<DcProcessConfig> processConfigList = dcProcessConfigMapper.selectDcProcessConfigByEventType(Math.toIntExact(dcEvent.getEventType()));
dcEvent.setProcessConfigList(processConfigList);
return dcEvent;
}

Loading…
Cancel
Save