From 91089caa40fb9292aa403c08de2451a8444c7a22 Mon Sep 17 00:00:00 2001 From: wangwei <1610949092@qq.com> Date: Wed, 8 Feb 2023 23:18:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thrsys/ThrProductsController.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/thrsys/ThrProductsController.java b/src/main/java/com/glxp/api/controller/thrsys/ThrProductsController.java index 6cbfe9614..815a4478c 100644 --- a/src/main/java/com/glxp/api/controller/thrsys/ThrProductsController.java +++ b/src/main/java/com/glxp/api/controller/thrsys/ThrProductsController.java @@ -166,18 +166,23 @@ public class ThrProductsController { */ @AuthRuleAnnotation("") @PostMapping("/udiwms/udiinfo/erp/products/saveProduct") - public BaseResponse saveProduct(@RequestBody ThrProductsEntity thrProductsEntity) { + public BaseResponse saveProduct(@RequestBody ThrProductsEntity thrProductsEntity,FilterThrProductsRequest filterThrProductsRequest) { if (null == thrProductsEntity) return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); - - thrProductsEntity.setUpdateUser(String.valueOf(customerService.getUserId())); - thrProductsEntity.setCreateUser(String.valueOf(customerService.getUserId())); - thrProductsEntity.setUpdateTime(new Date()); - thrProductsEntity.setCreateTime(new Date()); - thrProductsService.insertThrProducts(thrProductsEntity); + BeanUtils.copyProperties(thrProductsEntity,filterThrProductsRequest); + List thrProductsEntities = thrProductsService.filterThrProducts(filterThrProductsRequest); + if(thrProductsEntities.size()==0){ + thrProductsEntity.setUpdateUser(String.valueOf(customerService.getUserId())); + thrProductsEntity.setCreateUser(String.valueOf(customerService.getUserId())); + thrProductsEntity.setUpdateTime(new Date()); + thrProductsEntity.setCreateTime(new Date()); + thrProductsService.insertThrProducts(thrProductsEntity); + return ResultVOUtils.success(); + } + return ResultVOUtils.error(999,"数据已存在!"); // //新增主系统产品信息直接加到耗材字典里 @@ -186,7 +191,7 @@ public class ThrProductsController { // if (!udiContrastService.isExit(null, thrProductsEntity.getCode(), null)) { // udiContrastService.createOnlyMainId(thrProductsEntity.getCode()); // } - return ResultVOUtils.success(); + } } \ No newline at end of file