From fba883b0ae0b1d4b98b737ba62f2b8c6a133ad3d Mon Sep 17 00:00:00 2001 From: anthonywj Date: Wed, 13 Sep 2023 15:12:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E8=B5=84=E5=AD=97=E5=85=B8=E5=AF=B9?= =?UTF-8?q?=E7=85=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/UdiContrastController.java | 6 +- .../thrsys/ThrProductsAddDiController.java | 2 +- .../entity/inv/InvProductDetailEntity.java | 2 + .../api/req/basic/FilterUdiRelRequest.java | 1 + .../api/service/basic/UdiContrastService.java | 55 ++++++++++++++----- .../api/service/basic/UdiProductService.java | 3 + .../basic/impl/UdiProductServiceImpl.java | 8 +++ .../mybatis/mapper/basic/UdiRelevanceDao.xml | 13 +++-- 8 files changed, 69 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java b/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java index ffcb9a99..e144faa7 100644 --- a/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java +++ b/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java @@ -150,9 +150,9 @@ public class UdiContrastController { @Log(title = "耗材字典", businessType = BusinessType.UPDATE) public BaseResponse changeVersion(@RequestBody UdiCombineRequest udiCombineRequest) { UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(udiCombineRequest.getRelId()); - if (udiContrastService.isExit(udiCombineRequest.getKeys().get(0), udiRelevanceEntity.getMainId(), null)) { - return ResultVOUtils.error(500, "已存在相同的对照关系,无法切换版本"); - } +// if (udiContrastService.isExit(udiCombineRequest.getKeys().get(0), udiRelevanceEntity.getMainId(), null)) { +// return ResultVOUtils.error(500, "已存在相同的对照关系,无法切换版本"); +// } List udiInfoEntities = udiDlHttpClient.getUdiByUuid(udiCombineRequest.getKeys().get(0)); udiProductService.deleteByUuid(udiRelevanceEntity.getUuid()); diff --git a/src/main/java/com/glxp/api/controller/thrsys/ThrProductsAddDiController.java b/src/main/java/com/glxp/api/controller/thrsys/ThrProductsAddDiController.java index 5bbd6b15..d452dce8 100644 --- a/src/main/java/com/glxp/api/controller/thrsys/ThrProductsAddDiController.java +++ b/src/main/java/com/glxp/api/controller/thrsys/ThrProductsAddDiController.java @@ -139,7 +139,7 @@ public class ThrProductsAddDiController { } ThrProductsAddDiEntity thrProductsAddDiEntity = thrProductsAddDiService.selecByUuid(uuids.get(0)); if (thrProductsAddDiEntity != null) { - return ResultVOUtils.error(500, "重复提交!"); + return ResultVOUtils.error(500, "产品已存在,请勿重复提交!"); } thrProductsAddDiService.addThrAddDiProducts(addThrDiProductsRequest); return ResultVOUtils.success("提交成功!"); diff --git a/src/main/java/com/glxp/api/entity/inv/InvProductDetailEntity.java b/src/main/java/com/glxp/api/entity/inv/InvProductDetailEntity.java index 1dab0efb..3ae7b3ce 100644 --- a/src/main/java/com/glxp/api/entity/inv/InvProductDetailEntity.java +++ b/src/main/java/com/glxp/api/entity/inv/InvProductDetailEntity.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import java.math.BigDecimal; import java.util.Date; @Data @@ -122,4 +123,5 @@ public class InvProductDetailEntity { @TableField(value = "action") private String action; + } diff --git a/src/main/java/com/glxp/api/req/basic/FilterUdiRelRequest.java b/src/main/java/com/glxp/api/req/basic/FilterUdiRelRequest.java index 0dc9be4f..e7d01d02 100644 --- a/src/main/java/com/glxp/api/req/basic/FilterUdiRelRequest.java +++ b/src/main/java/com/glxp/api/req/basic/FilterUdiRelRequest.java @@ -78,4 +78,5 @@ public class FilterUdiRelRequest extends ListPageRequest { private String syqsfxyjxmj; private String mjfs; private String categoryName; + private String deviceRecordKey; } 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 bd3c73c1..8169420a 100644 --- a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java +++ b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java @@ -46,14 +46,22 @@ public class UdiContrastService { public boolean isExit(String originUuid, String mainId, String thirdSys) { - if (StrUtil.isNotEmpty(originUuid) && StrUtil.isNotEmpty(mainId) && StrUtil.isBlank(thirdSys)) { - List udiRelevanceEntities = findByUnion(originUuid, mainId); + + String deviceRecordKey = null; + if (StrUtil.isNotEmpty(originUuid)) { + UdiProductEntity udiProductEntity = udiProductService.findOneByOriginUuid(originUuid); + if (udiProductEntity != null) + deviceRecordKey = udiProductEntity.getDeviceRecordKey(); + } + + if (StrUtil.isNotEmpty(deviceRecordKey) && StrUtil.isNotEmpty(mainId) && StrUtil.isBlank(thirdSys)) { + List udiRelevanceEntities = findDrkByUnion(deviceRecordKey, mainId); if (CollUtil.isNotEmpty(udiRelevanceEntities)) { return true; } else return false; - } else if (StrUtil.isNotEmpty(originUuid) && StrUtil.isEmpty(mainId)) { - List udiRelevanceEntities = findByOriginUuid(originUuid); + } else if (StrUtil.isNotEmpty(deviceRecordKey) && StrUtil.isEmpty(mainId)) { + List udiRelevanceEntities = findByDeviceRecordKey(deviceRecordKey); if (CollUtil.isNotEmpty(udiRelevanceEntities)) { for (UdiRelevanceResponse udiRelevanceEntity : udiRelevanceEntities) { if (StrUtil.isEmpty(udiRelevanceEntity.getMainId()) && StrUtil.isNotEmpty(udiRelevanceEntity.getOriginUuid())) { @@ -72,8 +80,8 @@ public class UdiContrastService { } } return false; - } else if (StrUtil.isNotBlank(originUuid) && StrUtil.isNotBlank(mainId) && StrUtil.isNotBlank(thirdSys)) { - List udiRelevanceEntities = findByUnion2(originUuid, mainId, thirdSys); + } else if (StrUtil.isNotBlank(deviceRecordKey) && StrUtil.isNotBlank(mainId) && StrUtil.isNotBlank(thirdSys)) { + List udiRelevanceEntities = findByUnion2(deviceRecordKey, mainId, thirdSys); if (CollUtil.isNotEmpty(udiRelevanceEntities)) { return true; } else @@ -82,23 +90,36 @@ public class UdiContrastService { return false; } - private List findByUnion2(String originUuid, String mainId, String thirdSys) { + private List findByUnion2(String deviceRecordKey, String mainId, String thirdSys) { FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest(); filterUdiRelRequest.setMainId(mainId); - filterUdiRelRequest.setOriginUuid(originUuid); + filterUdiRelRequest.setDeviceRecordKey(deviceRecordKey); filterUdiRelRequest.setThirdSys(thirdSys); List udiRelevanceEntities = udiRelevanceDao.contrastJoinSelect(filterUdiRelRequest); return udiRelevanceEntities; } public List findByUnion(String originUuid, String mainId) { + UdiProductEntity udiProductEntity = udiProductService.findOneByOriginUuid(originUuid); + if (udiProductEntity == null) { + return null; + } FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest(); filterUdiRelRequest.setMainId(mainId); - filterUdiRelRequest.setOriginUuid(originUuid); + filterUdiRelRequest.setDeviceRecordKey(udiProductEntity.getDeviceRecordKey()); List udiRelevanceEntities = udiRelevanceDao.contrastJoinSelect(filterUdiRelRequest); return udiRelevanceEntities; } + public List findDrkByUnion(String deviceRecordKey, String mainId) { + FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest(); + filterUdiRelRequest.setMainId(mainId); + filterUdiRelRequest.setDeviceRecordKey(deviceRecordKey); + List udiRelevanceEntities = udiRelevanceDao.contrastJoinSelect(filterUdiRelRequest); + return udiRelevanceEntities; + } + + public List findByUuid(String uuid) { FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest(); filterUdiRelRequest.setUuid(uuid); @@ -122,6 +143,14 @@ public class UdiContrastService { return udiRelevanceEntities; } + public List findByDeviceRecordKey(String deviceRecordKey) { + FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest(); + filterUdiRelRequest.setDeviceRecordKey(deviceRecordKey); + List udiRelevanceEntities = udiRelevanceDao.contrastJoinSelect(filterUdiRelRequest); + return udiRelevanceEntities; + } + + public List findByMainId(String mainId) { FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest(); filterUdiRelRequest.setMainId(mainId); @@ -194,11 +223,11 @@ public class UdiContrastService { public Long createOnlyUuid(UdiCombineRequest udiCombineRequest, String key) { List udiInfoEntities = udiDlHttpClient.getOrUpdateByUuid(key); - if(udiInfoEntities==null || udiInfoEntities.size()==0){ + if (udiInfoEntities == null || udiInfoEntities.size() == 0) { //为了处理审核时的线上问题 - int a=9999; - return Long.valueOf(a); - }else{ + int a = 9999; + return Long.valueOf(a); + } else { UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity(); udiRelevanceEntity.setUpdateTime(new Date()); udiRelevanceEntity.setModifyTime(new Date()); diff --git a/src/main/java/com/glxp/api/service/basic/UdiProductService.java b/src/main/java/com/glxp/api/service/basic/UdiProductService.java index b6cd3edb..14ebbb5d 100644 --- a/src/main/java/com/glxp/api/service/basic/UdiProductService.java +++ b/src/main/java/com/glxp/api/service/basic/UdiProductService.java @@ -31,6 +31,9 @@ public interface UdiProductService { List findByOriginUuid(String originUuid); + + UdiProductEntity findOneByOriginUuid(String originUuid); + boolean insertUdiInfo(UdiProductEntity udiProductEntity); boolean insertUdiInfos(List udiInfoEntities); diff --git a/src/main/java/com/glxp/api/service/basic/impl/UdiProductServiceImpl.java b/src/main/java/com/glxp/api/service/basic/impl/UdiProductServiceImpl.java index 5e674487..27674075 100644 --- a/src/main/java/com/glxp/api/service/basic/impl/UdiProductServiceImpl.java +++ b/src/main/java/com/glxp/api/service/basic/impl/UdiProductServiceImpl.java @@ -101,6 +101,14 @@ public class UdiProductServiceImpl implements UdiProductService { return udiProductDao.findByOriginUuid(originUuid); } + @Override + public UdiProductEntity findOneByOriginUuid(String originUuid) { + List udiProductEntities = findByOriginUuid(originUuid); + if (CollUtil.isNotEmpty(udiProductEntities)) + return udiProductEntities.get(0); + return null; + } + @Override public boolean insertUdiInfo(UdiProductEntity udiProductEntity) { udiProductEntity.setUpdateTime(new Date()); diff --git a/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml b/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml index 8697deb2..edb1ca1f 100644 --- a/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml +++ b/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml @@ -131,11 +131,10 @@