zoujiajian 1 vuosi sitten
vanhempi
sitoutus
3909868030

+ 11 - 0
netflix-dao/src/main/java/com/cyksj/model/dto/UserWhoami.java

@@ -5,6 +5,7 @@ import lombok.Setter;
 import lombok.experimental.Accessors;
 
 import java.io.Serializable;
+import java.util.Date;
 
 /**
  *
@@ -51,4 +52,14 @@ public class UserWhoami implements Serializable {
      * 是否是未下单的用户
      */
     private Boolean isPay;
+
+    /**
+     * 是否是vip
+     */
+    private Boolean isVip = false;
+
+    /**
+     * 会员过期时间
+     */
+    private Date vipExpiryTime;
 }

+ 6 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/UserView.java

@@ -193,4 +193,10 @@ public class UserView {
      */
     @DbIgnore
     private Boolean isCert;
+
+    @DbIgnore
+    private Boolean isVip;
+
+    @DbIgnore
+    private Date vipExpiryTime;
 }

+ 14 - 1
netflix-service/src/main/java/com/cyksj/service/user/impl/UserServiceImpl.java

@@ -25,6 +25,7 @@ import com.cyksj.mapper.manage.distribute.UserDistributeSharedMapper;
 import com.cyksj.mapper.market.task.UserBindDetailMapper;
 import com.cyksj.mapper.mirrorshop.UserMirrorShopMapper;
 import com.cyksj.mapper.station.CollegeStudentStationUserRelateMapper;
+import com.cyksj.mapper.vip.VipUserMapper;
 import com.cyksj.model.dto.*;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.request.LoginReq;
@@ -137,6 +138,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 
 	private final UserCommonService userCommonService;
 
+	private final VipUserMapper vipUserMapper;
+
 	private static final GlobalThreadPoolTaskExecutor TASK_POOL = GlobalThreadPoolTaskExecutor.getInstance();
 
 	@Override
@@ -295,7 +298,17 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 				.in(OrderDon::getUserId, userIdList)
 				.notIn(OrderDon::getStatus, Constant.noOrderStatus));
 		userWhoami.setIsPay(selectCount > 0);
-	    return userWhoami;
+
+		//是否是会员
+		VipUser vipUser = vipUserMapper.selectOne(Wrappers.lambdaQuery(VipUser.class)
+				.eq(VipUser::getUserId, userId)
+				.gt(VipUser::getExpiryTime, DateTime.now())
+				.last("limit 1"));
+		if (vipUser != null) {
+			userWhoami.setIsVip(Boolean.TRUE);
+			userWhoami.setVipExpiryTime(vipUser.getExpiryTime());
+		}
+		return userWhoami;
     }
 
     @Override

+ 7 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsUserController.java

@@ -90,7 +90,7 @@ public class CmsUserController{
     private final List<Long> no_blacks_userIds = List.of(375274l, 545599l, 523937l, 507498l, 604146l, 613437l, 651728l, 614100l, 604148l);
 
     @GetMapping("/get")
-    public Result<SearchResult<UserView>> get(Long id, String otherPhone, Long sharedId, String userid, Long businessId, String sort, String order, Boolean isCert, Boolean isAbroad) {
+    public Result<SearchResult<UserView>> get(Long id, String otherPhone, Long sharedId, String userid, Long businessId, String sort, String order, Boolean isCert, Boolean isAbroad, Boolean isVip) {
         MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
         String otherSql = StrUtil.EMPTY;
         if (StrUtil.isNotBlank(otherPhone)) {
@@ -124,6 +124,12 @@ public class CmsUserController{
             }
             otherSql += String.format(" %s (select 1 from phone_code pc where pc.phone = u.login_phone and cid is not null and cid != 86)", isAbroad ? "exists" : "not exists");
         }
+        if (isVip != null) {
+            if (StrUtil.isNotBlank(otherSql)) {
+                otherSql += " and ";
+            }
+            otherSql += String.format(" %s (select 1 from vip_user vu where vu.user_id = u.id and vu.expiry_time > now())", isVip ? "exists" : "not exists");
+        }
         if (StrUtil.isNotBlank(otherSql)) {
             builder.put("otherConditionSql", otherSql);
         }