Browse Source

数据统计和新增系统修改

gao.qiang 10 months ago
parent
commit
b4300ec73c

+ 6 - 0
business-service/src/main/java/com/ozs/entity/BaseCameraManagement.java

@@ -224,9 +224,15 @@ public class BaseCameraManagement extends BaseEntity implements Serializable {
     /**
      * 显卡的使用(为了充分使用正式服务器的四张显卡)
      */
+    @Excel(name = "显卡")
     private String graphicsCard;
     /**
      * 车号
      */
     private String trainNum;
+
+    /**
+     * AB节
+     */
+    private String abSection;
 }

+ 4 - 0
business-service/src/main/java/com/ozs/entity/response/PreAlarmListResponse.java

@@ -33,4 +33,8 @@ public class PreAlarmListResponse {
      * 当前播放的相机编码
      */
     private String cameraCode;
+    /**
+     * 预警时间
+     */
+    private Long  preAlarmTime;
 }

+ 6 - 1
business-service/src/main/java/com/ozs/entity/response/VehicleVedioResponse.java

@@ -14,5 +14,10 @@ public class VehicleVedioResponse {
     /**
      * 车号
      */
-    private Integer trainNum;
+    private String trainNum;
+    /**
+     * AB节
+     */
+    private String abSection;
+
 }

+ 3 - 0
business-service/src/main/java/com/ozs/entity/vo/BaseCameraManagementVos.java

@@ -108,4 +108,7 @@ public class BaseCameraManagementVos implements Serializable {
      */
     @Excel(name = "排序")
     private String sort;
+
+    @Excel(name = "显卡")
+    private String graphicsCard;
 }

+ 4 - 0
business-service/src/main/java/com/ozs/entity/vo/MsgAlarmResp.java

@@ -152,4 +152,8 @@ public class MsgAlarmResp implements Serializable {
     private String enableOrNotName;
 
     private Integer alarmLevel;
+    /**
+     * 报警视频的URL
+     */
+    private String alarmUrl;
 }

+ 3 - 2
business-service/src/main/java/com/ozs/service/impl/BaseCameraManagementServiceImpl.java

@@ -67,6 +67,8 @@ public class BaseCameraManagementServiceImpl extends ServiceImpl<BaseCameraManag
     private BaseRailwayManagementMapper baseRailwayManagementMapper;
     @Autowired
     private ISysDictTypeService dictTypeService;
