From d0109a4969420cd032741bb44fe41a83e469254e Mon Sep 17 00:00:00 2001 From: qiuyt Date: Fri, 10 Jan 2025 12:51:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E7=A0=81=E8=9E=8D=E5=90=88=E8=A1=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AD=97=E6=AE=B5=E5=92=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collect/ThirdAliDrugController.java | 60 ++++++++++--------- .../req/collect/ThirdAliDrugRequest.java | 2 + .../mapper/collect/ThirdAliDrugMapper.xml | 6 ++ 3 files changed, 40 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/glxp/udidl/admin/controller/collect/ThirdAliDrugController.java b/src/main/java/com/glxp/udidl/admin/controller/collect/ThirdAliDrugController.java index 8649385..767982c 100644 --- a/src/main/java/com/glxp/udidl/admin/controller/collect/ThirdAliDrugController.java +++ b/src/main/java/com/glxp/udidl/admin/controller/collect/ThirdAliDrugController.java @@ -60,36 +60,40 @@ public class ThirdAliDrugController { } List list = thirdAliDrugService.filterList(thirdAliDrug); if (CollUtil.isEmpty(list)){ - ThirdAliDrugAddRequest thirdAliDrugAddRequest = new ThirdAliDrugAddRequest(); - AlihealthThirdAliDrugInsertReqeust request = new AlihealthThirdAliDrugInsertReqeust(); - AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust(); - alihealthKytDrugrescodeReqeust.setPhysic_name(thirdAliDrug.getCpmctymc()); - alihealthKytDrugrescodeReqeust.setApproval_licence_no(thirdAliDrug.getApprovalNum()); - alihealthKytDrugrescodeReqeust.setEnt_name(thirdAliDrug.getManufacturer()); - alihealthKytDrugrescodeReqeust.setPackage_spec(thirdAliDrug.getBzgg()); - alihealthKytDrugrescodeReqeust.setPrepn_spec(thirdAliDrug.getFormSpec()); - - request.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust); - try { - BaseResponse> baseResponse = alihealthUtils.thirdAliDrugInsertAll(request); - if(baseResponse.getCode() == 20000){ - list = baseResponse.getData(); - }else { - log.error("阿里访问失败==="+baseResponse.getMessage()); - } - }catch (Exception e){ - log.error("阿里访问失败==="+e.getMessage()); - } - List finalList = list; - ThreadUtil.execAsync(() -> { + // 剔除当前选入的产品编码要给他删了再重新查一次判断 如果还是查不到就去查阿里 + thirdAliDrug.setNameCodeIn(null); + List listNew = thirdAliDrugService.filterList(thirdAliDrug); + if (CollUtil.isEmpty(listNew)){ + ThirdAliDrugAddRequest thirdAliDrugAddRequest = new ThirdAliDrugAddRequest(); + AlihealthThirdAliDrugInsertReqeust request = new AlihealthThirdAliDrugInsertReqeust(); + AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust(); + alihealthKytDrugrescodeReqeust.setPhysic_name(thirdAliDrug.getCpmctymc()); + alihealthKytDrugrescodeReqeust.setApproval_licence_no(thirdAliDrug.getApprovalNum()); + alihealthKytDrugrescodeReqeust.setEnt_name(thirdAliDrug.getManufacturer()); + alihealthKytDrugrescodeReqeust.setPackage_spec(thirdAliDrug.getBzgg()); + alihealthKytDrugrescodeReqeust.setPrepn_spec(thirdAliDrug.getFormSpec()); + + request.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust); try { - thirdAliDrugAddRequest.setList(finalList); - thirdAliDrugService.addThirdAliDrug(thirdAliDrugAddRequest); - } catch (Exception e) { - log.error("异步更新阿里药品数据错误==="+e.getMessage()); + BaseResponse> baseResponse = alihealthUtils.thirdAliDrugInsertAll(request); + if(baseResponse.getCode() == 20000){ + list = baseResponse.getData(); + }else { + log.error("阿里访问失败==="+baseResponse.getMessage()); + } + }catch (Exception e){ + log.error("阿里访问失败==="+e.getMessage()); } - }); - + List finalList = list; + ThreadUtil.execAsync(() -> { + try { + thirdAliDrugAddRequest.setList(finalList); + thirdAliDrugService.addThirdAliDrug(thirdAliDrugAddRequest); + } catch (Exception e) { + log.error("异步更新阿里药品数据错误==="+e.getMessage()); + } + }); + } } PageInfo pageInfo = new PageInfo<>(list); diff --git a/src/main/java/com/glxp/udidl/admin/req/collect/ThirdAliDrugRequest.java b/src/main/java/com/glxp/udidl/admin/req/collect/ThirdAliDrugRequest.java index c73a904..da31d99 100644 --- a/src/main/java/com/glxp/udidl/admin/req/collect/ThirdAliDrugRequest.java +++ b/src/main/java/com/glxp/udidl/admin/req/collect/ThirdAliDrugRequest.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; +import java.util.List; @Data public class ThirdAliDrugRequest extends ListPageRequest { @@ -108,5 +109,6 @@ public class ThirdAliDrugRequest extends ListPageRequest { private String approvalNum; + private List nameCodeIn; } diff --git a/src/main/resources/mybatis/mapper/collect/ThirdAliDrugMapper.xml b/src/main/resources/mybatis/mapper/collect/ThirdAliDrugMapper.xml index 141f8f4..0dec7c7 100644 --- a/src/main/resources/mybatis/mapper/collect/ThirdAliDrugMapper.xml +++ b/src/main/resources/mybatis/mapper/collect/ThirdAliDrugMapper.xml @@ -100,6 +100,12 @@ AND bzgg LIKE concat('%', #{bzgg}, '%') + + AND nameCode NOT IN + + #{id} + +