From 5acbb896c6f28357d01db95010791d0aaa6102f2 Mon Sep 17 00:00:00 2001 From: qiuyt Date: Fri, 13 Dec 2024 18:35:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1=E3=80=81=E6=9F=A5=E8=AF=A2=E7=A0=81?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AlihealthYljgCodedetailResponse.java | 67 +++++++++---------- .../service/inout/impl/IoCodeTempService.java | 30 +++------ .../util/alihealth/AlihealthYljgUtils.java | 17 +++-- 3 files changed, 53 insertions(+), 61 deletions(-) diff --git a/src/main/java/com/glxp/api/res/alihealth/AlihealthYljgCodedetailResponse.java b/src/main/java/com/glxp/api/res/alihealth/AlihealthYljgCodedetailResponse.java index c1b54fc0..8391e8c9 100644 --- a/src/main/java/com/glxp/api/res/alihealth/AlihealthYljgCodedetailResponse.java +++ b/src/main/java/com/glxp/api/res/alihealth/AlihealthYljgCodedetailResponse.java @@ -1,9 +1,11 @@ package com.glxp.api.res.alihealth; +import cn.hutool.core.util.IdUtil; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.glxp.api.entity.collect.RelCodeBatch; +import com.glxp.api.entity.inout.IoCodeLostEntity; import com.glxp.api.util.udi.FilterUdiUtils; import lombok.Data; import org.apache.commons.lang3.StringUtils; @@ -46,48 +48,43 @@ public class AlihealthYljgCodedetailResponse extends AlihealthKytCommonParameter // this.setBill_up_out_detail_do(jsonObjectModel.getJSONObject("result_list").getJSONArray("bill_up_out_detail_do")); } } - public List disposeRelCodeBatch(String customerId){ - List relCodeBatchList =new ArrayList<>(); - + public List disposeRelCodeBatch(){ + List ioCodeLostEntityList = new ArrayList(); List list = (List)this.getCode_full_info_dto(); if(list != null & list.size() >0){ for (JSONObject jsonObject : list) { - RelCodeBatch relCodeBatch = new RelCodeBatch(); - relCodeBatch.setProductCode(FilterUdiUtils.getUdi(jsonObject.getStr("code")).getUdi()); -// relCodeBatch.setSubTypeNo(); -// relCodeBatch.setCascadeRatio(); - relCodeBatch.setPackageSpec(jsonObject.getJSONObject("drug_ent_base_d_t_o").getStr("pkg_spec_crit")); -// relCodeBatch.setComment(); + IoCodeLostEntity connLostEntity = new IoCodeLostEntity(); + connLostEntity.setId(IdUtil.getSnowflakeNextId()); + connLostEntity.setCode(jsonObject.getStr("code")); List jsonArray = (List) jsonObject.getJSONObject("code_produce_info_d_t_o").getJSONObject("produce_info_list").getJSONArray("produce_info_dto"); JSONObject produceInfo =jsonArray.get(0); - relCodeBatch.setBatchNo(produceInfo.getStr("batch_no")); - relCodeBatch.setMadeDate(produceInfo.getStr("produce_date_str")); - relCodeBatch.setValidateDate(produceInfo.getStr("expire_date")); - relCodeBatch.setWorkShop(jsonObject.getJSONObject("p_user_ent_d_t_o").getStr("ent_name")); -// relCodeBatch.setLineName(); -// relCodeBatch.setLineManager(); -// relCodeBatch.setCreateTime(); -// relCodeBatch.setCreateUser(); - relCodeBatch.setUpdateTime(new Date()); - relCodeBatch.setUpdateUser(customerId); - relCodeBatch.setUploadFlagUp(0); - relCodeBatch.setUploadFlagDown(0); - relCodeBatch.setParentCode(null); - relCodeBatch.setErpId(customerId); - relCodeBatch.setCurCode(jsonObject.getStr("code")); - relCodeBatch.setParentCode(jsonObject.getStr("code")); -// if(jsonObject.getJSONObject("p_user_ent_d_t_o").equals("1")){ -// -// }else if(jsonObject.getJSONObject("p_user_ent_d_t_o").equals("2")){ -// -// } - relCodeBatch.setOneLevelCount(0); - relCodeBatch.setTwoLevelCount(0); - relCodeBatch.setThreeLevelCount(0); - relCodeBatchList.add(relCodeBatch); + connLostEntity.setBatchNo(produceInfo.getStr("batch_no")); + String mabeDate =produceInfo.getStr("produce_date_str"); + String validateDate = produceInfo.getStr("expire_date"); + + + if(mabeDate.length() >= 10){ + mabeDate =mabeDate.replace("-","").substring(2,8); + + } + if(validateDate.length() >= 10){ + validateDate = validateDate.replace("-","").substring(2,8); + + } + if(mabeDate.length() == 8){ + mabeDate =mabeDate.replace("-","").substring(2,8); + + } + if(validateDate.length() == 8){ + validateDate = validateDate.replace("-","").substring(2,8); + } + connLostEntity.setProduceDate(mabeDate); + connLostEntity.setExpireDate(validateDate); + connLostEntity.setId(IdUtil.getSnowflakeNextId()); + ioCodeLostEntityList.add(connLostEntity); } } - return relCodeBatchList; + return ioCodeLostEntityList; } } diff --git a/src/main/java/com/glxp/api/service/inout/impl/IoCodeTempService.java b/src/main/java/com/glxp/api/service/inout/impl/IoCodeTempService.java index 34bbd241..dc858479 100644 --- a/src/main/java/com/glxp/api/service/inout/impl/IoCodeTempService.java +++ b/src/main/java/com/glxp/api/service/inout/impl/IoCodeTempService.java @@ -298,29 +298,19 @@ public class IoCodeTempService { new QueryWrapper().last("limit 1") ); if (authCompany != null) { - AlihealthYljgLocaCodedetailReqeust alihealthYljgLocaCodedetailReqeust = new AlihealthYljgLocaCodedetailReqeust(); - alihealthYljgLocaCodedetailReqeust.setAppSecret(authCompany.getAppSecret()); AlihealthYljgCodedetailReqeust alihealthYljgCodedetailReqeust = new AlihealthYljgCodedetailReqeust(); - alihealthYljgCodedetailReqeust.setRef_ent_id(authCompany.getRefEntId()); alihealthYljgCodedetailReqeust.setCodes(code); - alihealthYljgCodedetailReqeust.setApp_key(authCompany.getAppId()); - alihealthYljgLocaCodedetailReqeust.setAlihealthYljgCodedetailReqeust(alihealthYljgCodedetailReqeust); - BaseResponse> response = alihealthYljgUtils.codedetail(alihealthYljgLocaCodedetailReqeust); + BaseResponse> response = alihealthYljgUtils.codedetail(alihealthYljgCodedetailReqeust); if (response.getCode() == 20000) { - List relCodeBatchList = response.getData(); - if (relCodeBatchList != null && relCodeBatchList.size() > 0) { - RelCodeBatch relCodeBatch = relCodeBatchList.get(0); - IoCodeLostEntity connLostEntity = new IoCodeLostEntity(); - connLostEntity.setId(IdUtil.getSnowflakeNextId()); - connLostEntity.setCode(relCodeBatch.getCurCode()); - connLostEntity.setBatchNo(relCodeBatch.getBatchNo()); - connLostEntity.setProduceDate(relCodeBatch.getMadeDate()); - connLostEntity.setExpireDate(relCodeBatch.getValidateDate()); - connLostEntity.setBatchNo(relCodeBatch.getBatchNo()); - codeLostService.saveOrUpdate(connLostEntity); - udiEntity.setBatchNo(connLostEntity.getBatchNo()); - udiEntity.setProduceDate(connLostEntity.getProduceDate()); - udiEntity.setExpireDate(connLostEntity.getExpireDate()); + List ioCodeLostEntityList = response.getData(); + if (ioCodeLostEntityList != null && ioCodeLostEntityList.size() > 0) { + IoCodeLostEntity ioCodeLostEntity = ioCodeLostEntityList.get(0); + + + codeLostService.saveOrUpdate(ioCodeLostEntity); + udiEntity.setBatchNo(ioCodeLostEntity.getBatchNo()); + udiEntity.setProduceDate(ioCodeLostEntity.getProduceDate()); + udiEntity.setExpireDate(ioCodeLostEntity.getExpireDate()); } } else { log.error("拉取阿里码明细访问失败===" + response.getMessage()); diff --git a/src/main/java/com/glxp/api/util/alihealth/AlihealthYljgUtils.java b/src/main/java/com/glxp/api/util/alihealth/AlihealthYljgUtils.java index b657fdaa..d79d2749 100644 --- a/src/main/java/com/glxp/api/util/alihealth/AlihealthYljgUtils.java +++ b/src/main/java/com/glxp/api/util/alihealth/AlihealthYljgUtils.java @@ -13,6 +13,7 @@ import com.glxp.api.entity.auth.AuthCompany; import com.glxp.api.entity.auth.CustomerInfoEntity; import com.glxp.api.entity.basic.BasicCorpEntity; import com.glxp.api.entity.collect.RelCodeBatch; +import com.glxp.api.entity.inout.IoCodeLostEntity; import com.glxp.api.req.alihealth.*; import com.glxp.api.req.alihealth.local.*; import com.glxp.api.res.alihealth.*; @@ -117,16 +118,20 @@ public class AlihealthYljgUtils { * @param reqeust * @return */ - public BaseResponse> codedetail(AlihealthYljgLocaCodedetailReqeust reqeust) { + public BaseResponse> codedetail(AlihealthYljgCodedetailReqeust reqeust) { + AuthCompany authCompany = authCompanyMapper.selectOne( + new QueryWrapper().last("limit 1") + ); + reqeust.setApp_key(authCompany.getAppId()); + reqeust.setRef_ent_id(authCompany.getRefEntId()); AlihealthYljgCodedetailResponse alihealthYljgCodedetailResponse = null; - AlihealthYljgCodedetailReqeust alihealthYljgCodedetailReqeust = reqeust.getAlihealthYljgCodedetailReqeust(); if (reqeust != null - && org.apache.commons.lang3.StringUtils.isNotEmpty(alihealthYljgCodedetailReqeust.getApp_key()) - && org.apache.commons.lang3.StringUtils.isNotEmpty(reqeust.getAppSecret()) + && org.apache.commons.lang3.StringUtils.isNotEmpty(authCompany.getAppId()) + && org.apache.commons.lang3.StringUtils.isNotEmpty(authCompany.getAppSecret()) ) { try { - Map map = alihealthUtils.disposeSign(alihealthYljgCodedetailReqeust, reqeust.getAppSecret()); + Map map = alihealthUtils.disposeSign(reqeust, authCompany.getAppSecret()); String json = HttpUtil.get(alihealthUrl, map); alihealthYljgCodedetailResponse = new AlihealthYljgCodedetailResponse(json); @@ -138,7 +143,7 @@ public class AlihealthYljgUtils { return ResultVOUtils.error("阿里健康接口调用失败===用户找不到或者key和秘钥为空"); } if (alihealthYljgCodedetailResponse.judgeCall()) { - return ResultVOUtils.success( alihealthYljgCodedetailResponse.disposeRelCodeBatch(reqeust.getErpId())); + return ResultVOUtils.success( alihealthYljgCodedetailResponse.disposeRelCodeBatch()); } else { return ResultVOUtils.error("阿里健康接口调用失败===" + alihealthYljgCodedetailResponse.getMsg_info()); From 1610a0657ff0fe44f6b627055166d5d1d07e4e09 Mon Sep 17 00:00:00 2001 From: qiuyt Date: Fri, 13 Dec 2024 18:38:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?1=E3=80=81=E6=9F=A5=E8=AF=A2=E7=A0=81?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../glxp/api/res/alihealth/AlihealthYljgCodedetailResponse.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/glxp/api/res/alihealth/AlihealthYljgCodedetailResponse.java b/src/main/java/com/glxp/api/res/alihealth/AlihealthYljgCodedetailResponse.java index 8391e8c9..1a0c8e90 100644 --- a/src/main/java/com/glxp/api/res/alihealth/AlihealthYljgCodedetailResponse.java +++ b/src/main/java/com/glxp/api/res/alihealth/AlihealthYljgCodedetailResponse.java @@ -82,6 +82,7 @@ public class AlihealthYljgCodedetailResponse extends AlihealthKytCommonParameter connLostEntity.setProduceDate(mabeDate); connLostEntity.setExpireDate(validateDate); connLostEntity.setId(IdUtil.getSnowflakeNextId()); + connLostEntity.setNameCode(FilterUdiUtils.getUdi(jsonObject.getStr("code")).getUdi()); ioCodeLostEntityList.add(connLostEntity); } }