From b06ac186d84a7cb758314004d1e7328671b3db55 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期四, 02 十一月 2023 17:30:51 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ard-work/pom.xml | 5 -
ard-work/src/main/java/com/ruoyi/alarm/radar/service/impl/ArdRadarServiceImpl.java | 73 ++++++++++++++
ard-work/src/main/java/com/ruoyi/alarm/radar/service/ArdRadarService.java | 5 +
ruoyi-admin/src/main/resources/i18n/messages_en_US.properties | 37 +++++++
ard-work/src/main/java/com/ruoyi/device/radar/controller/ArdEquipRadarController.java | 16 ++
ard-work/src/main/java/com/ruoyi/utils/forest/RadarClient.java | 16 +++
ruoyi-admin/src/main/java/com/ruoyi/web/core/config/I18nConfig.java | 46 +++++++++
ard-work/src/main/java/com/ruoyi/device/radar/domain/GuideInfo.java | 15 +++
ruoyi-admin/src/main/resources/i18n/messages_zh_CN.properties | 37 +++++++
ruoyi-common/src/main/java/com/ruoyi/common/filter/MyI18nInterceptor.java | 41 ++++++++
ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumerCallback.java | 6 +
11 files changed, 290 insertions(+), 7 deletions(-)
diff --git a/ard-work/pom.xml b/ard-work/pom.xml
index cb6af83..de2d1f7 100644
--- a/ard-work/pom.xml
+++ b/ard-work/pom.xml
@@ -32,11 +32,6 @@
</dependency>
<!--娴峰悍褰曞儚鏈轰簩娆″紑鍙戜緷璧杍ar鍖�-->
<dependency>
- <groupId>net.java.jna</groupId>
- <artifactId>jna</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
<groupId>net.java.examples</groupId>
<artifactId>examples</artifactId>
<version>1.0.0</version>
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/radar/service/ArdRadarService.java b/ard-work/src/main/java/com/ruoyi/alarm/radar/service/ArdRadarService.java
new file mode 100644
index 0000000..1e51b9f
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/radar/service/ArdRadarService.java
@@ -0,0 +1,5 @@
+package com.ruoyi.alarm.radar.service;
+
+public interface ArdRadarService {
+ void forceGuide(String msg);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/radar/service/impl/ArdRadarServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarm/radar/service/impl/ArdRadarServiceImpl.java
new file mode 100644
index 0000000..8abcf5c
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/radar/service/impl/ArdRadarServiceImpl.java
@@ -0,0 +1,73 @@
+package com.ruoyi.alarm.radar.service.impl;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.ruoyi.alarm.radar.service.ArdRadarService;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.device.camera.domain.CameraCmd;
+import com.ruoyi.device.camera.service.ICameraSdkService;
+import com.ruoyi.device.radar.mapper.ArdEquipRadarMapper;
+import com.ruoyi.storage.minio.domain.jsonbean.JsonsRootBean;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Description: 闆疯揪涓氬姟
+ * @ClassName: ArdRadarServiceImpl
+ * @Author: 鍒樿嫃涔�
+ * @Date: 2023骞�11鏈�02鏃�9:00:08
+ **/
+@Slf4j(topic = "guideQueue")
+@Service
+public class ArdRadarServiceImpl implements ArdRadarService {
+ @Resource
+ ICameraSdkService iCameraSdkService;
+ @Resource
+ ArdEquipRadarMapper ardEquipRadarMapper;
+
+ /**
+ * 寮傛鎵ц寮哄埗寮曞
+ * 鍒樿嫃涔�
+ * 2023/11/2 9:00:55
+ */
+ @Override
+ @Async
+ public void forceGuide(String msg) {
+ try {
+ Map<String, Object> msgMap = JSONObject.parseObject(msg, Map.class);
+ if (msgMap != null) {
+ Double p = Double.parseDouble(msgMap.get("p").toString());
+ Double t = Double.parseDouble(msgMap.get("t").toString());
+ Double z = Double.parseDouble(msgMap.get("z").toString());
+ String radarId = msgMap.get("radarId").toString();
+ //鑾峰彇闆疯揪鎵�鍦ㄥ涓婄殑澶у厜鐢�
+ String cameraIdWithTower = ardEquipRadarMapper.getCameraByRadar(radarId);
+ if (StringUtils.isNotNull(cameraIdWithTower) && StringUtils.isNotEmpty(cameraIdWithTower)) {
+ log.debug("鑾峰彇鍒伴浄杈惧涓婄殑鍏夌數:" + cameraIdWithTower);
+ //濡傛灉闆疯揪濉斾笂鏈夊厜鐢�
+ CameraCmd cmd = new CameraCmd(cameraIdWithTower, 1);
+ cmd.setOperator("sys_radar_force");
+ Map<String, Double> ptzMap = new HashMap<>();
+ ptzMap.put("p", p);
+ ptzMap.put("t", t);
+ ptzMap.put("z", z);
+ cmd.setPtzMap(ptzMap);
+ boolean res = iCameraSdkService.setPtz(cmd);
+ if (res) {
+ log.debug("寮哄埗寮曞鎴愬姛");
+ } else {
+ log.debug("寮哄埗寮曞澶辫触");
+ }
+ } else {
+ log.debug("鏈幏鍙栧埌闆疯揪濉斾笂鐨勫厜鐢�");
+ }
+ }
+ } catch (Exception ex) {
+ log.error("寮哄埗寮曞寮傚父:"+ ex.getMessage());
+ }
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/device/radar/controller/ArdEquipRadarController.java b/ard-work/src/main/java/com/ruoyi/device/radar/controller/ArdEquipRadarController.java
index ccbbc0a..62de8d8 100644
--- a/ard-work/src/main/java/com/ruoyi/device/radar/controller/ArdEquipRadarController.java
+++ b/ard-work/src/main/java/com/ruoyi/device/radar/controller/ArdEquipRadarController.java
@@ -1,9 +1,12 @@
package com.ruoyi.device.radar.controller;
import java.util.List;
+import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.device.radar.domain.GuideInfo;
+import com.ruoyi.utils.forest.RadarClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -36,9 +39,10 @@
@Api(tags = "闆疯揪绠$悊鎺ュ彛")
public class ArdEquipRadarController extends BaseController
{
- @Autowired
+ @Resource
private IArdEquipRadarService ardEquipRadarService;
-
+ @Resource
+ private RadarClient radarClient;
/**
* 鏌ヨradar鍒楄〃
*/
@@ -112,4 +116,12 @@
{
return toAjax(ardEquipRadarService.deleteArdEquipRadarByIds(ids));
}
+
+ @ApiOperation(value = "瑙掑害寮曞淇℃伅鍙嶉")
+ @PostMapping("/guideInfo")
+ public AjaxResult guideInfoBack(@RequestBody GuideInfo guideInfo)
+ {
+ return radarClient.guideInfoBack(guideInfo);
+ }
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/device/radar/domain/GuideInfo.java b/ard-work/src/main/java/com/ruoyi/device/radar/domain/GuideInfo.java
new file mode 100644
index 0000000..552aa5b
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/device/radar/domain/GuideInfo.java
@@ -0,0 +1,15 @@
+package com.ruoyi.device.radar.domain;
+
+import lombok.Data;
+
+/**
+ * @Description:
+ * @ClassName: GuideInfo
+ * @Author: 鍒樿嫃涔�
+ * @Date: 2023骞�11鏈�01鏃�15:45:10
+ **/
+@Data
+public class GuideInfo {
+ String radarId;
+ double[] targetPosition;
+}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/forest/RadarClient.java b/ard-work/src/main/java/com/ruoyi/utils/forest/RadarClient.java
new file mode 100644
index 0000000..6c62313
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/utils/forest/RadarClient.java
@@ -0,0 +1,16 @@
+package com.ruoyi.utils.forest;
+
+import com.dtflys.forest.annotation.BaseRequest;
+import com.dtflys.forest.annotation.JSONBody;
+import com.dtflys.forest.annotation.Post;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.device.radar.domain.GuideInfo;
+
+@BaseRequest(baseURL = "http://127.0.0.1:8088/radar")
+public interface RadarClient {
+ /**
+ * 瑙掑害寮曞淇℃伅鍙嶉
+ */
+ @Post("/guideInfoBack")
+ public AjaxResult guideInfoBack(@JSONBody GuideInfo guideInfo);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumerCallback.java b/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumerCallback.java
index 7e2a2d3..29965fa 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumerCallback.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumerCallback.java
@@ -1,6 +1,7 @@
package com.ruoyi.utils.mqtt;
import com.ruoyi.alarm.global.service.impl.GlobalAlarmServiceImpl;
+import com.ruoyi.alarm.radar.service.ArdRadarService;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.statistical.service.StatisticalService;
import com.ruoyi.storage.minio.service.IStorageMinioEventService;
@@ -85,6 +86,11 @@
StatisticalService statisticalService = SpringUtils.getBean(StatisticalService.class);
statisticalService.data(new String(message.getPayload(), StandardCharsets.UTF_8));
}
+ if (topic.equals("radarForceGuide"))
+ {
+ ArdRadarService ardRadarService = SpringUtils.getBean(ArdRadarService.class);
+ ardRadarService.forceGuide(new String(message.getPayload(), StandardCharsets.UTF_8));
+ }
} catch (Exception e) {
log.debug("澶勭悊mqtt娑堟伅寮傚父:" + e);
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/I18nConfig.java b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/I18nConfig.java
new file mode 100644
index 0000000..d0cd0e1
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/I18nConfig.java
@@ -0,0 +1,46 @@
+package com.ruoyi.web.core.config;
+
+import com.ruoyi.common.filter.MyI18nInterceptor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.LocaleResolver;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
+import org.springframework.web.servlet.i18n.SessionLocaleResolver;
+
+import java.util.Locale;
+
+
+@Configuration
+@Slf4j
+public class I18nConfig implements WebMvcConfigurer {
+ @Bean
+ public LocaleResolver localeResolver()
+ {
+ SessionLocaleResolver slr = new SessionLocaleResolver();
+ // 榛樿璇█
+ slr.setDefaultLocale(Locale.SIMPLIFIED_CHINESE);
+ return slr;
+ }
+ //@Bean
+ //public LocaleChangeInterceptor localeChangeInterceptor()
+ //{
+ // LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
+ // // 鍙傛暟鍚�
+ // lci.setParamName("lang");
+ // return lci;
+ //}
+
+ @Override
+ public void addInterceptors(InterceptorRegistry registry) {
+ // 娉ㄥ唽鎷︽埅鍣�
+ MyI18nInterceptor myHandlerInterceptor = new MyI18nInterceptor();
+ InterceptorRegistration loginRegistry = registry.addInterceptor(myHandlerInterceptor);
+ // 鎷︽埅璺緞
+ loginRegistry.addPathPatterns("/**");
+ }
+
+}
diff --git a/ruoyi-admin/src/main/resources/i18n/messages_en_US.properties b/ruoyi-admin/src/main/resources/i18n/messages_en_US.properties
new file mode 100644
index 0000000..3b74bd8
--- /dev/null
+++ b/ruoyi-admin/src/main/resources/i18n/messages_en_US.properties
@@ -0,0 +1,37 @@
+#\u9519\u8BEF\u6D88\u606F
+not.null=* Mandatory
+user.jcaptcha.error=Verification code error
+user.jcaptcha.expire=The verification code has expired
+user.not.exists=User does not exist/password error
+user.password.not.match=User does not exist/password error
+user.password.retry.limit.count=Password input error {0} times
+user.password.retry.limit.exceed=Password input error {0} times, account locked for {1} minutes
+user.password.delete=Sorry, your account has been deleted
+user.blocked=The user has been banned. Please contact the administrator
+role.blocked=The role has been banned. Please contact the administrator
+user.logout.success=Exit successfully
+
+length.not.valid=The length must be between {min} and {max} characters
+
+user.username.not.valid=*Composed of 2 to 20 Chinese characters, letters, numbers, or underscores, and must start with a non numeric character
+user.password.not.valid=*5-50 characters
+
+user.email.not.valid=Email format error
+user.mobile.phone.number.not.valid=Mobile number format error
+user.login.success=Login successful
+user.register.success=login was successful
+user.notfound=Please log in again
+user.forcelogout=Administrator forced exit, please log in again
+user.unknown.error=Unknown error, please log in again
+
+##\u6587\u4EF6\u4E0A\u4F20\u6D88\u606F
+upload.exceed.maxSize=The uploaded file size exceeds the limit file size< The maximum allowed file size is: {0}MB !
+upload.filename.exceed.length=The maximum length of the uploaded file name is {0} characters
+
+##\u6743\u9650
+no.permission=You do not have permission for data. Please contact the administrator to add permission [{0}]
+no.create.permission=You do not have permission to create data. Please contact the administrator to add permissions [{0}]
+no.update.permission=You do not have permission to modify data. Please contact the administrator to add permissions [{0}]
+no.delete.permission=You do not have permission to delete data. Please contact the administrator to add permissions [{0}]
+no.export.permission=You do not have permission to export data. Please contact the administrator to add permissions [{0}]
+no.view.permission=You do not have permission to view data. Please contact the administrator to add permissions [{0}]
diff --git a/ruoyi-admin/src/main/resources/i18n/messages_zh_CN.properties b/ruoyi-admin/src/main/resources/i18n/messages_zh_CN.properties
new file mode 100644
index 0000000..4098fc9
--- /dev/null
+++ b/ruoyi-admin/src/main/resources/i18n/messages_zh_CN.properties
@@ -0,0 +1,37 @@
+#閿欒娑堟伅
+not.null=* 蹇呴』濉啓
+user.jcaptcha.error=楠岃瘉鐮侀敊璇�
+user.jcaptcha.expire=楠岃瘉鐮佸凡澶辨晥
+user.not.exists=鐢ㄦ埛涓嶅瓨鍦�/瀵嗙爜閿欒
+user.password.not.match=鐢ㄦ埛涓嶅瓨鍦�/瀵嗙爜閿欒
+user.password.retry.limit.count=瀵嗙爜杈撳叆閿欒{0}娆�
+user.password.retry.limit.exceed=瀵嗙爜杈撳叆閿欒{0}娆★紝甯愭埛閿佸畾{1}鍒嗛挓
+user.password.delete=瀵逛笉璧凤紝鎮ㄧ殑璐﹀彿宸茶鍒犻櫎
+user.blocked=鐢ㄦ埛宸插皝绂侊紝璇疯仈绯荤鐞嗗憳
+role.blocked=瑙掕壊宸插皝绂侊紝璇疯仈绯荤鐞嗗憳
+user.logout.success=閫�鍑烘垚鍔�
+
+length.not.valid=闀垮害蹇呴』鍦▄min}鍒皗max}涓瓧绗︿箣闂�
+
+user.username.not.valid=* 2鍒�20涓眽瀛椼�佸瓧姣嶃�佹暟瀛楁垨涓嬪垝绾跨粍鎴愶紝涓斿繀椤讳互闈炴暟瀛楀紑澶�
+user.password.not.valid=* 5-50涓瓧绗�
+
+user.email.not.valid=閭鏍煎紡閿欒
+user.mobile.phone.number.not.valid=鎵嬫満鍙锋牸寮忛敊璇�
+user.login.success=鐧诲綍鎴愬姛
+user.register.success=娉ㄥ唽鎴愬姛
+user.notfound=璇烽噸鏂扮櫥褰�
+user.forcelogout=绠$悊鍛樺己鍒堕��鍑猴紝璇烽噸鏂扮櫥褰�
+user.unknown.error=鏈煡閿欒锛岃閲嶆柊鐧诲綍
+
+##鏂囦欢涓婁紶娑堟伅
+upload.exceed.maxSize=涓婁紶鐨勬枃浠跺ぇ灏忚秴鍑洪檺鍒剁殑鏂囦欢澶у皬锛�<br/>鍏佽鐨勬枃浠舵渶澶уぇ灏忔槸锛歿0}MB锛�
+upload.filename.exceed.length=涓婁紶鐨勬枃浠跺悕鏈�闀縶0}涓瓧绗�
+
+##鏉冮檺
+no.permission=鎮ㄦ病鏈夋暟鎹殑鏉冮檺锛岃鑱旂郴绠$悊鍛樻坊鍔犳潈闄� [{0}]
+no.create.permission=鎮ㄦ病鏈夊垱寤烘暟鎹殑鏉冮檺锛岃鑱旂郴绠$悊鍛樻坊鍔犳潈闄� [{0}]
+no.update.permission=鎮ㄦ病鏈変慨鏀规暟鎹殑鏉冮檺锛岃鑱旂郴绠$悊鍛樻坊鍔犳潈闄� [{0}]
+no.delete.permission=鎮ㄦ病鏈夊垹闄ゆ暟鎹殑鏉冮檺锛岃鑱旂郴绠$悊鍛樻坊鍔犳潈闄� [{0}]
+no.export.permission=鎮ㄦ病鏈夊鍑烘暟鎹殑鏉冮檺锛岃鑱旂郴绠$悊鍛樻坊鍔犳潈闄� [{0}]
+no.view.permission=鎮ㄦ病鏈夋煡鐪嬫暟鎹殑鏉冮檺锛岃鑱旂郴绠$悊鍛樻坊鍔犳潈闄� [{0}]
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/MyI18nInterceptor.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/MyI18nInterceptor.java
new file mode 100644
index 0000000..836fba0
--- /dev/null
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/MyI18nInterceptor.java
@@ -0,0 +1,41 @@
+package com.ruoyi.common.filter;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.i18n.LocaleContextHolder;
+import org.springframework.web.servlet.HandlerInterceptor;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Locale;
+
+@Slf4j
+public class MyI18nInterceptor implements HandlerInterceptor {
+
+ @Override
+ public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+ final String key = "language";
+ String language = "en_US";//request.getHeader(key);
+ // 鍓嶇浼犻�掔殑language蹇呴』鏄痾h-CN鏍煎紡鐨勶紝涓棿鐨�-蹇呴』瑕佸畬鏁达紝涓嶈兘鍙紶閫抸h鎴杄n
+ log.info("褰撳墠璇█={}",language);
+ Locale locale = new Locale(language.split("_")[0],language.split("_")[1]);
+ // 杩欐牱璧嬪�间互鍚庯紝MessageUtils.message鏂规硶灏变笉鐢ㄤ慨鏀逛簡
+ LocaleContextHolder.setLocale(locale);
+ return true;
+ }
+
+ /**
+ * 璇锋眰澶勭悊涔嬪悗杩涜璋冪敤锛屼絾鏄湪瑙嗗浘琚覆鏌撲箣鍓嶏紙Controller鏂规硶璋冪敤涔嬪悗锛�
+ */
+ @Override
+ public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) {
+ }
+
+ /**
+ * 鍦ㄦ暣涓姹傜粨鏉熶箣鍚庤璋冪敤锛屼篃灏辨槸鍦―ispatcherServlet 娓叉煋浜嗗搴旂殑瑙嗗浘涔嬪悗鎵ц锛堜富瑕佹槸鐢ㄤ簬杩涜璧勬簮娓呯悊宸ヤ綔锛�
+ */
+ @Override
+ public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
+ }
+
+}
--
Gitblit v1.9.3