From 46870845284d8a89435fbe38f8e9b6c53140e5cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=85=81=E6=9E=9E?= <3422692813@qq.com> Date: Wed, 16 Oct 2024 18:28:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B010.16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ActiveAppletController.java | 10 +++++++ .../service/ActiveAppletService.java | 3 ++ .../service/impl/ActiveAppletServiceImpl.java | 30 +++++++++++++++++++ .../entity/ActiveRecommendRecords.java | 7 +++++ 4 files changed, 50 insertions(+) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/controller/ActiveAppletController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/controller/ActiveAppletController.java index 8230ae09e..0b470cc55 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/controller/ActiveAppletController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/controller/ActiveAppletController.java @@ -187,4 +187,14 @@ public class ActiveAppletController extends BaseController { public ResponseObject getRecommendedByStoreId(Integer storeId){ return getSuccessResult(activeAppletService.selectByStoreId(storeId)); } + /** + * + * 根据storeId查询邀请有礼活动(小程序) + * @param storeId + * @return + */ + @GetMapping("getRecommendedRecordsByStoreId") + public ResponseObject getRecommendedRecordsByStoreId(Integer storeId){ + return getSuccessResult(activeAppletService.selectRecommendedRecordsByStoreId(storeId)); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/service/ActiveAppletService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/service/ActiveAppletService.java index 41a304a2e..6075c5cf6 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/service/ActiveAppletService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/service/ActiveAppletService.java @@ -7,6 +7,7 @@ import com.fuint.business.marketingActivity.activeApplet.entity.ActiveApplet; import com.fuint.business.marketingActivity.activePrice.vo.ActivePriceReqVO; import com.fuint.business.marketingActivity.activePrice.vo.ActivePriceRespVO; import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommend; +import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords; import java.util.List; @@ -70,5 +71,7 @@ public interface ActiveAppletService extends IService { * @return */ ActiveRecommend selectByStoreId(Integer storeId); + + List selectRecommendedRecordsByStoreId(Integer storeId); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/service/impl/ActiveAppletServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/service/impl/ActiveAppletServiceImpl.java index 3b66b3926..e9d9e8935 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/service/impl/ActiveAppletServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeApplet/service/impl/ActiveAppletServiceImpl.java @@ -18,11 +18,15 @@ import com.fuint.business.marketingActivity.activePopUp.service.ActivePopUpServi import com.fuint.business.marketingActivity.activePrice.service.ActiveSubPriceService; import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommend; import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendChild; +import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords; import com.fuint.business.marketingActivity.activeRecommend.mapper.ActiveRecommendChildMapper; import com.fuint.business.marketingActivity.activeRecommend.mapper.ActiveRecommendMapper; +import com.fuint.business.marketingActivity.activeRecommend.mapper.ActiveRecommendRecordsMapper; import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecommendService; import com.fuint.business.marketingActivity.activeUserConsume.service.ActiveUserConsumeService; import com.fuint.business.marketingActivity.activeUserRecharge.service.ActiveUserRechargeService; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon; +import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponMapper; import com.fuint.business.userManager.entity.LJUserGrade; import com.fuint.business.userManager.service.LJUserGradeService; import com.fuint.common.dto.AccountInfo; @@ -35,6 +39,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; /** * 小程序端活动表(ActiveApplet)表服务实现类 @@ -87,6 +92,10 @@ public class ActiveAppletServiceImpl extends ServiceImpl applet(ActiveApplet activeApplet) { @@ -247,6 +256,27 @@ public class ActiveAppletServiceImpl extends ServiceImpl selectRecommendedRecordsByStoreId(Integer storeId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + //查询推荐有礼领取记录 + List activeRecommendRecords = activeRecommendRecordsMapper.selectList(new LambdaQueryWrapper() + .eq(ActiveRecommendRecords::getStoreId, storeId) + .eq(ActiveRecommendRecords::getUserId, nowAccountInfo.getId())); + + //通过券ids查询券信息 + for (ActiveRecommendRecords activeRecommendRecord : activeRecommendRecords) { + String[] split = activeRecommendRecord.getActiveRecommendIds().split(","); + List cardCoupons = activeRecommendChildMapper.selectList(new LambdaQueryWrapper() + .in(ActiveRecommendChild::getId, split)); + if (cardCoupons != null) { + List collect = cardCoupons.stream().map(ActiveRecommendChild::getGiftCardName).collect(Collectors.toList()); + activeRecommendRecord.setCouponNames(collect); + } + } + return activeRecommendRecords; + } + /** * 判断当前时间是否在活动时间范围内 * @param activeStartTime diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendRecords.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendRecords.java index 1cd75f106..8dc93442a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendRecords.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendRecords.java @@ -3,12 +3,14 @@ package com.fuint.business.marketingActivity.activeRecommend.entity; import java.util.Date; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * 邀请有礼记录表(ActiveRecommendRecords)表实体类 @@ -46,5 +48,10 @@ public class ActiveRecommendRecords extends Model { //更新时间 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") private Date updateTime; + private String activeRecommendIds; + private Integer points; + private Integer growthValue; + @TableField(exist = false) + private List couponNames; }