|
@@ -5,9 +5,9 @@ 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.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
-import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
|
|
import com.kym.common.exception.BusinessException;
|
|
import com.kym.common.exception.BusinessException;
|
|
|
import com.kym.common.utils.CommUtil;
|
|
import com.kym.common.utils.CommUtil;
|
|
|
|
|
+import com.kym.common.utils.HttpUtil;
|
|
|
import com.kym.entity.admin.Activity;
|
|
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;
|
|
@@ -16,6 +16,7 @@ import com.kym.entity.admin.queryParams.StatQueryParam;
|
|
|
import com.kym.entity.admin.vo.CustomOrderVo;
|
|
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.common.RedisKeys;
|
|
|
import com.kym.entity.miniapp.ChargeOrder;
|
|
import com.kym.entity.miniapp.ChargeOrder;
|
|
|
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;
|
|
@@ -30,8 +31,12 @@ import com.kym.service.miniapp.UserRechargeRightsService;
|
|
|
import com.kym.service.mybatisplus.MyBaseServiceImpl;
|
|
import com.kym.service.mybatisplus.MyBaseServiceImpl;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.SneakyThrows;
|
|
import lombok.SneakyThrows;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import okhttp3.Headers;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
|
+import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
@@ -54,6 +59,7 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
*/
|
|
|
@Service
|
|
@Service
|
|
|
@DS("db-miniapp")
|
|
@DS("db-miniapp")
|
|
|
|
|
+@Slf4j
|
|
|
public class ChargeOrderServiceImpl extends MyBaseServiceImpl<ChargeOrderMapper, ChargeOrder> implements ChargeOrderService {
|
|
public class ChargeOrderServiceImpl extends MyBaseServiceImpl<ChargeOrderMapper, ChargeOrder> implements ChargeOrderService {
|
|
|
|
|
|
|
|
|
|
|
|
@@ -63,16 +69,21 @@ public class ChargeOrderServiceImpl extends MyBaseServiceImpl<ChargeOrderMapper,
|
|
|
private final StationStatDayService stationStatDayService;
|
|
private final StationStatDayService stationStatDayService;
|
|
|
private final StationStatMonthService stationStatMonthService;
|
|
private final StationStatMonthService stationStatMonthService;
|
|
|
|
|
|
|
|
|
|
+ private final StringRedisTemplate redisTemplate;
|
|
|
|
|
+ @Value("${en-plus.sassClose}")
|
|
|
|
|
+ public String saasClose;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
public ChargeOrderServiceImpl(ExportService exportService, @Lazy UserCouponService userCouponService, UserRechargeRightsService userRechargeRightsService,
|
|
public ChargeOrderServiceImpl(ExportService exportService, @Lazy UserCouponService userCouponService, UserRechargeRightsService userRechargeRightsService,
|
|
|
- StationStatDayService stationStatDayService, StationStatMonthService stationStatMonthService) {
|
|
|
|
|
|
|
+ StationStatDayService stationStatDayService, StationStatMonthService stationStatMonthService, StringRedisTemplate redisTemplate) {
|
|
|
this.exportService = exportService;
|
|
this.exportService = exportService;
|
|
|
this.userCouponService = userCouponService;
|
|
this.userCouponService = userCouponService;
|
|
|
this.userRechargeRightsService = userRechargeRightsService;
|
|
this.userRechargeRightsService = userRechargeRightsService;
|
|
|
this.stationStatDayService = stationStatDayService;
|
|
this.stationStatDayService = stationStatDayService;
|
|
|
this.stationStatMonthService = stationStatMonthService;
|
|
this.stationStatMonthService = stationStatMonthService;
|
|
|
|
|
+ this.redisTemplate = redisTemplate;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public ChargeOrder getChargingOrderByUserId(Long userId) {
|
|
public ChargeOrder getChargingOrderByUserId(Long userId) {
|
|
|
return lambdaQuery()
|
|
return lambdaQuery()
|
|
@@ -210,6 +221,16 @@ public class ChargeOrderServiceImpl extends MyBaseServiceImpl<ChargeOrderMapper,
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void closeChargeOrder(String startChargeSeq) {
|
|
|
|
|
+ Headers headers = Headers.of("satoken", redisTemplate.opsForValue().get(RedisKeys.EN_PLUS_SASS_TOKEN));
|
|
|
|
|
+ var res = HttpUtil.parseJson(HttpUtil.post(saasClose + startChargeSeq, headers));
|
|
|
|
|
+ if (!(res.containsKey("success") && res.getBoolean("success"))) {
|
|
|
|
|
+ log.error("关闭订单失败:{}", res);
|
|
|
|
|
+ throw new BusinessException("关闭订单失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 站点统计
|
|
* 站点统计
|