From c33e83a6bf7e96de6a511c6de5ab58f921d71f21 Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Mon, 4 Nov 2024 10:32:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=A2=9E=E5=8A=A0=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=9A=84=E5=90=8D=E7=A7=B0=E5=92=8C=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E7=9A=84=E9=87=8D=E5=A4=8D=E5=88=A4=E6=96=AD=202.?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=93=E5=BA=93=E5=90=8D=E7=A7=B0=E5=92=8C?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E7=9A=84=E9=87=8D=E5=A4=8D=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BasicMaterialController.java | 39 ++++++++++++++++--- .../BasicdataWarehouseController.java | 22 +++++++++++ .../impl/DistributionSignforServiceImpl.java | 9 ++--- 3 files changed, 58 insertions(+), 12 deletions(-) diff --git a/blade-service/logpm-basic/src/main/java/com/logpm/basic/controller/BasicMaterialController.java b/blade-service/logpm-basic/src/main/java/com/logpm/basic/controller/BasicMaterialController.java index c9318e0c7..180b2ea07 100644 --- a/blade-service/logpm-basic/src/main/java/com/logpm/basic/controller/BasicMaterialController.java +++ b/blade-service/logpm-basic/src/main/java/com/logpm/basic/controller/BasicMaterialController.java @@ -31,6 +31,7 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; +import org.springblade.common.exception.CustomerException; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.excel.util.ExcelUtil; import org.springblade.core.mp.support.Condition; @@ -50,6 +51,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 物料基础信息 控制器 @@ -147,10 +149,30 @@ public class BasicMaterialController extends BladeController { return R.fail("添加失败,物料信息为空!"); } + checkBasicMaterialEntity(basicMaterial); + return R.status(basicMaterialService.save(basicMaterial)); } + private void checkBasicMaterialEntity(BasicMaterialEntity basicMaterial) { + + // 判断输入的物料编码是否重复 + List list = basicMaterialService.list(); + + List collect2 = list.stream().filter(item -> item.getName().equals(basicMaterial.getName())).collect(Collectors.toList()); + if(!collect2.isEmpty()){ + throw new CustomerException("物料名称重复,请重新输入"); + } + + List collect = list.stream().filter(item -> item.getProductCode().equals(basicMaterial.getProductCode())).collect(Collectors.toList()); + if(!collect.isEmpty()){ + throw new CustomerException("物料编码重复,请重新输入"); + } + + + } + /** * 物料基础信息 修改 */ @@ -191,12 +213,17 @@ public class BasicMaterialController extends BladeController { @ApiOperation(value = "逻辑删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { //改为修改隐藏状态 - boolean update = basicMaterialService.update(new UpdateWrapper().lambda() - .in(BasicMaterialEntity::getId, Func.toLongList(ids)) - .set(BasicMaterialEntity::getHide, 2) - ); -// basicMaterialService.deleteLogic(Func.toLongList(ids)); - return R.status(update); +// boolean update = basicMaterialService.update(new UpdateWrapper().lambda() +// .in(BasicMaterialEntity::getId, Func.toLongList(ids)) +// .set(BasicMaterialEntity::getHide, 2) +// ); + try { + basicMaterialService.deleteLogic(Func.toLongList(ids)); + } catch (Exception e) { + log.error("删除物料失败", e); + throw new CustomerException("服务器异常,请刷新重试"); + } + return R.status(true); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java index 6d8de23e5..c5760ad5a 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java @@ -36,6 +36,7 @@ import lombok.extern.log4j.Log4j2; import org.springblade.common.cache.CacheNames; import org.springblade.common.cache.CacheObjNames; import org.springblade.common.constant.common.IsOrNoConstant; +import org.springblade.common.exception.CustomerException; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.cache.utils.CacheUtil; import org.springblade.core.excel.util.ExcelUtil; @@ -199,6 +200,10 @@ public class BasicdataWarehouseController extends BladeController { @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入warehouseWarehouse") public R save(@Valid @RequestBody BasicdataWarehouseEntity warehouseWarehouse) { + + // 验证提交信息内容 + checkWarehouseInformation(warehouseWarehouse); + BladeUser user = AuthUtil.getUser(); CacheUtil.evict(CacheObjNames.basic_data_warehourse_list.getCacheName(), CacheObjNames.basic_data_warehourse_list.getKeyPrefix(),user.getUserId()); warehouseWarehouse.setEnableStatus("2"); @@ -216,6 +221,23 @@ public class BasicdataWarehouseController extends BladeController { return R.status(flag); } + private void checkWarehouseInformation(BasicdataWarehouseEntity warehouseWarehouse) { + + // 查询现在数据库已经存在的仓库信息 + List warehouseList = warehouseService.list(); + + List names = warehouseList.stream().filter(warehouseEntity -> warehouseEntity.getName().equals(warehouseWarehouse.getName())).collect(Collectors.toList()); + List codes = warehouseList.stream().filter(warehouseEntity -> warehouseEntity.getCode().equals(warehouseWarehouse.getCode())).collect(Collectors.toList()); + if(!names.isEmpty()){ + throw new CustomerException("仓库名称重复,请重新输入"); + } + + if(!codes.isEmpty()){ + throw new CustomerException("仓库编号重复,请重新输入"); + } + + } + /** * 仓库 修改 */ diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java index 469a38665..3265f8423 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java @@ -5440,10 +5440,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl jsonObjects = new ArrayList<>(); + List jsonObjects = new ArrayList<>(); if (SignforStatusConstant.yiqianshou.getValue().equals(distributionSignfor.getSigningStatus())) { return Resp.scanFail("当前客户已完成复核", "当前客户已完成复核"); } @@ -5982,8 +5979,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl