jyy
2021-03-08 408f7f23e18650d50c59bf72f272b115c5af217a
修改优惠券bug
6 files modified
32 ■■■■ changed files
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java 2 ●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopCouponAction.java 6 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WxShopCouponService.java 4 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopCouponServiceImpl.java 12 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopCouponRecordDao.java 4 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopCouponRecordDao.xml 4 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java
@@ -117,7 +117,7 @@
            }
        }
        //获取当前购物车产品可用的优惠券
        List<CouponReceiveInfoVO> usefulCoupon = wxShopCouponService.getCartVoCouponList(addShopOrderPOJO.getShopId(),notCouponuyCart);
        List<CouponReceiveInfoVO> usefulCoupon = wxShopCouponService.getCartVoCouponList(HostInterceptor.getCompanyId(),notCouponuyCart);
        //获取用户使用的优惠券
        CouponReceiveInfoVO shopCoupon = new CouponReceiveInfoVO();
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopCouponAction.java
@@ -58,11 +58,11 @@
     *
     * @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);
    }
    /**
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WxShopCouponService.java
@@ -42,12 +42,12 @@
     * 根据状态获取我的优惠券
     * 
     *
     * @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获取优惠券列表
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopCouponServiceImpl.java
@@ -57,7 +57,7 @@
     *
     * @return
     */
    public List<CouponReceiveInfoVO> getCartVoCouponList(Long shopId,List<ShopShoppingCart> shopShoppingCarts) {
    public List<CouponReceiveInfoVO> getCartVoCouponList(Long companyId,List<ShopShoppingCart> shopShoppingCarts) {
        //可用优惠券列表
        List<CouponReceiveInfoVO> shopCoupons = new ArrayList<>();
@@ -65,7 +65,7 @@
        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)) {
            //根据优惠力度排序,优惠力度大的先参与计算
@@ -215,20 +215,20 @@
     * 根据订单状态查询优惠券列表
     *
     *
     * @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);
    }
zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopCouponRecordDao.java
@@ -43,9 +43,9 @@
    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);
}
zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopCouponRecordDao.xml
@@ -270,7 +270,7 @@
        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()
@@ -296,7 +296,7 @@
        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对象是否为空 -->