| | |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.map.constant.I18nKeyConstant; |
| | | import com.xiaopeng.map.service.*; |
| | | import com.xiaopeng.map.service.serviceimpl.BootCommonService; |
| | | import com.xiaopeng.map.utils.OperationStrategyIndex; |
| | | import com.xiaopeng.api.query.operation.FenceAndStationVo; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.HashSet; |
| | |
| | | private XpPointService xpPointService; |
| | | @Resource |
| | | private XpStationService xpStationService; |
| | | @Resource |
| | | private BootCommonService bootCommonService; |
| | | |
| | | /** |
| | | * 查询省市管理 |
| | |
| | | |
| | | 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()) { |
| | |
| | | break; |
| | | case 2: //启动中 判断 待启动的状态 ,当前时间在 运营时间 内是启动中,否则是 待启动 |
| | | |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | |
| | | if(xpStation.getOperationType() ==1){//运营类型 1=与运营区同步 2=自定义时间段 |
| | | LocalDateTime startTime = electronicFence.getEffectTime();//生效时间 |
| | | LocalDateTime endTime = electronicFence.getFailureTime();//失效时间 |
| | | if(electronicFence.getFailureType() ==1) {// 失效类型 1=永不失效 2=定时失效 |
| | | endTime = LocalDateTime.now().plusYears(1); |
| | | } |
| | | if(!now.isBefore(startTime) && !now.isAfter(endTime)){ |
| | | 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); |
| | | } |
| | | }else { |
| | | //数据结构 [{"endTime": "18:00", "startTime": "05:00"}] |
| | | JSONArray jsonArray = JSONObject.parseArray(xpStation.getEffectiveTimePeriod()); |
| | | |
| | | boolean flag = false; |
| | | for (Object object : jsonArray) { |
| | | JSONObject jsonObject = (JSONObject) object; |
| | | String startTimeStr = jsonObject.getString("startTime"); |
| | | String endTimeStr = jsonObject.getString("endTime"); |
| | | startTimeStr = LocalDate.now() +" "+ startTimeStr+":00"; |
| | | endTimeStr = LocalDate.now() + " " + endTimeStr + ":00"; |
| | | LocalDateTime startTime = LocalDateTimeUtil.parse(startTimeStr, DatePattern.NORM_DATETIME_PATTERN); |
| | | LocalDateTime endTime = LocalDateTimeUtil.parse(endTimeStr, DatePattern.NORM_DATETIME_PATTERN); |
| | | if(!now.isBefore(startTime) && !now.isAfter(endTime)){ |
| | | flag = true; |
| | | } |
| | | } |
| | | if (flag){ |
| | | stationNumbers.setStartingUp(stationNumbers.getStartingUp() + 1); |
| | | }else{ |
| | | stationNumbers.setPendingLaunch(stationNumbers.getPendingLaunch() + 1); |
| | | } |
| | | } |
| | | break; |
| | | case 3: |