From 38ce5bc7cd58a218f89d8f9ca6aacd7e14d6d93e Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期二, 03 二月 2026 15:53:54 +0800
Subject: [PATCH] 1
---
zy-acs-cv/src/main/java/com/zy/asrs/service/impl/CtuMainServiceImpl.java | 30 ++++++++++++++++++++++--------
1 files changed, 22 insertions(+), 8 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..8cc721e 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
@@ -3,8 +3,11 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.controller.requestParam.StationRequestParam;
+import com.zy.asrs.controller.vo.ApplyInDto;
+import com.zy.asrs.controller.vo.ApplyInRepsonseDto;
import com.zy.asrs.controller.vo.OpenBusSubmitParam;
import com.zy.asrs.controller.vo.StationStatus;
import com.zy.asrs.service.CtuMainService;
@@ -24,7 +27,7 @@
* Created by vincent on 2020/8/6
*/
@Slf4j
-@Service("ctuMainService")
+@Service
@Transactional
@Data
public class CtuMainServiceImpl implements CtuMainService {
@@ -39,6 +42,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 +58,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 +89,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 + "")) {
@@ -99,8 +110,8 @@
}
log.info("鏈繑鍥炵珯鐐圭姸鎬侊細{}", staNo);
} else {
- log.error("璋冪敤涓嬪彂浠诲姟鎺ュ彛鎶ラ敊锛屽搷搴旂爜锛歿}锛屽搷搴斿唴瀹癸細{}", jsonObject.getInteger("code"), response);
- throw new CoolException("璋冪敤涓嬪彂浠诲姟鎺ュ彛鎶ラ敊锛屽搷搴旂爜锛�" + jsonObject.getInteger("code"));
+ log.error("璋冪敤涓嬪彂浠诲姟鎺ュ彛鎶ラ敊锛屽搷搴旂爜锛歿}锛屽搷搴斿唴瀹癸細{}", jsonObject.getInteger(code), response);
+ throw new CoolException("璋冪敤涓嬪彂浠诲姟鎺ュ彛鎶ラ敊锛屽搷搴旂爜锛�" + jsonObject.getInteger(code));
}
} catch (CoolException e) {
log.error("璋冪敤绔欑偣鐘舵�佹帴鍙e紓甯�", e);
@@ -110,4 +121,7 @@
}
return null;
}
+
+
+
}
--
Gitblit v1.9.1