Browse Source

线路下拉 添加工务段

sunhh 1 year ago
parent
commit
83be42ccd2
16 changed files with 222 additions and 18 deletions
  1. 10 1
      business-service/src/main/java/com/ozs/service/entity/BaseRailwayManagement.java
  2. 6 0
      business-service/src/main/java/com/ozs/service/entity/CameraTree.java
  3. 4 0
      business-service/src/main/java/com/ozs/service/mapper/BaseRailwayManagementMapper.java
  4. 2 1
      business-service/src/main/java/com/ozs/service/mapper/MsgAlarmMapper.java
  5. 2 0
      business-service/src/main/java/com/ozs/service/service/BaseRailwayManagementService.java
  6. 2 0
      business-service/src/main/java/com/ozs/service/service/MsgAlarmService.java
  7. 3 8
      business-service/src/main/java/com/ozs/service/service/impl/BaseDeviceDynamicManagementServiceImpl.java
  8. 5 0
      business-service/src/main/java/com/ozs/service/service/impl/BaseRailwayManagementServiceImpl.java
  9. 13 0
      business-service/src/main/java/com/ozs/service/service/impl/MsgAlarmServiceImpl.java
  10. 6 4
      business-service/src/main/resources/mapper/service/BaseDeviceDynamicManagementMapper.xml
  11. 8 0
      business-service/src/main/resources/mapper/service/BaseRailwayManagementMapper.xml
  12. 83 0
      business-service/src/main/resources/mapper/service/MsgAlarmMapper.xml
  13. 0 2
      hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseCameraManagementController.java
  14. 2 1
      hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseRailwayManagementController.java
  15. 75 0
      hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmController.java
  16. 1 1
      hazard-admin/src/main/java/com/ozs/web/controller/websocket/WebSocketConteoller.java

+ 10 - 1
business-service/src/main/java/com/ozs/service/entity/BaseRailwayManagement.java

