zoujiajian 3 lat temu
rodzic
commit
caa65dde34

+ 6 - 5
netflix-dao/src/main/resources/mapper/CouponUserMapper.xml

@@ -129,14 +129,16 @@
                cu.valid_end_time,
                c.is_renew,
                (case
-                    when cu.status != 'used' and cu.valid_end_time < now() then 'expired'
-                    when cu.status != 'used' and ca.status = 0 then 'invalid'
+                    when cu.status = 'used' then 'used'
+                    when cu.valid_end_time < now() then 'expired'
+                    when ca.id is not null and ca.status = 0 then 'invalid'
+                    when cu.valid_start_time < now() then 'unused'
                     else cu.status end) as couponUserStatus,
                (case
                     when cu.status = 'used' then 4
-                    when ca.status = 0 then 3
-                    when cu.valid_start_time < now() then 1
                     when cu.valid_end_time < now() then 2
+                    when ca.id is not null and ca.status = 0 then 3
+                    when cu.valid_start_time < now() then 1
                     when cu.status = 'unused' then 0
                    end)                 as orderby
         from `coupon_user` cu
@@ -144,7 +146,6 @@
                  left join `coupon_active` ca on ca.id = cu.coupon_active_id
         where cu.user_id = #{userId}
           and cu.channel != 'exCode'
-          and ca.id is not null
         order by `orderby`
     </select>
 </mapper>

+ 0 - 7
netflix-service/src/main/java/com/cyksj/service/coupon/CouponFontService.java

@@ -6,8 +6,6 @@ import com.cyksj.model.entity.CouponUser;
 import com.cyksj.model.request.CouponCollectReq;
 import com.cyksj.model.views.CouponUserView;
 
-import java.util.List;
-
 /*
  *项目名: netflix
  *文件名: CouponFontService
@@ -30,11 +28,6 @@ public interface CouponFontService {
 	 */
 	void collectWholeRecommendCoupon(Long userId);
 
-	/**
-	 * 处理优惠券状态
-	 */
-	void handleCouponStatus(List<CouponUserView> page);
-
 	/**
 	 * 可用/不可用优惠券
 	 */

+ 0 - 10
netflix-service/src/main/java/com/cyksj/service/coupon/impl/CouponFontServiceImpl.java

@@ -142,16 +142,6 @@ public class CouponFontServiceImpl implements CouponFontService {
 		});
 	}
 
-	@Override
-	public void handleCouponStatus(List<CouponUserView> list) {
-		DateTime now = DateTime.now();
-		list.forEach(data -> {
-			this.setCouponUserStatus(data, now);
-			String str = couponSkuMapper.selectGoodsSkuStr(data.getCouponId());
-			data.setGoodsSkuStr(str.replaceAll(",", "/").replaceAll(";", ""));
-		});
-	}
-
 	@Override
 	public Page<CouponUserView> getAvailableCouponList(Long skuId, Long couponId, Long userId, Boolean isRenew, Long start, Long limit) {
 		DateTime now = DateTime.now();

+ 0 - 1
netflix-web/src/main/java/com/cyksj/web/controller/coupon/CouponFrontController.java

@@ -70,7 +70,6 @@ public class CouponFrontController {
 	public Result<Page<CouponUserView>> couponPersonalList(@RequestParam(defaultValue = "1") Long start, @RequestParam(defaultValue = "5") Long limit) {
 		Long userId = StpUserUtil.getLoginIdAsLong();
 		Page<CouponUserView> page = couponUserMapper.couponPersonalList(userId, new Page<>(start, limit));
-		couponFontService.handleCouponStatus(page.getRecords());
 		return GatewayResponse.SUCCESS.newBuilder().toResult(page);
 	}