| | |
| | | import com.xiaopeng.map.vo.WalkTimeVo; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.data.geo.Point; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | |
| | | private GDMapGeocodingUtil gdMapGeocodingUtil; |
| | | @Autowired |
| | | private XpPointService xpPointService; |
| | | @Lazy |
| | | @Autowired |
| | | private BootCommonService bootCommonService; |
| | | |
| | | |
| | | |
| | |
| | | if(xpElectronicFence.getFailureType() == 2){ |
| | | JSONArray jsonArray = JSONArray.parseArray(operationStrategy); |
| | | if(!jsonArray.isEmpty()){ |
| | | Boolean inOperationTime = isInOperationTime(operationStrategy); |
| | | Boolean inOperationTime = bootCommonService.getFenceOperation(operationStrategy); |
| | | if(!inOperationTime){ |
| | | continue; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否在运营内 |
| | | * @param operationStrategy 规则json字符串 |
| | | * @return |
| | | */ |
| | | private Boolean isInOperationTime(String operationStrategy) { |
| | | JSONArray jsonArray = JSONArray.parseArray(operationStrategy); |
| | | Integer holidayToday = holidayUtil.isHolidayToday(); |
| | | for (Object o : jsonArray) { |
| | | JSONObject jsonObject =JSONObject.parseObject(o.toString()); |
| | | String type = jsonObject.getString("type"); |
| | | if(type.equals(holidayToday.toString())){ |
| | | JSONArray time = jsonObject.getJSONArray("time"); |
| | | // 判断当前时间 是否在time时间段中 |
| | | for (Object object : time) { |
| | | String[] timeArray = object.toString().split("-"); |
| | | String startTime = timeArray[0]; |
| | | String endTime = timeArray[1]; |
| | | boolean currentTimeInRange = DateUtils.isCurrentTimeInRange(startTime, endTime); |
| | | if(currentTimeInRange){ |
| | | return true; |
| | | } |
| | | } |
| | | }else if(type.equals("3")){ |
| | | // 判断是什么类型 0每天 1-7 想起 |
| | | String typeStr = jsonObject.getString("typeStr"); |
| | | // 查看今天周几 |
| | | Integer week = DateUtils.getWeek(); |
| | | // 包含每天 或者 包含当天 |
| | | if(typeStr.contains("0") || typeStr.contains(week.toString())){ |
| | | JSONArray time = jsonObject.getJSONArray("time"); |
| | | // 判断当前时间 是否在time时间段中 |
| | | for (Object object : time) { |
| | | String[] timeArray = object.toString().split("-"); |
| | | String startTime = timeArray[0]; |
| | | String endTime = timeArray[1]; |
| | | boolean currentTimeInRange = DateUtils.isCurrentTimeInRange(startTime, endTime); |
| | | if(currentTimeInRange){ |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | String operationStrategy = electronicFence.getOperationStrategy(); |
| | | Boolean inOperationTime = true; |
| | | if(electronicFence.getFailureType() == 2){ |
| | | inOperationTime = isInOperationTime(operationStrategy); |
| | | inOperationTime = bootCommonService.getFenceOperation(operationStrategy); |
| | | } |
| | | XpElectronicFenceArea electronicFenceArea = this.getById(Long.valueOf(polygon.getAreaId())); |
| | | if(inOperationTime && null != electronicFenceArea && !electronicFenceArea.getDeleted()){ |