csw 2 months ago
parent
commit
ab0cf48518

+ 26 - 0
src/main/java/com/ecnu/platform/cwp/CwpDataService.groovy

@@ -1,6 +1,7 @@
 package com.ecnu.platform.cwp
 
 import com.ecnu.alg.pojo.port.data.AlgCwpImportData
+import com.ecnu.alg.pojo.port.inputs.AlgBollard
 import com.ecnu.alg.pojo.port.inputs.AlgCraneBase
 import com.ecnu.alg.pojo.port.inputs.AlgCranePool
 import com.ecnu.alg.pojo.port.inputs.AlgStowDetail
@@ -40,6 +41,8 @@ class CwpDataService {
     public static final String AlgCwpBlockKey = "port:AlgCwpBlock:"
     public static final String AlgCwpParameterKey = "port:AlgCwpParameter:"
 
+    public static final String AlgBollardKey = "port:AlgBollard:"
+
     @Autowired
     private RedisUtil redisUtil;
 
@@ -47,6 +50,13 @@ class CwpDataService {
     @Doc4MethodRes(key = "result", desc = "底图信息", refClasses = AlgCwpImportData.class)
     AlgCwpImportData importData(Map<String, Object> map) throws Exception {
         AlgCwpImportData algCwpImportData = new AlgCwpImportData();
+        List<AlgBollard> algBollardList = redisUtil.getByPrefix(AlgBollardKey + "*") as List<AlgBollard>
+        Collections.sort(algBollardList, new Comparator<AlgBollard>() {
+            @Override
+            public int compare(AlgBollard o1, AlgBollard o2) {
+                return o1.getLocation().compareTo(o2.getLocation());
+            }
+        });
         // 解析船舶航次信息
         String vesselVisitId = null;
         SimpleDateFormat sdf = new SimpleDateFormat("MMM d, yyyy hh:mm:ss a", Locale.ENGLISH);
@@ -61,6 +71,21 @@ class CwpDataService {
             algVesselVisit.setPlanEndWorkTime(sdf.parse(smartScheduleIdInfo.get("planEndWorkTime") as String))
             algVesselVisit.setStartPst(smartScheduleIdInfo.get("planStartPst") as Double)
             algVesselVisit.setEndPst(smartScheduleIdInfo.get("planEndPst") as Double)
+            // 根据船舶停靠位置,找到缆桩编号
+            for (int i = 0; i < algBollardList.size(); i++) {
+                AlgBollard algBollard = algBollardList.get(i)
+                if (algVesselVisit.getStartPst() < algBollard.getLocation()) {
+                    algVesselVisit.setStartBollardId(algBollard.getId())
+                    break;
+                }
+            }
+            for (int i = 0; i < algBollardList.size(); i++) {
+                AlgBollard algBollard = algBollardList.get(i)
+                if (algVesselVisit.getEndPst() < algBollard.getLocation()) {
+                    algVesselVisit.setEndBollardId(algBollard.getId())
+                    break;
+                }
+            }
             algVesselVisit.setBerthDirection(smartScheduleIdInfo.get("planBerthDirect") as String)
             redisUtil.set(AlgVesselVisitKey + algVesselVisit.getVesselVisitId(), algVesselVisit)
             algCwpImportData.getAlgVesselVisitList().add(algVesselVisit)
@@ -226,6 +251,7 @@ class CwpDataService {
                 algVstBay1.setRowNos(algVstBay.getRowNos())
                 bayInfos.add(algVstBay1)
             }
+            algVstHatch.setBayInfos(bayInfos)
             redisUtil.set(AlgVstHatchKey + algVstHatch.getVesselStructGkey() + ":" + algVstHatch.getGkey(), algVstHatch)
         }
         // 解析舱盖板信息

File diff suppressed because it is too large
+ 50 - 0
src/main/java/com/ecnu/platform/port/CwpBlockVoService.groovy


+ 0 - 1
src/main/java/com/ecnu/platform/port/TmlVesselVisitVoService.groovy

@@ -33,7 +33,6 @@ class TmlVesselVisitVoService {
             visitMap.put("id", algVesselVisit.getVesselVisitId())
             visitMap.put("phase", "V_ON_BERTH")
             visitMap.put("hbrCvGkey", null)
-            // 根据船舶停靠位置,找到缆桩编号
             visitMap.put("actStartBollardId", algVesselVisit.getStartBollardId())
             visitMap.put("actEndBollardId", algVesselVisit.getEndBollardId())
             visitMap.put("actDirection", algVesselVisit.getBerthDirection())

+ 100 - 0
src/main/java/com/ecnu/platform/port/VesselStructService.groovy

@@ -0,0 +1,100 @@
+package com.ecnu.platform.port
+
+import com.ecnu.alg.pojo.port.inputs.AlgVstBay
+import com.ecnu.alg.pojo.port.inputs.AlgVstHatch
+import com.ecnu.alg.pojo.port.inputs.AlgVstRow
+import com.three.data_api.dm.annos.BizApiMethod
+import com.three.data_api.dm.annos.BizRequestPm
+import com.three.data_api.dm.annos.Doc4MethodRes
+import com.three.data_api.dm.constants.ThreeConstant
+import com.three.redis.utils.RedisUtil
+import org.springframework.beans.factory.annotation.Autowired
+
+class VesselStructService {
+
+
+    public static final String AlgVstHatchKey = "port:AlgVstHatch:"
+    public static final String AlgVstBayKey = "port:AlgVstBay:"
+    public static final String AlgVstHatchCoverKey = "port:AlgVstHatchCover:"
+
+    @Autowired
+    private RedisUtil redisUtil;
+
+    @BizApiMethod(matchedApis = ThreeConstant.BIZ_API_NAME, desc = "查询所有舱位信息,根据船舶结构主键查询")
+    @Doc4MethodRes(key = "result", desc = "舱位信息", refClasses = AlgVstHatch.class)
+    List<AlgVstHatch> selectHatchInfoList(@BizRequestPm(key = "body.vesselStructGkey", nullable = false, desc = "船舶结构主键") String vesselStructGkey) throws Exception {
+        // 查询舱位信息
+        List<AlgVstHatch> algVstHatchList = redisUtil.getByPrefix(AlgVstHatchKey + vesselStructGkey + ":*") as List<AlgVstHatch>
+        // 舱位排序
+        algVstHatchList.sort(new Comparator<AlgVstHatch>() {
+            @Override
+            int compare(AlgVstHatch o1, AlgVstHatch o2) {
+                return ((Double) o1.getStartPosM()).compareTo((Double) o2.getStartPosM());
+            }
+        });
+        // 倍位号排序
+        for (AlgVstHatch hatchInfo : algVstHatchList) {
+            List<String> bayNoList = new ArrayList<>(hatchInfo.getBayNos())
+            Collections.sort(bayNoList);
+            hatchInfo.setBayNos(bayNoList as Set<String>);
+            // 倍位信息排序
+            for (AlgVstBay bayInfo : hatchInfo.getBayInfos()) {
+                // 层号排序
+                List<String> tierNoList = new ArrayList<>(bayInfo.getTierNos())
+                Collections.sort(tierNoList);
+                bayInfo.setTierNos(new HashSet<String>(tierNoList));
+            }
+        }
+        return algVstHatchList
+    }
+
+    @BizApiMethod(matchedApis = ThreeConstant.BIZ_API_NAME, desc = "查询舱位所有倍位信息,根据船舶结构主键、舱位主键查询")
+    @Doc4MethodRes(key = "result", desc = "倍位信息", refClasses = AlgVstBay.class)
+    List<AlgVstBay> selectBayInfoList(@BizRequestPm(key = "body.vesselStructGkey", nullable = false, desc = "船舶结构主键") String vesselStructGkey,
+                                      @BizRequestPm(key = "body.hatchGkey", nullable = false, desc = "舱位主键,多个用英文逗号隔开") String hatchGkey) throws Exception {
+        String[] hatchGkeys = hatchGkey.split(",")
+        // 查询舱位信息
+        Set<String> keys = new HashSet<>()
+        for (String hatchGkeyTmp : hatchGkeys) {
+            keys.add(AlgVstHatchKey + vesselStructGkey + ":" + hatchGkeyTmp)
+        }
+        List<AlgVstHatch> algVstHatchList = redisUtil.getMulti(keys) as List<AlgVstHatch>
+        // 查询倍位信息
+        Set<String> bayKeys = new HashSet<>()
+        for (AlgVstHatch algVstHatch : algVstHatchList) {
+            for (AlgVstBay bayInfo : algVstHatch.getBayInfos()) {
+                bayKeys.add(AlgVstBayKey + vesselStructGkey + ":" + bayInfo.getGkey())
+            }
+        }
+        List<AlgVstBay> algVstBayList = redisUtil.getMulti(bayKeys) as List<AlgVstBay>
+        // 倍位信息排序
+        for (AlgVstBay bayInfo : algVstBayList) {
+            // 层号排序
+            List<String> tierNoList = new ArrayList<>(bayInfo.getTierNos())
+            Collections.sort(tierNoList);
+            bayInfo.setTierNos(new LinkedHashSet<>(tierNoList));
+            // 排信息排序
+            List<AlgVstRow> rowInfoList = bayInfo.getRows()
+            rowInfoList.sort(new Comparator<AlgVstRow>() {
+                @Override
+                int compare(AlgVstRow o1, AlgVstRow o2) {
+                    return ((Integer) o1.getSeq()).compareTo((Integer) o2.getSeq())
+                }
+            })
+            // 排号顺序
+            Set<String> rowNos = new LinkedHashSet<>();
+            for (AlgVstRow rowInfo : rowInfoList) {
+                rowNos.add(rowInfo.getNo())
+            }
+            bayInfo.setRowNos(rowNos)
+        }
+        // 倍信息排序
+        algVstBayList.sort(new Comparator<AlgVstBay>() {
+            @Override
+            int compare(AlgVstBay o1, AlgVstBay o2) {
+                return o1.getNo().compareTo(o2.getNo())
+            }
+        })
+        return algVstBayList
+    }
+}

File diff suppressed because it is too large
+ 53 - 0
src/main/java/com/ecnu/platform/port/VstHatchCoverService.groovy


Some files were not shown because too many files changed in this diff