| | |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.xiaopeng.map.service.serviceimpl.XpElectronicFenceServiceImpl.getPinyinInitials; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | content = "新增电子围栏", |
| | | appendRequestData = true |
| | | ) |
| | | public R add(@Valid @RequestBody ElectronicFenceAddDto dto) { |
| | | public R add(@Validated @RequestBody ElectronicFenceAddDto dto) { |
| | | validateFenceTime(dto.getStatus(), dto.getEffectType(), dto.getEffectTime(), dto.getFailureType(), dto.getFailureTime()); |
| | | return xpElectronicFenceService.addElectronic(dto); |
| | | } |
| | |
| | | |
| | | ElectronicFenceDetailVo.Numbers pointsNumbers = new ElectronicFenceDetailVo.Numbers(); |
| | | if(CollUtil.isNotEmpty(pointList)){ |
| | | for (XpPoint xpPoint : pointList) { |
| | | if (xpPoint.getOperationStatus() == 1) { |
| | | pointsNumbers.setPendingLaunch(pointsNumbers.getPendingLaunch() + 1); |
| | | } else if (xpPoint.getOperationStatus() == 2) { |
| | | pointsNumbers.setStartingUp(pointsNumbers.getStartingUp() + 1); |
| | | } |
| | | else if (xpPoint.getOperationStatus() == 3) { |
| | | pointsNumbers.setExpired(pointsNumbers.getExpired() + 1); |
| | | } |
| | | else if (xpPoint.getOperationStatus() == 4) { |
| | | pointsNumbers.setDisabled(pointsNumbers.getDisabled() + 1); |
| | | } |
| | | } |
| | | LocalTime localTime = LocalTime.now(); |
| | | //总数 |
| | | pointsNumbers.setTotalNum(pointList.size()); |
| | | //待测试 |
| | | long count = pointList.stream().filter(xpPoint -> xpPoint.getVerificationStatus() == 1).count(); |
| | | pointsNumbers.setToBeTested(Integer.parseInt(count+"")); |
| | | //测试中 |
| | | long count2 = pointList.stream().filter(xpPoint -> xpPoint.getVerificationStatus() == 2).count(); |
| | | pointsNumbers.setTesting(Integer.parseInt(count2+"")); |
| | | //测试不通过 |
| | | long count3 = pointList.stream().filter(xpPoint -> xpPoint.getVerificationStatus() == 4).count(); |
| | | pointsNumbers.setTestNotPass(Integer.parseInt(count3+"")); |
| | | //待启用 |
| | | long count4 = pointList.stream().filter(xpPoint -> xpPoint.getOperationStatus() == 1 && xpPoint.getVerificationStatus() == 3).count(); |
| | | pointsNumbers.setPendingLaunch(Integer.parseInt(count4+"")); |
| | | //启用中 |
| | | long count5 = pointList.stream().filter(xpPoint -> xpPoint.getOperationStatus() == 2 && xpPoint.getVerificationStatus() == 3).count(); |
| | | pointsNumbers.setStartingUp(Integer.parseInt(count5+"")); |
| | | //已停用 |
| | | long count6 = pointList.stream().filter(xpPoint -> xpPoint.getOperationStatus() == 3 && xpPoint.getVerificationStatus() == 3).count(); |
| | | pointsNumbers.setDisabled(Integer.parseInt(count6+"")); |
| | | //已失效 |
| | | long count7 = pointList.stream().filter(xpPoint -> xpPoint.getOperationStatus() == 4 && xpPoint.getVerificationStatus() == 3).count(); |
| | | pointsNumbers.setExpired(Integer.parseInt(count7+"")); |
| | | } |
| | | res.setPointsNumbers(pointsNumbers); |
| | | } |
| | |
| | | |
| | | ElectronicFenceDetailVo.Numbers stationNumbers = new ElectronicFenceDetailVo.Numbers(); |
| | | if(CollUtil.isNotEmpty(stationList)){ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalTime localTime = LocalTime.now(); |
| | | //status 场站状态 0=草稿 1=待启用 2=启用中 3=已停用 4=失效 |
| | | for (XpStation xpStation : stationList) { |
| | | switch (xpStation.getStatus()) { |
| | | case 0: |
| | | stationNumbers.setDraft(stationNumbers.getDraft() + 1); |
| | | break; |
| | | case 1: |
| | | stationNumbers.setPendingLaunch(stationNumbers.getPendingLaunch() + 1); |
| | | break; |
| | | case 2: //启动中 判断 待启动的状态 ,当前时间在 运营时间 内是启动中,否则是 待启动 |
| | | |
| | | boolean stationOperation = bootCommonService.getStationOperation(localTime, xpStation.getOperationType(), xpStation.getEffectivePeriod(), xpStation.getEffectiveTimePeriod(), xpStation.getFenceOperationStrategy()); |
| | | if (stationOperation) { |
| | | stationNumbers.setStartingUp(stationNumbers.getStartingUp() + 1); |
| | | }else{ |
| | | stationNumbers.setPendingLaunch(stationNumbers.getPendingLaunch() + 1); |
| | | } |
| | | break; |
| | | case 3: |
| | | stationNumbers.setDisabled(stationNumbers.getDisabled() + 1); |
| | | break; |
| | | case 4: |
| | | stationNumbers.setExpired(stationNumbers.getExpired() + 1); |
| | | break; |
| | | } |
| | | } |
| | | stationNumbers.setTotalNum(stationList.size()); |
| | | //待生效 |
| | | long count1 = stationList.stream().filter(xpStation -> xpStation.getStatus() == 1).count(); |
| | | stationNumbers.setPendingLaunch(Integer.parseInt(count1+"")); |
| | | //启用中 |
| | | long count2 = stationList.stream().filter(xpStation -> xpStation.getStatus() == 2).count(); |
| | | stationNumbers.setStartingUp(Integer.parseInt(count2+"")); |
| | | //已停用 |
| | | long count3 = stationList.stream().filter(xpStation -> xpStation.getStatus() == 3).count(); |
| | | stationNumbers.setDisabled(Integer.parseInt(count3+"")); |
| | | //已失效 |
| | | long count4 = stationList.stream().filter(xpStation -> xpStation.getStatus() == 4).count(); |
| | | stationNumbers.setExpired(Integer.parseInt(count4+"")); |
| | | } |
| | | res.setStationNumbers(stationNumbers); |
| | | return R.ok(res); |