feat: 阿里采购送货单的业务对接

dev_unify
chenhc 4 months ago
parent afe12bf5ff
commit e7a5145063

@ -65,6 +65,7 @@ import com.glxp.api.util.GennerOrderUtils;
import com.glxp.api.util.IntUtil;
import com.glxp.api.util.OrderNoTypeBean;
import com.glxp.api.util.udi.FilterUdiUtils;
import com.glxp.api.util.udi.UdiCalCountUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult;
@ -689,6 +690,11 @@ public class IoOrderDetailBizController extends BaseController {
AlihealthBusService alihealthBusService;
@Resource
UdiRelevanceDao udiRelevanceDao;
@Resource
IoCodeLostService ioCodeLostService;
@Resource
UdiCalCountUtil udiCalCountUtil;
//录入阿里送货单的业务单据详情
@AuthRuleAnnotation("")
@ -722,65 +728,99 @@ public class IoOrderDetailBizController extends BaseController {
return ResultVOUtils.error("单据码明细为空!");
}
String code = aliYljgBillDetailDrugCodeList.get(0).getCode();
if (StrUtil.isEmpty(code)) {
return ResultVOUtils.error("单据码为空!");
}
UdiEntity drugInfo = FilterUdiUtils.getDrugInfo(code);
if (drugInfo == null) {
return ResultVOUtils.error("单据码解析药品信息错误!");
}
//获取药品信息
String nameCode = drugInfo.getUdi();
if (StrUtil.isEmpty(nameCode)) {
return ResultVOUtils.error("单据码解析药品标识错误!");
}
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
filterUdiRelRequest.setNameCode(nameCode);
List<UdiRelevanceResponse> udiRelevanceResponses = udiRelevanceDao.filterUdiRelevance(filterUdiRelRequest);
if (CollUtil.isEmpty(udiRelevanceResponses)) {
return ResultVOUtils.error("未通过药品标识获取详情信息!");
}
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceResponses.get(0);
//1、直接模拟增加biz一行
addBizProductReqeust.setProductId(String.valueOf(udiRelevanceResponse.getProductId()));
addBizProductReqeust.setRelId(udiRelevanceResponse.getRelId());
addBizProductReqeust.setZczbhhzbapzbh(udiRelevanceResponse.getZczbhhzbapzbh());
addBizProductReqeust.setSupId(udiRelevanceResponse.getSupId());
addBizProductReqeust.setDatas(null);
IoOrderEntity ioOrderEntity = addBizProductReqeust.getOrderEntity();
for (int i = 0; i < aliYljgBillDetailDrugList.size(); i++) {
AliYljgBillDetailDrug aliYljgBillDetailDrug = aliYljgBillDetailDrugList.get(i);
String code = aliYljgBillDetailDrug.getAliYljgBillDetailDrugCodeList().get(0).getCode();
if (StrUtil.isEmpty(code)) {
return ResultVOUtils.error("单据码为空!");
}
UdiEntity drugInfo = FilterUdiUtils.getDrugInfo(code);
if (drugInfo == null) {
return ResultVOUtils.error("单据码解析药品信息错误!");
}
//获取药品信息
String nameCode = drugInfo.getUdi();
if (StrUtil.isEmpty(nameCode)) {
return ResultVOUtils.error("单据码解析药品标识错误!");
}
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
filterUdiRelRequest.setNameCode(nameCode);
List<UdiRelevanceResponse> udiRelevanceResponses = udiRelevanceDao.filterUdiRelevance(filterUdiRelRequest);
if (CollUtil.isEmpty(udiRelevanceResponses)) {
return ResultVOUtils.error("未通过药品标识获取详情信息!");
}
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceResponses.get(0);
List<AliYljgBillDetailDrugCode> aliYljgBillDetailDrugCodeList1 = aliYljgBillDetailDrug.getAliYljgBillDetailDrugCodeList();
//1、直接模拟增加biz一行
addBizProductReqeust.setProductId(String.valueOf(udiRelevanceResponse.getProductId()));
addBizProductReqeust.setRelId(udiRelevanceResponse.getRelId());
addBizProductReqeust.setZczbhhzbapzbh(udiRelevanceResponse.getZczbhhzbapzbh());
addBizProductReqeust.setSupId(udiRelevanceResponse.getSupId());
addBizProductReqeust.setDatas(null);
addBizProductReqeust.setCount(aliYljgBillDetailDrugCodeList1.size() * udiCalCountUtil.getCirActCount(udiRelevanceResponse));
addBizProductReqeust.setBatchNo(aliYljgBillDetailDrug.getProduceBatchNo());
addBizProductReqeust.setProductDate(aliYljgBillDetailDrug.getProduceDate());
addBizProductReqeust.setExpireDate(aliYljgBillDetailDrug.getProduceDate());
addBizProductReqeust.setOrderEntity(ioOrderEntity);
if (StrUtil.isNotEmpty(aliYljgBillDetailDrug.getProduceDate())){
addBizProductReqeust.setProductDate(aliYljgBillDetailDrug.getProduceDate().substring(2).replace(" 00:00:00", "").replace("-", ""));
}
if (StrUtil.isNotEmpty(aliYljgBillDetailDrug.getValidEndDate())){
addBizProductReqeust.setExpireDate(aliYljgBillDetailDrug.getValidEndDate().substring(2).replace(" 00:00:00", "").replace("-", ""));
}
if (i == 0) {
addBizProductReqeust.setOrderEntity(ioOrderEntity);
}
BaseResponse response = orderDetailBizService.addBizProduct(addBizProductReqeust);
if (response.getCode() != 20000) {
return response;
}
if (i == 0) {
ioOrderEntity = JSONObject.parseObject(JSONObject.toJSONString(response.getData()), IoOrderEntity.class);
addBizProductReqeust.setOrderEntity(ioOrderEntity);
}
}
AddOrderRequest addOrderRequest = new AddOrderRequest();
BeanUtils.copyProperties(ioOrderEntity, addOrderRequest);
for (int i = 0; i < aliYljgBillDetailDrugCodeList.size(); i++) {
AddOrderRequest addOrderRequest = new AddOrderRequest();
BeanUtils.copyProperties(ioOrderEntity, addOrderRequest);
for (int j = 0; j < aliYljgBillDetailDrugCodeList1.size(); j++) {
AliYljgBillDetailDrugCode aliYljgBillDetailDrugCode = aliYljgBillDetailDrugCodeList.get(j);
addOrderRequest.setCode(aliYljgBillDetailDrugCode.getCode());
IoCodeLostEntity codeLostEntity = ioCodeLostService.findByCode(code);
if (codeLostEntity == null) {
codeLostEntity = new IoCodeLostEntity();
codeLostEntity.setId(IdUtil.getSnowflakeNextId());
codeLostEntity.setNameCode(nameCode);
codeLostEntity.setCode(code);
codeLostEntity.setBatchNo(aliYljgBillDetailDrug.getProduceBatchNo());
if (StrUtil.isNotEmpty(aliYljgBillDetailDrug.getProduceDate())){
codeLostEntity.setProduceDate(aliYljgBillDetailDrug.getProduceDate().substring(2).replace(" 00:00:00", "").replace("-", ""));
}
if (StrUtil.isNotEmpty(aliYljgBillDetailDrug.getValidEndDate())){
codeLostEntity.setExpireDate(aliYljgBillDetailDrug.getValidEndDate().substring(2).replace(" 00:00:00", "").replace("-", ""));
}
}else {
codeLostEntity.setBatchNo(aliYljgBillDetailDrug.getProduceBatchNo());
if (StrUtil.isNotEmpty(aliYljgBillDetailDrug.getProduceDate())){
codeLostEntity.setProduceDate(aliYljgBillDetailDrug.getProduceDate().substring(2).replace(" 00:00:00", "").replace("-", ""));
}
if (StrUtil.isNotEmpty(aliYljgBillDetailDrug.getValidEndDate())){
codeLostEntity.setExpireDate(aliYljgBillDetailDrug.getValidEndDate().substring(2).replace(" 00:00:00", "").replace("-", ""));
}
}
ioCodeLostService.insertOrUpdate(codeLostEntity);
// IoCodeLostEntity ioCodeLostEntity = new IoCodeLostEntity();
// ioCodeLostEntity.set
// todo 补三期进扫码补齐表
AliYljgBillDetailDrugCode aliYljgBillDetailDrugCode = aliYljgBillDetailDrugCodeList.get(i);
addOrderRequest.setCode(aliYljgBillDetailDrugCode.getCode());
BaseResponse response = ioCodeTempService.addDrugOrderWeb(addOrderRequest);
if (response.getCode() != 20000) {
return response;
BaseResponse response2 = ioCodeTempService.addDrugOrderWeb(addOrderRequest);
if (response2.getCode() != 20000) {
return response2;
}
}
}

@ -21,6 +21,7 @@ public class AddBizProductReqeust {
private String batchNo;
private String productDate;
private String expireDate;
private Integer count;
List<AddBizProductReqeust> datas; //多选添加
AliYljgSearchbill aliData; //多选添加

@ -442,6 +442,8 @@ public class IoOrderDetailBizServiceImpl implements IoOrderDetailBizService {
ioOrderDetailBizEntity.setExpireDate(item.getExpireDate());
ioOrderDetailBizEntity.setBatchNo(item.getBatchNo());
ioOrderDetailBizEntity.setSupId(item.getSupId());
if (item.getCount() != null) ioOrderDetailBizEntity.setCount(item.getCount());
this.insert(ioOrderDetailBizEntity);
}

Loading…
Cancel
Save