@@ -8,12 +8,17 @@ import com.accompany.admin.service.UserLevelExperienceExportService;
|
||||
import com.accompany.business.constant.guild.GuildConstant;
|
||||
import com.accompany.business.dto.WeekActiveGuildStat;
|
||||
import com.accompany.business.model.*;
|
||||
import com.accompany.business.model.guild.Guild;
|
||||
import com.accompany.business.model.guild.GuildMember;
|
||||
import com.accompany.business.model.relation.RelationUser;
|
||||
import com.accompany.business.mybatismapper.*;
|
||||
import com.accompany.business.service.*;
|
||||
import com.accompany.business.service.activity.WeekStarService;
|
||||
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.level.LevelService;
|
||||
import com.accompany.business.service.lucky.BravoRecordService;
|
||||
@@ -152,6 +157,10 @@ public class MyApiService {
|
||||
private WeekGuildPartitionStatService weekGuildPartitionStatService;
|
||||
@Autowired
|
||||
private WeekRechargeAgentPartitionStatService weekRechargeAgentPartitionStatService;
|
||||
@Autowired
|
||||
private GuildOperatorService guildOperatorService;
|
||||
@Autowired
|
||||
private GuildService guildService;
|
||||
|
||||
public void refreshRoomMoneyRankList() {
|
||||
List<Long> roomUidList = myApiAdminMapper.getExceptionRoomUid();
|
||||
@@ -689,7 +698,19 @@ public class MyApiService {
|
||||
stat.setEnActiveCountDetail(JSON.toJSONString(enActiveGuildStatList));
|
||||
|
||||
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){
|
||||
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);
|
||||
@@ -735,7 +756,19 @@ public class MyApiService {
|
||||
stat.setZhActiveCountDetail(JSON.toJSONString(zhActiveGuildStatList));
|
||||
|
||||
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){
|
||||
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);
|
||||
@@ -756,6 +789,41 @@ public class MyApiService {
|
||||
log.info("[refreshWeekGuildStat] today {} last {}", JSON.toJSONString(stat), JSON.toJSONString(lastWeekStat));
|
||||
}
|
||||
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.insert(lastWeekGuildStatList);
|
||||
|
@@ -21,6 +21,10 @@ public class WeekActiveGuildStat {
|
||||
private Integer ownerRegionId;
|
||||
@TableField(exist = false)
|
||||
private String ownerRegionName;
|
||||
@TableField(exist = false)
|
||||
private Integer operatorId;
|
||||
@TableField(exist = false)
|
||||
private String operatorName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String groupByKey;
|
||||
|
@@ -8,6 +8,7 @@ import com.accompany.business.model.guild.Guild;
|
||||
import com.accompany.business.mybatismapper.WeekActiveGuildStatMapper;
|
||||
import com.accompany.business.mybatismapper.WeekGuildStatMapper;
|
||||
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.hall.HallService;
|
||||
import com.accompany.business.service.user.UsersService;
|
||||
@@ -53,6 +54,8 @@ public class WeekGuildStatService {
|
||||
private RegionInfoService regionInfoService;
|
||||
@Autowired
|
||||
private UsersService usersService;
|
||||
@Autowired
|
||||
private GuildOperatorService guildOperatorService;
|
||||
|
||||
public void stat(String monday) {
|
||||
stat(monday, true);
|
||||
@@ -238,6 +241,7 @@ public class WeekGuildStatService {
|
||||
private List<WeekActiveGuildStat> buildNewCountDetail(Map<Integer, List<String>> newGuildCountMap, Map<String, WeekActiveGuildStat> activeGuildStatMap,
|
||||
Integer partitionId, String monday, String sunday){
|
||||
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();
|
||||
if (!CollectionUtils.isEmpty(guildIdList)){
|
||||
@@ -256,10 +260,14 @@ public class WeekGuildStatService {
|
||||
List<Guild> guildList = guildService.listByIds(guildIdList);
|
||||
guildList.forEach(guild->{
|
||||
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<Integer, String> regionNameMap = regionInfoService.getRegionName();
|
||||
@@ -277,11 +285,21 @@ public class WeekGuildStatService {
|
||||
item.setActiveMemberCount(0);
|
||||
item.setGuildDiamondFlow(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;
|
||||
}).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());
|
||||
if (null != 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.mybatismapper.guild.GuildOperatorMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class GuildOperatorService extends ServiceImpl<GuildOperatorMapper, GuildOperator> {
|
||||
@@ -21,4 +25,14 @@ public class GuildOperatorService extends ServiceImpl<GuildOperatorMapper, Guild
|
||||
.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