fix 调用运控接口空指针问题&添加日志
parent
71071e2283
commit
6721936cef
|
@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ public class YunKongMessageSchedule {
|
||||||
|
|
||||||
String url = host + "/system/common/queryYKInterface";
|
String url = host + "/system/common/queryYKInterface";
|
||||||
HttpClient httpClient = new HttpClient(PostDataFormat.RAW);
|
HttpClient httpClient = new HttpClient(PostDataFormat.RAW);
|
||||||
log.info("curl -k -X POST -H 'Content-Type: application/json' -d '{}' '{}'", JSON.toJSONString(request), url);
|
log.info("【运控接口】curl -k -X POST -H 'Content-Type: application/json' -d '{}' '{}'", JSON.toJSONString(request), url);
|
||||||
Result result = httpClient.post(new HashMap<>(), request, url);
|
Result result = httpClient.post(new HashMap<>(), request, url);
|
||||||
Assert.isTrue(result.isSuccess(), result.getMessage());
|
Assert.isTrue(result.isSuccess(), result.getMessage());
|
||||||
|
|
||||||
|
@ -70,6 +71,10 @@ public class YunKongMessageSchedule {
|
||||||
for (int i = 0; i < array.size(); i++) {
|
for (int i = 0; i < array.size(); i++) {
|
||||||
JSONObject item = array.getJSONObject(i);
|
JSONObject item = array.getJSONObject(i);
|
||||||
String externalId = item.getString("record_id");
|
String externalId = item.getString("record_id");
|
||||||
|
if (StringUtils.isEmpty(externalId)) {
|
||||||
|
log.info("【运控接口】当前外部id为null:" + item.toJSONString());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Message message = oldMessages.stream()
|
Message message = oldMessages.stream()
|
||||||
.filter(m -> externalId.equals(m.getExternalId()))
|
.filter(m -> externalId.equals(m.getExternalId()))
|
||||||
.findFirst().orElse(new Message());
|
.findFirst().orElse(new Message());
|
||||||
|
|
Loading…
Reference in New Issue