Quellcode durchsuchen

全部船只查询

SHS vor 1 Jahr
Ursprung
Commit
a5af773ee8

+ 13 - 0
aidex-controller/src/main/java/com/aidex/web/controller/app/AppController.java

@@ -10,6 +10,8 @@ import com.aidex.common.core.domain.BaseEntity;
 import com.aidex.common.core.domain.R;
 import com.aidex.common.core.page.PageDomain;
 import com.aidex.common.gps.domain.LocationEntity;
+import com.aidex.common.plush.domain.vo.SysShipExtendListResVO;
+import com.aidex.common.plush.domain.vo.SysShipExtendListVO;
 import com.aidex.common.plush.domain.vo.SysShipExtendVO;
 import com.aidex.common.plush.domain.vo.SysShipResVO;
 import com.aidex.common.utils.json.JSONObject;
@@ -104,6 +106,17 @@ public class AppController {
         return R.data(iAppService.findAllLocationByNext(direction,lat,lon));
     }
 
+    @GetMapping("/location/wharf")
+    @ApiOperation(value = "获取全部船只位于站点相对位置", notes = "获取全部船只位于站点相对位置", produces = "application/json")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "direction", value = "正向(TRUE)/反向(FALSE)、默认正向", required = true, dataType = "Boolean"),
+            @ApiImplicitParam(name = "lat", value = "纬度", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "lon", value = "经度", required = true, dataType = "String")})
+    public R<SysShipExtendListResVO> getLocationWharf(@RequestParam(defaultValue = "true", name = "direction") Boolean direction, @RequestParam(defaultValue = "",name = "lat") String lat, @RequestParam(defaultValue = "",name = "lon") String lon )
+    {
+        return R.data(iAppService.findAllLocation(direction,lat,lon));
+    }
+
 
     @GetMapping("/location/all")
     @ApiOperation(value = "获取全部船只位置", notes = "获取全部船只位置", produces = "application/json")

+ 4 - 0
aidex-system/src/main/java/com/aidex/common/app/server/IAppService.java

@@ -4,6 +4,8 @@ import com.aidex.common.app.domain.vo.LocationVO;
 import com.aidex.common.app.domain.vo.SysWharfVO;
 import com.aidex.common.core.domain.R;
 import com.aidex.common.gps.domain.LocationEntity;
+import com.aidex.common.plush.domain.vo.SysShipExtendListResVO;
+import com.aidex.common.plush.domain.vo.SysShipExtendListVO;
 import com.aidex.common.plush.domain.vo.SysShipExtendVO;
 import com.aidex.common.plush.domain.vo.SysShipResVO;
 import com.aidex.system.domain.SysNotice;
@@ -28,6 +30,8 @@ public interface IAppService {
 
     SysShipResVO findAllLocationByNext(Boolean direction, String lat, String lon);
 
+    SysShipExtendListResVO findAllLocation(Boolean direction, String lat, String lon);
+
     SysWharfVO findNearestStation(String lat, String lng);
 
     JSONArray getEnableReservationConfig();

+ 45 - 0
aidex-system/src/main/java/com/aidex/common/app/server/impl/AppService.java

@@ -10,6 +10,8 @@ import com.aidex.common.core.domain.BaseEntity;
 import com.aidex.common.core.domain.R;
 import com.aidex.common.exception.SysException;
 import com.aidex.common.gps.server.IGpsService;
+import com.aidex.common.plush.domain.vo.SysShipExtendListResVO;
+import com.aidex.common.plush.domain.vo.SysShipExtendListVO;
 import com.aidex.common.plush.domain.vo.SysShipExtendVO;
 import com.aidex.common.plush.domain.vo.SysShipResVO;
 import com.aidex.common.plush.service.SysShipExtendService;
@@ -207,6 +209,49 @@ public class AppService implements IAppService {
         return sysShipResVO;
     }
 
+
+    public SysShipExtendListResVO findAllLocation(Boolean direction, String lat, String lon){
+        if(StringUtils.isEmpty(lat) || StringUtils.isEmpty(lon))
+            throw new SysException(4441,"请告诉我你在哪");
+
+        String travel = direction?"1":"0";
+        // 离我最近的站点
+        SysWharf wharf = this.findNearestStation(lat,lon);
+
+        if(!wharf.getStatus().equals("0"))
+            throw new SysException(4442, wharf.getWharfNanme()+" 已经停用!请更换其他站点");
+
+        List<SysShipExtendVO> sysShipExtendVOS = sysShipExtendService.findAllonline(travel);
+
+        if(sysShipExtendVOS.size() <= 0)
+            throw new SysException(8821,"暂无运行船只");
+
+        List<SysShipExtendListVO> sysShipExtendListVOS = new ArrayList<>();
+        for (SysShipExtendVO sysShipExtendVO : sysShipExtendVOS) {
+            SysShipExtendListVO sysShipExtendListVO = new SysShipExtendListVO();
+            BeanUtils.copyProperties(sysShipExtendVO,sysShipExtendListVO);
+            sysShipExtendListVO.setMy(wharf);
+            // 已经停靠
+            if(sysShipExtendVO.getIsStop().equals(1L)){
+                sysShipExtendListVO.setStop(sysWharfService.get(sysShipExtendVO.getWharfStop()));
+            }else {
+                sysShipExtendListVO.setNext(sysWharfService.get(sysShipExtendVO.getNextWharf()));
+            }
+            sysShipExtendListVOS.add(sysShipExtendListVO);
+        }
+
+        SysShipExtendListResVO resVO = new SysShipExtendListResVO();
+        resVO.setShipList(sysShipExtendListVOS);
+
+        try {
+            SysShipResVO sysShipResVO = this.findAllLocationByNext(direction,lat,lon);
+            resVO.setShipLocation(sysShipResVO);
+        }catch (Exception e){
+            resVO.setShipLocation(null);
+        }
+        return resVO;
+    }
+
     public SysWharfVO findNearestStation(String lat, String lon){
         if(StringUtils.isEmpty(lat) || StringUtils.isEmpty(lon))
             throw new SysException(4441,"请告诉我你在哪");

+ 17 - 0
aidex-system/src/main/java/com/aidex/common/plush/domain/vo/SysShipExtendListResVO.java

@@ -0,0 +1,17 @@
+package com.aidex.common.plush.domain.vo;
+
+import com.aidex.common.plush.domain.SysShipExtend;
+import com.aidex.system.domain.SysWharf;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class SysShipExtendListResVO extends SysShipExtend {
+
+    @ApiModelProperty(value="全部船只相对位置",required=true)
+    private List<SysShipExtendListVO> shipList;
+    @ApiModelProperty(value="离我最近的船只(如为NULL则所有船只已全部经过该站点)",required=true)
+    private SysShipResVO shipLocation;
+}

+ 19 - 0
aidex-system/src/main/java/com/aidex/common/plush/domain/vo/SysShipExtendListVO.java

@@ -0,0 +1,19 @@
+package com.aidex.common.plush.domain.vo;
+
+import com.aidex.common.plush.domain.SysShipExtend;
+import com.aidex.system.domain.SysWharf;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class SysShipExtendListVO extends SysShipExtend {
+
+    @ApiModelProperty(value="船只名称",required=true)
+    private String shipName;
+    @ApiModelProperty(value="停靠站点",required=true)
+    private SysWharf stop;
+    @ApiModelProperty(value="当前最近站点",required=true)
+    private SysWharf my;
+    @ApiModelProperty(value="即将到达站点",required=true)
+    private SysWharf next;
+}