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 5ae73999..6e01c3fd 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 @@ -566,10 +566,10 @@ public class UdiProductServiceImpl implements UdiProductService { for (UdiProductEntity udiProductEntity : udiProductEntities) { int bhltsl = 1; if (IntUtil.value(udiProductEntity.getPackLevel()) > curLevel) { - bhltsl = udiProductEntity.getBhxjsl(); + bhltsl = IntUtil.value(udiProductEntity.getBhxjsl(), 1); for (DiLevelResponse diLevelResponse : diLevelResponses) { if (IntUtil.value(udiProductEntity.getPackLevel()) > diLevelResponse.getPackLevel() && IntUtil.value(diLevelResponse.getPackLevel()) > curLevel) { - bhltsl = bhltsl * diLevelResponse.getBhxjsl(); + bhltsl = bhltsl * IntUtil.value(diLevelResponse.getBhxjsl(), 1); } } } @@ -582,10 +582,10 @@ public class UdiProductServiceImpl implements UdiProductService { for (UdiProductEntity udiProductEntity : udiProductEntities) { int bhltsl = 1; if (IntUtil.value(udiProductEntity.getPackLevel()) > curLevel) { - bhltsl = udiProductEntity.getBhxjsl(); + bhltsl = IntUtil.value(udiProductEntity.getBhxjsl(), 1); for (DiLevelResponse diLevelResponse : diLevelResponses) { if (IntUtil.value(udiProductEntity.getPackLevel()) > diLevelResponse.getPackLevel() && IntUtil.value(diLevelResponse.getPackLevel()) > curLevel) { - bhltsl = bhltsl * diLevelResponse.getBhxjsl(); + bhltsl = bhltsl * IntUtil.value(diLevelResponse.getBhxjsl(), 1); } } } @@ -613,18 +613,19 @@ public class UdiProductServiceImpl implements UdiProductService { private UdiProductService udiProductService; @Resource private ThirdAliDrugService thirdAliDrugService; + @Override public void saveOrUpadateLevelDrugAli(ThirdAliDrugRequest thirdAliDrugRequest) { ThrProductsEntity thrProductsEntity = thrProductsService.selectByCode(thirdAliDrugRequest.getYbbm()); ThirdAliDrug thirdAliDrugServiceOne = thirdAliDrugService.getOne( - new QueryWrapper().eq("nameCode",thirdAliDrugRequest.getNameCode()).last("limit 1") + new QueryWrapper().eq("nameCode", thirdAliDrugRequest.getNameCode()).last("limit 1") ); - if(thirdAliDrugServiceOne != null){ + if (thirdAliDrugServiceOne != null) { List thirdAliDrugList = thirdAliDrugService.list( - new QueryWrapper().eq("bzgg",thirdAliDrugServiceOne.getBzgg()).eq("packRatio",thirdAliDrugServiceOne.getPackRatio()) + new QueryWrapper().eq("bzgg", thirdAliDrugServiceOne.getBzgg()).eq("packRatio", thirdAliDrugServiceOne.getPackRatio()) ); - if(thirdAliDrugList != null && thirdAliDrugList.size() >0){ + if (thirdAliDrugList != null && thirdAliDrugList.size() > 0) { for (ThirdAliDrug thirdAliDrug : thirdAliDrugList) { UdiProductEntity udiProductEntity = new UdiProductEntity(); @@ -715,7 +716,6 @@ public class UdiProductServiceImpl implements UdiProductService { } - // } } diff --git a/src/main/java/com/glxp/api/util/IntUtil.java b/src/main/java/com/glxp/api/util/IntUtil.java index 5fc53533..5a78b6cb 100644 --- a/src/main/java/com/glxp/api/util/IntUtil.java +++ b/src/main/java/com/glxp/api/util/IntUtil.java @@ -32,4 +32,17 @@ public class IntUtil { else return Integer.parseInt(value); } + + public static int value(Integer value, int defaultValue) { + if (value != null && value != 0) + return value; + else return defaultValue; + } + + public static int value(String value, int defaultValue) { + if (StrUtil.isEmpty(value) || "0".equals(value)) + return defaultValue; + else return Integer.parseInt(value); + + } }