diff --git a/src/main/java/com/glxp/api/controller/alihealth/AlihealthBusController.java b/src/main/java/com/glxp/api/controller/alihealth/AlihealthBusController.java index 48ddc83f..42107793 100644 --- a/src/main/java/com/glxp/api/controller/alihealth/AlihealthBusController.java +++ b/src/main/java/com/glxp/api/controller/alihealth/AlihealthBusController.java @@ -21,6 +21,7 @@ import com.glxp.api.res.alihealth.AlihealthKytGetentinfoResponse; import com.glxp.api.util.alihealth.AlihealthUtils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -110,6 +111,7 @@ public class AlihealthBusController { } } catch (Exception e) { log.error("国家库查询阿里产品访问出现错误==="+e.getMessage()); + } if(thirdAliDrugsListGjk!= null && thirdAliDrugsListGjk.size() >0){ @@ -121,7 +123,7 @@ public class AlihealthBusController { thirdAliDrugListNew = baseResponse.getData(); }else { log.error("阿里接口未查到产品信息==="+baseResponse.getMessage()); - throw new JsonException(500, "阿里接口未查到产品信息"); + return ResultVOUtils.error("阿里接口未查到产品信息==="+baseResponse.getMessage()); } // 上传到国家库 @@ -132,6 +134,7 @@ public class AlihealthBusController { BaseResponse baseResponseAdd = JSONUtil.toBean(response,BaseResponse.class); log.info("成功上传国家库阿里产品数据"); } catch (Exception e) { + log.error("国家库上传阿里产品访问出现错误==="+e.getMessage()); } return ResultVOUtils.success(thirdAliDrugListNew); diff --git a/src/main/java/com/glxp/api/controller/test/TestCodeController.java b/src/main/java/com/glxp/api/controller/test/TestCodeController.java index b3a0d4da..3912ffa7 100644 --- a/src/main/java/com/glxp/api/controller/test/TestCodeController.java +++ b/src/main/java/com/glxp/api/controller/test/TestCodeController.java @@ -9,7 +9,7 @@ import com.glxp.api.req.alihealth.AlihealthKytDrugrescodeReqeust; import com.glxp.api.req.alihealth.AlihealthKytSearchbillReqeust; import com.glxp.api.req.alihealth.local.AlihealthRelCodeInsertReqeust; import com.glxp.api.req.alihealth.local.AlihealthThirdAliDrugInsertReqeust; -import com.glxp.api.req.alihealth.local.AlihealthThirdAliSearchbillInsertReqeust; +import com.glxp.api.req.alihealth.local.AlihealthKytThirdAliSearchbillInsertReqeust; import com.glxp.api.res.alihealth.AlihealthKytSinglerelationResponse; import com.glxp.api.service.collect.RelCodeBatchService; import com.glxp.api.service.collect.RelCodeDetailService; @@ -112,14 +112,14 @@ public class TestCodeController { } } - - return alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust,true); + return baseResponse; +// return alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust,true); } @PostMapping("/test2") public BaseResponse test2() { - AlihealthThirdAliSearchbillInsertReqeust alihealthThirdAliSearchbillInsertReqeust = new AlihealthThirdAliSearchbillInsertReqeust(); - alihealthThirdAliSearchbillInsertReqeust.setErpId("123"); - alihealthThirdAliSearchbillInsertReqeust.setAppSecret("5231c601505706a9d49823c3dfe2cb01"); + AlihealthKytThirdAliSearchbillInsertReqeust alihealthKytThirdAliSearchbillInsertReqeust = new AlihealthKytThirdAliSearchbillInsertReqeust(); + alihealthKytThirdAliSearchbillInsertReqeust.setErpId("123"); + alihealthKytThirdAliSearchbillInsertReqeust.setAppSecret("5231c601505706a9d49823c3dfe2cb01"); AlihealthKytSearchbillReqeust alihealthKytSearchbillReqeust = new AlihealthKytSearchbillReqeust(); alihealthKytSearchbillReqeust.setRef_ent_id("ef99b78bd9c54c1284f813149c858fb0"); alihealthKytSearchbillReqeust.setAuth_ref_user_id("ef99b78bd9c54c1284f813149c858fb0"); @@ -131,7 +131,7 @@ public class TestCodeController { alihealthKytSearchbillReqeust.setApp_key("31721223"); - alihealthThirdAliSearchbillInsertReqeust.setAlihealthKytSearchbillReqeust(alihealthKytSearchbillReqeust); + alihealthKytThirdAliSearchbillInsertReqeust.setAlihealthKytSearchbillReqeust(alihealthKytSearchbillReqeust); // BaseResponse> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust); // if(baseResponse.getCode() == 20000){ // List list = baseResponse.getData(); @@ -152,6 +152,6 @@ public class TestCodeController { // // } - return alihealthUtils.thirdAliSearchbillInsert(alihealthThirdAliSearchbillInsertReqeust); + return alihealthUtils.thirdAliSearchbillInsert(alihealthKytThirdAliSearchbillInsertReqeust); } } diff --git a/src/main/java/com/glxp/api/dao/auth/AuthAliUserDao.java b/src/main/java/com/glxp/api/dao/auth/AuthAliUserDao.java new file mode 100644 index 00000000..c6a08e3a --- /dev/null +++ b/src/main/java/com/glxp/api/dao/auth/AuthAliUserDao.java @@ -0,0 +1,8 @@ +package com.glxp.api.dao.auth; + +import com.glxp.api.dao.BaseMapperPlus; +import com.glxp.api.entity.auth.AuthAliUser; + +public interface AuthAliUserDao extends BaseMapperPlus { + +} diff --git a/src/main/java/com/glxp/api/entity/auth/AuthAliUser.java b/src/main/java/com/glxp/api/entity/auth/AuthAliUser.java new file mode 100644 index 00000000..cf302798 --- /dev/null +++ b/src/main/java/com/glxp/api/entity/auth/AuthAliUser.java @@ -0,0 +1,37 @@ +package com.glxp.api.entity.auth; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class AuthAliUser { + private Long id; + + /** + * 第三方ID + */ + private String erpid; + + /** + * 阿里KEY + */ + private String appkey; + + /** + * 阿里密钥 + */ + private String appsecret; + + /** + * 厂家标识 + */ + private String refentid; + + /** + * 1 为生成企业 2为零售药店 + */ + private String type; +} diff --git a/src/main/java/com/glxp/api/req/alihealth/local/AlihealthThirdAliSearchbillInsertReqeust.java b/src/main/java/com/glxp/api/req/alihealth/local/AlihealthKytThirdAliSearchbillInsertReqeust.java similarity index 68% rename from src/main/java/com/glxp/api/req/alihealth/local/AlihealthThirdAliSearchbillInsertReqeust.java rename to src/main/java/com/glxp/api/req/alihealth/local/AlihealthKytThirdAliSearchbillInsertReqeust.java index f9cd764c..d758834f 100644 --- a/src/main/java/com/glxp/api/req/alihealth/local/AlihealthThirdAliSearchbillInsertReqeust.java +++ b/src/main/java/com/glxp/api/req/alihealth/local/AlihealthKytThirdAliSearchbillInsertReqeust.java @@ -1,11 +1,10 @@ package com.glxp.api.req.alihealth.local; -import com.glxp.api.req.alihealth.AlihealthKytDrugrescodeReqeust; import com.glxp.api.req.alihealth.AlihealthKytSearchbillReqeust; import lombok.Data; @Data -public class AlihealthThirdAliSearchbillInsertReqeust { +public class AlihealthKytThirdAliSearchbillInsertReqeust { private String erpId; private String appSecret; private AlihealthKytSearchbillReqeust alihealthKytSearchbillReqeust; diff --git a/src/main/java/com/glxp/api/res/alihealth/AlihealthKytDrugrescodeResponse.java b/src/main/java/com/glxp/api/res/alihealth/AlihealthKytDrugrescodeResponse.java index 2e8cc933..7a1ecb85 100644 --- a/src/main/java/com/glxp/api/res/alihealth/AlihealthKytDrugrescodeResponse.java +++ b/src/main/java/com/glxp/api/res/alihealth/AlihealthKytDrugrescodeResponse.java @@ -63,7 +63,7 @@ public class AlihealthKytDrugrescodeResponse extends AlihealthKytCommonParameter // thirdAliDrug.setId(); thirdAliDrugShare.setType(jsonObject.getStr("physic_type")); thirdAliDrugShare.setManufacturer(jsonObject.getStr("ent_name")); - thirdAliDrugShare.setCpmctymc(jsonObject.getStr("physic_name")); + thirdAliDrugShare.setCpmctymc(jsonObject.getStr("physic_name").trim()); thirdAliDrugShare.setForm(jsonObject.getStr("prepn_type_desc")); thirdAliDrugShare.setSpmc(jsonObject.getStr("prod_name")); thirdAliDrugShare.setErpId(erpId); @@ -82,7 +82,7 @@ public class AlihealthKytDrugrescodeResponse extends AlihealthKytCommonParameter BeanUtils.copyProperties(thirdAliDrugShare,thirdAliDrugShareTwo); thirdAliDrugShareTwo.setFormSpec(oubType.getStr("prepn_spec")); thirdAliDrugShareTwo.setBzgg(oubType.getStr("package_spec")); - thirdAliDrugShareTwo.setApprovalNum(oubType.getStr("approve_no")); + thirdAliDrugShareTwo.setApprovalNum(oubType.getStr("approve_no").trim()); thirdAliDrugShareTwo.setPrepnUnit(oubType.getStr("prepn_unit")); thirdAliDrugShareTwo.setPrepnUnitName(oubType.getStr("prepn_unit_name")); @@ -90,16 +90,20 @@ public class AlihealthKytDrugrescodeResponse extends AlihealthKytCommonParameter if (oubType.containsKey("code_res_list")) { - List codeReslist = (List) oubType.getJSONObject("code_res_list").getJSONArray("code_res_list"); - for (JSONObject codeRes : codeReslist) { - ThirdAliDrug thirdAliDrug = new ThirdAliDrug(); - BeanUtils.copyProperties(thirdAliDrugShareTwo,thirdAliDrug); - // 码有值才加入 - thirdAliDrug.setNameCode(codeRes.getStr("res_code")); - thirdAliDrug.setPackRatio(codeRes.getStr("pkg_ratio")); - thirdAliDrug.setPackLevel(StringUtils.isEmpty(codeRes.getStr("code_level")) ? "0" : codeRes.getStr("code_level")); - list.add(thirdAliDrug); + JSONObject jsonObjectCodeRes = oubType.getJSONObject("code_res_list"); + if(jsonObjectCodeRes.containsKey("code_res_list")){ + List codeReslist = (List) jsonObjectCodeRes.getJSONArray("code_res_list"); + for (JSONObject codeRes : codeReslist) { + ThirdAliDrug thirdAliDrug = new ThirdAliDrug(); + BeanUtils.copyProperties(thirdAliDrugShareTwo,thirdAliDrug); + // 码有值才加入 + thirdAliDrug.setNameCode(codeRes.getStr("res_code")); + thirdAliDrug.setPackRatio(codeRes.getStr("pkg_ratio")); + thirdAliDrug.setPackLevel(StringUtils.isEmpty(codeRes.getStr("code_level")) ? null: codeRes.getStr("code_level")); + list.add(thirdAliDrug); + } } + } } } diff --git a/src/main/java/com/glxp/api/service/auth/AuthAliUserService.java b/src/main/java/com/glxp/api/service/auth/AuthAliUserService.java new file mode 100644 index 00000000..487bd0e2 --- /dev/null +++ b/src/main/java/com/glxp/api/service/auth/AuthAliUserService.java @@ -0,0 +1,25 @@ +package com.glxp.api.service.auth; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.glxp.api.dao.auth.AuthAliUserDao; +import com.glxp.api.entity.auth.AuthAliUser; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +@Service +public class AuthAliUserService extends ServiceImpl { + @Resource + private AuthAliUserDao authAliUserDao; + public AuthAliUser getOne(){ + AuthAliUser authAliUser = this.getOne(new QueryWrapper() + .last("limit 1") + ); + if(authAliUser == null){ + authAliUser = new AuthAliUser(); + } + return authAliUser; + } + +} 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 af9cfe58..93d67f04 100644 --- a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java +++ b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java @@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.constant.ConstantStatus; import com.glxp.api.dao.basic.UdiRelevanceDao; +import com.glxp.api.entity.auth.AuthAliUser; import com.glxp.api.entity.auth.CustomerInfoEntity; import com.glxp.api.entity.basic.UdiProductEntity; import com.glxp.api.entity.basic.UdiRelevanceEntity; @@ -27,6 +28,7 @@ import com.glxp.api.req.thrsys.ThrInsDrugFeeRequest; import com.glxp.api.req.thrsys.ThrInsMaterialFeeRequest; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.basic.UdiRelevanceResponse; +import com.glxp.api.service.auth.AuthAliUserService; import com.glxp.api.service.auth.CustomerInfoService; import com.glxp.api.service.auth.CustomerService; import com.glxp.api.service.thrsys.BasicInsMaterialService; @@ -78,6 +80,8 @@ public class UdiContrastService { private AlihealthUtils alihealthUtils; @Value("${UDI_SERVER_URL}") private String udiUrl; + @Resource + private AuthAliUserService authAliUserService; public boolean isExit(String originUuid, String mainId, String thirdSys) { @@ -260,6 +264,29 @@ public class UdiContrastService { UdiProductEntity udiProductEntity = new UdiProductEntity(); BeanUtils.copyProperties(thrProductsEntity, udiProductEntity); YbDrug ybDrug=new YbDrug(); + + // 数据处理 + udiProductEntity.setId(IdUtil.getSnowflakeNextId()); +// udiProductEntity.setNameCode(thrProductsEntity.getCode()); + + udiProductEntity.setUuid(udiRelevanceEntity.getUuid()); + udiProductEntity.setDiType(1); + udiProductEntity.setScbssfbhph("是"); + udiProductEntity.setScbssfbhscrq("是"); + udiProductEntity.setScbssfbhsxrq("是"); + udiProductEntity.setScbssfbhxlh("否"); + udiProductEntity.setProductsType(thrProductsEntity.getProductType()); + udiProductEntity.setRequireScanCode(1); + udiProductEntity.setMajorStatus(1); + udiProductEntity.setPhysicType(3); + //设置包装级别 + udiProductEntity.setPackLevel(1 + ""); + if (StrUtil.isEmpty(udiProductEntity.getPrice())) { + udiProductEntity.setPrice("0.00"); + } + udiProductEntity.setUpdateTime(new Date()); + udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity); + if (list != null && list.size() > 0) { ybDrug = list.get(0); // 数据做处理好查询阿里接口 @@ -268,9 +295,6 @@ public class UdiContrastService { ybDrug.setApprovalCode(charArr[0]); } - - - udiProductEntity.setId(IdUtil.getSnowflakeNextId()); // udiProductEntity.setNameCode(thrProductsEntity.getCode()); udiProductEntity.setPrepnSpec(ybDrug.getRealityOutlook()); udiProductEntity.setZczbhhzbapzbh(ybDrug.getApprovalCode()); @@ -285,51 +309,17 @@ public class UdiContrastService { udiProductEntity.setPackUnit(ybDrug.getUnit()); //设置最小产品数量 udiProductEntity.setBhxjsl(ybDrug.getFactor()); - //设置包装级别 - udiProductEntity.setPackLevel(1 + ""); + //生产厂家 udiProductEntity.setManufactory(ybDrug.getCompanyNameSc()); //商品条码 essentialDrugMarkName sptm // udiProductEntity.setSptm(ybDrug.getBusinessLicense()); udiProductEntity.setPrepnUnit(ybDrug.getRealityMedicinemodel()); - udiProductEntity.setUuid(udiRelevanceEntity.getUuid()); - 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); } else { - // 数据处理 - udiProductEntity.setId(IdUtil.getSnowflakeNextId()); -// udiProductEntity.setNameCode(thrProductsEntity.getCode()); - udiProductEntity.setUuid(udiRelevanceEntity.getUuid()); - 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 thirdAliDrugList = thirdAliDrugService.list( @@ -371,28 +361,40 @@ public class UdiContrastService { }else { List thirdAliDrugListNew = null; + AuthAliUser authAliUser = authAliUserService.getOne(); AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust(); - alihealthThirdAliDrugInsertReqeust.setErpId("73157692795424"); - alihealthThirdAliDrugInsertReqeust.setAppSecret("5231c601505706a9d49823c3dfe2cb01"); + alihealthThirdAliDrugInsertReqeust.setErpId(authAliUser.getErpid()); + alihealthThirdAliDrugInsertReqeust.setAppSecret(authAliUser.getAppsecret()); AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust(); alihealthKytDrugrescodeReqeust.setPhysic_name(udiProductEntity.getCpmctymc()); alihealthKytDrugrescodeReqeust.setApproval_licence_no(udiProductEntity.getZczbhhzbapzbh()); alihealthKytDrugrescodeReqeust.setPage_size(100); alihealthKytDrugrescodeReqeust.setPage(1); - alihealthKytDrugrescodeReqeust.setApp_key("31721223"); - alihealthKytDrugrescodeReqeust.setRef_ent_id("ef99b78bd9c54c1284f813149c858fb0"); + alihealthKytDrugrescodeReqeust.setApp_key(authAliUser.getAppkey()); + alihealthKytDrugrescodeReqeust.setRef_ent_id(authAliUser.getRefentid()); alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust); - BaseResponse> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust,true); - if(baseResponse.getCode() == 20000){ - thirdAliDrugListNew = baseResponse.getData(); - thirdAliDrugService.addOrUpdate(thirdAliDrugListNew); - - }else { - udiProductService.insertUdiInfo(udiProductEntity); - log.error("阿里接口未查到产品信息==="+baseResponse.getMessage()); + try { + BaseResponse> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust,true); + if(baseResponse.getCode() == 20000){ + thirdAliDrugListNew = baseResponse.getData(); + if(thirdAliDrugService.addOrUpdate(thirdAliDrugListNew)){ + + }else { + log.error("阿里接口未查到产品信息==="); + udiProductService.insertUdiInfo(udiProductEntity); + } + + }else { + log.error("阿里接口未查到产品信息==="+baseResponse.getMessage()); + udiProductService.insertUdiInfo(udiProductEntity); // throw new JsonException(500, "阿里接口未查到产品信息"); + } + }catch (Exception e){ + log.error("阿里接口查询产品信息出现错误==="+e.getMessage()); + udiProductService.insertUdiInfo(udiProductEntity); } + if(thirdAliDrugListNew!=null && thirdAliDrugListNew.size() > 0 ){ try { // 上传到国家库 @@ -462,7 +464,7 @@ public class UdiContrastService { } else udiProductEntity.setBhxjsl(ybDrug.getFactor()); } - if (thirdAliDrug.getPackLevel() != null || !thirdAliDrug.getPackLevel().equals("0")) { + if (thirdAliDrug.getPackLevel() != null && !thirdAliDrug.getPackLevel().equals("0")) { udiProductEntity.setDiType(IntUtil.value(thirdAliDrug.getPackLevel()) == 1 ? 1 : 4); } else { udiProductEntity.setDiType(1); diff --git a/src/main/java/com/glxp/api/util/DimaUtil.java b/src/main/java/com/glxp/api/util/DimaUtil.java index 2b40f041..40ae6c49 100644 --- a/src/main/java/com/glxp/api/util/DimaUtil.java +++ b/src/main/java/com/glxp/api/util/DimaUtil.java @@ -22,7 +22,9 @@ public class DimaUtil { // 存储每层级的倍数关系 List calculatedLevels = new ArrayList<>(); for (int i = levels.length - 1; i > 0; i--) { - calculatedLevels.add(levels[i] / levels[i - 1]); + if(levels[i - 1] > 0){ + calculatedLevels.add(levels[i] / levels[i - 1]); + } } // 最后加上最小单位(第一层级为 1) @@ -33,7 +35,6 @@ public class DimaUtil { for (int i = calculatedLevels.size() - 1; i >= 0; i--) { reversed.add(calculatedLevels.get(i)); } - return reversed; } diff --git a/src/main/java/com/glxp/api/util/alihealth/AlihealthUtils.java b/src/main/java/com/glxp/api/util/alihealth/AlihealthUtils.java index 25094042..6b0a2f41 100644 --- a/src/main/java/com/glxp/api/util/alihealth/AlihealthUtils.java +++ b/src/main/java/com/glxp/api/util/alihealth/AlihealthUtils.java @@ -12,7 +12,7 @@ import com.glxp.api.req.alihealth.AlihealthKytSearchbillReqeust; import com.glxp.api.req.alihealth.AlihealthKytSinglerelationReqeust; import com.glxp.api.req.alihealth.local.AlihealthRelCodeInsertReqeust; import com.glxp.api.req.alihealth.local.AlihealthThirdAliDrugInsertReqeust; -import com.glxp.api.req.alihealth.local.AlihealthThirdAliSearchbillInsertReqeust; +import com.glxp.api.req.alihealth.local.AlihealthKytThirdAliSearchbillInsertReqeust; import com.glxp.api.res.alihealth.AlihealthKytDrugrescodeResponse; import com.glxp.api.res.alihealth.AlihealthKytSearchbillResponse; import com.glxp.api.res.alihealth.AlihealthKytSinglerelationResponse; @@ -64,22 +64,22 @@ public class AlihealthUtils { /** * 通过时间段批量查询入出库单信息 * - * @param alihealthThirdAliDrugInsertReqeust + * @param alihealthKytThirdAliSearchbillInsertReqeust */ - public BaseResponse> thirdAliSearchbillInsert(AlihealthThirdAliSearchbillInsertReqeust alihealthThirdAliDrugInsertReqeust) { - if (alihealthThirdAliDrugInsertReqeust.getAlihealthKytSearchbillReqeust() == null) { + public BaseResponse> thirdAliSearchbillInsert(AlihealthKytThirdAliSearchbillInsertReqeust alihealthKytThirdAliSearchbillInsertReqeust) { + if (alihealthKytThirdAliSearchbillInsertReqeust.getAlihealthKytSearchbillReqeust() == null) { return ResultVOUtils.error("入参不能为空"); } AlihealthKytSearchbillResponse alihealthKytDrugrescodeResponse = null; - AlihealthKytSearchbillReqeust alihealthKytSearchbillReqeust = alihealthThirdAliDrugInsertReqeust.getAlihealthKytSearchbillReqeust(); + AlihealthKytSearchbillReqeust alihealthKytSearchbillReqeust = alihealthKytThirdAliSearchbillInsertReqeust.getAlihealthKytSearchbillReqeust(); if (alihealthKytSearchbillReqeust != null && org.apache.commons.lang3.StringUtils.isNotEmpty(alihealthKytSearchbillReqeust.getApp_key()) - && org.apache.commons.lang3.StringUtils.isNotEmpty(alihealthThirdAliDrugInsertReqeust.getAppSecret()) + && org.apache.commons.lang3.StringUtils.isNotEmpty(alihealthKytThirdAliSearchbillInsertReqeust.getAppSecret()) ) { try { - Map map = alihealthUtils.disposeSign(alihealthKytSearchbillReqeust, alihealthThirdAliDrugInsertReqeust.getAppSecret()); + Map map = alihealthUtils.disposeSign(alihealthKytSearchbillReqeust, alihealthKytThirdAliSearchbillInsertReqeust.getAppSecret()); String json = HttpUtil.get(alihealthUrl, map); alihealthKytDrugrescodeResponse = new AlihealthKytSearchbillResponse(json); @@ -92,7 +92,7 @@ public class AlihealthUtils { return ResultVOUtils.error("阿里健康接口调用失败===用户找不到或者key和秘钥为空"); } if (alihealthKytDrugrescodeResponse.judgeCall()) { - List list = alihealthKytDrugrescodeResponse.disposeThirdAliSearchbill(alihealthThirdAliDrugInsertReqeust.getErpId()); + List list = alihealthKytDrugrescodeResponse.disposeThirdAliSearchbill(alihealthKytThirdAliSearchbillInsertReqeust.getErpId()); return ResultVOUtils.success(list); } else { return ResultVOUtils.error("阿里健康接口调用失败===" + alihealthKytDrugrescodeResponse.getMsg_info()); @@ -134,10 +134,11 @@ public class AlihealthUtils { List list = alihealthKytDrugrescodeResponse.disposeThirdAliDrugList(alihealthThirdAliDrugInsertReqeust.getErpId()); return ResultVOUtils.success(list); } else { + String physicName = alihealthKytDrugrescodeReqeust.getPhysic_name(); + // 重新上传标识为true就改变一下 if ("未查询到相关信息".equals(alihealthKytDrugrescodeResponse.getMsg_info()) - && callBool) { - String physicName = alihealthKytDrugrescodeReqeust.getPhysic_name(); + && callBool && (physicName.contains("(") || physicName.contains("("))) { if (physicName.contains("(")) { physicName = physicName.replace("(", "(").replace(")", ")"); diff --git a/src/main/resources/mybatis/mapper/auth/AuthAliUserDao.xml b/src/main/resources/mybatis/mapper/auth/AuthAliUserDao.xml new file mode 100644 index 00000000..1008a54e --- /dev/null +++ b/src/main/resources/mybatis/mapper/auth/AuthAliUserDao.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + id, erpId, appKey, appSecret, refEntId, `type` + + + diff --git a/src/main/resources/schemas/schema_v2.4.sql b/src/main/resources/schemas/schema_v2.4.sql index ac803b71..fd75cb03 100644 --- a/src/main/resources/schemas/schema_v2.4.sql +++ b/src/main/resources/schemas/schema_v2.4.sql @@ -1229,3 +1229,13 @@ CALL Pro_Temp_ColumnWork('third_ali_drug', 'physicTypeDesc', CALL Pro_Temp_ColumnWork('third_ali_drug', 'packUnitName', ' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT ''包装单位''', 1); + +CREATE TABLE IF NOT EXISTS `auth_ali_user` ( + `id` bigint NOT NULL, + `erpId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '第三方ID', + `appKey` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '阿里KEY', + `appSecret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '阿里密钥', + `refEntId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '厂家标识', + `type` varchar(255) DEFAULT NULL COMMENT '1 为生成企业 2为零售药店', + PRIMARY KEY (`id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;