puzhibing
2025-06-03 f58d0913c810c68c550e5b12da64dbdeb0d0c1f0
优化报警
3个文件已修改
26 ■■■■■ 已修改文件
ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/WarnMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/DOWNConnectRspService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/WarnMsgService.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/WarnMapper.xml
@@ -27,9 +27,9 @@
        left join t_driver c on (a.driver_id = c.id)
        left join t_enterprise d on (a.enterprise_id = d.id)
        <where>
            <if test="null != item.warnTypes and warnTypes.size() > 0">
            <if test="null != item.warnTypes and item.warnTypes.size() > 0">
                and a.warn_type in
                <foreach collection="warnTypes" item="item" index="index" separator="," open="(" close=")">
                <foreach collection="item.warnTypes" item="item" index="index" separator="," open="(" close=")">
                    #{item}
                </foreach>
            </if>
ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/DOWNConnectRspService.java
@@ -76,12 +76,14 @@
            }
            if (times >= 18) {
                UPConnect ipAndPort = ChannelMap.getIpAndPort(inferiorPlatformId);
                if(null != ipAndPort){
                boolean b = connectReqService.downConnect(inferiorPlatformId, ipAndPort.getDownLinkIp(), ipAndPort.getDownLinkPort(), ipAndPort.getVerifyCode());
                if (b) {
                    times = 0;
                } else {
                    times++;
                }
                }
            } else {
                times++;
            }
ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/server/WarnMsgService.java
@@ -193,7 +193,9 @@
    public void saveWarnMsgService(JSONObject jsonObject) {
        SubscriptionEvent subscriptionEvent = jsonObject.getObject("params", SubscriptionEvent.class);
        List<Event> events = subscriptionEvent.getEvents();
        if(null != events){
        events.forEach(event -> {
                try {
            //车牌号
            String srcName = event.getSrcName();
            Alarm data = JSONObject.parseObject(event.getData(), Alarm.class);
@@ -208,16 +210,30 @@
            upWarnMsgAdptInfo.setVehicleColor(null == data.getVehicleLicenseColor() ? 0 : data.getVehicleLicenseColor());
            upWarnMsgAdptInfo.setWarnSrc(data.getSourceType() + 1);
            upWarnMsgAdptInfo.setWarnType(getAlarmType(data.getEventType()));
                    if(null != data.getAlarmTime()){
            upWarnMsgAdptInfo.setWarnTime(LocalDateTime.parse(data.getAlarmTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).toEpochSecond(ZoneOffset.ofHours(8)));
                    }
            upWarnMsgAdptInfo.setInfoId(data.getAlarmId());
            upWarnMsgAdptInfo.setLevel(getLevel(data.getLevel()));
                    if(null != data.getLatitude()){
            upWarnMsgAdptInfo.setLongitude(data.getLatitude().intValue() * 10);
                    }
                    if(null != data.getLongitude()){
            upWarnMsgAdptInfo.setLatitude(data.getLongitude().intValue());
                    }
                    if(null != data.getHeight()){
            upWarnMsgAdptInfo.setAltitude(data.getHeight().intValue() / 10);
                    }
                    if(null != data.getSpeed()){
            upWarnMsgAdptInfo.setSpeed(data.getSpeed().intValue() / 100000);
                    }
                    if(null != data.getSpeed()){
            upWarnMsgAdptInfo.setVec2(data.getSpeed().intValue() / 100000);
                    }
            upWarnMsgAdptInfo.setStatus(data.getStatus());
                    if(null != data.getDirection()){
            upWarnMsgAdptInfo.setDirection(data.getDirection() / 100);
                    }
            upWarnMsgAdptInfo.setInfoContent(data.getAlarmInfo());
            upWarnMsgAdptInfo.setInferiorPlatformId(25439966);
            upWarnMsgAdptInfo.setCreateTime(LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8)));
@@ -225,8 +241,12 @@
                return;
            }
            upWarnMsgAdptInfoDao.save(upWarnMsgAdptInfo);
                }catch (Exception e){
                    e.printStackTrace();
                }
        });
    }
    }
    
    public int getAlarmType(long eventType){
        switch ((int) eventType){