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.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.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.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; @Test public void test() { PropCoupon vip004 = propCouponGateway.selectByCouponNo("VIP004"); LocalDateTime now = LocalDateTime.now(); propCouponGateway.expireOverdueCoupons(); } @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 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() ); } } }