optimize: 优化数据验证
This commit is contained in:
parent
1d50b4686d
commit
4efbf98253
|
|
@ -19,7 +19,6 @@ import com.nflg.product.bomnew.pojo.vo.*;
|
||||||
import com.nflg.product.bomnew.service.*;
|
import com.nflg.product.bomnew.service.*;
|
||||||
import com.nflg.product.bomnew.util.EecExcelUtil;
|
import com.nflg.product.bomnew.util.EecExcelUtil;
|
||||||
import com.nflg.product.bomnew.util.VUtils;
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
import com.nflg.product.bomnew.util.VersionUtil;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import nflg.product.common.constant.STATE;
|
import nflg.product.common.constant.STATE;
|
||||||
|
|
@ -37,11 +36,7 @@ import javax.validation.Valid;
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -395,7 +390,7 @@ public class EbomApi extends BaseApi {
|
||||||
@PostMapping("temporary")
|
@PostMapping("temporary")
|
||||||
@ApiOperation("暂存")
|
@ApiOperation("暂存")
|
||||||
@LogRecord(success = "Ebom-暂存,物料编码:{{#dto.parent.materialNo}}-版本:{{#dto.parent.currentVersion}},操作结果:{{#_ret.state}} {{#_ret.msg}}", bizNo = "{{#dto.parent.rowId}}", type = "Ebom-暂存")
|
@LogRecord(success = "Ebom-暂存,物料编码:{{#dto.parent.materialNo}}-版本:{{#dto.parent.currentVersion}},操作结果:{{#_ret.state}} {{#_ret.msg}}", bizNo = "{{#dto.parent.rowId}}", type = "Ebom-暂存")
|
||||||
public ResultVO<BomNewEbomParentVO> temporary(@RequestBody BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
|
public ResultVO<BomNewEbomParentVO> temporary(@Valid @RequestBody BomNewEBomParentEditDTO dto) {
|
||||||
|
|
||||||
checkDeleteRule(dto);
|
checkDeleteRule(dto);
|
||||||
bomNewEbomParentService.deleteBomChild(dto.getDelDatas(), dto.getParent());
|
bomNewEbomParentService.deleteBomChild(dto.getDelDatas(), dto.getParent());
|
||||||
|
|
@ -407,7 +402,7 @@ public class EbomApi extends BaseApi {
|
||||||
@PostMapping("temporaryAdd")
|
@PostMapping("temporaryAdd")
|
||||||
@ApiOperation("暂存添加")
|
@ApiOperation("暂存添加")
|
||||||
@LogRecord(success = "Ebom-暂存添加,物料编码:{{#dto.parent.materialNo}}-版本:{{#dto.parent.currentVersion}},操作结果:{{#_ret.state}} {{#_ret.msg}}", bizNo = "{{#dto.parent.rowId}}", type = "Ebom-暂存添加")
|
@LogRecord(success = "Ebom-暂存添加,物料编码:{{#dto.parent.materialNo}}-版本:{{#dto.parent.currentVersion}},操作结果:{{#_ret.state}} {{#_ret.msg}}", bizNo = "{{#dto.parent.rowId}}", type = "Ebom-暂存添加")
|
||||||
public ResultVO<BomNewEbomParentVO> temporaryAdd(@RequestBody BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
|
public ResultVO<BomNewEbomParentVO> temporaryAdd(@Valid @RequestBody BomNewEBomParentEditDTO dto) {
|
||||||
checkDeleteRule(dto);
|
checkDeleteRule(dto);
|
||||||
bomNewEbomParentService.deleteBomChild(dto.getDelDatas(), dto.getParent());
|
bomNewEbomParentService.deleteBomChild(dto.getDelDatas(), dto.getParent());
|
||||||
BomNewEbomParentVO temporary = bomNewEbomParentService.temporary(dto);
|
BomNewEbomParentVO temporary = bomNewEbomParentService.temporary(dto);
|
||||||
|
|
@ -418,7 +413,7 @@ public class EbomApi extends BaseApi {
|
||||||
@PostMapping("submitAdd")
|
@PostMapping("submitAdd")
|
||||||
@ApiOperation("提交添加")
|
@ApiOperation("提交添加")
|
||||||
@LogRecord(success = "Ebom-提交添加,物料编码:{{#dto.parent.materialNo}}-版本:{{#dto.parent.currentVersion}},操作结果:{{#_ret.state}} {{#_ret.msg}}", bizNo = "{{#dto.parent.rowId}}", type = "Ebom-提交添加")
|
@LogRecord(success = "Ebom-提交添加,物料编码:{{#dto.parent.materialNo}}-版本:{{#dto.parent.currentVersion}},操作结果:{{#_ret.state}} {{#_ret.msg}}", bizNo = "{{#dto.parent.rowId}}", type = "Ebom-提交添加")
|
||||||
public ResultVO<Boolean> submitAdd(@RequestBody BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
|
public ResultVO<Boolean> submitAdd(@Valid @RequestBody BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
|
||||||
checkDeleteRule(dto);
|
checkDeleteRule(dto);
|
||||||
bomNewEbomParentService.deleteBomChild(dto.getDelDatas(), dto.getParent());
|
bomNewEbomParentService.deleteBomChild(dto.getDelDatas(), dto.getParent());
|
||||||
return ResultVO.success(bomNewEbomParentService.submit(dto));
|
return ResultVO.success(bomNewEbomParentService.submit(dto));
|
||||||
|
|
@ -428,7 +423,7 @@ public class EbomApi extends BaseApi {
|
||||||
@PostMapping("submit")
|
@PostMapping("submit")
|
||||||
@ApiOperation("提交")
|
@ApiOperation("提交")
|
||||||
@LogRecord(success = "Ebom-提交,物料编码:{{#dto.parent.materialNo}}-版本:{{#dto.parent.currentVersion}},操作结果:{{#_ret.state}} {{#_ret.msg}}", bizNo = "{{#dto.parent.rowId}}", type = "Ebom-提交")
|
@LogRecord(success = "Ebom-提交,物料编码:{{#dto.parent.materialNo}}-版本:{{#dto.parent.currentVersion}},操作结果:{{#_ret.state}} {{#_ret.msg}}", bizNo = "{{#dto.parent.rowId}}", type = "Ebom-提交")
|
||||||
public ResultVO<Boolean> submit(@RequestBody BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
|
public ResultVO<Boolean> submit(@Valid @RequestBody BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
|
||||||
checkDeleteRule(dto);
|
checkDeleteRule(dto);
|
||||||
bomNewEbomParentService.deleteBomChild(dto.getDelDatas(), dto.getParent());
|
bomNewEbomParentService.deleteBomChild(dto.getDelDatas(), dto.getParent());
|
||||||
return ResultVO.success(bomNewEbomParentService.submit(dto));
|
return ResultVO.success(bomNewEbomParentService.submit(dto));
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,13 @@ import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class BomNewEBomParentEditDTO extends BomNewEBomParentCreateDTO{
|
public class BomNewEBomParentEditDTO extends BomNewEBomParentCreateDTO{
|
||||||
@ApiModelProperty("上层")
|
@ApiModelProperty("上层")
|
||||||
|
@NotNull
|
||||||
private BomNewEbomParentVO parent;
|
private BomNewEbomParentVO parent;
|
||||||
|
|
||||||
@ApiModelProperty("删除的列表")
|
@ApiModelProperty("删除的列表")
|
||||||
|
|
|
||||||
|
|
@ -1937,7 +1937,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public BomNewEbomParentVO temporary(BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
|
public BomNewEbomParentVO temporary(BomNewEBomParentEditDTO dto) {
|
||||||
|
|
||||||
|
|
||||||
checkUserRoleAuth(dto.getParent().getCreatedBy());
|
checkUserRoleAuth(dto.getParent().getCreatedBy());
|
||||||
|
|
@ -2390,7 +2390,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
for (int index = 0, count = query.size(); index < count; index++) {
|
for (int index = 0, count = query.size(); index < count; index++) {
|
||||||
BomExceptionQuery bom = query.get(index);
|
BomExceptionQuery bom = query.get(index);
|
||||||
BomExceptionVO vo = new BomExceptionVO();
|
BomExceptionVO vo = new BomExceptionVO();
|
||||||
if (index == 0) {
|
if (index == 0 && bom.getBomRowId() > 0) {
|
||||||
BomNewEbomParentEntity parent = getById(bom.getBomRowId());
|
BomNewEbomParentEntity parent = getById(bom.getBomRowId());
|
||||||
VUtils.isTure(Objects.isNull(parent)).throwMessage(bom.getMaterialNo() + "不存在");
|
VUtils.isTure(Objects.isNull(parent)).throwMessage(bom.getMaterialNo() + "不存在");
|
||||||
|
|
||||||
|
|
@ -2403,7 +2403,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
VUtils.isTure(Objects.isNull(child)).throwMessage(bom.getMaterialNo() + "不存在");
|
VUtils.isTure(Objects.isNull(child)).throwMessage(bom.getMaterialNo() + "不存在");
|
||||||
|
|
||||||
vo.setMaterialNo(child.getMaterialNo());
|
vo.setMaterialNo(child.getMaterialNo());
|
||||||
if (Objects.equals(child.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())) {
|
if (Objects.equals(child.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue()) && bom.getBomRowId() > 0) {
|
||||||
BomNewEbomParentEntity parent = getById(bom.getBomRowId());
|
BomNewEbomParentEntity parent = getById(bom.getBomRowId());
|
||||||
vo.setExceptionStatus(parent.getExceptionStatus());
|
vo.setExceptionStatus(parent.getExceptionStatus());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue