上传采购单3502 湖里优化逻辑复制过来 (并且把没试过的医保接口配置匹配先注释了 怕自动上传重新问题)

yxfydrug
qiuyt 2 months ago
parent b2de04057b
commit a158fb36bb

@ -80,10 +80,11 @@ import java.util.stream.Collectors;
@Slf4j
@Service(value = "100011HttpClient")
public class CtqyyClient extends CommonHttpClient {
private final String[] buyType_3501 = {"24"};
private final String[] buyType_3502 = {"SC72889572632899", "6", "5", "4", "1", "16", "12", "28", "35"};
// 目前只有3505调通过上传医保 其他先不配置怕自动上传出问题
private final String[] buyType_3501 = {};
private final String[] buyType_3502 = { };
private final String[] buyType_3505 = {"QXCF001", "YPCF002"};
private final String[] buyType_3506 = {"YPTH001"};
private final String[] buyType_3506 = {};
@Resource
AuthWarehouseUserMapper authWarehouseUserMapper;
@Resource
@ -2090,9 +2091,12 @@ public class CtqyyClient extends CommonHttpClient {
if (StrUtil.isNotBlank(code)) {
List<RelCodeDetail> relCodeDetailList = relCodeDetailService.getAllNext(code);
if (relCodeDetailList != null && relCodeDetailList.size() > 0) {
DrugInfoRequest request = new DrugInfoRequest();
request.setDrug_trac_codg(code);
drugTraceList.add(request);
for (RelCodeDetail relCodeDetail : relCodeDetailList) {
DrugInfoRequest request = new DrugInfoRequest();
request.setDrug_trac_codg(relCodeDetail.getCurCode());
drugTraceList.add(request);
}
}
}
}
@ -2174,9 +2178,12 @@ public class CtqyyClient extends CommonHttpClient {
if (StrUtil.isNotBlank(code)) {
List<RelCodeDetail> relCodeDetailList = relCodeDetailService.getAllNext(code);
if (relCodeDetailList != null && relCodeDetailList.size() > 0) {
DrugInfoRequest request = new DrugInfoRequest();
request.setDrug_trac_codg(code);
drugTraceList.add(request);
for (RelCodeDetail relCodeDetail : relCodeDetailList) {
DrugInfoRequest request = new DrugInfoRequest();
request.setDrug_trac_codg(relCodeDetail.getCurCode());
drugTraceList.add(request);
}
}
}
}
@ -2208,46 +2215,73 @@ public class CtqyyClient extends CommonHttpClient {
public BaseResponse optionUploadCollectOrder3502(IoCollectOrder ioCollectOrder) {
// List<CollectOrderBizResponse> bizList = ioCollectOrder.getCollectOrderBizResponseList();
List<CollectOrderBizResponse> bizList = ioCollectOrder.getCollectOrderBizResponseList();
if (CollUtil.isNotEmpty(bizList)) {
List<CollectOrderBizResponse> collectOrderBizResponseList = ioCollectOrder.getCollectOrderBizResponseList();
List<Kcbg3502Request> kcbg3502Requests = new ArrayList<>();
for (CollectOrderBizResponse collectOrderBizResponse : collectOrderBizResponseList) {
BasicUdirelEntity basicUdirelEntity = basicUdirelDao.selectById(collectOrderBizResponse.getRelId());
for (CollectOrderBizResponse item : bizList) {
BasicUdirelEntity basicUdirelEntity = basicUdirelDao.selectById(item.getRelId());
String itemCode = basicUdirelEntity.getMainId();
for (CollectOrderBizResponse item : bizList) {
if (item.getYbbm().equals(itemCode)) {
String[] codes = collectOrderBizResponse.getFinishUdiCode().split(",");
List<DrugInfoRequest> drugTraceList = new ArrayList<>();
// 遍历fruits数组
for (String code : codes) {
if (StrUtil.isNotBlank(code)) {
List<RelCodeDetail> relCodeDetailList = relCodeDetailService.getAllNext(code);
if (relCodeDetailList != null && relCodeDetailList.size() > 0) {
DrugInfoRequest request = new DrugInfoRequest();
request.setDrug_trac_codg(code);
drugTraceList.add(request);
}
// for (CollectOrderBizResponse item : collectOrderBizResponseList) {
// if (item.getYbbm().equals(itemCode)) {
String[] codes = item.getFinishUdiCode().split(",");
String nameCode = item.getNameCode();
BasicProductsEntity basicProductsEntity = basicProductsDao.selectOne(
new QueryWrapper<BasicProductsEntity>().eq("nameCode",nameCode).last("limit 1")
);
if(Objects.isNull(basicProductsEntity)){
return ResultVOUtils.error(500,"产品为空请检查");
}
Integer packLevel = Integer.valueOf(basicProductsEntity.getPackLevel());
List<DrugInfoRequest> drugTraceList = new ArrayList<>();
List<String> codeList = new ArrayList<>();
// 遍历fruits数组
for (String code : codes) {
if (StrUtil.isNotBlank(code)) {
List<RelCodeDetail> relCodeDetailList = relCodeDetailService.getAllNext(code);
if (relCodeDetailList != null && relCodeDetailList.size() > 0) {
for (RelCodeDetail relCodeDetail : relCodeDetailList) {
codeList.add(relCodeDetail.getCurCode());
}
}
// 级别为2的产品码不可能只有一个
if(packLevel >1 && codeList.size() <2){
return ResultVOUtils.error(500,"大包装码关联关系拉取不到请检查"+code);
}
// TODO: 2024/9/10 字段未完全正确对应
Kcbg3502Request kcbg3502Request = Kcbg3502Request.builder()
.med_list_codg(item.getYbbm())
.inv_chg_type("108")
.fixmedins_hilist_id(item.getThrCode())
.fixmedins_hilist_name(item.getCpmctymc())
.fixmedins_bchno("0000")
.pric("0")
.cnt(item.getActCount())
.rx_flag("1")
.inv_chg_time(item.getUpdateTime())
.inv_chg_opter_name(ioCollectOrder.getCreateUser())
.memo(item.getRemark())
.trdn_flag("0")
.drugtracinfo(drugTraceList).build();
kcbg3502Requests.add(kcbg3502Request);
}
}
Set<String> set = new HashSet(codeList);
for (String code : set) {
DrugInfoRequest request = new DrugInfoRequest();
request.setDrug_trac_codg(code);
drugTraceList.add(request);
}
if(CollUtil.isEmpty(drugTraceList)){
return ResultVOUtils.error(500,"单据要传的码为空请检查");
}
// TODO: 2024/9/10 字段未完全正确对应
Kcbg3502Request kcbg3502Request = Kcbg3502Request.builder()
.med_list_codg(item.getYbbm())
.inv_chg_type("108")
.fixmedins_hilist_id(item.getThrCode())
.fixmedins_hilist_name(item.getCpmctymc())
.fixmedins_bchno("0000")
.pric("0")
.cnt(item.getActCount())
.rx_flag("1")
.inv_chg_time(item.getUpdateTime())
.inv_chg_opter_name(ioCollectOrder.getCreateUser())
.memo(item.getRemark())
.trdn_flag("0")
.drugtracinfo(drugTraceList).build();
kcbg3502Requests.add(kcbg3502Request);
// }
// }
}
BaseKcbg3502Request baseKcbg3502Request = new BaseKcbg3502Request();
baseKcbg3502Request.setInvinfoDetail(kcbg3502Requests);
@ -2281,9 +2315,12 @@ public class CtqyyClient extends CommonHttpClient {
if (StrUtil.isNotBlank(code)) {
List<RelCodeDetail> relCodeDetailList = relCodeDetailService.getAllNext(code);
if (relCodeDetailList != null && relCodeDetailList.size() > 0) {
DrugInfoRequest request = new DrugInfoRequest();
request.setDrug_trac_codg(code);
drugTraceList.add(request);
for (RelCodeDetail relCodeDetail : relCodeDetailList) {
DrugInfoRequest request = new DrugInfoRequest();
request.setDrug_trac_codg(relCodeDetail.getCurCode());
drugTraceList.add(request);
}
}
}
}

@ -21,17 +21,22 @@ public class RelCodeDetailService extends ServiceImpl<RelCodeDetailMapper, RelCo
* @return
*/
public List<RelCodeDetail> getAllNext(String code) {
RelCodeDetail relCodeDetail = this.baseMapper.selectOne(
new LambdaQueryWrapper<RelCodeDetail>().eq(RelCodeDetail::getCurCode, code)
);
if(Objects.isNull(relCodeDetail)){
relCodeDetail = new RelCodeDetail();
relCodeDetail.setCurCode(code);
}
// RelCodeDetail relCodeDetail = this.baseMapper.selectOne(
// new LambdaQueryWrapper<RelCodeDetail>().eq(RelCodeDetail::getCurCode, code)
// );
// if(Objects.isNull(relCodeDetail)){
// relCodeDetail = new RelCodeDetail();
// relCodeDetail.setCurCode(code);
// }
List<RelCodeDetail> list = new ArrayList<>();
list.add(relCodeDetail);
// list.add(relCodeDetail);
fetchAllChildren(code, list);
if (CollUtil.isEmpty(list)) {
RelCodeDetail relCodeDetail = new RelCodeDetail();
relCodeDetail.setCurCode(code);
list.add(relCodeDetail);
}
return list;
}

@ -78,13 +78,20 @@ public class YbClient {
log.error("【" + apiNo + "】医保接口请求参数:" + JSONObject.toJSONString(req));
ChsMedicalResponse resp = client.execute(req);
log.error("【" + apiNo + "】医保接口返回结果:" + JSONObject.toJSONString(resp));
if(resp.getIsSuccess() == true
&& org.apache.commons.lang3.StringUtils.isNotEmpty(resp.getAppid())
&& "0".equals(resp.getInfCode())
&& "成功".equals(resp.getErrMsg())
){
return ResultVOUtils.success("【" + apiNo + "】上传医保成功");
if(apiNo.equals("3505A") && "成功".equals(resp.getErrMsg())){
return ResultVOUtils.success("【" + apiNo + "】上传医保成功");
}else if(apiNo.equals("3502A") && org.apache.commons.lang3.StringUtils.isEmpty(resp.getErrMsg())){
return ResultVOUtils.success("【" + apiNo + "】上传医保成功");
}
}

Loading…
Cancel
Save