ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserVipDetail.java
@@ -69,7 +69,7 @@ @ApiModelProperty(value = "会员结束时间") @TableField("end_time") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private LocalDateTime endTime; @TableField("create_time") ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java
@@ -225,7 +225,9 @@ */ @PostMapping("/grantCoupon") public R grantCoupon(@RequestBody GrantCouponDto dto){ if (dto.getWaysToObtain()==null){ dto.setWaysToObtain(3); } List<TAppCoupon> res = new ArrayList<>(); TCoupon coupon = otherClient.getCouponById(dto.getCouponId()).getData(); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -332,6 +332,13 @@ appUser.setLastDays( Duration.between(LocalDateTime.now(), appUser.getVipEndTime()).toDays()); appUser.setUid(appUser.getId().toString()); TAppUserCar one1 = appUserCarService.lambdaQuery().eq(TAppUserCar::getAppUserId, appUser.getId()).orderByDesc(BasePojo::getCreateTime).last("limit 1").one(); if (one1!=null){ CarNumDto carNumDto = CarUtil.carNum(one1.getLicensePlate()); appUser.setPlace(carNumDto.getProvince()+carNumDto.getCity()); } } return R.ok(page); } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -618,10 +618,36 @@ } 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 @@ -655,7 +681,33 @@ //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 @@ -792,13 +844,15 @@ // 获取本周一的日期 LocalDate mondayThisWeek = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)); start = statisticsQueryDto.getStartTime(); end = statisticsQueryDto.getEndTime(); System.out.println("本周一是: " + mondayThisWeek); } else if (statisticsQueryDto.getDayType()==3){ // 获取当前日期 LocalDate today = LocalDate.now(); start = statisticsQueryDto.getStartTime(); end = statisticsQueryDto.getEndTime(); // 获取本月1号的日期 YearMonth yearMonth = YearMonth.from(today); // start = yearMonth.atDay(1); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/PayOrderDto.java
@@ -26,6 +26,7 @@ private Integer status; @ApiModelProperty("订单金额") private Double orderAmount; private Double rechargeAmount; @ApiModelProperty("支付金额") private Double paymentAmount; @ApiModelProperty("下单时间") ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -1154,6 +1154,16 @@ public R<PageInfo<PayOrderDto>> payOrderQuery(PayOrderQueryDto payOrderQueryDto) { PageInfo<PayOrderDto> pageInfo = new PageInfo<>(payOrderQueryDto.getPageCurr(),payOrderQueryDto.getPageSize()); List<PayOrderDto> list = this.baseMapper.payOrderQuery(pageInfo,payOrderQueryDto); for (PayOrderDto payOrderDto : list) { if (payOrderDto.getType()==2||payOrderDto.getType()==3){ payOrderDto.setFinalAmount(payOrderDto.getOrderAmount()); } if (payOrderDto.getType()==1&&payOrderDto.getStatus()==3){ payOrderDto.setFinalAmount(payOrderDto.getRechargeAmount()); payOrderDto.setOrderAmount(payOrderDto.getRechargeAmount()); payOrderDto.setPaymentAmount(payOrderDto.getRechargeAmount()); } } pageInfo.setRecords(list); return R.ok(pageInfo); } @@ -1937,7 +1947,7 @@ } @Override public List<Map<String, Object>> usersByQuery1(ChargingStatisticsQueryDto statisticsQueryDto) { return this.baseMapper.usersByQuery(statisticsQueryDto); return this.baseMapper.usersByQuery1(statisticsQueryDto); } @Override @@ -2001,7 +2011,7 @@ chargingOrderRefund.setRefundTitle("后台退款"); chargingOrderRefund.setRefundContent("后台退款"); chargingOrderRefund.setRefundReason("后台退款"); chargingOrderRefund.setRefundRemark("后台退款"); chargingOrderRefund.setRefundRemark(payOrderQueryDto.getRemark()); chargingOrderRefund.setRefundTotalAmount(tChargingOrder.getRefundAmount().add(payOrderQueryDto.getRefundAmount())); chargingOrderRefund.setPayAmount(tChargingOrder.getPaymentAmount()); @@ -2062,7 +2072,7 @@ chargingOrderRefund.setRefundTitle("后台退款"); chargingOrderRefund.setRefundContent("后台退款"); chargingOrderRefund.setRefundReason("后台退款"); chargingOrderRefund.setRefundRemark("后台退款"); chargingOrderRefund.setRefundRemark(payOrderQueryDto.getRemark()); chargingOrderRefund.setRefundTotalAmount(tChargingOrder.getRefundAmount().add(payOrderQueryDto.getRefundAmount())); chargingOrderRefund.setPayAmount(tChargingOrder.getPaymentAmount()); ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -117,6 +117,7 @@ title, `status`, order_amount, recharge_amount, payment_amount , create_time, end_time, @@ -377,7 +378,7 @@ type, SUM( charging_capacity ) as charging_capacity , SUM( period_service_price ) as period_electric_price, SUM(period_electric_price+period_service_price) as total_amount SUM(period_electric_price) as total_amount FROM t_charging_order_accounting_strategy <where> @@ -394,9 +395,9 @@ <select id="getDateData" resultType="java.util.Map"> SELECT DATE_FORMAT( create_time, '%Y-%m-%d %H' ) as time, SUM(service_charge) as servicecharge, SUM(electrovalence) as electrovalence, SUM(payment_amount) AS paymentAmount, CAST(SUM(service_charge-coupon_discount_amount) AS DECIMAL(20, 6)) as servicecharge, CAST(SUM(charging_capacity) AS DECIMAL(20, 6)) as electrovalence, CAST(SUM(electrovalence) AS DECIMAL(20, 4)) AS paymentAmount, count(1) as orderCount FROM t_charging_order @@ -418,9 +419,9 @@ <select id="getWeekData" resultType="java.util.Map"> SELECT DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, SUM(service_charge) as servicecharge, SUM(electrovalence) as electrovalence, SUM(payment_amount) AS paymentAmount, SUM(service_charge-coupon_discount_amount) as servicecharge, SUM(charging_capacity) as electrovalence, SUM(electrovalence) AS paymentAmount, count(1) as orderCount FROM t_charging_order @@ -442,9 +443,9 @@ <select id="getMonthData" resultType="java.util.Map"> SELECT DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, SUM(service_charge) as servicecharge, SUM(electrovalence) as electrovalence, SUM(payment_amount) AS paymentAmount, SUM(service_charge-coupon_discount_amount) as servicecharge, SUM(charging_capacity) as electrovalence, SUM(electrovalence) AS paymentAmount, count(1) as orderCount FROM t_charging_order @@ -466,9 +467,9 @@ <select id="getYearData" resultType="java.util.Map"> SELECT DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, SUM(service_charge) as servicecharge, SUM(electrovalence) as electrovalence, SUM(payment_amount) AS paymentAmount, SUM(service_charge-coupon_discount_amount) as servicecharge, SUM(charging_capacity) as electrovalence, SUM(electrovalence) AS paymentAmount, count(1) as orderCount FROM @@ -492,8 +493,8 @@ <select id="getByDate" resultType="java.util.Map"> SELECT DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, SUM(service_charge) as servicecharge, SUM(electrovalence) as electrovalence, SUM(service_charge-coupon_discount_amount) as servicecharge, SUM(charging_capacity) as electrovalence, count(1) as orderCount FROM t_charging_order @@ -560,11 +561,11 @@ </select> <select id="queryPowerLevel" resultType="java.util.Map"> SELECT count(CASE WHEN power BETWEEN 0 AND 30 THEN 1 ELSE 0 END) AS count_0_30, count(CASE WHEN power BETWEEN 31 AND 60 THEN 1 ELSE 0 END) AS count_31_60, count(CASE WHEN power BETWEEN 61 AND 120 THEN 1 ELSE 0 END) AS count_61_120, count(CASE WHEN power BETWEEN 121 AND 300 THEN 1 ELSE 0 END) AS count_121_300, count(CASE WHEN power > 300 THEN 1 ELSE 0 END) AS count_above_300 SUM(CASE WHEN power BETWEEN 0 AND 30 THEN 1 ELSE 0 END) AS count_0_30, SUM(CASE WHEN power BETWEEN 31 AND 60 THEN 1 ELSE 0 END) AS count_31_60, SUM(CASE WHEN power BETWEEN 61 AND 120 THEN 1 ELSE 0 END) AS count_61_120, SUM(CASE WHEN power BETWEEN 121 AND 300 THEN 1 ELSE 0 END) AS count_121_300, SUM(CASE WHEN power > 300 THEN 1 ELSE 0 END) AS count_above_300 FROM t_charging_order WHERE @@ -576,25 +577,25 @@ #{siteId} </foreach> </if> <if test="statisticsQueryDto.dayType =1"> <if test="statisticsQueryDto.dayType ==1"> AND DATE(create_time) = CURDATE() </if> <if test="statisticsQueryDto.dayType =2"> <if test="statisticsQueryDto.dayType ==2"> AND WEEKOFYEAR(create_time) = WEEKOFYEAR(CURDATE()) </if> <if test="statisticsQueryDto.dayType =3"> <if test="statisticsQueryDto.dayType ==3"> AND MONTH(create_time) = MONTH(CURDATE()) </if> <if test="statisticsQueryDto.dayType =4"> <if test="statisticsQueryDto.dayType ==4"> AND YEAR(create_time) = YEAR(CURDATE()) </if> <if test="statisticsQueryDto.dayType =5"> <if test="statisticsQueryDto.startTime != null"> <if test="statisticsQueryDto.dayType ==5"> AND create_time >= #{statisticsQueryDto.startTime} </if> <if test="statisticsQueryDto.endTime != null"> AND create_time <= #{statisticsQueryDto.endTime} </if> </if> </select> @@ -602,7 +603,7 @@ SELECT DATE_FORMAT( create_time, '%Y-%m-%d %H' ) AS time, DATE_FORMAT( create_time, '%H:00' ) AS time, count(1) AS counts FROM charging_pile_account.t_app_user