|
|
@@ -2,7 +2,6 @@ package com.cyksj.web.controller.coupon;
|
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.cyksj.common.annotation.NoSubmit;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
@@ -15,7 +14,6 @@ import com.cyksj.mapper.manage.coupon.CouponSkuMapper;
|
|
|
import com.cyksj.mapper.manage.coupon.CouponUserMapper;
|
|
|
import com.cyksj.model.dto.CouponPopularizeDto;
|
|
|
import com.cyksj.model.entity.Coupon;
|
|
|
-import com.cyksj.model.entity.CouponUser;
|
|
|
import com.cyksj.model.request.CouponCollectReq;
|
|
|
import com.cyksj.model.views.*;
|
|
|
import com.cyksj.redis.RedisService;
|
|
|
@@ -119,13 +117,9 @@ public class CouponFrontController {
|
|
|
}
|
|
|
Page<CouponRecommendView> page = couponRecommendMapper.getRecommendCouponViewList(userId, isNewUser, new Page<>(start, limit));
|
|
|
page.getRecords().forEach(data -> {
|
|
|
- CouponUser couponUser = couponUserMapper.selectOne(Wrappers.lambdaQuery(CouponUser.class).eq(CouponUser::getUserId, userId).eq(CouponUser::getCouponId, data.getCouponId()).select(CouponUser::getId).last("limit 1"));
|
|
|
- if (couponUser == null) {
|
|
|
- //待领取
|
|
|
- data.setCouponStatus(CouponActiveView.CouponStatus.collecting);
|
|
|
- } else {
|
|
|
- //已领取
|
|
|
- data.setCouponStatus(CouponActiveView.CouponStatus.received);
|
|
|
+ if (data.getCouponStatus() == CouponActiveView.CouponStatus.received) {
|
|
|
+ data.setValidStartTime(data.getUserValidStartTime());
|
|
|
+ data.setValidEndTime(data.getUserValidEndTime());
|
|
|
}
|
|
|
String str = couponSkuMapper.selectGoodsSkuStr(data.getCouponId());
|
|
|
data.setGoodsSkuStr(str.replaceAll(",", "/").replaceAll(";", ""));
|
|
|
@@ -184,7 +178,12 @@ public class CouponFrontController {
|
|
|
@GetMapping("/recommend/collect/num")
|
|
|
public Result<Integer> collectRecommendCouponNum() {
|
|
|
Long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
- Integer num = couponFontService.collectRecommendCouponNum(userId);
|
|
|
+ CouponNewUserView couponNewUserView = beanSearcher.searchFirst(CouponNewUserView.class, MapUtils.builder().field(CouponNewUserView::getUserId, userId).op(Operator.Equal).build());
|
|
|
+ Boolean isNewUser = true;
|
|
|
+ if (couponNewUserView != null) {
|
|
|
+ isNewUser = false;
|
|
|
+ }
|
|
|
+ Integer num = couponFontService.collectRecommendCouponNum(userId, isNewUser);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(num);
|
|
|
}
|
|
|
|