ard-work/pom.xml
@@ -32,11 +32,6 @@ </dependency> <!--海康录像机二次开发依赖jar包--> <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> 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); } 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()); } } } 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); } } 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; } 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); } 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); } 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("/**"); } } 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}] 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}] 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必须是zh-CN格式的,中间的-必须要完整,不能只传递zh或en 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) { } /** * 在整个请求结束之后被调用,也就是在DispatcherServlet 渲染了对应的视图之后执行(主要是用于进行资源清理工作) */ @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { } }