|
|
|
@ -1,10 +1,12 @@
|
|
|
|
|
package com.glxp.mipsdl.client.dsxyy;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.util.ReflectUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
|
import com.alibaba.fastjson2.TypeReference;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
@ -45,6 +47,8 @@ import com.glxp.mipsdl.req.post.PostThrCorpRequest;
|
|
|
|
|
import com.glxp.mipsdl.req.post.PostThrInvProductsRequest;
|
|
|
|
|
import com.glxp.mipsdl.req.post.PostThrProductsRequest;
|
|
|
|
|
import com.glxp.mipsdl.res.BaseResponse;
|
|
|
|
|
import com.glxp.mipsdl.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.mipsdl.res.udiwms.ThrProductsResponse;
|
|
|
|
|
import com.glxp.mipsdl.service.auth.AuthWarehouseService;
|
|
|
|
|
import com.glxp.mipsdl.service.order.OrderUploadLogService;
|
|
|
|
|
import com.glxp.mipsdl.service.thrsys.ThrCorpService;
|
|
|
|
@ -57,6 +61,7 @@ import javax.annotation.Resource;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@ -109,6 +114,8 @@ public class DsxyyClient extends CommonHttpClient {
|
|
|
|
|
private OrderUploadLogService orderUploadLogService;
|
|
|
|
|
@Resource
|
|
|
|
|
private ThrOrderUploadBustypesMapper thrOrderUploadBustypesMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
ThrCorpDao thrCorpDao;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse getUnit(UdiwmsUnitRequest udiwmsUnitRequest) {
|
|
|
|
@ -124,7 +131,23 @@ public class DsxyyClient extends CommonHttpClient {
|
|
|
|
|
DsProductRequest dsProductRequest = new DsProductRequest();
|
|
|
|
|
BeanUtil.copyProperties(udiwmsProductRequest, dsProductRequest);
|
|
|
|
|
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_PI_QUERY_URL), dsProductRequest);
|
|
|
|
|
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
|
|
|
|
|
|
|
|
|
|
BaseResponse<PageSimpleResponse<ThrProductsResponse>> baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ThrProductsResponse>>>() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 过滤西药库产品
|
|
|
|
|
if (CollUtil.isNotEmpty(baseResponse.getData().getList())) {
|
|
|
|
|
Iterator<ThrProductsResponse> iterator = baseResponse.getData().getList().iterator();
|
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
|
ThrProductsResponse item = iterator.next();
|
|
|
|
|
if (item.getRemark() != null && item.getRemark().contains("西药库")) {
|
|
|
|
|
iterator.remove();
|
|
|
|
|
baseResponse.getData().setTotal(-555l);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -210,6 +233,16 @@ public class DsxyyClient extends CommonHttpClient {
|
|
|
|
|
if (basicCorpEntity != null) {
|
|
|
|
|
dsOrderRequest.setCorpId(basicCorpEntity.getThirdId());
|
|
|
|
|
dsOrderRequest.setCorpName(basicCorpEntity.getName());
|
|
|
|
|
List<ThrCorpEntity> thrCorpEntities = thrCorpDao.selectList(new QueryWrapper<ThrCorpEntity>().eq("name", basicCorpEntity.getThirdName()));
|
|
|
|
|
if (CollUtil.isNotEmpty(thrCorpEntities)) {
|
|
|
|
|
for (ThrCorpEntity temp : thrCorpEntities) {
|
|
|
|
|
if (StrUtil.isNotEmpty(temp.getKfdm()) && temp.getKfdm().equals(udiwmsOrderRequest.getLocInvCode())) {
|
|
|
|
|
udiwmsOrderRequest.setCorpId(temp.getUnitId()); //往来单位编码,需转换为第三方系统的ID
|
|
|
|
|
udiwmsOrderRequest.setCorpName(temp.getName()); //往来单位名称,需转换为第三方系统的名称
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("code", udiwmsOrderRequest.getCorpId()));
|
|
|
|
|
try {
|
|
|
|
@ -234,12 +267,25 @@ public class DsxyyClient extends CommonHttpClient {
|
|
|
|
|
if (null != basicCorpEntity) {
|
|
|
|
|
dsOrderRequest.setCorpId(basicCorpEntity.getThirdId());
|
|
|
|
|
dsOrderRequest.setCorpName(basicCorpEntity.getName());
|
|
|
|
|
|
|
|
|
|
List<ThrCorpEntity> thrCorpEntities = thrCorpDao.selectList(new QueryWrapper<ThrCorpEntity>().eq("name", basicCorpEntity.getThirdName()));
|
|
|
|
|
if (CollUtil.isNotEmpty(thrCorpEntities)) {
|
|
|
|
|
for (ThrCorpEntity temp : thrCorpEntities) {
|
|
|
|
|
if (StrUtil.isNotEmpty(temp.getKfdm()) && temp.getKfdm().equals(udiwmsOrderRequest.getLocInvCode())) {
|
|
|
|
|
udiwmsOrderRequest.setCorpId(temp.getUnitId()); //往来单位编码,需转换为第三方系统的ID
|
|
|
|
|
udiwmsOrderRequest.setCorpName(temp.getName()); //往来单位名称,需转换为第三方系统的名称
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
String msg = "查询单据对应的第三方往来单位信息异常";
|
|
|
|
|
orderUploadLogService.updateLocalErr(orderEntity, msg);
|
|
|
|
|
log.error("----单据提交-----" + orderEntity.getBillNo() + msg);
|
|
|
|
|
return ResultVOUtils.error(500, msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// //查询仓库信息
|
|
|
|
|