1、阿里单据拉取参数(还差一些对照)

2、产品选入问题
dev_unify
qiuyt 7 months ago
parent 38f66bc445
commit d2c006cf43

@ -1,4 +1,4 @@
package com.glxp.api.entity.thrsys;
package com.glxp.api.entity.alihealth;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
@ -7,7 +7,7 @@ import lombok.Data;
import java.util.Date;
@Data
public class ThirdAliSearchbill {
public class AliKytSearchbill {
private String billType;
private String billCode;
private String fromUserId;

@ -0,0 +1,57 @@
package com.glxp.api.req.alihealth;
import com.glxp.api.req.alihealth.AlihealthKytCommonParametersReqeust;
import lombok.Data;
@Data
public class AlihealthLsydListupoutReqeust extends AlihealthKytCommonParametersReqeust {
/**
* ID
*/
private String ref_ent_id;
/**
*
*/
private String begin_date;
/**
*
*/
private String end_date;
/**
*
*/
private String from_user_id;
/**
*
*/
private String produce_batch_no;
/**
* ID
*/
private String drug_ent_base_info_id;
/**
*
*/
private String bill_type;
/**
*
*/
private String physic_type;
/**
*
*/
private String status;
/**
*
*/
private String bill_code;
private Integer cur_page;
private Integer page_size;
public AlihealthLsydListupoutReqeust(){
this.setMethod("alibaba.alihealth.drugtrace.top.lsyd.listupout");
}
}

@ -3,9 +3,7 @@ package com.glxp.api.res.alihealth;
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.thrsys.ThirdAliDrug;
import com.glxp.api.entity.thrsys.ThirdAliSearchbill;
import com.glxp.api.entity.alihealth.AliKytSearchbill;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
@ -40,37 +38,37 @@ public class AlihealthKytSearchbillResponse extends AlihealthKytCommonParameter
}
}
public List<ThirdAliSearchbill> disposeThirdAliSearchbill(String customerId){
List<ThirdAliSearchbill> list = new ArrayList<>();
public List<AliKytSearchbill> disposeThirdAliSearchbill(String customerId){
List<AliKytSearchbill> list = new ArrayList<>();
List<JSONObject> jsonArray = (List) this.getBill_chk_in_out_do();
if (jsonArray != null && jsonArray.size() > 0) {
for (JSONObject jsonObject : jsonArray) {
if (!Objects.isNull(jsonObject)) {
ThirdAliSearchbill thirdAliSearchbill = new ThirdAliSearchbill();
thirdAliSearchbill.setBillType(jsonObject.getStr("bill_type"));
thirdAliSearchbill.setBillCode(jsonObject.getStr("bill_code"));
thirdAliSearchbill.setFromUserId(jsonObject.getStr("from_user_id"));
thirdAliSearchbill.setRefUserName(jsonObject.getStr("ref_user_name"));;
thirdAliSearchbill.setRefUserId(jsonObject.getStr("ref_user_id"));
thirdAliSearchbill.setProduceDate(jsonObject.getStr("produce_date"));
thirdAliSearchbill.setUploadFileName(jsonObject.getStr("upload_file_name"));
thirdAliSearchbill.setFromUserName(jsonObject.getStr("from_user_name"));
thirdAliSearchbill.setToUserId(jsonObject.getStr("to_user_id"));
thirdAliSearchbill.setProduceEntId(jsonObject.getStr("produce_ent_id"));
thirdAliSearchbill.setBillTime(jsonObject.getStr("bill_time"));
thirdAliSearchbill.setUserRoleType(jsonObject.getStr("user_role_type"));
thirdAliSearchbill.setProcessDate(jsonObject.getStr("process_date"));
thirdAliSearchbill.setBillId(jsonObject.getStr("bill_id"));
thirdAliSearchbill.setToUserName(jsonObject.getStr("to_user_name"));
thirdAliSearchbill.setAgentUserName(jsonObject.getStr("agent_user_name"));
thirdAliSearchbill.setAgentRefUserId(jsonObject.getStr("agent_ref_user_id"));
thirdAliSearchbill.setBillTypeName(jsonObject.getStr("bill_type_name"));
thirdAliSearchbill.setToRefUserId(jsonObject.getStr("to_ref_user_id"));
thirdAliSearchbill.setFromRefUserId(jsonObject.getStr("from_ref_user_id"));
thirdAliSearchbill.setErpId("customerId");
thirdAliSearchbill.setCreateTime(new Date());
thirdAliSearchbill.setUpdateTime(new Date());
list.add(thirdAliSearchbill);
AliKytSearchbill aliKytSearchbill = new AliKytSearchbill();
aliKytSearchbill.setBillType(jsonObject.getStr("bill_type"));
aliKytSearchbill.setBillCode(jsonObject.getStr("bill_code"));
aliKytSearchbill.setFromUserId(jsonObject.getStr("from_user_id"));
aliKytSearchbill.setRefUserName(jsonObject.getStr("ref_user_name"));;
aliKytSearchbill.setRefUserId(jsonObject.getStr("ref_user_id"));
aliKytSearchbill.setProduceDate(jsonObject.getStr("produce_date"));
aliKytSearchbill.setUploadFileName(jsonObject.getStr("upload_file_name"));
aliKytSearchbill.setFromUserName(jsonObject.getStr("from_user_name"));
aliKytSearchbill.setToUserId(jsonObject.getStr("to_user_id"));
aliKytSearchbill.setProduceEntId(jsonObject.getStr("produce_ent_id"));
aliKytSearchbill.setBillTime(jsonObject.getStr("bill_time"));
aliKytSearchbill.setUserRoleType(jsonObject.getStr("user_role_type"));
aliKytSearchbill.setProcessDate(jsonObject.getStr("process_date"));
aliKytSearchbill.setBillId(jsonObject.getStr("bill_id"));
aliKytSearchbill.setToUserName(jsonObject.getStr("to_user_name"));
aliKytSearchbill.setAgentUserName(jsonObject.getStr("agent_user_name"));
aliKytSearchbill.setAgentRefUserId(jsonObject.getStr("agent_ref_user_id"));
aliKytSearchbill.setBillTypeName(jsonObject.getStr("bill_type_name"));
aliKytSearchbill.setToRefUserId(jsonObject.getStr("to_ref_user_id"));
aliKytSearchbill.setFromRefUserId(jsonObject.getStr("from_ref_user_id"));
aliKytSearchbill.setErpId(customerId);
aliKytSearchbill.setCreateTime(new Date());
aliKytSearchbill.setUpdateTime(new Date());
list.add(aliKytSearchbill);
}
}

@ -0,0 +1,43 @@
package com.glxp.api.res.alihealth;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import java.util.Objects;
@Data
public class AlihealthLsydListupoutResponse extends AlihealthKytCommonParametersResponse {
private JSONArray bill_up_out_detail_do;
private Integer total_num;
public AlihealthLsydListupoutResponse(String json) {
// 初始化请求的值
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(json);
JSONObject jsonObjectResult = null;
for (String s : jsonObject.keySet()) {
jsonObjectResult = jsonObject.getJSONObject(s).getJSONObject("result");
}
AlihealthKytCommonParametersResponse alihealthKytCommonParametersResponse = JSONUtil.toBean(jsonObjectResult.toString(),
AlihealthKytCommonParametersResponse.class);
BeanUtils.copyProperties(alihealthKytCommonParametersResponse, this);
if (StringUtils.isNotEmpty(this.getMsg_info())
&& this.getMsg_info().equals("调用成功")
) {
this.disposeResult(jsonObjectResult);
}
}
public void disposeResult(JSONObject jsonObjectResult) {
JSONObject jsonObjectModel = jsonObjectResult.getJSONObject("model");
if (!Objects.isNull(jsonObjectModel)) {
this.setTotal_num(jsonObjectModel.getInt("total_num"));
this.setBill_up_out_detail_do(jsonObjectModel.getJSONObject("result_list").getJSONArray("bill_up_out_detail_do"));
}
}
}

@ -418,18 +418,7 @@ public class UdiContrastService {
for (int i = 0; i < thirdAliDrugList.size(); i++) {
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());
@ -447,14 +436,25 @@ public class UdiContrastService {
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());
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);
}
if (IntUtil.value(thirdAliDrug.getPackLevel()) == 1) {
udiProductEntity.setXjdw(ybDrug.getMinUnit());
if (DimaUtil.trMinCount(thirdAliDrug.getBzgg()) != null) {

@ -5,7 +5,7 @@ import cn.hutool.http.HttpUtil;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.entity.thrsys.ThirdAliDrug;
import com.glxp.api.entity.thrsys.ThirdAliSearchbill;
import com.glxp.api.entity.alihealth.AliKytSearchbill;
import com.glxp.api.req.alihealth.AlihealthKytCommonParametersReqeust;
import com.glxp.api.req.alihealth.AlihealthKytDrugrescodeReqeust;
import com.glxp.api.req.alihealth.AlihealthKytSearchbillReqeust;
@ -92,7 +92,7 @@ public class AlihealthUtils {
return ResultVOUtils.error("阿里健康接口调用失败===用户找不到或者key和秘钥为空");
}
if (alihealthKytDrugrescodeResponse.judgeCall()) {
List<ThirdAliSearchbill> list = alihealthKytDrugrescodeResponse.disposeThirdAliSearchbill(alihealthKytThirdAliSearchbillInsertReqeust.getErpId());
List<AliKytSearchbill> list = alihealthKytDrugrescodeResponse.disposeThirdAliSearchbill(alihealthKytThirdAliSearchbillInsertReqeust.getErpId());
return ResultVOUtils.success(list);
} else {
return ResultVOUtils.error("阿里健康接口调用失败===" + alihealthKytDrugrescodeResponse.getMsg_info());

Loading…
Cancel
Save