|
|
@ -3,6 +3,7 @@ package com.glxp.api.admin.httpclient;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
|
import com.glxp.api.admin.entity.basic.BasicExportStatusEntity;
|
|
|
|
import com.glxp.api.admin.entity.basic.BasicExportStatusEntity;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.entity.info.SyncDataSetEntity;
|
|
|
|
import com.glxp.api.admin.entity.inout.IOOrderStatusEntity;
|
|
|
|
import com.glxp.api.admin.entity.inout.IOOrderStatusEntity;
|
|
|
|
import com.glxp.api.admin.httpclient.UHttpClient;
|
|
|
|
import com.glxp.api.admin.httpclient.UHttpClient;
|
|
|
|
import com.glxp.api.admin.req.basic.BasicExportStatusRequest;
|
|
|
|
import com.glxp.api.admin.req.basic.BasicExportStatusRequest;
|
|
|
@ -14,11 +15,13 @@ import com.glxp.api.admin.res.basic.SpsSyncDataResponse;
|
|
|
|
import com.glxp.api.admin.res.basic.SpsSyncOrderResponse;
|
|
|
|
import com.glxp.api.admin.res.basic.SpsSyncOrderResponse;
|
|
|
|
import com.glxp.api.admin.res.basic.SpsSyncScheduleResponse;
|
|
|
|
import com.glxp.api.admin.res.basic.SpsSyncScheduleResponse;
|
|
|
|
import com.glxp.api.admin.res.inout.DlOrderResponse;
|
|
|
|
import com.glxp.api.admin.res.inout.DlOrderResponse;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.service.info.SyncDataSetService;
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
@ -26,13 +29,21 @@ import java.util.Map;
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
public class SpGetHttpClient {
|
|
|
|
public class SpGetHttpClient {
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${SPSYNC_IP}")
|
|
|
|
// @Value("${SPSYNC_IP}")
|
|
|
|
private String spsSyncUrl;
|
|
|
|
// private String spsSyncUrl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
SyncDataSetService syncDataSetService;
|
|
|
|
|
|
|
|
public String getIpUrl() {
|
|
|
|
|
|
|
|
SyncDataSetEntity syncDataSetEntity = syncDataSetService.findSet();
|
|
|
|
|
|
|
|
return syncDataSetEntity.getSyncIp();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BaseResponse<PageSimpleResponse<IOOrderStatusEntity>> getOrderStatus() {
|
|
|
|
public BaseResponse<PageSimpleResponse<IOOrderStatusEntity>> getOrderStatus() {
|
|
|
|
Map<String, Object> paramMap = new HashMap<>(16);
|
|
|
|
Map<String, Object> paramMap = new HashMap<>(16);
|
|
|
|
paramMap.put("status", 1);
|
|
|
|
paramMap.put("status", 1);
|
|
|
|
String response = UHttpClient.mipsGet(spsSyncUrl + "/spms/inout/order/status", paramMap);
|
|
|
|
String response = UHttpClient.mipsGet(getIpUrl() + "/spms/inout/order/status", paramMap);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
BaseResponse<PageSimpleResponse<IOOrderStatusEntity>> data =
|
|
|
|
BaseResponse<PageSimpleResponse<IOOrderStatusEntity>> data =
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<IOOrderStatusEntity>>>() {
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<IOOrderStatusEntity>>>() {
|
|
|
@ -49,7 +60,7 @@ public class SpGetHttpClient {
|
|
|
|
public BaseResponse<List<DlOrderResponse>> getOrders(String orderId) {
|
|
|
|
public BaseResponse<List<DlOrderResponse>> getOrders(String orderId) {
|
|
|
|
Map<String, Object> paramMap = new HashMap<>(16);
|
|
|
|
Map<String, Object> paramMap = new HashMap<>(16);
|
|
|
|
paramMap.put("orderId", orderId);
|
|
|
|
paramMap.put("orderId", orderId);
|
|
|
|
String response = UHttpClient.mipsGet(spsSyncUrl + "/spms/inout/order/dlByStatus", paramMap);
|
|
|
|
String response = UHttpClient.mipsGet(getIpUrl() + "/spms/inout/order/dlByStatus", paramMap);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
BaseResponse<List<DlOrderResponse>> data =
|
|
|
|
BaseResponse<List<DlOrderResponse>> data =
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse<List<DlOrderResponse>>>() {
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse<List<DlOrderResponse>>>() {
|
|
|
@ -66,7 +77,7 @@ public class SpGetHttpClient {
|
|
|
|
OrderStatusFilterRequest orderStatusFilterRequest = new OrderStatusFilterRequest();
|
|
|
|
OrderStatusFilterRequest orderStatusFilterRequest = new OrderStatusFilterRequest();
|
|
|
|
orderStatusFilterRequest.setOrderId(orderId);
|
|
|
|
orderStatusFilterRequest.setOrderId(orderId);
|
|
|
|
orderStatusFilterRequest.setStatus(2);
|
|
|
|
orderStatusFilterRequest.setStatus(2);
|
|
|
|
String result = UHttpClient.postJson(spsSyncUrl + "/spms/inout/order/updateStatus", orderStatusFilterRequest);
|
|
|
|
String result = UHttpClient.postJson(getIpUrl() + "/spms/inout/order/updateStatus", orderStatusFilterRequest);
|
|
|
|
BaseResponse<String> response =
|
|
|
|
BaseResponse<String> response =
|
|
|
|
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
|
|
|
|
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -77,7 +88,7 @@ public class SpGetHttpClient {
|
|
|
|
public BaseResponse<List<BasicExportStatusEntity>> getBasicStatus(String type) {
|
|
|
|
public BaseResponse<List<BasicExportStatusEntity>> getBasicStatus(String type) {
|
|
|
|
Map<String, Object> paramMap = new HashMap<>(16);
|
|
|
|
Map<String, Object> paramMap = new HashMap<>(16);
|
|
|
|
paramMap.put("type", type);
|
|
|
|
paramMap.put("type", type);
|
|
|
|
String response = UHttpClient.mipsGet(spsSyncUrl + "/spssync/basic/udiinfo/getStatus", paramMap);
|
|
|
|
String response = UHttpClient.mipsGet(getIpUrl() + "/spssync/basic/udiinfo/getStatus", paramMap);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
BaseResponse<List<BasicExportStatusEntity>> data =
|
|
|
|
BaseResponse<List<BasicExportStatusEntity>> data =
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse<List<BasicExportStatusEntity>>>() {
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse<List<BasicExportStatusEntity>>>() {
|
|
|
@ -92,7 +103,7 @@ public class SpGetHttpClient {
|
|
|
|
|
|
|
|
|
|
|
|
public BaseResponse<String> testConnect() {
|
|
|
|
public BaseResponse<String> testConnect() {
|
|
|
|
Map<String, Object> paramMap = new HashMap<>(16);
|
|
|
|
Map<String, Object> paramMap = new HashMap<>(16);
|
|
|
|
String response = UHttpClient.mipsGet(spsSyncUrl + "/sps/sync/connect/test", paramMap);
|
|
|
|
String response = UHttpClient.mipsGet(getIpUrl() + "/sps/sync/connect/test", paramMap);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
BaseResponse<String> data =
|
|
|
|
BaseResponse<String> data =
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse<String>>() {
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse<String>>() {
|
|
|
@ -115,7 +126,7 @@ public class SpGetHttpClient {
|
|
|
|
paramMap.put("id", basicExportStatusRequest.getId());
|
|
|
|
paramMap.put("id", basicExportStatusRequest.getId());
|
|
|
|
if (basicExportStatusRequest.getScheduleType() != null)
|
|
|
|
if (basicExportStatusRequest.getScheduleType() != null)
|
|
|
|
paramMap.put("scheduleType", basicExportStatusRequest.getScheduleType());
|
|
|
|
paramMap.put("scheduleType", basicExportStatusRequest.getScheduleType());
|
|
|
|
String response = UHttpClient.mipsGet(spsSyncUrl + "/spssync/basic/udiinfo/getStatus", paramMap);
|
|
|
|
String response = UHttpClient.mipsGet(getIpUrl() + "/spssync/basic/udiinfo/getStatus", paramMap);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
BaseResponse<List<BasicExportStatusEntity>> data =
|
|
|
|
BaseResponse<List<BasicExportStatusEntity>> data =
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse<List<BasicExportStatusEntity>>>() {
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse<List<BasicExportStatusEntity>>>() {
|
|
|
@ -133,7 +144,7 @@ public class SpGetHttpClient {
|
|
|
|
BasicExportStatusRequest basicExportStatusRequest = new BasicExportStatusRequest();
|
|
|
|
BasicExportStatusRequest basicExportStatusRequest = new BasicExportStatusRequest();
|
|
|
|
basicExportStatusRequest.setId(id);
|
|
|
|
basicExportStatusRequest.setId(id);
|
|
|
|
basicExportStatusRequest.setType(type);
|
|
|
|
basicExportStatusRequest.setType(type);
|
|
|
|
String result = UHttpClient.postJson(spsSyncUrl + "/spssync/basic/udiinfo/downloadByStatus", basicExportStatusRequest);
|
|
|
|
String result = UHttpClient.postJson(getIpUrl() + "/spssync/basic/udiinfo/downloadByStatus", basicExportStatusRequest);
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -141,7 +152,7 @@ public class SpGetHttpClient {
|
|
|
|
public BaseResponse<String> postBasicStatus(String id) {
|
|
|
|
public BaseResponse<String> postBasicStatus(String id) {
|
|
|
|
BasicExportStatusRequest basicStatusFilterRequest = new BasicExportStatusRequest();
|
|
|
|
BasicExportStatusRequest basicStatusFilterRequest = new BasicExportStatusRequest();
|
|
|
|
basicStatusFilterRequest.setId(id);
|
|
|
|
basicStatusFilterRequest.setId(id);
|
|
|
|
String result = UHttpClient.postJson(spsSyncUrl + "/spssync/basic/udiinfo/deleteByStatus", basicStatusFilterRequest);
|
|
|
|
String result = UHttpClient.postJson(getIpUrl() + "/spssync/basic/udiinfo/deleteByStatus", basicStatusFilterRequest);
|
|
|
|
BaseResponse<String> response =
|
|
|
|
BaseResponse<String> response =
|
|
|
|
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
|
|
|
|
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -150,7 +161,7 @@ public class SpGetHttpClient {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BaseResponse<String> postAllBaseData(SpsSyncDataResponse syncDataResponse) {
|
|
|
|
public BaseResponse<String> postAllBaseData(SpsSyncDataResponse syncDataResponse) {
|
|
|
|
String result = UHttpClient.postJson(spsSyncUrl + "/sps/sync/basic/upload", syncDataResponse);
|
|
|
|
String result = UHttpClient.postJson(getIpUrl() + "/sps/sync/basic/upload", syncDataResponse);
|
|
|
|
BaseResponse<String> response =
|
|
|
|
BaseResponse<String> response =
|
|
|
|
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
|
|
|
|
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -159,7 +170,7 @@ public class SpGetHttpClient {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BaseResponse<String> postAllBus(SpsSyncBusResponse spsSyncBusResponse) {
|
|
|
|
public BaseResponse<String> postAllBus(SpsSyncBusResponse spsSyncBusResponse) {
|
|
|
|
String result = UHttpClient.postJson(spsSyncUrl + "/sps/sync/busType/upload", spsSyncBusResponse);
|
|
|
|
String result = UHttpClient.postJson(getIpUrl() + "/sps/sync/busType/upload", spsSyncBusResponse);
|
|
|
|
BaseResponse<String> response =
|
|
|
|
BaseResponse<String> response =
|
|
|
|
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
|
|
|
|
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -168,7 +179,7 @@ public class SpGetHttpClient {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BaseResponse<String> postAllOrder(SpsSyncOrderResponse spsSyncOrderResponse) {
|
|
|
|
public BaseResponse<String> postAllOrder(SpsSyncOrderResponse spsSyncOrderResponse) {
|
|
|
|
String result = UHttpClient.postJson(spsSyncUrl + "/sps/sync/order/upload", spsSyncOrderResponse);
|
|
|
|
String result = UHttpClient.postJson(getIpUrl() + "/sps/sync/order/upload", spsSyncOrderResponse);
|
|
|
|
BaseResponse<String> response =
|
|
|
|
BaseResponse<String> response =
|
|
|
|
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
|
|
|
|
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -176,7 +187,7 @@ public class SpGetHttpClient {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public BaseResponse<String> postAllSchedule(SpsSyncScheduleResponse spsSyncScheduleResponse) {
|
|
|
|
public BaseResponse<String> postAllSchedule(SpsSyncScheduleResponse spsSyncScheduleResponse) {
|
|
|
|
String result = UHttpClient.postJson(spsSyncUrl + "/sps/sync/schedule/upload", spsSyncScheduleResponse);
|
|
|
|
String result = UHttpClient.postJson(getIpUrl() + "/sps/sync/schedule/upload", spsSyncScheduleResponse);
|
|
|
|
BaseResponse<String> response =
|
|
|
|
BaseResponse<String> response =
|
|
|
|
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
|
|
|
|
JSONObject.parseObject(result, new TypeReference<BaseResponse<String>>() {
|
|
|
|
});
|
|
|
|
});
|
|
|
|