|
@@ -4,11 +4,11 @@ import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.poi.excel.ExcelUtil;
|
|
import cn.hutool.poi.excel.ExcelUtil;
|
|
|
import cn.hutool.poi.excel.ExcelWriter;
|
|
import cn.hutool.poi.excel.ExcelWriter;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
-import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
|
|
+import com.kym.common.exception.BusinessException;
|
|
|
import com.kym.common.utils.CommUtil;
|
|
import com.kym.common.utils.CommUtil;
|
|
|
-import com.kym.entity.admin.RechargeRights;
|
|
|
|
|
|
|
+import com.kym.entity.admin.Activity;
|
|
|
import com.kym.entity.admin.StationStatDay;
|
|
import com.kym.entity.admin.StationStatDay;
|
|
|
import com.kym.entity.admin.StationStatMonth;
|
|
import com.kym.entity.admin.StationStatMonth;
|
|
|
import com.kym.entity.admin.queryParams.CustomChargeOrdersQueryParam;
|
|
import com.kym.entity.admin.queryParams.CustomChargeOrdersQueryParam;
|
|
@@ -17,20 +17,20 @@ import com.kym.entity.admin.vo.CustomOrderVo;
|
|
|
import com.kym.entity.admin.vo.StationStatVo;
|
|
import com.kym.entity.admin.vo.StationStatVo;
|
|
|
import com.kym.entity.common.PageBean;
|
|
import com.kym.entity.common.PageBean;
|
|
|
import com.kym.entity.miniapp.ChargeOrder;
|
|
import com.kym.entity.miniapp.ChargeOrder;
|
|
|
-import com.kym.entity.miniapp.OrderRechargeRights;
|
|
|
|
|
import com.kym.entity.miniapp.queryParams.OrderQueryParams;
|
|
import com.kym.entity.miniapp.queryParams.OrderQueryParams;
|
|
|
import com.kym.entity.miniapp.vo.ChargeOrderVo;
|
|
import com.kym.entity.miniapp.vo.ChargeOrderVo;
|
|
|
import com.kym.mapper.miniapp.ChargeOrderMapper;
|
|
import com.kym.mapper.miniapp.ChargeOrderMapper;
|
|
|
import com.kym.service.admin.ExportService;
|
|
import com.kym.service.admin.ExportService;
|
|
|
-import com.kym.service.admin.RechargeRightsService;
|
|
|
|
|
import com.kym.service.admin.StationStatDayService;
|
|
import com.kym.service.admin.StationStatDayService;
|
|
|
import com.kym.service.admin.StationStatMonthService;
|
|
import com.kym.service.admin.StationStatMonthService;
|
|
|
import com.kym.service.cache.KymCache;
|
|
import com.kym.service.cache.KymCache;
|
|
|
import com.kym.service.miniapp.ChargeOrderService;
|
|
import com.kym.service.miniapp.ChargeOrderService;
|
|
|
-import com.kym.service.miniapp.OrderRechargeRightsService;
|
|
|
|
|
|
|
+import com.kym.service.miniapp.UserCouponService;
|
|
|
|
|
+import com.kym.service.miniapp.UserRechargeRightsService;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.SneakyThrows;
|
|
import lombok.SneakyThrows;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
@@ -57,16 +57,16 @@ public class ChargeOrderServiceImpl extends MPJBaseServiceImpl<ChargeOrderMapper
|
|
|
|
|
|
|
|
|
|
|
|
|
private final ExportService exportService;
|
|
private final ExportService exportService;
|
|
|
- private final OrderRechargeRightsService orderRechargeRightsService;
|
|
|
|
|
- private final RechargeRightsService rechargeRightsService;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ private final UserCouponService userCouponService;
|
|
|
|
|
+ private final UserRechargeRightsService userRechargeRightsService;
|
|
|
private final StationStatDayService stationStatDayService;
|
|
private final StationStatDayService stationStatDayService;
|
|
|
private final StationStatMonthService stationStatMonthService;
|
|
private final StationStatMonthService stationStatMonthService;
|
|
|
|
|
|
|
|
- public ChargeOrderServiceImpl(ExportService exportService, OrderRechargeRightsService orderRechargeRightsService, RechargeRightsService rechargeRightsService, StationStatDayService stationStatDayService, StationStatMonthService stationStatMonthService) {
|
|
|
|
|
|
|
+ public ChargeOrderServiceImpl(ExportService exportService, @Lazy UserCouponService userCouponService, UserRechargeRightsService userRechargeRightsService,
|
|
|
|
|
+ StationStatDayService stationStatDayService, StationStatMonthService stationStatMonthService) {
|
|
|
this.exportService = exportService;
|
|
this.exportService = exportService;
|
|
|
- this.orderRechargeRightsService = orderRechargeRightsService;
|
|
|
|
|
- this.rechargeRightsService = rechargeRightsService;
|
|
|
|
|
|
|
+ this.userCouponService = userCouponService;
|
|
|
|
|
+ this.userRechargeRightsService = userRechargeRightsService;
|
|
|
this.stationStatDayService = stationStatDayService;
|
|
this.stationStatDayService = stationStatDayService;
|
|
|
this.stationStatMonthService = stationStatMonthService;
|
|
this.stationStatMonthService = stationStatMonthService;
|
|
|
}
|
|
}
|
|
@@ -185,18 +185,30 @@ public class ChargeOrderServiceImpl extends MPJBaseServiceImpl<ChargeOrderMapper
|
|
|
// 订单对应的优惠信息
|
|
// 订单对应的优惠信息
|
|
|
var orderVo = new ChargeOrderVo();
|
|
var orderVo = new ChargeOrderVo();
|
|
|
BeanUtils.copyProperties(chargeOrder, orderVo);
|
|
BeanUtils.copyProperties(chargeOrder, orderVo);
|
|
|
- if (chargeOrder.getDiscountAmount() > 0) {
|
|
|
|
|
- // 充值权益
|
|
|
|
|
- var orderRechargeRight = orderRechargeRightsService.lambdaQuery().eq(OrderRechargeRights::getStartChargeSeq, startChargeSeq).one();
|
|
|
|
|
- DynamicDataSourceContextHolder.push("db-admin");
|
|
|
|
|
- var rechargeRights = rechargeRightsService.lambdaQuery().eq(RechargeRights::getId, orderRechargeRight.getRightsId()).one();
|
|
|
|
|
- DynamicDataSourceContextHolder.poll();
|
|
|
|
|
- var desc = rechargeRights.getRightsDesc();
|
|
|
|
|
- orderVo.setRightsDesc(desc);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // todo 修改成只显示优惠金额,具体优惠信息点击详情查看具体权益卡/优惠券
|
|
|
|
|
+// if (chargeOrder.getDiscountAmount() > 0) {
|
|
|
|
|
+// // 充值权益
|
|
|
|
|
+// var orderRechargeRight = orderRechargeRightsService.lambdaQuery().eq(OrderRechargeRights::getStartChargeSeq, startChargeSeq).one();
|
|
|
|
|
+// DynamicDataSourceContextHolder.push("db-admin");
|
|
|
|
|
+// var rechargeRights = rechargeRightsService.lambdaQuery().eq(RechargeRights::getId, orderRechargeRight.getRightsId()).one();
|
|
|
|
|
+// DynamicDataSourceContextHolder.poll();
|
|
|
|
|
+// var desc = rechargeRights.getRightsDesc();
|
|
|
|
|
+// orderVo.setRightsDesc(desc);
|
|
|
|
|
+// }
|
|
|
return orderVo;
|
|
return orderVo;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Object orderDiscountDetail(String startChargeSeq, String discountType) {
|
|
|
|
|
+ return switch (discountType) {
|
|
|
|
|
+ case Activity.DISCOUNT_TYPE_服务费折扣权益 -> userRechargeRightsService.getUserRechargeRights(startChargeSeq);
|
|
|
|
|
+ case Activity.DISCOUNT_TYPE_优惠券 -> userCouponService.getUserCoupon(startChargeSeq);
|
|
|
|
|
+ default -> throw new BusinessException("未知的优惠类型");
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 站点统计
|
|
* 站点统计
|
|
|
*
|
|
*
|