| | |
| | | import com.ruoyi.common.core.dto.ChargingOrderGroup; |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | import com.ruoyi.order.service.TOrderEvaluateService; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.order.vo.EndOfChargePageInfo; |
| | | import com.ruoyi.order.vo.OrderCountByDate; |
| | | import com.ruoyi.order.vo.StatisticsOfBatteryVO; |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 大屏-新能源汽车电池安全检测次数统计 |
| | | */ |
| | | @Override |
| | | public R<StatisticsOfBatteryVO> getStatisticsOfBattery() { |
| | | StatisticsOfBatteryVO vo = new StatisticsOfBatteryVO(); |
| | | //1.计算累计次数 |
| | | //查询该俩站点的快充和超充的充电枪id集合 site_id 25 26 charge_model 1 2 |
| | | R<List<Integer>> r = chargingGunClient.getGunIdsBySiteIdsAndChargeModels(Arrays.asList(25,26),Arrays.asList(1,2)); |
| | | if (r.getCode()!=200){ |
| | | return R.ok(vo); |
| | | } |
| | | List<Integer> gunIds=r.getData(); |
| | | //统计 |
| | | Long total= 0L; |
| | | if(gunIds!=null && !gunIds.isEmpty()) { |
| | | total = this.baseMapper.selectCount(new LambdaQueryWrapper<TChargingOrder>() |
| | | .eq(TChargingOrder::getDelFlag, 0)//未删除 |
| | | .in(TChargingOrder::getStatus, Arrays.asList(3, 5))//充电中、已结束 |
| | | .in(TChargingOrder::getChargingGunId, gunIds));//符合条件的充电枪 |
| | | } |
| | | vo.setTotal(total.intValue()); |
| | | //2.折线图 |
| | | /* // 计算日期范围:前七天(不含今日)直接查找数据量太大,内存报错 |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDateTime startDate = today.minusDays(7).atStartOfDay(); |
| | | LocalDateTime endDate = today.minusDays(1).atTime(LocalTime.MAX); |
| | | // 查询数据库 |
| | | List<OrderCountByDate> orderCounts = this.baseMapper.countOrdersByDate(startDate, endDate, gunIds);*/ |
| | | // 转换结果 |
| | | List<LocalDate> dates = new ArrayList<>(); |
| | | List<Integer> counts = new ArrayList<>(); |
| | | LocalDate today = LocalDate.now(); |
| | | // 直接查找数据量太大,内存报错,分每天查找 |
| | | for (int i = 7; i >= 1; i--) {//升序 |
| | | LocalDate day = today.minusDays(i); |
| | | LocalDateTime startOfDay = day.atStartOfDay(); |
| | | LocalDateTime endOfDay = day.atTime(LocalTime.MAX); |
| | | //统计 |
| | | Long count=0L; |
| | | if(gunIds!=null && !gunIds.isEmpty()){ |
| | | count = this.baseMapper.selectCount(new LambdaQueryWrapper<TChargingOrder>() |
| | | .eq(TChargingOrder::getDelFlag,0)//未删除 |
| | | .in(TChargingOrder::getStatus,Arrays.asList(3,5))//充电中、已结束 |
| | | .in(TChargingOrder::getChargingGunId,gunIds)//符合条件的充电枪 站点 超充快充 |
| | | .between(BasePojo::getCreateTime,startOfDay,endOfDay));//每天 |
| | | } |
| | | dates.add(day); |
| | | counts.add(count.intValue()); |
| | | } |
| | | vo.setDates(dates); |
| | | vo.setCounts(counts); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getSumDegreeBySiteIds(List<Integer> siteIds) { |
| | | |
| | | return this.baseMapper.getSumDegreeBySiteIds(siteIds); |
| | | |
| | | } |
| | | } |