|
@@ -1,144 +0,0 @@
|
|
|
-package com.jtgh.yjpt.controller.ais;
|
|
|
-
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.flex.remoting.RemotingDestination;
|
|
|
-import org.springframework.stereotype.Controller;
|
|
|
-
|
|
|
-import com.google.gson.Gson;
|
|
|
-import com.google.gson.reflect.TypeToken;
|
|
|
-import com.jtgh.yjpt.controller.BaseController;
|
|
|
-import com.yuanxd.tools.hscbdt.HscbdtService;
|
|
|
-import com.yuanxd.tools.hscbdt.bean.SeqShips;
|
|
|
-import com.yuanxd.tools.hscbdt.bean.Ship;
|
|
|
-
|
|
|
-/**
|
|
|
- * 海事AIS相关Flex服务接口
|
|
|
- *
|
|
|
- *
|
|
|
- */
|
|
|
-@Controller
|
|
|
-@RemotingDestination("aisCtl")
|
|
|
-public class AisCtl extends BaseController {
|
|
|
- @Autowired
|
|
|
- HscbdtService msaapiService;
|
|
|
-
|
|
|
- private Gson gson;
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 区域检索ais船舶数据
|
|
|
- *
|
|
|
- * @param extend
|
|
|
- * @return
|
|
|
- */
|
|
|
- public Ship[] queryAis(String bottomLeftx, String bottomLefty, String topRightx, String topRighty) {
|
|
|
- System.out.println(bottomLeftx + "," + bottomLefty + ","+ topRightx + "," + topRighty);
|
|
|
-// Map<String, Object> ext = parseData(extend);
|
|
|
- SeqShips ships = msaapiService.searchObjectResultByArea(1,
|
|
|
- bottomLeftx + "," + bottomLefty + ",",
|
|
|
- topRightx + "," + topRighty);
|
|
|
- if (ships != null && ships.getShips().length > 0) {
|
|
|
- for (Ship ship : ships.getShips()) {
|
|
|
- if ("0".equals(ship.getEta())) {
|
|
|
- ship.setEta("");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return ships == null ? null : ships.getShips();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据mmsi查询船舶轨迹
|
|
|
- *
|
|
|
- * @param mmsi
|
|
|
- * @param beginDate
|
|
|
- * @param endDate
|
|
|
- * @return
|
|
|
- */
|
|
|
- /*public Collection<ShipPosition> queryAISCBsByMMSI(String mmsi, String beginDate, String endDate) {
|
|
|
- ShipPosition[] poss = hscbdtService.findTrackObject(mmsi,
|
|
|
- StringUtils.isEmpty(beginDate) ? new Date() : new Date(Long.parseLong(beginDate)),
|
|
|
- StringUtils.isEmpty(endDate) ? new Date() : new Date(Long.parseLong(endDate)));
|
|
|
- ArrayList<ShipPosition> posList = new ArrayList<ShipPosition>();
|
|
|
- if (poss.length > 0) {
|
|
|
- for (int i = (poss.length - 1); i > -1; i--) {
|
|
|
- if(null!=poss[i]) {
|
|
|
- posList.add(poss[i]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return posList;
|
|
|
- }*/
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询单船轨迹
|
|
|
- *
|
|
|
- * @param mmsi
|
|
|
- * @param startTime
|
|
|
- * @param endTime
|
|
|
- * @return
|
|
|
- *//*
|
|
|
- public ArrayList<ShipPosition> queryAISCBsByMMSI2(String mmsi, String startTime, String endTime) {
|
|
|
- Date startDate = new Date(Long.parseLong(startTime));
|
|
|
- Date endDate = new Date(Long.parseLong(endTime));
|
|
|
- String trackStr = hscbdtService.findTrack(mmsi, startDate, endDate);
|
|
|
- ArrayList<ShipPosition> posList = new ArrayList<ShipPosition>();
|
|
|
- ShipPosition routeVo = null;
|
|
|
- // 解析逗号分隔字符串
|
|
|
- String[] routeArr = trackStr.split(",");
|
|
|
- Date date = new Date();
|
|
|
- for (int i = (routeArr.length - 1); i > -1; i--) {
|
|
|
- // 解析 “|” 号分隔字符串
|
|
|
- String str = routeArr[i];
|
|
|
- String[] strArr = str.split("\\|");
|
|
|
- if (strArr.length > 0) {
|
|
|
- routeVo = new ShipPosition();
|
|
|
- routeVo.setLon(strArr[1]);
|
|
|
- routeVo.setLat(strArr[2]);
|
|
|
- if (StringUtils.isNotEmpty(strArr[3])) {
|
|
|
- date = new Date();
|
|
|
- // 加毫秒数
|
|
|
- date.setTime(Long.parseLong(strArr[3] + "000"));
|
|
|
- routeVo.setTime(date);
|
|
|
- }
|
|
|
- routeVo.setAngle(strArr[4]);
|
|
|
- posList.add(routeVo);
|
|
|
- }
|
|
|
- }
|
|
|
- return posList;
|
|
|
- }*/
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取船名
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- /*public String getShipName(String name) {
|
|
|
- String url = DataServerGlobal.SHIPNAME_URL;
|
|
|
- String strJson = "";
|
|
|
- if(StringUtils.isNotEmpty(name)) {
|
|
|
- try {
|
|
|
- name = name.replaceAll(" ", "%20");
|
|
|
- url = url + "/"+name;
|
|
|
- strJson = HttpProxy.http_get_json(url);
|
|
|
- if(StringUtils.isNotEmpty(strJson)) {
|
|
|
- strJson = strJson.replace("\"", "");
|
|
|
- } else {
|
|
|
- return "";
|
|
|
- }
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- return strJson;
|
|
|
- }*/
|
|
|
-
|
|
|
- private Map<String, Object> parseData(String data) {
|
|
|
- Map<String, Object> map = gson.fromJson(data, new TypeToken<Map<String, Object>>() {
|
|
|
- }.getType());
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
-}
|