| | |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private TOrderEvaluateService orderEvaluateService; |
| | | |
| | | @Autowired |
| | | private TGrantVipService tGrantVipService; |
| | | @Resource |
| | | private WxPaymentClient wxPaymentClient; |
| | | |
| | |
| | | @Resource |
| | | private TOrderInvoiceService invoiceService; |
| | | |
| | | /** |
| | | * 远程调用 增加管理后台赠送会员记录 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping(value = "/management/give/vip") |
| | | public R managementGiveVip(@RequestBody TGrantVip grantVip) { |
| | | return R.ok(tGrantVipService.save(grantVip)); |
| | | } |
| | | |
| | | /** |
| | | * 远程调用根据枪id 查询最新的订单id 用户后台结束充电 |
| | |
| | | @ResponseBody |
| | | @GetMapping(value = "/pay/order/charging") |
| | | @ApiOperation(value = "充电信息", tags = {"管理后台-支付订单-订单信息"}) |
| | | public R refundDetail(Long orderId) { |
| | | public R<PayOrderChargingInfo> refundDetail(Long orderId) { |
| | | PayOrderChargingInfo payOrderChargingInfo = new PayOrderChargingInfo(); |
| | | TChargingOrder byId = chargingOrderService.getById(orderId); |
| | | List<Site> data = siteClient.getSiteByIds(Collections.singletonList(byId.getSiteId())).getData(); |
| | |
| | | List<TAppUserCar> data3 = appUserCarClient.getCarByIds(Collections.singletonList(byId.getAppUserCarId())).getData(); |
| | | payOrderChargingInfo.setCarNum(data3.get(0).getLicensePlate()); |
| | | } |
| | | return R.ok(); |
| | | payOrderChargingInfo.setTChargingOrder(byId); |
| | | |
| | | Long count = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, orderId).count(); |
| | | payOrderChargingInfo.setPeriodCount(count); |
| | | if (byId.getAppUserCarId()!=null) { |
| | | List<Long> carid = new ArrayList<>(); |
| | | carid.add(byId.getAppUserCarId()); |
| | | R<List<TAppUserCar>> carByIds = appUserCarClient.getCarByIds(carid); |
| | | payOrderChargingInfo.setCarNum(carByIds.getData().get(0).getLicensePlate()); |
| | | } |
| | | payOrderChargingInfo.setStartTime(byId.getStartTime()); |
| | | payOrderChargingInfo.setEndTime(byId.getEndTime()); |
| | | payOrderChargingInfo.setTimeCount(payOrderChargingInfo.calculateDuration()); |
| | | return R.ok(payOrderChargingInfo); |
| | | } |
| | | |
| | | @ResponseBody |
| | |
| | | @ApiOperation(value = "充电明细", tags = {"管理后台-支付订单-订单信息"}) |
| | | public R<List<TChargingOrderAccountingStrategy>> chargingDetail(Long orderId) { |
| | | List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, orderId).orderByDesc(TChargingOrderAccountingStrategy::getStartTime).list(); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : list) { |
| | | String format = tChargingOrderAccountingStrategy.getCreateTime().format(formatter); |
| | | tChargingOrderAccountingStrategy.setStartTime(format+" "+tChargingOrderAccountingStrategy.getStartTime()); |
| | | tChargingOrderAccountingStrategy.setEndTime(format+" "+tChargingOrderAccountingStrategy.getEndTime()); |
| | | } |
| | | |
| | | |
| | | return R.ok(list); |
| | | } |
| | | |
| | |
| | | public AjaxResult<ChargingOrderInfoVO> chargingOrderInfo(String strategyId) { |
| | | TChargingOrder byId = chargingOrderService.getById(strategyId); |
| | | ChargingOrderInfoVO chargingOrderInfoVO = new ChargingOrderInfoVO(); |
| | | |
| | | chargingOrderInfoVO.setCdElectronic(byId.getCurrent()!=null?byId.getCurrent()+"":""); |
| | | chargingOrderInfoVO.setCdVoltage(byId.getVoltage()!=null?byId.getVoltage()+"":""); |
| | | chargingOrderInfoVO.setSurplus(byId.getTotalElectricity()!=null?byId.getTotalElectricity()+"":""); |
| | | chargingOrderInfoVO.setTotalPower(byId.getPower()!=null?byId.getPower()+"":""); |
| | | chargingOrderInfoVO.setCdElectronic(byId.getCurrent()!=null?byId.getCurrent().setScale(2, BigDecimal.ROUND_HALF_DOWN)+"":""); |
| | | chargingOrderInfoVO.setCdVoltage(byId.getVoltage()!=null?byId.getVoltage().setScale(2, BigDecimal.ROUND_HALF_DOWN)+"":""); |
| | | chargingOrderInfoVO.setSurplus(byId.getTotalElectricity()!=null?byId.getTotalElectricity().setScale(2, BigDecimal.ROUND_HALF_DOWN)+"":""); |
| | | chargingOrderInfoVO.setTotalPower(byId.getPower()!=null?byId.getPower().setScale(2, BigDecimal.ROUND_HALF_DOWN)+"":""); |
| | | if (byId.getAppUserCarId()!=null){ |
| | | List<TAppUserCar> data = appUserCarClient.getCarByIds(Collections.singletonList(byId.getAppUserCarId())).getData(); |
| | | List<TAppUserCar> data = appUserCarClient.getCarByIds(Arrays.asList(byId.getAppUserCarId())).getData(); |
| | | if (!data.isEmpty()){ |
| | | chargingOrderInfoVO.setLicensePlate(data.get(0).getLicensePlate()); |
| | | chargingOrderInfoVO.setVehicleBrand(data.get(0).getVehicleBrand()); |
| | |
| | | // 时段总服务费 |
| | | BigDecimal bigDecimal = new BigDecimal("0"); |
| | | List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, strategyId).orderByDesc(TChargingOrderAccountingStrategy::getStartTime).list(); |
| | | |
| | | for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : list) { |
| | | if (byId.getVipDiscountAmount()!=null){ |
| | | BigDecimal multiply = byId.getVipDiscountAmount().divide(byId.getServiceCharge(), 2) |
| | | .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); |
| | | tChargingOrderAccountingStrategy.setVipDiscount(multiply); |
| | | } |
| | | bigDecimal = bigDecimal.add(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); |
| | | tChargingOrderAccountingStrategy.setVipDiscount( |
| | | tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice() |
| | | .subtract(tChargingOrderAccountingStrategy.getPeriodServicePrice()) |
| | | ); |
| | | tChargingOrderAccountingStrategy.setCouponDiscount( |
| | | tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice() |
| | | .subtract(tChargingOrderAccountingStrategy.getPeriodServicePrice()) |
| | | ); |
| | | |
| | | if (byId.getCouponDiscountAmount()!=null){ |
| | | BigDecimal multiply = byId.getCouponDiscountAmount().divide(byId.getServiceCharge(), 2) |
| | | .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); |
| | | tChargingOrderAccountingStrategy.setCouponDiscount(multiply); |
| | | } |
| | | } |
| | | chargingOrderInfoVO.setList(list); |
| | | return AjaxResult.success(chargingOrderInfoVO); |
| | |
| | | } |
| | | LocalDate sixBefore = PreviousSixMonths.get(); |
| | | //通过siteIds进行sql查询统计 |
| | | List<SixChargingDto> sixChargingDtos = generateLastSixMonths(); |
| | | List<SixChargingDto> chargingDtos = chargingOrderService.charge(sixBefore, siteIds); |
| | | for (SixChargingDto sixChargingDto : sixChargingDtos) { |
| | | for (SixChargingDto chargingDto : chargingDtos) { |
| | | if (sixChargingDto.getMonth().equals(chargingDto.getMonth())){ |
| | | BeanUtils.copyProperties(chargingDto,sixChargingDto); |
| | | } |
| | | } |
| | | |
| | | return R.ok(chargingDtos); |
| | | } |
| | | |
| | | return R.ok(sixChargingDtos); |
| | | |
| | | } |
| | | |
| | | |
| | | public static List<SixChargingDto> generateLastSixMonths() { |
| | | LocalDate today = LocalDate.now(); |
| | | List<SixChargingDto> months = new ArrayList<>(); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM"); |
| | | |
| | | for (int i = 5; i >= 0; i--) { |
| | | LocalDate date = today.minusMonths(i); |
| | | String month = date.format(formatter); |
| | | SixChargingDto sixChargingDto = new SixChargingDto(); |
| | | sixChargingDto.setMonth(month); |
| | | months.add(sixChargingDto); |
| | | } |
| | | |
| | | return months; |
| | | } |
| | | |
| | | @ResponseBody |
| | |
| | | //count近6个月的数据 |
| | | LocalDate sixBefore = PreviousSixMonths.get(); |
| | | List<SixShopDto> sixShopDtos = shoppingOrderService.sixBefore(sixBefore,status); |
| | | return R.ok(sixShopDtos); |
| | | List<SixShopDto> sixChargingDtos = generateLastSixMonths1(); |
| | | for (SixShopDto sixChargingDto : sixChargingDtos) { |
| | | for (SixShopDto chargingDto : sixShopDtos) { |
| | | if (sixChargingDto.getMonth().equals(chargingDto.getMonth())){ |
| | | BeanUtils.copyProperties(chargingDto,sixChargingDto); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | return R.ok(sixChargingDtos); |
| | | } |
| | | |
| | | public static List<SixShopDto> generateLastSixMonths1() { |
| | | LocalDate today = LocalDate.now(); |
| | | List<SixShopDto> months = new ArrayList<>(); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM"); |
| | | |
| | | for (int i = 5; i >= 0; i--) { |
| | | LocalDate date = today.minusMonths(i); |
| | | String month = date.format(formatter); |
| | | SixShopDto sixChargingDto = new SixShopDto(); |
| | | sixChargingDto.setMonth(month); |
| | | months.add(sixChargingDto); |
| | | } |
| | | |
| | | return months; |
| | | } |
| | | |
| | | @ResponseBody |
| | |
| | | List<UploadRealTimeMonitoringData> data1 = uploadRealTimeMonitoringDataClient.getAll(mongoChargingOrderQuery).getData(); |
| | | |
| | | List<ChargingOrderAndUploadRealTimeMonitoringDataDto> dtos = new ArrayList<>(); |
| | | Map<String,ChargingOrderVO> map = new HashMap<>(); |
| | | for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : data1) { |
| | | ChargingOrderAndUploadRealTimeMonitoringDataDto dataDto = new ChargingOrderAndUploadRealTimeMonitoringDataDto(); |
| | | BeanUtils.copyProperties(uploadRealTimeMonitoringData,dataDto); |
| | | ChargingOrderQuery dto = new ChargingOrderQuery(); |
| | | dto.setCode(uploadRealTimeMonitoringData.getTransaction_serial_number()); |
| | | TCharingOrderVO vo = chargingOrderService.chargingOrder(dto); |
| | | ChargingOrderVO chargingOrderVO = vo.getList().getRecords().get(0); |
| | | if (chargingOrderVO!=null) { |
| | | BeanUtils.copyProperties(chargingOrderVO, dataDto); |
| | | if (!vo.getList().getRecords().isEmpty()) { |
| | | ChargingOrderVO chargingOrderVO = vo.getList().getRecords().get(0); |
| | | if (chargingOrderVO != null) { |
| | | BeanUtils.copyProperties(chargingOrderVO, dataDto); |
| | | } |
| | | dtos.add(dataDto); |
| | | }else { |
| | | continue; |
| | | } |
| | | dtos.add(dataDto); |
| | | } |
| | | |
| | | |
| | |
| | | LocalDate mondayThisWeek = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)); |
| | | start = statisticsQueryDto.getStartTime(); |
| | | end = statisticsQueryDto.getEndTime(); |
| | | |
| | | System.out.println("本周一是: " + mondayThisWeek); |
| | | } |
| | | else if (statisticsQueryDto.getDayType()==3){ |
| | |
| | | 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<TChargingOrder> list = chargingOrderService.lambdaQuery().ge(TChargingOrder::getCreateTime, start).le(TChargingOrder::getCreateTime, end).in(TChargingOrder::getSiteId, siteIds).list(); |
| | | List<Long> chargingOrderIds = list.stream().map(TChargingOrder::getId).collect(Collectors.toList()); |
| | | chargingOrderIds.add(-1L); |
| | | //上方饼图 |
| | |
| | | |
| | | //用户标签 |
| | | List<Map<String,Object>> maps = chargingOrderService.getUserTagCount(); |
| | | Map<String,Object> stringObjectMap = new HashMap<>(); |
| | | Long noTagCount = chargingOrderService.countNoTag(); |
| | | stringObjectMap.put("count",noTagCount); |
| | | maps.add(stringObjectMap); |
| | | |
| | | //会员标签 |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getVipCount(); |
| | | |
| | |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | //查询评价分 |
| | | Long aver = chargingOrderService.getAver(siteIds); |
| | | Double aver = chargingOrderService.getAver(siteIds); |
| | | //查询各个分数 |
| | | List<Map<String,Object>> evaluate = chargingOrderService.getLevelEvaluate(siteIds); |
| | | //查询差评回复数 |
| | | Long count = orderEvaluateService.lambdaQuery().isNotNull(TOrderEvaluate::getResponseTime).count(); |
| | | List<Integer> mark = new ArrayList<>(); |
| | | mark.add(1); |
| | | mark.add(2); |
| | | Long count = orderEvaluateService.lambdaQuery().in(TOrderEvaluate::getMark, mark).isNotNull(TOrderEvaluate::getResponseTime).count(); |
| | | TCharingUserEvaluateVO tCharingUserEvaluateVO = new TCharingUserEvaluateVO(); |
| | | tCharingUserEvaluateVO.setAver(aver); |
| | | tCharingUserEvaluateVO.setEvaluate(evaluate); |
| | |
| | | //将capMap的chargingCapacity除以totalRatedPower保留两位数 |
| | | capMap.forEach(map -> { |
| | | BigDecimal chargingCapacity = (BigDecimal) map.get("chargingCapacity"); |
| | | BigDecimal result = chargingCapacity.divide(totalRatedPower, 2, RoundingMode.HALF_UP); |
| | | map.put("chargingCapacity", result); |
| | | BigDecimal result = chargingCapacity.divide(totalRatedPower, 4, RoundingMode.HALF_UP); |
| | | BigDecimal multiply = result.multiply(new BigDecimal(100)); |
| | | map.put("chargingCapacity", multiply); |
| | | }); |
| | | |
| | | |