Эх сурвалжийг харах

调整字段内容和处理方案

459242451@qq.com 3 жил өмнө
parent
commit
8732409951

+ 3 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/gas/BlackGasController.java

@@ -62,9 +62,9 @@ public class BlackGasController extends BaseController {
         equalsCondition.put("aisMmsi", ObjectUtil.isEmpty(shipRecognition.getAisMmsi()) ? null : StrUtil.concat(true, "*", Convert.toStr(shipRecognition.getAisMmsi()), "*"));
         equalsCondition.put("aisShipName", StrUtil.isBlank(shipRecognition.getAisShipName()) ? null : StrUtil.concat(true, "*", shipRecognition.getAisShipName(), "*"));
         equalsCondition.put("snapPos", StrUtil.isBlank(shipRecognition.getSnapPos()) ? null : StrUtil.concat(true, "*", shipRecognition.getSnapPos(), "*"));
-        equalsCondition.put("aisDst", StrUtil.isBlank(shipRecognition.getAisDst()) ? null : StrUtil.concat(true, "*", shipRecognition.getAisDst(), "*"));
-        equalsCondition.put("aisShipType", StrUtil.isBlank(shipRecognition.getAisShipType()) ? null : StrUtil.concat(true, "*", shipRecognition.getAisShipType(), "*"));
+        equalsCondition.put("shipRegionType", shipRecognition.getShipRegionType());
         equalsCondition.put("rcgSoot", shipRecognition.getRcgSoot());
+        equalsCondition.put("illegalStatus", shipRecognition.getIllegalStatus());
         // 组装范围查询条件
         Map<String, Object> rangeCondition = new HashMap<>();
         if (ObjectUtil.isNotEmpty(params.get("beginTime"))) {
@@ -82,7 +82,7 @@ public class BlackGasController extends BaseController {
         TableDataInfo rspData = new TableDataInfo();
         rspData.setCode(HttpStatus.SUCCESS);
         rspData.setMsg("查询成功");
-        rspData.setRows(Convert.toList(maps.get("pageList")));
+        rspData.setRows(Convert.toList(ShipRecognition.class, maps.get("pageList")));
         rspData.setTotal(Convert.toLong(maps.get("totalNum")));
         return rspData;
     }

+ 72 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/gas/So2Controller.java

@@ -19,6 +19,7 @@ import com.ruoyi.common.enums.AggsType;
 import com.ruoyi.framework.config.ElasticSearchClient;
 import com.ruoyi.system.domain.GuapAlert;
 import com.ruoyi.system.domain.GuapMonitorPoint;
+import com.ruoyi.system.domain.IllegalShip;
 import com.ruoyi.system.domain.XiuTanIllegalShip;
 import com.ruoyi.system.domain.XiuTanSemInstrument;
 import com.ruoyi.system.service.IAisDatabase;
@@ -73,6 +74,13 @@ public class So2Controller extends BaseController {
         // 组装查询条件
         equalsCondition.put("mmsi", ObjectUtil.isEmpty(guapAlert.getMmsi()) ? null : StrUtil.concat(true, "*", Convert.toStr(guapAlert.getMmsi()), "*"));
         equalsCondition.put("shipName", StrUtil.isBlank(guapAlert.getShipName()) ? null : StrUtil.concat(true, "*", guapAlert.getShipName(), "*"));
+        equalsCondition.put("shipRegionType", guapAlert.getShipRegionType());
+        equalsCondition.put("destination", StrUtil.isBlank(guapAlert.getDestination()) ? null : StrUtil.concat(true, "*", guapAlert.getDestination(), "*"));
+        equalsCondition.put("orgName", guapAlert.getOrgName());
+        equalsCondition.put("illegalStatus", guapAlert.getIllegalStatus());
+        equalsCondition.put("dealResult", guapAlert.getDealResult());
+        equalsCondition.put("fastResult", guapAlert.getFastResult());
+        equalsCondition.put("uploadResult", guapAlert.getUploadResult());
         equalsCondition.put("monitorPointName", guapAlert.getMonitorPointName());
         // 组装范围查询条件
         Map<String, Object> rangeCondition = new HashMap<>();
@@ -103,8 +111,15 @@ public class So2Controller extends BaseController {
         Map<String, Object> params = illegalShip.getParams();
         Map<String, Object> equalsCondition = new HashMap<>();
         // 组装查询条件
-        equalsCondition.put("shipMmsi", ObjectUtil.isEmpty(illegalShip.getShipMmsi()) ? null : StrUtil.concat(true, "*", Convert.toStr(illegalShip.getShipMmsi()), "*"));
+        equalsCondition.put("mmsi", ObjectUtil.isEmpty(illegalShip.getMmsi()) ? null : StrUtil.concat(true, "*", Convert.toStr(illegalShip.getMmsi()), "*"));
         equalsCondition.put("shipName", StrUtil.isBlank(illegalShip.getShipName()) ? null : StrUtil.concat(true, "*", illegalShip.getShipName(), "*"));
+        equalsCondition.put("shipRegionType", illegalShip.getShipRegionType());
+        equalsCondition.put("destination", StrUtil.isBlank(illegalShip.getDestination()) ? null : StrUtil.concat(true, "*", illegalShip.getDestination(), "*"));
+        equalsCondition.put("orgName", illegalShip.getOrgName());
+        equalsCondition.put("illegalStatus", illegalShip.getIllegalStatus());
+        equalsCondition.put("dealResult", illegalShip.getDealResult());
+        equalsCondition.put("fastResult", illegalShip.getFastResult());
+        equalsCondition.put("uploadResult", illegalShip.getUploadResult());
         equalsCondition.put("monitorPointName", illegalShip.getMonitorPointName());
         // 组装范围查询条件
         Map<String, Object> rangeCondition = new HashMap<>();
@@ -128,6 +143,45 @@ public class So2Controller extends BaseController {
         return rspData;
     }
 
+    @GetMapping("/list")
+    @ApiOperation("硫嫌疑船舶列表数据")
+    public TableDataInfo list(IllegalShip illegalShip) {
+        // 传来的参数
+        Map<String, Object> params = illegalShip.getParams();
+        Map<String, Object> equalsCondition = new HashMap<>();
+        // 组装查询条件
+        equalsCondition.put("mmsi", ObjectUtil.isEmpty(illegalShip.getMmsi()) ? null : StrUtil.concat(true, "*", Convert.toStr(illegalShip.getMmsi()), "*"));
+        equalsCondition.put("shipName", StrUtil.isBlank(illegalShip.getShipName()) ? null : StrUtil.concat(true, "*", illegalShip.getShipName(), "*"));
+        equalsCondition.put("shipRegionType", illegalShip.getShipRegionType());
+        equalsCondition.put("destination", StrUtil.isBlank(illegalShip.getDestination()) ? null : StrUtil.concat(true, "*", illegalShip.getDestination(), "*"));
+        equalsCondition.put("orgName", illegalShip.getOrgName());
+        equalsCondition.put("illegalStatus", illegalShip.getIllegalStatus());
+        equalsCondition.put("dealResult", illegalShip.getDealResult());
+        equalsCondition.put("fastResult", illegalShip.getFastResult());
+        equalsCondition.put("uploadResult", illegalShip.getUploadResult());
+        equalsCondition.put("monitorPointName", illegalShip.getMonitorPointName());
+        // 组装范围查询条件
+        Map<String, Object> rangeCondition = new HashMap<>();
+        if (ObjectUtil.isNotEmpty(params.get("beginTime"))) {
+            params.put("beginTime", params.get("beginTime") + " 00:00:00");
+        }
+        if (ObjectUtil.isNotEmpty(params.get("endTime"))) {
+            params.put("endTime", params.get("endTime") + " 23:59:59");
+        }
+        rangeCondition.put("createTime", StrUtil.concat(true, "[", Convert.toStr(params.get("beginTime")), ",", Convert.toStr(params.get("endTime")), "]"));
+        List<String> orderBy = new ArrayList<>();
+        orderBy.add("-createTime");
+        PageDomain pageDomain = TableSupport.buildPageRequest();
+        Map<String, Object> maps = client.searchDocument(equalsCondition, rangeCondition, orderBy, pageDomain.getPageNum(), pageDomain.getPageSize(), ElasticConstants.SO2_ALERT, ElasticConstants.AIS_ILLEGAL_SHIP);
+
+        TableDataInfo rspData = new TableDataInfo();
+        rspData.setCode(HttpStatus.SUCCESS);
+        rspData.setMsg("查询成功");
+        rspData.setRows(Convert.toList(IllegalShip.class, maps.get("pageList")));
+        rspData.setTotal(Convert.toLong(maps.get("totalNum")));
+        return rspData;
+    }
+
     @GetMapping("/guangpu/monitorPoint")
     @ApiOperation("光谱-检测点数据")
     public AjaxResult monitorPoint(GuapMonitorPoint monitorPoint) {
@@ -238,4 +292,21 @@ public class So2Controller extends BaseController {
         return AjaxResult.success(result);
     }
 
+    /*@DeleteMapping("/del")
+    @ApiOperation("删除数据")
+    public AjaxResult del() {
+        if (StrUtil.isBlank(interval)) {
+            // 默认值为1个月
+            interval = "1M";
+        }
+        Map<Object, Object> aisAggs = client.dateHistogramAggs(ElasticConstants.AIS_ILLEGAL_SHIP, AggsType.count, "peakTime", "id", null, null, new DateHistogramInterval(interval));
+        Map<Object, Object> so2Aggs = client.dateHistogramAggs(ElasticConstants.SO2_ALERT, AggsType.count, "createTime", "id", null, null, new DateHistogramInterval(interval));
+        Map<Object, Object> heiyanAggs = client.dateHistogramAggs(ElasticConstants.HEIYAN_SHIP_RECOGNITION, AggsType.count, "snapTimeFmt", "id", null, null, new DateHistogramInterval(interval));
+        Map<String, Map<Object, Object>> result = new HashMap<>();
+        result.put("ais", aisAggs);
+        result.put("so2", so2Aggs);
+        result.put("black", heiyanAggs);
+        return AjaxResult.success(result);
+    }*/
+
 }

+ 1 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/core/config/CanalClient.java

@@ -4,7 +4,6 @@ import com.alibaba.otter.canal.client.CanalConnector;
 import com.alibaba.otter.canal.client.CanalConnectors;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.DisposableBean;
-import org.springframework.context.annotation.Bean;
 import org.springframework.stereotype.Component;
 
 import java.net.InetSocketAddress;
@@ -21,7 +20,7 @@ public class CanalClient implements DisposableBean {
 
     private CanalConnector canalConnector;
 
-    @Bean
+    //    @Bean
     public CanalConnector getCanalConnector() {
         canalConnector = CanalConnectors.newSingleConnector(new InetSocketAddress("127.0.0.1",
                 11111), "heiyan", "", "");

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

@@ -2,6 +2,7 @@ package com.ruoyi.web.job;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
@@ -15,6 +16,9 @@ import com.ruoyi.common.constant.ElasticConstants;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.JdbcTypeUtil;
 import com.ruoyi.framework.config.ElasticSearchClient;
+import com.ruoyi.system.domain.vo.AisShipInfo;
+import com.ruoyi.system.domain.vo.ShipEepReportRecInfo;
+import com.ruoyi.system.service.IAisInfoService;
 import com.ruoyi.system.service.ISysConfigService;
 import com.ruoyi.web.core.config.CanalConfig;
 import lombok.SneakyThrows;
@@ -50,6 +54,8 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
     private RedisCache redisCache;
     @Autowired
     private ISysConfigService configService;
+    @Autowired
+    private IAisInfoService aisInfoService;
     //    @Resource
 //    private CanalConnector canalConnector;
     @Value("${black.snapImgUrl}")
@@ -58,6 +64,15 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
     @Autowired
     private CanalConfig canalConfig;
 
+    public final static Map<String, String> orgMap = new HashMap<String, String>() {{
+        put("南京三桥", "南京海事局");
+        put("南京四桥", "南京海事局");
+        put("润扬大桥", "扬州海事局");
+        put("泰州大桥", "泰州海事局");
+        put("江阴大桥", "江阴海事局");
+        put("苏通大桥", "常熟海事局");
+    }};
+
     @Override
     @Scheduled(fixedDelay = 100) //每隔100秒执行
     public void run() {
@@ -157,7 +172,6 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
                 "alert",
                 "monitor_point",
                 "device",
-                "ship_static_info",
                 "illegal_ship",
                 "sem_instrument",
                 "sem_instrument_test")) {
@@ -174,8 +188,7 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
                 if (StrUtil.equalsIgnoreCase(database, "heiyan") && StrUtil.equalsIgnoreCase(table, "ship_recognition")) {
                     // 判断数据状态
                     if (ObjectUtil.isNotEmpty(afterDataMap.get("rcgSoot")) && NumberUtil.isGreaterOrEqual(Convert.toBigDecimal(afterDataMap.get("rcgSoot")), Convert.toBigDecimal(blackThresholdVal))) {
-                        // 嫌疑船舶
-                        afterDataMap.put("illegalStatus", 2);
+
                         // 查询黑烟图片
                         /*String imgUrl = HttpUtil.get(blackImgUrl + Convert.toStr(afterDataMap.get("id")));
                         JSONObject response = JSON.parseObject(imgUrl);
@@ -191,9 +204,24 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
                             }
                             afterDataMap.put("allImgUrl", newImgList);
                         }*/
+                        // 查询检测点和船舶信息、船舶进出港记录
+                        if (ObjectUtil.isNotEmpty(afterDataMap.get("aisMmsi"))) {
+                            AisShipInfo shipInfo = aisInfoService.getShipInfo("", Convert.toStr(afterDataMap.get("aisMmsi")), "", "");
+                            if (shipInfo != null) {
+                                afterDataMap.put("aisShipName", shipInfo.getShipName());
+                                afterDataMap.put("shipRegionType", shipInfo.getShipRegionType());
+                            }
+                        }
+                        if (ObjectUtil.isNotEmpty(afterDataMap.get("snapPos"))) {
+                            afterDataMap.put("orgName", orgMap.get(Convert.toStr(afterDataMap.get("snapPos"))));
+                        }
+                        // 嫌疑船舶
+                        afterDataMap.put("illegalStatus", 2);
+                        afterDataMap.put("uploadFlag", 1);
                         // TODO 上报行政检查系统
 
                     } else {
+                        afterDataMap.put("uploadFlag", 0);
                         afterDataMap.put("illegalStatus", 1);
                     }
                     client.createDocument(ElasticConstants.HEIYAN_SHIP_RECOGNITION, Convert.toStr(afterDataMap.get("id")), afterDataMap);
@@ -211,36 +239,40 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
                     redisCache.deleteObject(CollUtil.set(false,
                             CacheConstants.DEVICE_STATIC,
                             CacheConstants.DEVICE_TYPE_STATIC));
-                } /*else if (StrUtil.equalsIgnoreCase(database, "so2") && StrUtil.equalsIgnoreCase(table, "ship_static_info")) {
-                    // 船舶信息
-                    if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi"))) {
-                        client.createDocument(ElasticConstants.SO2_SHIP_STATIC_INFO, Convert.toStr(afterDataMap.get("mmsi")), afterDataMap);
-                    }
-                }*/ else if (StrUtil.equalsIgnoreCase(database, "so2") && StrUtil.equalsIgnoreCase(table, "alert")) {
+                } else if (StrUtil.equalsIgnoreCase(database, "so2") && StrUtil.equalsIgnoreCase(table, "alert")) {
                     // 船舶记录
-                    // 查询检测点和船舶信息
-                    if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi"))) {
-                        Map<String, Object> mmsi = client.getDocById(ElasticConstants.SO2_SHIP_STATIC_INFO, Convert.toStr(afterDataMap.get("mmsi")), "name,destination");
-                        if (mmsi != null && ObjectUtil.equal(mmsi.get("code"), 200)) {
-                            Map<String, String> data = Convert.toMap(String.class, String.class, mmsi.get("data"));
-                            afterDataMap.put("shipName", data.get("name"));
-                            afterDataMap.put("destination", data.get("destination"));
-                        }
-                    }
-                    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"));
-                    }
                     // 判断是否大于阈值
                     if (ObjectUtil.isNotEmpty(afterDataMap.get("so2Percent")) && NumberUtil.isGreaterOrEqual(Convert.toBigDecimal(afterDataMap.get("so2Percent")), Convert.toBigDecimal(so2ThresholdVal))) {
+                        // 查询检测点和船舶信息、船舶进出港记录
+                        if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi"))) {
+                            AisShipInfo shipInfo = aisInfoService.getShipInfo("", Convert.toStr(afterDataMap.get("mmsi")), "", "");
+                            if (shipInfo != null) {
+                                afterDataMap.put("shipName", shipInfo.getShipName());
+                                afterDataMap.put("shipRegionType", shipInfo.getShipRegionType());
+                            }
+                            ShipEepReportRecInfo eepReportRecInfo = aisInfoService.getShipEepReportRecInfo(DateUtil.formatDate(DateUtil.lastWeek()), DateUtil.formatDate(DateUtil.tomorrow()), Convert.toStr(afterDataMap.get("mmsi")), "", "");
+                            if (eepReportRecInfo != null) {
+                                afterDataMap.put("destination", eepReportRecInfo.getNextPortName());
+                                afterDataMap.put("berthName", eepReportRecInfo.getBerthName());
+                            }
+                        }
+                        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("illegalStatus", 2);
+                        afterDataMap.put("uploadFlag", 1);
                         // TODO 上报行政检查系统
 
                     } else {
+                        afterDataMap.put("uploadFlag", 0);
                         afterDataMap.put("illegalStatus", 1);
                     }
+                    afterDataMap.put("illegalType", "guangpu");
                     client.createDocument(ElasticConstants.SO2_ALERT, Convert.toStr(afterDataMap.get("id")), afterDataMap);
                 } else if (StrUtil.equalsIgnoreCase(database, "ais_database") && (StrUtil.equalsIgnoreCase(table, "sem_instrument_test") || StrUtil.equalsIgnoreCase(table, "sem_instrument"))) {
                     // 嗅探系统-站点信息
@@ -250,22 +282,46 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
                             CacheConstants.DEVICE_TYPE_STATIC));
                 } else if (StrUtil.equalsIgnoreCase(database, "ais_database") && StrUtil.equalsIgnoreCase(table, "illegal_ship")) {
                     // 嗅探系统-违规船舶
-                    // 查询站点信息
-                    Map<String, Object> sem = client.getDocById(ElasticConstants.AIS_SEM_INSTRUMENT, Convert.toStr(afterDataMap.get("semId")), "name,category");
-                    if (sem != null && ObjectUtil.equal(sem.get("code"), 200)) {
-                        Map<String, String> data = Convert.toMap(String.class, String.class, sem.get("data"));
-                        afterDataMap.put("semName", data.get("name"));
-                        afterDataMap.put("monitorPointName", data.get("category"));
+                    afterDataMap.put("mmsi", afterDataMap.get("shipMmsi"));
+                    afterDataMap.put("createTime", afterDataMap.get("peakTime"));
+                    if (ObjectUtil.isNotEmpty(afterDataMap.get("sPercent")) && NumberUtil.isGreaterOrEqual(Convert.toBigDecimal(afterDataMap.get("sPercent")), Convert.toBigDecimal(so2ThresholdVal))) {
+                        // 查询检测点和船舶信息、船舶进出港记录
+                        if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi"))) {
+                            AisShipInfo shipInfo = aisInfoService.getShipInfo("", Convert.toStr(afterDataMap.get("mmsi")), "", "");
+                            if (shipInfo != null) {
+                                afterDataMap.put("shipName", shipInfo.getShipName());
+                                afterDataMap.put("shipRegionType", shipInfo.getShipRegionType());
+                            }
+                            ShipEepReportRecInfo eepReportRecInfo = aisInfoService.getShipEepReportRecInfo(DateUtil.formatDate(DateUtil.lastWeek()), DateUtil.formatDate(DateUtil.tomorrow()), Convert.toStr(afterDataMap.get("mmsi")), "", "");
+                            if (eepReportRecInfo != null) {
+                                afterDataMap.put("destination", eepReportRecInfo.getNextPortName());
+                                afterDataMap.put("berthName", eepReportRecInfo.getBerthName());
+                            }
+                        }
+                        // 查询站点信息
+                        Map<String, Object> sem = client.getDocById(ElasticConstants.AIS_SEM_INSTRUMENT, Convert.toStr(afterDataMap.get("semId")), "name,category");
+                        if (sem != null && ObjectUtil.equal(sem.get("code"), 200)) {
+                            Map<String, String> data = Convert.toMap(String.class, String.class, sem.get("data"));
+                            afterDataMap.put("semName", data.get("name"));
+                            afterDataMap.put("monitorPointName", data.get("category"));
+                            afterDataMap.put("orgName", orgMap.get(data.get("name")));
+                        }
+
+                        // 嫌疑船舶
+                        afterDataMap.put("illegalStatus", 2);
+                        afterDataMap.put("uploadFlag", 1);
+                        // TODO 上报行政检查系统
+
+                    } else {
+                        afterDataMap.put("uploadFlag", 0);
+                        afterDataMap.put("illegalStatus", 1);
                     }
-                    // 初始化设为未上传状态
-                    afterDataMap.put("uploadFlag", 0);
+                    afterDataMap.put("illegalType", "xiutan");
                     client.createDocument(ElasticConstants.AIS_ILLEGAL_SHIP, Convert.toStr(afterDataMap.get("id")), afterDataMap);
                 }
                 break;
             case UPDATE:
-                if (StrUtil.equalsIgnoreCase(database, "heiyan") && StrUtil.equalsIgnoreCase(table, "ship_recognition")) {
-                    client.updateDocument(ElasticConstants.HEIYAN_SHIP_RECOGNITION, Convert.toStr(afterDataMap.get("id")), afterDataMap);
-                } else if (StrUtil.equalsIgnoreCase(database, "heiyan") && StrUtil.equalsIgnoreCase(table, "ship_snap_address")) {
+                if (StrUtil.equalsIgnoreCase(database, "heiyan") && StrUtil.equalsIgnoreCase(table, "ship_snap_address")) {
                     redisCache.deleteObject(CollUtil.set(false,
                             CacheConstants.DEVICE_STATIC,
                             CacheConstants.DEVICE_TYPE_STATIC));
@@ -284,16 +340,6 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
                     redisCache.deleteObject(CollUtil.set(false,
                             CacheConstants.DEVICE_STATIC,
                             CacheConstants.DEVICE_TYPE_STATIC));
-                } else if (StrUtil.equalsIgnoreCase(database, "ais_database") && StrUtil.equalsIgnoreCase(table, "illegal_ship")) {
-                    // 嗅探系统-违规船舶
-                    // 查询站点信息
-                    Map<String, Object> sem = client.getDocById(ElasticConstants.AIS_SEM_INSTRUMENT, Convert.toStr(afterDataMap.get("semId")), "name,category");
-                    if (sem != null && ObjectUtil.equal(sem.get("code"), 200)) {
-                        Map<String, String> data = Convert.toMap(String.class, String.class, sem.get("data"));
-                        afterDataMap.put("semName", data.get("name"));
-                        afterDataMap.put("monitorPointName", data.get("category"));
-                    }
-                    client.updateDocument(ElasticConstants.AIS_ILLEGAL_SHIP, Convert.toStr(afterDataMap.get("id")), afterDataMap);
                 }
                 break;
             case DELETE:
@@ -310,9 +356,6 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
                     redisCache.deleteObject(CollUtil.set(false,
                             CacheConstants.DEVICE_STATIC,
                             CacheConstants.DEVICE_TYPE_STATIC));
-                } else if (StrUtil.equalsIgnoreCase(database, "so2") && StrUtil.equalsIgnoreCase(table, "ship_static_info")) {
-                    // 船舶信息
-                    client.deleteDocument(ElasticConstants.SO2_SHIP_STATIC_INFO, Convert.toStr(afterDataMap.get("mmsi")));
                 } else if (StrUtil.equalsIgnoreCase(database, "ais_database") && (StrUtil.equalsIgnoreCase(table, "sem_instrument_test") || StrUtil.equalsIgnoreCase(table, "sem_instrument"))) {
                     // 嗅探系统-站点信息
                     client.deleteDocument(ElasticConstants.AIS_SEM_INSTRUMENT, Convert.toStr(afterDataMap.get("id")));

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

@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -31,6 +32,15 @@ public class GasCommonServiceImpl implements IGasCommonService {
     @Autowired
     private ElasticSearchClient client;
 
+    public final static Map<String, String> orgMap = new HashMap<String, String>() {{
+        put("南京三桥", "南京海事局");
+        put("南京四桥", "南京海事局");
+        put("润扬大桥", "扬州海事局");
+        put("泰州大桥", "泰州海事局");
+        put("江阴大桥", "江阴海事局");
+        put("苏通大桥", "常熟海事局");
+    }};
+
     @SneakyThrows
     @Override
     @Async
@@ -53,6 +63,12 @@ public class GasCommonServiceImpl implements IGasCommonService {
             // 嗅探违规船舶信息
             List<Map<String, Object>> map = gasCommonMapper.queryIllegalShip(syncPost);
             for (Map<String, Object> stringObjectMap : map) {
+                stringObjectMap.put("mmsi", stringObjectMap.get("shipMmsi"));
+                stringObjectMap.put("createTime", stringObjectMap.get("peakTime"));
+                stringObjectMap.put("illegalStatus", 1);
+                stringObjectMap.put("illegalType", "xiutan");
+                stringObjectMap.put("uploadFlag", 0);
+                stringObjectMap.put("orgName", orgMap.get(Convert.toStr(stringObjectMap.get("monitorPointName"))));
                 saveOrUpdate(ElasticConstants.AIS_ILLEGAL_SHIP, Convert.toStr(stringObjectMap.get("id")), stringObjectMap);
             }
         } else if (StrUtil.equalsIgnoreCase(schema, "heiyan") && StrUtil.equalsIgnoreCase(table, "ship_recognition")) {
@@ -68,7 +84,9 @@ public class GasCommonServiceImpl implements IGasCommonService {
             List<Map<String, Object>> map = gasCommonMapper.queryAlert(syncPost);
             for (Map<String, Object> stringObjectMap : map) {
                 stringObjectMap.put("illegalStatus", 1);
+                stringObjectMap.put("illegalType", "guangpu");
                 stringObjectMap.put("uploadFlag", 0);
+                stringObjectMap.put("orgName", orgMap.get(Convert.toStr(stringObjectMap.get("monitorPointName"))));
                 saveOrUpdate(ElasticConstants.SO2_ALERT, Convert.toStr(stringObjectMap.get("id")), stringObjectMap);
             }
         } else if (StrUtil.equalsIgnoreCase(schema, "so2") && StrUtil.equalsIgnoreCase(table, "monitor_point")) {

+ 8 - 3
ruoyi-admin/src/main/resources/application-prod.yml

@@ -16,7 +16,7 @@ spring:
         url: jdbc:mysql://47.92.161.189:3306/ais_database?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
         username: js_test
         password: js123456
-      # 从库数据源(二氧化硫)
+      # 从库数据源(光谱)
       slaveso2:
         # 从数据源开关/默认关闭
         enabled: true
@@ -120,5 +120,10 @@ swagger:
   pathMapping: /prod-api
 
 # 子平台
-balck:
-  snapImgUrl: http://127.0.0.1:8090/api/shipface/snap/imgUrl?id=
+black:
+  snapImgUrl: http://127.0.0.1:8090/api/shipface/snap/imgUrl?id=
+
+# 第三方接口
+third:
+  shipEepReportRecInfo: http://198.17.188.111:6201/huiyan/getShipEepReportRec # 船舶进出港记录
+  shipBaseInfo: http://198.17.239.239:7999/getInfosByCondition # 船舶基本信息

+ 8 - 3
ruoyi-admin/src/main/resources/application-test.yml

@@ -16,7 +16,7 @@ spring:
         url: jdbc:mysql://47.92.161.189:3306/ais_database?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
         username: js_test
         password: js123456
-      # 从库数据源(二氧化硫)
+      # 从库数据源(光谱)
       slaveso2:
         # 从数据源开关/默认关闭
         enabled: true
@@ -119,5 +119,10 @@ swagger:
   pathMapping: /dev-api
 
 # 子平台
-balck:
-  snapImgUrl: http://127.0.0.1:8090/api/shipface/snap/imgUrl?id=
+black:
+  snapImgUrl: http://127.0.0.1:8090/api/shipface/snap/imgUrl?id=
+
+# 第三方接口
+third:
+  shipEepReportRecInfo: http://198.17.188.111:6201/huiyan/getShipEepReportRec # 船舶进出港记录
+  shipBaseInfo: http://198.17.239.239:7999/getInfosByCondition # 船舶基本信息

+ 0 - 2
ruoyi-common/src/main/java/com/ruoyi/common/constant/ElasticConstants.java

@@ -9,8 +9,6 @@ package com.ruoyi.common.constant;
 public class ElasticConstants {
     // 黑烟嫌疑船舶
     public static final String HEIYAN_SHIP_RECOGNITION = "heiyan_ship_recognition";
-    // 光谱船舶信息
-    public static final String SO2_SHIP_STATIC_INFO = "so2_ship_static_info";
     // 光谱检测点信息
     public static final String SO2_MONITOR_POINT = "so2_monitor_point";
     // 光谱违规船舶

+ 6 - 0
ruoyi-system/pom.xml

@@ -34,6 +34,12 @@
             <version>4.4.0</version>
         </dependency>
 
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.3.10</version>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 15 - 13
ruoyi-system/src/main/java/com/ruoyi/system/domain/GuapAlert.java

@@ -11,17 +11,18 @@ import java.util.Date;
 
 /**
  * 光谱-嫌疑船舶
- * 
+ *
  * @author ruoyi
  * @date 2021-08-24
  */
 @EqualsAndHashCode(callSuper = true)
 @Data
-public class GuapAlert extends BaseEntity
-{
+public class GuapAlert extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 主键 */
+    /**
+     * 主键
+     */
     private Long id;
 
     private String mmsi;
@@ -32,14 +33,19 @@ public class GuapAlert extends BaseEntity
     @Excel(name = "目的地")
     private String destination;
 
+    private String berthName;
+    private String shipRegionType;
+    private String orgName;
+    private String illegalType;
+    private String dealResult;
+    private String fastResult;
+    private String uploadResult;
+
     private Long monitorPointId;
 
     @Excel(name = "监测点")
     private String monitorPointName;
 
-    @Excel(name = "类型 0:报警 1:疑似报警")
-    private Integer alertType;
-
     @Excel(name = "二氧化氮浓度")
     private BigDecimal no2Concentration;
 
@@ -56,10 +62,6 @@ public class GuapAlert extends BaseEntity
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
 
-    @Excel(name = "0: 未审核 1:违法 2:合法")
-    private Integer auditStatus;
-
-    @Excel(name = "抓拍图片地址")
-    private String captureUrl;
-
+    private Integer illegalStatus;
+    private Integer uploadFlag;
 }

+ 49 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/IllegalShip.java

@@ -0,0 +1,49 @@
+package com.ruoyi.system.domain;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+
+/**
+ * 嫌疑船舶
+ *
+ * @author ruoyi
+ * @date 2021-08-24
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class IllegalShip extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    private Long id;
+
+    private String shipRegionType;// 0-内河船。1-海船
+    private String orgName;
+    private String illegalType;
+    private String dealResult;
+    private String fastResult;
+    private String uploadResult;
+
+    private String destination;
+
+    @Excel(name = "监测点")
+    private String monitorPointName;
+
+    private String mmsi;
+
+    @Excel(name = "船舶名")
+    private String shipName;
+
+    // 状态。1-正常;2-嫌疑;3-违规;4-检查正常
+    private Integer illegalStatus;
+
+    private String berthName;
+
+    private BigDecimal sPercent;
+
+    private BigDecimal so2Concentration;
+
+}

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/ShipRecognition.java

@@ -59,6 +59,9 @@ public class ShipRecognition extends BaseEntity {
     @Excel(name = "船名")
     private String aisShipName;
 
+    private String shipRegionType;
+    private String orgName;
+
     /**
      * AIS船速, 单位:m/s
      */
@@ -268,4 +271,8 @@ public class ShipRecognition extends BaseEntity {
     @Excel(name = "所有图片")
     private String allImgUrl;
 
+    private Integer illegalStatus;
+    private Integer uploadFlag;
+    
+
 }

+ 16 - 2
ruoyi-system/src/main/java/com/ruoyi/system/domain/XiuTanIllegalShip.java

@@ -29,6 +29,16 @@ public class XiuTanIllegalShip extends BaseEntity {
     @Excel(name = "设备名")
     private String semName;
 
+    private String berthName;
+    private String shipRegionType;
+    private String orgName;
+    private String illegalType;
+    private String dealResult;
+    private String fastResult;
+    private String uploadResult;
+
+    private String destination;
+
     @Excel(name = "监测点")
     private String monitorPointName;
 
@@ -41,13 +51,15 @@ public class XiuTanIllegalShip extends BaseEntity {
     @Excel(name = "波峰时间")
     private Date peakTime;
 
+    private Date createTime;
+
     @Excel(name = "波峰起始时间")
     private Date startTime;
 
     @Excel(name = "波峰结束时间")
     private Date endTime;
 
-    private String shipMmsi;
+    private String mmsi;
 
     @Excel(name = "船舶名")
     private String shipName;
@@ -64,9 +76,11 @@ public class XiuTanIllegalShip extends BaseEntity {
     @Excel(name = "风向")
     private BigDecimal windAngle;
 
-    @Excel(name = "状态。1-正常;2-嫌疑;3-违规")
+    @Excel(name = "状态。1-正常;2-嫌疑;3-违规;4-检查正常")
     private Integer illegalStatus;
 
+    private Integer uploadFlag;
+
     private Integer confirmed;
 
 }

+ 23 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/AisShipInfo.java

@@ -0,0 +1,23 @@
+package com.ruoyi.system.domain.vo;
+
+import lombok.Builder;
+import lombok.Data;
+
+/**
+ * @Description: TODO
+ * @Author: huangcheng
+ * @Date: 2021/9/26
+ * @Version V1.0
+ */
+@Data
+@Builder
+public class AisShipInfo {
+    /**
+     * 船名
+     */
+    private String shipName;
+    /**
+     * 船舶类型(0=内河船;1-海船)
+     */
+    private String shipRegionType;
+}

+ 23 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/ShipEepReportRecInfo.java

@@ -0,0 +1,23 @@
+package com.ruoyi.system.domain.vo;
+
+import lombok.Builder;
+import lombok.Data;
+
+/**
+ * @Description: TODO
+ * @Author: huangcheng
+ * @Date: 2021/9/26
+ * @Version V1.0
+ */
+@Data
+@Builder
+public class ShipEepReportRecInfo {
+    /**
+     * 下一港口
+     */
+    private String nextPortName;
+    /**
+     * 停靠泊位
+     */
+    private String berthName;
+}

+ 17 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IAisInfoService.java

@@ -0,0 +1,17 @@
+package com.ruoyi.system.service;
+
+import com.ruoyi.system.domain.vo.AisShipInfo;
+import com.ruoyi.system.domain.vo.ShipEepReportRecInfo;
+
+/**
+ * @Description: TODO
+ * @Author: huangcheng
+ * @Date: 2021/9/26
+ * @Version V1.0
+ */
+public interface IAisInfoService {
+
+    ShipEepReportRecInfo getShipEepReportRecInfo(String startTime, String endTime, String mmsi, String shipId, String shipNameCn);
+
+    AisShipInfo getShipInfo(String shipnameCn, String mmsi, String shipId, String shipNo);
+}

+ 85 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AisInfoServiceImpl.java

@@ -0,0 +1,85 @@
+package com.ruoyi.system.service.impl;
+
+import cn.hutool.core.convert.Convert;
+import cn.hutool.http.HttpUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.system.domain.vo.AisShipInfo;
+import com.ruoyi.system.domain.vo.ShipEepReportRecInfo;
+import com.ruoyi.system.service.IAisInfoService;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Description: TODO
+ * @Author: huangcheng
+ * @Date: 2021/9/26
+ * @Version V1.0
+ */
+@Service
+public class AisInfoServiceImpl implements IAisInfoService {
+
+    @Value("${spring.profiles.active}")
+    private String profile;
+    @Value("${third.shipEepReportRecInfo}")
+    private String shipEepReportRecInfoUrl;
+    @Value("${third.shipBaseInfo}")
+    private String shipBaseInfo;
+
+    /**
+     * 获取船舶进出港记录
+     *
+     * @param startTime
+     * @param endTime
+     * @param mmsi
+     * @param shipId
+     * @param shipNameCn
+     * @return
+     */
+    @Override
+    public ShipEepReportRecInfo getShipEepReportRecInfo(String startTime, String endTime, String mmsi, String shipId, String shipNameCn) {
+        if ("prod".equals(profile)) {
+            Map<String, Object> params = new HashMap<>();
+            params.put("startTime", startTime);
+            params.put("endTime", endTime);
+            params.put("mmsi", mmsi);
+            params.put("shipId", shipId);
+            params.put("shipNameCn", shipNameCn);
+            String getResult = HttpUtil.get(shipEepReportRecInfoUrl, params);
+            JSONObject jsonObject = JSON.parseObject(getResult);
+            if (jsonObject != null && 200 == jsonObject.getInteger("code")) {
+                JSONArray result = jsonObject.getJSONArray("result");
+                if (result != null && !result.isEmpty()) {
+                    Map<String, String> stringStringMap = Convert.toMap(String.class, String.class, result.get(0));
+                    return ShipEepReportRecInfo.builder().berthName(stringStringMap.get("BERTH_NAME")).nextPortName(stringStringMap.get("NEXT_PORT_NAME")).build();
+                }
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public AisShipInfo getShipInfo(String shipnameCn, String mmsi, String shipId, String shipNo) {
+        if ("prod".equals(profile)) {
+            Map<String, Object> params = new HashMap<>();
+            params.put("shipnameCn", shipnameCn);
+            params.put("mmsi", mmsi);
+            params.put("shipId", shipId);
+            params.put("shipNo", shipNo);
+            String getResult = HttpUtil.get(shipBaseInfo, params);
+            JSONObject jsonObject = JSON.parseObject(getResult);
+            if (jsonObject != null && 200 == jsonObject.getInteger("code")) {
+                JSONArray result = jsonObject.getJSONArray("data");
+                if (result != null && !result.isEmpty()) {
+                    Map<String, String> stringStringMap = Convert.toMap(String.class, String.class, result.get(0));
+                    return AisShipInfo.builder().shipName(stringStringMap.get("shipnameCn")).shipRegionType(stringStringMap.get("shipRegionType")).build();
+                }
+            }
+        }
+        return null;
+    }
+}