pbom-异常检查可多选

This commit is contained in:
大米 2024-09-29 18:16:31 +08:00
parent 1e36417038
commit 729f300b0a
3 changed files with 13 additions and 7 deletions

View File

@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Sets;
import com.mzt.logapi.context.LogRecordContext;
import com.mzt.logapi.starter.annotation.LogRecord;
import com.nflg.product.base.core.api.BaseApi;
@ -36,10 +37,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
import java.util.stream.Collectors;
@ -443,8 +441,15 @@ public class PBomApi extends BaseApi {
@PostMapping("checkException")
@ApiOperation("PBOM-数据异常检查")
public ResultVO<Boolean> checkException(@RequestBody PBomCheckExceptionDTO checkExceptionDTO) {
VUtils.isTure(CollUtil.isEmpty(checkExceptionDTO.getBomRowIds())).throwMessage("请选择要检查的BOM");
List<BomNewPbomParentEntity> pBoms = bomNewPbomParentService.lambdaQuery().in(BomNewPbomParentEntity::getRowId, checkExceptionDTO.getBomRowIds()).list();
Set<Long> exitsBoms = pBoms.stream().map(u -> u.getRowId()).collect(Collectors.toSet());
Set<Long> noBomParams= Sets.difference(Sets.newHashSet(checkExceptionDTO.getBomRowIds()) , exitsBoms);
VUtils.isTure(CollUtil.isNotEmpty(noBomParams)).throwMessage(StrUtil.join(",", noBomParams)+ "PBom版本不存在,请检查参数是否正确.");
bomNewPbomParentService.checkException(checkExceptionDTO.getBomRowId(),checkExceptionDTO.getPBomType());
for(Long rowId : checkExceptionDTO.getBomRowIds()) {
bomNewPbomParentService.checkException(rowId, checkExceptionDTO.getPBomType());
};
return ResultVO.success(true);
}

View File

@ -3,11 +3,13 @@ package com.nflg.product.bomnew.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class PBomCheckExceptionDTO {
@ApiModelProperty("BOM版本ID")
private Long bomRowId;
private List<Long> bomRowIds;

View File

@ -2029,7 +2029,6 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
*/
public void checkException(Long rowId,Integer bomType){
BomNewPbomParentEntity parent = this.getById(rowId);
VUtils.isTure(parent==null).throwMessage("PBom不存在");
List<BomNewPbomParentVO> allBom =new ArrayList<>();
if(bomType==0){
allBom= this.getAllBom(rowId, 0);