@@ -32,7 +32,16 @@ import lombok.NoArgsConstructor;
 public class BaseRailwayManagement extends BaseEntity implements Serializable ,Comparable<BaseRailwayManagement>{
 
     private static final long serialVersionUID = 1L;
-
+    /**
+     * 工务段ID
+     */
+    @TableField(exist = false)
+    private String deptId;
+    /**
+     * 工务段名称
+     */
+    @TableField(exist = false)
+    private String deptName;
     /**
      * 主键ID
      */

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

@@ -1,5 +1,6 @@
 package com.ozs.service.entity;
 
+import com.ozs.common.annotation.Excel;
 import lombok.Builder;
 import lombok.Data;
 import sun.reflect.generics.tree.Tree;
@@ -19,6 +20,11 @@ public class CameraTree implements Serializable,Comparable<CameraTree> {
     String name;
     boolean flay;
     Integer mileage;
+    /**
+     * 所属工务段
+     */
+    @Excel(name = "所属工务段")
+    private String publicWorksSection;
     List<CameraTree> children;
 
     @Override

+ 4 - 0
business-service/src/main/java/com/ozs/service/mapper/BaseRailwayManagementMapper.java

@@ -5,6 +5,8 @@ import com.ozs.service.entity.BaseRailwayManagement;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * <p>
  *   线路管理表 Mapper 接口
@@ -17,4 +19,6 @@ import org.apache.ibatis.annotations.Param;
 public interface BaseRailwayManagementMapper extends BaseMapper<BaseRailwayManagement> {
 
     String getCameraNameByCameraCode(@Param("cameraCode") String cameraCode);
+
+    List<BaseRailwayManagement> listRailway();
 }

+ 2 - 1
business-service/src/main/java/com/ozs/service/mapper/MsgAlarmMapper.java

@@ -37,7 +37,6 @@ public interface MsgAlarmMapper extends BaseMapper<MsgAlarm> {
 
     MsgAlarm selectByCameraCode(@Param("cameraCode") String cameraCode);
 
-
     List<MsgAlarm> selectMsgAlarmList(MsgAlarmVo msgAlarmVo);
 
     MsgAlarm getByAlarmId(@Param("alarmId") String alarmId);
@@ -49,4 +48,6 @@ public interface MsgAlarmMapper extends BaseMapper<MsgAlarm> {
     Integer countWJC(MsgAlarmVo msgAlarmVo);
 
     List<MsgAlarm> queryAlarmInfoByAfterTenMinute();
+
+    List<MsgAlarm> selectMsgAlarmListHome(MsgAlarmVo msgAlarmVo);
 }

+ 2 - 0
business-service/src/main/java/com/ozs/service/service/BaseRailwayManagementService.java

@@ -25,4 +25,6 @@ public interface BaseRailwayManagementService extends IService<BaseRailwayManage
     String importBaseLineManagement(List<BaseRailwayManagement> accountManageList, boolean updateSupport,String userId);
 
     String getCameraNameByCameraCode(String cameraCode);
+
+    List<BaseRailwayManagement> listRailway();
 }

+ 2 - 0
business-service/src/main/java/com/ozs/service/service/MsgAlarmService.java

@@ -50,4 +50,6 @@ public interface MsgAlarmService extends IService<MsgAlarm> {
     List<MsgAlarm> msgAlarmList(MsgAlarmVo msgAlarmVo);
 
     List<MsgAlarm> queryAlarmInfoByAfterTenMinute();
+
+    IPage<MsgAlarm> queryPageHome(MsgAlarmVo msgAlarmVo);
 }

+ 3 - 8
business-service/src/main/java/com/ozs/service/service/impl/BaseDeviceDynamicManagementServiceImpl.java

@@ -49,6 +49,7 @@ public class BaseDeviceDynamicManagementServiceImpl extends ServiceImpl<BaseDevi
                         .code(o.getRailwayCode())
                         .name(o.getRailwayName())
                         .flay(true)
+                        .publicWorksSection(o.getPublicWorksSection())
                         .children(new ArrayList<>())
                         .build();
 
@@ -59,18 +60,16 @@ public class BaseDeviceDynamicManagementServiceImpl extends ServiceImpl<BaseDevi
                     cameraTree.getChildren().add(build);
                     map.put(o.getRailwayCode(), build);
                 }
-
                 // 里程
                 String mils = AppendUtils.stringAppend(o.getInstallMile());
                 CameraTree build1 = CameraTree.builder()
                         .code(mils + "-" + (o.getLineDir().equals("1") ? "上行" : "下行"))
                         .name(mils + "-" + (o.getLineDir().equals("1") ? "上行" : "下行"))
                         .flay(true)
+                        .publicWorksSection(o.getPublicWorksSection())
                         .mileage(o.getInstallMile())
                         .children(new ArrayList<>())
                         .build();
-
-
                 if (!ObjectUtils.isEmpty(map.get(o.getRailwayCode()))) {
                     CameraTree cameraTree1 = map.get(o.getRailwayCode()+"-"+o.getInstallMile() + "-" + (o.getLineDir().equals("1") ? "上行" : "下行"));
                     if (ObjectUtils.isEmpty(cameraTree1)) {
@@ -78,23 +77,19 @@ public class BaseDeviceDynamicManagementServiceImpl extends ServiceImpl<BaseDevi
                         map.get(o.getRailwayCode()).getChildren().add(build1);
                     }
                 }
-
                 // 摄像头
                 CameraTree build2 = CameraTree.builder()
                         .code(o.getCameraCode())
                         .name(o.getCameraCode())
                         .flay(true)
+                        .publicWorksSection(o.getPublicWorksSection())
                         .children(new ArrayList<>())
                         .build();
-
-
                 if (!ObjectUtils.isEmpty(map.get(o.getRailwayCode()+"-"+o.getInstallMile() + "-" + (o.getLineDir().equals("1") ? "上行" : "下行")))) {
                     map.get(o.getRailwayCode()+"-"+o.getInstallMile() + "-" + (o.getLineDir().equals("1") ? "上行" : "下行")).getChildren().add(build2);
                 }
             }
         }
-
-
         return cameraTree;
     }
 }

+ 5 - 0
business-service/src/main/java/com/ozs/service/service/impl/BaseRailwayManagementServiceImpl.java

@@ -102,4 +102,9 @@ public class BaseRailwayManagementServiceImpl extends ServiceImpl<BaseRailwayMan
     public String getCameraNameByCameraCode(String cameraCode) {
         return baseRailwayManagementMapper.getCameraNameByCameraCode(cameraCode);
     }
+
+    @Override
+    public List<BaseRailwayManagement> listRailway() {
+        return baseRailwayManagementMapper.listRailway();
+    }
 }

+ 13 - 0
business-service/src/main/java/com/ozs/service/service/impl/MsgAlarmServiceImpl.java

@@ -139,4 +139,17 @@ public class MsgAlarmServiceImpl extends ServiceImpl<MsgAlarmMapper, MsgAlarm> i
     public List<MsgAlarm> queryAlarmInfoByAfterTenMinute() {
         return msgAlarmMapper.queryAlarmInfoByAfterTenMinute();
     }
