|
|
|
@ -25,7 +25,6 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.dom4j.Document;
|
|
|
|
|
import org.dom4j.DocumentException;
|
|
|
|
|
import org.dom4j.DocumentHelper;
|
|
|
|
|
import org.dom4j.io.SAXReader;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
@ -101,7 +100,7 @@ public class ZaxyyClient {
|
|
|
|
|
zaZyHeareRequest.setMsgHeader(getMsgHeader("getMaterialUnit"));
|
|
|
|
|
zaZyHeareRequest.setMsgBody(JSONUtil.toJsonStr(unitRequest));
|
|
|
|
|
String response = httpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + basicThirdSysDetailEntity.getValue(), zaZyHeareRequest, getHeaderArray());
|
|
|
|
|
|
|
|
|
|
response = parseErrorMsg(response);
|
|
|
|
|
try {
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
@ -122,7 +121,7 @@ public class ZaxyyClient {
|
|
|
|
|
zaZyHeareRequest.setMsgBody(JSONUtil.toJsonStr(udiwmsProductRequest));
|
|
|
|
|
|
|
|
|
|
String response = httpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + basicThirdSysDetailEntity.getValue(), zaZyHeareRequest, getHeaderArray());
|
|
|
|
|
|
|
|
|
|
response = parseErrorMsg(response);
|
|
|
|
|
try {
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
@ -143,6 +142,7 @@ public class ZaxyyClient {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String response = httpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + basicThirdSysDetailEntity.getValue(), zaZyHeareRequest, getHeaderArray());
|
|
|
|
|
response = parseErrorMsg(response);
|
|
|
|
|
try {
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
@ -173,6 +173,7 @@ public class ZaxyyClient {
|
|
|
|
|
// BasicThirdSysBusApiEntity basicThirdSysBusApiEntity = basicThirdSysBusApiService.selectByKey(bussinessOriginTypeResponse.getThirdAction(), bussinessOriginTypeResponse.getThirdSys(), 1);
|
|
|
|
|
BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailDao.selectByKey("orderQueryUrl", thirdSysConfig.getThirdSysConfig().getThirdId());
|
|
|
|
|
String response = httpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + basicThirdSysDetailEntity.getValue(), zaZyHeareRequest, getHeaderArray());
|
|
|
|
|
response = parseErrorMsg(response);
|
|
|
|
|
try {
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
@ -203,6 +204,7 @@ public class ZaxyyClient {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String response = httpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + interStr, zaZyHeareRequest, getHeaderArray());
|
|
|
|
|
response = parseErrorMsg(response);
|
|
|
|
|
try {
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
@ -226,6 +228,7 @@ public class ZaxyyClient {
|
|
|
|
|
zaZyHeareRequest.setMsgBody(JSONUtil.toJsonStr(udiwmsPreInOrderRequest));
|
|
|
|
|
|
|
|
|
|
String response = httpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + interStr, zaZyHeareRequest, getHeaderArray());
|
|
|
|
|
response = parseErrorMsg(response);
|
|
|
|
|
try {
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
@ -244,15 +247,7 @@ public class ZaxyyClient {
|
|
|
|
|
zaZyHeareRequest.setMsgHeader(getMsgHeader("getMaterialStorage"));
|
|
|
|
|
zaZyHeareRequest.setMsgBody(JSONUtil.toJsonStr(udiwmsOnhandRequest));
|
|
|
|
|
String response = httpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + basicThirdSysDetailEntity.getValue(), zaZyHeareRequest, getHeaderArray());
|
|
|
|
|
|
|
|
|
|
if (response.contains("<root")) {
|
|
|
|
|
SAXReader saxReader = new SAXReader();
|
|
|
|
|
try {
|
|
|
|
|
Document document = DocumentHelper.parseText(response);
|
|
|
|
|
} catch (DocumentException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
response = parseErrorMsg(response);
|
|
|
|
|
try {
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
@ -272,7 +267,7 @@ public class ZaxyyClient {
|
|
|
|
|
|
|
|
|
|
BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailDao.selectByKey("warehouseQueryUrl", thirdSysConfig.getThirdSysConfig().getThirdId());
|
|
|
|
|
String response = httpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + basicThirdSysDetailEntity.getValue(), zaZyHeareRequest, getHeaderArray());
|
|
|
|
|
|
|
|
|
|
response = parseErrorMsg(response);
|
|
|
|
|
try {
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
@ -285,4 +280,19 @@ public class ZaxyyClient {
|
|
|
|
|
return ResultVOUtils.error(500, "网络错误,或远程服务器异常无法返回正确结果" + "(" + response + ")");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String parseErrorMsg(String response) {
|
|
|
|
|
if (response.contains("<root")) {
|
|
|
|
|
try {
|
|
|
|
|
Document document = DocumentHelper.parseText(response);
|
|
|
|
|
String message = document.getRootElement().element("message").getText();
|
|
|
|
|
return message;
|
|
|
|
|
} catch (DocumentException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|