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 901ab970..10e2c73a 100644 --- a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java +++ b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java @@ -227,7 +227,7 @@ public class UdiContrastService { @Resource ThirdAliDrugService thirdAliDrugService; - @Transactional +// @Transactional public void createOnlyMainId(String mainId) { FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest(); filterThrProductsRequest.setCode(mainId); @@ -346,7 +346,7 @@ public class UdiContrastService { if(thirdAliDrugService.addOrUpdate(thirdAliDrugsListGjk)){ }else { - List thirdAliDrugListNew; + List thirdAliDrugListNew = null; String customerId =customerService.getCustomerId(); CustomerInfoEntity customerInfoEntity = customerInfoService.selectById(customerId); @@ -366,20 +366,22 @@ public class UdiContrastService { if(baseResponse.getCode() == 20000){ thirdAliDrugListNew = baseResponse.getData(); thirdAliDrugService.addOrUpdate(thirdAliDrugListNew); + }else { log.error("阿里接口未查到产品信息==="+baseResponse.getMessage()); - throw new JsonException(500, "阿里接口未查到产品信息"); - +// throw new JsonException(500, "阿里接口未查到产品信息"); } - // 上传到国家库 - try { - Map mapNew = new HashMap(); - mapNew.put("list",thirdAliDrugListNew); - String response = HttpUtil.post(udiUrl+"/udiwms/aliDrug/addThirdAliDrug", JSONUtil.toJsonStr(mapNew)); - BaseResponse baseResponseAdd = JSONUtil.toBean(response,BaseResponse.class); - log.info("成功上传国家库阿里产品数据"); - } catch (Exception e) { - log.error("国家库上传阿里产品访问出现错误==="+e.getMessage()); + if(thirdAliDrugListNew!=null && thirdAliDrugListNew.size() > 0 ){ + try { + // 上传到国家库 + Map mapNew = new HashMap(); + mapNew.put("list",thirdAliDrugListNew); + String response = HttpUtil.post(udiUrl+"/udiwms/aliDrug/addThirdAliDrug", JSONUtil.toJsonStr(mapNew)); + BaseResponse baseResponseAdd = JSONUtil.toBean(response,BaseResponse.class); + log.info("成功上传国家库阿里产品数据"); + } catch (Exception e) { + log.error("国家库上传阿里产品访问出现错误==="+e.getMessage()); + } } }