手动合并test上的代码:设计岗用户可维护自己的数据,数据来源包括(原始Bom、sap 、excel、mdm、变更)

This commit is contained in:
10001392 2024-10-16 17:39:43 +08:00
parent 9f45527909
commit e3fc5b2361
1 changed files with 23 additions and 19 deletions

View File

@ -2425,7 +2425,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
List<BomNewEbomChildEntity> delChildList = SpringUtil.getBean(BomNewEbomChildService.class).list(queryChildWrapper);
List<BomNewEbomChildEntity> delTagList = new ArrayList<>();
List<BomNewEbomChildEntity> deletingTagList = new ArrayList<>();
//检查原始bom里过来数据是否包含正常数据
// List<BomNewEbomChildEntity> check1List = delChildList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource())
@ -2448,30 +2448,34 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
// }
//原始bom不正常
List<BomNewEbomChildEntity> s1List = delChildList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource())
&& !Objects.equals(u.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(s1List)) {
delTagList.addAll(s1List);
}
//原始bom不正常
//24/10/15需求变更原始bom正常数据可删除
// List<BomNewEbomChildEntity> toDel1List = delChildList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource())
// && !Objects.equals(u.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())).collect(Collectors.toList());
// if (CollectionUtil.isNotEmpty(s1List)) {
// delTagList.addAll(s1List);
// }
//手动创建
List<BomNewEbomChildEntity> s2List = delChildList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_EXCE.getValue(), u.getSource())
|| Objects.equals(EBomSourceEnum.FROM_MDM.getValue(), u.getSource())
|| Objects.equals(EBomSourceEnum.FROM_CHANGE.getValue(), u.getSource())
).collect(Collectors.toList());
//可删数据来源包含全部
// List<BomNewEbomChildEntity> toDel2List = delChildList.stream().filter(u ->
// Objects.equals(EBomSourceEnum.FROM_EXCE.getValue(), u.getSource())
// || Objects.equals(EBomSourceEnum.FROM_MDM.getValue(), u.getSource())
// || Objects.equals(EBomSourceEnum.FROM_CHANGE.getValue(), u.getSource())
// || Objects.equals(EBomSourceEnum.FROM_SAP.getValue(), u.getSource())
// || Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource())
// ).collect(Collectors.toList());
//工艺岗可以删自己的和设计岗(手动excel),
// 设计自己删除自己
//工艺岗用户1 可以删工艺岗用户2 的数据
if (CollectionUtil.isNotEmpty(s2List)) {
if (CollectionUtil.isNotEmpty(delChildList)) {
for (BomNewEbomChildEntity vo :
s2List) {
delChildList) {
if (userRoleService.technician()) { //工艺岗可删
delTagList.add(vo);
deletingTagList.add(vo);
} else if (userRoleService.designer() && vo.getCreatedBy().equals(SessionUtil.getUserCode())) { //自己的数据可删
delTagList.add(vo);
deletingTagList.add(vo);
} else {
throw new NflgBusinessException(STATE.Error, StrUtil.format("{}数据不是你的,无权删除", vo.getMaterialNo()));
@ -2479,12 +2483,12 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
}
if (CollectionUtil.isNotEmpty(delTagList)) {
List<Long> rowIdList = delTagList.stream().map(BomNewEbomChildEntity::getRowId).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(deletingTagList)) {
List<Long> rowIdList = deletingTagList.stream().map(BomNewEbomChildEntity::getRowId).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(rowIdList)) {
ebomChildService.removeByIds(rowIdList);
//将对应的parent设置为根节点
setRootIs1(delTagList.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList()), SessionUtil.getUserCode());
setRootIs1(deletingTagList.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList()), SessionUtil.getUserCode());
}
}
}