|
@@ -1,6 +1,7 @@
|
|
|
package com.ecnu.platform.cwp
|
|
|
|
|
|
-import com.ecnu.alg.pojo.port.data.AlgCwpImportData
|
|
|
+import com.ecnu.alg.pojo.port.datas.AlgCwpInputData
|
|
|
+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,13 +41,22 @@ 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;
|
|
|
|
|
|
@BizApiMethod(matchedApis = ThreeConstant.BIZ_API_NAME, desc = "导入CWP算法数据")
|
|
|
- @Doc4MethodRes(key = "result", desc = "底图信息", refClasses = AlgCwpImportData.class)
|
|
|
- AlgCwpImportData importData(Map<String, Object> map) throws Exception {
|
|
|
- AlgCwpImportData algCwpImportData = new AlgCwpImportData();
|
|
|
+ @Doc4MethodRes(key = "result", desc = "底图信息", refClasses = AlgCwpInputData.class)
|
|
|
+ AlgCwpInputData importData(Map<String, Object> map) throws Exception {
|
|
|
+ AlgCwpInputData algCwpInputData = new AlgCwpInputData();
|
|
|
+ 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);
|
|
@@ -55,14 +65,30 @@ class CwpDataService {
|
|
|
AlgVesselVisit algVesselVisit = new AlgVesselVisit()
|
|
|
algVesselVisit.setVesselVisitId(smartScheduleIdInfo.get("berthId") as String)
|
|
|
algVesselVisit.setVesselCode(smartScheduleIdInfo.get("vesselCode") as String)
|
|
|
+ algVesselVisit.setVesselName(smartScheduleIdInfo.get("vesselCode") as String)
|
|
|
algVesselVisit.setVesselType(smartScheduleIdInfo.get("vesselType") as String)
|
|
|
algVesselVisit.setPlanStartWorkTime(sdf.parse(smartScheduleIdInfo.get("planBeginWorkTime") as String))
|
|
|
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)
|
|
|
+ algCwpInputData.getAlgVesselVisitList().add(algVesselVisit)
|
|
|
vesselVisitId = algVesselVisit.getVesselVisitId();
|
|
|
}
|
|
|
// 解析桥机信息
|
|
@@ -81,7 +107,7 @@ class CwpDataService {
|
|
|
algCraneBase.setDschMph(smartCraneBaseInfo.get("unLoadEfficiency40") as Integer)
|
|
|
algCraneBase.setTandemFlag(smartCraneBaseInfo.get("tandemFlag") as String)
|
|
|
redisUtil.set(AlgCraneBaseKey + algCraneBase.getCraneId(), algCraneBase)
|
|
|
- algCwpImportData.getAlgCraneBaseList().add(algCraneBase)
|
|
|
+ algCwpInputData.getAlgCraneBaseList().add(algCraneBase)
|
|
|
}
|
|
|
// 解析作业工艺设置信息
|
|
|
List<Map> smartCraneWorkFlowInfoList = map.get("smartCraneWorkFlowInfoList") as List<Map>
|
|
@@ -95,7 +121,7 @@ class CwpDataService {
|
|
|
algWorkFlow.setTandem(smartCraneWorkFlowInfo.get("tandem") == true ? "Y" : "N")
|
|
|
algWorkFlow.setLdStrategy(smartCraneWorkFlowInfo.get("ldStrategy") as String)
|
|
|
redisUtil.set(AlgWorkFlowKey + algWorkFlow.getVesselVisitId() + ":" + algWorkFlow.getHatchGkey(), algWorkFlow)
|
|
|
- algCwpImportData.getAlgWorkFlowList().add(algWorkFlow)
|
|
|
+ algCwpInputData.getAlgWorkFlowList().add(algWorkFlow)
|
|
|
}
|
|
|
// 船舶结构相关
|
|
|
// 解析舱位信息
|
|
@@ -113,7 +139,7 @@ class CwpDataService {
|
|
|
algVstHatch.setType("H")
|
|
|
algVstHatch.setGapM(1.0)
|
|
|
algVstHatchMap.put(algVstHatch.getGkey(), algVstHatch)
|
|
|
- algCwpImportData.getAlgVstHatchList().add(algVstHatch)
|
|
|
+ algCwpInputData.getAlgVstHatchList().add(algVstHatch)
|
|
|
}
|
|
|
// 解析倍位信息
|
|
|
Map<String, AlgVstBay> algVstBayMap = new HashMap<>()
|
|
@@ -130,7 +156,7 @@ class CwpDataService {
|
|
|
if (algVstHatch != null) {
|
|
|
algVstHatch.getBayNos().add(algVstBay.getNo())
|
|
|
algVstHatch.getBayInfos().add(algVstBay)
|
|
|
- algCwpImportData.getAlgVstBayList().add(algVstBay)
|
|
|
+ algCwpInputData.getAlgVstBayList().add(algVstBay)
|
|
|
}
|
|
|
}
|
|
|
// 解析排信息
|
|
@@ -209,10 +235,10 @@ class CwpDataService {
|
|
|
}
|
|
|
}
|
|
|
// 存入缓存
|
|
|
- for (AlgVstBay algVstBay : algCwpImportData.getAlgVstBayList()) {
|
|
|
+ for (AlgVstBay algVstBay : algCwpInputData.getAlgVstBayList()) {
|
|
|
redisUtil.set(AlgVstBayKey + algVstBay.getVesselStructGkey() + ":" + algVstBay.getGkey(), algVstBay)
|
|
|
}
|
|
|
- for (AlgVstHatch algVstHatch : algCwpImportData.getAlgVstHatchList()) {
|
|
|
+ for (AlgVstHatch algVstHatch : algCwpInputData.getAlgVstHatchList()) {
|
|
|
List<AlgVstBay> bayInfos = new ArrayList<>()
|
|
|
for (AlgVstBay algVstBay : algVstHatch.getBayInfos()) {
|
|
|
AlgVstBay algVstBay1 = new AlgVstBay()
|
|
@@ -225,6 +251,7 @@ class CwpDataService {
|
|
|
algVstBay1.setRowNos(algVstBay.getRowNos())
|
|
|
bayInfos.add(algVstBay1)
|
|
|
}
|
|
|
+ algVstHatch.setBayInfos(bayInfos)
|
|
|
redisUtil.set(AlgVstHatchKey + algVstHatch.getVesselStructGkey() + ":" + algVstHatch.getGkey(), algVstHatch)
|
|
|
}
|
|
|
// 解析舱盖板信息
|
|
@@ -233,8 +260,6 @@ class CwpDataService {
|
|
|
AlgVstHatchCover algVstHatchCover = new AlgVstHatchCover()
|
|
|
algVstHatchCover.setGkey(smartVpsVslHatchcoversInfo.get("hatchCoverId") as String)
|
|
|
algVstHatchCover.setVesselStructGkey(smartVpsVslHatchcoversInfo.get("vesselCode") as String)
|
|
|
- algVstHatchCover.setHatchCoverId(smartVpsVslHatchcoversInfo.get("hatchCoverId") as String)
|
|
|
- algVstHatchCover.setHatchCoverNo(smartVpsVslHatchcoversInfo.get("hatchCoverNo") as String)
|
|
|
algVstHatchCover.setOpenSeq(smartVpsVslHatchcoversInfo.get("openSeq") as Integer)
|
|
|
// 查询倍位信息
|
|
|
Set<String> bayNos = new HashSet<>()
|
|
@@ -254,7 +279,7 @@ class CwpDataService {
|
|
|
algVstHatchCover.setDeckToRowNo(smartVpsVslHatchcoversInfo.get("deckToRowNo") as String)
|
|
|
algVstHatchCover.setWeightMt(smartVpsVslHatchcoversInfo.get("weight") as Double)
|
|
|
redisUtil.set(AlgVstHatchCoverKey + algVstHatchCover.getVesselStructGkey() + ":" + algVstHatchCover.getGkey(), algVstHatchCover)
|
|
|
- algCwpImportData.getAlgVstHatchCoverList().add(algVstHatchCover)
|
|
|
+ algCwpInputData.getAlgVstHatchCoverList().add(algVstHatchCover)
|
|
|
}
|
|
|
// 解析桥机池信息
|
|
|
String poolId = null
|
|
@@ -272,11 +297,11 @@ class CwpDataService {
|
|
|
AlgCranePool algCranePool = new AlgCranePool()
|
|
|
algCranePool.setVesselVisitId(vesselVisitId)
|
|
|
algCranePool.setCraneId(smartCranePoolInfo.get("craneNo") as String)
|
|
|
- algCwpImportData.getAlgCranePoolList().add(algCranePool)
|
|
|
+ algCwpInputData.getAlgCranePoolList().add(algCranePool)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- redisUtil.set(AlgCranePoolKey + vesselVisitId, algCwpImportData.getAlgCranePoolList())
|
|
|
+ redisUtil.set(AlgCranePoolKey + vesselVisitId, algCwpInputData.getAlgCranePoolList())
|
|
|
// 解析预配/积载信息
|
|
|
Map<String, List<AlgStowDetail>> algStowDetailListMap = new HashMap<>()
|
|
|
List<Map> smartVesselContainerInfoList = map.get("smartVesselContainerInfoList") as List<Map>
|
|
@@ -351,7 +376,7 @@ class CwpDataService {
|
|
|
algStowDetail.setUgIsHazardous(0)
|
|
|
}
|
|
|
algStowDetail.setTotalWeightKg(smartVesselContainerInfo.get("weight") as Double)
|
|
|
- algCwpImportData.getAlgStowDetailList().add(algStowDetail)
|
|
|
+ algCwpInputData.getAlgStowDetailList().add(algStowDetail)
|
|
|
algStowDetailListMap.putIfAbsent(algStowDetail.getVesselVisitId(), new ArrayList<AlgStowDetail>())
|
|
|
algStowDetailListMap.get(algStowDetail.getVesselVisitId()).add(algStowDetail)
|
|
|
}
|
|
@@ -360,6 +385,47 @@ class CwpDataService {
|
|
|
}
|
|
|
// 解析属性组信息
|
|
|
|
|
|
- return algCwpImportData
|
|
|
+ return algCwpInputData
|
|
|
+ }
|
|
|
+
|
|
|
+ @BizApiMethod(matchedApis = ThreeConstant.BIZ_API_NAME, desc = "查询CWP输入数据")
|
|
|
+ AlgCwpInputData queryAll(@BizRequestPm(key = "id", nullable = false, desc = "船舶航次主键,多个用英文逗号隔开") String id) throws Exception {
|
|
|
+ AlgCwpInputData algCwpInputData = new AlgCwpInputData();
|
|
|
+ // 查询船期信息
|
|
|
+ String[] ids = id.split(",");
|
|
|
+ for (String vesselVisitId : ids) {
|
|
|
+ AlgVesselVisit algVesselVisit = redisUtil.get(AlgVesselVisitKey + vesselVisitId) as AlgVesselVisit
|
|
|
+ algCwpInputData.getAlgVesselVisitList().add(algVesselVisit)
|
|
|
+ }
|
|
|
+ // 查询桥机信息
|
|
|
+ List<AlgCraneBase> algCraneBaseList = redisUtil.getByPrefix(AlgCraneBaseKey + "*") as List<AlgCraneBase>
|
|
|
+ algCwpInputData.setAlgCraneBaseList(algCraneBaseList)
|
|
|
+ // 查询作业桥机信息
|
|
|
+ for (String vesselVisitId : ids) {
|
|
|
+ List<AlgCranePool> algCranePoolList = redisUtil.get(AlgCranePoolKey + vesselVisitId) as List<AlgCranePool>
|
|
|
+ algCwpInputData.getAlgCranePoolList().addAll(algCranePoolList)
|
|
|
+ }
|
|
|
+ // 查询预配、积载信息
|
|
|
+ for (String vesselVisitId : ids) {
|
|
|
+ List<AlgStowDetail> algStowDetailList = redisUtil.get(AlgStowDetailKey + vesselVisitId) as List<AlgStowDetail>
|
|
|
+ algCwpInputData.getAlgStowDetailList().addAll(algStowDetailList)
|
|
|
+ }
|
|
|
+ // 查询船舶结构
|
|
|
+ // 查询倍位
|
|
|
+ for (AlgVesselVisit algVesselVisit : algCwpInputData.getAlgVesselVisitList()) {
|
|
|
+ List<AlgVstBay> algVstBayList = redisUtil.getByPrefix(AlgVstBayKey + algVesselVisit.getVesselCode() + ":*") as List<AlgVstBay>
|
|
|
+ algCwpInputData.getAlgVstBayList().addAll(algVstBayList)
|
|
|
+ }
|
|
|
+ // 查询舱位
|
|
|
+ for (AlgVesselVisit algVesselVisit : algCwpInputData.getAlgVesselVisitList()) {
|
|
|
+ List<AlgVstHatch> algVstHatchList = redisUtil.getByPrefix(AlgVstHatchKey + algVesselVisit.getVesselCode() + ":*") as List<AlgVstHatch>
|
|
|
+ algCwpInputData.getAlgVstHatchList().addAll(algVstHatchList)
|
|
|
+ }
|
|
|
+ // 查询舱盖板
|
|
|
+ for (AlgVesselVisit algVesselVisit : algCwpInputData.getAlgVesselVisitList()) {
|
|
|
+ List<AlgVstHatchCover> algVstHatchCoverList = redisUtil.getByPrefix(AlgVstHatchCoverKey + algVesselVisit.getVesselCode() + ":*") as List<AlgVstHatchCover>
|
|
|
+ algCwpInputData.getAlgVstHatchCoverList().addAll(algVstHatchCoverList)
|
|
|
+ }
|
|
|
+ return algCwpInputData
|
|
|
}
|
|
|
}
|