+
+    @Override
+    public IPage<MsgAlarm> queryPageHome(MsgAlarmVo msgAlarmVo) {
+        int pageNum = Integer.parseInt(msgAlarmVo.getPageNum().toString());
+        int pageSize = Integer.parseInt(msgAlarmVo.getPageSize().toString());
+        com.github.pagehelper.Page<MsgAlarm> page = PageHelper.startPage(pageNum, pageSize)
+                .doSelectPage(() -> msgAlarmMapper.selectMsgAlarmListHome(msgAlarmVo));
+        com.baomidou.mybatisplus.extension.plugins.pagination.Page<MsgAlarm> pageR =
+                new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageNum, pageSize);
+        pageR.setRecords(page.getResult());
+        pageR.setTotal(page.getTotal());
+        return pageR;
+    }
 }

+ 6 - 4
business-service/src/main/resources/mapper/service/BaseDeviceDynamicManagementMapper.xml

@@ -9,10 +9,12 @@
 			a.camera_code AS cameraCode, 
 			a.line_dir AS lineDir, 
 			a.install_mile AS installMile, 
-			a.id AS id
-		FROM
-		    base_camera_management AS a inner join
-		    base_railway_management AS l on a.railway_code = l.railway_code
+			a.id AS id,
+			a.dept_id,
+			d.dept_name as publicWorksSection
+		FROM base_camera_management AS a
+		    inner join sys_dept as d on a.dept_id = d.dept_id
+		    inner join base_railway_management AS l on a.railway_code = l.railway_code
 		<where>
 			<if test="railwayCode != null and railwayCode !=''">
 				and concat(l.railway_name,a.camera_code,a.railway_code) like concat("%",#{railwayCode},"%")

+ 8 - 0
business-service/src/main/resources/mapper/service/BaseRailwayManagementMapper.xml

@@ -5,4 +5,12 @@
     <select id="getCameraNameByCameraCode" resultType="java.lang.String" parameterType="java.lang.String">
         select railway_name railwayName from base_railway_management where railway_code = #{cameraCode}
     </select>
+
+    <select id="listRailway" resultType="com.ozs.service.entity.BaseRailwayManagement">
+        select a.dept_id, a.dept_name, c.* from
+            (select dept_id, dept_name from sys_dept) a JOIN
+            (select dept_id, railway_code from base_camera_management) b on a.dept_id = b.dept_id join
+            (select * from base_railway_management) c on b.railway_code = c.railway_code
+        group by c.railway_code, a.dept_id
+    </select>
 </mapper>

+ 83 - 0
business-service/src/main/resources/mapper/service/MsgAlarmMapper.xml

@@ -286,6 +286,89 @@
         where camera_code = #{cameraCode}
         order by alarm_time desc limit 1
     </select>
+
+    <select id="selectMsgAlarmListHome" resultType="com.ozs.service.entity.MsgAlarm"
+            parameterType="com.ozs.service.entity.vo.MsgAlarmVo">
+        SELECT
+        a.alarm_id AS alarmId,
+        a.alarm_time AS alarmTime,
+        a.alarm_mile AS alarmMile,
+        a.line_dir AS lineDir,
+        a.alarm_type AS alarmType,
+        a.camera_code AS cameraCode,
+        a.id AS id,
+        a.content AS content,
+        a.alarm_confidence AS alarmConfidence,
+        a.alarm_attr AS alarmAttr,
+        a.image_url AS imageUrl,
+        a.released_by AS releasedBy,
+        a.is_lock AS isLock,
+        a.released_time AS releasedTime,
+        a.released_type AS releasedType,
+        a.released_reason AS releasedReason,
+        a.remark AS remark
+        FROM msg_alarm AS a
+            join base_camera_management AS b on a.camera_code=b.camera_code
+            join base_railway_management AS l on b.railway_code=l.railway_code
+        <where>
+            <if test="railwayCode != null and railwayCode != ''">
+                concat(l.railway_name,l.railway_code)
+                like concat("%",#{railwayCode},"%")
+            </if>
+            <if test="beginMile != null and beginMile != 0">
+                and b.begin_mile &gt;=#{beginMile}
+            </if>
+            <if test="endMile != null and endMile != 0">
+                and b.end_mile &lt;=#{endMile}
+            </if>
+            <if test="ids != null and ids.size>0">
+                and a.id in
+                <foreach item="items" collection="ids" separator="," open="(" close=")" index="">
+                    #{items}
+                </foreach>
+            </if>
+            <if test="!dsFlay">
+                and
+                <trim prefix="(" prefixOverrides="or" suffix=")">
+                    <if test="dsUserId != null and dsUserId != ''">
+                        or a.create_by=#{dsUserId}
+                    </if>
+                    <if test="dsDeptId != null and dsDeptId != 0">
+                        or b.dept_id=#{dsDeptId}
+                    </if>
+                    <if test="dsDeptIds != null">
+                        or b.dept_id in
+                        <foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
+                            #{item}
+                        </foreach>
+                    </if>
+                </trim>
+            </if>
+            <if test="alarmType != null and alarmType != 0">
+                and a.alarm_type=#{alarmType}
+            </if>
+            <if test="alarmMile != null and alarmMile != 0">
+                and a.alarm_mile=#{alarmMile}
+            </if>
+            <if test="isLock != null and isLock != 0">
+                and a.is_lock=#{isLock}
+            </if>
+            <if test="lineDir != null and lineDir != 0">
+                and a.line_dir =#{lineDir}
+            </if>
+            <if test="releasedType != null and releasedType != 0">
+                and a.released_type =#{releasedType}
+            </if>
+            <if test="beginAlarmTime != null and beginAlarmTime != ''">
+                and date_format(a.alarm_time,'%Y-%m-%d') &gt;= date_format(#{beginAlarmTime},'%Y-%m-%d')
+            </if>
+            <if test="endAlarmTime != null and endAlarmTime != ''">
+                AND date_format(a.alarm_time,'%Y-%m-%d') &lt;= date_format(#{endAlarmTime},'%Y-%m-%d')
+            </if>
+        </where>
+        order by a.is_lock desc, a.alarm_time desc
+    </select>
+
     <select id="selectMsgAlarmList" resultType="com.ozs.service.entity.MsgAlarm"
             parameterType="com.ozs.service.entity.vo.MsgAlarmVo">
         SELECT

+ 0 - 2
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseCameraManagementController.java

@@ -759,8 +759,6 @@ public class BaseCameraManagementController extends BaseController {
                 return substring1.compareTo(substring2);
             }
         });
-
-
         for (CameraTree child : children) {
             List<CameraTree> children1 = child.getChildren();
             children1.sort(new Comparator<CameraTree>() {

+ 2 - 1
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseRailwayManagementController.java

@@ -301,7 +301,8 @@ public class BaseRailwayManagementController extends BaseController {
     @GetMapping("/query")
     @Log(title = "线路台账管理", businessType = BusinessType.SELECT)
     public AjaxResult query() {
-        List<BaseRailwayManagement> list = baseRailwayManagementService.list();
+        // List<BaseRailwayManagement> list = baseRailwayManagementService.list();
+        List<BaseRailwayManagement> list = baseRailwayManagementService.listRailway();
         list.sort(new Comparator<BaseRailwayManagement>() {
             @Override
             public int compare(BaseRailwayManagement o1, BaseRailwayManagement o2) {

+ 75 - 0
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmController.java

@@ -164,6 +164,81 @@ public class MsgAlarmController extends BaseController {
         return toAjax(msgWebPushService.read(msgWebPush));
     }
 
+    /**
+     * 首页报警信息列表
+     * 首页左侧报警默认为全部,先按照未解除、已解除排序,然后再按照时间倒序排序
+     *
+     * @param msgAlarmVo
+     * @return
+     */
+    @ApiOperation(value = "首页报警信息列表")
+    @PostMapping("/listHome")
+    @Log(title = "首页", businessType = BusinessType.SELECT)
+    public AjaxResult selectMsgAlarmHome(@RequestBody MsgAlarmVo msgAlarmVo) {
+        msgAlarmVo = (MsgAlarmVo) dataScoreUtil.setDataScore(getUserId(), msgAlarmVo);
+        if (!ObjectUtils.isEmpty(msgAlarmVo.getAlarmMile())) {
+            msgAlarmVo.setAlarmMile(msgAlarmVo.getAlarmMile() * 1000);
+        }
+        if (!ObjectUtils.isEmpty(msgAlarmVo.getBeginMile())) {
+            msgAlarmVo.setBeginMile(msgAlarmVo.getBeginMile() * 1000);
+        }
+        if (!ObjectUtils.isEmpty(msgAlarmVo.getEndMile())) {
+            msgAlarmVo.setEndMile(msgAlarmVo.getEndMile() * 1000);
+        }
+        IPage<MsgAlarm> page = msgAlarmService.queryPageHome(msgAlarmVo);
+        page.setTotal(page.getTotal());
+        page.setCurrent(page.getCurrent());
+        page.setPages(page.getPages());
+        if (!ObjectUtils.isEmpty(page) && page.getRecords().size() > 0) {
+            List<MsgAlarm> dto1 = page.getRecords().stream().map(o -> {
+                String[] split = o.getImageUrl().split(";");
+                ArrayList<String> objects = new ArrayList<>(Arrays.asList(split));
+                o.setImageUrls(objects);
+                LambdaQueryWrapper<BaseCameraManagement> cameraManagementLambdaQueryWrapper = new LambdaQueryWrapper<BaseCameraManagement>();
+                if (!ObjectUtils.isEmpty(o.getCameraCode())) {
+                    cameraManagementLambdaQueryWrapper.eq(BaseCameraManagement::getCameraCode, o.getCameraCode());
+                }
+                BaseCameraManagement cameraManagement = baseCameraManagementService.getOne(cameraManagementLambdaQueryWrapper);
+                LambdaQueryWrapper<BaseRailwayManagement> queryWrapper = new LambdaQueryWrapper<BaseRailwayManagement>();
+                if (!ObjectUtils.isEmpty(cameraManagement.getRailwayCode())) {
+                    queryWrapper.eq(BaseRailwayManagement::getRailwayCode, cameraManagement.getRailwayCode());
+                }
+                BaseRailwayManagement baseRailwayManagement = baseRailwayManagementService.getOne(queryWrapper);
+                o.setRailwayName(baseRailwayManagement.getRailwayName());
+                if (StringUtils.isNotEmpty(o.getReleasedBy())) {
+                    BaseUser user = baseUserService.getUser(o.getReleasedBy());
+                    o.setReleasedByName(user.getNickName());
+                }
+                String mils = AppendUtils.stringAppend(cameraManagement.getInstallMile());
+                o.setAlarmMiles(mils);
+                if (!ObjectUtils.isEmpty(cameraManagement.getEndMile())) {
+                    String end = AppendUtils.stringAppend(cameraManagement.getEndMile());
+                    o.setEndMile(end);
+                }
+                if (!ObjectUtils.isEmpty(cameraManagement.getBeginMile())) {
+                    String begin = AppendUtils.stringAppend(cameraManagement.getBeginMile());
+                    o.setBeginMile(begin);
+                }
+                LambdaQueryWrapper<MsgAlarmFrequency> wrapper = new LambdaQueryWrapper<MsgAlarmFrequency>();
+                if (!ObjectUtils.isEmpty(o.getAlarmId())) {
+                    wrapper.eq(MsgAlarmFrequency::getAlarmId, o.getAlarmId());
+                }
+                o.setAlarmCount((int) msgAlarmFrequencyService.count(wrapper));
+                if (!ObjectUtils.isEmpty(o.getReleasedType())) {
+                    o.setReleasedTypeName(o.getReleasedType() == 1 ? "实报" : "误报");
+                }
+                String[] split1 = o.getAlarmAttr().split(",");
+                String stringBuilder = "画面,大小为" + split1[0] + "×" + split1[1] + "," +
+                        "泥石流范围为左上角坐标(" + split1[2] + "," + split1[3] + ")" +
+                        "大小" + split1[4] + "×" + split1[5];
+                o.setAlarmAttr(stringBuilder);
+                return o;
+            }).collect(Collectors.toList());
+            page.setRecords(dto1);
+        }
+        return AjaxResult.success(page);
+    }
+
     /**
      * 报警信息分页
      *

+ 1 - 1
hazard-admin/src/main/java/com/ozs/web/controller/websocket/WebSocketConteoller.java

@@ -173,7 +173,7 @@ public class WebSocketConteoller extends BaseController {
         msgAlarmResp.setAlarmId(alarmId);
 
         LambdaQueryWrapper<MsgWebPush> lwMsgWebPush = new LambdaQueryWrapper<MsgWebPush>();
-        if (!ObjectUtils.isEmpty(msgAlarm.getCameraCode())) {
+        if (!ObjectUtils.isEmpty(msgAlarm.getAlarmId())) {
             lwMsgWebPush.eq(MsgWebPush::getAlarmId, msgAlarm.getAlarmId());
         }
         List<MsgWebPush> msgWebPushList = msgWebPushService.list(lwMsgWebPush);