feat: 网络对接优化
parent
aafe6c1cbb
commit
440876d529
@ -1,145 +0,0 @@
|
||||
package com.glxp.api.httpClient;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.constant.ConstantStatus;
|
||||
import com.glxp.api.entity.thrsys.ThrSystemEntity;
|
||||
import com.glxp.api.req.thrsys.FilterThrOrderRequest;
|
||||
import com.glxp.api.res.PageSimpleResponse;
|
||||
import com.glxp.api.res.thrsys.ThrErpOrderResponse;
|
||||
import com.glxp.api.res.thrsys.ThrOrderResponse;
|
||||
import com.glxp.api.service.thrsys.ThrSystemService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 获取ERP出入库单据
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ErpOrderClient {
|
||||
|
||||
@Autowired
|
||||
private ThrSystemService thrSystemService;
|
||||
@Resource
|
||||
HttpOkClient httpOkClient;
|
||||
|
||||
public List<ThrOrderResponse> getErpOrder(String url, List<String> billCodes, String action) {
|
||||
List<ThrOrderResponse> erpOrderEntities = new ArrayList<>();
|
||||
if (billCodes != null && billCodes.size() > 0) {
|
||||
for (int i = 0; i < billCodes.size(); i++) {
|
||||
List<ThrOrderResponse> ThrErpOrderResponses = getErpOrder(url, Arrays.asList(billCodes.get(i)), action);
|
||||
if (ThrErpOrderResponses != null) {
|
||||
erpOrderEntities.addAll(ThrErpOrderResponses);
|
||||
}
|
||||
}
|
||||
}
|
||||
return erpOrderEntities;
|
||||
}
|
||||
|
||||
public BaseResponse<PageSimpleResponse<ThrOrderResponse>> getThrOrderResponse(FilterThrOrderRequest filterOrderRequest) {
|
||||
|
||||
//查询第三方服务授权参数
|
||||
ThrSystemEntity thrSystemEntity = thrSystemService.selectByThirdId("thirdId");
|
||||
String url = thrSystemEntity.getThridUrl() + "/udiwms/erp/getOrders";
|
||||
String response = httpOkClient.uCloudPost(url, filterOrderRequest, thrSystemEntity);
|
||||
try {
|
||||
BaseResponse<PageSimpleResponse<ThrOrderResponse>> responseBaseResponse =
|
||||
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ThrOrderResponse>>>() {
|
||||
});
|
||||
return responseBaseResponse;
|
||||
} catch (Exception e) {
|
||||
log.error("获取订单数据异常", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<ThrErpOrderResponse> getErpOrder(FilterThrOrderRequest filterOrderRequest) {
|
||||
try {
|
||||
BaseResponse<PageSimpleResponse<ThrOrderResponse>> responseBaseResponse = getThrOrderResponse(filterOrderRequest);
|
||||
List<ThrOrderResponse> purchaseinResponseList = responseBaseResponse.getData().getList();
|
||||
if (purchaseinResponseList != null && purchaseinResponseList.size() > 0) {
|
||||
List<ThrErpOrderResponse> erpOrderEntities = new ArrayList<>();
|
||||
for (ThrOrderResponse ThrOrderResponse : purchaseinResponseList) {
|
||||
for (ThrOrderResponse.SubErpOrder subPurchase : ThrOrderResponse.getSubErpOrders()) {
|
||||
ThrErpOrderResponse ThrErpOrderResponse = new ThrErpOrderResponse();
|
||||
ThrErpOrderResponse.setErpOrderId(ThrOrderResponse.getBillNo());
|
||||
ThrErpOrderResponse.setCompanyid(ThrOrderResponse.getCorpId());
|
||||
ThrErpOrderResponse.setCompanyname(ThrOrderResponse.getCorpName());
|
||||
ThrErpOrderResponse.setCredate(ThrOrderResponse.getBilldate());
|
||||
ThrErpOrderResponse.setGoodsid(subPurchase.getProductId());
|
||||
ThrErpOrderResponse.setGoodsname(subPurchase.getProductName());
|
||||
ThrErpOrderResponse.setBatchNo(subPurchase.getBatchNo());
|
||||
ThrErpOrderResponse.setProductDate(subPurchase.getProductDate());
|
||||
ThrErpOrderResponse.setExpireDate(subPurchase.getExpireDate());
|
||||
ThrErpOrderResponse.setErpCount(subPurchase.getCount());
|
||||
ThrErpOrderResponse.setReCount(subPurchase.getReCount());
|
||||
ThrErpOrderResponse.setOriginType(ThrOrderResponse.getOriginType());
|
||||
ThrErpOrderResponse.setGoodsunit(subPurchase.getSpec());
|
||||
ThrErpOrderResponse.setOrderFromType(ConstantStatus.SORDER_FROM_ONLINE);
|
||||
erpOrderEntities.add(ThrErpOrderResponse);
|
||||
}
|
||||
}
|
||||
return erpOrderEntities;
|
||||
}
|
||||
} catch (
|
||||
Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// public BaseResponse submitOrder(UdiwmsOrderRequest udiwmsOrderRequest) {
|
||||
// BasicThirdSysEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(udiwmsOrderRequest.getThirdSys());
|
||||
// String url = basicThirdSysEntity.getThridUrl() + "/udiwms/erp/submitOrders";
|
||||
// String response = httpOkClient.uCloudPost(url, udiwmsOrderRequest);
|
||||
// try {
|
||||
// BaseResponse<PageSimpleResponse<ThrOrderResponse>> responseBaseResponse =
|
||||
// JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ThrOrderResponse>>>() {
|
||||
// });
|
||||
// return responseBaseResponse;
|
||||
// } catch (Exception e) {
|
||||
// log.error("获取订单数据异常", e);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
|
||||
// public BaseResponse postBill(Map<String, List<ThrErpOrderResponse>> postMap, String billAction, String uploadUrl, String thirdSysFk) {
|
||||
// ERPPostBillRequest erpPostBillRequest = new ERPPostBillRequest();
|
||||
// erpPostBillRequest.setPostMap(postMap);
|
||||
// erpPostBillRequest.setBillAction(billAction);
|
||||
//
|
||||
// //查询第三方服务授权参数
|
||||
// BasicThirdSysEntity basicThirdSysEntity = basicThirdSysService.selectByThirdId(thirdSysFk);
|
||||
// String response = httpOkClient.uCloudPost(uploadUrl, erpPostBillRequest, basicThirdSysEntity);
|
||||
// BaseResponse baseResponse = JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
||||
// });
|
||||
// return baseResponse;
|
||||
// }
|
||||
//
|
||||
// public BaseResponse postBill(ERPPostBillRequest erpPostBillRequest, String uploadUrl) {
|
||||
// String response = httpOkClient.uCloudPost(uploadUrl, erpPostBillRequest);
|
||||
// BaseResponse baseResponse =
|
||||
// JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
||||
// });
|
||||
// return baseResponse;
|
||||
// }
|
||||
//
|
||||
// public BaseResponse signBill(USignRequest signRequest, String url) {
|
||||
// String response = httpOkClient.uCloudPost(url, signRequest);
|
||||
// BaseResponse baseResponse =
|
||||
// JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
||||
// });
|
||||
// return baseResponse;
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package com.glxp.api.httpClient.serviceClient;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import com.glxp.api.entity.thrsys.*;
|
||||
import com.glxp.api.httpClient.req.UdiwmsBusTypeRequest;
|
||||
import com.glxp.api.httpClient.req.UdiwmsUnitRequest;
|
||||
import com.glxp.api.req.basic.YbDrugDetailFilterRequest;
|
||||
import com.glxp.api.req.basic.YbHcflDetailFilterRequest;
|
||||
import com.glxp.api.req.collect.PostCollectOrderRequest;
|
||||
import com.glxp.api.req.thrsys.*;
|
||||
import com.glxp.api.res.PageSimpleResponse;
|
||||
import com.glxp.api.res.chs.YbHcflEntityResponse;
|
||||
import com.glxp.api.res.thrsys.ThrCorpsResponse;
|
||||
import com.glxp.api.res.thrsys.ThrProductsResponse;
|
||||
import com.glxp.api.res.thrsys.UdiwmsWarehouseDetail;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ErpBasicClient {
|
||||
|
||||
|
||||
public BaseResponse<PageSimpleResponse<ThrCorpsResponse>> getErpCrop(ThrUnitMaintainFilterRequest thrUnitMaintainFilterRequest);
|
||||
|
||||
//获取产品信息
|
||||
public BaseResponse<PageSimpleResponse<ThrProductsResponse>> getErpProducts(FilterThrProductsRequest filterThrProductsRequest);
|
||||
|
||||
//查询仓库货位号
|
||||
public BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>> getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest);
|
||||
//测试连通性
|
||||
public BaseResponse testThridConnect(ThrSystemEntity thrSystemEntity);
|
||||
//下载第三方系统单据类型
|
||||
public BaseResponse<PageSimpleResponse<ThrSystemBusApiEntity>> getBusTypes(FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest);
|
||||
|
||||
/**
|
||||
* 医保耗材详情
|
||||
*/
|
||||
public BaseResponse<PageSimpleResponse<YbHcflEntityResponse>> getYbHcflDetail(YbHcflDetailFilterRequest ybHcflDetailFilterRequest);
|
||||
|
||||
/**
|
||||
* 获取往来单位
|
||||
*/
|
||||
public BaseResponse<PageSimpleResponse<ThrManufacturerEntity>> getThrManu(ThrManuFilterRequest thrManuFilterRequest);
|
||||
/**
|
||||
* 通过医保编码获取 药品 信息
|
||||
* @param ybHcflDetailFilterRequest
|
||||
* @return
|
||||
*/
|
||||
public BaseResponse<PageSimpleResponse<YbDrug>> getYbDrugDetail(YbDrugDetailFilterRequest ybHcflDetailFilterRequest);
|
||||
|
||||
/**
|
||||
* 获取 多码融合表
|
||||
* @param codeRel
|
||||
* @return
|
||||
*/
|
||||
public BaseResponse<List<CodeRel>> getCodeRelDetail(CodeRel codeRel);
|
||||
|
||||
/**
|
||||
* 获取 多码融合表
|
||||
* @param codeList
|
||||
* @return
|
||||
*/
|
||||
public BaseResponse<List> checkCode(List<String> codeList);
|
||||
|
||||
/**
|
||||
* 更新 多码融合表
|
||||
* @param codeRel
|
||||
* @return
|
||||
*/
|
||||
public BaseResponse updateCodeRelDetail(CodeRel codeRel);
|
||||
|
||||
/**
|
||||
* 上传已成功传输医保的完成单据
|
||||
* @param postCollectOrderRequest
|
||||
* @return
|
||||
*/
|
||||
public BaseResponse collectOrderUpload(PostCollectOrderRequest postCollectOrderRequest);
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.glxp.api.httpClient.serviceClient;
|
||||
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.req.thrsys.ThrOnhandRequest;
|
||||
import com.glxp.api.res.PageSimpleResponse;
|
||||
import com.glxp.api.res.thrsys.ThrInvProductResponse;
|
||||
|
||||
public interface ErpInvClient {
|
||||
public BaseResponse<PageSimpleResponse<ThrInvProductResponse>> getInvPrdoductResponse(ThrOnhandRequest onhandRequest, String url);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.glxp.api.httpClient.serviceClient;
|
||||
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.req.thrsys.FilterThrOrderRequest;
|
||||
import com.glxp.api.res.PageSimpleResponse;
|
||||
import com.glxp.api.res.thrsys.ThrOrderResponse;
|
||||
|
||||
public interface ErpOrderClient {
|
||||
public BaseResponse<PageSimpleResponse<ThrOrderResponse>> getThrOrderResponse(FilterThrOrderRequest filterOrderRequest);
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.glxp.api.httpClient.serviceClient;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.glxp.api.constant.ConstantStatus;
|
||||
import com.glxp.api.entity.basic.ProductInfoEntity;
|
||||
import com.glxp.api.entity.basic.UdiProductEntity;
|
||||
import com.glxp.api.req.basic.ProductInfoFilterRequest;
|
||||
import com.glxp.api.util.UuidUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public interface NmpaUdiClient {
|
||||
|
||||
|
||||
public List<UdiProductEntity> getUdiByUuid(String uuid);
|
||||
|
||||
public List<UdiProductEntity> getOrUpdateByUuid(String uuid);
|
||||
|
||||
public List<UdiProductEntity> getUdiByDi(String key);
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.glxp.api.httpClient.serviceClient.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.entity.thrsys.ThrSystemEntity;
|
||||
import com.glxp.api.httpClient.serviceClient.ErpOrderClient;
|
||||
import com.glxp.api.httpClient.utils.HttpOkClient;
|
||||
import com.glxp.api.req.thrsys.FilterThrOrderRequest;
|
||||
import com.glxp.api.res.PageSimpleResponse;
|
||||
import com.glxp.api.res.thrsys.ThrOrderResponse;
|
||||
import com.glxp.api.service.thrsys.ThrSystemService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 获取ERP出入库单据
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ErpOrderClientImpl implements ErpOrderClient {
|
||||
|
||||
@Autowired
|
||||
private ThrSystemService thrSystemService;
|
||||
@Resource
|
||||
HttpOkClient httpOkClient;
|
||||
|
||||
@Override
|
||||
public BaseResponse<PageSimpleResponse<ThrOrderResponse>> getThrOrderResponse(FilterThrOrderRequest filterOrderRequest) {
|
||||
|
||||
//查询第三方服务授权参数
|
||||
ThrSystemEntity thrSystemEntity = thrSystemService.selectByThirdId("thirdId");
|
||||
String url = thrSystemEntity.getThridUrl() + "/udiwms/erp/getOrders";
|
||||
String response = httpOkClient.uCloudPost(url, filterOrderRequest, thrSystemEntity);
|
||||
try {
|
||||
BaseResponse<PageSimpleResponse<ThrOrderResponse>> responseBaseResponse =
|
||||
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ThrOrderResponse>>>() {
|
||||
});
|
||||
return responseBaseResponse;
|
||||
} catch (Exception e) {
|
||||
log.error("获取订单数据异常", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.glxp.api.httpClient;
|
||||
package com.glxp.api.httpClient.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
Loading…
Reference in New Issue