126 lines
5.1 KiB
Java

import com.red.circle.OtherServiceApplication;
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
import com.red.circle.common.business.enums.ConsoleAccountStatusEnum;
import com.red.circle.external.inner.endpoint.message.ImGroupClient;
import com.red.circle.external.inner.endpoint.message.OfficialNoticeClient;
import com.red.circle.external.inner.model.cmd.message.BroadcastGroupMsgBodyCmd;
import com.red.circle.external.inner.model.cmd.message.notice.official.NoticeExtTemplateTypeCmd;
import com.red.circle.external.inner.model.enums.message.GroupMessageTypeEnum;
import com.red.circle.external.inner.model.enums.message.OfficialNoticeTypeEnum;
import com.red.circle.framework.core.dto.ReqSysOrigin;
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
import com.red.circle.other.app.dto.cmd.activity.RankingDataUpdateCmd;
import com.red.circle.other.app.enums.violation.GameOriginEnum;
import com.red.circle.other.app.service.activity.RankingActivityService;
import com.red.circle.other.app.service.user.user.AppUserDataViolationService;
import com.red.circle.other.app.util.OfficialNoticeUtils;
import com.red.circle.other.domain.gateway.PropCouponGateway;
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.domain.gateway.user.ability.InviteUserGateway;
import com.red.circle.other.domain.propcoupon.PropCoupon;
import com.red.circle.other.domain.ranking.RankingActivityType;
import com.red.circle.other.domain.ranking.RankingCycleType;
import com.red.circle.other.domain.ranking.RankingDimension;
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
import com.red.circle.other.infra.database.rds.entity.sys.GameListConfig;
import com.red.circle.other.infra.database.rds.service.sys.GameListConfigService;
import com.red.circle.other.inner.model.cmd.user.ApprovalAccountCmd;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.tool.core.parse.DataTypeUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Map;
import java.util.Objects;
@SpringBootTest(classes = OtherServiceApplication.class)
@RunWith(SpringRunner.class)
public class SpringTest {
@Autowired
private InviteUserGateway inviteUserGateway;
@Autowired
private OfficialNoticeClient officialNoticeClient;
@Autowired
private UserProfileAppConvertor userProfileAppConvertor;
@Autowired
private EnumConfigCacheService enumConfigCacheService;
@Autowired
private GameListConfigService gameListConfigService;
@Autowired
private UserProfileGateway userProfileGateway;
@Autowired
private ImGroupClient imGroupClient;
@Autowired
private PropCouponGateway propCouponGateway;
@Autowired
private AppUserDataViolationService userDataViolationService;
@Autowired
private RankingActivityService rankingActivityService;
@Test
public void testGame() {
RankingDataUpdateCmd receiverCmd = new RankingDataUpdateCmd();
receiverCmd.setUserId(1957345312961527809L);
receiverCmd.setUserSex(1);
receiverCmd.setActivityType(RankingActivityType.GREEDY_GAME.getCode());
receiverCmd.setCycleType(RankingCycleType.MONTHLY.getCode());
receiverCmd.setCycleKey("202511");
receiverCmd.setDimension(RankingDimension.GAME_WIN.getCode());
receiverCmd.setIncrementQuantity(111L);
receiverCmd.setBizNo("3243k1od");
receiverCmd.setReqSysOrigin(ReqSysOrigin.of("LIKEI"));
rankingActivityService.accumulateRankingData(receiverCmd);
}
@Test
public void test() {
PropCoupon vip004 = propCouponGateway.selectByCouponNo("VIP004");
LocalDateTime now = LocalDateTime.now();
propCouponGateway.expireOverdueCoupons();
}
@Test
public void testApproval() {
Long userId = 1963789902071508993L;
ApprovalAccountCmd cmd = new ApprovalAccountCmd();
cmd.setAccountStatusEnum(ConsoleAccountStatusEnum.ARCHIVE_DEVICE);
cmd.setDescription("lottery dollar");
cmd.setBeApprovalUserId(userId);
userDataViolationService.updateAccountStatus(cmd);
}
@Test
public void execute() {
Long userId = 1954021558348390402L;
UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO(
userProfileGateway.getByUserId(DataTypeUtils.toLong(userId)));
GameListConfig gameListConfig = gameListConfigService.getByGameId("1090", GameOriginEnum.LINGXIAN.name(), "LIKEI");
if (Objects.nonNull(gameListConfig)) {
Map<Object, Object> build = OfficialNoticeUtils.buildUserProfile(userProfile);
build.put("gameUrl", gameListConfig.getCover());
build.put("currencyDiff", 6000);
imGroupClient.sendMessageBroadcast(
BroadcastGroupMsgBodyCmd.builder()
.toPlatform(SysOriginPlatformEnum.LIKEI)
.type(GroupMessageTypeEnum.GAME_BAISHUN_WIN)
.data(build)
.build()
);
}
}
}