zoujiajian 11 сар өмнө
parent
commit
0dfe2807b9

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/model/views/NanoUserQuotaInfoView.java

@@ -27,6 +27,8 @@ public class NanoUserQuotaInfoView {
 
 	private Long relationId;
 
+	private Long skuId;
+
 	/**
 	 * 用户昵称
 	 */

+ 17 - 3
netflix-service/src/main/java/com/cyksj/service/nano/impl/NanoServiceImpl.java

@@ -2,7 +2,11 @@ package com.cyksj.service.nano.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.cyksj.mapper.GroupsMapper;
+import com.cyksj.mapper.GroupsRelationMapper;
 import com.cyksj.mapper.NanoUserQuotaMapper;
+import com.cyksj.model.entity.GroupsRelation;
+import com.cyksj.model.entity.GroupsTrips;
 import com.cyksj.model.entity.NanoUserQuota;
 import com.cyksj.model.views.NanoUserQuotaInfoView;
 import com.cyksj.service.nano.NanoService;
@@ -21,12 +25,22 @@ public class NanoServiceImpl implements NanoService {
 	private final UserBindRelationService userBindRelationService;
 
 	private final NanoUserQuotaMapper nanoUserQuotaMapper;
+
+	private final GroupsRelationMapper groupsRelationMapper;
+
+	private final GroupsMapper groupsMapper;
 	@Override
 	public NanoUserQuotaInfoView getUserSubsInfo(long userId) {
 		List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
 		NanoUserQuota nanoUserQuota = nanoUserQuotaMapper.selectOne(Wrappers.lambdaQuery(NanoUserQuota.class).in(NanoUserQuota::getUid, userIdList).last("limit 1"));
-		NanoUserQuotaInfoView nanoUserQuotaInfoView = new NanoUserQuotaInfoView();
-		BeanUtil.copyProperties(nanoUserQuota, nanoUserQuotaInfoView);
-		return nanoUserQuotaInfoView;
+		if (nanoUserQuota != null) {
+			GroupsRelation relation = groupsRelationMapper.selectById(nanoUserQuota.getRelationId());
+			GroupsTrips groupsTrips = groupsMapper.selectById(relation.getGroupsId());
+			NanoUserQuotaInfoView nanoUserQuotaInfoView = new NanoUserQuotaInfoView();
+			BeanUtil.copyProperties(nanoUserQuota, nanoUserQuotaInfoView);
+			nanoUserQuotaInfoView.setSkuId(groupsTrips.getSkuId());
+			return nanoUserQuotaInfoView;
+		}
+		return null;
 	}
 }