diff --git a/mes/src/main/java/com/wangziyang/mes/basedata/controller/SpMaterileController.java b/mes/src/main/java/com/wangziyang/mes/basedata/controller/SpMaterileController.java index 80a1daad2ebe5cdbbe137ba51687c759616ff308..29aa43edf1a88db29d956973f24fb151ec85c205 100644 --- a/mes/src/main/java/com/wangziyang/mes/basedata/controller/SpMaterileController.java +++ b/mes/src/main/java/com/wangziyang/mes/basedata/controller/SpMaterileController.java @@ -1,6 +1,7 @@ package com.wangziyang.mes.basedata.controller; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.wangziyang.mes.basedata.entity.SpMaterile; @@ -23,6 +24,8 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import java.util.Objects; + /** *

* 物料控制器 @@ -37,6 +40,7 @@ public class SpMaterileController extends BaseController { /** * 物料服务 + * * @date 2020-07-07 */ @Autowired @@ -113,8 +117,12 @@ public class SpMaterileController extends BaseController { @PostMapping("/add-or-update") @ResponseBody public Result addOrUpdate(SpMaterile record) { - SpFlow spflow = iSpFlowService.getById(record.getFlowId()); - record.setFlowDesc(spflow.getFlowDesc()); + if (StrUtil.isNotBlank(record.getFlowId())) { + SpFlow spflow = iSpFlowService.getById(record.getFlowId()); + if (Objects.nonNull(spflow)) { + record.setFlowDesc(spflow.getFlowDesc()); + } + } iSpMaterileService.saveOrUpdate(record); return Result.success(); } diff --git a/mes/src/main/java/com/wangziyang/mes/technology/dto/SpFlowDto.java b/mes/src/main/java/com/wangziyang/mes/technology/dto/SpFlowDto.java index cdad28459c35a984ef37f062bb38c56d4e22db98..c0bf13b4f869783b991cfe5caae2ba52dd88961a 100644 --- a/mes/src/main/java/com/wangziyang/mes/technology/dto/SpFlowDto.java +++ b/mes/src/main/java/com/wangziyang/mes/technology/dto/SpFlowDto.java @@ -1,5 +1,6 @@ package com.wangziyang.mes.technology.dto; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.wangziyang.mes.technology.entity.SpFlow; import com.wangziyang.mes.technology.vo.SpOperVo; @@ -8,6 +9,7 @@ import java.util.List; /** * 流程DTO */ +@JsonIgnoreProperties(ignoreUnknown = true) public class SpFlowDto extends SpFlow { /** * 流程与工序关系集合