|
|
|
@ -8,41 +8,59 @@ import com.glxp.mipsdl.admin.req.system.PostThrInvProductsRequest;
|
|
|
|
|
import com.glxp.mipsdl.admin.req.system.PostThrProductsRequest;
|
|
|
|
|
import com.glxp.mipsdl.admin.util.HttpClient;
|
|
|
|
|
import com.glxp.mipsdl.common.res.BaseResponse;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
public class UdiwmsClient {
|
|
|
|
|
|
|
|
|
|
String udiWmsUrl;
|
|
|
|
|
@Value("${UDIWMS_IP}")
|
|
|
|
|
private String udiWmsUrl;
|
|
|
|
|
|
|
|
|
|
public UdiwmsClient(String udiWmsUrl) {
|
|
|
|
|
this.udiWmsUrl = udiWmsUrl;
|
|
|
|
|
|
|
|
|
|
@Value("${API_KEY}")
|
|
|
|
|
private String apiKey;
|
|
|
|
|
@Value("${API_SECRET}")
|
|
|
|
|
private String apiSecret;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public HttpHeaders getHeaders() {
|
|
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
|
|
headers.add("Content-Type", "application/json");
|
|
|
|
|
headers.add("api_key", apiKey);
|
|
|
|
|
headers.add("secret_key", apiSecret);
|
|
|
|
|
return headers;
|
|
|
|
|
}
|
|
|
|
|
public BaseResponse postProducts( PostThrProductsRequest postThrProductsRequest) {
|
|
|
|
|
String response = HttpClient.postJson(udiWmsUrl+"/udiwms/thrsys/postThrProducts", postThrProductsRequest);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BaseResponse postProducts(PostThrProductsRequest postThrProductsRequest) {
|
|
|
|
|
String response = HttpClient.postJson(udiWmsUrl + "/udiwms/thrsys/postThrProducts", postThrProductsRequest, getHeaders());
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
|
});
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BaseResponse postCorps( PostThrCorpRequest postThrCorpRequest) {
|
|
|
|
|
public BaseResponse postCorps(PostThrCorpRequest postThrCorpRequest) {
|
|
|
|
|
postThrCorpRequest.setUploadType("文件导入");
|
|
|
|
|
String response = HttpClient.postJson(udiWmsUrl+"/udiwms/thrsys/postCorps", postThrCorpRequest);
|
|
|
|
|
String response = HttpClient.postJson(udiWmsUrl + "/udiwms/thrsys/postCorps", postThrCorpRequest, getHeaders());
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
|
});
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BaseResponse postOrderDetail( PostFileThrOrderRequest postFileThrOrderRequest) {
|
|
|
|
|
String response = HttpClient.postJson(udiWmsUrl+"/udiwms/thrsys/postFileOrder", postFileThrOrderRequest);
|
|
|
|
|
public BaseResponse postOrderDetail(PostFileThrOrderRequest postFileThrOrderRequest) {
|
|
|
|
|
String response = HttpClient.postJson(udiWmsUrl + "/udiwms/thrsys/postFileOrder", postFileThrOrderRequest, getHeaders());
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
|
});
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BaseResponse postInvProducts( PostThrInvProductsRequest postThrInvProductsRequest) {
|
|
|
|
|
String response = HttpClient.postJson(udiWmsUrl+"/udiwms/thrsys/postInvProducts", postThrInvProductsRequest);
|
|
|
|
|
public BaseResponse postInvProducts(PostThrInvProductsRequest postThrInvProductsRequest) {
|
|
|
|
|
String response = HttpClient.postJson(udiWmsUrl + "/udiwms/thrsys/postInvProducts", postThrInvProductsRequest, getHeaders());
|
|
|
|
|
BaseResponse baseResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
|
|
|
|
|
});
|
|
|
|
|