package com.matrix.system.shopXcx.api.action;
|
|
import com.matrix.component.redis.RedisUserLoginUtils;
|
import com.matrix.core.pojo.AjaxResult;
|
import com.matrix.core.pojo.PaginationVO;
|
import com.matrix.system.common.interceptor.HostInterceptor;
|
import com.matrix.system.shopXcx.api.service.WxShopCouponService;
|
import com.matrix.system.shopXcx.dao.ShopCouponDao;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.*;
|
|
/**
|
* @author jyy
|
* @description 优惠券
|
* @date 2019-06-12 15:17
|
*/
|
@Controller
|
@RequestMapping(value = "wxapi/shopCoupon")
|
public class WxShopCouponAction {
|
|
@Autowired
|
private WxShopCouponService shopCouponService;
|
|
@Autowired
|
private ShopCouponDao shopCouponDao;
|
@Autowired
|
private RedisUserLoginUtils redisUserLoginUtils;
|
|
/**
|
* 获取可以领取的优惠券
|
*
|
* @return
|
*/
|
@RequestMapping(value = "getUsableCoupon")
|
@ResponseBody
|
public AjaxResult getUsableCoupon(@RequestBody PaginationVO pageVo) {
|
|
pageVo.setSort("update_time");
|
pageVo.setOrder("desc");
|
return shopCouponService.getUsableCoupon(pageVo);
|
}
|
|
/**
|
* 领取优惠券
|
*
|
* @param couponId 优惠券ID
|
* @return
|
*/
|
@GetMapping(value = "receiveCoupon/{couponId}")
|
@ResponseBody
|
public AjaxResult receiveCoupon(@PathVariable("couponId") Integer couponId) {
|
return shopCouponService.receiveCoupon(couponId);
|
}
|
|
/**
|
* 根据优惠券状态查询我的优惠券信息(1=已使用;2=待使用;3=过期)
|
*
|
* @return
|
*/
|
@RequestMapping(value = "getMyCouponInfoByStatus/{status}")
|
@ResponseBody
|
public AjaxResult getMyCouponInfo(@PathVariable("status") Integer status, @RequestBody PaginationVO pageVo) {
|
|
return shopCouponService.getMyCouponInfoByStatus(HostInterceptor.getCompanyId(),status, pageVo);
|
}
|
|
/**
|
* 根据产品id获取可用的优惠券列表
|
*
|
* @return
|
*/
|
@GetMapping(value = "getCouponListByProductId/{productId}")
|
@ResponseBody
|
public AjaxResult getCouponListByProductId(@PathVariable("productId") int productId) {
|
return new AjaxResult(AjaxResult.STATUS_SUCCESS, shopCouponService.getCouponListByProductId(productId));
|
}
|
|
@GetMapping(value = "getCouponListByTag/{tag}")
|
@ResponseBody
|
public AjaxResult getCouponListByTag(@PathVariable("tag") String tag) {
|
return shopCouponService.getCouponListByTag(tag, HostInterceptor.getCompanyId());
|
}
|
|
}
|