| | |
| | | import com.ruoyi.account.api.vo.ExchangeRecordVO; |
| | | import com.ruoyi.account.service.TAppCouponService; |
| | | import com.ruoyi.account.service.TAppUserCarService; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.vo.SiteInfoVO; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public class TAppCouponController { |
| | | @Autowired |
| | | private TAppCouponService tAppCouponService; |
| | | @Autowired |
| | | private OtherClient otherClient; |
| | | |
| | | @Autowired |
| | | private TAppUserCarService appUserCarService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private ChargingPileClient chargingPileClient; |
| | | @Autowired |
| | | private ChargingOrderClient chargingOrderClient; |
| | | /** |
| | | * 查询用户可用优惠券数量 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "通过桩编号获取电站详情", tags = {"小程序-扫一扫"}) |
| | | @GetMapping(value = "/scan/siteInfo") |
| | | public AjaxResult<SiteInfoVO> siteInfo(String number) { |
| | | SiteInfoVO data = chargingPileClient.getSiteInfoByNumber(number).getData(); |
| | | List<TAppUserCar> cars = appUserCarService.list(new QueryWrapper<TAppUserCar>() |
| | | .eq("app_user_id",tokenService.getLoginUserApplet().getUserId()) |
| | | .orderByDesc("create_time")); |
| | | Long data1 = chargingOrderClient.getCar().getData(); |
| | | if (!cars.isEmpty()){ |
| | | if (data1 == -1){ |
| | | // 没有充电订单 展示最新添加的车辆 |
| | | data.setLicensePlate(cars.get(0).getLicensePlate()); |
| | | data.setVehicleBrand(cars.get(0).getVehicleBrand()); |
| | | data.setId(cars.get(0).getId()); |
| | | }else{ |
| | | for (TAppUserCar car : cars) { |
| | | if (car.getId().equals(data1)){ |
| | | data.setLicensePlate(car.getLicensePlate()); |
| | | data.setVehicleBrand(car.getVehicleBrand()); |
| | | data.setId(car.getId()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.ok(data); |
| | | } |
| | | /** |
| | | * 查询用户可用优惠券数量 |
| | | * @param dto |
| | |
| | | return AjaxResult.ok(res); |
| | | } |
| | | /** |
| | | * 选择车辆列表 |
| | | * 选择车辆列表 远程调用 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "选择车辆列表", tags = {"小程序-扫一扫"}) |
| | | @PostMapping(value = "/scan/carList") |
| | | public AjaxResult<List<TAppUserCar>> carList() { |
| | | // todo 用户id |
| | | public R<List<TAppUserCar>> carList() { |
| | | List<TAppUserCar> appUserId = appUserCarService.list(new QueryWrapper<TAppUserCar>() |
| | | .eq("app_user_id",tokenService.getLoginUserApplet().getUserId())); |
| | | return AjaxResult.ok(appUserId); |
| | | return R.ok(appUserId); |
| | | } |
| | | |
| | | /** |