fix: 修复一些问题

This commit is contained in:
曹鹏飞 2024-04-24 15:16:55 +08:00
parent affa1426b8
commit 44ff90fb26
7 changed files with 190 additions and 48 deletions

View File

@ -7,13 +7,11 @@ import com.google.common.collect.ImmutableList;
import com.mzt.logapi.context.LogRecordContext; import com.mzt.logapi.context.LogRecordContext;
import com.mzt.logapi.starter.annotation.LogRecord; import com.mzt.logapi.starter.annotation.LogRecord;
import com.nflg.product.base.core.api.BaseApi; import com.nflg.product.base.core.api.BaseApi;
import com.nflg.product.bomnew.pojo.query.BomExceptionQuery;
import com.nflg.product.bomnew.pojo.query.BomNewDQbomPageQuery; import com.nflg.product.bomnew.pojo.query.BomNewDQbomPageQuery;
import com.nflg.product.bomnew.pojo.query.BomNewDQbomQuery; import com.nflg.product.bomnew.pojo.query.BomNewDQbomQuery;
import com.nflg.product.bomnew.pojo.query.BomNewDQbomSaveQuery; import com.nflg.product.bomnew.pojo.query.BomNewDQbomSaveQuery;
import com.nflg.product.bomnew.pojo.vo.BomDQbomEditDetailVO; import com.nflg.product.bomnew.pojo.vo.*;
import com.nflg.product.bomnew.pojo.vo.BomNewDQbomVO;
import com.nflg.product.bomnew.pojo.vo.DQbomExcelVO;
import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO;
import com.nflg.product.bomnew.service.DQBomImportService; import com.nflg.product.bomnew.service.DQBomImportService;
import com.nflg.product.bomnew.service.DQBomService; import com.nflg.product.bomnew.service.DQBomService;
import com.nflg.product.bomnew.util.EecExcelUtil; import com.nflg.product.bomnew.util.EecExcelUtil;
@ -227,4 +225,15 @@ public class DQBomApi extends BaseApi {
public ResultVO<BomDQbomEditDetailVO> editDetail(@Valid @RequestParam("rowId") @NotNull Long rowId, @Valid @RequestParam("bomRowId") @NotNull Long bomRowId) { public ResultVO<BomDQbomEditDetailVO> editDetail(@Valid @RequestParam("rowId") @NotNull Long rowId, @Valid @RequestParam("bomRowId") @NotNull Long bomRowId) {
return ResultVO.success(dQBomService.editDetail(rowId, bomRowId)); return ResultVO.success(dQBomService.editDetail(rowId, bomRowId));
} }
/**
* 获取节点异常状态
* @param query query
* @return 节点异常状态
*/
@PostMapping("getBomException")
@ApiOperation("获取节点异常状态")
public ResultVO<List<BomExceptionVO>> getBomException(@Valid @RequestBody @NotEmpty List<BomExceptionQuery> query) {
return ResultVO.success(dQBomService.getBomException(query));
}
} }

View File

@ -0,0 +1,33 @@
package com.nflg.product.bomnew.pojo.query;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author 曹鹏飞
* @date 2024/4/24 14:24:21
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "com-nflg-product-bomnew-pojo-new-query-BomExceptionQuery")
public class BomExceptionQuery implements Serializable {
/**
* bomRowId
*/
@ApiModelProperty(value = "bomRowId", required = true)
@NotNull
protected Long bomRowId;
/**
* rowId
*/
@ApiModelProperty(value = "rowId", required = true)
@NotNull
protected Long rowId;
}

View File

@ -0,0 +1,37 @@
package com.nflg.product.bomnew.pojo.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @author 曹鹏飞
* @date 2024/4/24 13:32:57
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "com-nflg-product-bomnew-pojo-new-vo-BomExceptionVO")
public class BomExceptionVO implements Serializable {
/**
* bom行编号
*/
@ApiModelProperty(value = "bom行编号")
public Long bomRowId;
/**
* 物料编码
*/
@ApiModelProperty(value = "物料编码")
public String materialNo;
/**
* 异常状态
* @see com.nflg.product.bomnew.constant.EBomExceptionStatusEnum
*/
@ApiModelProperty(value = "异常状态")
private Integer exceptionStatus = -1;
}

