wuchen преди 2 месеца
родител
ревизия
29bf25d15a

+ 3 - 3
alien-entity/src/main/java/shop/alien/entity/storePlatform/StoreOperationalActivity.java

@@ -63,9 +63,9 @@ public class StoreOperationalActivity {
     @TableField("coupon_id")
     private Integer couponId;
 
-    @ApiModelProperty(value = "代金券ID,关联代金券表 life_coupon(评论有礼时可二选一或同时配置)")
-    @TableField("voucher_id")
-    private Integer voucherId;
+//    @ApiModelProperty(value = "代金券ID,关联代金券表 life_coupon(评论有礼时可二选一或同时配置)")
+//    @TableField("voucher_id")
+//    private Integer voucherId;
 
     @ApiModelProperty(value = "优惠券发放数量")
     @TableField("coupon_quantity")

+ 25 - 0
alien-entity/src/main/java/shop/alien/entity/storePlatform/vo/OperationalActivityUpdateResultVo.java

@@ -0,0 +1,25 @@
+package shop.alien.entity.storePlatform.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 运营活动更新接口返回对象(仅增加返回字段,不改变原有逻辑)
+ *
+ * @author system
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@ApiModel(value = "OperationalActivityUpdateResultVo", description = "运营活动更新返回对象")
+public class OperationalActivityUpdateResultVo {
+
+    @ApiModelProperty(value = "提示信息")
+    private String message;
+
+    @ApiModelProperty(value = "优惠券类型:1-优惠券, 2-红包, 3-平台优惠券, 4-代金券")
+    private Integer couponType;
+}

+ 1 - 0
alien-entity/src/main/resources/mapper/storePlatform/StoreOperationalActivityMapper.xml

@@ -14,6 +14,7 @@
         <result column="activity_rule" property="activityRule" />
         <result column="reward_type" property="rewardType" />
         <result column="coupon_id" property="couponId" />
+<!--        <result column="voucher_id" property="voucherId" />-->
         <result column="coupon_quantity" property="couponQuantity" />
         <result column="status" property="status" />
         <result column="delete_flag" property="deleteFlag" />

+ 1 - 1
alien-store/src/main/java/shop/alien/store/service/LifeDiscountCouponStoreFriendService.java

@@ -74,5 +74,5 @@ public interface LifeDiscountCouponStoreFriendService extends IService<LifeDisco
      * @param voucherId 代金券ID(life_coupon),为null则不发代金券
      * @return 发放数量(优惠券+代金券),0表示未发放
      */
-    int issueCouponForGoodRating(Integer userId, Integer storeId);
+//    int issueCouponForGoodRating(Integer userId, Integer storeId);
 }

+ 3 - 3
alien-store/src/main/java/shop/alien/store/service/impl/CommonRatingServiceImpl.java

@@ -237,9 +237,9 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
                             .orderByDesc(StoreOperationalActivity::getId)
                             .last("LIMIT 1");
                     StoreOperationalActivity activity = storeOperationalActivityMapper.selectOne(activityWrapper);
