From 1dd888195c562851f869d6c75b424365ed1c781e Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 14 八月 2025 14:26:28 +0800
Subject: [PATCH] 有wechat模块增加查询所有摄像头及accessToken功能
---
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java | 44 ++++++++++++++++++++++++++++++++++----------
1 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java
index db4830b..a066651 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java
@@ -12,6 +12,7 @@
import com.dy.pipIrrGlobal.command.enums.LastOperateENUM;
import com.dy.pipIrrGlobal.command.result.CommandResultCode;
import com.dy.pipIrrGlobal.daoBa.BaSettingsMapper;
+import com.dy.pipIrrGlobal.daoIr.IrIntakeOperateMapper;
import com.dy.pipIrrGlobal.daoPr.PrCommonIntakesMapper;
import com.dy.pipIrrGlobal.daoPr.PrControllerMapper;
import com.dy.pipIrrGlobal.daoRm.RmCommandHistoryMapper;
@@ -34,7 +35,10 @@
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
-import java.util.*;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
@@ -62,10 +66,6 @@
protected String commandTypeOuter = CommandType.outerCommand;
- // 瀛樺偍瀹炰緥鍖栫殑 CompletableFuture<Data> 瀵硅薄
- protected static Map<Long, Object> features = new HashMap<>();
- //protected static Boolean setuped = false;
-
@Autowired
private RestTemplate restTemplate;
@@ -83,6 +83,9 @@
@Autowired
private PrCommonIntakesMapper prCommonIntakesMapper;
+
+ @Autowired
+ private IrIntakeOperateMapper irIntakeOperateMapper;
public static ComSupport comSupport;
@@ -205,19 +208,19 @@
*/
protected BaseResponse<Data> dealWithCallBack(Long comId, Command com) {
CompletableFuture<JSONObject> feature = new CompletableFuture<>();
- features.put(comId, feature);
+ ComResultWait.put(comId, feature);
try {
// 鍙戦�佸懡浠�
JSONObject response_SendCom = (JSONObject) JSON.toJSON(sendCom2Mw(com));
if (response_SendCom == null || !response_SendCom.getString("code").equals("0001")) {
// 璇锋眰澶辫触锛孯TU鏈笂绾匡紝娓呴櫎feature
- features.remove(comId);
+ ComResultWait.remove(comId);
JSONObject job_param = response_SendCom.getJSONObject("content").getJSONObject("param");
return BaseResponseUtils.buildErrorMsg(job_param.getString("message"));
}
JSONObject resultData = feature.get(180, TimeUnit.SECONDS);
- features.remove(comId);
+ ComResultWait.remove(comId);
Long commandId = resultData.getLong("commandId");
if (commandId.equals(comId)) {
@@ -279,6 +282,7 @@
Object param = po.getParam();
String rtuResultSendWebUrl = po.getRtuResultSendWebUrl();
Long operator = po.getOperator();
+ Byte openType = po.getOpenType();
// 鏋勯�犲懡浠�
Command com = command(comId, commandCode, rtuAddr, protocol, rtuResultSendWebUrl, param);
@@ -306,6 +310,7 @@
rmCommandHistory.setResult((byte) 0);
rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory);
//return BaseResponseUtils.buildErrorMsg(response_CallBack.getContent().toString());
+ irIntakeOperateMapper.updateByCommandId(comId, (byte)2, response_CallBack.getMsg());
return BaseResponseUtils.buildErrorMsg(response_CallBack.getMsg());
}
@@ -321,6 +326,7 @@
rmCommandHistory.setComId(comId);
rmCommandHistory.setResult((byte) 0);
rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory);
+ irIntakeOperateMapper.updateByCommandId(comId, (byte)2, "鍥炶皟瓒呮椂");
return BaseResponseUtils.buildErrorMsg(CommandResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage());
}
@@ -352,7 +358,16 @@
JSONObject job_param = (JSONObject) JSON.toJSON(param);
JSONObject job_data = job_response.getJSONObject("content").getJSONObject("data");
if(!job_data.getBoolean("success")) {
- // 寮�鍏抽榾澶辫触
+ // 寮�鍏抽榾澶辫触锛屾洿鏂板懡浠ゆ墽琛岀姸鎬佸強铏氭嫙鍗$姸鎬�
+
+ rmCommandHistory = new RmCommandHistory();
+ rmCommandHistory.setComId(comId);
+ rmCommandHistory.setResult((byte) 0);
+ rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory);
+
+ if(openType != null && openType == 1 ) {
+ irIntakeOperateMapper.updateByCommandId(comId, (byte)2, "寮�闃�澶辫触");
+ }
// 寮�闃�澶辫触鍒欒В闄ゅ崰鐢紝鍏抽榾澶辫触鍒欏崰鐢�
if (comType != null) {
@@ -375,7 +390,16 @@
response_CallBack.setMsg(CommandResultCode.OPEN_CLOSE_FAIL.getMessage());
response_CallBack.setSuccess(false);
}else {
- // 寮�鍏抽榾鎴愬姛
+ // 寮�鍏抽榾鎴愬姛锛屾洿鏂板懡浠ゆ墽琛岀姸鎬佸強铏氭嫙鍗$姸鎬�
+
+ rmCommandHistory = new RmCommandHistory();
+ rmCommandHistory.setComId(comId);
+ rmCommandHistory.setResult((byte) 1);
+ rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory);
+
+ if(openType != null && openType == 1) {
+ irIntakeOperateMapper.updateByCommandId(comId, (byte)1, null);
+ }
// 寮�闃�鎴愬姛鍒欏崰鐢紝鍏抽榾鎴愬姛涓嶅崰鐢�
if (comType != null) {
--
Gitblit v1.8.0