Merge branch 'main' into test
This commit is contained in:
commit
3588d0aeee
@ -146,15 +146,21 @@ public class DatavRestController extends BaseController {
|
||||
}
|
||||
LocalDate parsedStartDate = LocalDate.parse(startDate);
|
||||
LocalDate parsedEndDate = LocalDate.parse(endDate);
|
||||
List<String> refreshedTimezones = countryDashboardBackfillLockService.call(
|
||||
() -> countryDashboardGameMetricService.refreshRange(
|
||||
parsedStartDate, parsedEndDate, sysOrigin, statTimezones));
|
||||
Map<String, Object> refreshed = countryDashboardBackfillLockService.call(() -> {
|
||||
List<String> countryTimezones = countryDashboardDailyMetricService.refreshRange(
|
||||
parsedStartDate, parsedEndDate, sysOrigin, statTimezones);
|
||||
List<String> gameTimezones = countryDashboardGameMetricService.refreshRange(
|
||||
parsedStartDate, parsedEndDate, sysOrigin, statTimezones);
|
||||
return Map.of(
|
||||
"countryStatTimezones", countryTimezones,
|
||||
"gameStatTimezones", gameTimezones);
|
||||
});
|
||||
return Map.of(
|
||||
"status", "success",
|
||||
"startDate", parsedStartDate.toString(),
|
||||
"endDate", parsedEndDate.toString(),
|
||||
"sysOrigin", sysOrigin,
|
||||
"statTimezones", refreshedTimezones);
|
||||
"statTimezones", refreshed);
|
||||
}
|
||||
|
||||
private CountryDashboardCO emptyCountryDashboard(CountryDashboardQryCmd cmd) {
|
||||
|
||||
@ -133,8 +133,6 @@ public class ResidentCpActivityServiceImpl implements ResidentCpActivityService
|
||||
private void validateConfig(ResidentCpConfigSaveCmd cmd) {
|
||||
ResponseAssert.notBlank(ResponseErrorCode.REQUEST_PARAMETER_ERROR, cmd.getSysOrigin());
|
||||
List<ResidentCpLevelConfigSaveCmd> levels = sortedLevels(cmd.getLevels());
|
||||
ResponseAssert.isTrue(ResponseErrorCode.REQUEST_PARAMETER_ERROR,
|
||||
"CP levels must contain exactly 6 items.", levels.size() == CP_LEVEL_COUNT);
|
||||
Set<Integer> levelSet = new HashSet<>();
|
||||
long previousRequiredValue = -1L;
|
||||
for (ResidentCpLevelConfigSaveCmd level : levels) {
|
||||
|
||||
@ -292,7 +292,7 @@ public class CountryDashboardServiceImpl implements CountryDashboardService {
|
||||
limit = Math.min(100, limit);
|
||||
|
||||
QueryCondition condition = QueryCondition.of(cmd);
|
||||
String countryCodes = trimToNull(cmd == null ? null : cmd.getCountryCodes());
|
||||
String countryCodes = QueryCondition.trimToNull(cmd == null ? null : cmd.getCountryCodes());
|
||||
long total = safeLong(countryDashboardDAO.countRechargeDetails(
|
||||
condition.startTime, condition.endTime, condition.countryKeyword, countryCodes,
|
||||
condition.sysOrigin, condition.storageTimezoneOffset, condition.statTimezoneOffset));
|
||||
|
||||
@ -1,12 +1,17 @@
|
||||
package com.red.circle.console.app.service.app.activity;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import com.red.circle.console.app.dto.clienobject.app.activity.cp.ResidentCpConfigCO;
|
||||
import com.red.circle.console.app.dto.clienobject.app.activity.cp.ResidentCpLevelConfigCO;
|
||||
import com.red.circle.console.app.dto.cmd.app.activity.cp.ResidentCpConfigSaveCmd;
|
||||
import com.red.circle.console.app.dto.cmd.app.activity.cp.ResidentCpLevelConfigSaveCmd;
|
||||
import com.red.circle.console.app.service.app.sys.CpCabinConfigService;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.other.inner.model.cmd.sys.SysCpCabinConfigQryCmd;
|
||||
@ -41,6 +46,29 @@ class ResidentCpActivityServiceImplTest {
|
||||
assertEquals(0L, result.getLevels().get(5).getRequiredIntimacyValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
void saveConfigShouldNotRequireExactLevelCount() {
|
||||
CpCabinConfigService cpCabinConfigService = mock(CpCabinConfigService.class);
|
||||
ResidentCpActivityServiceImpl service = new ResidentCpActivityServiceImpl(
|
||||
cpCabinConfigService);
|
||||
PageResult<SysCpCabinConfigDTO> page = new PageResult<>();
|
||||
page.setRecords(List.of());
|
||||
when(cpCabinConfigService.getCpCabin(any(SysCpCabinConfigQryCmd.class))).thenReturn(page);
|
||||
|
||||
ResidentCpConfigSaveCmd cmd = new ResidentCpConfigSaveCmd()
|
||||
.setSysOrigin("likei")
|
||||
.setLevels(List.of(
|
||||
level(0, 0L),
|
||||
level(1, 100L),
|
||||
level(2, 200L),
|
||||
level(3, 300L),
|
||||
level(4, 400L)
|
||||
));
|
||||
|
||||
assertDoesNotThrow(() -> service.saveConfig(cmd));
|
||||
verify(cpCabinConfigService, times(5)).addCpCabin(any(SysCpCabinConfigDTO.class));
|
||||
}
|
||||
|
||||
private static SysCpCabinConfigDTO config(Long id, Long sort, Long unlockValue) {
|
||||
return new SysCpCabinConfigDTO()
|
||||
.setId(id)
|
||||
@ -48,4 +76,11 @@ class ResidentCpActivityServiceImplTest {
|
||||
.setCabinUnlockValue(unlockValue)
|
||||
.setSort(sort);
|
||||
}
|
||||
|
||||
private static ResidentCpLevelConfigSaveCmd level(Integer level, Long requiredValue) {
|
||||
return new ResidentCpLevelConfigSaveCmd()
|
||||
.setLevel(level)
|
||||
.setLevelName("CP " + level + "级")
|
||||
.setRequiredIntimacyValue(requiredValue);
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,6 +78,12 @@ public class SendCpApplyCmdExe {
|
||||
|
||||
public boolean autoCreateFromCpGift(Long sendUserId, Long acceptUserId, String sysOrigin,
|
||||
String relationTypeValue, BigDecimal applyConsumeGold) {
|
||||
if (Objects.equals(sendUserId, acceptUserId)) {
|
||||
log.info(
|
||||
"[CP] skip auto create cp apply from self gift, sendUserId={}, relationType={}",
|
||||
sendUserId, relationTypeValue);
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
process(sendUserId, acceptUserId, sysOrigin, relationTypeValue, false, applyConsumeGold);
|
||||
return true;
|
||||
@ -166,7 +172,7 @@ public class SendCpApplyCmdExe {
|
||||
|
||||
sendCpBuildIm(sendUserId, acceptUserId, cpApply.getId(), userProfile, acceptUserProfile,
|
||||
isReconcile, relationType, applyText);
|
||||
|
||||
|
||||
userMqMessageService.cpApplyDelayed(
|
||||
new CpApplyEvent()
|
||||
.setId(cpApply.getId())
|
||||
|
||||
@ -109,12 +109,22 @@ class SendCpApplyCmdExeTest {
|
||||
assertTrue(data.get("content").toString().contains("\"relationType\":\"" + relationType + "\""));
|
||||
}
|
||||
|
||||
@Test
|
||||
void autoCreateFromCpGiftShouldSkipSelfGift() {
|
||||
Fixture fixture = new Fixture(1, 1);
|
||||
|
||||
assertFalse(fixture.exe.autoCreateFromCpGift(1001L, 1001L, "LIKEI", "BROTHER"));
|
||||
verify(fixture.cpApplyService, never()).save(any(CpApply.class));
|
||||
verify(fixture.userRegionGateway, never()).checkEqRegion(any(), any());
|
||||
}
|
||||
|
||||
private static class Fixture {
|
||||
|
||||
private final CpApplyService cpApplyService = mock(CpApplyService.class);
|
||||
private final ImMessageClient imMessageClient = mock(ImMessageClient.class);
|
||||
private final UserMqMessageService userMqMessageService = mock(UserMqMessageService.class);
|
||||
private final CpRelationshipService cpRelationshipService = mock(CpRelationshipService.class);
|
||||
private final UserRegionGateway userRegionGateway = mock(UserRegionGateway.class);
|
||||
private final SendCpApplyCmdExe exe;
|
||||
private long nextApplyId = 3001L;
|
||||
|
||||
@ -123,8 +133,6 @@ class SendCpApplyCmdExeTest {
|
||||
EnumConfigCacheService enumConfigCacheService = mock(EnumConfigCacheService.class);
|
||||
UserProfileGateway userProfileGateway = mock(UserProfileGateway.class);
|
||||
UserProfileAppConvertor userProfileAppConvertor = mock(UserProfileAppConvertor.class);
|
||||
UserRegionGateway userRegionGateway = mock(UserRegionGateway.class);
|
||||
|
||||
UserProfile sendProfile = new UserProfile();
|
||||
sendProfile.setId(1001L);
|
||||
UserProfile acceptProfile = new UserProfile();
|
||||
|
||||
@ -5,7 +5,6 @@ import com.red.circle.common.business.enums.PropsActivityRewardEnum;
|
||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||
import com.red.circle.framework.core.response.CommonErrorCode;
|
||||
import com.red.circle.other.domain.gateway.props.ActivitySourceGroupGateway;
|
||||
import com.red.circle.other.infra.common.activity.VipActivityRewardCommon;
|
||||
import com.red.circle.other.infra.common.props.PropsResourcesCommon;
|
||||
import com.red.circle.other.infra.convertor.material.PropsActivityInfraConvertor;
|
||||
import com.red.circle.other.infra.database.rds.entity.activity.PropsActivityRewardConfig;
|
||||
@ -383,8 +382,6 @@ public class ActivitySourceGroupGatewayImpl implements ActivitySourceGroupGatewa
|
||||
return rewardGroupConfigMap.values().stream()
|
||||
.flatMap(Collection::stream)
|
||||
.filter(config -> PropsActivityRewardEnum.PROPS.eq(config.getType()))
|
||||
.filter(config -> Objects.equals(config.getDetailType(),
|
||||
VipActivityRewardCommon.VIP_DETAIL_TYPE))
|
||||
.map(config -> DataTypeUtils.toLong(config.getContent()))
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
@ -408,7 +405,6 @@ public class ActivitySourceGroupGatewayImpl implements ActivitySourceGroupGatewa
|
||||
|
||||
private boolean isVipLevelReward(PropsActivityRewardConfig rewardConfig, Set<Long> vipConfigIds) {
|
||||
return PropsActivityRewardEnum.PROPS.eq(rewardConfig.getType())
|
||||
&& Objects.equals(rewardConfig.getDetailType(), VipActivityRewardCommon.VIP_DETAIL_TYPE)
|
||||
&& vipConfigIds.contains(DataTypeUtils.toLong(rewardConfig.getContent()));
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.red.circle.common.business.enums.PropsActivityRewardEnum;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.other.infra.common.activity.VipActivityRewardCommon;
|
||||
import com.red.circle.other.app.inner.convertor.material.PropsInnerConvertor;
|
||||
import com.red.circle.other.app.inner.service.material.props.PropsActivityRewardGroupClientService;
|
||||
import com.red.circle.other.infra.database.rds.entity.activity.PropsActivityRewardConfig;
|
||||
@ -354,8 +353,6 @@ public class PropsActivityRewardGroupClientServiceImpl implements
|
||||
private Set<Long> getVipLevelConfigIds(List<PropsActivityRewardConfig> configs) {
|
||||
return configs.stream()
|
||||
.filter(config -> Objects.equals(config.getType(), PropsActivityRewardEnum.PROPS.name()))
|
||||
.filter(config -> Objects.equals(config.getDetailType(),
|
||||
VipActivityRewardCommon.VIP_DETAIL_TYPE))
|
||||
.map(config -> DataTypeUtils.toLong(config.getContent()))
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
@ -375,7 +372,6 @@ public class PropsActivityRewardGroupClientServiceImpl implements
|
||||
private boolean isVipLevelReward(PropsActivityRewardConfig config,
|
||||
Map<Long, VipLevelConfig> vipConfigMap) {
|
||||
return Objects.equals(config.getType(), PropsActivityRewardEnum.PROPS.name())
|
||||
&& Objects.equals(config.getDetailType(), VipActivityRewardCommon.VIP_DETAIL_TYPE)
|
||||
&& vipConfigMap.containsKey(DataTypeUtils.toLong(config.getContent()));
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user