ソースを参照

优惠券标识显示

plf 3 年 前
コミット
b373852135

+ 3 - 2
src/main/java/com/caimei365/commodity/mapper/CouponMapper.java

@@ -87,7 +87,8 @@ public interface CouponMapper {
     /**
      * 更新兑换状态
      *
-     * @param id 兑换码id
+     * @param id           兑换码id
+     * @param clubCouponId 用户关联优惠券id
      */
-    void updateRedemptionCode(Integer id);
+    void updateRedemptionCode(@Param("id") Integer id, @Param("clubCouponId") Integer clubCouponId);
 }

+ 2 - 2
src/main/java/com/caimei365/commodity/model/po/CouponRedemptionCodePo.java

@@ -23,9 +23,9 @@ public class CouponRedemptionCodePo implements Serializable {
     private Integer couponId;
 
     /**
-     * 机构用户id
+     * 用户关联优惠券id(对应cm_coupon_club)
      */
-    private Integer userId;
+    private Integer clubCouponId;
 
     /**
      * 兑换码(16位)

+ 1 - 1
src/main/java/com/caimei365/commodity/service/impl/CouponServiceImpl.java

@@ -155,7 +155,7 @@ public class CouponServiceImpl implements CouponService {
         couponClub.setCreateDate(new Date());
         couponClub.setDelFlag("0");
         couponMapper.insertCouponClub(couponClub);
-        couponMapper.updateRedemptionCode(redemptionCode.getId());
+        couponMapper.updateRedemptionCode(redemptionCode.getId(), couponClub.getId());
         return ResponseJson.success(coupon);
     }
 

+ 8 - 3
src/main/java/com/caimei365/commodity/service/impl/SellerServiceImpl.java

@@ -1,10 +1,12 @@
 package com.caimei365.commodity.service.impl;
 
 import com.caimei365.commodity.components.PriceUtilService;
-import com.caimei365.commodity.mapper.PriceMapper;
 import com.caimei365.commodity.mapper.SellerMapper;
 import com.caimei365.commodity.model.ResponseJson;
-import com.caimei365.commodity.model.vo.*;
+import com.caimei365.commodity.model.vo.CombinationVo;
+import com.caimei365.commodity.model.vo.PaginationVo;
+import com.caimei365.commodity.model.vo.ProductItemVo;
+import com.caimei365.commodity.service.PageService;
 import com.caimei365.commodity.service.SellerService;
 import com.github.pagehelper.PageHelper;
 import org.springframework.beans.factory.annotation.Value;
@@ -29,7 +31,7 @@ public class SellerServiceImpl implements SellerService {
     @Resource
     private PriceUtilService priceUtilService;
     @Resource
-    private PriceMapper priceMapper;
+    private PageService pageService;
 
     /**
      * 协销搜索商品(单一)
@@ -82,6 +84,9 @@ public class SellerServiceImpl implements SellerService {
                 product.setTotalPrice(0d);
                 // 设置商品主图及价格
                 priceUtilService.setProductDetails(clubUserId, product);
+                //优惠券标识
+                Boolean couponsLogo = pageService.setCouponsLogo(clubUserId, product.getProductId(), 2);
+                product.setCouponsLogo(couponsLogo);
             });
             combination.setCombinationProductList(productList);
         });

+ 10 - 3
src/main/resources/mapper/CouponMapper.xml

@@ -164,7 +164,7 @@
         SELECT
           `id`,
           `couponId`,
-          `userId`,
+          `clubCouponId`,
           `redemptionCode`,
           `status`,
           `redemptionTime`,
@@ -185,7 +185,7 @@
           AND couponId = #{couponId}
     </select>
 
-    <insert id="insertCouponClub">
+    <insert id="insertCouponClub" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
         INSERT INTO `cm_coupon_club` (
           `userId`,
           `couponId`,
@@ -210,6 +210,13 @@
     </insert>
 
     <update id="updateRedemptionCode">
-        UPDATE cm_coupon_redemption_code SET status = 2, redemptionTime = NOW() WHERE id = #{id}
+        UPDATE
+          cm_coupon_redemption_code
+        SET
+          STATUS = 2,
+          redemptionTime = NOW(),
+          clubCouponId = #{clubCouponId}
+        WHERE
+          id = #{id}
     </update>
 </mapper>