|
@@ -8,6 +8,7 @@ import cn.hutool.core.util.NumberUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -17,8 +18,8 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.redis.RedisCache;
|
|
|
import com.ruoyi.common.utils.uuid.IdUtils;
|
|
|
import com.ruoyi.framework.config.ElasticSearchClient;
|
|
|
-import com.ruoyi.system.domain.AisShip;
|
|
|
import com.ruoyi.system.domain.DeviceBo;
|
|
|
+import com.ruoyi.system.domain.HuiHAisInfo;
|
|
|
import com.ruoyi.system.domain.IllegalInfo;
|
|
|
import com.ruoyi.system.domain.IllegalShipData;
|
|
|
import com.ruoyi.system.domain.MonitorInfo;
|
|
@@ -27,7 +28,6 @@ import com.ruoyi.system.domain.vo.AisShipInfo;
|
|
|
import com.ruoyi.system.domain.vo.ShipEepReportRecInfo;
|
|
|
import com.ruoyi.system.service.IAisDatabase;
|
|
|
import com.ruoyi.system.service.IAisInfoService;
|
|
|
-import com.ruoyi.system.service.IAisShipService;
|
|
|
import com.ruoyi.system.service.IHeiYanService;
|
|
|
import com.ruoyi.system.service.IIllegalShipDataService;
|
|
|
import com.ruoyi.system.service.ISo2Service;
|
|
@@ -78,8 +78,6 @@ public class GasCommonController {
|
|
|
private IAisDatabase aisDatabase;
|
|
|
@Autowired
|
|
|
private IHeiYanService heiYanService;
|
|
|
- @Autowired
|
|
|
- private IAisShipService aisShipService;
|
|
|
@Value("${spring.profiles.active}")
|
|
|
private String env;
|
|
|
@Autowired
|
|
@@ -285,17 +283,19 @@ public class GasCommonController {
|
|
|
ElasticConstants.HEIYAN_SHIP_RECOGNITION);
|
|
|
List<IllegalInfo> pageList = Convert.toList(IllegalInfo.class, stringObjectMap.get("pageList"));
|
|
|
// 查询船舶的实时经纬度
|
|
|
- Map<String, AisShip> aisShipMap = aisShipService.queryDynamicShip(1);
|
|
|
for (IllegalInfo illegalInfo : pageList) {
|
|
|
if (StrUtil.isNotBlank(illegalInfo.getMmsi())) {
|
|
|
- AisShip aisShip = aisShipMap.get(illegalInfo.getMmsi());
|
|
|
- if (aisShip != null) {
|
|
|
- illegalInfo.setLat(aisShip.getLat());
|
|
|
- illegalInfo.setLng(aisShip.getLng());
|
|
|
- illegalInfo.setReceive(aisShip.getReceive());
|
|
|
- illegalInfo.setHead(ObjectUtil.isEmpty(aisShip.getHead()) ? "-" : aisShip.getHead() + "");
|
|
|
- illegalInfo.setSpeed(ObjectUtil.isEmpty(aisShip.getSpeed()) ? "-" : aisShip.getSpeed() + "节");
|
|
|
- illegalInfo.setCourse(ObjectUtil.isEmpty(aisShip.getCourse()) ? "-" : aisShip.getCourse() + "");
|
|
|
+ String aisShip = redisCache.getCacheMapValue("ais:ship", illegalInfo.getMmsi());
|
|
|
+ if (StrUtil.isNotBlank(aisShip)) {
|
|
|
+ cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(aisShip);
|
|
|
+ illegalInfo.setLat(jsonObject.getBigDecimal("lat"));
|
|
|
+ illegalInfo.setLng(jsonObject.getBigDecimal("lng"));
|
|
|
+ if (StrUtil.isNotBlank(jsonObject.getStr("receive"))) {
|
|
|
+ illegalInfo.setReceive(DateUtil.parseDateTime(jsonObject.getStr("receive").replace("T", " ").substring(0, jsonObject.getStr("receive").lastIndexOf("."))));
|
|
|
+ }
|
|
|
+ illegalInfo.setHead(jsonObject.getStr("head", "-"));
|
|
|
+ illegalInfo.setSpeed(jsonObject.getStr("speed", "-") + "节");
|
|
|
+ illegalInfo.setCourse(jsonObject.getStr("course", "-"));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -305,6 +305,33 @@ public class GasCommonController {
|
|
|
return AjaxResult.success(pageList);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/queryRdsShipList")
|
|
|
+ @ApiOperation("获取redis中所有正常船舶数据-用于地图展示船舶")
|
|
|
+ public AjaxResult queryRedisShipList() {
|
|
|
+ Map<String, Object> cacheMap = redisCache.getCacheMap("ais:ship");
|
|
|
+
|
|
|
+ Map<String, Object> equalsCondition = new HashMap<>();
|
|
|
+ equalsCondition.put("mmsi", "!0");
|
|
|
+ Map<String, Object> rangeCondition = new HashMap<>();
|
|
|
+ String startTime = DateUtil.formatDateTime(DateUtil.offsetDay(new Date(), -1));
|
|
|
+ rangeCondition.put("createTime", StrUtil.concat(true, "[", startTime, ",", DateUtil.now(), "]"));
|
|
|
+ List<String> orderBy = new ArrayList<>();
|
|
|
+ orderBy.add("-createTime");
|
|
|
+ Map<String, Object> stringObjectMap = client.searchDocument(equalsCondition,
|
|
|
+ rangeCondition,
|
|
|
+ orderBy,
|
|
|
+ 1,
|
|
|
+ 10000,
|
|
|
+ ElasticConstants.AIS_ILLEGAL_SHIP,
|
|
|
+ ElasticConstants.SO2_ALERT,
|
|
|
+ ElasticConstants.HEIYAN_SHIP_RECOGNITION);
|
|
|
+ List<IllegalInfo> pageList = Convert.toList(IllegalInfo.class, stringObjectMap.get("pageList"));
|
|
|
+ for (IllegalInfo illegalInfo : pageList) {
|
|
|
+ cacheMap.remove(illegalInfo.getMmsi());
|
|
|
+ }
|
|
|
+ return AjaxResult.success(toMapList(cacheMap));
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/queryShipMonitorInfo")
|
|
|
@ApiOperation("获取船舶监测数据")
|
|
|
public AjaxResult queryShipMonitorInfo(@RequestParam String mmsi) {
|
|
@@ -440,9 +467,9 @@ public class GasCommonController {
|
|
|
afterDataMap.put("uploadFlag", 0);
|
|
|
afterDataMap.put("illegalStatus", 1);
|
|
|
}
|
|
|
- if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi"))) {
|
|
|
- aisInfoService.getDynamicShipInfo(Convert.toStr(afterDataMap.get("mmsi")));
|
|
|
- }
|
|
|
+// if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi"))) {
|
|
|
+// aisInfoService.getDynamicShipInfo(Convert.toStr(afterDataMap.get("mmsi")));
|
|
|
+// }
|
|
|
afterDataMap.put("illegalType", "xiutan");
|
|
|
// 保存数据
|
|
|
saveIllegalData(afterDataMap, ElasticConstants.AIS_ILLEGAL_SHIP);
|
|
@@ -483,9 +510,9 @@ public class GasCommonController {
|
|
|
afterDataMap.put("monitorPointName", data.get("name"));
|
|
|
afterDataMap.put("orgName", orgMap.get(data.get("name")));
|
|
|
}
|
|
|
- if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi"))) {
|
|
|
- aisInfoService.getDynamicShipInfo(Convert.toStr(afterDataMap.get("mmsi")));
|
|
|
- }
|
|
|
+// if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi"))) {
|
|
|
+// aisInfoService.getDynamicShipInfo(Convert.toStr(afterDataMap.get("mmsi")));
|
|
|
+// }
|
|
|
afterDataMap.put("illegalType", "guangpu");
|
|
|
// 保存数据
|
|
|
saveIllegalData(afterDataMap, ElasticConstants.SO2_ALERT);
|
|
@@ -534,9 +561,9 @@ public class GasCommonController {
|
|
|
afterDataMap.put("uploadFlag", 0);
|
|
|
afterDataMap.put("illegalStatus", 1);
|
|
|
}
|
|
|
- if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi")) && Convert.toStr(afterDataMap.get("mmsi")).length() == 9) {
|
|
|
- aisInfoService.getDynamicShipInfo(Convert.toStr(afterDataMap.get("mmsi")));
|
|
|
- }
|
|
|
+// if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi")) && Convert.toStr(afterDataMap.get("mmsi")).length() == 9) {
|
|
|
+// aisInfoService.getDynamicShipInfo(Convert.toStr(afterDataMap.get("mmsi")));
|
|
|
+// }
|
|
|
afterDataMap.put("illegalType", "heiyan");
|
|
|
// 查询检测点和船舶信息
|
|
|
if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi")) && !"0".equals(Convert.toStr(afterDataMap.get("mmsi")))) {
|
|
@@ -576,4 +603,12 @@ public class GasCommonController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private List<Object> toMapList(Map<String, Object> listMap) {
|
|
|
+ List<Object> resultList = new ArrayList<>();
|
|
|
+ for (Map.Entry<String, Object> entry : listMap.entrySet()) {
|
|
|
+ resultList.add(JSONUtil.toBean(entry.getValue().toString(), HuiHAisInfo.class));
|
|
|
+ }
|
|
|
+ return resultList;
|
|
|
+ }
|
|
|
+
|
|
|
}
|