From 1b6c512c4b251e7131a9b78e6f4ecb3a7d0a31a3 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期一, 02 二月 2026 14:44:05 +0800
Subject: [PATCH] 1
---
zy-acs-cv/src/main/java/com/zy/asrs/service/impl/CtuMainServiceImpl.java | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/zy-acs-cv/src/main/java/com/zy/asrs/service/impl/CtuMainServiceImpl.java b/zy-acs-cv/src/main/java/com/zy/asrs/service/impl/CtuMainServiceImpl.java
index bb1e295..467c66c 100644
--- a/zy-acs-cv/src/main/java/com/zy/asrs/service/impl/CtuMainServiceImpl.java
+++ b/zy-acs-cv/src/main/java/com/zy/asrs/service/impl/CtuMainServiceImpl.java
@@ -39,6 +39,14 @@
@Value("${ctu.sendTask}")
private String sendTask;
+ private String code ="code";
+
+ private String dataCode ="data";
+
+ private Integer codeValue =200;
+
+ private Integer timeout = 1200;
+
@Transactional
public boolean sendTask(OpenBusSubmitParam openBusSubmitParam) {
@@ -47,12 +55,12 @@
response = new HttpHandler.Builder()
.setUri(ctuUrl)
.setPath(sendTask)
- .setTimeout(1200, TimeUnit.SECONDS)
+ .setTimeout(timeout, TimeUnit.SECONDS)
.setJson(JSON.toJSONString(openBusSubmitParam))
.build()
.doPost();
JSONObject jsonObject = JSON.parseObject(response);
- if (jsonObject.getInteger("code").equals(200)) {
+ if (jsonObject.getInteger(code).equals(codeValue)) {
log.info("涓嬪彂浠诲姟杩斿洖鏁版嵁锛歿}", response);
return true;
}
@@ -78,14 +86,14 @@
response = new HttpHandler.Builder()
.setUri(ctuUrl)
.setPath(station)
- .setTimeout(1200, TimeUnit.SECONDS)
+ .setTimeout(timeout, TimeUnit.SECONDS)
.setJson(JSON.toJSONString(stationRequestParam))
.build()
.doPost();
JSONObject jsonObject = JSON.parseObject(response);
- if (jsonObject.getInteger("code").equals(200)) {
+ if (jsonObject.getInteger(code).equals(codeValue)) {
log.info("RCS杩斿洖鏁版嵁锛歿}", response);
- JSONArray data = jsonObject.getJSONArray("data");
+ JSONArray data = jsonObject.getJSONArray(dataCode);
List<StationStatus> stationStatuses = JSONArray.parseArray(data.toString(), StationStatus.class);
for (StationStatus object : stationStatuses) {
if (object.getStaNo().equals(staNo + "")) {
--
Gitblit v1.9.1