|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
|
|
import com.glxp.mipsdl.admin.client.BaseHttpClient;
|
|
|
|
|
import com.glxp.mipsdl.admin.config.ThirdSysConfig;
|
|
|
|
|
import com.glxp.mipsdl.admin.dao.phxyy.BasicThirdSysDetailDao;
|
|
|
|
|
import com.glxp.mipsdl.admin.entity.phxyy.BasicThirdSysBusApiEntity;
|
|
|
|
|
import com.glxp.mipsdl.admin.entity.phxyy.BasicThirdSysDetailEntity;
|
|
|
|
@ -14,7 +15,6 @@ import com.glxp.mipsdl.admin.service.phxyy.BussinessOriginTypeService;
|
|
|
|
|
import com.glxp.mipsdl.admin.util.HttpClient;
|
|
|
|
|
import com.glxp.mipsdl.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.mipsdl.common.util.ResultVOUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
@ -26,19 +26,15 @@ import javax.annotation.Resource;
|
|
|
|
|
@Service
|
|
|
|
|
public class PhxyyClient implements BaseHttpClient {
|
|
|
|
|
|
|
|
|
|
@Value("${UDIWMS_IP}")
|
|
|
|
|
private String udiWmsUrl;
|
|
|
|
|
@Value("${API_KEY}")
|
|
|
|
|
private String apiKey;
|
|
|
|
|
@Value("${API_SECRET}")
|
|
|
|
|
private String apiSecret;
|
|
|
|
|
@Resource
|
|
|
|
|
private ThirdSysConfig thirdSysConfig;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public HttpHeaders getHeaders() {
|
|
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
|
|
headers.add("Content-Type", "application/json");
|
|
|
|
|
headers.add("api_key", apiKey);
|
|
|
|
|
headers.add("secret_key", apiSecret);
|
|
|
|
|
headers.add("api_key", thirdSysConfig.getThirdSysConfig().getApikey());
|
|
|
|
|
headers.add("secret_key", thirdSysConfig.getThirdSysConfig().getSecretkey());
|
|
|
|
|
return headers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -51,10 +47,8 @@ public class PhxyyClient implements BaseHttpClient {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse getUnit(UdiwmsUnitRequest unitRequest) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailDao.selectByKey("corpUrl", unitRequest.getThirdSys());
|
|
|
|
|
String response = HttpClient.postJson(udiWmsUrl + basicThirdSysDetailEntity.getValue(), unitRequest, getHeaders());
|
|
|
|
|
String response = HttpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + basicThirdSysDetailEntity.getValue(), unitRequest, getHeaders());
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
|
});
|
|
|
|
@ -62,9 +56,9 @@ public class PhxyyClient implements BaseHttpClient {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse getPrdoucts(UdiwmsProductRequest udiwmsProductRequest) {
|
|
|
|
|
public BaseResponse getProducts(UdiwmsProductRequest udiwmsProductRequest) {
|
|
|
|
|
BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailDao.selectByKey("piQueryUrl", udiwmsProductRequest.getThirdSys());
|
|
|
|
|
String response = HttpClient.postJson(udiWmsUrl + basicThirdSysDetailEntity.getValue(), udiwmsProductRequest, getHeaders());
|
|
|
|
|
String response = HttpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + basicThirdSysDetailEntity.getValue(), udiwmsProductRequest, getHeaders());
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
|
});
|
|
|
|
@ -73,9 +67,8 @@ public class PhxyyClient implements BaseHttpClient {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse getOrderTypes(UdiwmsBusTypeRequest udiwmsBusTypeRequest) {
|
|
|
|
|
|
|
|
|
|
BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailDao.selectByKey("busTypeQueryUrl", udiwmsBusTypeRequest.getThirdSys());
|
|
|
|
|
String response = HttpClient.postJson(udiWmsUrl + basicThirdSysDetailEntity.getValue(), udiwmsBusTypeRequest, getHeaders());
|
|
|
|
|
String response = HttpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + basicThirdSysDetailEntity.getValue(), udiwmsBusTypeRequest, getHeaders());
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
|
});
|
|
|
|
@ -84,7 +77,6 @@ public class PhxyyClient implements BaseHttpClient {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse getOrders(UdiwmsOrderRequest udiwmsOrderRequest) {
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(udiwmsOrderRequest.getBillType())) {
|
|
|
|
|
return ResultVOUtils.error(500, "单据类型不能未空");
|
|
|
|
|
}
|
|
|
|
@ -94,7 +86,7 @@ public class PhxyyClient implements BaseHttpClient {
|
|
|
|
|
BussinessOriginTypeResponse bussinessOriginTypeResponse = bussinessOriginTypeService.findByKey(udiwmsOrderRequest.getBillType(), udiwmsOrderRequest.getThirdSys());
|
|
|
|
|
udiwmsOrderRequest.setBillType(bussinessOriginTypeResponse.getThirdAction());
|
|
|
|
|
BasicThirdSysBusApiEntity basicThirdSysBusApiEntity = basicThirdSysBusApiService.selectByKey(bussinessOriginTypeResponse.getThirdAction(), bussinessOriginTypeResponse.getThirdSys(), 1);
|
|
|
|
|
String response = HttpClient.postJson(udiWmsUrl+basicThirdSysBusApiEntity.getUrl(), udiwmsOrderRequest, getHeaders());
|
|
|
|
|
String response = HttpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + basicThirdSysBusApiEntity.getUrl(), udiwmsOrderRequest, getHeaders());
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
|
});
|
|
|
|
@ -103,8 +95,6 @@ public class PhxyyClient implements BaseHttpClient {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse submitOrders(UdiwmsOrderRequest udiwmsOrderRequest) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(udiwmsOrderRequest.getBillType())) {
|
|
|
|
|
return ResultVOUtils.error(500, "单据类型不能未空");
|
|
|
|
|
}
|
|
|
|
@ -119,7 +109,7 @@ public class PhxyyClient implements BaseHttpClient {
|
|
|
|
|
udiwmsOrderRequest.setInoutType(2);
|
|
|
|
|
}
|
|
|
|
|
BasicThirdSysBusApiEntity basicThirdSysBusApiEntity = basicThirdSysBusApiService.selectByKey(bussinessOriginTypeResponse.getThirdAction(), bussinessOriginTypeResponse.getThirdSys(), 1);
|
|
|
|
|
String response = HttpClient.postJson(udiWmsUrl+basicThirdSysBusApiEntity.getUrl(), udiwmsOrderRequest, getHeaders());
|
|
|
|
|
String response = HttpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + basicThirdSysBusApiEntity.getUrl(), udiwmsOrderRequest, getHeaders());
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
|
});
|
|
|
|
@ -129,7 +119,17 @@ public class PhxyyClient implements BaseHttpClient {
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse getInvProducts(UdiwmsOnhandRequest udiwmsOnhandRequest) {
|
|
|
|
|
BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailDao.selectByKey("invPiUrl", udiwmsOnhandRequest.getThirdSys());
|
|
|
|
|
String response = HttpClient.postJson(udiWmsUrl + basicThirdSysDetailEntity.getValue(), udiwmsOnhandRequest, getHeaders());
|
|
|
|
|
String response = HttpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + basicThirdSysDetailEntity.getValue(), udiwmsOnhandRequest, getHeaders());
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
|
});
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest) {
|
|
|
|
|
BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailDao.selectByKey("warehouseUrl", udiwmsWarehouseRequest.getThirdSys());
|
|
|
|
|
String response = HttpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + basicThirdSysDetailEntity.getValue(), udiwmsWarehouseRequest, getHeaders());
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
|
});
|
|
|
|
|