|
@@ -43,6 +43,7 @@ import org.springframework.util.LinkedCaseInsensitiveMap;
|
|
|
|
|
|
import java.net.InetSocketAddress;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -88,10 +89,10 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
|
|
|
put("苏通大桥", "常熟海事局");
|
|
|
}};
|
|
|
public final static Map<String, String> heiyanDeviceMap = new HashMap<String, String>() {{
|
|
|
- put("南京三桥", "65");
|
|
|
- put("润扬大桥", "66");
|
|
|
- put("江阴大桥", "67");
|
|
|
- put("苏通大桥", "68");
|
|
|
+ put("南京三桥", "1106");
|
|
|
+ put("润扬大桥", "2104");
|
|
|
+ put("江阴大桥", "6106");
|
|
|
+ put("苏通大桥", "9108");
|
|
|
}};
|
|
|
|
|
|
@Override
|
|
@@ -206,7 +207,11 @@ 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*/) {
|
|
|
+ afterDataMap.put("mmsi", afterDataMap.get("aisMmsi"));
|
|
|
+ afterDataMap.put("illegalType", "heiyan");
|
|
|
+ afterDataMap.put("createTime", afterDataMap.get("snapTimeFmt"));
|
|
|
+ afterDataMap.put("monitorPointName", afterDataMap.get("snapPos"));
|
|
|
+ if (ObjectUtil.isEmpty(afterDataMap.get("mmsi")) /*|| Convert.toStr(afterDataMap.get("mmsi")).length() != 9*/) {
|
|
|
break;
|
|
|
}
|
|
|
// 判断数据状态
|
|
@@ -231,6 +236,12 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
|
|
|
afterDataMap.put("allImgUrl", newImgList);
|
|
|
}
|
|
|
}
|
|
|
+ // 查询检测点和船舶信息、船舶进出港记录
|
|
|
+ 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", 3);
|
|
|
afterDataMap.put("uploadFlag", 0);
|
|
@@ -240,18 +251,15 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
|
|
|
afterDataMap.put("uploadFlag", 0);
|
|
|
afterDataMap.put("illegalStatus", 1);
|
|
|
}
|
|
|
- if (ObjectUtil.isNotEmpty(afterDataMap.get("aisMmsi")) && Convert.toStr(afterDataMap.get("aisMmsi")).length() == 9) {
|
|
|
- aisInfoService.getDynamicShipInfo(Convert.toStr(afterDataMap.get("aisMmsi")));
|
|
|
+ if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi")) && Convert.toStr(afterDataMap.get("mmsi")).length() == 9) {
|
|
|
+ aisInfoService.getDynamicShipInfo(Convert.toStr(afterDataMap.get("mmsi")));
|
|
|
}
|
|
|
- afterDataMap.put("mmsi", afterDataMap.get("aisMmsi"));
|
|
|
- afterDataMap.put("illegalType", "heiyan");
|
|
|
+
|
|
|
// 查询检测点和船舶信息
|
|
|
- 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());
|
|
|
- }
|
|
|
+ AisShipInfo shipInfo = aisInfoService.getShipInfo("", Convert.toStr(afterDataMap.get("mmsi")), "", "");
|
|
|
+ if (shipInfo != null) {
|
|
|
+ afterDataMap.put("shipName", shipInfo.getShipName());
|
|
|
+ afterDataMap.put("shipRegionType", shipInfo.getShipRegionType());
|
|
|
}
|
|
|
// 对于没有从ais系统拿到船名的情况下,直接取rcgShipName
|
|
|
if (ObjectUtil.isEmpty(afterDataMap.get("shipName"))) {
|
|
@@ -262,8 +270,7 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
|
|
|
afterDataMap.put("orgName", orgMap.get(Convert.toStr(afterDataMap.get("snapPos"))));
|
|
|
afterDataMap.put("deviceId", heiyanDeviceMap.get(Convert.toStr(afterDataMap.get("snapPos"))));
|
|
|
}
|
|
|
- afterDataMap.put("createTime", afterDataMap.get("snapTimeFmt"));
|
|
|
- afterDataMap.put("monitorPointName", afterDataMap.get("snapPos"));
|
|
|
+
|
|
|
// 保存数据
|
|
|
saveIllegalData(afterDataMap, ElasticConstants.HEIYAN_SHIP_RECOGNITION);
|
|
|
client.createDocument(ElasticConstants.HEIYAN_SHIP_RECOGNITION, Convert.toStr(afterDataMap.get("id")), afterDataMap);
|
|
@@ -286,29 +293,19 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
|
|
|
} else if (StrUtil.equalsIgnoreCase(database, "ship") && StrUtil.equalsIgnoreCase(table, "alert")) {
|
|
|
// 船舶记录
|
|
|
if ("prod".equals(env)) {
|
|
|
- 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());
|
|
|
- }
|
|
|
+ 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))) {
|
|
|
// 查询检测点和船舶信息、船舶进出港记录
|
|
|
- if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi"))) {
|
|
|
- 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")));
|
|
|
+ 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());
|
|
|
}
|
|
|
|
|
|
// 嫌疑船舶
|
|
@@ -320,6 +317,12 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
|
|
|
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")));
|
|
|
+ }
|
|
|
if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi")) && Convert.toStr(afterDataMap.get("mmsi")).length() == 9) {
|
|
|
aisInfoService.getDynamicShipInfo(Convert.toStr(afterDataMap.get("mmsi")));
|
|
|
}
|
|
@@ -336,38 +339,25 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
|
|
|
CacheConstants.DEVICE_LIST_STATIC));
|
|
|
} else if (StrUtil.equalsIgnoreCase(database, "ais_database") && StrUtil.equalsIgnoreCase(table, "illegal_ship")) {
|
|
|
// 嗅探系统-违规船舶
|
|
|
+ afterDataMap.put("mmsi", afterDataMap.get("shipMmsi"));
|
|
|
+ afterDataMap.put("createTime", afterDataMap.get("peakTime"));
|
|
|
+ afterDataMap.put("so2Percent", afterDataMap.get("sPercent"));
|
|
|
if ("prod".equals(env)) {
|
|
|
// 查询检测点和船舶信息、船舶进出港记录
|
|
|
- if (ObjectUtil.isNotEmpty(afterDataMap.get("shipMmsi"))) {
|
|
|
- AisShipInfo shipInfo = aisInfoService.getShipInfo("", Convert.toStr(afterDataMap.get("shipMmsi")), "", "");
|
|
|
- if (shipInfo != null) {
|
|
|
- afterDataMap.put("shipName", shipInfo.getShipName());
|
|
|
- afterDataMap.put("shipRegionType", shipInfo.getShipRegionType());
|
|
|
- }
|
|
|
+ AisShipInfo shipInfo = aisInfoService.getShipInfo("", Convert.toStr(afterDataMap.get("mmsi")), "", "");
|
|
|
+ if (shipInfo != null) {
|
|
|
+ afterDataMap.put("shipName", shipInfo.getShipName());
|
|
|
+ afterDataMap.put("shipRegionType", shipInfo.getShipRegionType());
|
|
|
}
|
|
|
}
|
|
|
- afterDataMap.put("mmsi", afterDataMap.get("shipMmsi"));
|
|
|
- afterDataMap.put("createTime", afterDataMap.get("peakTime"));
|
|
|
- afterDataMap.put("so2Percent", afterDataMap.get("sPercent"));
|
|
|
if (ObjectUtil.isNotEmpty(afterDataMap.get("sPercent")) && NumberUtil.isGreaterOrEqual(Convert.toBigDecimal(afterDataMap.get("sPercent")), Convert.toBigDecimal(so2ThresholdVal))) {
|
|
|
// 查询检测点和船舶信息、船舶进出港记录
|
|
|
- if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi"))) {
|
|
|
- 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());
|
|
|
- }
|
|
|
- }
|
|
|
- afterDataMap.put("deviceId", afterDataMap.get("semId"));
|
|
|
- // 查询站点信息
|
|
|
- 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("category")));
|
|
|
+ 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);
|
|
@@ -377,6 +367,15 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
|
|
|
afterDataMap.put("uploadFlag", 0);
|
|
|
afterDataMap.put("illegalStatus", 1);
|
|
|
}
|
|
|
+ afterDataMap.put("deviceId", afterDataMap.get("semId"));
|
|
|
+ // 查询站点信息
|
|
|
+ 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("category")));
|
|
|
+ }
|
|
|
if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi")) && Convert.toStr(afterDataMap.get("mmsi")).length() == 9) {
|
|
|
aisInfoService.getDynamicShipInfo(Convert.toStr(afterDataMap.get("mmsi")));
|
|
|
}
|