From 0a025cf733fe2ef0498eb5745e4211c2227091fa Mon Sep 17 00:00:00 2001 From: anthonywj Date: Mon, 16 Jan 2023 17:24:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=97=E6=9D=90=E5=AD=97=E5=85=B8=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/UdiRelevanceController.java | 39 ++++++++++++++++--- .../java/com/glxp/api/http/NmpaUdiClient.java | 14 +++---- .../api/service/basic/UdiContrastService.java | 1 - .../mybatis/mapper/basic/UdiProductDao.xml | 2 +- 4 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/basic/UdiRelevanceController.java b/src/main/java/com/glxp/api/controller/basic/UdiRelevanceController.java index 14e488ac..79ecfc17 100644 --- a/src/main/java/com/glxp/api/controller/basic/UdiRelevanceController.java +++ b/src/main/java/com/glxp/api/controller/basic/UdiRelevanceController.java @@ -283,6 +283,8 @@ public class UdiRelevanceController { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } + + //更新关联表 UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity(); BeanUtils.copyProperties(udiRelevanceSaveRequest, udiRelevanceEntity); udiRelevanceEntity.setId(udiRelevanceSaveRequest.getId()); @@ -290,8 +292,9 @@ public class UdiRelevanceController { udiRelevanceEntity.setModifyTime(new Date()); udiRelevanceEntity.setUpdateUser(customerService.getUserId() + ""); udiRelevanceService.updateUdiRelevance(udiRelevanceEntity); + + //关联更新 UdiProductEntity udiProductEntity = new UdiProductEntity(); - udiProductEntity.setSptm(udiRelevanceSaveRequest.getSptm()); udiProductEntity.setYbbm(udiRelevanceSaveRequest.getYbbm()); udiProductEntity.setMeasname(udiRelevanceSaveRequest.getMeasname()); udiProductEntity.setManufactory(udiRelevanceSaveRequest.getManufactory()); @@ -313,13 +316,37 @@ public class UdiRelevanceController { udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_UDI); } udiProductEntity.setUuid(udiRelevanceSaveRequest.getUuid()); + udiProductService.updateUdiInfoByUuid(udiProductEntity); - //关联修改提交 - if (udiRelevanceSaveRequest.getRelSubmit() != null && udiRelevanceSaveRequest.getRelSubmit()) { - udiProductService.updateUdiInfoByUuid(udiProductEntity); - } else { - udiProductService.updateUdiInfo(udiProductEntity); + return ResultVOUtils.success("更新成功"); + } + + + @AuthRuleAnnotation("") + @PostMapping("/udi/udirel/update/di") + public BaseResponse updateSingel(@RequestBody UdiRelevanceSaveRequest udiRelevanceSaveRequest, BindingResult bindingResult) { + + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } + + //更新关联表 + UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity(); + udiRelevanceEntity.setId(udiRelevanceSaveRequest.getId()); + udiRelevanceEntity.setUpdateTime(new Date()); + udiRelevanceEntity.setModifyTime(new Date()); + udiRelevanceEntity.setUpdateUser(customerService.getUserId() + ""); + udiRelevanceService.updateUdiRelevance(udiRelevanceEntity); + + + //单独更新DI + UdiProductEntity diEntity = new UdiProductEntity(); +// diEntity.setMeasname(udiRelevanceSaveRequest.getMeasname()); + diEntity.setPackUnit(udiRelevanceSaveRequest.getPackUnit()); + diEntity.setSptm(udiRelevanceSaveRequest.getSptm()); + diEntity.setUuid(udiRelevanceSaveRequest.getUuid()); + diEntity.setNameCode(udiRelevanceSaveRequest.getNameCode()); + udiProductService.updateUdiInfo(diEntity); return ResultVOUtils.success("更新成功"); } diff --git a/src/main/java/com/glxp/api/http/NmpaUdiClient.java b/src/main/java/com/glxp/api/http/NmpaUdiClient.java index 9580b4eb..1cdd310d 100644 --- a/src/main/java/com/glxp/api/http/NmpaUdiClient.java +++ b/src/main/java/com/glxp/api/http/NmpaUdiClient.java @@ -51,13 +51,13 @@ public class NmpaUdiClient { public List getOrUpdateByUuid(String uuid) { List udiInfoEntities = getUdiByUuid(uuid); - if (CollUtil.isNotEmpty(udiInfoEntities)) { - UdiProductEntity udiProductEntity = udiProductService.findByNameCode(udiInfoEntities.get(0).getNameCode()); - if (udiProductEntity != null) { - List exitUdis = udiProductService.findByUuids(udiProductEntity.getUuid()); - return exitUdis; - } - } +// if (CollUtil.isNotEmpty(udiInfoEntities)) { +// UdiProductEntity udiProductEntity = udiProductService.findByNameCode(udiInfoEntities.get(0).getNameCode()); +// if (udiProductEntity != null) { +// List exitUdis = udiProductService.findByUuids(udiProductEntity.getUuid()); +// return exitUdis; +// } +// } return udiInfoEntities; } diff --git a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java index b87b140e..319e98b7 100644 --- a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java +++ b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java @@ -140,7 +140,6 @@ public class UdiContrastService { UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity(); udiRelevanceEntity.setThirdId(udiCombineRequest.getThirdId()); udiRelevanceEntity.setMainId(udiCombineRequest.getThirdId()); - String time = DateUtil.getDateTime(); udiRelevanceEntity.setUpdateTime(new Date()); udiRelevanceEntity.setModifyTime(new Date()); udiRelevanceEntity.setUuid(udiInfoEntities.get(0).getUuid()); diff --git a/src/main/resources/mybatis/mapper/basic/UdiProductDao.xml b/src/main/resources/mybatis/mapper/basic/UdiProductDao.xml index b982d6c0..03c19ec0 100644 --- a/src/main/resources/mybatis/mapper/basic/UdiProductDao.xml +++ b/src/main/resources/mybatis/mapper/basic/UdiProductDao.xml @@ -315,7 +315,7 @@ basicPrductRemak7=#{basicPrductRemak7}, basicPrductRemak8=#{basicPrductRemak8}, - WHERE nameCode = #{nameCode} + WHERE nameCode = #{nameCode} and uuid = #{uuid}