jyy
2021-03-09 e941c4f9d9bc76787bde2df21158fffaabe77824
小程序优惠券跨公司bug
4 files modified
25 ■■■■ changed files
zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopCouponAction.java 3 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopCouponServiceImpl.java 16 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopCouponDao.java 2 ●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopCouponDao.xml 4 ●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/shopXcx/action/ShopCouponAction.java
@@ -14,7 +14,6 @@
import com.matrix.core.tools.WebUtil;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.constance.Dictionary;
import com.matrix.system.hive.action.util.QueryUtil;
import com.matrix.system.shopXcx.bean.ShopCoupon;
import com.matrix.system.shopXcx.bean.ShopProduct;
import com.matrix.system.shopXcx.dao.ShopCouponDao;
@@ -269,6 +268,7 @@
     * @param shopCoupon
     */
    private void productLabeling(ShopCoupon shopCoupon) {
        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        Date now = new Date();
        Boolean needUpdate = false;
        //优惠券处于可用状态
@@ -279,6 +279,7 @@
            if (shopCoupon.getIsAll() == 1) {
                ShopProduct productQuery = new ShopProduct();
                productQuery.setDelFlag(2);
                productQuery.setCompanyId(user.getCompanyId());
                shopProductList = shopProductDao.selectByModel(productQuery);
            } else {
                if (StringUtils.isNotBlank(shopCoupon.getProductIds())) {
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopCouponServiceImpl.java
@@ -8,14 +8,8 @@
import com.matrix.component.redis.RedisUserLoginUtils;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.shopXcx.bean.ShopCoupon;
import com.matrix.system.shopXcx.bean.ShopCouponRecord;
import com.matrix.system.shopXcx.bean.ShopProductAttrRef;
import com.matrix.system.shopXcx.bean.ShopShoppingCart;
import com.matrix.system.shopXcx.dao.ShopCouponDao;
import com.matrix.system.shopXcx.dao.ShopCouponRecordDao;
import com.matrix.system.shopXcx.dao.ShopProductAttrRefDao;
import com.matrix.system.shopXcx.dao.ShopReceiveAddressDao;
import com.matrix.system.shopXcx.bean.*;
import com.matrix.system.shopXcx.dao.*;
import com.matrix.system.shopXcx.api.service.WxShopCouponService;
import com.matrix.system.shopXcx.api.tools.WxShopCouponUtil;
import com.matrix.system.shopXcx.api.tools.WxShopOrderUtil;
@@ -50,6 +44,9 @@
    private ShopReceiveAddressDao shopReceiveAddressDao;
    @Autowired
    private WxShopCouponUtil wxShopCouponUtil;
    @Autowired
    private ShopProductDao productDao;
    /**
@@ -290,7 +287,8 @@
                attrIds.addAll(ids);
            }
        }
        List<ShopCoupon> list = shopCouponDao.selectHdListByProductId(productId, attrIds);
        ShopProduct shopProduct = productDao.selectById(productId);
        List<ShopCoupon> list = shopCouponDao.selectHdListByProductId(productId, attrIds,shopProduct.getCompanyId());
        return list;
    }
zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopCouponDao.java
@@ -55,7 +55,7 @@
    ShopCoupon selectByIdAndUserId(@Param("id") Integer id, @Param("userId") String userId);
    public List<ShopCoupon> selectHdListByProductId(@Param("productId") Integer productId, @Param("attrIds") List<String> attrIds);
    public List<ShopCoupon> selectHdListByProductId(@Param("productId") Integer productId, @Param("attrIds") List<String> attrIds, @Param("companyId")Long companyId);
    ShopCoupon getCouponByTitle(@Param("title")String title, @Param("companyId")Long companyId);
}
zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopCouponDao.xml
@@ -526,6 +526,7 @@
        <result property="tag" column="tag"/>
        <result property="isUsing" column="is_using"/>
        <result property="kind" column="kind"/>
        <result property="companyId" column="company_id"/>
    </resultMap>
    <select id="selectUsableCouponByProductInfo" resultMap="WxShopCouponMap">
@@ -561,7 +562,8 @@
        select *
        from shop_coupon
        where
        kind=2 and now() >= begin_time and end_time >= now()
        company_id=#{companyId}
        and kind=2 and now() >= begin_time and end_time >= now()
        and is_open = 1
        and (is_all = 1 or
        (