From 73382dd3052c078b1393272ff7e11eda86831d6a Mon Sep 17 00:00:00 2001 From: luoliming Date: Sat, 2 Mar 2024 20:44:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nflg/product/bomnew/api/user/EbomApi.java | 18 +++++++++++++++--- .../nflg/product/bomnew/api/user/PBomApi.java | 18 ++++++++++++++++++ .../service/BomNewEbomParentService.java | 15 +++++++++++++-- .../service/BomNewPbomParentService.java | 7 +++++-- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java index e2fc9a85..5b087537 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java @@ -168,6 +168,8 @@ public class EbomApi extends BaseApi { @PostMapping("exportBom") @ApiOperation("工作明细导出") + @LogRecord(success = "Ebom-工作明细导出,操作结果:{{#_ret}}", bizNo = "", + extra = "{{#bomRowIds.toString()}}" ,type = "Ebom-工作明细导出") public void exportBom(@RequestBody List bomRowIds, HttpServletResponse response) throws IOException { VUtils.isTure(CollUtil.isEmpty(bomRowIds)).throwMessage("请选择要导出的物料行"); bomNewEbomParentService.exportBom(bomRowIds, response); @@ -175,6 +177,8 @@ public class EbomApi extends BaseApi { @PostMapping("editExportBom") @ApiOperation("编辑导出") + @LogRecord(success = "Ebom-编辑导出,操作结果:{{#_ret}}", bizNo = "", + extra = "{{#list.toString()}}" ,type = "Ebom-编辑导出") public void editExportBom(@RequestBody List list, HttpServletResponse response) throws IOException { VUtils.isTure(CollectionUtil.isEmpty(list)).throwMessage("请选择要导出的物料行"); bomNewEbomParentService.editExportBom(list, response); @@ -245,6 +249,8 @@ public class EbomApi extends BaseApi { @PostMapping("revertDesign") @ApiOperation("退回到设计") + @LogRecord(success = "Ebom-退回到设计:{{#log}},操作结果:{{#_ret}}", bizNo = "", + extra = "{{#dto.rowIdList.toString()}}" ,type = "Ebom-退回到设计") public ResultVO revertDesign(@RequestBody BomNewEBomRevertDTO dto) throws ExecutionException, InterruptedException { if (CollectionUtil.isEmpty(dto.getRowIdList())) { return ResultVO.error(STATE.ParamErr, "请选择要退回的数据"); @@ -259,6 +265,8 @@ public class EbomApi extends BaseApi { @PostMapping("reviewDesign") @ApiOperation("设计复核") + @LogRecord(success = "Ebom-设计复核:{{#log}},操作结果:{{#_ret}}", bizNo = "", + extra = "{{#dto.rowIdList.toString()}}" ,type = "Ebom-设计复核") public ResultVO reviewDesign(@RequestBody BomNewEBomRevertDTO dto) throws ExecutionException, InterruptedException { if (CollectionUtil.isEmpty(dto.getRowIdList())) { return ResultVO.error(STATE.ParamErr, "请选择要复核的数据"); @@ -286,6 +294,7 @@ public class EbomApi extends BaseApi { @PostMapping("updateProjectType") @ApiOperation("更新项目类型") + @LogRecord(success = "Ebom-更新项目类型,操作结果:{{#_ret}}", bizNo = "",type = "Ebom-更新项目类型") public ResultVO updateProjectType(@RequestBody BomNewEbomProjectTypeDTO dto) { VUtils.isTure(StrUtil.isEmpty(dto.getProjectType())).throwMessage("项目类型不能为空"); @@ -311,6 +320,7 @@ public class EbomApi extends BaseApi { @PostMapping("changeMaterial") @ApiOperation("更新物料行") + @LogRecord(success = "Ebom-更新物料行,物料编码:{{#dto.parent.materialNo}}-版本:{{dto.parent.currentVersion}},操作结果:{{#_ret}}", bizNo = "",type = "Ebom-更新物料行") public ResultVO> changeMaterial(@RequestBody BomNewEBomChangeDTO dto) { if ( dto.getParent() ==null || CollectionUtil.isEmpty(dto.getDatas()) ) { return ResultVO.error(STATE.Error, "选择更新的数据"); @@ -326,6 +336,7 @@ public class EbomApi extends BaseApi { @GetMapping("delete") @ApiOperation("删除物料") + @LogRecord(success = "Ebom-删除物料,物料编码:{{#bom.materialNo}}-版本:{{bom.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#bomRowId}}",type = "Ebom-删除物料") public ResultVO deleteBom(@RequestParam("bomRowId") Long bomRowId ) throws ExecutionException, InterruptedException{ bomNewEbomParentService.deleteBom(bomRowId); @@ -347,6 +358,7 @@ public class EbomApi extends BaseApi { @PostMapping("submit") @ApiOperation("提交") + @LogRecord(success = "Ebom-提交,物料编码:{{#dto.parent.materialNo}}-版本:{{dto.parent.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#dto.parent.rowId}}",type = "Ebom-提交") public ResultVO submit(@RequestBody BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException { return ResultVO.success(bomNewEbomParentService.submit(dto)); } @@ -354,6 +366,7 @@ public class EbomApi extends BaseApi { @PostMapping("intiException") @ApiOperation("初始化错误类型") + @LogRecord(success = "Ebom-初始化错误类型,操作结果:{{#_ret}}", bizNo = "{{#bomRowIds.toString()}}",type = "Ebom-提交") public ResultVO intiException(@RequestBody List bomRowIds) throws ExecutionException, InterruptedException { bomNewEbomParentService.batchCheckAndSaveEBomException(bomRowIds ); @@ -371,13 +384,12 @@ public class EbomApi extends BaseApi { // } - @LogRecord(success = "luo下了一个订单,购买商品「{{#name.toString()}}}」,测试变量「dsfsdf」,下单结果:{{#_ret}}", + @LogRecord(success = "luo下了一个订单,购买商品「{{#bom.currentVersion}}}」,测试变量「dsfsdf」,下单结果:{{#_ret}}", bizNo = "sfsfsa" ,type = "dsfdsf") @PostMapping("log") @ApiOperation("测试日志") public boolean createOrder() { - LogRecordContext.putVariable("name","罗里面"); - + bomNewEbomParentService.createOrder(); return true; } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java index 6eb139fe..518cb6c2 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java @@ -2,6 +2,8 @@ package com.nflg.product.bomnew.api.user; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.mzt.logapi.context.LogRecordContext; +import com.mzt.logapi.starter.annotation.LogRecord; import com.nflg.product.base.core.api.BaseApi; import com.nflg.product.bomnew.constant.EBomConstant; import com.nflg.product.bomnew.constant.PBomEditStatusEnum; @@ -31,6 +33,7 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.concurrent.ExecutionException; /** @@ -78,12 +81,14 @@ public class PBomApi extends BaseApi { @PostMapping("exportWorkDetailsListByPage") @ApiOperation("导出工作列表--导出") + @LogRecord(success = "PBom-导出工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-导出工作列表") public void exportWorkDownLoad(@RequestBody BomNewPbomParentQuery query ,HttpServletResponse response) throws IOException { bomNewPbomParentService.workDetailsExcel(query,response); } @PostMapping("releaseListDownLoad") @ApiOperation("PBom已发布工作列表--导出") + @LogRecord(success = "PBom-导出已发布工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-已发布工作列表") public void releaseListDownLoad(@RequestBody BomNewPbomParentQuery query ,HttpServletResponse response) throws IOException { bomNewPbomParentService.releaseListExcel(query,response); } @@ -96,6 +101,7 @@ public class PBomApi extends BaseApi { @PostMapping("editStaging") @ApiOperation("编辑-暂存") + @LogRecord(success = "PBom-编辑-暂存,物料编码:{{#bom.materialNo}}-版本:{{#bom.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#param.bomRowId}}",type = "PBom-编辑-暂存") public ResultVO editStaging(@Valid @RequestBody EditPBomParamDTO param){ bomNewPbomParentService.editSave(param,PBomEditStatusEnum.HANDLER_TEMP); return ResultVO.success(true); @@ -103,6 +109,7 @@ public class PBomApi extends BaseApi { @PostMapping("editSubmit") @ApiOperation("编辑-提交") + @LogRecord(success = "PBom-编辑-提交,物料编码:{{#bom.materialNo}}-版本:{{#bom.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#param.bomRowId}}",type = "PBom-编辑-提交") public ResultVO editSubmit(@Valid @RequestBody EditPBomParamDTO param){ //检查物料编码是否存在 bomNewPbomParentService.checkMaterialNo(param.getChildList()); @@ -115,6 +122,7 @@ public class PBomApi extends BaseApi { @PostMapping("editDel") @ApiOperation("编辑-删除") + @LogRecord(success = "PBom-编辑-删除,物料编码:{{#bom.materialNo}}-版本:{{#bom.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#param.bomRowId}}",type = "PBom-编辑-删除") public ResultVO editDel(@Valid @RequestBody EditPBomDelDTO param){ VUtils.isTure(CollUtil.isEmpty(param.getRowIdList())).throwMessage("请选择要删除的数据行"); bomNewPbomParentService.editDel(param); @@ -123,6 +131,7 @@ public class PBomApi extends BaseApi { @PostMapping("setVirtualPart") @ApiOperation("编辑-设置虚拟件") + @LogRecord(success = "PBom-编辑-设置虚拟件,操作结果:{{#_ret}}", bizNo = "{{#rowIdList.toString()}}",type = "PBom-编辑-设置虚拟件") public ResultVO setVirtualPart(@RequestBody List rowIdList){ VUtils.isTure(CollUtil.isEmpty(rowIdList)).throwMessage("请选择要设置虚拟件的行"); @@ -160,6 +169,7 @@ public class PBomApi extends BaseApi { @PostMapping("createTechnologyPackage") @ApiOperation("编辑-创建虚拟包") + @LogRecord(success = "PBom-编辑-创建虚拟包,物料编码:{{#packageParam.materialName}},图号:{{#packageParam.drawingNo}},操作结果:{{#_ret}}", bizNo = "{{#packageParam.bomRowId}}",type = "PBom-编辑-创建虚拟包") public ResultVO createTechnologyPackage(@Valid @RequestBody TechnologyPackageParam packageParam) throws IOException { return ResultVO.success( bomNewPbomParentService.createTechnologyPackage(packageParam)); @@ -195,6 +205,7 @@ public class PBomApi extends BaseApi { @PostMapping("saveAllocationFactory") @ApiOperation("分工厂-保存") + @LogRecord(success = "PBom-分工厂-保存。操作结果:{{#_ret}}", bizNo = "",type = "PBom-分工厂-保存") public ResultVO saveAllocationFactory(@Valid @RequestBody List params){ return ResultVO.success(bomNewPbomParentService.saveAllocationFactory(params)); @@ -202,15 +213,20 @@ public class PBomApi extends BaseApi { @PostMapping("allocationFactoryForRel") @ApiOperation("分工厂-规则匹配") + @LogRecord(success = "PBom-分工厂-规则匹配,物料编码:{{#bom.materialNo}}-版本:{{#bom.currentVersion}}-规则编码:{{#params.ruleGroupCode}} 操作结果:{{#_ret}}", bizNo = "{{#params.bomRowId}}",type = "PBom-分工厂-规则匹配") public ResultVO allocationFactoryForRel(@Valid @RequestBody AllocationFactoryForRelDTO params) throws ExecutionException, InterruptedException { + BomNewPbomParentEntity bom = bomNewPbomParentService.getBaseMapper().selectById(params.getBomRowId()); + LogRecordContext.putVariable("bom",bom); return ResultVO.success(bomNewPbomParentService.allocationFactoryForRel(params)); } @GetMapping("convertToMBom") @ApiOperation("转MBom") + @LogRecord(success = "PBom-转MBom,物料编码:{{#bom.materialNo}}-版本:{{#bom.currentVersion}} 操作结果:{{#_ret}}", bizNo = "{{#bomRowId}}",type = "PBom-转MBom") public ResultVO convertToMBom(@RequestParam("bomRowId") Long bomRowId) throws ExecutionException, InterruptedException { BomNewPbomParentEntity parent = bomNewPbomParentService.getById(bomRowId); + LogRecordContext.putVariable("bom",parent); VUtils.isTure(!parent.getMaterialNo().startsWith("31")).throwMessage("只有31开头的物料才可以发布"); VUtils.isTure(parent.getStatus()< PBomStatusEnum.PUBLISH.getValue()).throwMessage("只有已发布的BOM才能生成MBom"); // @@ -221,6 +237,7 @@ public class PBomApi extends BaseApi { @GetMapping("realesePbom") @ApiOperation("发布Pbom") + @LogRecord(success = "发布PBom,物料编码:{{#bom.materialNo}}-版本:{{#bom.currentVersion}} 操作结果:{{#_ret}}", bizNo = "{{#bomRowId}}",type = "发布PBom") public ResultVO realesePbom(@RequestParam("bomRowId") Long bomRowId) { return ResultVO.success(bomNewPbomParentService.realesePbom(bomRowId)); @@ -237,6 +254,7 @@ public class PBomApi extends BaseApi { @GetMapping("upgrade") @ApiOperation("发起变更") + @LogRecord(success = "PBom发起变更,物料编码:{{#bom.materialNo}}-版本:{{#bom.currentVersion}} 操作结果:{{#_ret}}", bizNo = "{{#bomRowId}}",type = "发起变更") public ResultVO upgrade(@RequestParam("bomRowId") Long bomRowId) { try { bomNewPbomParentService.upgrade(bomRowId); diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java index fc4ce2b8..3a7a53e7 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java @@ -1039,12 +1039,12 @@ public class BomNewEbomParentService extends ServiceImpl bomNewEbomParentEntityList = this.lambdaQuery().in(BomNewEbomParentEntity::getRowId, rowIds).eq(BomNewEbomParentEntity::getRootIs, 1).list(); - if (CollUtil.isEmpty(bomNewEbomParentEntityList)) { // throw new NflgBusinessException(STATE.BusinessError, "下级BOM无法进行退回"); VUtils.isTure(true).throwMessage("下级BOM无法进行退回"); } - + Set materialNoAndVersion = bomNewEbomParentEntityList.stream().map(u -> StrUtil.join("-", u.getMaterialNo(), u.getCurrentVersion())).collect(Collectors.toSet()); + LogRecordContext.putVariable("log",materialNoAndVersion); if (rowIds.size() != bomNewEbomParentEntityList.size()) { @@ -1150,6 +1150,8 @@ public class BomNewEbomParentService extends ServiceImpl materialNoAndVersion = bomNewEbomParentEntityList.stream().map(u -> StrUtil.join("-", u.getMaterialNo(), u.getCurrentVersion())).collect(Collectors.toSet()); + LogRecordContext.putVariable("log",materialNoAndVersion); if (rowIds.size() != bomNewEbomParentEntityList.size()) { VUtils.isTure(true).throwMessage("数据中包含有下级BOM无法进行复核"); @@ -1391,6 +1393,7 @@ public class BomNewEbomParentService extends ServiceImpl childList = Convert.toList(BomNewPbomChildEntity.class, paramDTO.getChildList()); childList.forEach(u -> { u.setParentRowId(paramDTO.getBomRowId()); @@ -354,7 +355,7 @@ public class BomNewPbomParentService extends ServiceImpl childList = pbomChildService.getBaseMapper().selectBatchIds(paramDTO.getRowIdList()); @@ -853,6 +854,7 @@ public class BomNewPbomParentService extends ServiceImpl allBom = getAllBom(bomRowId, 0); @@ -919,6 +921,7 @@ public class BomNewPbomParentService extends ServiceImpl