zhibing.pu
2024-09-07 4fd0278cda787a91eb35d95d6491f5485afe3e48
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java
@@ -65,15 +65,30 @@
    private TAppUserCarService appUserCarService;
    @Autowired
    private TokenService tokenService;
    @Autowired
    @Resource
    private ChargingPileClient chargingPileClient;
    @Autowired
    @Resource
    private ChargingOrderClient chargingOrderClient;
    @Resource
    private ChargingGunClient chargingGunClient;
    @Autowired
    private TAppUserTagService appUserTagService;
    @Autowired
    private TAppUserService appUserService;
    /**
     * 后台退款 回退优惠券使用状态
     * @return
     */
    @PostMapping(value = "/refund/{id}")
    public R refund(@PathVariable("id") String id) {
        TAppCoupon byId = tAppCouponService.getById(id);
        byId.setStatus(1);
        tAppCouponService.updateById(byId);
        return R.ok();
    }
    /**
     * 小程序扫一扫 添加车辆
     * @param dto
@@ -192,16 +207,13 @@
    }
    @ApiOperation(value = "优惠卷可用数量", tags = {"小程序-站点管理-站点详情"})
    @PostMapping(value = "/couponCount")
    @GetMapping(value = "/couponCount")
    public R<Long> couponCount() {
        LocalDateTime now = LocalDateTime.now();
        return R.ok(tAppCouponService.lambdaQuery().le(TAppCoupon::getStartTime, now).ge(TAppCoupon::getEndTime, now).eq(TAppCoupon::getStatus, 1).count());
    }
    @Autowired
    private TAppUserTagService appUserTagService;
    @Autowired
    private TAppUserService appUserService;
    /**
     * 后台远程调用 给用户发放优惠券
@@ -265,5 +277,17 @@
        return R.ok();
    }
    /**
     * 根据id获取优惠券领取记录
     * @param id
     * @return
     */
    @PostMapping("/getAppCouponById")
    public R<TAppCoupon> getAppCouponById(@RequestParam("id") Long id){
        TAppCoupon appCoupon = tAppCouponService.getById(id);
        return R.ok(appCoupon);
    }
}