|
@@ -21,6 +21,7 @@ import java.time.Duration;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -90,230 +91,236 @@ public class BoatPollutionWarningServiceImpl extends ServiceImpl<BoatPollutionWa
|
|
|
log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.dictDistrictPortList==========");
|
|
|
List<DictDistrictPort> dictDistrictPortList = dictDistrictPortService.getDictDistrictPortList();
|
|
|
Map<String, List<BoatAISVO>> boatAISVOMap = boatAISList.stream().collect(Collectors.groupingBy(BoatAISVO::getDeviceId));
|
|
|
- boatAISVOMap.forEach((k, v) -> {
|
|
|
- //查询船舶最近监管记录
|
|
|
- List<BoatPollutionSupervision> bpsList = boatPollutionSupervisionList.stream().filter(x -> x.getMmsi().equals(k) && x.getSupervisionState().equals(SupervisionStateEnum.SUPERVISING.getStatusCode())).sorted(Comparator.comparing(BoatPollutionSupervision::getCreatedTime).reversed()).collect(Collectors.toList());
|
|
|
- LocalDateTime gpsTime = LocalDateTimeUtil.parse(v.get(0).getGpsTime());
|
|
|
- //进出港申报记录
|
|
|
- LambdaQueryWrapper<CCbShipEepReportRec> cCbShipEepReportRecLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- if (v.get(0).getShipId() != null) {
|
|
|
- cCbShipEepReportRecLambdaQueryWrapper.eq(CCbShipEepReportRec::getShipId, v.get(0).getShipId())
|
|
|
- .le(CCbShipEepReportRec::getReportTime, gpsTime)
|
|
|
- .ge(CCbShipEepReportRec::getReportTime, gpsTime.minusDays(20))
|
|
|
- .likeRight(CCbShipEepReportRec::getOrgCode, "29")
|
|
|
- .orderByDesc(CCbShipEepReportRec::getReportTime);
|
|
|
- } else if (v.get(0).getDeviceId() != null) {
|
|
|
- cCbShipEepReportRecLambdaQueryWrapper.eq(CCbShipEepReportRec::getMmsi, v.get(0).getDeviceId())
|
|
|
- .le(CCbShipEepReportRec::getReportTime, gpsTime)
|
|
|
- .ge(CCbShipEepReportRec::getReportTime, gpsTime.minusDays(20))
|
|
|
- .likeRight(CCbShipEepReportRec::getOrgCode, "29")
|
|
|
- .orderByDesc(CCbShipEepReportRec::getReportTime);
|
|
|
- } else {
|
|
|
- cCbShipEepReportRecLambdaQueryWrapper.eq(CCbShipEepReportRec::getShipNameCn, v.get(0).getShipName())
|
|
|
- .le(CCbShipEepReportRec::getReportTime, gpsTime)
|
|
|
- .ge(CCbShipEepReportRec::getReportTime, gpsTime.minusDays(20))
|
|
|
- .likeRight(CCbShipEepReportRec::getOrgCode, "29")
|
|
|
- .orderByDesc(CCbShipEepReportRec::getReportTime);
|
|
|
- }
|
|
|
- List<CCbShipEepReportRec> ccbShipEepReportRecList = ccbShipEepReportRecService.list(cCbShipEepReportRecLambdaQueryWrapper);
|
|
|
- if (!bpsList.isEmpty()) {
|
|
|
- BoatPollutionSupervision bps = bpsList.get(0);
|
|
|
- if (bps.getHasWarning().equals(HasWarningEnum.HAS.getStatusCode())) {
|
|
|
- //有预警
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.Warning.start==========");
|
|
|
- BoatPollutionWarning boatPollutionWarning = this.getOne(new QueryWrapper<BoatPollutionWarning>().lambda().eq(BoatPollutionWarning::getSupervisionCode, bps.getCode()));
|
|
|
- if (boatPollutionWarning.getFilterState().equals(FilterStateEnum.UNDISPOSED.getStatusCode())) {
|
|
|
- if (gpsTime.isAfter(boatPollutionWarning.getWarningTime().plusDays(5))) {
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.Warning.overBoatPollutionWarning.undisposed.removeWarning==========");
|
|
|
- boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
- .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
- this.remove(new QueryWrapper<BoatPollutionWarning>().lambda().eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()));
|
|
|
- }
|
|
|
- } else if (boatPollutionWarning.getFilterState().equals(FilterStateEnum.CONFIRM.getStatusCode())) {
|
|
|
- //查询排放物
|
|
|
- LambdaQueryWrapper<BoatWaterPollutantAcceptF> boatWaterPollutantAcceptFLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- if (v.get(0).getShipName() != null) {
|
|
|
- boatWaterPollutantAcceptFLambdaQueryWrapper.eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getDeviceId())
|
|
|
- .eq(BoatWaterPollutantAcceptF::getShipName, v.get(0).getShipName())
|
|
|
- .eq(BoatWaterPollutantAcceptF::getSewageType, SewageTypeEnum.SEWAGE.getType())
|
|
|
- .ge(BoatWaterPollutantAcceptF::getFirstDtm, bps.getStartTime())
|
|
|
- .le(BoatWaterPollutantAcceptF::getFirstDtm, boatPollutionWarning.getWarningTime().plusDays(5).isAfter(gpsTime) ? gpsTime : boatPollutionWarning.getWarningTime().plusDays(5))
|
|
|
- .orderByDesc(BoatWaterPollutantAcceptF::getFirstDtm);
|
|
|
+ List<Map<String, List<BoatAISVO>>> boatAISVOMaplist = splitMap(boatAISVOMap, 50);
|
|
|
+ boatAISVOMaplist.forEach(subBoatAISVOMap -> CompletableFuture.runAsync(() -> {
|
|
|
+ {
|
|
|
+ boatAISVOMap.forEach((k, v) -> {
|
|
|
+ //查询船舶最近监管记录
|
|
|
+ List<BoatPollutionSupervision> bpsList = boatPollutionSupervisionList.stream().filter(x -> x.getMmsi().equals(k) && x.getSupervisionState().equals(SupervisionStateEnum.SUPERVISING.getStatusCode())).sorted(Comparator.comparing(BoatPollutionSupervision::getCreatedTime).reversed()).collect(Collectors.toList());
|
|
|
+ LocalDateTime gpsTime = LocalDateTimeUtil.parse(v.get(0).getGpsTime());
|
|
|
+ //进出港申报记录
|
|
|
+ LambdaQueryWrapper<CCbShipEepReportRec> cCbShipEepReportRecLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ if (v.get(0).getShipId() != null) {
|
|
|
+ cCbShipEepReportRecLambdaQueryWrapper.eq(CCbShipEepReportRec::getShipId, v.get(0).getShipId())
|
|
|
+ .le(CCbShipEepReportRec::getReportTime, gpsTime)
|
|
|
+ .ge(CCbShipEepReportRec::getReportTime, gpsTime.minusDays(20))
|
|
|
+ .likeRight(CCbShipEepReportRec::getOrgCode, "29")
|
|
|
+ .orderByDesc(CCbShipEepReportRec::getReportTime);
|
|
|
+ } else if (v.get(0).getDeviceId() != null) {
|
|
|
+ cCbShipEepReportRecLambdaQueryWrapper.eq(CCbShipEepReportRec::getMmsi, v.get(0).getDeviceId())
|
|
|
+ .le(CCbShipEepReportRec::getReportTime, gpsTime)
|
|
|
+ .ge(CCbShipEepReportRec::getReportTime, gpsTime.minusDays(20))
|
|
|
+ .likeRight(CCbShipEepReportRec::getOrgCode, "29")
|
|
|
+ .orderByDesc(CCbShipEepReportRec::getReportTime);
|
|
|
+ } else {
|
|
|
+ cCbShipEepReportRecLambdaQueryWrapper.eq(CCbShipEepReportRec::getShipNameCn, v.get(0).getShipName())
|
|
|
+ .le(CCbShipEepReportRec::getReportTime, gpsTime)
|
|
|
+ .ge(CCbShipEepReportRec::getReportTime, gpsTime.minusDays(20))
|
|
|
+ .likeRight(CCbShipEepReportRec::getOrgCode, "29")
|
|
|
+ .orderByDesc(CCbShipEepReportRec::getReportTime);
|
|
|
+ }
|
|
|
+ List<CCbShipEepReportRec> ccbShipEepReportRecList = ccbShipEepReportRecService.list(cCbShipEepReportRecLambdaQueryWrapper);
|
|
|
+ if (!bpsList.isEmpty()) {
|
|
|
+ BoatPollutionSupervision bps = bpsList.get(0);
|
|
|
+ if (bps.getHasWarning().equals(HasWarningEnum.HAS.getStatusCode())) {
|
|
|
+ //有预警
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.Warning.start==========");
|
|
|
+ BoatPollutionWarning boatPollutionWarning = this.getOne(new QueryWrapper<BoatPollutionWarning>().lambda().eq(BoatPollutionWarning::getSupervisionCode, bps.getCode()));
|
|
|
+ if (boatPollutionWarning.getFilterState().equals(FilterStateEnum.UNDISPOSED.getStatusCode())) {
|
|
|
+ if (gpsTime.isAfter(boatPollutionWarning.getWarningTime().plusDays(5))) {
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.Warning.overBoatPollutionWarning.undisposed.removeWarning==========");
|
|
|
+ boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
+ .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
+ this.remove(new QueryWrapper<BoatPollutionWarning>().lambda().eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()));
|
|
|
+ }
|
|
|
+ } else if (boatPollutionWarning.getFilterState().equals(FilterStateEnum.CONFIRM.getStatusCode())) {
|
|
|
+ //查询排放物
|
|
|
+ LambdaQueryWrapper<BoatWaterPollutantAcceptF> boatWaterPollutantAcceptFLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ if (v.get(0).getShipName() != null) {
|
|
|
+ boatWaterPollutantAcceptFLambdaQueryWrapper.eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getDeviceId())
|
|
|
+ .eq(BoatWaterPollutantAcceptF::getShipName, v.get(0).getShipName())
|
|
|
+ .eq(BoatWaterPollutantAcceptF::getSewageType, SewageTypeEnum.SEWAGE.getType())
|
|
|
+ .ge(BoatWaterPollutantAcceptF::getFirstDtm, bps.getStartTime())
|
|
|
+ .le(BoatWaterPollutantAcceptF::getFirstDtm, boatPollutionWarning.getWarningTime().plusDays(5).isAfter(gpsTime) ? gpsTime : boatPollutionWarning.getWarningTime().plusDays(5))
|
|
|
+ .orderByDesc(BoatWaterPollutantAcceptF::getFirstDtm);
|
|
|
+ } else {
|
|
|
+ boatWaterPollutantAcceptFLambdaQueryWrapper.eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getDeviceId())
|
|
|
+ .eq(BoatWaterPollutantAcceptF::getSewageType, SewageTypeEnum.SEWAGE.getType())
|
|
|
+ .ge(BoatWaterPollutantAcceptF::getFirstDtm, bps.getStartTime())
|
|
|
+ .le(BoatWaterPollutantAcceptF::getFirstDtm, boatPollutionWarning.getWarningTime().plusDays(5).isAfter(gpsTime) ? gpsTime : boatPollutionWarning.getWarningTime().plusDays(5))
|
|
|
+ .orderByDesc(BoatWaterPollutantAcceptF::getFirstDtm);
|
|
|
+ }
|
|
|
+ List<BoatWaterPollutantAcceptF> boatWaterPollutantAcceptFList = boatWaterPollutantAcceptFService.list(boatWaterPollutantAcceptFLambdaQueryWrapper);
|
|
|
+ if (gpsTime.isAfter(boatPollutionWarning.getWarningTime().plusDays(5))) {
|
|
|
+ if (!boatWaterPollutantAcceptFList.isEmpty()) {
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.Warning.overBoatPollutionWarning.releive.Y5.pollutant_release==========");
|
|
|
+ boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
+ .set(BoatPollutionSupervision::getLastOilsewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.OILSEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastSewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.SEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastToxicliquidTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.TOXICLIQUID.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastBadoilTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.BADOIL.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastRubbishTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.RUBBISH.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
+ this.lambdaUpdate()
|
|
|
+ .set(BoatPollutionWarning::getWarningState, WarningStateEnum.WANNING_RELIEVE.getStatusCode())
|
|
|
+ .set(BoatPollutionWarning::getRelieveTime, gpsTime)
|
|
|
+ .set(BoatPollutionWarning::getRelieveType, RelieveTypeEnum.POLLUTANT_RELEASE.getStatusCode())
|
|
|
+ .eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()).update(new BoatPollutionWarning());
|
|
|
+ } else {
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.Warning.overBoatPollutionWarning.releive.Y5.warning_exceed==========");
|
|
|
+ boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
+ .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
+ this.lambdaUpdate()
|
|
|
+ .set(BoatPollutionWarning::getWarningState, WarningStateEnum.WANNING_RELIEVE.getStatusCode())
|
|
|
+ .set(BoatPollutionWarning::getRelieveTime, gpsTime)
|
|
|
+ .set(BoatPollutionWarning::getRelieveType, RelieveTypeEnum.WARNING_EXCEED.getStatusCode())
|
|
|
+ .eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()).update(new BoatPollutionWarning());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!boatWaterPollutantAcceptFList.isEmpty()) {
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.Warning.overBoatPollutionWarning.releive.N5.pollutant_release==========");
|
|
|
+ boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
+ .set(BoatPollutionSupervision::getLastOilsewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.OILSEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastSewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.SEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastToxicliquidTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.TOXICLIQUID.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastBadoilTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.BADOIL.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastRubbishTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.RUBBISH.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
+ this.lambdaUpdate()
|
|
|
+ .set(BoatPollutionWarning::getWarningState, WarningStateEnum.WANNING_RELIEVE.getStatusCode())
|
|
|
+ .set(BoatPollutionWarning::getRelieveTime, gpsTime)
|
|
|
+ .set(BoatPollutionWarning::getRelieveType, RelieveTypeEnum.POLLUTANT_RELEASE.getStatusCode())
|
|
|
+ .eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()).update(new BoatPollutionWarning());
|
|
|
+ } else {
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.Warning.overBoatPollutionWarning.releive.N5.updateBoatPollutionSupervision==========");
|
|
|
+ boatPollutionSupervisionService.lambdaUpdate()
|
|
|
+ .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
+ .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (boatPollutionWarning.getFilterState().equals(FilterStateEnum.CANCEL.getStatusCode())) {
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.Warning.overBoatPollutionWarning.cancel.removeWarning==========");
|
|
|
+ this.remove(new QueryWrapper<BoatPollutionWarning>().lambda().eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()));
|
|
|
+ }
|
|
|
} else {
|
|
|
- boatWaterPollutantAcceptFLambdaQueryWrapper.eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getDeviceId())
|
|
|
- .eq(BoatWaterPollutantAcceptF::getSewageType, SewageTypeEnum.SEWAGE.getType())
|
|
|
- .ge(BoatWaterPollutantAcceptF::getFirstDtm, bps.getStartTime())
|
|
|
- .le(BoatWaterPollutantAcceptF::getFirstDtm, boatPollutionWarning.getWarningTime().plusDays(5).isAfter(gpsTime) ? gpsTime : boatPollutionWarning.getWarningTime().plusDays(5))
|
|
|
- .orderByDesc(BoatWaterPollutantAcceptF::getFirstDtm);
|
|
|
- }
|
|
|
- List<BoatWaterPollutantAcceptF> boatWaterPollutantAcceptFList = boatWaterPollutantAcceptFService.list(boatWaterPollutantAcceptFLambdaQueryWrapper);
|
|
|
- if (gpsTime.isAfter(boatPollutionWarning.getWarningTime().plusDays(5))) {
|
|
|
- if (!boatWaterPollutantAcceptFList.isEmpty()) {
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.Warning.overBoatPollutionWarning.releive.Y5.pollutant_release==========");
|
|
|
- boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
- .set(BoatPollutionSupervision::getLastOilsewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.OILSEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastSewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.SEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastToxicliquidTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.TOXICLIQUID.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastBadoilTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.BADOIL.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastRubbishTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.RUBBISH.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
- this.lambdaUpdate()
|
|
|
- .set(BoatPollutionWarning::getWarningState, WarningStateEnum.WANNING_RELIEVE.getStatusCode())
|
|
|
- .set(BoatPollutionWarning::getRelieveTime, gpsTime)
|
|
|
- .set(BoatPollutionWarning::getRelieveType, RelieveTypeEnum.POLLUTANT_RELEASE.getStatusCode())
|
|
|
- .eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()).update(new BoatPollutionWarning());
|
|
|
+ //无预警
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.noneWarning.start==========");
|
|
|
+ //查询排放物
|
|
|
+ LambdaQueryWrapper<BoatWaterPollutantAcceptF> boatWaterPollutantAcceptFLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ if (v.get(0).getShipName() != null) {
|
|
|
+ boatWaterPollutantAcceptFLambdaQueryWrapper.eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getDeviceId())
|
|
|
+ .eq(BoatWaterPollutantAcceptF::getShipName, v.get(0).getShipName())
|
|
|
+ .eq(BoatWaterPollutantAcceptF::getSewageType, SewageTypeEnum.SEWAGE.getType())
|
|
|
+ .ge(BoatWaterPollutantAcceptF::getFirstDtm, bps.getStartTime())
|
|
|
+ .le(BoatWaterPollutantAcceptF::getFirstDtm, bps.getPredictwarnSwTime().isAfter(gpsTime) ? gpsTime : bps.getPredictwarnSwTime())
|
|
|
+ .orderByDesc(BoatWaterPollutantAcceptF::getFirstDtm);
|
|
|
} else {
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.Warning.overBoatPollutionWarning.releive.Y5.warning_exceed==========");
|
|
|
- boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
- .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
- this.lambdaUpdate()
|
|
|
- .set(BoatPollutionWarning::getWarningState, WarningStateEnum.WANNING_RELIEVE.getStatusCode())
|
|
|
- .set(BoatPollutionWarning::getRelieveTime, gpsTime)
|
|
|
- .set(BoatPollutionWarning::getRelieveType, RelieveTypeEnum.WARNING_EXCEED.getStatusCode())
|
|
|
- .eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()).update(new BoatPollutionWarning());
|
|
|
+ boatWaterPollutantAcceptFLambdaQueryWrapper.eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getDeviceId())
|
|
|
+ .eq(BoatWaterPollutantAcceptF::getSewageType, SewageTypeEnum.SEWAGE.getType())
|
|
|
+ .ge(BoatWaterPollutantAcceptF::getFirstDtm, bps.getStartTime())
|
|
|
+ .le(BoatWaterPollutantAcceptF::getFirstDtm, bps.getPredictwarnSwTime().isAfter(gpsTime) ? gpsTime : bps.getPredictwarnSwTime())
|
|
|
+ .orderByDesc(BoatWaterPollutantAcceptF::getFirstDtm);
|
|
|
}
|
|
|
- } else {
|
|
|
- if (!boatWaterPollutantAcceptFList.isEmpty()) {
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.Warning.overBoatPollutionWarning.releive.N5.pollutant_release==========");
|
|
|
- boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
- .set(BoatPollutionSupervision::getLastOilsewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.OILSEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastSewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.SEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastToxicliquidTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.TOXICLIQUID.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastBadoilTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.BADOIL.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastRubbishTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.RUBBISH.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
- this.lambdaUpdate()
|
|
|
- .set(BoatPollutionWarning::getWarningState, WarningStateEnum.WANNING_RELIEVE.getStatusCode())
|
|
|
- .set(BoatPollutionWarning::getRelieveTime, gpsTime)
|
|
|
- .set(BoatPollutionWarning::getRelieveType, RelieveTypeEnum.POLLUTANT_RELEASE.getStatusCode())
|
|
|
- .eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()).update(new BoatPollutionWarning());
|
|
|
+ List<BoatWaterPollutantAcceptF> boatWaterPollutantAcceptFList = boatWaterPollutantAcceptFService.list(boatWaterPollutantAcceptFLambdaQueryWrapper);
|
|
|
+ //查询是否到监控周期内的第五天
|
|
|
+ if (gpsTime.isAfter(bps.getStartTime().plusDays(5))) {
|
|
|
+ //是否有排放记录
|
|
|
+ if (!boatWaterPollutantAcceptFList.isEmpty()) {
|
|
|
+ //结束监管
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.noneWarning.overBoatPollutionWarning==========");
|
|
|
+ boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
+ .set(BoatPollutionSupervision::getLastOilsewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.OILSEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastSewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.SEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastToxicliquidTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.TOXICLIQUID.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastBadoilTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.BADOIL.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastRubbishTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.RUBBISH.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
+ } else {
|
|
|
+ //生成预警
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.generateBoatPollutionWarning==========");
|
|
|
+ boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getHasWarning, HasWarningEnum.HAS.getStatusCode())
|
|
|
+ .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getWarningCount, bps.getWarningCount() + 1)
|
|
|
+ .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
+ BoatPollutionWarning boatPollutionWarningItem = new BoatPollutionWarning();
|
|
|
+ boatPollutionWarningItem.setCode(serialService.getCusNumber("bpw"));
|
|
|
+ boatPollutionWarningItem.setSupervisionCode(bps.getCode());
|
|
|
+ boatPollutionWarningItem.setBoatName(bps.getBoatName());
|
|
|
+ boatPollutionWarningItem.setMmsi(bps.getMmsi());
|
|
|
+ boatPollutionWarningItem.setType(SewageTypeEnum.SEWAGE.getType());
|
|
|
+ boatPollutionWarningItem.setWarningTime(gpsTime);
|
|
|
+ boatPollutionWarningItem.setReportCode(ccbShipEepReportRecList.get(0).getReportNo());
|
|
|
+ boatPollutionWarningItem.setWarningState(WarningStateEnum.WANNING.getStatusCode());
|
|
|
+ boatPollutionWarningItem.setIsRead(IsReadEnum.UNREAD.getStatusCode());
|
|
|
+ boatPollutionWarningItem.setDistrict(this.getDistinct(ccbShipEepReportRecList.get(0), dictDistrictPortList));
|
|
|
+ boatPollutionWarningItem.setBerthName(ccbShipEepReportRecList.get(0).getBerthName());
|
|
|
+ boatPollutionWarningItem.setRelieveType(RelieveTypeEnum.WARNING.getStatusCode());
|
|
|
+ boatPollutionWarningItem.setSendmsgFlag(SendMsgFlagEnum.UNSENT.getStatusCode());
|
|
|
+ boatPollutionWarningItem.setWarnCount(0);
|
|
|
+ boatPollutionWarningItem.setFilterState(FilterStateEnum.UNDISPOSED.getStatusCode());
|
|
|
+ this.save(boatPollutionWarningItem);
|
|
|
+ }
|
|
|
} else {
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.Warning.overBoatPollutionWarning.releive.N5.updateBoatPollutionSupervision==========");
|
|
|
- boatPollutionSupervisionService.lambdaUpdate()
|
|
|
- .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
- .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
+ //是否有排放记录
|
|
|
+ if (!boatWaterPollutantAcceptFList.isEmpty()) {
|
|
|
+ //结束监管
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.noneWarning.overBoatPollutionSupervision==========");
|
|
|
+ boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
+ .set(BoatPollutionSupervision::getLastOilsewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.OILSEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastSewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.SEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastToxicliquidTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.TOXICLIQUID.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastBadoilTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.BADOIL.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastRubbishTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.RUBBISH.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
+ } else {
|
|
|
+ //更新监管
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.noneWarning.updateBoatPollutionSupervision==========");
|
|
|
+ boatPollutionSupervisionService.lambdaUpdate()
|
|
|
+ .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISING.getStatusCode())
|
|
|
+ .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- } else if (boatPollutionWarning.getFilterState().equals(FilterStateEnum.CANCEL.getStatusCode())) {
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.Warning.overBoatPollutionWarning.cancel.removeWarning==========");
|
|
|
- this.remove(new QueryWrapper<BoatPollutionWarning>().lambda().eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()));
|
|
|
- }
|
|
|
- } else {
|
|
|
- //无预警
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.noneWarning.start==========");
|
|
|
- //查询排放物
|
|
|
- LambdaQueryWrapper<BoatWaterPollutantAcceptF> boatWaterPollutantAcceptFLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- if (v.get(0).getShipName() != null) {
|
|
|
- boatWaterPollutantAcceptFLambdaQueryWrapper.eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getDeviceId())
|
|
|
- .eq(BoatWaterPollutantAcceptF::getShipName, v.get(0).getShipName())
|
|
|
- .eq(BoatWaterPollutantAcceptF::getSewageType, SewageTypeEnum.SEWAGE.getType())
|
|
|
- .ge(BoatWaterPollutantAcceptF::getFirstDtm, bps.getStartTime())
|
|
|
- .le(BoatWaterPollutantAcceptF::getFirstDtm, bps.getPredictwarnSwTime().isAfter(gpsTime) ? gpsTime : bps.getPredictwarnSwTime())
|
|
|
- .orderByDesc(BoatWaterPollutantAcceptF::getFirstDtm);
|
|
|
} else {
|
|
|
- boatWaterPollutantAcceptFLambdaQueryWrapper.eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getDeviceId())
|
|
|
- .eq(BoatWaterPollutantAcceptF::getSewageType, SewageTypeEnum.SEWAGE.getType())
|
|
|
- .ge(BoatWaterPollutantAcceptF::getFirstDtm, bps.getStartTime())
|
|
|
- .le(BoatWaterPollutantAcceptF::getFirstDtm, bps.getPredictwarnSwTime().isAfter(gpsTime) ? gpsTime : bps.getPredictwarnSwTime())
|
|
|
- .orderByDesc(BoatWaterPollutantAcceptF::getFirstDtm);
|
|
|
- }
|
|
|
- List<BoatWaterPollutantAcceptF> boatWaterPollutantAcceptFList = boatWaterPollutantAcceptFService.list(boatWaterPollutantAcceptFLambdaQueryWrapper);
|
|
|
- //查询是否到监控周期内的第五天
|
|
|
- if (gpsTime.isAfter(bps.getStartTime().plusDays(5))) {
|
|
|
- //是否有排放记录
|
|
|
- if (!boatWaterPollutantAcceptFList.isEmpty()) {
|
|
|
- //结束监管
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.noneWarning.overBoatPollutionWarning==========");
|
|
|
- boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
- .set(BoatPollutionSupervision::getLastOilsewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.OILSEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastSewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.SEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastToxicliquidTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.TOXICLIQUID.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastBadoilTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.BADOIL.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastRubbishTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.RUBBISH.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
- } else {
|
|
|
- //生成预警
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.generateBoatPollutionWarning==========");
|
|
|
- boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getHasWarning, HasWarningEnum.HAS.getStatusCode())
|
|
|
- .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getWarningCount, bps.getWarningCount() + 1)
|
|
|
- .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
- BoatPollutionWarning boatPollutionWarningItem = new BoatPollutionWarning();
|
|
|
- boatPollutionWarningItem.setCode(serialService.getCusNumber("bpw"));
|
|
|
- boatPollutionWarningItem.setSupervisionCode(bps.getCode());
|
|
|
- boatPollutionWarningItem.setBoatName(bps.getBoatName());
|
|
|
- boatPollutionWarningItem.setMmsi(bps.getMmsi());
|
|
|
- boatPollutionWarningItem.setType(SewageTypeEnum.SEWAGE.getType());
|
|
|
- boatPollutionWarningItem.setWarningTime(gpsTime);
|
|
|
- boatPollutionWarningItem.setReportCode(ccbShipEepReportRecList.get(0).getReportNo());
|
|
|
- boatPollutionWarningItem.setWarningState(WarningStateEnum.WANNING.getStatusCode());
|
|
|
- boatPollutionWarningItem.setIsRead(IsReadEnum.UNREAD.getStatusCode());
|
|
|
- boatPollutionWarningItem.setDistrict(this.getDistinct(ccbShipEepReportRecList.get(0), dictDistrictPortList));
|
|
|
- boatPollutionWarningItem.setBerthName(ccbShipEepReportRecList.get(0).getBerthName());
|
|
|
- boatPollutionWarningItem.setRelieveType(RelieveTypeEnum.WARNING.getStatusCode());
|
|
|
- boatPollutionWarningItem.setSendmsgFlag(SendMsgFlagEnum.UNSENT.getStatusCode());
|
|
|
- boatPollutionWarningItem.setWarnCount(0);
|
|
|
- boatPollutionWarningItem.setFilterState(FilterStateEnum.UNDISPOSED.getStatusCode());
|
|
|
- this.save(boatPollutionWarningItem);
|
|
|
- }
|
|
|
- } else {
|
|
|
- //是否有排放记录
|
|
|
- if (!boatWaterPollutantAcceptFList.isEmpty()) {
|
|
|
- //结束监管
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.noneWarning.overBoatPollutionSupervision==========");
|
|
|
- boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
- .set(BoatPollutionSupervision::getLastOilsewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.OILSEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastSewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.SEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastToxicliquidTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.TOXICLIQUID.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastBadoilTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.BADOIL.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastRubbishTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.RUBBISH.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
- } else {
|
|
|
- //更新监管
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge.noneWarning.updateBoatPollutionSupervision==========");
|
|
|
- boatPollutionSupervisionService.lambdaUpdate()
|
|
|
- .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISING.getStatusCode())
|
|
|
- .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
+ if (!ccbShipEepReportRecList.isEmpty()) {
|
|
|
+ //新增监管记录
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge saveBoatPollutionSupervision==========");
|
|
|
+ BoatPollutionSupervision boatPollutionSupervision = new BoatPollutionSupervision();
|
|
|
+ boatPollutionSupervision.setCode(serialService.getCusNumber("bps"));
|
|
|
+ boatPollutionSupervision.setMmsi(k);
|
|
|
+ boatPollutionSupervision.setStartTime(gpsTime);
|
|
|
+ boatPollutionSupervision.setGpsTime(gpsTime);
|
|
|
+ boatPollutionSupervision.setIsBreak(IsBreakEnum.VALID_0.getStatusCode());
|
|
|
+ boatPollutionSupervision.setHasWarning(HasWarningEnum.NONE.getStatusCode());
|
|
|
+ boatPollutionSupervision.setReportId(ccbShipEepReportRecList.get(0).getReportId());
|
|
|
+ boatPollutionSupervision.setBerthName(ccbShipEepReportRecList.get(0).getBerthName());
|
|
|
+ boatPollutionSupervision.setBoatName(v.get(0).getShipName());
|
|
|
+ boatPollutionSupervision.setOutCount(0);
|
|
|
+ boatPollutionSupervision.setSupervisionType(SupervisionTypeEnum.SHORT_BARGE.getStatusCode());
|
|
|
+ boatPollutionSupervision.setSupervisionState(SupervisionStateEnum.SUPERVISING.getStatusCode());
|
|
|
+ boatPollutionSupervision.setPredictwarnSwTime(gpsTime.plusDays(Long.parseLong(warningProperties.getPollutionday())));
|
|
|
+ boatPollutionSupervision.setWarningCount(0);
|
|
|
+ boatPollutionSupervisionService.save(boatPollutionSupervision);
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (!ccbShipEepReportRecList.isEmpty()) {
|
|
|
- //新增监管记录
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge saveBoatPollutionSupervision==========");
|
|
|
- BoatPollutionSupervision boatPollutionSupervision = new BoatPollutionSupervision();
|
|
|
- boatPollutionSupervision.setCode(serialService.getCusNumber("bps"));
|
|
|
- boatPollutionSupervision.setMmsi(k);
|
|
|
- boatPollutionSupervision.setStartTime(gpsTime);
|
|
|
- boatPollutionSupervision.setGpsTime(gpsTime);
|
|
|
- boatPollutionSupervision.setIsBreak(IsBreakEnum.VALID_0.getStatusCode());
|
|
|
- boatPollutionSupervision.setHasWarning(HasWarningEnum.NONE.getStatusCode());
|
|
|
- boatPollutionSupervision.setReportId(ccbShipEepReportRecList.get(0).getReportId());
|
|
|
- boatPollutionSupervision.setBerthName(ccbShipEepReportRecList.get(0).getBerthName());
|
|
|
- boatPollutionSupervision.setBoatName(v.get(0).getShipName());
|
|
|
- boatPollutionSupervision.setOutCount(0);
|
|
|
- boatPollutionSupervision.setSupervisionType(SupervisionTypeEnum.SHORT_BARGE.getStatusCode());
|
|
|
- boatPollutionSupervision.setSupervisionState(SupervisionStateEnum.SUPERVISING.getStatusCode());
|
|
|
- boatPollutionSupervision.setPredictwarnSwTime(gpsTime.plusDays(Long.parseLong(warningProperties.getPollutionday())));
|
|
|
- boatPollutionSupervision.setWarningCount(0);
|
|
|
- boatPollutionSupervisionService.save(boatPollutionSupervision);
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- });
|
|
|
+ }));
|
|
|
+
|
|
|
LocalDateTime handleEndTime = LocalDateTime.now();
|
|
|
log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge crossTime:[" + Duration.between(handleStartTime, handleEndTime).toMillis() + " milliseconds]==========");
|
|
|
log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge end==========");
|
|
@@ -351,68 +358,109 @@ public class BoatPollutionWarningServiceImpl extends ServiceImpl<BoatPollutionWa
|
|
|
log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.dictDistrictPortList==========");
|
|
|
List<DictDistrictPort> dictDistrictPortList = dictDistrictPortService.getDictDistrictPortList();
|
|
|
Map<String, List<BoatAISVO>> boatAISVOMap = boatAISList.stream().collect(Collectors.groupingBy(BoatAISVO::getDeviceId));
|
|
|
- boatAISVOMap.forEach((k, v) -> {
|
|
|
- //查询船舶最近监管记录
|
|
|
- List<BoatPollutionSupervision> bpsList = boatPollutionSupervisionList.stream().filter(x -> x.getMmsi().equals(k) && x.getSupervisionState().equals(SupervisionStateEnum.SUPERVISING.getStatusCode())).sorted(Comparator.comparing(BoatPollutionSupervision::getCreatedTime).reversed()).collect(Collectors.toList());
|
|
|
- LocalDateTime gpsTime = LocalDateTimeUtil.parse(v.get(0).getGpsTime());
|
|
|
- if (!bpsList.isEmpty()) {
|
|
|
- BoatPollutionSupervision bps = bpsList.get(0);
|
|
|
- //查询排放物
|
|
|
- LambdaQueryWrapper<BoatWaterPollutantAcceptF> boatWaterPollutantAcceptFLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- if (!v.get(0).getShipName().isEmpty()) {
|
|
|
- boatWaterPollutantAcceptFLambdaQueryWrapper.eq(BoatWaterPollutantAcceptF::getSewageType, v.get(0).getDeviceId())
|
|
|
- .eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getDeviceId())
|
|
|
- .eq(BoatWaterPollutantAcceptF::getShipName, v.get(0).getShipName())
|
|
|
- .eq(BoatWaterPollutantAcceptF::getSewageType, SewageTypeEnum.SEWAGE.getType())
|
|
|
- .gt(BoatWaterPollutantAcceptF::getFirstDtm, bps.getStartTime())
|
|
|
- .le(BoatWaterPollutantAcceptF::getFirstDtm, bps.getPredictwarnSwTime().isAfter(gpsTime) ? gpsTime : bps.getPredictwarnSwTime())
|
|
|
- .orderByDesc(BoatWaterPollutantAcceptF::getFirstDtm);
|
|
|
- } else {
|
|
|
- boatWaterPollutantAcceptFLambdaQueryWrapper.eq(BoatWaterPollutantAcceptF::getSewageType, v.get(0).getShipName())
|
|
|
- .eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getDeviceId())
|
|
|
- .eq(BoatWaterPollutantAcceptF::getSewageType, SewageTypeEnum.SEWAGE.getType())
|
|
|
- .gt(BoatWaterPollutantAcceptF::getFirstDtm, bps.getStartTime())
|
|
|
- .le(BoatWaterPollutantAcceptF::getFirstDtm, bps.getPredictwarnSwTime().isAfter(gpsTime) ? gpsTime : bps.getPredictwarnSwTime())
|
|
|
- .orderByDesc(BoatWaterPollutantAcceptF::getFirstDtm);
|
|
|
- }
|
|
|
- List<BoatWaterPollutantAcceptF> boatWaterPollutantAcceptFList = boatWaterPollutantAcceptFService.list(boatWaterPollutantAcceptFLambdaQueryWrapper);
|
|
|
- if (bps.getHasWarning().equals(HasWarningEnum.HAS.getStatusCode())) {
|
|
|
- //有预警
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.start==========");
|
|
|
- BoatPollutionWarning boatPollutionWarning = this.getOne(new QueryWrapper<BoatPollutionWarning>().lambda().eq(BoatPollutionWarning::getSupervisionCode, bps.getCode()));
|
|
|
- if (boatPollutionWarning.getFilterState().equals(FilterStateEnum.UNDISPOSED.getStatusCode())) {
|
|
|
- if (gpsTime.isAfter(boatPollutionWarning.getWarningTime().plusDays(5))) {
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.overBoatPollutionWarning.undisposed.removeWarning==========");
|
|
|
- boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
- .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
- this.remove(new QueryWrapper<BoatPollutionWarning>().lambda().eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()));
|
|
|
+ List<Map<String, List<BoatAISVO>>> boatAISVOMaplist = splitMap(boatAISVOMap, 50);
|
|
|
+ boatAISVOMaplist.forEach(subBoatAISVOMap -> CompletableFuture.runAsync(() -> {
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ boatAISVOMap.forEach((k, v) -> {
|
|
|
+ //查询船舶最近监管记录
|
|
|
+ List<BoatPollutionSupervision> bpsList = boatPollutionSupervisionList.stream().filter(x -> x.getMmsi().equals(k) && x.getSupervisionState().equals(SupervisionStateEnum.SUPERVISING.getStatusCode())).sorted(Comparator.comparing(BoatPollutionSupervision::getCreatedTime).reversed()).collect(Collectors.toList());
|
|
|
+ LocalDateTime gpsTime = LocalDateTimeUtil.parse(v.get(0).getGpsTime());
|
|
|
+ if (!bpsList.isEmpty()) {
|
|
|
+ BoatPollutionSupervision bps = bpsList.get(0);
|
|
|
+ //查询排放物
|
|
|
+ LambdaQueryWrapper<BoatWaterPollutantAcceptF> boatWaterPollutantAcceptFLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ if (!v.get(0).getShipName().isEmpty()) {
|
|
|
+ boatWaterPollutantAcceptFLambdaQueryWrapper.eq(BoatWaterPollutantAcceptF::getSewageType, v.get(0).getDeviceId())
|
|
|
+ .eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getDeviceId())
|
|
|
+ .eq(BoatWaterPollutantAcceptF::getShipName, v.get(0).getShipName())
|
|
|
+ .eq(BoatWaterPollutantAcceptF::getSewageType, SewageTypeEnum.SEWAGE.getType())
|
|
|
+ .gt(BoatWaterPollutantAcceptF::getFirstDtm, bps.getStartTime())
|
|
|
+ .le(BoatWaterPollutantAcceptF::getFirstDtm, bps.getPredictwarnSwTime().isAfter(gpsTime) ? gpsTime : bps.getPredictwarnSwTime())
|
|
|
+ .orderByDesc(BoatWaterPollutantAcceptF::getFirstDtm);
|
|
|
+ } else {
|
|
|
+ boatWaterPollutantAcceptFLambdaQueryWrapper.eq(BoatWaterPollutantAcceptF::getSewageType, v.get(0).getShipName())
|
|
|
+ .eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getDeviceId())
|
|
|
+ .eq(BoatWaterPollutantAcceptF::getSewageType, SewageTypeEnum.SEWAGE.getType())
|
|
|
+ .gt(BoatWaterPollutantAcceptF::getFirstDtm, bps.getStartTime())
|
|
|
+ .le(BoatWaterPollutantAcceptF::getFirstDtm, bps.getPredictwarnSwTime().isAfter(gpsTime) ? gpsTime : bps.getPredictwarnSwTime())
|
|
|
+ .orderByDesc(BoatWaterPollutantAcceptF::getFirstDtm);
|
|
|
}
|
|
|
- } else if (boatPollutionWarning.getFilterState().equals(FilterStateEnum.CONFIRM.getStatusCode())) {
|
|
|
- //判断是否到预警后的第5天
|
|
|
- if (gpsTime.isAfter(boatPollutionWarning.getWarningTime().plusDays(5))) {
|
|
|
- if (!boatWaterPollutantAcceptFList.isEmpty()) {
|
|
|
- //有排污
|
|
|
- //查询是否出港
|
|
|
- boolean isOut = false;
|
|
|
- Integer outCount = 0;
|
|
|
- LocalDateTime outTime = null;
|
|
|
- for (int i = 0; i < v.size(); i++) {
|
|
|
- if (v.get(i).getState() == 0) {
|
|
|
- outCount++;
|
|
|
- if (outCount >= 3) {
|
|
|
- isOut = true;
|
|
|
- outTime = LocalDateTime.parse(v.get(i - 2).getGpsTime());
|
|
|
- break;
|
|
|
- }
|
|
|
- } else if (v.get(i).getState() == 1) {
|
|
|
- outCount = 0;
|
|
|
- }
|
|
|
+ List<BoatWaterPollutantAcceptF> boatWaterPollutantAcceptFList = boatWaterPollutantAcceptFService.list(boatWaterPollutantAcceptFLambdaQueryWrapper);
|
|
|
+ if (bps.getHasWarning().equals(HasWarningEnum.HAS.getStatusCode())) {
|
|
|
+ //有预警
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.start==========");
|
|
|
+ BoatPollutionWarning boatPollutionWarning = this.getOne(new QueryWrapper<BoatPollutionWarning>().lambda().eq(BoatPollutionWarning::getSupervisionCode, bps.getCode()));
|
|
|
+ if (boatPollutionWarning.getFilterState().equals(FilterStateEnum.UNDISPOSED.getStatusCode())) {
|
|
|
+ if (gpsTime.isAfter(boatPollutionWarning.getWarningTime().plusDays(5))) {
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.overBoatPollutionWarning.undisposed.removeWarning==========");
|
|
|
+ boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
+ .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
+ this.remove(new QueryWrapper<BoatPollutionWarning>().lambda().eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()));
|
|
|
}
|
|
|
- if (isOut) {
|
|
|
- if (outTime.isBefore(gpsTime)) {
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.overBoatPollutionWarning.releive.Y5.leave_port==========");
|
|
|
+ } else if (boatPollutionWarning.getFilterState().equals(FilterStateEnum.CONFIRM.getStatusCode())) {
|
|
|
+ //判断是否到预警后的第5天
|
|
|
+ if (gpsTime.isAfter(boatPollutionWarning.getWarningTime().plusDays(5))) {
|
|
|
+ if (!boatWaterPollutantAcceptFList.isEmpty()) {
|
|
|
+ //有排污
|
|
|
+ //查询是否出港
|
|
|
+ boolean isOut = false;
|
|
|
+ Integer outCount = 0;
|
|
|
+ LocalDateTime outTime = null;
|
|
|
+ for (int i = 0; i < v.size(); i++) {
|
|
|
+ if (v.get(i).getState() == 0) {
|
|
|
+ outCount++;
|
|
|
+ if (outCount >= 3) {
|
|
|
+ isOut = true;
|
|
|
+ outTime = LocalDateTime.parse(v.get(i - 2).getGpsTime());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else if (v.get(i).getState() == 1) {
|
|
|
+ outCount = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isOut) {
|
|
|
+ if (outTime.isBefore(gpsTime)) {
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.overBoatPollutionWarning.releive.Y5.leave_port==========");
|
|
|
+ boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
+ .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
+ this.lambdaUpdate()
|
|
|
+ .set(BoatPollutionWarning::getWarningState, WarningStateEnum.WANNING_RELIEVE.getStatusCode())
|
|
|
+ .set(BoatPollutionWarning::getRelieveTime, gpsTime)
|
|
|
+ .set(BoatPollutionWarning::getRelieveType, RelieveTypeEnum.LEAVE_PORT.getStatusCode())
|
|
|
+ .eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()).update(new BoatPollutionWarning());
|
|
|
+ } else {
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.overBoatPollutionWarning.releive.Y5.pollutant_release2==========");
|
|
|
+ boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
+ .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
+ this.lambdaUpdate()
|
|
|
+ .set(BoatPollutionWarning::getWarningState, WarningStateEnum.WANNING_RELIEVE.getStatusCode())
|
|
|
+ .set(BoatPollutionWarning::getRelieveTime, gpsTime)
|
|
|
+ .set(BoatPollutionWarning::getRelieveType, RelieveTypeEnum.POLLUTANT_RELEASE.getStatusCode())
|
|
|
+ .eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()).update(new BoatPollutionWarning());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.overBoatPollutionWarning.releive.Y5.pollutant_release==========");
|
|
|
+ boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
+ .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
+ .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
+ this.lambdaUpdate()
|
|
|
+ .set(BoatPollutionWarning::getWarningState, WarningStateEnum.WANNING_RELIEVE.getStatusCode())
|
|
|
+ .set(BoatPollutionWarning::getRelieveTime, gpsTime)
|
|
|
+ .set(BoatPollutionWarning::getRelieveType, RelieveTypeEnum.POLLUTANT_RELEASE.getStatusCode())
|
|
|
+ .eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()).update(new BoatPollutionWarning());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //无排污
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.overBoatPollutionWarning.releive.Y5.warning_exceed==========");
|
|
|
boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
.set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
.set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
@@ -420,176 +468,142 @@ public class BoatPollutionWarningServiceImpl extends ServiceImpl<BoatPollutionWa
|
|
|
this.lambdaUpdate()
|
|
|
.set(BoatPollutionWarning::getWarningState, WarningStateEnum.WANNING_RELIEVE.getStatusCode())
|
|
|
.set(BoatPollutionWarning::getRelieveTime, gpsTime)
|
|
|
- .set(BoatPollutionWarning::getRelieveType, RelieveTypeEnum.LEAVE_PORT.getStatusCode())
|
|
|
+ .set(BoatPollutionWarning::getRelieveType, RelieveTypeEnum.WARNING_EXCEED.getStatusCode())
|
|
|
.eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()).update(new BoatPollutionWarning());
|
|
|
- } else {
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.overBoatPollutionWarning.releive.Y5.pollutant_release2==========");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!boatWaterPollutantAcceptFList.isEmpty()) {
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.overBoatPollutionWarning.releive.N5.pollutant_release==========");
|
|
|
boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
.set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
.set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
+ .set(BoatPollutionSupervision::getLastOilsewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.OILSEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastSewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.SEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastToxicliquidTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.TOXICLIQUID.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastBadoilTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.BADOIL.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
+ .set(BoatPollutionSupervision::getLastRubbishTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.RUBBISH.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
.eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
this.lambdaUpdate()
|
|
|
.set(BoatPollutionWarning::getWarningState, WarningStateEnum.WANNING_RELIEVE.getStatusCode())
|
|
|
.set(BoatPollutionWarning::getRelieveTime, gpsTime)
|
|
|
.set(BoatPollutionWarning::getRelieveType, RelieveTypeEnum.POLLUTANT_RELEASE.getStatusCode())
|
|
|
.eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()).update(new BoatPollutionWarning());
|
|
|
+ } else {
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.overBoatPollutionWarning.releive.N5.updateBoatPollutionSupervision==========");
|
|
|
+ boatPollutionSupervisionService.lambdaUpdate()
|
|
|
+ .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
+ .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
+ this.lambdaUpdate()
|
|
|
+ .set(BoatPollutionWarning::getWarnCount, boatPollutionWarning.getWarnCount() + 1)
|
|
|
+ .eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()).update(new BoatPollutionWarning());
|
|
|
}
|
|
|
- } else {
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.overBoatPollutionWarning.releive.Y5.pollutant_release==========");
|
|
|
- boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
- .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
- this.lambdaUpdate()
|
|
|
- .set(BoatPollutionWarning::getWarningState, WarningStateEnum.WANNING_RELIEVE.getStatusCode())
|
|
|
- .set(BoatPollutionWarning::getRelieveTime, gpsTime)
|
|
|
- .set(BoatPollutionWarning::getRelieveType, RelieveTypeEnum.POLLUTANT_RELEASE.getStatusCode())
|
|
|
- .eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()).update(new BoatPollutionWarning());
|
|
|
}
|
|
|
- } else {
|
|
|
- //无排污
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.overBoatPollutionWarning.releive.Y5.warning_exceed==========");
|
|
|
- boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
- .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
- this.lambdaUpdate()
|
|
|
- .set(BoatPollutionWarning::getWarningState, WarningStateEnum.WANNING_RELIEVE.getStatusCode())
|
|
|
- .set(BoatPollutionWarning::getRelieveTime, gpsTime)
|
|
|
- .set(BoatPollutionWarning::getRelieveType, RelieveTypeEnum.WARNING_EXCEED.getStatusCode())
|
|
|
- .eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()).update(new BoatPollutionWarning());
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (!boatWaterPollutantAcceptFList.isEmpty()) {
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.overBoatPollutionWarning.releive.N5.pollutant_release==========");
|
|
|
- boatPollutionSupervisionService.lambdaUpdate().set(BoatPollutionSupervision::getEndTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
- .set(BoatPollutionSupervision::getSupervisionState, SupervisionStateEnum.SUPERVISE_OVER.getStatusCode())
|
|
|
- .set(BoatPollutionSupervision::getLastOilsewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.OILSEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastSewageTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.SEWAGE.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastToxicliquidTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.TOXICLIQUID.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastBadoilTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.BADOIL.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .set(BoatPollutionSupervision::getLastRubbishTime, boatWaterPollutantAcceptFList.stream().filter(y -> y.getSewageType().equals(SewageTypeEnum.RUBBISH.getType())).findFirst().map(BoatWaterPollutantAcceptF::getFirstDtm).orElse(null))
|
|
|
- .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
- this.lambdaUpdate()
|
|
|
- .set(BoatPollutionWarning::getWarningState, WarningStateEnum.WANNING_RELIEVE.getStatusCode())
|
|
|
- .set(BoatPollutionWarning::getRelieveTime, gpsTime)
|
|
|
- .set(BoatPollutionWarning::getRelieveType, RelieveTypeEnum.POLLUTANT_RELEASE.getStatusCode())
|
|
|
- .eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()).update(new BoatPollutionWarning());
|
|
|
- } else {
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.overBoatPollutionWarning.releive.N5.updateBoatPollutionSupervision==========");
|
|
|
- boatPollutionSupervisionService.lambdaUpdate()
|
|
|
- .set(BoatPollutionSupervision::getGpsTime, gpsTime)
|
|
|
- .eq(BoatPollutionSupervision::getCode, bps.getCode()).update(new BoatPollutionSupervision());
|
|
|
- this.lambdaUpdate()
|
|
|
- .set(BoatPollutionWarning::getWarnCount, boatPollutionWarning.getWarnCount() + 1)
|
|
|
- .eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()).update(new BoatPollutionWarning());
|
|
|
+ } else if (boatPollutionWarning.getFilterState().equals(FilterStateEnum.CANCEL.getStatusCode())) {
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.overBoatPollutionWarning.removeWarning==========");
|
|
|
+ this.remove(new QueryWrapper<BoatPollutionWarning>().lambda().eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()));
|
|
|
}
|
|
|
}
|
|
|
- } else if (boatPollutionWarning.getFilterState().equals(FilterStateEnum.CANCEL.getStatusCode())) {
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.Warning.overBoatPollutionWarning.removeWarning==========");
|
|
|
- this.remove(new QueryWrapper<BoatPollutionWarning>().lambda().eq(BoatPollutionWarning::getCode, boatPollutionWarning.getCode()));
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- //无预警
|
|
|
- //查询近三次AIS中是否有一个点在围栏内
|
|
|
- boolean isIn = false;
|
|
|
- LocalDateTime inTime = null;
|
|
|
- for (BoatAISVO boatAISVO : v) {
|
|
|
- if (boatAISVO.getState() == 1) {
|
|
|
- inTime = LocalDateTimeUtil.parse(boatAISVO.getGpsTime());
|
|
|
- isIn = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (isIn) {
|
|
|
- //有一个点在围栏内
|
|
|
- //查询进出港申报地是上海的申报记录
|
|
|
- LambdaQueryWrapper<CCbShipEepReportRec> cCbShipEepReportRecLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- if (v.get(0).getShipId() != null) {
|
|
|
- cCbShipEepReportRecLambdaQueryWrapper.eq(CCbShipEepReportRec::getShipId, v.get(0).getShipId())
|
|
|
- .between(CCbShipEepReportRec::getReportTime, inTime.minusDays(1), inTime)
|
|
|
- .eq(CCbShipEepReportRec::getArrivalOrLeave, ArrivalOrLeaveEnum.ARRIVAL.getStatusCode())
|
|
|
- .likeRight(CCbShipEepReportRec::getOrgCode, "29").orderByDesc(CCbShipEepReportRec::getReportTime);
|
|
|
- } else if (v.get(0).getDeviceId() != null) {
|
|
|
- cCbShipEepReportRecLambdaQueryWrapper.eq(CCbShipEepReportRec::getMmsi, v.get(0).getDeviceId())
|
|
|
- .between(CCbShipEepReportRec::getReportTime, inTime.minusDays(1), inTime)
|
|
|
- .eq(CCbShipEepReportRec::getArrivalOrLeave, ArrivalOrLeaveEnum.ARRIVAL.getStatusCode())
|
|
|
- .likeRight(CCbShipEepReportRec::getOrgCode, "29")
|
|
|
- .orderByDesc(CCbShipEepReportRec::getReportTime);
|
|
|
- } else if (v.get(0).getShipName() != null) {
|
|
|
- cCbShipEepReportRecLambdaQueryWrapper.eq(CCbShipEepReportRec::getShipNameCn, v.get(0).getShipName())
|
|
|
- .between(CCbShipEepReportRec::getReportTime, inTime.minusDays(1), inTime)
|
|
|
- .eq(CCbShipEepReportRec::getArrivalOrLeave, ArrivalOrLeaveEnum.ARRIVAL.getStatusCode())
|
|
|
- .likeRight(CCbShipEepReportRec::getOrgCode, "29")
|
|
|
- .orderByDesc(CCbShipEepReportRec::getReportTime);
|
|
|
- }
|
|
|
- List<CCbShipEepReportRec> ccbShipEepReportRecList = ccbShipEepReportRecService.list(cCbShipEepReportRecLambdaQueryWrapper);
|
|
|
- if (!ccbShipEepReportRecList.isEmpty()) {
|
|
|
- //查询前5天是否有排放记录
|
|
|
- LambdaQueryWrapper<BoatWaterPollutantAcceptF> boatWaterPollutantAcceptFLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- if (v.get(0).getShipName() != null) {
|
|
|
- boatWaterPollutantAcceptFLambdaQueryWrapper.eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getDeviceId())
|
|
|
- .eq(BoatWaterPollutantAcceptF::getShipName, v.get(0).getShipName())
|
|
|
- .eq(BoatWaterPollutantAcceptF::getSewageType, SewageTypeEnum.SEWAGE.getType())
|
|
|
- .gt(BoatWaterPollutantAcceptF::getFirstDtm, gpsTime.minusDays(5))
|
|
|
- .le(BoatWaterPollutantAcceptF::getFirstDtm, gpsTime)
|
|
|
- .orderByDesc(BoatWaterPollutantAcceptF::getFirstDtm);
|
|
|
- } else {
|
|
|
- boatWaterPollutantAcceptFLambdaQueryWrapper.eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getShipName())
|
|
|
- .eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getDeviceId())
|
|
|
- .eq(BoatWaterPollutantAcceptF::getSewageType, SewageTypeEnum.SEWAGE.getType())
|
|
|
- .gt(BoatWaterPollutantAcceptF::getFirstDtm, gpsTime.minusDays(5))
|
|
|
- .le(BoatWaterPollutantAcceptF::getFirstDtm, gpsTime)
|
|
|
- .orderByDesc(BoatWaterPollutantAcceptF::getFirstDtm);
|
|
|
+ } else {
|
|
|
+ //无预警
|
|
|
+ //查询近三次AIS中是否有一个点在围栏内
|
|
|
+ boolean isIn = false;
|
|
|
+ LocalDateTime inTime = null;
|
|
|
+ for (BoatAISVO boatAISVO : v) {
|
|
|
+ if (boatAISVO.getState() == 1) {
|
|
|
+ inTime = LocalDateTimeUtil.parse(boatAISVO.getGpsTime());
|
|
|
+ isIn = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- List<BoatWaterPollutantAcceptF> boatWaterPollutantAcceptFList = boatWaterPollutantAcceptFService.list(boatWaterPollutantAcceptFLambdaQueryWrapper);
|
|
|
- if (boatWaterPollutantAcceptFList.isEmpty()) {
|
|
|
- //新增监管记录
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip saveBoatPollutionSupervision==========");
|
|
|
- BoatPollutionSupervision boatPollutionSupervision = new BoatPollutionSupervision();
|
|
|
- boatPollutionSupervision.setCode(serialService.getCusNumber("bps"));
|
|
|
- boatPollutionSupervision.setMmsi(k);
|
|
|
- boatPollutionSupervision.setStartTime(gpsTime);
|
|
|
- boatPollutionSupervision.setGpsTime(gpsTime);
|
|
|
- boatPollutionSupervision.setIsBreak(IsBreakEnum.VALID_0.getStatusCode());
|
|
|
- boatPollutionSupervision.setHasWarning(HasWarningEnum.HAS.getStatusCode());
|
|
|
- boatPollutionSupervision.setReportId(ccbShipEepReportRecList.get(0).getReportId());
|
|
|
- boatPollutionSupervision.setBerthName(ccbShipEepReportRecList.get(0).getBerthName());
|
|
|
- boatPollutionSupervision.setBoatName(v.get(0).getShipName());
|
|
|
- boatPollutionSupervision.setOutCount(0);
|
|
|
- boatPollutionSupervision.setSupervisionType(SupervisionTypeEnum.ORDINARY_SHIP_TYPE.getStatusCode());
|
|
|
- boatPollutionSupervision.setSupervisionState(SupervisionStateEnum.SUPERVISING.getStatusCode());
|
|
|
- boatPollutionSupervision.setPredictwarnSwTime(gpsTime.plusDays(Long.parseLong(warningProperties.getPollutionday())));
|
|
|
- boatPollutionSupervision.setWarningCount(0);
|
|
|
- boatPollutionSupervisionService.save(boatPollutionSupervision);
|
|
|
+ if (isIn) {
|
|
|
+ //有一个点在围栏内
|
|
|
+ //查询进出港申报地是上海的申报记录
|
|
|
+ LambdaQueryWrapper<CCbShipEepReportRec> cCbShipEepReportRecLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ if (v.get(0).getShipId() != null) {
|
|
|
+ cCbShipEepReportRecLambdaQueryWrapper.eq(CCbShipEepReportRec::getShipId, v.get(0).getShipId())
|
|
|
+ .between(CCbShipEepReportRec::getReportTime, inTime.minusDays(1), inTime)
|
|
|
+ .eq(CCbShipEepReportRec::getArrivalOrLeave, ArrivalOrLeaveEnum.ARRIVAL.getStatusCode())
|
|
|
+ .likeRight(CCbShipEepReportRec::getOrgCode, "29").orderByDesc(CCbShipEepReportRec::getReportTime);
|
|
|
+ } else if (v.get(0).getDeviceId() != null) {
|
|
|
+ cCbShipEepReportRecLambdaQueryWrapper.eq(CCbShipEepReportRec::getMmsi, v.get(0).getDeviceId())
|
|
|
+ .between(CCbShipEepReportRec::getReportTime, inTime.minusDays(1), inTime)
|
|
|
+ .eq(CCbShipEepReportRec::getArrivalOrLeave, ArrivalOrLeaveEnum.ARRIVAL.getStatusCode())
|
|
|
+ .likeRight(CCbShipEepReportRec::getOrgCode, "29")
|
|
|
+ .orderByDesc(CCbShipEepReportRec::getReportTime);
|
|
|
+ } else if (v.get(0).getShipName() != null) {
|
|
|
+ cCbShipEepReportRecLambdaQueryWrapper.eq(CCbShipEepReportRec::getShipNameCn, v.get(0).getShipName())
|
|
|
+ .between(CCbShipEepReportRec::getReportTime, inTime.minusDays(1), inTime)
|
|
|
+ .eq(CCbShipEepReportRec::getArrivalOrLeave, ArrivalOrLeaveEnum.ARRIVAL.getStatusCode())
|
|
|
+ .likeRight(CCbShipEepReportRec::getOrgCode, "29")
|
|
|
+ .orderByDesc(CCbShipEepReportRec::getReportTime);
|
|
|
+ }
|
|
|
+ List<CCbShipEepReportRec> ccbShipEepReportRecList = ccbShipEepReportRecService.list(cCbShipEepReportRecLambdaQueryWrapper);
|
|
|
+ if (!ccbShipEepReportRecList.isEmpty()) {
|
|
|
+ //查询前5天是否有排放记录
|
|
|
+ LambdaQueryWrapper<BoatWaterPollutantAcceptF> boatWaterPollutantAcceptFLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ if (v.get(0).getShipName() != null) {
|
|
|
+ boatWaterPollutantAcceptFLambdaQueryWrapper.eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getDeviceId())
|
|
|
+ .eq(BoatWaterPollutantAcceptF::getShipName, v.get(0).getShipName())
|
|
|
+ .eq(BoatWaterPollutantAcceptF::getSewageType, SewageTypeEnum.SEWAGE.getType())
|
|
|
+ .gt(BoatWaterPollutantAcceptF::getFirstDtm, gpsTime.minusDays(5))
|
|
|
+ .le(BoatWaterPollutantAcceptF::getFirstDtm, gpsTime)
|
|
|
+ .orderByDesc(BoatWaterPollutantAcceptF::getFirstDtm);
|
|
|
+ } else {
|
|
|
+ boatWaterPollutantAcceptFLambdaQueryWrapper.eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getShipName())
|
|
|
+ .eq(BoatWaterPollutantAcceptF::getMmsi, v.get(0).getDeviceId())
|
|
|
+ .eq(BoatWaterPollutantAcceptF::getSewageType, SewageTypeEnum.SEWAGE.getType())
|
|
|
+ .gt(BoatWaterPollutantAcceptF::getFirstDtm, gpsTime.minusDays(5))
|
|
|
+ .le(BoatWaterPollutantAcceptF::getFirstDtm, gpsTime)
|
|
|
+ .orderByDesc(BoatWaterPollutantAcceptF::getFirstDtm);
|
|
|
+ }
|
|
|
+ List<BoatWaterPollutantAcceptF> boatWaterPollutantAcceptFList = boatWaterPollutantAcceptFService.list(boatWaterPollutantAcceptFLambdaQueryWrapper);
|
|
|
+ if (boatWaterPollutantAcceptFList.isEmpty()) {
|
|
|
+ //新增监管记录
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip saveBoatPollutionSupervision==========");
|
|
|
+ BoatPollutionSupervision boatPollutionSupervision = new BoatPollutionSupervision();
|
|
|
+ boatPollutionSupervision.setCode(serialService.getCusNumber("bps"));
|
|
|
+ boatPollutionSupervision.setMmsi(k);
|
|
|
+ boatPollutionSupervision.setStartTime(gpsTime);
|
|
|
+ boatPollutionSupervision.setGpsTime(gpsTime);
|
|
|
+ boatPollutionSupervision.setIsBreak(IsBreakEnum.VALID_0.getStatusCode());
|
|
|
+ boatPollutionSupervision.setHasWarning(HasWarningEnum.HAS.getStatusCode());
|
|
|
+ boatPollutionSupervision.setReportId(ccbShipEepReportRecList.get(0).getReportId());
|
|
|
+ boatPollutionSupervision.setBerthName(ccbShipEepReportRecList.get(0).getBerthName());
|
|
|
+ boatPollutionSupervision.setBoatName(v.get(0).getShipName());
|
|
|
+ boatPollutionSupervision.setOutCount(0);
|
|
|
+ boatPollutionSupervision.setSupervisionType(SupervisionTypeEnum.ORDINARY_SHIP_TYPE.getStatusCode());
|
|
|
+ boatPollutionSupervision.setSupervisionState(SupervisionStateEnum.SUPERVISING.getStatusCode());
|
|
|
+ boatPollutionSupervision.setPredictwarnSwTime(gpsTime.plusDays(Long.parseLong(warningProperties.getPollutionday())));
|
|
|
+ boatPollutionSupervision.setWarningCount(0);
|
|
|
+ boatPollutionSupervisionService.save(boatPollutionSupervision);
|
|
|
+
|
|
|
+ //生成预警
|
|
|
+ log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.generateBoatPollutionWarning==========");
|
|
|
+ BoatPollutionWarning boatPollutionWarningItem = new BoatPollutionWarning();
|
|
|
+ boatPollutionWarningItem.setCode(serialService.getCusNumber("obpw"));
|
|
|
+ boatPollutionWarningItem.setSupervisionCode(boatPollutionSupervision.getCode());
|
|
|
+ boatPollutionWarningItem.setBoatName(boatPollutionSupervision.getBoatName());
|
|
|
+ boatPollutionWarningItem.setMmsi(boatPollutionSupervision.getMmsi());
|
|
|
+ boatPollutionWarningItem.setType(SewageTypeEnum.SEWAGE.getType());
|
|
|
+ boatPollutionWarningItem.setWarningTime(gpsTime);
|
|
|
+ boatPollutionWarningItem.setReportCode(ccbShipEepReportRecList.get(0).getReportNo());
|
|
|
+ boatPollutionWarningItem.setWarningState(WarningStateEnum.WANNING.getStatusCode());
|
|
|
+ boatPollutionWarningItem.setIsRead(IsReadEnum.UNREAD.getStatusCode());
|
|
|
+ boatPollutionWarningItem.setDistrict(this.getDistinct(ccbShipEepReportRecList.get(0), dictDistrictPortList));
|
|
|
+ boatPollutionWarningItem.setBerthName(ccbShipEepReportRecList.get(0).getBerthName());
|
|
|
+ boatPollutionWarningItem.setRelieveType(RelieveTypeEnum.WARNING.getStatusCode());
|
|
|
+ boatPollutionWarningItem.setSendmsgFlag(SendMsgFlagEnum.UNSENT.getStatusCode());
|
|
|
+ boatPollutionWarningItem.setWarnCount(0);
|
|
|
+ boatPollutionWarningItem.setFilterState(FilterStateEnum.UNDISPOSED.getStatusCode());
|
|
|
+ this.save(boatPollutionWarningItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- //生成预警
|
|
|
- log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip.generateBoatPollutionWarning==========");
|
|
|
- BoatPollutionWarning boatPollutionWarningItem = new BoatPollutionWarning();
|
|
|
- boatPollutionWarningItem.setCode(serialService.getCusNumber("obpw"));
|
|
|
- boatPollutionWarningItem.setSupervisionCode(boatPollutionSupervision.getCode());
|
|
|
- boatPollutionWarningItem.setBoatName(boatPollutionSupervision.getBoatName());
|
|
|
- boatPollutionWarningItem.setMmsi(boatPollutionSupervision.getMmsi());
|
|
|
- boatPollutionWarningItem.setType(SewageTypeEnum.SEWAGE.getType());
|
|
|
- boatPollutionWarningItem.setWarningTime(gpsTime);
|
|
|
- boatPollutionWarningItem.setReportCode(ccbShipEepReportRecList.get(0).getReportNo());
|
|
|
- boatPollutionWarningItem.setWarningState(WarningStateEnum.WANNING.getStatusCode());
|
|
|
- boatPollutionWarningItem.setIsRead(IsReadEnum.UNREAD.getStatusCode());
|
|
|
- boatPollutionWarningItem.setDistrict(this.getDistinct(ccbShipEepReportRecList.get(0), dictDistrictPortList));
|
|
|
- boatPollutionWarningItem.setBerthName(ccbShipEepReportRecList.get(0).getBerthName());
|
|
|
- boatPollutionWarningItem.setRelieveType(RelieveTypeEnum.WARNING.getStatusCode());
|
|
|
- boatPollutionWarningItem.setSendmsgFlag(SendMsgFlagEnum.UNSENT.getStatusCode());
|
|
|
- boatPollutionWarningItem.setWarnCount(0);
|
|
|
- boatPollutionWarningItem.setFilterState(FilterStateEnum.UNDISPOSED.getStatusCode());
|
|
|
- this.save(boatPollutionWarningItem);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
+ });
|
|
|
}
|
|
|
- });
|
|
|
+ }));
|
|
|
LocalDateTime handleEndTime = LocalDateTime.now();
|
|
|
log.info("==========BoatPollutionWarningServiceImpl.handleShortBarge crossTime:[" + Duration.between(handleStartTime, handleEndTime).toMillis() + " milliseconds]==========");
|
|
|
log.info("==========BoatPollutionWarningServiceImpl.handleOrdinaryShip end==========");
|
|
@@ -659,4 +673,27 @@ public class BoatPollutionWarningServiceImpl extends ServiceImpl<BoatPollutionWa
|
|
|
}
|
|
|
return district;
|
|
|
}
|
|
|
+
|
|
|
+ private List<Map<String, List<BoatAISVO>>> splitMap(Map<String, List<BoatAISVO>> map, int splitSize) {
|
|
|
+ List<Map<String, List<BoatAISVO>>> result = new ArrayList<>();
|
|
|
+ int count = 0;
|
|
|
+ Map<String, List<BoatAISVO>> subMap = new HashMap<>();
|
|
|
+
|
|
|
+ for (Map.Entry<String, List<BoatAISVO>> entry : map.entrySet()) {
|
|
|
+ subMap.put(entry.getKey(), entry.getValue());
|
|
|
+ count++;
|
|
|
+
|
|
|
+ if (count == splitSize) {
|
|
|
+ result.add(subMap);
|
|
|
+ subMap = new HashMap<>();
|
|
|
+ count = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!subMap.isEmpty()) {
|
|
|
+ result.add(subMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|