Merge remote-tracking branch 'origin/dev_drug' into dev_drug

dev_unify
yewj 4 months ago
commit 72eca2dcbc

@ -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,44 @@ public class AlihealthYljgCodedetailResponse extends AlihealthKytCommonParameter
// this.setBill_up_out_detail_do(jsonObjectModel.getJSONObject("result_list").getJSONArray("bill_up_out_detail_do"));
}
}
public List<RelCodeBatch> disposeRelCodeBatch(String customerId){
List<RelCodeBatch> relCodeBatchList =new ArrayList<>();
public List<IoCodeLostEntity> disposeRelCodeBatch(){
List<IoCodeLostEntity> ioCodeLostEntityList = new ArrayList();
List<JSONObject> 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<JSONObject> 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());
connLostEntity.setNameCode(FilterUdiUtils.getUdi(jsonObject.getStr("code")).getUdi());
ioCodeLostEntityList.add(connLostEntity);
}
}
return relCodeBatchList;
return ioCodeLostEntityList;
}
}

@ -298,29 +298,19 @@ public class IoCodeTempService {
new QueryWrapper<AuthCompany>().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<List<RelCodeBatch>> response = alihealthYljgUtils.codedetail(alihealthYljgLocaCodedetailReqeust);
BaseResponse<List<IoCodeLostEntity>> response = alihealthYljgUtils.codedetail(alihealthYljgCodedetailReqeust);
if (response.getCode() == 20000) {
List<RelCodeBatch> 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<IoCodeLostEntity> 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());

@ -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<List<RelCodeBatch>> codedetail(AlihealthYljgLocaCodedetailReqeust reqeust) {
public BaseResponse<List<IoCodeLostEntity>> codedetail(AlihealthYljgCodedetailReqeust reqeust) {
AuthCompany authCompany = authCompanyMapper.selectOne(
new QueryWrapper<AuthCompany>().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());

Loading…
Cancel
Save