+    @Autowired
+    private CameraUtil cameraUtil;
 
     /**
      * 相机台账管理表导入
@@ -159,7 +161,6 @@ public class BaseCameraManagementServiceImpl extends ServiceImpl<BaseCameraManag
 //                                accountManagement.setInstallMile(accountManagement.getInstallMileBD() * 1000);
 //                                accountManagement.setEndMile(accountManagement.getEndMile() * 1000);
 //                                accountManagement.setBeginMile(accountManagement.getBeginMile() * 1000);
-
                             if (!StringUtils.isEmpty(cameraManagementVos.getMonitoringDirectionName())) {
                                 List<SysDictData> data = dictTypeService.selectDictDataByType("monitoring_direction");
                                 for (SysDictData datum : data) {
@@ -480,7 +481,7 @@ public class BaseCameraManagementServiceImpl extends ServiceImpl<BaseCameraManag
         if (!ObjectUtils.isEmpty(baseCameraManagementList)) {
             List<BaseCameraManagement> list = new ArrayList<>(baseCameraManagementList);
             for (BaseCameraManagement baseCameraManagement : list) {
-                String flv = CameraUtil.getPlayFlv(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel());
+                String flv = cameraUtil.getPlayFlv(baseCameraManagement.getCameraCode(), baseCameraManagement.getGraphicsCard());
                 BaseVehicleTerminalDto dto = new BaseVehicleTerminalDto();
                 dto.setUrl(flv);
                 dto.setCameraCode(baseCameraManagement.getCameraCode());

+ 10 - 11
business-service/src/main/java/com/ozs/service/impl/MonitorSystemServiceImpl.java

@@ -86,26 +86,25 @@ public class MonitorSystemServiceImpl extends ServiceImpl<MonitorSystemMapper, M
             list.forEach(l -> {
                 if (l.getEnv().equals(1)) {//测试环境
                     monitor.setTestSecret(SM4Utils.decryptData_ECB(l.getClientSecret(), KEY));
-                } else if (l.getEnv().equals(2)) {//正式环境
-                    monitor.setClientSecret(SM4Utils.decryptData_ECB(l.getClientSecret(), KEY));
+//                } else if (l.getEnv().equals(2)) {//正式环境
+//                    monitor.setClientSecret(SM4Utils.decryptData_ECB(l.getClientSecret(), KEY));
                 }
             });
         }
         Integer grantType = 1;
         int row1 = 0;
         int row2 = 0;
-        if (!monitorSystem.getClientId().equals(monitor.getClientId()) || !monitorSystem.getClientSecret().equals(monitor.getClientSecret())
-                || !monitorSystem.getTestSecret().equals(monitor.getTestSecret())) {//客户端编号或者正式环境密钥或者测试环境密钥改变
+        if (!monitorSystem.getClientId().equals(monitor.getClientId()) || !monitorSystem.getTestSecret().equals(monitor.getTestSecret())) {//客户端编号或者正式环境密钥或者测试环境密钥改变
             LambdaQueryWrapper<SvcAddress> wrapper = new LambdaQueryWrapper<SvcAddress>();
             wrapper.eq(SvcAddress::getClientId, monitor.getClientId());
             svcAddressMapper.delete(wrapper);
 
-            SvcAddress svc = new SvcAddress();
-            svc.setClientId(monitorSystem.getClientId());
-            svc.setClientSecret(SM4Utils.encryptData_ECB(monitorSystem.getClientSecret(), KEY));//正式环境
-            svc.setGrantType(grantType);
-            svc.setEnv(2);
-            row1 = svcAddressMapper.insert(svc);
+//            SvcAddress svc = new SvcAddress();
+//            svc.setClientId(monitorSystem.getClientId());
+//            svc.setClientSecret(SM4Utils.encryptData_ECB(monitorSystem.getClientSecret(), KEY));//正式环境
+//            svc.setGrantType(grantType);
+//            svc.setEnv(2);
+//            row1 = svcAddressMapper.insert(svc);
             SvcAddress svc1 = new SvcAddress();
             svc1.setClientId(monitorSystem.getClientId());
             svc1.setClientSecret(SM4Utils.encryptData_ECB(monitorSystem.getTestSecret(), KEY));//测试环境
@@ -209,8 +208,8 @@ public class MonitorSystemServiceImpl extends ServiceImpl<MonitorSystemMapper, M
                         offlineMonitor++;
                         monitorSystem.setStatus(2);
                     }
-                    monitorSystemMapper.updateById(monitorSystem);
                 }
+                monitorSystemMapper.updateById(monitorSystem);
             }
         }
         mapCount.put("monitorSystemList", monitorSystemList);

+ 6 - 2
vehicle-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseCameraManagementController.java

@@ -1034,8 +1034,12 @@ public class BaseCameraManagementController extends BaseController {
 
     @GetMapping(value = "/terminalHeartbeatLog")
     public AjaxResult terminalHeartbeatLog() {
-        List<TerminalHeartbeatLog> list = terminalHeartbeatLogService.terminalHeartbeatLogList();
-        return AjaxResult.success(list);
+        TerminalHeartbeatLog terminalHeartbeatLog = new TerminalHeartbeatLog();
+        terminalHeartbeatLog.setId(terminalHeartbeatLogService.count() + 1);
+        terminalHeartbeatLog.setCameraCode("111");
+        terminalHeartbeatLog.setCreateTime(new Date());
+        boolean save = terminalHeartbeatLogService.save(terminalHeartbeatLog);
+        return AjaxResult.success(save);
     }
 
     /**

+ 4 - 2
vehicle-admin/src/main/java/com/ozs/web/controller/accountmanagment/DataStatisticController.java

@@ -1,5 +1,6 @@
 package com.ozs.web.controller.accountmanagment;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ozs.common.annotation.Log;
@@ -11,6 +12,7 @@ import com.ozs.common.utils.StringUtils;
 import com.ozs.common.utils.poi.ExcelUtil;
 import com.ozs.entity.BaseUser;
 import com.ozs.entity.BaseTerminal;
+import com.ozs.entity.BaseVehicle;
 import com.ozs.entity.vo.*;
 import com.ozs.service.*;
 import com.ozs.system.service.ISysDictDataService;
@@ -325,10 +327,10 @@ public class DataStatisticController extends BaseController {
     @Log(title = "查询终端数、机车数、相机数、预警数", businessType = BusinessType.SELECT)
     public AjaxResult getNum() {
         Long alarmNum = msgAlarmService.getAlarmNum();
-        Long vehicleNum = baseVehicleService.count();
+        Long vehicleNum = baseVehicleService.count(new LambdaQueryWrapper<BaseVehicle>().groupBy(BaseVehicle::getVehicleCode));
         QueryWrapper<BaseTerminal> wrapper = new QueryWrapper<BaseTerminal>();
         wrapper.lambda().eq(BaseTerminal::getStatus, 1);
-        Long terminalNum = baseTerminalService.count();
+        Long terminalNum = baseTerminalService.count(new LambdaQueryWrapper<BaseTerminal>().groupBy(BaseTerminal::getTerminalCode));
         Long cameraNum = baseCameraManagementService.count();
         DataStatisticNum dataStatisticNum = new DataStatisticNum();
         if (!ObjectUtils.isEmpty(alarmNum)) {

+ 20 - 4
vehicle-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmController.java

@@ -21,6 +21,7 @@ import com.ozs.system.service.DataScoreUtil;
 import com.ozs.system.service.ISysDeptService;
 import com.ozs.system.service.ISysDictDataService;
 import com.ozs.system.service.ISysDictTypeService;
+import com.ozs.utils.CameraUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
@@ -74,6 +75,8 @@ public class MsgAlarmController extends BaseController {
     private MonitorSystemService monitorSystemService;
     @Autowired
     private BaseTerminalService baseTerminalService;
+    @Autowired
+    private CameraUtil cameraUtil;
 
     /**
      * web更多消息-总数,已读数
@@ -308,13 +311,21 @@ public class MsgAlarmController extends BaseController {
 //            }
             // 查询里程位置最近的相机
             LambdaQueryWrapper<BaseCameraManagement> lw = new LambdaQueryWrapper<>();
-            if (!StringUtils.isEmptySunhh(msgAlarm.getRailwayCode())) {
-                lw.eq(BaseCameraManagement::getRailwayCode, msgAlarm.getRailwayCode());
+            if (msgAlarm.getLineDir() == 1) {
+                lw.ge(BaseCameraManagement::getEndMile, msgAlarm.getAlarmMile());
+                lw.le(BaseCameraManagement::getBeginMile, msgAlarm.getAlarmMile());
+                lw.in(BaseCameraManagement::getMonitoringDirection, 1, 3);
+                lw.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
             }
-            if (!StringUtils.isEmptySunhh(msgAlarm.getAlarmMile())) {
+            if (msgAlarm.getLineDir() == 2) {
+                lw.ge(BaseCameraManagement::getEndMile, msgAlarm.getAlarmMile());
                 lw.le(BaseCameraManagement::getBeginMile, msgAlarm.getAlarmMile());
-                lw.gt(BaseCameraManagement::getEndMile, msgAlarm.getAlarmMile());
+                lw.in(BaseCameraManagement::getMonitoringDirection, 2, 3);
+                lw.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
             }
+            lw.eq(BaseCameraManagement::getRailwayCode, msgAlarm.getRailwayCode());
+            lw.eq(BaseCameraManagement::getOnline, 2);
+            lw.eq(BaseCameraManagement::getEnableOrNot, 1);
             List<BaseCameraManagement> baseCameraManagementList = baseCameraManagementService.list(lw);
             BaseCameraManagement baseCameraManagement = new BaseCameraManagement();
             if (!StringUtils.isEmptySunhh(baseCameraManagementList) && baseCameraManagementList.size() > 0) {
@@ -364,6 +375,11 @@ public class MsgAlarmController extends BaseController {
                     }
                 }
             });
+            if (msgAlarm.getAlarmType() == 2) {
+                msgAlarmResp.setAlarmUrl("https://rtmp01open.ys7.com:9188/v3/openlive/K38316196_1_1.flv?expire=1745409016&id=704781554165264384&t=477265ab4d36debe072836e0b16755ba50303c3b8eb165a628bc9c0a0328afb5&ev=100");
+            }else {
+                msgAlarmResp.setAlarmUrl(CameraUtil.getPlayFlv(baseCameraManagement.getCameraCode(), "channel"));
+            }
             return AjaxResult.success(msgAlarmResp);
         } else {
             return success("无报警信息数据");