| | |
| | | import com.ruoyi.order.api.query.ChargingOrderQuery; |
| | | import com.ruoyi.order.api.query.TChargingCountQuery; |
| | | import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery; |
| | | import com.ruoyi.order.api.vo.*; |
| | | import com.ruoyi.order.api.vo.ChargingOrderInfoVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderVO; |
| | | import com.ruoyi.order.api.vo.GetChargingOrderByLicensePlate; |
| | |
| | | return chargingOrderService.getRefundList(chargingRefundDto); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | @ResponseBody |
| | | @GetMapping(value = "/six/total") |
| | | @ApiOperation(value = "底部数据分类", tags = {"后台-数据分析-平台收入分析"}) |
| | | public R<Map<String,BigDecimal>> total() { |
| | | public R<Map<String,Object>> total() { |
| | | //count近6个月的数据 |
| | | LocalDate sixBefore = PreviousSixMonths.get(); |
| | | Map<String,BigDecimal> map = chargingOrderService.countAll(sixBefore); |
| | | Map<String,Object> map = chargingOrderService.countAll(sixBefore); |
| | | BigDecimal data = parkingLotClient.getRecordAmount(sixBefore).getData(); |
| | | map.put("parkingAmount",data); |
| | | BigDecimal data1 = shoppingOrderService.getSumAmount(sixBefore); |
| | |
| | | |
| | | |
| | | |
| | | // @ResponseBody |
| | | // @PostMapping(value = "/charging/statistics") |
| | | // @ApiOperation(value = "统计", tags = {"管理后台-数据分析-充电运营分析"}) |
| | | // public R<TCharingOrderVO> watchChargingOrder(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){ |
| | | // List<Integer> siteIds =new ArrayList<>(); |
| | | // if (statisticsQueryDto.getSiteId()==null) { |
| | | // Long userId = SecurityUtils.getUserId(); |
| | | // //获取当前登录的siteIds |
| | | // List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | // for (GetSiteListDTO datum : data) { |
| | | // siteIds.add(datum.getId()); |
| | | // } |
| | | // }else { |
| | | // siteIds.add(statisticsQueryDto.getSiteId()); |
| | | // } |
| | | // |
| | | // |
| | | // LocalDate start = null; |
| | | // LocalDate end = null; |
| | | // if (statisticsQueryDto.getDayType()==1){ |
| | | // start = LocalDate.now(); |
| | | // |
| | | // }else if (statisticsQueryDto.getDayType()==2){ |
| | | // LocalDate today = LocalDate.now(); |
| | | // |
| | | // // 获取本周一的日期 |
| | | // LocalDate mondayThisWeek = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)); |
| | | // |
| | | // System.out.println("本周一是: " + mondayThisWeek); |
| | | // } |
| | | // else if (statisticsQueryDto.getDayType()==3){ |
| | | // // 获取当前日期 |
| | | // LocalDate today = LocalDate.now(); |
| | | // |
| | | // // 获取本月1号的日期 |
| | | // YearMonth yearMonth = YearMonth.from(today); |
| | | // start = yearMonth.atDay(1); |
| | | // |
| | | // System.out.println("本月1号是: " + start); |
| | | // }else if (statisticsQueryDto.getDayType()==4){ |
| | | // LocalDate today = LocalDate.now(); |
| | | // // 获取当前年份 |
| | | // int currentYear = today.getYear(); |
| | | // // 获取今年1月1日的日期 |
| | | // start = LocalDate.of(currentYear, 1, 1); |
| | | // System.out.println("今年1月1日是: " + start); |
| | | // }else if (statisticsQueryDto.getDayType()==5){ |
| | | // |
| | | // // 获取今年1月1日的日期 |
| | | // start = statisticsQueryDto.getStartTime(); |
| | | // end = statisticsQueryDto.getEndTime(); |
| | | // } |
| | | // List<TChargingOrder> list = chargingOrderService.lambdaQuery().ge(TChargingOrder::getStartTime, start).le(TChargingOrder::getEndTime, end).in(TChargingOrder::getSiteId, siteIds).list(); |
| | | // List<Long> chargingOrderIds = list.stream().map(TChargingOrder::getId).collect(Collectors.toList()); |
| | | // //上方饼图 |
| | | // List<Map<String,BigDecimal>> maps = chargingOrderService.getSumByType(chargingOrderIds); |
| | | // |
| | | // if (statisticsQueryDto.getDayType()==1){ |
| | | // List<Map<String,BigDecimal>> maps1 = chargingOrderService.getDateData(chargingOrderIds); |
| | | // |
| | | // }else if (statisticsQueryDto.getDayType()==2){ |
| | | // List<Map<String,BigDecimal>> maps1 = chargingOrderService.getWeekData(chargingOrderIds); |
| | | // }else if (statisticsQueryDto.getDayType()==3){ |
| | | // List<Map<String,BigDecimal>> maps1 = chargingOrderService.getMonthData(chargingOrderIds); |
| | | // }else if (statisticsQueryDto.getDayType()==4){ |
| | | // List<Map<String,BigDecimal>> maps1 = chargingOrderService.getYearData(chargingOrderIds); |
| | | // } |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // } |
| | | @ResponseBody |
| | | @PostMapping(value = "/charging/statistics") |
| | | @ApiOperation(value = "统计,充电订单分析", tags = {"管理后台-数据分析-充电运营分析"}) |
| | | public R<TCharingOrderMapVO> watchChargingOrder(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){ |
| | | List<Integer> siteIds =new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId()==null) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | }else { |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | TCharingOrderMapVO tCharingOrderMapVO = new TCharingOrderMapVO(); |
| | | |
| | | |
| | | LocalDate start = null; |
| | | LocalDate end = null; |
| | | if (statisticsQueryDto.getDayType()==1){ |
| | | start = LocalDate.now(); |
| | | |
| | | }else if (statisticsQueryDto.getDayType()==2){ |
| | | LocalDate today = LocalDate.now(); |
| | | |
| | | // 获取本周一的日期 |
| | | LocalDate mondayThisWeek = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)); |
| | | |
| | | System.out.println("本周一是: " + mondayThisWeek); |
| | | } |
| | | else if (statisticsQueryDto.getDayType()==3){ |
| | | // 获取当前日期 |
| | | LocalDate today = LocalDate.now(); |
| | | |
| | | // 获取本月1号的日期 |
| | | YearMonth yearMonth = YearMonth.from(today); |
| | | start = yearMonth.atDay(1); |
| | | |
| | | System.out.println("本月1号是: " + start); |
| | | }else if (statisticsQueryDto.getDayType()==4){ |
| | | LocalDate today = LocalDate.now(); |
| | | // 获取当前年份 |
| | | int currentYear = today.getYear(); |
| | | // 获取今年1月1日的日期 |
| | | start = LocalDate.of(currentYear, 1, 1); |
| | | System.out.println("今年1月1日是: " + start); |
| | | }else if (statisticsQueryDto.getDayType()==5){ |
| | | |
| | | // 获取今年1月1日的日期 |
| | | start = statisticsQueryDto.getStartTime(); |
| | | end = statisticsQueryDto.getEndTime(); |
| | | } |
| | | List<TChargingOrder> list = chargingOrderService.lambdaQuery().ge(TChargingOrder::getStartTime, start).le(TChargingOrder::getEndTime, end).in(TChargingOrder::getSiteId, siteIds).list(); |
| | | List<Long> chargingOrderIds = list.stream().map(TChargingOrder::getId).collect(Collectors.toList()); |
| | | //上方饼图 |
| | | List<Map<String,Object>> maps = chargingOrderService.getSumByType(chargingOrderIds); |
| | | |
| | | if (statisticsQueryDto.getDayType()==1){ |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getDateData(chargingOrderIds); |
| | | tCharingOrderMapVO.setMaps1(maps1); |
| | | }else if (statisticsQueryDto.getDayType()==2){ |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getWeekData(chargingOrderIds); |
| | | tCharingOrderMapVO.setMaps1(maps1); |
| | | }else if (statisticsQueryDto.getDayType()==3){ |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getMonthData(chargingOrderIds); |
| | | tCharingOrderMapVO.setMaps1(maps1); |
| | | }else if (statisticsQueryDto.getDayType()==4){ |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getYearData(chargingOrderIds); |
| | | tCharingOrderMapVO.setMaps1(maps1); |
| | | }else if (statisticsQueryDto.getDayType()==5){ |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getByDate(chargingOrderIds); |
| | | tCharingOrderMapVO.setMaps1(maps1); |
| | | } |
| | | |
| | | |
| | | tCharingOrderMapVO.setMaps(maps); |
| | | |
| | | |
| | | return R.ok(tCharingOrderMapVO); |
| | | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/charging/power") |
| | | @ApiOperation(value = "功率", tags = {"管理后台-数据分析-充电运营分析"}) |
| | | public R<TCharingOrderPowerMapVO> power(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId() == null) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } else { |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | List<Map<String,Object>> maps1 = chargingOrderService.queryPower(siteIds); |
| | | |
| | | |
| | | Map<String,Object> map = chargingOrderService.qureryPowerLevel(siteIds,statisticsQueryDto); |
| | | |
| | | TCharingOrderPowerMapVO tCharingOrderPowerMapVO = new TCharingOrderPowerMapVO(); |
| | | tCharingOrderPowerMapVO.setMaps1(map); |
| | | tCharingOrderPowerMapVO.setMaps(maps1); |
| | | return R.ok(tCharingOrderPowerMapVO); |
| | | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/charging/users") |
| | | @ApiOperation(value = "除电站流量外", tags = {"管理后台-数据分析-充电用户分析"}) |
| | | public R<TCharingUserMapVO> users(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){ |
| | | |
| | | TCharingUserMapVO tCharingUserMapVO = new TCharingUserMapVO(); |
| | | //上方折现 |
| | | if (statisticsQueryDto.getDayType()==1){ |
| | | List<Map<String,Object>> map = chargingOrderService.usersDay(); |
| | | tCharingUserMapVO.setMap(map); |
| | | }else { |
| | | List<Map<String,Object>> map = chargingOrderService.usersByQuery(statisticsQueryDto); |
| | | tCharingUserMapVO.setMap(map); |
| | | } |
| | | |
| | | //用户标签 |
| | | List<Map<String,Object>> maps = chargingOrderService.getUserTagCount(); |
| | | //会员标签 |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getVipCount(); |
| | | |
| | | //单位消费 |
| | | List<Map<String, Object>> untiMap = chargingOrderService.unitConsumption(statisticsQueryDto); |
| | | |
| | | //车辆用途 |
| | | List<Map<String, Object>> carMap = chargingOrderService.carUserMethod(); |
| | | //车辆品牌 |
| | | List<Map<String, Object>> carBrandMap = chargingOrderService.carUserBrand(); |
| | | //本地车数量 |
| | | Map<String,Object> localCarMap = chargingOrderService.countLocalCar(); |
| | | |
| | | |
| | | tCharingUserMapVO.setUserMaps(maps); |
| | | tCharingUserMapVO.setVipMaps(maps1); |
| | | tCharingUserMapVO.setUntiMap(untiMap); |
| | | tCharingUserMapVO.setCarMap(carMap); |
| | | tCharingUserMapVO.setCarBrandMap(carBrandMap); |
| | | tCharingUserMapVO.setLocalCarMap(localCarMap); |
| | | return R.ok(tCharingUserMapVO); |
| | | |
| | | } |
| | | @ResponseBody |
| | | @PostMapping(value = "/charging/sites") |
| | | @ApiOperation(value = "电站评价", tags = {"管理后台-数据分析-充电用户分析"}) |
| | | public R<TCharingUserEvaluateVO> sites(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){ |
| | | List<Integer> siteIds =new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId()==null) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | }else { |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | //查询评价分 |
| | | Long aver = chargingOrderService.getAver(siteIds); |
| | | //查询各个分数 |
| | | List<Map<String,Object>> evaluate = chargingOrderService.getLevelEvaluate(siteIds); |
| | | //查询差评回复数 |
| | | Long count = orderEvaluateService.lambdaQuery().isNotNull(TOrderEvaluate::getResponseTime).count(); |
| | | TCharingUserEvaluateVO tCharingUserEvaluateVO = new TCharingUserEvaluateVO(); |
| | | tCharingUserEvaluateVO.setAver(aver); |
| | | tCharingUserEvaluateVO.setEvaluate(evaluate); |
| | | tCharingUserEvaluateVO.setBlackCount(count); |
| | | |
| | | |
| | | |
| | | //标签 |
| | | //查出好评ids |
| | | // orderEvaluateService.goodTop(); |
| | | |
| | | |
| | | |
| | | |
| | | //流量 |
| | | return R.ok(tCharingUserEvaluateVO); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // 示例数据 |
| | |
| | | public void excelEndCharge(@RequestParam("code") String code){ |
| | | chargingOrderService.excelEndCharge(code); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据车牌号和时间查询有效的充电数据 |
| | | * @param query |