| | |
| | | } |
| | | } |
| | | //获取当前购物车产品可用的优惠券 |
| | | List<CouponReceiveInfoVO> usefulCoupon = wxShopCouponService.getCartVoCouponList(addShopOrderPOJO.getShopId(),notCouponuyCart); |
| | | List<CouponReceiveInfoVO> usefulCoupon = wxShopCouponService.getCartVoCouponList(HostInterceptor.getCompanyId(),notCouponuyCart); |
| | | |
| | | //获取用户使用的优惠券 |
| | | CouponReceiveInfoVO shopCoupon = new CouponReceiveInfoVO(); |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "getMyCouponInfoByStatus/{shopId}/{status}") |
| | | @RequestMapping(value = "getMyCouponInfoByStatus/{status}") |
| | | @ResponseBody |
| | | public AjaxResult getMyCouponInfo(@PathVariable("shopId") Long shopId,@PathVariable("status") Integer status, @RequestBody PaginationVO pageVo) { |
| | | public AjaxResult getMyCouponInfo(@PathVariable("status") Integer status, @RequestBody PaginationVO pageVo) { |
| | | |
| | | return shopCouponService.getMyCouponInfoByStatus(shopId,status, pageVo); |
| | | return shopCouponService.getMyCouponInfoByStatus(HostInterceptor.getCompanyId(),status, pageVo); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 根据状态获取我的优惠券 |
| | | * |
| | | * |
| | | * @param shopId |
| | | * @param companyId |
| | | * @param status |
| | | * @param pageVo |
| | | * @return |
| | | */ |
| | | AjaxResult getMyCouponInfoByStatus(Long shopId, Integer status, PaginationVO pageVo); |
| | | AjaxResult getMyCouponInfoByStatus(Long companyId, Integer status, PaginationVO pageVo); |
| | | |
| | | /** |
| | | * 根据产品ID获取优惠券列表 |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | public List<CouponReceiveInfoVO> getCartVoCouponList(Long shopId,List<ShopShoppingCart> shopShoppingCarts) { |
| | | public List<CouponReceiveInfoVO> getCartVoCouponList(Long companyId,List<ShopShoppingCart> shopShoppingCarts) { |
| | | |
| | | //可用优惠券列表 |
| | | List<CouponReceiveInfoVO> shopCoupons = new ArrayList<>(); |
| | |
| | | |
| | | BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | //1.找到用户所有的优惠券 |
| | | List<CouponReceiveInfoVO> userAllCoupon = shopCouponRecordDao.selectMyCouponByStatus(shopId, bizUser.getOpenId(), AppConstance.MY_COUPON_NOT_USE, |
| | | List<CouponReceiveInfoVO> userAllCoupon = shopCouponRecordDao.selectMyCouponByStatus(companyId, bizUser.getOpenId(), AppConstance.MY_COUPON_NOT_USE, |
| | | null); |
| | | if (CollectionUtils.isNotEmpty(userAllCoupon)) { |
| | | //根据优惠力度排序,优惠力度大的先参与计算 |
| | |
| | | * 根据订单状态查询优惠券列表 |
| | | * |
| | | * |
| | | * @param shopId |
| | | * @param companyId |
| | | * @param status 1=已使用;2=未使用;3=过期 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public AjaxResult getMyCouponInfoByStatus(Long shopId, Integer status, PaginationVO pageVo) { |
| | | public AjaxResult getMyCouponInfoByStatus(Long companyId, Integer status, PaginationVO pageVo) { |
| | | BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | // 如果查询使用或未使用状态的优惠券列表 |
| | | if (AppConstance.MY_COUPON_USE.equals(status) || AppConstance.MY_COUPON_NOT_USE.equals(status)) { |
| | | List<CouponReceiveInfoVO> list = shopCouponRecordDao.selectMyCouponByStatus(shopId,bizUser.getOpenId(), status, |
| | | List<CouponReceiveInfoVO> list = shopCouponRecordDao.selectMyCouponByStatus(companyId,bizUser.getOpenId(), status, |
| | | pageVo); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, list); |
| | | } |
| | | List<CouponReceiveInfoVO> list = shopCouponRecordDao.selectMyPastCoupon(shopId,bizUser.getOpenId(), pageVo); |
| | | List<CouponReceiveInfoVO> list = shopCouponRecordDao.selectMyPastCoupon(companyId,bizUser.getOpenId(), pageVo); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, list); |
| | | } |
| | | |
| | |
| | | |
| | | CouponReceiveInfoVO selectMyCouponByReceiveId(@Param("receiveId") Integer receiveId); |
| | | |
| | | List<CouponReceiveInfoVO> selectMyCouponByStatus(@Param("shopId") Long shopId, @Param("userId") String userId, @Param("status") Integer status, |
| | | List<CouponReceiveInfoVO> selectMyCouponByStatus(@Param("companyId") Long shopId, @Param("userId") String userId, @Param("status") Integer status, |
| | | @Param("pageVo") PaginationVO pageVo); |
| | | |
| | | List<CouponReceiveInfoVO> selectMyPastCoupon(@Param("shopId")Long shopId, @Param("userId") String userId, @Param("pageVo") PaginationVO pageVo); |
| | | List<CouponReceiveInfoVO> selectMyPastCoupon(@Param("companyId")Long shopId, @Param("userId") String userId, @Param("pageVo") PaginationVO pageVo); |
| | | |
| | | } |
| | |
| | | sc.min_amount minAmount, sc.offset_amount offsetAmount, sc.is_all isAll, |
| | | sc.product_ids productIds, sc.attr_ids attrIds, scr.is_using isUsing |
| | | from shop_coupon sc, shop_coupon_record scr |
| | | where sc.shop_id=#{shopId} and sc.id = scr.c_id and scr.user_id = #{userId} and is_using = #{status} |
| | | where sc.company_id=#{companyId} and sc.id = scr.c_id and scr.user_id = #{userId} and is_using = #{status} |
| | | and is_open = 1 |
| | | <if test="status == 2"> |
| | | and now() >= begin_time and end_time >= now() |
| | |
| | | sc.min_amount minAmount, sc.offset_amount offsetAmount, sc.is_all isAll, |
| | | sc.product_ids productIds, sc.attr_ids attrIds, scr.is_using isUsing |
| | | from shop_coupon sc, shop_coupon_record scr |
| | | where sc.shop_id=#{shopId} and sc.id = scr.c_id and scr.user_id = #{userId} |
| | | where sc.company_id=#{companyId} and sc.id = scr.c_id and scr.user_id = #{userId} |
| | | and (isnull(order_id) or order_id = 0) |
| | | and now() > end_time and is_open = 1 |
| | | <if test="pageVo != null"><!-- 判断pageVo对象是否为空 --> |