fix: 添加子节点为空判断,如果为空则不执行更新操作
This commit is contained in:
parent
3f20301028
commit
c9e03f5009
|
|
@ -243,13 +243,13 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
new Workbook().addSheet(new ListSheet<>(result)).writeTo(response.getOutputStream());
|
||||
}
|
||||
|
||||
public List<BomNewPbomParentVO> getChild(Long rowId) {
|
||||
|
||||
List<BomNewPbomParentVO> parentChild = this.getBaseMapper().getParentChild(rowId);
|
||||
BomNewPbomParentEntity parent = this.getById(rowId);
|
||||
public List<BomNewPbomParentVO> getChild(BomNewPbomParentEntity parent) {
|
||||
//List<BomNewPbomParentVO> parentChild = this.getBaseMapper().getParentChild(rowId);
|
||||
//BomNewPbomParentEntity parent = this.getById(rowId);
|
||||
List<BomNewPbomParentVO> parentChild = this.getBaseMapper().getParentChild(parent.getRowId());
|
||||
if (CollUtil.isNotEmpty(parentChild)) {
|
||||
materialMainService.intiMaterialInfo(parentChild, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
List<String> materialNos = parentChild.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
List<String> materialNos = parentChild.stream().map(BaseMaterialVO::getMaterialNo).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(materialNos)) {
|
||||
List<BomNewPbomParentEntity> list = this.lambdaQuery().in(BomNewPbomParentEntity::getMaterialNo, materialNos)
|
||||
.eq(!PBomStatusEnum.PUBLISH.equalsValue(parent.getStatus()), BomNewPbomParentEntity::getLastVersionIs, 1)
|
||||
|
|
@ -325,15 +325,18 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
BomNewPbomParentEntity parent = this.getById(paramDTO.getBomRowId());
|
||||
VUtils.isTure(Objects.isNull(parent)).throwMessage("参数错误,该BOM不存在");
|
||||
LogRecordContext.putVariable("bom",parent);
|
||||
List<BomNewPbomChildEntity> childList = Convert.toList(BomNewPbomChildEntity.class, paramDTO.getChildList());
|
||||
childList.forEach(u -> {
|
||||
u.setParentRowId(paramDTO.getBomRowId());
|
||||
});
|
||||
pbomChildService.saveOrUpdateBatch(childList);
|
||||
parent.setEditStatus(editStatus.getValue());
|
||||
parent.setModifyTime(LocalDateTime.now());
|
||||
this.updateById(parent);
|
||||
|
||||
if (CollUtil.isNotEmpty(paramDTO.getChildList())) {
|
||||
List<BomNewPbomChildEntity> childList = Convert.toList(BomNewPbomChildEntity.class, paramDTO.getChildList());
|
||||
childList.forEach(u -> u.setParentRowId(paramDTO.getBomRowId()));
|
||||
pbomChildService.saveOrUpdateBatch(childList);
|
||||
}
|
||||
|
||||
if (editStatus == PBomEditStatusEnum.HANDLER_TEMP) {
|
||||
return getChild(paramDTO.getBomRowId());
|
||||
return getChild(parent);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -431,7 +434,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
*/
|
||||
public void editExport(Long bomRowId, HttpServletResponse response) throws IOException {
|
||||
EecExcelUtil.setResponseExcelHeader(response, "bom明细列表");
|
||||
List<BomNewPbomParentVO> child = this.getChild(bomRowId);
|
||||
BomNewPbomParentEntity parent = this.getById(bomRowId);
|
||||
List<BomNewPbomParentVO> child = this.getChild(parent);
|
||||
List<BomNewPbomEditExcelVO> result = Convert.toList(BomNewPbomEditExcelVO.class, child);
|
||||
|
||||
new Workbook().addSheet(new ListSheet<>(result)).writeTo(response.getOutputStream());
|
||||
|
|
@ -440,7 +444,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
public void editExportV2(PBomEditExportParamDTO param, HttpServletResponse response) throws IOException {
|
||||
EecExcelUtil.setResponseExcelHeader(response, "bom明细列表");
|
||||
List<BomNewPbomParentVO> child = this.getChild(param.getBomRowId());
|
||||
BomNewPbomParentEntity parent = this.getById(param.getBomRowId());
|
||||
List<BomNewPbomParentVO> child = this.getChild(parent);
|
||||
if (CollUtil.isNotEmpty(param.getRowIds())) {
|
||||
child = child.stream().filter(u -> param.getRowIds().contains(u.getRowId())).collect(Collectors.toList());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue