删除出现异常

This commit is contained in:
jing's 2024-03-26 21:58:18 +08:00
parent 686b65b0ba
commit 10cc77a414
2 changed files with 59 additions and 53 deletions

View File

@ -20,6 +20,7 @@ import com.nflg.product.bomnew.util.VUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import nflg.product.common.constant.STATE;
import nflg.product.common.dto.LoginUserInfoDTO;
import nflg.product.common.vo.ResultVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
@ -86,7 +87,7 @@ public class EbomApi extends BaseApi {
@PostMapping("delChangeImpact")
@ApiOperation("变更影响-删除")
public ResultVO<Boolean> delChangeImpact(@RequestBody List<Long> rowIds){
public ResultVO<Boolean> delChangeImpact(@RequestBody List<Long> rowIds) {
VUtils.isTure(CollUtil.isEmpty(rowIds)).throwMessage("请选择要删除的数据");
upgradeChangeService.delChangeImpact(rowIds);
return ResultVO.success(true);
@ -94,14 +95,13 @@ public class EbomApi extends BaseApi {
@PostMapping("updateChangeImpactVersion")
@ApiOperation("变更影响-更新版本")
public ResultVO<Boolean> updateChangeImpactVersion(@RequestBody List<Long> rowIds){
public ResultVO<Boolean> updateChangeImpactVersion(@RequestBody List<Long> rowIds) {
VUtils.isTure(CollUtil.isEmpty(rowIds)).throwMessage("请选择要更新版本的数据");
upgradeChangeService.updateChangeImpactVersion(rowIds);
return ResultVO.success(true);
}
@GetMapping("getChild")
@ApiOperation("获取子级")
public ResultVO<List<BomNewEbomParentVO>> getChild(@RequestParam("bomRowId") Long bomRowId) {
@ -111,7 +111,7 @@ public class EbomApi extends BaseApi {
@PostMapping("projectTypeInit")
@ApiOperation("项目类别自动赋值")
@LogRecord(success = "项目类别自动赋值:物料编码:{{#bom.materialNo}} 版本:{{#bom.currentVersion}},操作结果:{{#_ret}}",
bizNo = "{{#bomRowIds.toString()}}" ,type = "项目类别自动赋值")
bizNo = "{{#bomRowIds.toString()}}", type = "项目类别自动赋值")
public ResultVO<Boolean> projectTypeInit(@RequestBody List<Long> bomRowIds) throws ExecutionException, InterruptedException {
VUtils.isTure(CollUtil.isEmpty(bomRowIds)).throwMessage("请选择要自动赋值的行");
@ -123,7 +123,7 @@ public class EbomApi extends BaseApi {
@PostMapping("generateVirtualPackage")
@ApiOperation("生成虚拟包")
@LogRecord(success = "生成虚拟包:物料编码:{{#bom.materialNo}} 版本:{{#bom.currentVersion}},操作结果:{{#_ret}}",
bizNo = "{{#paramDto.bomRowId}}" ,type = "生成虚拟包")
bizNo = "{{#paramDto.bomRowId}}", type = "生成虚拟包")
public ResultVO<Boolean> generateVirtualPackage(@RequestBody VirtualPackageParamDto paramDto) {
VUtils.isTure(CollUtil.isEmpty(paramDto.getVirtualPackageValue())).throwMessage("请选择要生成的虚拟包");
@ -141,7 +141,7 @@ public class EbomApi extends BaseApi {
@PostMapping("convertToPBom")
@ApiOperation("转PBom")
@LogRecord(success = "转PBom物料编码{{#bom.materialNo}} 版本:{{#bom.currentVersion}},操作结果:{{#_ret}}",
bizNo = "{{#paramDto.bomRowIds.toString()}}" ,type = "转PBom")
bizNo = "{{#paramDto.bomRowIds.toString()}}", type = "转PBom")
public ResultVO<Boolean> convertToPBom(@RequestBody EBomToPBomParamDTO paramDto) throws ExecutionException, InterruptedException {
VUtils.isTure(CollUtil.isEmpty(paramDto.getBomRowIds())).throwMessage("请选择要转换的物料");
VUtils.isTure(CollUtil.isEmpty(paramDto.getFacCodes())).throwMessage("请选择要转换的工厂");
@ -157,7 +157,7 @@ public class EbomApi extends BaseApi {
@PostMapping("upgradeChanges")
@ApiOperation("发起变更")
@LogRecord(success = "发起变更:物料编码:{{#bom.materialNo}} 版本:{{#bom.currentVersion}},操作结果:{{#_ret}}",
bizNo = "{{#param.bomRowIds.toString()}}" ,type = "发起变更")
bizNo = "{{#param.bomRowIds.toString()}}", type = "发起变更")
public ResultVO<Boolean> upgradeChanges(@RequestBody EBomUpgradeChangesParamDTO param) {
VUtils.isTure(CollUtil.isEmpty(param.getBomRowIds())).throwMessage("请选择要发起变更的物料");
bomNewEbomParentService.upgradeChanges(param);
@ -169,7 +169,7 @@ public class EbomApi extends BaseApi {
@PostMapping("exportBom")
@ApiOperation("工作明细导出")
@LogRecord(success = "Ebom-工作明细导出,操作结果:{{#_ret}}", bizNo = "",
extra = "{{#bomRowIds.toString()}}" ,type = "Ebom-工作明细导出")
extra = "{{#bomRowIds.toString()}}", type = "Ebom-工作明细导出")
public void exportBom(@RequestBody List<Long> bomRowIds, HttpServletResponse response) throws IOException {
VUtils.isTure(CollUtil.isEmpty(bomRowIds)).throwMessage("请选择要导出的物料行");
bomNewEbomParentService.exportBom(bomRowIds, response);
@ -178,14 +178,13 @@ public class EbomApi extends BaseApi {
@PostMapping("editExportBom")
@ApiOperation("编辑导出")
@LogRecord(success = "Ebom-编辑导出,操作结果:{{#_ret}}", bizNo = "",
extra = "{{#list.toString()}}" ,type = "Ebom-编辑导出")
extra = "{{#list.toString()}}", type = "Ebom-编辑导出")
public void editExportBom(@RequestBody List<BomNewEbomParentVO> list, HttpServletResponse response) throws IOException {
VUtils.isTure(CollectionUtil.isEmpty(list)).throwMessage("请选择要导出的物料行");
bomNewEbomParentService.editExportBom(list, response);
}
@GetMapping("createBomDownExcelTmp")
@ApiOperation("创建EBOM-导入时模版下载")
public void createBomDownExcelTmp(HttpServletResponse response) throws IOException {
@ -193,7 +192,7 @@ public class EbomApi extends BaseApi {
new Workbook("eBom-create-template", "").addSheet(new ListSheet<>("sheet1", ImmutableList.of(new BomNewEBomImportExcelDTO()))).writeTo(response.getOutputStream());
}
// @PostMapping("createBomImport")
// @PostMapping("createBomImport")
// @ApiOperation("创建EBOM-导入")
// public ResultVO<List<BomNewEBomImportExcelDTO>> createBomImport(@ModelAttribute BomNewEbomImportDTO dto) throws IOException {
// if (dto.getFile() != null && !dto.getFile().getOriginalFilename().endsWith("xls") && !dto.getFile().getOriginalFilename().endsWith("xlsx")) {
@ -209,7 +208,7 @@ public class EbomApi extends BaseApi {
@ApiOperation("创建EBOM-导入")
public ResultVO<Boolean> createBomImport(
@RequestParam(value = "opType") Integer opType, @RequestParam(value = "rowId") Long rowId, @RequestParam(value = "file") MultipartFile file
) throws IOException, ExecutionException, InterruptedException {
) throws IOException, ExecutionException, InterruptedException {
if (Objects.isNull(rowId)) {
@ -223,14 +222,14 @@ public class EbomApi extends BaseApi {
if (file != null && !file.getOriginalFilename().endsWith("xls") && !file.getOriginalFilename().endsWith("xlsx")) {
return ResultVO.error("请上传Excel文件");
}
BomNewEbomImportDTO dto=new BomNewEbomImportDTO();
BomNewEbomImportDTO dto = new BomNewEbomImportDTO();
dto.setOpType(opType);
dto.setRowId(rowId);
if( !(dto.isDel() || dto.isAppend() )){
if (!(dto.isDel() || dto.isAppend())) {
return ResultVO.error("清除原数据或追加行数据错误");
}
return bomNewEbomParentService.createBomImport(dto,file.getInputStream());
return bomNewEbomParentService.createBomImport(dto, file.getInputStream());
}
@ -250,7 +249,7 @@ public class EbomApi extends BaseApi {
@PostMapping("revertDesign")
@ApiOperation("退回到设计")
@LogRecord(success = "Ebom-退回到设计:{{#log}},操作结果:{{#_ret}}", bizNo = "",
extra = "{{#dto.rowIdList.toString()}}" ,type = "Ebom-退回到设计")
extra = "{{#dto.rowIdList.toString()}}", type = "Ebom-退回到设计")
public ResultVO<Boolean> revertDesign(@RequestBody BomNewEBomRevertDTO dto) throws ExecutionException, InterruptedException {
if (CollectionUtil.isEmpty(dto.getRowIdList())) {
return ResultVO.error(STATE.ParamErr, "请选择要退回的数据");
@ -266,35 +265,35 @@ public class EbomApi extends BaseApi {
@PostMapping("reviewDesign")
@ApiOperation("设计复核")
@LogRecord(success = "Ebom-设计复核:{{#log}},操作结果:{{#_ret}}", bizNo = "",
extra = "{{#dto.rowIdList.toString()}}" ,type = "Ebom-设计复核")
extra = "{{#dto.rowIdList.toString()}}", type = "Ebom-设计复核")
public ResultVO<Boolean> reviewDesign(@RequestBody BomNewEBomRevertDTO dto) throws ExecutionException, InterruptedException {
if (CollectionUtil.isEmpty(dto.getRowIdList())) {
return ResultVO.error(STATE.ParamErr, "请选择要复核的数据");
}
dto.setRevertUserName(SessionUtil.getUserName());
dto.setUserCode(SessionUtil.getUserCode());
bomNewEbomParentService.designReview(dto);
bomNewEbomParentService.designReview(dto);
return ResultVO.success(true);
return ResultVO.success(true);
}
@GetMapping("editDetail")
@ApiOperation("编辑物料列表")
public ResultVO<BomNewEbomEditDetailVO> editDetail(@RequestParam("rowId") Long rowId,@RequestParam("bomRowId") Long bomRowId,@RequestParam("projectType") String projectType) {
if(Objects.isNull(rowId)){
VUtils.isTure(true ).throwMessage("rowId 不能为空");
public ResultVO<BomNewEbomEditDetailVO> editDetail(@RequestParam("rowId") Long rowId, @RequestParam("bomRowId") Long bomRowId, @RequestParam("projectType") String projectType) {
if (Objects.isNull(rowId)) {
VUtils.isTure(true).throwMessage("rowId 不能为空");
}
if(Objects.isNull(bomRowId)){
VUtils.isTure(true ).throwMessage("bomRowId不能为空");
if (Objects.isNull(bomRowId)) {
VUtils.isTure(true).throwMessage("bomRowId不能为空");
}
return ResultVO.success(bomNewEbomParentService.editDetail(rowId,bomRowId,projectType));
return ResultVO.success(bomNewEbomParentService.editDetail(rowId, bomRowId, projectType));
}
@PostMapping("updateProjectType")
@ApiOperation("更新项目类型")
@LogRecord(success = "Ebom-更新项目类型,操作结果:{{#_ret}}", bizNo = "",type = "Ebom-更新项目类型")
@LogRecord(success = "Ebom-更新项目类型,操作结果:{{#_ret}}", bizNo = "", type = "Ebom-更新项目类型")
public ResultVO<Boolean> updateProjectType(@RequestBody BomNewEbomProjectTypeDTO dto) {
VUtils.isTure(StrUtil.isEmpty(dto.getProjectType())).throwMessage("项目类型不能为空");
@ -302,11 +301,10 @@ public class EbomApi extends BaseApi {
VUtils.isTure(CollUtil.isEmpty(dto.getRowIdList())).throwMessage("选择要修改的数据");
bomNewEbomParentService.updateProjectType(dto);
return ResultVO.success(true);
return ResultVO.success(true);
}
@PostMapping("queryMaterial")
@ApiOperation("查询物料信息")
public ResultVO<BomNewEbomParentVO> queryMaterial(@RequestBody BomNewEbomMaterialQuery query) {
@ -320,9 +318,9 @@ public class EbomApi extends BaseApi {
@PostMapping("changeMaterial")
@ApiOperation("更新物料行")
@LogRecord(success = "Ebom-更新物料行,物料编码:{{#dto.parent.materialNo}}-版本:{{dto.parent.currentVersion}},操作结果:{{#_ret}}", bizNo = "",type = "Ebom-更新物料行")
@LogRecord(success = "Ebom-更新物料行,物料编码:{{#dto.parent.materialNo}}-版本:{{dto.parent.currentVersion}},操作结果:{{#_ret}}", bizNo = "", type = "Ebom-更新物料行")
public ResultVO<List<BomNewEbomParentVO>> changeMaterial(@RequestBody BomNewEBomChangeDTO dto) {
if ( dto.getParent() ==null || CollectionUtil.isEmpty(dto.getDatas()) ) {
if (dto.getParent() == null || CollectionUtil.isEmpty(dto.getDatas())) {
return ResultVO.error(STATE.Error, "选择更新的数据");
}
@ -331,24 +329,20 @@ public class EbomApi extends BaseApi {
}
@GetMapping("delete")
@ApiOperation("删除物料")
@LogRecord(success = "Ebom-删除物料,物料编码:{{#bom.materialNo}}-版本:{{#bom.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#bomRowId}}",type = "Ebom-删除物料")
public ResultVO<Boolean> deleteBom(@RequestParam("bomRowId") Long bomRowId ) throws ExecutionException, InterruptedException{
@LogRecord(success = "Ebom-删除物料,物料编码:{{#bom.materialNo}}-版本:{{#bom.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#bomRowId}}", type = "Ebom-删除物料")
public ResultVO<Boolean> deleteBom(@RequestParam("bomRowId") Long bomRowId) throws ExecutionException, InterruptedException {
return ResultVO.success(bomNewEbomParentService.deleteBom(bomRowId));
}
//temporary
@PostMapping("temporary")
@ApiOperation("暂存")
@LogRecord(success = "Ebom-暂存,物料编码:{{#dto.parent.materialNo}}-版本:{{#dto.parent.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#dto.parent.rowId}}",type = "Ebom-暂存")
@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 {
@ -358,41 +352,41 @@ public class EbomApi extends BaseApi {
@PostMapping("temporaryAdd")
@ApiOperation("暂存添加")
@LogRecord(success = "Ebom-暂存添加,物料编码:{{#dto.parent.materialNo}}-版本:{{#dto.parent.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#dto.parent.rowId}}",type = "Ebom-暂存添加")
@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 {
bomNewEbomParentService.deleteBomChild(dto.getDelDatas());
return ResultVO.success(bomNewEbomParentService.temporary(dto));
}
@PostMapping("submitAdd")
@ApiOperation("提交添加")
@LogRecord(success = "Ebom-提交添加,物料编码:{{#dto.parent.materialNo}}-版本:{{#dto.parent.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#dto.parent.rowId}}",type = "Ebom-提交添加")
@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 {
bomNewEbomParentService.deleteBomChild(dto.getDelDatas());
return ResultVO.success(bomNewEbomParentService.submit(dto));
}
@PostMapping("submit")
@ApiOperation("提交")
@LogRecord(success = "Ebom-提交,物料编码:{{#dto.parent.materialNo}}-版本:{{#dto.parent.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#dto.parent.rowId}}",type = "Ebom-提交")
@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 {
bomNewEbomParentService.deleteBomChild(dto.getDelDatas());
return ResultVO.success(bomNewEbomParentService.submit(dto));
}
@PostMapping("intiException")
@ApiOperation("初始化错误类型")
@LogRecord(success = "Ebom-初始化错误类型,操作结果:{{#_ret}}", bizNo = "{{#bomRowIds.toString()}}",type = "Ebom-初始化错误类型")
@LogRecord(success = "Ebom-初始化错误类型,操作结果:{{#_ret}}", bizNo = "{{#bomRowIds.toString()}}", type = "Ebom-初始化错误类型")
public ResultVO<Boolean> intiException(@RequestBody List<Long> bomRowIds) throws ExecutionException, InterruptedException {
bomNewEbomParentService.batchCheckAndSaveEBomException(bomRowIds );
bomNewEbomParentService.batchCheckAndSaveEBomException(bomRowIds);
return ResultVO.success(true);
}
// @GetMapping("getrel")
// @ApiOperation("模糊匹配物料")
// public ResultVO<MaterialMateVO> getRelMaterial(@RequestParam(value = "materialName", required = false) String materialName ,@RequestParam(value = "materialTexture" ,required = false) String materialTexture ){
@ -403,7 +397,7 @@ public class EbomApi extends BaseApi {
@LogRecord(success = "luo下了一个订单,购买商品「{{#bom.currentVersion}}}」,测试变量「dsfsdf」,下单结果:{{#_ret}}",
bizNo = "sfsfsa" ,type = "dsfdsf")
bizNo = "sfsfsa", type = "dsfdsf")
@PostMapping("log")
@ApiOperation("测试日志")
public boolean createOrder() {
@ -412,10 +406,21 @@ public class EbomApi extends BaseApi {
}
@GetMapping("loginDebug")
@ApiOperation("模拟登录")
public ResultVO<Boolean> loginDebug() {
LoginUserInfoDTO dto = new LoginUserInfoDTO();
dto.setUserCode("QHI17062100");
dto.setUserName("郑军榕");
dto.setRealName("郑军榕");
dto.setDepartName("信息流程中心/IT支持");
dto.setFullDeptName("信息流程中心/IT支持");
dto.setRowId(1585164668335439881l);
SessionUtil.loginUser.set(dto);
return ResultVO.success();
}
}

View File

@ -1675,14 +1675,15 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
* 用户可以直接删除用户单击暂存或是提交时才会保存至数据库
*/
public void deleteBomChild(List<BomNewEbomParentVO> delList) {
if(CollUtil.isEmpty(delList)){
return;
}
List<Long> rowIds=delList.stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
QueryWrapper<BomNewEbomChildEntity> queryChildWrapper=new QueryWrapper<>();
queryChildWrapper.lambda().in(BomNewEbomChildEntity::getRowId,delList.stream().map(BomNewEbomParentVO::getRowId));
queryChildWrapper.lambda().in(BomNewEbomChildEntity::getRowId,rowIds);
List<BomNewEbomChildEntity> delChildList=SpringUtil.getBean(BomNewEbomChildService.class).list(queryChildWrapper);
List<BomNewEbomChildEntity> delTagList = new ArrayList<>();
//检查原始bom里过来数据是否包含正常数据