459242451@qq.com vor 3 Jahren
Ursprung
Commit
555885d7e8

+ 38 - 38
ruoyi-admin/src/main/java/com/ruoyi/web/job/CanalScheduling.java

@@ -191,7 +191,7 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
         if (!StrUtil.equalsAnyIgnoreCase(table,
                 "ship_recognition",
                 "ship_snap_address",
-                "alert",
+                "common_record",
                 "monitor_point",
                 "device",
                 "illegal_ship",
@@ -289,43 +289,6 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
                             CacheConstants.DEVICE_STATIC,
                             CacheConstants.DEVICE_TYPE_STATIC,
                             CacheConstants.DEVICE_LIST_STATIC));
-                } else if (StrUtil.equalsIgnoreCase(database, "ship") && StrUtil.equalsIgnoreCase(table, "alert")) {
-                    // 船舶记录
-                    if ("prod".equals(env)) {
-                        AisShipInfo shipInfo = aisInfoService.getShipInfo("", Convert.toStr(afterDataMap.get("mmsi")), "", "");
-                        if (shipInfo != null) {
-                            afterDataMap.put("shipName", shipInfo.getShipName());
-                            afterDataMap.put("shipRegionType", shipInfo.getShipRegionType());
-                        }
-                    }
-                    // 判断是否大于阈值
-                    if (ObjectUtil.isNotEmpty(afterDataMap.get("so2Percent")) && NumberUtil.isGreaterOrEqual(Convert.toBigDecimal(afterDataMap.get("so2Percent")), Convert.toBigDecimal(so2ThresholdVal))) {
-                        // 查询检测点和船舶信息、船舶进出港记录
-                        ShipEepReportRecInfo eepReportRecInfo = aisInfoService.getShipEepReportRecInfo(DateUtil.formatDate(DateUtil.offsetDay(new Date(), -20)), DateUtil.formatDate(DateUtil.tomorrow()), Convert.toStr(afterDataMap.get("mmsi")), "", "");
-                        if (eepReportRecInfo != null) {
-                            afterDataMap.put("destination", eepReportRecInfo.getNextPortName());
-                            afterDataMap.put("berthName", eepReportRecInfo.getBerthName());
-                        }
-
-                        // 嫌疑船舶
-                        afterDataMap.put("illegalStatus", 2);
-                        afterDataMap.put("uploadFlag", 0);
-                        // TODO 上报行政检查系统
-
-                    } else {
-                        afterDataMap.put("uploadFlag", 0);
-                        afterDataMap.put("illegalStatus", 1);
-                    }
-                    Map<String, Object> monitor = client.getDocById(ElasticConstants.SO2_MONITOR_POINT, Convert.toStr(afterDataMap.get("monitorPointId")), "name");
-                    if (monitor != null && ObjectUtil.equal(monitor.get("code"), 200)) {
-                        Map<String, String> data = Convert.toMap(String.class, String.class, monitor.get("data"));
-                        afterDataMap.put("monitorPointName", data.get("name"));
-                        afterDataMap.put("orgName", orgMap.get(data.get("name")));
-                    }
-                    afterDataMap.put("illegalType", "guangpu");
-                    // 保存数据
-                    saveIllegalData(afterDataMap, ElasticConstants.SO2_ALERT);
-                    client.createDocument(ElasticConstants.SO2_ALERT, Convert.toStr(afterDataMap.get("id")), afterDataMap);
                 } else if (StrUtil.equalsIgnoreCase(database, "ais_database") && (StrUtil.equalsIgnoreCase(table, "sem_instrument"))) {
                     // 嗅探系统-站点信息
                     client.createDocument(ElasticConstants.AIS_SEM_INSTRUMENT, Convert.toStr(afterDataMap.get("id")), afterDataMap);
@@ -386,6 +349,43 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
                             CacheConstants.DEVICE_STATIC,
                             CacheConstants.DEVICE_TYPE_STATIC,
                             CacheConstants.DEVICE_LIST_STATIC));
