公会周统计添加负责人
This commit is contained in:
@@ -8,12 +8,17 @@ import com.accompany.admin.service.UserLevelExperienceExportService;
|
|||||||
import com.accompany.business.constant.guild.GuildConstant;
|
import com.accompany.business.constant.guild.GuildConstant;
|
||||||
import com.accompany.business.dto.WeekActiveGuildStat;
|
import com.accompany.business.dto.WeekActiveGuildStat;
|
||||||
import com.accompany.business.model.*;
|
import com.accompany.business.model.*;
|
||||||
|
import com.accompany.business.model.guild.Guild;
|
||||||
import com.accompany.business.model.guild.GuildMember;
|
import com.accompany.business.model.guild.GuildMember;
|
||||||
import com.accompany.business.model.relation.RelationUser;
|
import com.accompany.business.model.relation.RelationUser;
|
||||||
import com.accompany.business.mybatismapper.*;
|
import com.accompany.business.mybatismapper.*;
|
||||||
import com.accompany.business.service.*;
|
import com.accompany.business.service.*;
|
||||||
import com.accompany.business.service.activity.WeekStarService;
|
import com.accompany.business.service.activity.WeekStarService;
|
||||||
import com.accompany.business.service.apple.IOSRefundV2Service;
|
import com.accompany.business.service.apple.IOSRefundV2Service;
|
||||||
|
import com.accompany.business.service.guild.GuildDressUpService;
|
||||||
|
import com.accompany.business.service.guild.GuildMemberService;
|
||||||
|
import com.accompany.business.service.guild.GuildOperatorService;
|
||||||
|
import com.accompany.business.service.guild.GuildService;
|
||||||
import com.accompany.business.service.guild.*;
|
import com.accompany.business.service.guild.*;
|
||||||
import com.accompany.business.service.guildpolicy2.GuildCrystalSettlementService;
|
import com.accompany.business.service.guildpolicy2.GuildCrystalSettlementService;
|
||||||
import com.accompany.business.service.level.LevelService;
|
import com.accompany.business.service.level.LevelService;
|
||||||
@@ -149,6 +154,10 @@ public class MyApiService {
|
|||||||
private WeekGuildPartitionStatService weekGuildPartitionStatService;
|
private WeekGuildPartitionStatService weekGuildPartitionStatService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private WeekRechargeAgentPartitionStatService weekRechargeAgentPartitionStatService;
|
private WeekRechargeAgentPartitionStatService weekRechargeAgentPartitionStatService;
|
||||||
|
@Autowired
|
||||||
|
private GuildOperatorService guildOperatorService;
|
||||||
|
@Autowired
|
||||||
|
private GuildService guildService;
|
||||||
|
|
||||||
public void refreshRoomMoneyRankList() {
|
public void refreshRoomMoneyRankList() {
|
||||||
List<Long> roomUidList = myApiAdminMapper.getExceptionRoomUid();
|
List<Long> roomUidList = myApiAdminMapper.getExceptionRoomUid();
|
||||||
@@ -686,7 +695,19 @@ public class MyApiService {
|
|||||||
stat.setEnActiveCountDetail(JSON.toJSONString(enActiveGuildStatList));
|
stat.setEnActiveCountDetail(JSON.toJSONString(enActiveGuildStatList));
|
||||||
|
|
||||||
List<WeekActiveGuildStat> arActiveGuildStatList = JSON.parseArray(stat.getArActiveCountDetail(), WeekActiveGuildStat.class);
|
List<WeekActiveGuildStat> arActiveGuildStatList = JSON.parseArray(stat.getArActiveCountDetail(), WeekActiveGuildStat.class);
|
||||||
|
Map<Integer, String> operatorNameMap = guildOperatorService.operatorNameMap(PartitionEnum.ARAB.getId());
|
||||||
|
Map<Integer, Guild> guildMap = new HashMap<>();
|
||||||
|
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(arActiveGuildStatList)) {
|
||||||
|
List<Integer> guildIds = arActiveGuildStatList.stream().map(WeekActiveGuildStat::getGuildId).collect(Collectors.toList());
|
||||||
|
List<Guild> guildList = guildService.listByIds(guildIds);
|
||||||
|
guildMap = guildList.stream().collect(Collectors.toMap(Guild::getId, guild->guild));
|
||||||
|
}
|
||||||
for (WeekActiveGuildStat activeGuildStat : arActiveGuildStatList){
|
for (WeekActiveGuildStat activeGuildStat : arActiveGuildStatList){
|
||||||
|
Guild guild = guildMap.get(activeGuildStat.getGuildId());
|
||||||
|
if (guild != null && guild.getOperatorId() != null) {
|
||||||
|
activeGuildStat.setOperatorId(guild.getOperatorId());
|
||||||
|
activeGuildStat.setOperatorName(operatorNameMap.get(guild.getOperatorId()));
|
||||||
|
}
|
||||||
String lastWeek = DateTimeUtil.convertDate(DateTimeUtil.addDays(DateTimeUtil.convertStrToDate(activeGuildStat.getDate(), DateTimeUtil.DEFAULT_DATE_PATTERN), -7));
|
String lastWeek = DateTimeUtil.convertDate(DateTimeUtil.addDays(DateTimeUtil.convertStrToDate(activeGuildStat.getDate(), DateTimeUtil.DEFAULT_DATE_PATTERN), -7));
|
||||||
String lastWeekGroupByKey = String.join("_", lastWeek, activeGuildStat.getPartitionId().toString(), activeGuildStat.getGuildId().toString());
|
String lastWeekGroupByKey = String.join("_", lastWeek, activeGuildStat.getPartitionId().toString(), activeGuildStat.getGuildId().toString());
|
||||||
WeekActiveGuildStat lastWeekStat = lastWeekActiveGuildStatMap.get(lastWeekGroupByKey);
|
WeekActiveGuildStat lastWeekStat = lastWeekActiveGuildStatMap.get(lastWeekGroupByKey);
|
||||||
@@ -732,7 +753,19 @@ public class MyApiService {
|
|||||||
stat.setZhActiveCountDetail(JSON.toJSONString(zhActiveGuildStatList));
|
stat.setZhActiveCountDetail(JSON.toJSONString(zhActiveGuildStatList));
|
||||||
|
|
||||||
List<WeekActiveGuildStat> trActiveGuildStatList = JSON.parseArray(stat.getTrActiveCountDetail(), WeekActiveGuildStat.class);
|
List<WeekActiveGuildStat> trActiveGuildStatList = JSON.parseArray(stat.getTrActiveCountDetail(), WeekActiveGuildStat.class);
|
||||||
|
operatorNameMap = guildOperatorService.operatorNameMap(PartitionEnum.TURKEY.getId());
|
||||||
|
guildMap = new HashMap<>();
|
||||||
|
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(trActiveGuildStatList)) {
|
||||||
|
List<Integer> guildIds = trActiveGuildStatList.stream().map(WeekActiveGuildStat::getGuildId).collect(Collectors.toList());
|
||||||
|
List<Guild> guildList = guildService.listByIds(guildIds);
|
||||||
|
guildMap = guildList.stream().collect(Collectors.toMap(Guild::getId, guild->guild));
|
||||||
|
}
|
||||||
for (WeekActiveGuildStat activeGuildStat : trActiveGuildStatList){
|
for (WeekActiveGuildStat activeGuildStat : trActiveGuildStatList){
|
||||||
|
Guild guild = guildMap.get(activeGuildStat.getGuildId());
|
||||||
|
if (guild != null && guild.getOperatorId() != null) {
|
||||||
|
activeGuildStat.setOperatorId(guild.getOperatorId());
|
||||||
|
activeGuildStat.setOperatorName(operatorNameMap.get(guild.getOperatorId()));
|
||||||
|
}
|
||||||
String lastWeek = DateTimeUtil.convertDate(DateTimeUtil.addDays(DateTimeUtil.convertStrToDate(activeGuildStat.getDate(), DateTimeUtil.DEFAULT_DATE_PATTERN), -7));
|
String lastWeek = DateTimeUtil.convertDate(DateTimeUtil.addDays(DateTimeUtil.convertStrToDate(activeGuildStat.getDate(), DateTimeUtil.DEFAULT_DATE_PATTERN), -7));
|
||||||
String lastWeekGroupByKey = String.join("_", lastWeek, activeGuildStat.getPartitionId().toString(), activeGuildStat.getGuildId().toString());
|
String lastWeekGroupByKey = String.join("_", lastWeek, activeGuildStat.getPartitionId().toString(), activeGuildStat.getGuildId().toString());
|
||||||
WeekActiveGuildStat lastWeekStat = lastWeekActiveGuildStatMap.get(lastWeekGroupByKey);
|
WeekActiveGuildStat lastWeekStat = lastWeekActiveGuildStatMap.get(lastWeekGroupByKey);
|
||||||
@@ -753,6 +786,41 @@ public class MyApiService {
|
|||||||
log.info("[refreshWeekGuildStat] today {} last {}", JSON.toJSONString(stat), JSON.toJSONString(lastWeekStat));
|
log.info("[refreshWeekGuildStat] today {} last {}", JSON.toJSONString(stat), JSON.toJSONString(lastWeekStat));
|
||||||
}
|
}
|
||||||
stat.setTrActiveCountDetail(JSON.toJSONString(trActiveGuildStatList));
|
stat.setTrActiveCountDetail(JSON.toJSONString(trActiveGuildStatList));
|
||||||
|
|
||||||
|
List<WeekActiveGuildStat> en2ActiveGuildStatList = JSON.parseArray(stat.getEn2ActiveCountDetail(), WeekActiveGuildStat.class);
|
||||||
|
operatorNameMap = guildOperatorService.operatorNameMap(PartitionEnum.ENGLISH2.getId());
|
||||||
|
guildMap = new HashMap<>();
|
||||||
|
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(en2ActiveGuildStatList)) {
|
||||||
|
List<Integer> guildIds = en2ActiveGuildStatList.stream().map(WeekActiveGuildStat::getGuildId).collect(Collectors.toList());
|
||||||
|
List<Guild> guildList = guildService.listByIds(guildIds);
|
||||||
|
guildMap = guildList.stream().collect(Collectors.toMap(Guild::getId, guild->guild));
|
||||||
|
}
|
||||||
|
for (WeekActiveGuildStat activeGuildStat : en2ActiveGuildStatList){
|
||||||
|
Guild guild = guildMap.get(activeGuildStat.getGuildId());
|
||||||
|
if (guild != null && guild.getOperatorId() != null) {
|
||||||
|
activeGuildStat.setOperatorId(guild.getOperatorId());
|
||||||
|
activeGuildStat.setOperatorName(operatorNameMap.get(guild.getOperatorId()));
|
||||||
|
}
|
||||||
|
String lastWeek = DateTimeUtil.convertDate(DateTimeUtil.addDays(DateTimeUtil.convertStrToDate(activeGuildStat.getDate(), DateTimeUtil.DEFAULT_DATE_PATTERN), -7));
|
||||||
|
String lastWeekGroupByKey = String.join("_", lastWeek, activeGuildStat.getPartitionId().toString(), activeGuildStat.getGuildId().toString());
|
||||||
|
WeekActiveGuildStat lastWeekStat = lastWeekActiveGuildStatMap.get(lastWeekGroupByKey);
|
||||||
|
if (null == lastWeekStat){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
activeGuildStat.setLastGuildDiamondFlow(lastWeekStat.getGuildDiamondFlow());
|
||||||
|
activeGuildStat.setLastGuildGoldFlow(lastWeekStat.getGuildGoldFlow());
|
||||||
|
|
||||||
|
BigDecimal guildDiamondFlowWow = lastWeekStat.getGuildDiamondFlow().compareTo(BigDecimal.ZERO) > 0 ?
|
||||||
|
(activeGuildStat.getGuildDiamondFlow().subtract(lastWeekStat.getGuildDiamondFlow())).divide(lastWeekStat.getGuildDiamondFlow(), 2, RoundingMode.HALF_UP): BigDecimal.ONE;
|
||||||
|
activeGuildStat.setGuildDiamondFlowWow(guildDiamondFlowWow);
|
||||||
|
|
||||||
|
BigDecimal guildGoldFlowWow = lastWeekStat.getGuildGoldFlow().compareTo(BigDecimal.ZERO) > 0 ?
|
||||||
|
(activeGuildStat.getGuildGoldFlow().subtract(lastWeekStat.getGuildGoldFlow())).divide(lastWeekStat.getGuildGoldFlow(), 2, RoundingMode.HALF_UP): BigDecimal.ONE;
|
||||||
|
activeGuildStat.setGuildGoldFlowWow(guildGoldFlowWow);
|
||||||
|
|
||||||
|
log.info("[refreshWeekGuildStat] today {} last {}", JSON.toJSONString(stat), JSON.toJSONString(lastWeekStat));
|
||||||
|
}
|
||||||
|
stat.setEn2ActiveCountDetail(JSON.toJSONString(en2ActiveGuildStatList));
|
||||||
}
|
}
|
||||||
weekGuildStatMapper.delete(null);
|
weekGuildStatMapper.delete(null);
|
||||||
weekGuildStatMapper.insert(lastWeekGuildStatList);
|
weekGuildStatMapper.insert(lastWeekGuildStatList);
|
||||||
|
@@ -21,6 +21,10 @@ public class WeekActiveGuildStat {
|
|||||||
private Integer ownerRegionId;
|
private Integer ownerRegionId;
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String ownerRegionName;
|
private String ownerRegionName;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer operatorId;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String operatorName;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String groupByKey;
|
private String groupByKey;
|
||||||
|
@@ -5,9 +5,10 @@ import com.accompany.business.model.Hall;
|
|||||||
import com.accompany.business.model.WeekGuildStat;
|
import com.accompany.business.model.WeekGuildStat;
|
||||||
import com.accompany.business.model.family.Family;
|
import com.accompany.business.model.family.Family;
|
||||||
import com.accompany.business.model.guild.Guild;
|
import com.accompany.business.model.guild.Guild;
|
||||||
import com.accompany.business.mybatismapper.WeekGuildStatMapper;
|
|
||||||
import com.accompany.business.mybatismapper.WeekActiveGuildStatMapper;
|
import com.accompany.business.mybatismapper.WeekActiveGuildStatMapper;
|
||||||
|
import com.accompany.business.mybatismapper.WeekGuildStatMapper;
|
||||||
import com.accompany.business.service.family.FamilyService;
|
import com.accompany.business.service.family.FamilyService;
|
||||||
|
import com.accompany.business.service.guild.GuildOperatorService;
|
||||||
import com.accompany.business.service.guild.GuildService;
|
import com.accompany.business.service.guild.GuildService;
|
||||||
import com.accompany.business.service.hall.HallService;
|
import com.accompany.business.service.hall.HallService;
|
||||||
import com.accompany.business.service.user.UsersService;
|
import com.accompany.business.service.user.UsersService;
|
||||||
@@ -53,6 +54,8 @@ public class WeekGuildStatService {
|
|||||||
private RegionInfoService regionInfoService;
|
private RegionInfoService regionInfoService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UsersService usersService;
|
private UsersService usersService;
|
||||||
|
@Autowired
|
||||||
|
private GuildOperatorService guildOperatorService;
|
||||||
|
|
||||||
public void stat(String monday) {
|
public void stat(String monday) {
|
||||||
stat(monday, true);
|
stat(monday, true);
|
||||||
@@ -245,6 +248,7 @@ public class WeekGuildStatService {
|
|||||||
private List<WeekActiveGuildStat> buildNewCountDetail(Map<Integer, List<String>> newGuildCountMap, Map<String, WeekActiveGuildStat> activeGuildStatMap,
|
private List<WeekActiveGuildStat> buildNewCountDetail(Map<Integer, List<String>> newGuildCountMap, Map<String, WeekActiveGuildStat> activeGuildStatMap,
|
||||||
Integer partitionId, String monday, String sunday){
|
Integer partitionId, String monday, String sunday){
|
||||||
Map<Integer, Long> ownerUidMap = new HashMap<>();
|
Map<Integer, Long> ownerUidMap = new HashMap<>();
|
||||||
|
Map<Integer, Integer> operatorIdMap = new HashMap<>();
|
||||||
|
|
||||||
List<Long> guildIdList = newGuildCountMap.containsKey(partitionId)? newGuildCountMap.get(partitionId).stream().map(key->Long.parseLong(key.split("_")[1])).distinct().toList():Collections.emptyList();
|
List<Long> guildIdList = newGuildCountMap.containsKey(partitionId)? newGuildCountMap.get(partitionId).stream().map(key->Long.parseLong(key.split("_")[1])).distinct().toList():Collections.emptyList();
|
||||||
if (!CollectionUtils.isEmpty(guildIdList)){
|
if (!CollectionUtils.isEmpty(guildIdList)){
|
||||||
@@ -263,10 +267,14 @@ public class WeekGuildStatService {
|
|||||||
List<Guild> guildList = guildService.listByIds(guildIdList);
|
List<Guild> guildList = guildService.listByIds(guildIdList);
|
||||||
guildList.forEach(guild->{
|
guildList.forEach(guild->{
|
||||||
ownerUidMap.put(guild.getId(), guild.getOwnerUid());
|
ownerUidMap.put(guild.getId(), guild.getOwnerUid());
|
||||||
|
operatorIdMap.put(guild.getId(), guild.getOperatorId());
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<Integer, String> guildOperatorMap = guildOperatorService.operatorNameMap(partitionId);
|
||||||
|
|
||||||
Map<Long, Users> ownerUserMap = usersService.getUsersMapByUids(ownerUidMap.values().stream().toList());
|
Map<Long, Users> ownerUserMap = usersService.getUsersMapByUids(ownerUidMap.values().stream().toList());
|
||||||
|
|
||||||
Map<Integer, String> regionNameMap = regionInfoService.getRegionName();
|
Map<Integer, String> regionNameMap = regionInfoService.getRegionName();
|
||||||
@@ -284,11 +292,21 @@ public class WeekGuildStatService {
|
|||||||
item.setActiveMemberCount(0);
|
item.setActiveMemberCount(0);
|
||||||
item.setGuildDiamondFlow(BigDecimal.ZERO);
|
item.setGuildDiamondFlow(BigDecimal.ZERO);
|
||||||
item.setGuildGoldFlow(BigDecimal.ZERO);
|
item.setGuildGoldFlow(BigDecimal.ZERO);
|
||||||
|
Integer operatorId = operatorIdMap.getOrDefault(item.getGuildId(), null);
|
||||||
|
if (operatorId != null) {
|
||||||
|
item.setOperatorId(operatorId);
|
||||||
|
item.setOperatorName(guildOperatorMap.getOrDefault(item.getOperatorId(), ""));
|
||||||
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}).peek(item->{
|
}).peek(item->{
|
||||||
|
Integer operatorId = operatorIdMap.getOrDefault(item.getGuildId(), null);
|
||||||
|
if (operatorId != null) {
|
||||||
|
item.setOperatorId(operatorId);
|
||||||
|
item.setOperatorName(guildOperatorMap.getOrDefault(item.getOperatorId(), ""));
|
||||||
|
}
|
||||||
Long ownerUid = ownerUidMap.get(item.getGuildId());
|
Long ownerUid = ownerUidMap.get(item.getGuildId());
|
||||||
if (null != ownerUid){
|
if (null != ownerUid){
|
||||||
Users ownerUser = ownerUserMap.get(ownerUid);
|
Users ownerUser = ownerUserMap.get(ownerUid);
|
||||||
|
@@ -3,9 +3,13 @@ package com.accompany.business.service.guild;
|
|||||||
import com.accompany.business.model.guild.GuildOperator;
|
import com.accompany.business.model.guild.GuildOperator;
|
||||||
import com.accompany.business.mybatismapper.guild.GuildOperatorMapper;
|
import com.accompany.business.mybatismapper.guild.GuildOperatorMapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class GuildOperatorService extends ServiceImpl<GuildOperatorMapper, GuildOperator> {
|
public class GuildOperatorService extends ServiceImpl<GuildOperatorMapper, GuildOperator> {
|
||||||
@@ -21,4 +25,14 @@ public class GuildOperatorService extends ServiceImpl<GuildOperatorMapper, Guild
|
|||||||
.list();
|
.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<Integer, String> operatorNameMap(Integer partitionId){
|
||||||
|
List<GuildOperator> guildOperators = listByPartitionId(partitionId);
|
||||||
|
if (CollectionUtils.isEmpty(guildOperators)) {
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
|
return guildOperators
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(GuildOperator::getId, GuildOperator::getName));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user