Ver código fonte

代码提交

wuchen 2 meses atrás
pai
commit
edb407e950

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

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

+ 5 - 2
alien-store-platform/src/main/java/shop/alien/storeplatform/controller/OperationalActivityController.java

@@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import shop.alien.entity.result.R;
+import shop.alien.entity.storePlatform.vo.OperationalActivityUpdateResultVo;
 import shop.alien.entity.storePlatform.vo.StoreOperationalActivityDTO;
 import shop.alien.entity.storePlatform.vo.StoreOperationalActivityVO;
 import shop.alien.storeplatform.service.OperationalActivityService;
@@ -62,12 +63,14 @@ public class OperationalActivityController {
     @ApiOperation("更新运营活动")
     @ApiOperationSupport(order = 2)
     @PostMapping("/update")
-    public R<String> updateActivity(@RequestBody StoreOperationalActivityDTO dto) {
+    public R<OperationalActivityUpdateResultVo> updateActivity(@RequestBody StoreOperationalActivityDTO dto) {
         log.info("OperationalActivityController.updateActivity: dto={}", dto);
         try {
             int result = activityService.updateActivity(dto);
             if (result > 0) {
-                return R.success("活动更新成功");
+                StoreOperationalActivityVO vo = activityService.queryActivityById(dto.getId());
+                Integer couponType = (vo != null) ? vo.getCouponType() : null;
+                return R.data(new OperationalActivityUpdateResultVo("活动更新成功", couponType));
             }
             return R.fail("活动更新失败");
         } catch (Exception e) {

+ 9 - 8
alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/OperationalActivityServiceImpl.java

@@ -486,14 +486,15 @@ public class OperationalActivityServiceImpl implements OperationalActivityServic
         } else if (activity.getStatus() == 7) {
             vo.setStatusName("已结束");
         }
-
-        // 设置优惠券名称(判空处理)
-        if (activity.getCouponId() != null) {
-            LifeDiscountCoupon coupon = lifeDiscountCouponMapper.selectById(activity.getCouponId());
-            if (coupon != null) {
-                vo.setCouponName(coupon.getName());
-            }
-        }
+//
+//        // 设置优惠券名称与优惠券类型(判空处理)
+//        if (activity.getCouponId() != null) {
+//            LifeDiscountCoupon coupon = lifeDiscountCouponMapper.selectById(activity.getCouponId());
+//            if (coupon != null) {
+//                vo.setCouponName(coupon.getName());
+//                vo.setCouponType(coupon.getType());
+//            }
+//        }
 
         StoreImg activityTitleImg = imgMapper.selectOne(new LambdaQueryWrapper<StoreImg>()
                 .eq(StoreImg::getStoreId, vo.getStoreId())

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

@@ -66,11 +66,13 @@ public interface LifeDiscountCouponStoreFriendService extends IService<LifeDisco
     List<LifeDiscountCouponFriendRuleVo> getReceivedSendFriendCouponList(String storeUserId, String friendStoreUserId, String storeName, Integer type);
 
     /**
-     * 好评送券:用户对店铺好评且通过AI审核通过后,将店铺可用券发放到用户卡包
+     * 好评送券:用户好评且AI审核通过后,按运营活动配置的优惠券/代金券ID发放到用户券包,发放成功后扣减库存;按券类型发送对应通知。
      *
-     * @param userId  评价用户ID(life用户)
-     * @param storeId 店铺ID(businessId)
-     * @return 发放的优惠券数量,0表示未发放
+     * @param userId   评价用户ID(life用户)
+     * @param storeId  店铺ID(businessId)
+     * @param couponId 优惠券ID(life_discount_coupon),为null则不发优惠券
+     * @param voucherId 代金券ID(life_coupon),为null则不发代金券
+     * @return 发放数量(优惠券+代金券),0表示未发放
      */
     int issueCouponForGoodRating(Integer userId, Integer storeId);
 }