-                    if (activity == null || (activity.getCouponId() == null && activity.getVoucherId() == null)) {
-                        return;
-                    }
+//                    if (activity == null || (activity.getCouponId() == null && activity.getVoucherId() == null)) {
+//                        return;
+//                    }
                     Integer limit = activity.getParticipationLimit();
                     if (limit != null && limit > 0) {
                         int passedCount = commonRatingMapper.countPassedGoodRatingsByUserAndStore(commonRating.getUserId(), businessId);

+ 96 - 96
alien-store/src/main/java/shop/alien/store/service/impl/LifeDiscountCouponStoreFriendServiceImpl.java

@@ -651,100 +651,100 @@ public class LifeDiscountCouponStoreFriendServiceImpl extends ServiceImpl<LifeDi
     /**
      * 好评送券:按优惠券/代金券ID发放到用户券包,发放成功后扣减库存;根据是优惠券还是代金券发送对应通知。
      */
-    @Override
-    public int issueCouponForGoodRating(Integer userId, Integer storeId, Integer couponId, Integer voucherId) {
-        if (userId == null || storeId == null) {
-            return 0;
-        }
-        if ((couponId == null || couponId <= 0) && (voucherId == null || voucherId <= 0)) {
-            return 0;
-        }
-        int commenterUserId = userId.intValue();
-        StoreInfo storeInfo = storeInfoMapper.selectById(storeId);
-        LifeUser lifeUser = lifeUserMapper.selectById(commenterUserId);
-        int grantedCoupon = 0;
-        int grantedVoucher = 0;
-
-        // 按优惠券ID发放:发放1张,扣减库存,发优惠券通知
-        if (couponId != null && couponId > 0) {
-            LifeDiscountCoupon coupon = lifeDiscountCouponMapper.selectById(couponId);
-            if (coupon != null && String.valueOf(storeId).equals(coupon.getStoreId())
-                    && coupon.getSingleQty() != null && coupon.getSingleQty() > 0) {
-                try {
-                    LifeDiscountCouponUser lifeDiscountCouponUser = new LifeDiscountCouponUser();
-                    lifeDiscountCouponUser.setCouponId(coupon.getId());
-                    lifeDiscountCouponUser.setUserId(commenterUserId);
-                    lifeDiscountCouponUser.setReceiveTime(new Date());
-                    lifeDiscountCouponUser.setExpirationTime(coupon.getValidDate());
-                    lifeDiscountCouponUser.setStatus(Integer.parseInt(DiscountCouponEnum.WAITING_USED.getValue()));
-                    lifeDiscountCouponUser.setDeleteFlag(0);
-                    lifeDiscountCouponUserMapper.insert(lifeDiscountCouponUser);
-                    coupon.setSingleQty(coupon.getSingleQty() - 1);
-                    lifeDiscountCouponMapper.updateById(coupon);
-                    grantedCoupon = 1;
-                } catch (Exception e) {
-
-                }
-            }
-        }
-
-        // 按代金券ID发放:发放1张,扣减库存,发代金券通知
-        if (voucherId != null && voucherId > 0) {
-            LifeCoupon lifeCoupon = lifeCouponMapper.selectById(voucherId);
-            if (lifeCoupon != null && String.valueOf(storeId).equals(lifeCoupon.getStoreId())
-                    && lifeCoupon.getSingleQty() != null && lifeCoupon.getSingleQty() > 0) {
-                try {
-                    LifeDiscountCouponUser lifeDiscountCouponUser = new LifeDiscountCouponUser();
-                    lifeDiscountCouponUser.setVoucherId(lifeCoupon.getId());
-                    lifeDiscountCouponUser.setUserId(commenterUserId);
-                    lifeDiscountCouponUser.setReceiveTime(new Date());
-                    if (lifeCoupon.getEndDate() != null) {
-                        lifeDiscountCouponUser.setExpirationTime(lifeCoupon.getEndDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
-                    }
-                    lifeDiscountCouponUser.setStatus(Integer.parseInt(DiscountCouponEnum.WAITING_USED.getValue()));
-                    lifeDiscountCouponUser.setDeleteFlag(0);
-                    lifeDiscountCouponUserMapper.insert(lifeDiscountCouponUser);
-                    lifeCoupon.setSingleQty(lifeCoupon.getSingleQty() - 1);
-                    lifeCouponMapper.updateById(lifeCoupon);
-                    grantedVoucher = 1;
-                } catch (Exception e) {
-
-                }
-            }
-        }
-
-        // 根据发放的是优惠券还是代金券发送对应通知
-        if (lifeUser != null && storeInfo != null) {
-            if (grantedCoupon > 0) {
-                LifeNotice couponNotice = new LifeNotice();
-                couponNotice.setSenderId("system");
-                couponNotice.setReceiverId("user_" + lifeUser.getUserPhone());
-                String couponText = "您对店铺「" + storeInfo.getStoreName() + "」的好评已通过审核,已为您发放优惠券,快去我的券包查看吧~";
-                JSONObject couponJson = new JSONObject();
-                couponJson.put("message", couponText);
-                couponNotice.setContext(couponJson.toJSONString());
-                couponNotice.setNoticeType(1);
-                couponNotice.setTitle("好评送券");
-                couponNotice.setIsRead(0);
-                couponNotice.setDeleteFlag(0);
-                lifeNoticeMapper.insert(couponNotice);
-            }
-            if (grantedVoucher > 0) {
-                LifeNotice voucherNotice = new LifeNotice();
-                voucherNotice.setSenderId("system");
-                voucherNotice.setReceiverId("user_" + lifeUser.getUserPhone());
-                String voucherText = "您对店铺「" + storeInfo.getStoreName() + "」的好评已通过审核,已为您发放代金券,快去我的券包查看吧~";
-                JSONObject voucherJson = new JSONObject();
-                voucherJson.put("message", voucherText);
-                voucherNotice.setContext(voucherJson.toJSONString());
-                voucherNotice.setNoticeType(1);
-                voucherNotice.setTitle("好评送代金券");
-                voucherNotice.setIsRead(0);
-                voucherNotice.setDeleteFlag(0);
-                lifeNoticeMapper.insert(voucherNotice);
-            }
-        }
-
-        return grantedCoupon + grantedVoucher;
-    }
+//    @Override
+//    public int issueCouponForGoodRating(Integer userId, Integer storeId, Integer couponId, Integer voucherId) {
+//        if (userId == null || storeId == null) {
+//            return 0;
+//        }
+//        if ((couponId == null || couponId <= 0) && (voucherId == null || voucherId <= 0)) {
+//            return 0;
+//        }
+//        int commenterUserId = userId.intValue();
+//        StoreInfo storeInfo = storeInfoMapper.selectById(storeId);
+//        LifeUser lifeUser = lifeUserMapper.selectById(commenterUserId);
+//        int grantedCoupon = 0;
+//        int grantedVoucher = 0;
+//
+//        // 按优惠券ID发放:发放1张,扣减库存,发优惠券通知
+//        if (couponId != null && couponId > 0) {
+//            LifeDiscountCoupon coupon = lifeDiscountCouponMapper.selectById(couponId);
+//            if (coupon != null && String.valueOf(storeId).equals(coupon.getStoreId())
+//                    && coupon.getSingleQty() != null && coupon.getSingleQty() > 0) {
+//                try {
+//                    LifeDiscountCouponUser lifeDiscountCouponUser = new LifeDiscountCouponUser();
+//                    lifeDiscountCouponUser.setCouponId(coupon.getId());
+//                    lifeDiscountCouponUser.setUserId(commenterUserId);
+//                    lifeDiscountCouponUser.setReceiveTime(new Date());
+//                    lifeDiscountCouponUser.setExpirationTime(coupon.getValidDate());
+//                    lifeDiscountCouponUser.setStatus(Integer.parseInt(DiscountCouponEnum.WAITING_USED.getValue()));
+//                    lifeDiscountCouponUser.setDeleteFlag(0);
+//                    lifeDiscountCouponUserMapper.insert(lifeDiscountCouponUser);
+//                    coupon.setSingleQty(coupon.getSingleQty() - 1);
+//                    lifeDiscountCouponMapper.updateById(coupon);
+//                    grantedCoupon = 1;
+//                } catch (Exception e) {
+//
+//                }
+//            }
+//        }
+//
+//        // 按代金券ID发放:发放1张,扣减库存,发代金券通知
+//        if (voucherId != null && voucherId > 0) {
+//            LifeCoupon lifeCoupon = lifeCouponMapper.selectById(voucherId);
+//            if (lifeCoupon != null && String.valueOf(storeId).equals(lifeCoupon.getStoreId())
+//                    && lifeCoupon.getSingleQty() != null && lifeCoupon.getSingleQty() > 0) {
+//                try {
+//                    LifeDiscountCouponUser lifeDiscountCouponUser = new LifeDiscountCouponUser();
+//                    lifeDiscountCouponUser.setVoucherId(lifeCoupon.getId());
+//                    lifeDiscountCouponUser.setUserId(commenterUserId);
+//                    lifeDiscountCouponUser.setReceiveTime(new Date());
+//                    if (lifeCoupon.getEndDate() != null) {
+//                        lifeDiscountCouponUser.setExpirationTime(lifeCoupon.getEndDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
+//                    }
+//                    lifeDiscountCouponUser.setStatus(Integer.parseInt(DiscountCouponEnum.WAITING_USED.getValue()));
+//                    lifeDiscountCouponUser.setDeleteFlag(0);
+//                    lifeDiscountCouponUserMapper.insert(lifeDiscountCouponUser);
+//                    lifeCoupon.setSingleQty(lifeCoupon.getSingleQty() - 1);
+//                    lifeCouponMapper.updateById(lifeCoupon);
+//                    grantedVoucher = 1;
+//                } catch (Exception e) {
+//
+//                }
+//            }
+//        }
+//
+//        // 根据发放的是优惠券还是代金券发送对应通知
+//        if (lifeUser != null && storeInfo != null) {
+//            if (grantedCoupon > 0) {
+//                LifeNotice couponNotice = new LifeNotice();
+//                couponNotice.setSenderId("system");
+//                couponNotice.setReceiverId("user_" + lifeUser.getUserPhone());
+//                String couponText = "您对店铺「" + storeInfo.getStoreName() + "」的好评已通过审核,已为您发放优惠券,快去我的券包查看吧~";
+//                JSONObject couponJson = new JSONObject();
+//                couponJson.put("message", couponText);
+//                couponNotice.setContext(couponJson.toJSONString());
+//                couponNotice.setNoticeType(1);
+//                couponNotice.setTitle("好评送券");
+//                couponNotice.setIsRead(0);
+//                couponNotice.setDeleteFlag(0);
+//                lifeNoticeMapper.insert(couponNotice);
+//            }
+//            if (grantedVoucher > 0) {
+//                LifeNotice voucherNotice = new LifeNotice();
+//                voucherNotice.setSenderId("system");
+//                voucherNotice.setReceiverId("user_" + lifeUser.getUserPhone());
+//                String voucherText = "您对店铺「" + storeInfo.getStoreName() + "」的好评已通过审核,已为您发放代金券,快去我的券包查看吧~";
+//                JSONObject voucherJson = new JSONObject();
+//                voucherJson.put("message", voucherText);
+//                voucherNotice.setContext(voucherJson.toJSONString());
+//                voucherNotice.setNoticeType(1);
+//                voucherNotice.setTitle("好评送代金券");
+//                voucherNotice.setIsRead(0);
+//                voucherNotice.setDeleteFlag(0);
+//                lifeNoticeMapper.insert(voucherNotice);
+//            }
+//        }
+//
+//        return grantedCoupon + grantedVoucher;
+//    }
 }