View File

@ -2,6 +2,7 @@ package com.nflg.product.bomnew.service;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@ -138,7 +139,7 @@ public class DQBomImportService {
//BomNewDQbomParentEntity oldParent = dQBomParentService.getLatestByMaterialNo(parent.getMaterialNo()); //BomNewDQbomParentEntity oldParent = dQBomParentService.getLatestByMaterialNo(parent.getMaterialNo());
boolean isSame = true; boolean isSame = true;
if (Objects.isNull(oldParent)) { if (Objects.isNull(oldParent)) {
return isSame; return false;
} }
isSame = Objects.equals(parent.getMaterialUnit(), oldParent.getMaterialUnit()) isSame = Objects.equals(parent.getMaterialUnit(), oldParent.getMaterialUnit())
&& NumberUtil.equals(parent.getNum(), oldParent.getNum()) && NumberUtil.equals(parent.getNum(), oldParent.getNum())
@ -176,14 +177,14 @@ public class DQBomImportService {
log.debug("checkInconsistentDataentity" + JsonUtil.toJson(child)); log.debug("checkInconsistentDataentity" + JsonUtil.toJson(child));
List<BomNewDQbomVO> oldChildren = dQBomChildService.getBom(parentRowId, child.getMaterialNo()); List<BomNewDQbomVO> oldChildren = dQBomChildService.getBom(parentRowId, child.getMaterialNo());
boolean isSame = true; boolean isSame = true;
if (CollUtil.isEmpty(oldChildren)) return isSame; if (CollUtil.isEmpty(oldChildren)) return false;
BomNewDQbomVO oldChild; BomNewDQbomVO oldChild;
if (oldChildren.size() == 1) { if (oldChildren.size() == 1) {
oldChild = oldChildren.get(0); oldChild = oldChildren.get(0);
} else { } else {
oldChild = oldChildren.stream().filter(c -> Objects.equals(c.getOrderNumber(), child.getOrderNumber())).findFirst().orElse(null); oldChild = oldChildren.stream().filter(c -> Objects.equals(c.getOrderNumber(), child.getOrderNumber())).findFirst().orElse(null);
if (Objects.isNull(oldChild)) { if (Objects.isNull(oldChild)) {
return isSame; return false;
} }
} }
isSame = Objects.equals(child.getMaterialUnit(), oldChild.getMaterialUnit()) isSame = Objects.equals(child.getMaterialUnit(), oldChild.getMaterialUnit())
@ -364,7 +365,7 @@ public class DQBomImportService {
dQbomExcelVO.setRowNum(rowNum.get()); dQbomExcelVO.setRowNum(rowNum.get());
if (dQbomExcelVO.getProjectType().equals("T")) { if (dQbomExcelVO.getProjectType().equals("T")) {
long id = System.currentTimeMillis(); String id = RandomUtil.randomNumbers(9);
dQbomExcelVO.setMaterialNo(BomConstant.NO_TEMPORARY_PREFIX + id); dQbomExcelVO.setMaterialNo(BomConstant.NO_TEMPORARY_PREFIX + id);
dQbomExcelVO.setDrawingNo(BomConstant.NO_TEMPORARY_PREFIX + id); dQbomExcelVO.setDrawingNo(BomConstant.NO_TEMPORARY_PREFIX + id);
if (StrUtil.isBlank(dQbomExcelVO.getMaterialUnit())) { if (StrUtil.isBlank(dQbomExcelVO.getMaterialUnit())) {

View File

@ -12,7 +12,6 @@ import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Sets;
import com.nflg.product.base.core.conmon.util.SessionUtil; import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.bomnew.constant.*; import com.nflg.product.bomnew.constant.*;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO; import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
@ -21,13 +20,11 @@ import com.nflg.product.bomnew.pojo.entity.BomNewDQbomChildEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewDQbomParentEntity; import com.nflg.product.bomnew.pojo.entity.BomNewDQbomParentEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity; import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity; import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
import com.nflg.product.bomnew.pojo.query.BomExceptionQuery;
import com.nflg.product.bomnew.pojo.query.BomNewDQbomPageQuery; import com.nflg.product.bomnew.pojo.query.BomNewDQbomPageQuery;
import com.nflg.product.bomnew.pojo.query.BomNewDQbomQuery; import com.nflg.product.bomnew.pojo.query.BomNewDQbomQuery;
import com.nflg.product.bomnew.pojo.query.BomNewDQbomSaveQuery; import com.nflg.product.bomnew.pojo.query.BomNewDQbomSaveQuery;
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO; import com.nflg.product.bomnew.pojo.vo.*;
import com.nflg.product.bomnew.pojo.vo.BomDQbomEditDetailVO;
import com.nflg.product.bomnew.pojo.vo.BomNewDQbomVO;
import com.nflg.product.bomnew.pojo.vo.DQbomExcelVO;
import com.nflg.product.bomnew.util.BomUtil; import com.nflg.product.bomnew.util.BomUtil;
import com.nflg.product.bomnew.util.VUtils; import com.nflg.product.bomnew.util.VUtils;
import com.nflg.product.bomnew.util.VersionUtil; import com.nflg.product.bomnew.util.VersionUtil;
@ -253,15 +250,17 @@ public class DQBomService {
//修改数据 //修改数据
// VUtils.isTure(!SessionUtil.getUserCode().equals(parent.getCreatedBy())).throwMessage("不能修改他人的数据"); // VUtils.isTure(!SessionUtil.getUserCode().equals(parent.getCreatedBy())).throwMessage("不能修改他人的数据");
if (CollUtil.isEmpty(query.getChildren())) {
dQBomChildService.deleteAllChildren(parent.getRowId());
return query;
}
//删除 //删除
dQBomChildService.deleteAllChildren(parent.getRowId()); dQBomChildService.deleteAllChildren(parent.getRowId());
parent.setBomExist(1);
parent.setModifyTime(LocalDateTime.now()); parent.setModifyTime(LocalDateTime.now());
dQBomParentService.updateById(parent); if (CollUtil.isEmpty(query.getChildren())) {
//dQBomChildService.deleteAllChildren(parent.getRowId());
parent.setBomExist(0);
dQBomParentService.saveOrUpdate(parent);
return query;
}
parent.setBomExist(1);
dQBomParentService.saveOrUpdate(parent);
} }
//处理child //处理child
List<BomNewDQbomChildEntity> children = Convert.toList(BomNewDQbomChildEntity.class, query.getChildren()); List<BomNewDQbomChildEntity> children = Convert.toList(BomNewDQbomChildEntity.class, query.getChildren());
@ -271,6 +270,9 @@ public class DQBomService {
c.setRowId(IdWorker.getId()); c.setRowId(IdWorker.getId());
c.setCreatedBy(SessionUtil.getUserCode()); c.setCreatedBy(SessionUtil.getUserCode());
c.setCreatedName(SessionUtil.getRealName()); c.setCreatedName(SessionUtil.getRealName());
String id = RandomUtil.randomNumbers(9);
c.setMaterialNo(BomConstant.NO_TEMPORARY_PREFIX + id);
c.setDrawingNo(BomConstant.NO_TEMPORARY_PREFIX + id);
} else { } else {
c.setModifyTime(LocalDateTime.now()); c.setModifyTime(LocalDateTime.now());
} }
@ -327,6 +329,11 @@ public class DQBomService {
.set(BomNewDQbomParentEntity::getEditStatus, EbomEditStatusEnum.HANDLER_FINISHED.getValue()) .set(BomNewDQbomParentEntity::getEditStatus, EbomEditStatusEnum.HANDLER_FINISHED.getValue())
.set(BomNewDQbomParentEntity::getModifyTime, LocalDateTime.now()) .set(BomNewDQbomParentEntity::getModifyTime, LocalDateTime.now())
.update(); .update();
dQBomChildService.lambdaUpdate()
.eq(BomNewDQbomChildEntity::getParentRowId, query.getParent().getRowId())
.set(BomNewDQbomChildEntity::getEditStatus, EbomEditStatusEnum.HANDLER_FINISHED.getValue())
.set(BomNewDQbomChildEntity::getModifyTime, LocalDateTime.now())
.update();
//checkException(CollUtil.toList(query.getParent().getRowId())); //checkException(CollUtil.toList(query.getParent().getRowId()));
} }
@ -393,15 +400,23 @@ public class DQBomService {
} }
public BomDQbomEditDetailVO editDetail(Long rowId, Long bomRowId) { public BomDQbomEditDetailVO editDetail(Long rowId, Long bomRowId) {
VUtils.isTure(Objects.isNull(rowId) && Objects.isNull(bomRowId)).throwMessage("无效的数据");
BomDQbomEditDetailVO vo = new BomDQbomEditDetailVO(); BomDQbomEditDetailVO vo = new BomDQbomEditDetailVO();
BomNewDQbomParentEntity parent = dQBomParentService.getById(bomRowId); if (bomRowId == 0) {
BomNewDQbomChildEntity child = dQBomChildService.getById(rowId); BomNewDQbomChildEntity child = dQBomChildService.getById(rowId);
VUtils.isTure(Objects.isNull(parent) && Objects.isNull(child)).throwMessage("无效的数据"); BomNewDQbomVO p = Convert.convert(BomNewDQbomVO.class, child);
if (!Objects.isNull(parent)) { p.setRootIs(0);
p.setUserRootIs(0);
p.setRowId(IdWorker.getId());
p.setCreatedTime(LocalDateTime.now());
p.setCreatedBy(SessionUtil.getUserCode());
p.setModifyTime(null);
vo.setParent(p);
} else {
BomNewDQbomParentEntity parent = dQBomParentService.getById(bomRowId);
vo.setParent(Convert.convert(BomNewDQbomVO.class, parent)); vo.setParent(Convert.convert(BomNewDQbomVO.class, parent));
vo.setDatas(getChild(bomRowId)); vo.setDatas(getChild(bomRowId));
} else if (!Objects.isNull(child)) {
vo.setParent(Convert.convert(BomNewDQbomVO.class, child));
} }
return vo; return vo;
} }
@ -438,13 +453,17 @@ public class DQBomService {
BomNewDQbomParentEntity root = dQBomParentService.getById(rootBomRowId); BomNewDQbomParentEntity root = dQBomParentService.getById(rootBomRowId);
VUtils.isTure(Objects.isNull(root)).throwMessage("未找到数据"); VUtils.isTure(Objects.isNull(root)).throwMessage("未找到数据");
VUtils.isTure(root.getStatus() == 2).throwMessage("已转pbom不能再次转换");
if (Objects.equals(root.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())) {
//如果没有异常则再进行一次异常检查避免手动添加数据后没做异常检查就转pbom
checkException(rootBomRowId);
}
VUtils.isTure(!Objects.equals(root.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())) VUtils.isTure(!Objects.equals(root.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue()))
.throwMessage("异常状态不能转pbom"); .throwMessage("异常状态不能转pbom");
VUtils.isTure(root.getStatus() == 2).throwMessage("已转pbom不能再次转换");
List<BomNewDQbomParentEntity> parents = new ArrayList<>(); List<BomNewDQbomParentEntity> parents = new ArrayList<>();
List<BomNewDQbomChildEntity> children = new ArrayList<>(); List<BomNewDQbomChildEntity> children = new ArrayList<>();
buildPbom(root, parents, children); buildTree(root, parents, children);
dQBomParentService.updateBatchById(parents); dQBomParentService.updateBatchById(parents);
dQBomChildService.updateBatchById(children); dQBomChildService.updateBatchById(children);
savePbomParents(parents); savePbomParents(parents);
@ -467,12 +486,18 @@ public class DQBomService {
c.setModifyTime(null); c.setModifyTime(null);
c.setIdentityNo(c.getParentRowId() + "_" + c.getRowId()); c.setIdentityNo(c.getParentRowId() + "_" + c.getRowId());
if (CollUtil.isNotEmpty(materialBaseInfos)) { if (CollUtil.isNotEmpty(materialBaseInfos)) {
BaseMaterialVO materialVO = materialBaseInfos.stream().filter(m -> m.getMaterialNo().equals(c.getMaterialNo())).findFirst().orElse(null); BaseMaterialVO materialVO = materialBaseInfos.stream()
.filter(m -> m.getMaterialNo().equals(c.getMaterialNo()))
.findFirst()
.orElse(null);
if (!Objects.isNull(materialVO)) { if (!Objects.isNull(materialVO)) {
c.setMaterialCategoryCode(materialVO.getMaterialCategoryCode()); c.setMaterialCategoryCode(materialVO.getMaterialCategoryCode());
} }
} }
BomNewDQbomParentEntity parent = parents.stream().filter(p -> p.getMaterialNo().equals(c.getMaterialNo())).findFirst().orElse(null); BomNewDQbomParentEntity parent = parents.stream()
.filter(p -> p.getMaterialNo().equals(c.getMaterialNo()))
.findFirst()
.orElse(null);
if (!Objects.isNull(parent)) { if (!Objects.isNull(parent)) {
c.setBomVersionRowId(parent.getRowId()); c.setBomVersionRowId(parent.getRowId());
} }
@ -496,7 +521,7 @@ public class DQBomService {
bomNewPbomParentService.saveBatch(pparents); bomNewPbomParentService.saveBatch(pparents);
} }
private void buildPbom(BomNewDQbomParentEntity parent, List<BomNewDQbomParentEntity> parents, List<BomNewDQbomChildEntity> children) { private void buildTree(BomNewDQbomParentEntity parent, List<BomNewDQbomParentEntity> parents, List<BomNewDQbomChildEntity> children) {
parent.setStatus(2); parent.setStatus(2);
parent.setConvertToPbomTime(LocalDateTime.now()); parent.setConvertToPbomTime(LocalDateTime.now());
parent.setModifyTime(LocalDateTime.now()); parent.setModifyTime(LocalDateTime.now());
@ -521,24 +546,25 @@ public class DQBomService {
VUtils.isTure(true).throwMessage(StrUtil.format("{}的当前版本为{}比pbom中版本{}低", parent.getMaterialNo() VUtils.isTure(true).throwMessage(StrUtil.format("{}的当前版本为{}比pbom中版本{}低", parent.getMaterialNo()
, parent.getCurrentVersion(), pp.getCurrentVersion())); , parent.getCurrentVersion(), pp.getCurrentVersion()));
} else { } else {
if (pp.getStatus() == 4) { if (pp.getStatus() >= 4) {
List<BomNewDQbomVO> dqChildren = getChild(parent.getRowId()); // List<BomNewDQbomVO> dqChildren = getChild(parent.getRowId());
Set<String> pChildren = bomNewPbomChildService.lambdaQuery() // Set<String> pChildren = bomNewPbomChildService.lambdaQuery()
.select(BomNewPbomChildEntity::getMaterialNo) // .select(BomNewPbomChildEntity::getMaterialNo)
.eq(BomNewPbomChildEntity::getParentRowId, pp.getRowId()) // .eq(BomNewPbomChildEntity::getParentRowId, pp.getRowId())
.list() // .list()
.stream() // .stream()
.map(BomNewPbomChildEntity::getMaterialNo) // .map(BomNewPbomChildEntity::getMaterialNo)
.collect(Collectors.toSet()); // .collect(Collectors.toSet());
if (dqChildren.size() != pChildren.size() // if (dqChildren.size() != pChildren.size()
|| !Sets.difference(dqChildren.stream().map(BomNewDQbomVO::getMaterialNo).collect(Collectors.toSet()), pChildren).isEmpty()) { // || !Sets.difference(dqChildren.stream().map(BomNewDQbomVO::getMaterialNo).collect(Collectors.toSet()), pChildren).isEmpty()) {
parent.setCurrentVersion(VersionUtil.getNextVersion(parent.getCurrentVersion())); parent.setCurrentVersion(VersionUtil.getNextVersion(pp.getCurrentVersion()));
pp.setLastVersionIs(0); pp.setLastVersionIs(0);
bomNewPbomParentService.updateById(pp); bomNewPbomParentService.updateById(pp);
} // }
} else { } else {
parent.setCurrentVersion(pp.getCurrentVersion());
bomNewPbomParentService.getBaseMapper().deleteById(pp.getRowId()); bomNewPbomParentService.getBaseMapper().deleteById(pp.getRowId());
bomNewPbomChildService.getBaseMapper().delete(new LambdaQueryWrapper<BomNewPbomChildEntity>() bomNewPbomChildService.getBaseMapper().delete(bomNewPbomChildService.lambdaQuery()
.eq(BomNewPbomChildEntity::getParentRowId, pp.getRowId())); .eq(BomNewPbomChildEntity::getParentRowId, pp.getRowId()));
} }
} }
@ -548,7 +574,7 @@ public class DQBomService {
.in(BomNewDQbomParentEntity::getMaterialNo, cc.stream().map(BomNewDQbomChildEntity::getMaterialNo).collect(Collectors.toList())) .in(BomNewDQbomParentEntity::getMaterialNo, cc.stream().map(BomNewDQbomChildEntity::getMaterialNo).collect(Collectors.toList()))
.eq(BomNewDQbomParentEntity::getStatus, 1) .eq(BomNewDQbomParentEntity::getStatus, 1)
.list() .list()
.forEach(p -> buildPbom(p, parents, children)); .forEach(p -> buildTree(p, parents, children));
} }
private int versionCompare(String version1, String version2) { private int versionCompare(String version1, String version2) {
@ -556,4 +582,34 @@ public class DQBomService {
if (StrUtil.isBlank(version2)) return -1; if (StrUtil.isBlank(version2)) return -1;
return Integer.parseInt(version1.substring(1)) - Integer.parseInt(version2.substring(1)); return Integer.parseInt(version1.substring(1)) - Integer.parseInt(version2.substring(1));
} }
public List<BomExceptionVO> getBomException(List<BomExceptionQuery> query) {
List<BomExceptionVO> datas = new ArrayList<>();
for (int index = 0, count = query.size(); index < count; index++) {
BomExceptionQuery bom = query.get(index);
if (index == 0) {
checkException(bom.getBomRowId());
BomNewDQbomParentEntity parent = dQBomParentService.getById(bom.getBomRowId());
BomExceptionVO vo = new BomExceptionVO();
vo.setBomRowId(bom.getBomRowId());
vo.setMaterialNo(parent.getMaterialNo());
vo.setExceptionStatus(parent.getExceptionStatus());
datas.add(vo);
} else {
BomExceptionVO vo = new BomExceptionVO();
vo.setBomRowId(bom.getBomRowId());
BomNewDQbomChildEntity child = dQBomChildService.getById(bom.getRowId());
vo.setMaterialNo(child.getMaterialNo());
if (Objects.equals(child.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())) {
BomNewDQbomParentEntity parent = dQBomParentService.getById(bom.getBomRowId());
vo.setExceptionStatus(parent.getExceptionStatus());
} else {
vo.setExceptionStatus(child.getExceptionStatus());
}
}
}
return datas;
}
} }

View File

@ -30,7 +30,7 @@
<!--分页获取数据--> <!--分页获取数据-->
<select id="getPageList" resultType="com.nflg.product.bomnew.pojo.vo.BomNewDQbomVO"> <select id="getPageList" resultType="com.nflg.product.bomnew.pojo.vo.BomNewDQbomVO">
SELECT SELECT
ifnull(c.row_id,p.row_id) row_id, ifnull(c.row_id,0) row_id,
p.row_id bomRowId, p.row_id bomRowId,
p.created_by bomCreateBy, p.created_by bomCreateBy,
p.* p.*

View File

@ -1,6 +1,7 @@
package com.nflg.product.bomnew.service.test; package com.nflg.product.bomnew.service.test;
import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@ -142,4 +143,9 @@ public class OtherTest {
public void test16() { public void test16() {
System.out.println("下一个版本:" + VersionUtil.getNextVersionForSmallVersion("A00")); System.out.println("下一个版本:" + VersionUtil.getNextVersionForSmallVersion("A00"));
} }
@Test
public void test17() {
System.out.println("T" + RandomUtil.randomNumbers(9));
}
} }