公会-结算-cal方法返回nullable

This commit is contained in:
khalil
2025-07-29 17:14:20 +08:00
committed by hokli
parent d5d21eb0e0
commit face96a9da
2 changed files with 12 additions and 3 deletions

View File

@@ -86,6 +86,9 @@ public class GuildSettleRecordAdminService {
if (curCycleDate.equals(basePageParams.getDateCycle())){
String endDate = CycleTimeUtil.getCurCycleEndDateByZoneId(partitionInfo.getZoneId());
List<GuildSettleRecord> poList = guildSettleService.cal(basePageParams.getPartitionId(), curCycleDate, endDate, gId, basePageParams.getRegionId());
if (CollectionUtils.isEmpty(poList)){
return voPage;
}
List<GuildSettleRecordAdminVo> voList = transferToVo(poList, basePageParams.getPageNo(), basePageParams.getPageSize());
voPage.setRecords(voList);
voPage.setTotal(poList.size());
@@ -110,7 +113,9 @@ public class GuildSettleRecordAdminService {
private List<GuildSettleRecordAdminVo> transferToVo(List<GuildSettleRecord> poList, Integer pageNo, Integer pageSize) {
if (null != pageNo && null != pageSize){
poList = poList.subList((pageNo - 1) * pageSize, pageNo * pageSize);
int start = (pageNo - 1) * pageSize;
int end = Math.min(poList.size(), start + pageSize);
poList = poList.subList(start, end);
}
List<Integer> guildIdList = poList.stream().map(GuildSettleRecord::getGuildId).distinct().toList();

View File

@@ -26,6 +26,7 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -64,8 +65,7 @@ public class GuildSettleService {
public List<GuildSettleRecord> cal(Integer partitionId, String beginDate, String endDate, Integer gId, Integer regionId){
List<GuildMemberDiamondStatisticsVo> memberSettleList = guildMemberDiamondStatisticsMapper.listGuildMemberDiamondStat(partitionId, beginDate, gId, regionId);
if (CollectionUtils.isEmpty(memberSettleList)){
log.error("[guild settle] partitionId {} cycleDate {} 周期内无有效公会", partitionId, beginDate);
throw new ServiceException(BusiStatus.SERVERERROR);
return Collections.emptyList();
}
Map<Integer, List<GuildMemberDiamondStatisticsVo>> groupByGuildIdMap = memberSettleList.stream().collect(Collectors.groupingBy(GuildMemberDiamondStatisticsVo::getGuildId));
@@ -125,6 +125,10 @@ public class GuildSettleService {
public void settle(Integer partitionId, String beginDate, String endDate){
List<GuildSettleRecord> guildSettleRecords = cal(partitionId, beginDate, endDate, null, null);
if (CollectionUtils.isEmpty(guildSettleRecords)){
log.error("[guild settle] partitionId {} cycleDate {} 周期内无有效公会", partitionId, beginDate);
return;
}
guildSettleRecordService.saveBatch(guildSettleRecords);
sendMessage(guildSettleRecords);