调整+平潭协和对接
parent
648e9c8264
commit
d7b1fd573c
@ -0,0 +1,81 @@
|
|||||||
|
package com.glxp.mipsdl.client;
|
||||||
|
|
||||||
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.glxp.mipsdl.config.ThirdSysConfig;
|
||||||
|
import com.glxp.mipsdl.constant.ConstantType;
|
||||||
|
import com.glxp.mipsdl.constant.Constants;
|
||||||
|
import com.glxp.mipsdl.dao.auth.AuthWarehouseDao;
|
||||||
|
import com.glxp.mipsdl.dao.basic.BasicBussinessTypeDao;
|
||||||
|
import com.glxp.mipsdl.dao.basic.BasicCorpDao;
|
||||||
|
import com.glxp.mipsdl.dao.inout.IoCodeDao;
|
||||||
|
import com.glxp.mipsdl.dao.inout.IoOrderDao;
|
||||||
|
import com.glxp.mipsdl.dao.inout.IoOrderDetailBizDao;
|
||||||
|
import com.glxp.mipsdl.dao.thrsys.ThrBustypeOriginDao;
|
||||||
|
import com.glxp.mipsdl.dao.thrsys.ThrInvWarehouseDao;
|
||||||
|
import com.glxp.mipsdl.dao.thrsys.ThrSystemBusApiDao;
|
||||||
|
import com.glxp.mipsdl.entity.auth.AuthWarehouseEntity;
|
||||||
|
import com.glxp.mipsdl.entity.basic.BasicBussinessTypeEntity;
|
||||||
|
import com.glxp.mipsdl.entity.inout.IoCodeEntity;
|
||||||
|
import com.glxp.mipsdl.entity.inout.IoOrderDetailBizEntity;
|
||||||
|
import com.glxp.mipsdl.entity.inout.IoOrderEntity;
|
||||||
|
import com.glxp.mipsdl.entity.thrsys.ThrCorpEntity;
|
||||||
|
import com.glxp.mipsdl.entity.thrsys.ThrInvWarehouseEntity;
|
||||||
|
import com.glxp.mipsdl.entity.thrsys.ThrSystemBusApiEntity;
|
||||||
|
import com.glxp.mipsdl.http.HttpClient;
|
||||||
|
import com.glxp.mipsdl.req.base.*;
|
||||||
|
import com.glxp.mipsdl.req.post.PostFileThrOrderRequest;
|
||||||
|
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.udiwms.UdiwmsProductInfoResponse;
|
||||||
|
import com.glxp.mipsdl.service.auth.AuthWarehouseService;
|
||||||
|
import com.glxp.mipsdl.service.file.UdiInfoUploadService;
|
||||||
|
import com.glxp.mipsdl.service.thrsys.ThrCorpService;
|
||||||
|
import com.glxp.mipsdl.service.thrsys.ThrSystemDetailService;
|
||||||
|
import com.glxp.mipsdl.util.*;
|
||||||
|
import com.glxp.mipsdl.vo.file.yxzyy.YxzyyProductEntity;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public abstract class CommonFileClient implements BaseFileClient {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UdiInfoUploadService udiInfoUploadService;
|
||||||
|
@Autowired
|
||||||
|
private ExecutorUtil executorUtil;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract BaseResponse uploadPi(List<MultipartFile> files, String thirdSys);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse uploadCorps(List<MultipartFile> files, String thirdSys) {
|
||||||
|
return ResultVOUtils.error(500, "暂不支持往来单位上传!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse uploadInvPi(List<MultipartFile> files, String thirdSys) {
|
||||||
|
return ResultVOUtils.error(500, "暂不支持库存产品信息上传!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse uploadOrders(List<MultipartFile> files, String thirdSys) {
|
||||||
|
return ResultVOUtils.error(500, "暂不支持业务单据上传!");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,217 @@
|
|||||||
|
package com.glxp.mipsdl.client;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.glxp.mipsdl.config.ThirdSysConfig;
|
||||||
|
import com.glxp.mipsdl.constant.ConstantType;
|
||||||
|
import com.glxp.mipsdl.constant.Constants;
|
||||||
|
import com.glxp.mipsdl.dao.auth.AuthWarehouseDao;
|
||||||
|
import com.glxp.mipsdl.dao.basic.BasicBussinessTypeDao;
|
||||||
|
import com.glxp.mipsdl.dao.basic.BasicCorpDao;
|
||||||
|
import com.glxp.mipsdl.dao.inout.IoCodeDao;
|
||||||
|
import com.glxp.mipsdl.dao.inout.IoOrderDao;
|
||||||
|
import com.glxp.mipsdl.dao.inout.IoOrderDetailBizDao;
|
||||||
|
import com.glxp.mipsdl.dao.thrsys.ThrBustypeOriginDao;
|
||||||
|
import com.glxp.mipsdl.dao.thrsys.ThrInvWarehouseDao;
|
||||||
|
import com.glxp.mipsdl.dao.thrsys.ThrSystemBusApiDao;
|
||||||
|
import com.glxp.mipsdl.entity.auth.AuthWarehouseEntity;
|
||||||
|
import com.glxp.mipsdl.entity.basic.BasicBussinessTypeEntity;
|
||||||
|
import com.glxp.mipsdl.entity.inout.IoCodeEntity;
|
||||||
|
import com.glxp.mipsdl.entity.inout.IoOrderDetailBizEntity;
|
||||||
|
import com.glxp.mipsdl.entity.inout.IoOrderEntity;
|
||||||
|
import com.glxp.mipsdl.entity.thrsys.ThrCorpEntity;
|
||||||
|
import com.glxp.mipsdl.entity.thrsys.ThrInvWarehouseEntity;
|
||||||
|
import com.glxp.mipsdl.entity.thrsys.ThrSystemBusApiEntity;
|
||||||
|
import com.glxp.mipsdl.http.HttpClient;
|
||||||
|
import com.glxp.mipsdl.req.base.*;
|
||||||
|
import com.glxp.mipsdl.req.post.PostFileThrOrderRequest;
|
||||||
|
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.service.auth.AuthWarehouseService;
|
||||||
|
import com.glxp.mipsdl.service.thrsys.ThrCorpService;
|
||||||
|
import com.glxp.mipsdl.service.thrsys.ThrSystemDetailService;
|
||||||
|
import com.glxp.mipsdl.util.DateUtil;
|
||||||
|
import com.glxp.mipsdl.util.DictUtl;
|
||||||
|
import com.glxp.mipsdl.util.ResultVOUtils;
|
||||||
|
import com.glxp.mipsdl.util.SubmitOrderUtil;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public abstract class CommonHttpClient implements BaseHttpClient {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HttpClient httpClient;
|
||||||
|
@Autowired
|
||||||
|
private ThirdSysConfig thirdSysConfig;
|
||||||
|
@Autowired
|
||||||
|
private ThrSystemDetailService thrSystemDetailService;
|
||||||
|
@Autowired
|
||||||
|
private ThrBustypeOriginDao thrBustypeOriginDao;
|
||||||
|
@Autowired
|
||||||
|
private IoOrderDao orderDao;
|
||||||
|
@Autowired
|
||||||
|
private ThrSystemBusApiDao thrSystemBusApiDao;
|
||||||
|
@Autowired
|
||||||
|
private BasicBussinessTypeDao basicBussinessTypeDao;
|
||||||
|
@Autowired
|
||||||
|
private BasicCorpDao basicCorpDao;
|
||||||
|
@Autowired
|
||||||
|
private AuthWarehouseDao authWarehouseDao;
|
||||||
|
@Autowired
|
||||||
|
private ThrInvWarehouseDao thrInvWarehouseDao;
|
||||||
|
@Autowired
|
||||||
|
private AuthWarehouseService authWarehouseService;
|
||||||
|
@Autowired
|
||||||
|
private ThrCorpService thrCorpService;
|
||||||
|
@Autowired
|
||||||
|
private IoCodeDao codeDao;
|
||||||
|
@Autowired
|
||||||
|
private IoOrderDetailBizDao orderDetailBizDao;
|
||||||
|
@Autowired
|
||||||
|
private SubmitOrderUtil submitOrderUtil;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse getUnit(UdiwmsUnitRequest udiwmsUnitRequest) {
|
||||||
|
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_CORP_URL), udiwmsUnitRequest);
|
||||||
|
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
|
||||||
|
return baseResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse getProducts(UdiwmsProductRequest udiwmsProductRequest) {
|
||||||
|
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_PI_QUERY_URL), udiwmsProductRequest);
|
||||||
|
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
|
||||||
|
return baseResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse getOrderTypes(UdiwmsBusTypeRequest udiwmsBusTypeRequest) {
|
||||||
|
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_BUS_TYPE_QUERY_URL), udiwmsBusTypeRequest);
|
||||||
|
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
|
||||||
|
return baseResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse getOrders(UdiwmsOrderQueryRequest udiwmsOrderQueryRequest) {
|
||||||
|
if (StrUtil.isBlank(udiwmsOrderQueryRequest.getBillType())) {
|
||||||
|
return ResultVOUtils.error(500, "单据类型不能为空");
|
||||||
|
}
|
||||||
|
//查询绑定的第三方单据类型
|
||||||
|
String thirdAction = thrBustypeOriginDao.findThirdActionByBillType(udiwmsOrderQueryRequest.getBillType(), DictUtl.CURRENT_HOSP_CODE);
|
||||||
|
udiwmsOrderQueryRequest.setBillType(thirdAction);
|
||||||
|
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_ORDER_QUERY_URL), udiwmsOrderQueryRequest);
|
||||||
|
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
|
||||||
|
return baseResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract BaseResponse submitOrders(UdiwmsOrderRequest udiwmsOrderRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 封装单据详情参数
|
||||||
|
*
|
||||||
|
* @param ioCodeEntities 单据码明细
|
||||||
|
* @param orderDetailRequests 单据详情参数
|
||||||
|
* @param detailBizEntities 单据业务详情
|
||||||
|
*/
|
||||||
|
private void setOrderDetailList(List<IoCodeEntity> ioCodeEntities, List<UdiwmsOrderDetailRequest> orderDetailRequests, List<IoOrderDetailBizEntity> detailBizEntities) {
|
||||||
|
for (IoOrderDetailBizEntity detailBizEntity : detailBizEntities) {
|
||||||
|
UdiwmsOrderDetailRequest item = submitOrderUtil.buildProductInfo(detailBizEntity);
|
||||||
|
//封装条码信息
|
||||||
|
submitOrderUtil.setCodeList(ioCodeEntities, detailBizEntity, item);
|
||||||
|
orderDetailRequests.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse getInvProducts(UdiwmsInvProductsRequest udiwmsInvProductsRequest) {
|
||||||
|
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_INV_PI_URL), udiwmsInvProductsRequest);
|
||||||
|
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
|
||||||
|
return baseResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest) {
|
||||||
|
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_WAREHOUSE_QUERY_URL), udiwmsWarehouseRequest);
|
||||||
|
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
|
||||||
|
return baseResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse testConnect() {
|
||||||
|
UdiwmsUnitRequest udiwmsUnitRequest = new UdiwmsUnitRequest();
|
||||||
|
udiwmsUnitRequest.setPage(1);
|
||||||
|
udiwmsUnitRequest.setLimit(1);
|
||||||
|
BaseResponse baseResponse = getUnit(udiwmsUnitRequest);
|
||||||
|
if (baseResponse.getCode() == 20000) {
|
||||||
|
return ResultVOUtils.success("连接成功");
|
||||||
|
}
|
||||||
|
return ResultVOUtils.error(500, "连接失败!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse queryUdiInvProducts(UdiwmsQueryUdiInvProductsRequest queryUdiInvProductsRequest) {
|
||||||
|
String response = httpClient.postUDIWMSJson(thirdSysConfig.getQueryInvUrl(), queryUdiInvProductsRequest);
|
||||||
|
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
|
||||||
|
return baseResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse submitProducts(UdiwmsAddProductsRequest udiwmsAddProductsRequest) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse submitUnit(UdiwmsAddUnitRequest udiwmsAddUnitRequest) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse submitPreInOrders(UdiwmsPreInOrderRequest udiwmsPreInOrderRequest) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse postProducts(PostThrProductsRequest postThrProductsRequest) {
|
||||||
|
postThrProductsRequest.setUploadType("文件导入");
|
||||||
|
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostPiUrl(), postThrProductsRequest);
|
||||||
|
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
|
||||||
|
return baseResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse postCorps(PostThrCorpRequest postThrCorpRequest) {
|
||||||
|
postThrCorpRequest.setUploadType("文件导入");
|
||||||
|
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostCorpUrl(), postThrCorpRequest);
|
||||||
|
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
|
||||||
|
return baseResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse postOrderDetail(PostFileThrOrderRequest postFileThrOrderRequest) {
|
||||||
|
postFileThrOrderRequest.setUploadType("文件导入");
|
||||||
|
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostOrderUrl(), postFileThrOrderRequest);
|
||||||
|
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
|
||||||
|
return baseResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse postInvProducts(PostThrInvProductsRequest postThrInvProductsRequest) {
|
||||||
|
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostInvPiUrl(), postThrInvProductsRequest);
|
||||||
|
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
|
||||||
|
return baseResponse;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue