+ebom编辑 验证码删除与编辑行互斥

This commit is contained in:
jing's 2024-03-30 18:56:49 +08:00
parent 22c09cf185
commit 9ae1b14842
1 changed files with 22 additions and 3 deletions

View File

@ -2,6 +2,7 @@ package com.nflg.product.bomnew.api.user;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.ImmutableList;
@ -34,6 +35,7 @@ import java.io.IOException;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
/**
@ -338,7 +340,22 @@ public class EbomApi extends BaseApi {
}
//temporary
void checkDeleteRule(BomNewEBomParentEditDTO dto){
if(CollUtil.isNotEmpty(dto.getDelDatas()) && CollUtil.isNotEmpty(dto.getDelDatas())){
List<Long> delList=dto.getDelDatas().stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
List<Long> dataList=dto.getDelDatas().stream().filter(u-> ObjectUtil.isNotNull(u.getRowId())&& u.getRowId().longValue()>0).map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
// 删除编辑出现相同(互斥)
List<Long> sameList= CollectionUtil.intersection(delList,dataList).stream().collect(Collectors.toList());;
if(CollUtil.isNotEmpty(sameList)){
VUtils.isTure(true).throwMessage(StrUtil.format("删除数据与编辑数据出现相同行 {}",StrUtil.join(",",sameList)));
}
}
}
@PostMapping("temporary")
@ -346,7 +363,7 @@ public class EbomApi extends BaseApi {
@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 {
checkDeleteRule(dto);
bomNewEbomParentService.deleteBomChild(dto.getDelDatas());
return ResultVO.success(bomNewEbomParentService.temporary(dto));
}
@ -355,7 +372,7 @@ public class EbomApi extends BaseApi {
@ApiOperation("暂存添加")
@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 {
checkDeleteRule(dto);
bomNewEbomParentService.deleteBomChild(dto.getDelDatas());
return ResultVO.success(bomNewEbomParentService.temporary(dto));
}
@ -364,6 +381,7 @@ public class EbomApi extends BaseApi {
@ApiOperation("提交添加")
@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 {
checkDeleteRule(dto);
bomNewEbomParentService.deleteBomChild(dto.getDelDatas());
return ResultVO.success(bomNewEbomParentService.submit(dto));
}
@ -373,6 +391,7 @@ public class EbomApi extends BaseApi {
@ApiOperation("提交")
@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 {
checkDeleteRule(dto);
bomNewEbomParentService.deleteBomChild(dto.getDelDatas());
return ResultVO.success(bomNewEbomParentService.submit(dto));
}