+                } else if (StrUtil.equalsIgnoreCase(database, "ship") && StrUtil.equalsIgnoreCase(table, "common_record")) {
+                    // 船舶记录
+                    if ("prod".equals(env)) {
+                        AisShipInfo shipInfo = aisInfoService.getShipInfo("", Convert.toStr(afterDataMap.get("mmsi")), "", "");
+                        if (shipInfo != null) {
+                            afterDataMap.put("shipName", shipInfo.getShipName());
+                            afterDataMap.put("shipRegionType", shipInfo.getShipRegionType());
+                        }
+                    }
+                    // 判断是否大于阈值
+                    if (ObjectUtil.isNotEmpty(afterDataMap.get("so2Percent")) && NumberUtil.isGreaterOrEqual(Convert.toBigDecimal(afterDataMap.get("so2Percent")), Convert.toBigDecimal(so2ThresholdVal))) {
+                        // 查询检测点和船舶信息、船舶进出港记录
+                        ShipEepReportRecInfo eepReportRecInfo = aisInfoService.getShipEepReportRecInfo(DateUtil.formatDate(DateUtil.offsetDay(new Date(), -20)), DateUtil.formatDate(DateUtil.tomorrow()), Convert.toStr(afterDataMap.get("mmsi")), "", "");
+                        if (eepReportRecInfo != null) {
+                            afterDataMap.put("destination", eepReportRecInfo.getNextPortName());
+                            afterDataMap.put("berthName", eepReportRecInfo.getBerthName());
+                        }
+
+                        // 嫌疑船舶
+                        afterDataMap.put("illegalStatus", 2);
+                        afterDataMap.put("uploadFlag", 0);
+                        // TODO 上报行政检查系统
+
+                    } else {
+                        afterDataMap.put("uploadFlag", 0);
+                        afterDataMap.put("illegalStatus", 1);
+                    }
+                    Map<String, Object> monitor = client.getDocById(ElasticConstants.SO2_MONITOR_POINT, Convert.toStr(afterDataMap.get("monitorPointId")), "name");
+                    if (monitor != null && ObjectUtil.equal(monitor.get("code"), 200)) {
+                        Map<String, String> data = Convert.toMap(String.class, String.class, monitor.get("data"));
+                        afterDataMap.put("monitorPointName", data.get("name"));
+                        afterDataMap.put("orgName", orgMap.get(data.get("name")));
+                    }
+                    afterDataMap.put("illegalType", "guangpu");
+                    // 保存数据
+                    saveIllegalData(afterDataMap, ElasticConstants.SO2_ALERT);
+                    client.createDocument(ElasticConstants.SO2_ALERT, Convert.toStr(afterDataMap.get("id")), afterDataMap);
                 } else if (StrUtil.equalsIgnoreCase(database, "ship") && StrUtil.equalsIgnoreCase(table, "monitor_point")) {
                     // 检测点信息
                     client.updateDocument(ElasticConstants.SO2_MONITOR_POINT, Convert.toStr(afterDataMap.get("id")), afterDataMap);

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/service/Impl/GasCommonServiceImpl.java

@@ -156,7 +156,7 @@ public class GasCommonServiceImpl implements IGasCommonService {
                 }
                 saveOrUpdate(ElasticConstants.HEIYAN_SHIP_RECOGNITION, Convert.toStr(afterDataMap.get("id")), afterDataMap);
             }
-        } else if (StrUtil.equalsIgnoreCase(schema, "ship") && StrUtil.equalsIgnoreCase(table, "alert")) {
+        } else if (StrUtil.equalsIgnoreCase(schema, "ship") && StrUtil.equalsIgnoreCase(table, "common_record")) {
             // 光谱嫌疑船舶
             List<Map<String, Object>> map = gasCommonMapper.queryAlert(syncPost);
             for (Map<String, Object> stringObjectMap : map) {

+ 1 - 1
ruoyi-system/src/main/resources/mapper/system/GasCommonMapper.xml

@@ -175,7 +175,7 @@
         t1.co2_concentration co2Concentration,
         so2_percent so2Percent,
         date_format(create_time, '%Y-%m-%d %H:%i:%S') as createTime
-        from alert t1
+        from common_record t1
         left join monitor_point t2 on t1.monitor_point_id = t2.id
         left join ship_static_info t3 on t1.mmsi = t3.mmsi
         <where>

+ 2 - 1
ruoyi-system/src/main/resources/mapper/system/So2Mapper.xml

@@ -45,8 +45,9 @@
                so2_concentration                             so2Concentration,
                co2_concentration                             co2Concentration,
                so2_percent                                   so2Percent,
+               device_id                                     deviceId,
                date_format(create_time, '%Y-%m-%d %H:%i:%s') createTime
-        from alert
+        from common_record
         where id = #{id}
     </select>
 </mapper>