|  |  | @ -227,7 +227,6 @@ public class UdiContrastService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     ThirdAliDrugService thirdAliDrugService; |  |  |  |     ThirdAliDrugService thirdAliDrugService; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     //    @Transactional
 |  |  |  |     //    @Transactional
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public void createOnlyMainId(String mainId) { |  |  |  |     public void createOnlyMainId(String mainId) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest(); |  |  |  |         FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest(); | 
			
		
	
	
		
		
			
				
					|  |  | @ -260,15 +259,15 @@ public class UdiContrastService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 UdiProductEntity udiProductEntity = new UdiProductEntity(); |  |  |  |                 UdiProductEntity udiProductEntity = new UdiProductEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 BeanUtils.copyProperties(thrProductsEntity, udiProductEntity); |  |  |  |                 BeanUtils.copyProperties(thrProductsEntity, udiProductEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 YbDrug ybDrug=new YbDrug(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (list != null && list.size() > 0) { |  |  |  |                 if (list != null && list.size() > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     YbDrug ybDrug = list.get(0); |  |  |  |                      ybDrug = list.get(0); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     // 数据做处理好查询阿里接口
 |  |  |  |                     // 数据做处理好查询阿里接口
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     ybDrug.setRegisteredProductName(ybDrug.getRegisteredProductName().replace("(", "(").replace(")", ")")); |  |  |  |                     if(ybDrug.getApprovalCode().contains("(")){ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     if (ybDrug.getApprovalCode().contains("(")) { |  |  |  |                         String[] charArr  = ybDrug.getRegisteredProductName().split("\\("); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         String[] charArr = ybDrug.getRegisteredProductName().split("\\("); |  |  |  |                         ybDrug.setApprovalCode(charArr[0]); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ybDrug.setRegisteredProductName(charArr[0]); |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                     ybDrug.setApprovalCode(ybDrug.getApprovalCode().replace("(", "(").replace(")", ")")); |  |  |  | 
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     udiProductEntity.setId(IdUtil.getSnowflakeNextId()); |  |  |  |                     udiProductEntity.setId(IdUtil.getSnowflakeNextId()); | 
			
		
	
	
		
		
			
				
					|  |  | @ -309,127 +308,171 @@ public class UdiContrastService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     udiProductEntity.setUpdateTime(new Date()); |  |  |  |                     udiProductEntity.setUpdateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity); |  |  |  |                     udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     List<ThirdAliDrug> thirdAliDrugList = thirdAliDrugService.list( |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             new QueryWrapper<ThirdAliDrug>() |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                     .eq(StringUtils.isNotEmpty(ybDrug.getRegisteredProductName()), "cpmctymc", ybDrug.getRegisteredProductName()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                     .eq(StringUtils.isNotEmpty(ybDrug.getApprovalCode()), "approvalNum", ybDrug.getApprovalCode()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     ); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     if (CollUtil.isNotEmpty(thirdAliDrugList)) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } else { |  |  |  |                 } else { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         Map map = new HashMap(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         if (StringUtils.isNotEmpty(ybDrug.getRegisteredProductName())) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             map.put("cpmctymc", ybDrug.getRegisteredProductName()); |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                     // 数据处理
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         if (StringUtils.isNotEmpty(ybDrug.getApprovalCode())) { |  |  |  |                     udiProductEntity.setId(IdUtil.getSnowflakeNextId()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             map.put("approvalNum", ybDrug.getApprovalCode()); |  |  |  | //                    udiProductEntity.setNameCode(thrProductsEntity.getCode());
 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                     udiProductEntity.setUuid(udiRelevanceEntity.getUuid()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         List<ThirdAliDrug> thirdAliDrugsListGjk = null; |  |  |  |                     udiProductEntity.setDiType(1); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setScbssfbhph("是"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setScbssfbhscrq("是"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setScbssfbhsxrq("是"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setScbssfbhxlh("否"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setProductsType(thrProductsEntity.getProductType()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setRequireScanCode(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setMajorStatus(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setPhysicType(3); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if (StrUtil.isEmpty(udiProductEntity.getPrice())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         udiProductEntity.setPrice("0.00"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setUpdateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 List<ThirdAliDrug> thirdAliDrugList =   thirdAliDrugService.list( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         new QueryWrapper<ThirdAliDrug>() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 .eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()),"cpmctymc",udiProductEntity.getCpmctymc()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 .eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()),"approvalNum",udiProductEntity.getZczbhhzbapzbh()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (CollUtil.isNotEmpty(thirdAliDrugList)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     Map map = new HashMap(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc())){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         map.put("cpmctymc",udiProductEntity.getCpmctymc()); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                         try { |  |  |  |                     } | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             String response = HttpUtil.get(udiUrl + "/udiwms/aliDrug/getDrugLevelList", map); |  |  |  |                     if(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh())){ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             BaseResponse<PageSimpleResponse<ThirdAliDrug>> udiDlDeviceResponse = |  |  |  |                         map.put("approvalNum",udiProductEntity.getZczbhhzbapzbh()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                     JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ThirdAliDrug>>>() { |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                                     }); |  |  |  |                     } | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             if (udiDlDeviceResponse != null) { |  |  |  |                     List<ThirdAliDrug> thirdAliDrugsListGjk = null; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 // 查询国家库是否有值 有值直接返回没值查询阿里接口
 |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 thirdAliDrugsListGjk = udiDlDeviceResponse.getData().getList(); |  |  |  |                     try { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         String response =  HttpUtil.get(udiUrl+"/udiwms/aliDrug/getDrugLevelList",map); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         BaseResponse<PageSimpleResponse<ThirdAliDrug>> udiDlDeviceResponse = | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ThirdAliDrug>>>() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 }); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         if (udiDlDeviceResponse != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             // 查询国家库是否有值 有值直接返回没值查询阿里接口
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             thirdAliDrugsListGjk = udiDlDeviceResponse.getData().getList(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } catch (Exception e) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             log.error("国家库查询阿里产品访问出现错误===" + e.getMessage()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } catch (Exception e) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         log.error("国家库查询阿里产品访问出现错误==="+e.getMessage()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                         if (thirdAliDrugService.addOrUpdate(thirdAliDrugsListGjk)) { |  |  |  |                     if(thirdAliDrugService.addOrUpdate(thirdAliDrugsListGjk)){ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         } else { |  |  |  |                     }else { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             List<ThirdAliDrug> thirdAliDrugListNew = null; |  |  |  |                         List<ThirdAliDrug> thirdAliDrugListNew = null; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust(); |  |  |  |                         AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             alihealthThirdAliDrugInsertReqeust.setErpId("73157692795424"); |  |  |  |                         alihealthThirdAliDrugInsertReqeust.setErpId("73157692795424"); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             alihealthThirdAliDrugInsertReqeust.setAppSecret("5231c601505706a9d49823c3dfe2cb01"); |  |  |  |                         alihealthThirdAliDrugInsertReqeust.setAppSecret("5231c601505706a9d49823c3dfe2cb01"); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust(); |  |  |  |                         AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             alihealthKytDrugrescodeReqeust.setPhysic_name(ybDrug.getRegisteredProductName()); |  |  |  |                         alihealthKytDrugrescodeReqeust.setPhysic_name(udiProductEntity.getCpmctymc()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             alihealthKytDrugrescodeReqeust.setApproval_licence_no(ybDrug.getApprovalCode()); |  |  |  |                         alihealthKytDrugrescodeReqeust.setApproval_licence_no(udiProductEntity.getZczbhhzbapzbh()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             alihealthKytDrugrescodeReqeust.setPage_size(100); |  |  |  |                         alihealthKytDrugrescodeReqeust.setPage_size(100); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             alihealthKytDrugrescodeReqeust.setPage(1); |  |  |  |                         alihealthKytDrugrescodeReqeust.setPage(1); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             alihealthKytDrugrescodeReqeust.setApp_key("31721223"); |  |  |  |                         alihealthKytDrugrescodeReqeust.setApp_key("31721223"); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             alihealthKytDrugrescodeReqeust.setRef_ent_id("ef99b78bd9c54c1284f813149c858fb0"); |  |  |  |                         alihealthKytDrugrescodeReqeust.setRef_ent_id("ef99b78bd9c54c1284f813149c858fb0"); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust); |  |  |  |                         alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust); |  |  |  |                         BaseResponse<List<ThirdAliDrug>> baseResponse  = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust,true); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             if (baseResponse.getCode() == 20000) { |  |  |  |                         if(baseResponse.getCode() == 20000){ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 thirdAliDrugListNew = baseResponse.getData(); |  |  |  |                             thirdAliDrugListNew  = baseResponse.getData(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 thirdAliDrugService.addOrUpdate(thirdAliDrugListNew); |  |  |  |                             thirdAliDrugService.addOrUpdate(thirdAliDrugListNew); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             } else { |  |  |  |                         }else { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 udiProductService.insertUdiInfo(udiProductEntity); |  |  |  |                             udiProductService.insertUdiInfo(udiProductEntity); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 log.error("阿里接口未查到产品信息===" + baseResponse.getMessage()); |  |  |  |                             log.error("阿里接口未查到产品信息==="+baseResponse.getMessage()); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | //                                throw new JsonException(500, "阿里接口未查到产品信息");
 |  |  |  | //                                throw new JsonException(500, "阿里接口未查到产品信息");
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         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()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             } |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |                             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()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | //                        udiProductService.insertUdiInfo(udiProductEntity);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     thirdAliDrugList = thirdAliDrugService.list( |  |  |  |                     thirdAliDrugList = thirdAliDrugService.list( | 
			
		
	
		
		
			
				
					
					|  |  |  |                             new QueryWrapper<ThirdAliDrug>() |  |  |  |                             new QueryWrapper<ThirdAliDrug>() | 
			
		
	
		
		
			
				
					
					|  |  |  |                                     .eq(StringUtils.isNotEmpty(ybDrug.getRegisteredProductName()), "cpmctymc", ybDrug.getRegisteredProductName()) |  |  |  |                                     .eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()),"cpmctymc",udiProductEntity.getCpmctymc()) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                     .eq(StringUtils.isNotEmpty(ybDrug.getApprovalCode()), "approvalNum", ybDrug.getApprovalCode()) |  |  |  |                                     .eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()),"approvalNum",udiProductEntity.getZczbhhzbapzbh()) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     ); |  |  |  |                     ); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     for (int i = 0; i < thirdAliDrugList.size(); i++) { |  |  |  | //                        udiProductService.insertUdiInfo(udiProductEntity);
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i); |  |  |  |                 } | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         List<Integer> integers = new ArrayList<>(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         if (StrUtil.isNotEmpty(thirdAliDrug.getPackRatio())) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             integers = DimaUtil.calculateLevels(thirdAliDrug.getPackRatio()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductEntity.setPackLevel(thirdAliDrug.getPackLevel()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         try { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             udiProductEntity.setBhxjsl(integers.get(IntUtil.value(thirdAliDrug.getPackLevel()) - 1)); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } catch (IndexOutOfBoundsException e) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             e.printStackTrace(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             Log.error("计算包装级别出错" + thirdAliDrug.getPackLevel() + "---" + integers + "-----" + thirdAliDrug.toString()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             udiProductEntity.setBhxjsl(0); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductEntity.setNameCode(thirdAliDrug.getNameCode()); |  |  |  |                 for (int i = 0; i < thirdAliDrugList.size(); i++) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         if (IntUtil.value(thirdAliDrug.getPackLevel()) == 1) { |  |  |  |                     ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             udiProductEntity.setXjdw(ybDrug.getMinUnit()); |  |  |  |                     List<Integer> integers = new ArrayList<>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             if (DimaUtil.trMinCount(thirdAliDrug.getBzgg()) != null) { |  |  |  |                     if (StrUtil.isNotEmpty(thirdAliDrug.getPackRatio())) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 udiProductEntity.setBhxjsl(DimaUtil.trMinCount(thirdAliDrug.getBzgg())); |  |  |  |                         integers = DimaUtil.calculateLevels(thirdAliDrug.getPackRatio()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             } else |  |  |  |                     } | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 udiProductEntity.setBhxjsl(ybDrug.getFactor()); |  |  |  |                     udiProductEntity.setPackLevel(thirdAliDrug.getPackLevel()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                     try { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         if (thirdAliDrug.getPackLevel() != null || !thirdAliDrug.getPackLevel().equals("0")) { |  |  |  |                         udiProductEntity.setBhxjsl(integers.get(IntUtil.value(thirdAliDrug.getPackLevel()) - 1)); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             udiProductEntity.setDiType(IntUtil.value(thirdAliDrug.getPackLevel()) == 1 ? 1 : 4); |  |  |  |                     } catch (IndexOutOfBoundsException e) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         } else { |  |  |  |                         e.printStackTrace(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             udiProductEntity.setDiType(1); |  |  |  |                         Log.error("计算包装级别出错" + thirdAliDrug.getPackLevel() + "---" + integers + "-----" + thirdAliDrug.toString()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         udiProductEntity.setBhxjsl(0); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductEntity.setXjdw(thirdAliDrug.getPrepnUnitName()); |  |  |  |                     } | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName()); |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductEntity.setId(IdUtil.getSnowflakeNextId()); |  |  |  |                     udiProductEntity.setNameCode(thirdAliDrug.getNameCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         udiProductService.insertUdiInfo(udiProductEntity); |  |  |  | 
 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     // 数据处理
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setPrepnSpec(thirdAliDrug.getFormSpec()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setZczbhhzbapzbh(thirdAliDrug.getApprovalNum()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setCpmctymc(thirdAliDrug.getCpmctymc()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setSpmc(thirdAliDrug.getSpmc()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setBzgg(thirdAliDrug.getBzgg()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //                        udiProductEntity.setMatrial(ybDrug.getMaterialName());
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //                        udiProductEntity.setPackMatrial(ybDrug.getMaterialName());
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //                        udiProductEntity.setMedicareType(setMedicareType(ybDrug.getProductInsuranceType()));
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     //最小产品单位
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     //设置最小产品数量
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //                        udiProductEntity.setBhxjsl(ybDrug.getFactor());
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     //设置包装级别
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setPackLevel(1 + ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     //生产厂家
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setManufactory(thirdAliDrug.getManufacturer()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     //商品条码 essentialDrugMarkName sptm
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //                    udiProductEntity.setSptm(ybDrug.getBusinessLicense());
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setPrepnUnit(thirdAliDrug.getPrepnUnitName()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if (IntUtil.value(thirdAliDrug.getPackLevel()) == 1) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         udiProductEntity.setXjdw(ybDrug.getMinUnit()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         if (DimaUtil.trMinCount(thirdAliDrug.getBzgg()) != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             udiProductEntity.setBhxjsl(DimaUtil.trMinCount(thirdAliDrug.getBzgg())); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             udiProductEntity.setBhxjsl(ybDrug.getFactor()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } else { |  |  |  |                     if (thirdAliDrug.getPackLevel() != null || !thirdAliDrug.getPackLevel().equals("0")) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         udiProductEntity.setDiType(IntUtil.value(thirdAliDrug.getPackLevel()) == 1 ? 1 : 4); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         udiProductEntity.setDiType(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setXjdw(thirdAliDrug.getPrepnUnitName()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     udiProductEntity.setId(IdUtil.getSnowflakeNextId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     udiProductService.insertUdiInfo(udiProductEntity); |  |  |  |                     udiProductService.insertUdiInfo(udiProductEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                setLevel(udiRelevanceEntity.getUuid());
 |  |  |  | //                setLevel(udiRelevanceEntity.getUuid());
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 UdiProductEntity byUuid = udiProductService.findByUuid(udiRelevanceEntity.getUuid()); |  |  |  |                 UdiProductEntity byUuid = udiProductService.findByUuid(udiRelevanceEntity.getUuid()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 udiRelevanceEntity = udiRelevanceService.insertDefaultLevel(udiRelevanceEntity, byUuid); |  |  |  |                 udiRelevanceEntity = udiRelevanceService.insertDefaultLevel(udiRelevanceEntity, byUuid); | 
			
		
	
	
		
		
			
				
					|  |  | 
 |