v1.1 家族列表
This commit is contained in:
@@ -105,6 +105,8 @@ public interface ClanService extends IService<Clan> {
|
|||||||
*/
|
*/
|
||||||
List<ClanRankListVO> listClanRankV2();
|
List<ClanRankListVO> listClanRankV2();
|
||||||
|
|
||||||
|
List<ClanRankListVO> listClan();
|
||||||
|
|
||||||
List<Clan> getValidClanByUid(Long clanElderUid);
|
List<Clan> getValidClanByUid(Long clanElderUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,7 +37,6 @@ import com.accompany.core.model.Users;
|
|||||||
import com.accompany.core.service.common.JedisService;
|
import com.accompany.core.service.common.JedisService;
|
||||||
import com.accompany.core.service.user.UsersBaseService;
|
import com.accompany.core.service.user.UsersBaseService;
|
||||||
import com.accompany.core.vo.UserLevelVo;
|
import com.accompany.core.vo.UserLevelVo;
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
@@ -251,21 +250,21 @@ public class ClanServiceImpl extends ServiceImpl<ClanMapper, Clan> implements Cl
|
|||||||
return clanMapper.getClanBaseInfoByUid(uid);
|
return clanMapper.getClanBaseInfoByUid(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* 填充等级信息
|
public List<ClanRankListVO> listClanRankV2() {
|
||||||
*
|
Long begin = Long.valueOf((Constant.DEFAULT_PAGE - 1) * Constant.DEFAULT_PAGE_SIZE);
|
||||||
* @param memberList
|
Long end = Long.valueOf(Constant.DEFAULT_PAGE * Constant.DEFAULT_PAGE_SIZE - 1);
|
||||||
*/
|
return rankClanList(begin, end);
|
||||||
private void fillLevelVo(List<ClanMemberVO> memberList) {
|
|
||||||
if (CollectionUtils.isNotEmpty(memberList)) {
|
|
||||||
List<String> uids = memberList.stream().map(member -> member.getUid().toString()).collect(Collectors.toList());
|
|
||||||
Map<Long, UserLevelVo> userLevelVoMap = levelService.getUserLevelVoMap(uids.toArray(new String[uids.size()]));
|
|
||||||
memberList.forEach((member) -> member.setUserLevelVo(userLevelVoMap.get(member.getUid())));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ClanRankListVO> listClanRankV2() {
|
public List<ClanRankListVO> listClan() {
|
||||||
|
Long begin = Long.MIN_VALUE;
|
||||||
|
Long end = Long.MAX_VALUE;
|
||||||
|
return rankClanList(begin, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ClanRankListVO> rankClanList(Long begin, Long end) {
|
||||||
// 获取家族列表
|
// 获取家族列表
|
||||||
List<ClanRankListVO> clanRankListVOS = clanMapper.listClanRankWithOutIncome();
|
List<ClanRankListVO> clanRankListVOS = clanMapper.listClanRankWithOutIncome();
|
||||||
|
|
||||||
@@ -286,8 +285,6 @@ public class ClanServiceImpl extends ServiceImpl<ClanMapper, Clan> implements Cl
|
|||||||
|
|
||||||
|
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
Long begin = Long.valueOf((Constant.DEFAULT_PAGE - 1) * Constant.DEFAULT_PAGE_SIZE);
|
|
||||||
Long end = Long.valueOf(Constant.DEFAULT_PAGE * Constant.DEFAULT_PAGE_SIZE - 1);
|
|
||||||
// 获取家族的周流水
|
// 获取家族的周流水
|
||||||
Set<Map<String, Object>> mapSet = jedisService.zrevrangeWithScore(getClanWeekKey(date), begin, end);
|
Set<Map<String, Object>> mapSet = jedisService.zrevrangeWithScore(getClanWeekKey(date), begin, end);
|
||||||
if (!CollectionUtils.isEmpty(mapSet)) {
|
if (!CollectionUtils.isEmpty(mapSet)) {
|
||||||
@@ -314,6 +311,19 @@ public class ClanServiceImpl extends ServiceImpl<ClanMapper, Clan> implements Cl
|
|||||||
return clanRankListVOS;
|
return clanRankListVOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 填充等级信息
|
||||||
|
*
|
||||||
|
* @param memberList
|
||||||
|
*/
|
||||||
|
private void fillLevelVo(List<ClanMemberVO> memberList) {
|
||||||
|
if (CollectionUtils.isNotEmpty(memberList)) {
|
||||||
|
List<String> uids = memberList.stream().map(member -> member.getUid().toString()).collect(Collectors.toList());
|
||||||
|
Map<Long, UserLevelVo> userLevelVoMap = levelService.getUserLevelVoMap(uids.toArray(new String[uids.size()]));
|
||||||
|
memberList.forEach((member) -> member.setUserLevelVo(userLevelVoMap.get(member.getUid())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String getClanWeekKey(Date date) {
|
private String getClanWeekKey(Date date) {
|
||||||
String key = Constant.RankDatetype.week.toString() + ":" + DateTimeUtil.convertDate(DateTimeUtil.getMonday(date, 0, 0, 0), DateTimeUtil.DEFAULT_DATE_PATTERN);
|
String key = Constant.RankDatetype.week.toString() + ":" + DateTimeUtil.convertDate(DateTimeUtil.getMonday(date, 0, 0, 0), DateTimeUtil.DEFAULT_DATE_PATTERN);
|
||||||
return RedisKey.clan_rank.getKey(key);
|
return RedisKey.clan_rank.getKey(key);
|
||||||
|
@@ -196,10 +196,9 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="listClanRankWithOutIncome" resultMap="clanRankListVO">
|
<select id="listClanRankWithOutIncome" resultMap="clanRankListVO">
|
||||||
SELECT IFNULL(c.avatar,u.avatar) avatar, c.`name` , cl.level_icon, c.id, c.level, c.clan_elder_uid uid
|
SELECT c.avatar, c.`name` , cl.level_icon, c.id, c.level, c.clan_elder_uid uid
|
||||||
from clan c, users u, clan_level_setting cl
|
from clan c, clan_level_setting cl
|
||||||
where c.clan_elder_uid = u.uid
|
where c.`status` = 1
|
||||||
and c.`status` = 1
|
|
||||||
and c.`level` = cl.`level`
|
and c.`level` = cl.`level`
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@@ -96,4 +96,11 @@ public class ClanController extends BaseController {
|
|||||||
public BaseResponseVO<List<ClanRankListVO>> listClanRank() {
|
public BaseResponseVO<List<ClanRankListVO>> listClanRank() {
|
||||||
return new BaseResponseVO(BusinessStatusCodeEnum.SUCCESS, clanService.listClanRankV2());
|
return new BaseResponseVO(BusinessStatusCodeEnum.SUCCESS, clanService.listClanRankV2());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取家族信息")
|
||||||
|
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||||
|
@Authorization
|
||||||
|
public BaseResponseVO<List<ClanRankListVO>> listClan() {
|
||||||
|
return new BaseResponseVO(BusinessStatusCodeEnum.SUCCESS, clanService.listClan());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user