Pu Zhibing
9 小时以前 187155d0e0ae19d4846372e196afb9f4a4e2652e
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java
@@ -15,9 +15,11 @@
import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient;
import com.ruoyi.chargingPile.api.model.TChargingGun;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.common.core.utils.ServletUtils;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.log.enums.OperatorType;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.other.api.vo.CouponListVOVO;
import com.ruoyi.account.api.vo.ExchangeRecordVO;
import com.ruoyi.account.service.TAppCouponService;
@@ -115,28 +117,33 @@
        data.setChargingGunId(id);
        data.setSiteId(chargingGun.getSiteId());
        data.setChargeMode(chargingGun.getChargeMode());
        List<TAppUserCar> cars = appUserCarService.list(new QueryWrapper<TAppUserCar>()
                .eq("app_user_id",tokenService.getLoginUserApplet().getUserId())
                .orderByDesc("create_time"));
        Long data1 = chargingOrderClient.getCar(tokenService.getLoginUserApplet().getUserId().toString()).getData();
        Integer data2 = otherClient.getAddCarIntegral().getData();
        data.setIntegral(data2);
        if (!cars.isEmpty()){
            if (null == data1 || data1 == -1){
                // 没有充电订单 展示最新添加的车辆
                data.setLicensePlate(cars.get(0).getLicensePlate());
                data.setVehicleBrand(cars.get(0).getVehicleBrand());
                data.setId(cars.get(0).getId().toString());
            }else{
                for (TAppUserCar car : cars) {
                    if (car.getId().equals(data1)){
                        data.setLicensePlate(car.getLicensePlate());
                        data.setVehicleBrand(car.getVehicleBrand());
                        data.setId(car.getId().toString());
        String token = SecurityUtils.getToken(ServletUtils.getRequest());
        if(com.ruoyi.common.core.utils.StringUtils.isNotEmpty(token)){
            List<TAppUserCar> cars = appUserCarService.list(new QueryWrapper<TAppUserCar>()
                    .eq("app_user_id",tokenService.getLoginUserApplet().getUserId())
                    .orderByDesc("create_time"));
            Long data1 = chargingOrderClient.getCar(tokenService.getLoginUserApplet().getUserId().toString()).getData();
            if (!cars.isEmpty()){
                if (null == data1 || data1 == -1){
                    // 没有充电订单 展示最新添加的车辆
                    data.setLicensePlate(cars.get(0).getLicensePlate());
                    data.setVehicleBrand(cars.get(0).getVehicleBrand());
                    data.setId(cars.get(0).getId().toString());
                }else{
                    for (TAppUserCar car : cars) {
                        if (car.getId().equals(data1)){
                            data.setLicensePlate(car.getLicensePlate());
                            data.setVehicleBrand(car.getVehicleBrand());
                            data.setId(car.getId().toString());
                        }
                    }
                }
            }
        }
        Integer data2 = otherClient.getAddCarIntegral().getData();
        data.setIntegral(data2);
        BigDecimal electrovalence = data.getElectrovalence();
        BigDecimal vipElectrovalence = data.getVipElectrovalence();
        // 计算预付金额能充多少度普通电