|
@@ -20,6 +20,7 @@ import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -38,30 +39,19 @@ public class LogisticsService {
|
|
|
@Resource
|
|
|
IPlatApiRecordService iPlatApiRecordService;
|
|
|
|
|
|
- public String repeat(String url){
|
|
|
- String result = null;
|
|
|
- try {
|
|
|
- String res = HttpUtils.sendGet(url);
|
|
|
- if (StringUtils.isNotBlank(res)){
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
- result = jsonObject.getString("data");
|
|
|
- }
|
|
|
- }catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
|
|
|
public void getLogisticsData(){
|
|
|
- String json = repeat(ApiUrlConfig.getLogisticsUrl());
|
|
|
+ JSONObject jsonObject = this.repeat(ApiUrlConfig.getLogisticsUrl());
|
|
|
+ if (Objects.isNull(jsonObject)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
// 添加接口请求记录
|
|
|
PlatApiRecord platApiRecord = new PlatApiRecord();
|
|
|
platApiRecord.setApiUrl(ApiUrlConfig.getLogisticsUrl());
|
|
|
- platApiRecord.setApiResult(json);
|
|
|
+ platApiRecord.setApiResult(jsonObject.toString());
|
|
|
iPlatApiRecordService.save(platApiRecord);
|
|
|
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(json);
|
|
|
JSONArray dataArray = jsonObject.getJSONArray("data");
|
|
|
List<LargeLogistics> list = new ArrayList<>();
|
|
|
List<LargeAssetDirs> officeAssetList = new ArrayList<>();
|
|
@@ -126,4 +116,16 @@ public class LogisticsService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public JSONObject repeat(String url){
|
|
|
+ try {
|
|
|
+ String res = HttpUtils.sendPost(url,"");
|
|
|
+ if (StringUtils.isNotBlank(res)){
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
+ return jsonObject;
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|