2025-10-29 11:18:35 +08:00

73 lines
2.9 KiB
Java

import com.red.circle.OtherServiceApplication;
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
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.other.app.convertor.user.UserProfileAppConvertor;
import com.red.circle.other.app.util.OfficialNoticeUtils;
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.domain.gateway.user.ability.InviteUserGateway;
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.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.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;
@Test
public void execute() {
Long userId = 1954021558348390402L;
UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO(
userProfileGateway.getByUserId(DataTypeUtils.toLong(userId)));
GameListConfig gameListConfig = gameListConfigService.getByGameId("1090", "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()
);
}
}
}