459242451@qq.com 3 years ago
parent
commit
93423bde7d

+ 8 - 1
README.md

@@ -19,6 +19,12 @@ http://200.200.19.122:9200
 外网测试环境
 http://212.129.138.23:9100
 http://212.129.138.23:9200
+
+生产环境
+http://198.17.188.51:9200
+启动流程:切换到su esuser
+cd /home/elasticsearch-7.14.0/bin/
+./elasticsearch -d
 ```
 
 > canal
@@ -90,4 +96,5 @@ sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
 
 > 记录
 
-- 共同的字段:mmsi、shipName、destination、berthName、monitorPointName
+- 三子系统ES中共同的字段:mmsi、shipName、destination、berthName、monitorPointName
+- 黑烟提供的接口文档地址:https://yx00mdxxzb.feishu.cn/docs/doccnv5xXUqxHYTqMyhj5UkQjPd#

+ 21 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/gas/GasCommonController.java

@@ -273,4 +273,25 @@ public class GasCommonController {
         put("苏通大桥", "常熟海事局");
     }};
 
+    @GetMapping("/queryData")
+    @ApiOperation("查询ES数据")
+    public Object queryData(@RequestParam(required = false) String id, @RequestParam(required = false) Integer size, @RequestParam String... index) {
+        if (size == null) {
+            size = 200;
+        }
+        Map<String, Object> equalsCondition = new HashMap<>();
+        if (StrUtil.isNotBlank(id)) {
+            equalsCondition.put("id", id);
+        }
+        List<String> orderBy = new ArrayList<>();
+        orderBy.add("-createTime");
+        Map<String, Object> map = client.searchDocument(equalsCondition,
+                null,
+                orderBy,
+                1,
+                size,
+                index);
+        return map.get("pageList");
+    }
+
 }

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

@@ -193,8 +193,14 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
             case INSERT:
                 // 黑烟船舶数据入库
                 if (StrUtil.equalsIgnoreCase(database, "smoke_api") && StrUtil.equalsIgnoreCase(table, "ship_recognition")) {
+                    if (ObjectUtil.isEmpty(afterDataMap.get("aisMmsi")) || Convert.toStr(afterDataMap.get("aisMmsi")).length() != 9) {
+                        log.info("==1");
+                        break;
+                    }
                     // 判断数据状态
-                    if (ObjectUtil.isNotEmpty(afterDataMap.get("rcgSoot")) && NumberUtil.isGreaterOrEqual(Convert.toBigDecimal(afterDataMap.get("rcgSoot")), Convert.toBigDecimal(blackThresholdVal))) {
+                    if (ObjectUtil.isNotEmpty(afterDataMap.get("rcgSoot")) && NumberUtil.isGreaterOrEqual(Convert.toBigDecimal(afterDataMap.get("rcgSoot")),
+                            Convert.toBigDecimal(blackThresholdVal))) {
+                        log.info("==2");
                         // 查询黑烟图片
                         if ("prod".equals(env)) {
                             String imgUrl = HttpUtil.get(blackImgUrl + Convert.toStr(afterDataMap.get("id")));
@@ -223,19 +229,17 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
                         afterDataMap.put("uploadFlag", 0);
                         afterDataMap.put("illegalStatus", 1);
                     }
-                    if (ObjectUtil.isNotEmpty(afterDataMap.get("aisMmsi"))) {
+                    if ("prod".equals(env) && ObjectUtil.isNotEmpty(afterDataMap.get("aisMmsi"))) {
                         aisInfoService.getDynamicShipInfo(Convert.toStr(afterDataMap.get("aisMmsi")));
                     }
                     afterDataMap.put("mmsi", afterDataMap.get("aisMmsi"));
                     afterDataMap.put("illegalType", "heiyan");
                     // 查询检测点和船舶信息
-                    if ("prod".equals(env)) {
-                        if (ObjectUtil.isNotEmpty(afterDataMap.get("aisMmsi")) && !"0".equals(Convert.toStr(afterDataMap.get("aisMmsi")))) {
-                            AisShipInfo shipInfo = aisInfoService.getShipInfo("", Convert.toStr(afterDataMap.get("aisMmsi")), "", "");
-                            if (shipInfo != null) {
-                                afterDataMap.put("shipName", shipInfo.getShipName());
-                                afterDataMap.put("shipRegionType", shipInfo.getShipRegionType());
-                            }
+                    if (ObjectUtil.isNotEmpty(afterDataMap.get("aisMmsi")) && !"0".equals(Convert.toStr(afterDataMap.get("aisMmsi")))) {
+                        AisShipInfo shipInfo = aisInfoService.getShipInfo("", Convert.toStr(afterDataMap.get("aisMmsi")), "", "");
+                        if (shipInfo != null) {
+                            afterDataMap.put("shipName", shipInfo.getShipName());
+                            afterDataMap.put("shipRegionType", shipInfo.getShipRegionType());
                         }
                     }
                     if (ObjectUtil.isNotEmpty(afterDataMap.get("snapPos"))) {

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

@@ -133,4 +133,4 @@ black:
 third:
   shipEepReportRecInfo: http://198.17.188.111:6201/huiyan/getShipEepReportRec # 船舶进出港记录
   shipBaseInfo: http://198.17.239.239:7001/getInfosByCondition # 船舶基本信息
-  shipDynamicInfo: http://198.17.239.239:9004/getInfosByMmsi?mmsi #船舶动态数据信息
+  shipDynamicInfo: http://198.17.239.239:9004/getInfosByMmsi?mmsi= #船舶动态数据信息

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

@@ -129,4 +129,4 @@ black:
 third:
   shipEepReportRecInfo: http://198.17.188.111:6201/huiyan/getShipEepReportRec # 船舶进出港记录
   shipBaseInfo: http://198.17.239.239:7001/getInfosByCondition # 船舶基本信息
-  shipDynamicInfo: http://198.17.239.239:9004/getInfosByMmsi?mmsi #船舶动态数据信息
+  shipDynamicInfo: http://198.17.239.239:9004/getInfosByMmsi?mmsi= #船舶动态数据信息

+ 11 - 7
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AisInfoServiceImpl.java

@@ -51,10 +51,11 @@ public class AisInfoServiceImpl implements IAisInfoService {
             params.put("startTime", startTime);
             params.put("endTime", endTime);
             params.put("mmsi", mmsi);
-            params.put("shipId", shipId);
-            params.put("shipNameCn", shipNameCn);
+//            params.put("shipId", shipId);
+//            params.put("shipNameCn", shipNameCn);
             try {
-                String getResult = HttpUtil.get(shipEepReportRecInfoUrl, params);
+                String getResult = HttpUtil.get(shipEepReportRecInfoUrl + "?" + HttpUtil.toParams(params));
+                log.info("获取进出港数据:{}", getResult);
                 JSONObject jsonObject = JSON.parseObject(getResult);
                 if (jsonObject != null && 200 == jsonObject.getInteger("code")) {
                     JSONArray result = jsonObject.getJSONArray("result");
@@ -73,14 +74,17 @@ public class AisInfoServiceImpl implements IAisInfoService {
 
     @Override
     public AisShipInfo getShipInfo(String shipnameCn, String mmsi, String shipId, String shipNo) {
+        log.info("当前环境:{}", profile);
         if ("prod".equals(profile)) {
             Map<String, Object> params = new HashMap<>();
-            params.put("shipnameCn", shipnameCn);
+//            params.put("shipnameCn", shipnameCn);
             params.put("mmsi", mmsi);
-            params.put("shipId", shipId);
-            params.put("shipNo", shipNo);
+//            params.put("shipId", shipId);
+//            params.put("shipNo", shipNo);
             try {
-                String getResult = HttpUtil.get(shipBaseInfo, params);
+                String url = shipBaseInfo + "?" + HttpUtil.toParams(params);
+                String getResult = HttpUtil.get(url);
+                log.info("调用地址:{}。获取船舶数据:{}", url, getResult);
                 JSONObject jsonObject = JSON.parseObject(getResult);
                 if (jsonObject != null && 200 == jsonObject.getInteger("code")) {
                     JSONArray result = jsonObject.getJSONArray("data");

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

@@ -18,20 +18,20 @@
     </select>
 
     <select id="queryDeviceList" resultType="com.ruoyi.system.domain.DeviceBo">
-        select d.name      as name,
+        select d.name                               as name,
                case d.type
                    when 0 then 'ais设备'
                    when 1 then '遥测设备'
                    when 2 then '气象站设备'
-                   end        deviceType,
-               t1.name        monitorName,
+                   end                                 deviceType,
+               t1.name                                 monitorName,
                case online_status
                    when 0 then '在线'
                    when 1 then '离线'
-                   end        status,
-               ''          as latilongti,
-               update_time as updateTime,
-               'so2'       as source
+                   end                                 status,
+               CONCAT(d.longitude, ',', d.latitude) as latilongti,
+               update_time                          as updateTime,
+               'so2'                                as source
         from device d
                  left join monitor_point t1
                            on t1.id = d.monitor_point_id