|  |  | 
 |  |  | import cc.mrbird.febs.common.exception.FebsException; | 
 |  |  | import cc.mrbird.febs.common.utils.LoginUserUtil; | 
 |  |  | import cc.mrbird.febs.mall.dto.AgentLevelUpdateDto; | 
 |  |  | import cc.mrbird.febs.mall.dto.ApiMallActWinDetailsDto; | 
 |  |  | import cc.mrbird.febs.mall.entity.*; | 
 |  |  | import cc.mrbird.febs.mall.mapper.*; | 
 |  |  | import cc.mrbird.febs.mall.quartz.ProfitJob; | 
 |  |  | import cc.mrbird.febs.mall.service.IAgentService; | 
 |  |  | import cc.mrbird.febs.mall.vo.ApiMallActWinDetailsVo; | 
 |  |  | import cc.mrbird.febs.mall.vo.ApiMallAwardDetailsVo; | 
 |  |  | import cc.mrbird.febs.rabbit.consumer.AgentConsumer; | 
 |  |  | import cc.mrbird.febs.rabbit.producter.AgentProducer; | 
 |  |  | import cn.hutool.core.collection.CollUtil; | 
 |  |  | import cn.hutool.core.util.ObjectUtil; | 
 |  |  | import cn.hutool.core.util.RandomUtil; | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.aspectj.weaver.loadtime.Agent; | 
 |  |  | import org.junit.jupiter.api.Test; | 
 |  |  | 
 |  |  |  | 
 |  |  |         BigDecimal multiply = totalProbability.multiply(new BigDecimal(100)); | 
 |  |  |         BigDecimal failureScope = new BigDecimal(100).subtract(multiply); | 
 |  |  |         int randomInt = RandomUtil.randomInt(1, 100); | 
 |  |  |         int randomInt = 90; | 
 |  |  |         //小于failureScope这个数字,则没中奖 | 
 |  |  |         if(new BigDecimal(randomInt).compareTo(failureScope) <= 0){ | 
 |  |  |             //抽奖记录 | 
 |  |  | 
 |  |  |     @Test | 
 |  |  |     public void agentTest() { | 
 |  |  | //        agentProducer.sendDelayMsg(1L, 10000L); | 
 |  |  |  | 
 |  |  |         ApiMallActWinDetailsDto apiMallActWinDetailsDto = new ApiMallActWinDetailsDto(); | 
 |  |  |         apiMallActWinDetailsDto.setActId(1L); | 
 |  |  |         apiMallActWinDetailsDto.setPageNow(1); | 
 |  |  |         apiMallActWinDetailsDto.setPageSize(10); | 
 |  |  |         Long memberId = 4L; | 
 |  |  |         MallMember mallMember = mallMemberMapper.selectById(memberId); | 
 |  |  |         if(ObjectUtil.isEmpty(mallMember)){ | 
 |  |  |             throw new FebsException("用户不存在"); | 
 |  |  |         } | 
 |  |  |         apiMallActWinDetailsDto.setMemberId(memberId); | 
 |  |  |  | 
 |  |  |         Long actId = apiMallActWinDetailsDto.getActId(); | 
 |  |  |         MallActSet mallActSet = mallActSetMapper.selectById(actId); | 
 |  |  |         if(ObjectUtil.isEmpty(mallActSet)){ | 
 |  |  |             throw new FebsException("活动不存在"); | 
 |  |  |         } | 
 |  |  |         Page<ApiMallActWinDetailsVo> page = new Page<>(apiMallActWinDetailsDto.getPageNow(), apiMallActWinDetailsDto.getPageSize()); | 
 |  |  |         IPage<ApiMallActWinDetailsVo> apiMallActWinDetailsVoIPage = mallActWinRecordMapper.selectApiMallActWinDetailsListInPage(apiMallActWinDetailsDto, page); | 
 |  |  |         System.out.println(apiMallActWinDetailsVoIPage); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Test | 
 |  |  |     public void insertAgentTest() { | 
 |  |  |         AgentInfo agentInfo = new AgentInfo(); | 
 |  |  |         agentInfo.setOrderType(2); | 
 |  |  |         agentInfo.setOrderCnt(2000); | 
 |  |  |         agentInfo.setLastCnt(3); | 
 |  |  |         agentInfo.setDirectIncome(BigDecimal.valueOf(50)); | 
 |  |  |         agentInfo.setTeamIncome(BigDecimal.valueOf(15)); | 
 |  |  |         agentInfo.setTeamIncomeType(2); | 
 |  |  |  | 
 |  |  |         DataDictionaryCustom data = new DataDictionaryCustom(); | 
 |  |  |         data.setType("AGENT_LEVEL_REQUIRE"); | 
 |  |  |         data.setCode(AgentLevelEnum.FOUR_LEVEL.name()); | 
 |  |  |         data.setValue(JSONObject.toJSONString(agentInfo)); | 
 |  |  |         dataDictionaryCustomMapper.insert(data); | 
 |  |  | //        AgentInfo agentInfo = new AgentInfo(); | 
 |  |  | //        agentInfo.setOrderType(2); | 
 |  |  | //        agentInfo.setOrderCnt(2000); | 
 |  |  | //        agentInfo.setLastCnt(3); | 
 |  |  | //        agentInfo.setDirectIncome(BigDecimal.valueOf(50)); | 
 |  |  | //        agentInfo.setTeamIncome(BigDecimal.valueOf(15)); | 
 |  |  | //        agentInfo.setTeamIncomeType(2); | 
 |  |  | // | 
 |  |  | //        DataDictionaryCustom data = new DataDictionaryCustom(); | 
 |  |  | //        data.setType("AGENT_LEVEL_REQUIRE"); | 
 |  |  | //        data.setCode(AgentLevelEnum.FOUR_LEVEL.name()); | 
 |  |  | //        data.setValue(JSONObject.toJSONString(agentInfo)); | 
 |  |  | //        dataDictionaryCustomMapper.insert(data); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Test | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Test | 
 |  |  |     public void profitJobTest() { | 
 |  |  |         profitJob.profitJob(); | 
 |  |  | //        profitJob.profitJob(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private AgentConsumer agentConsumer; | 
 |  |  |  | 
 |  |  |     @Test | 
 |  |  |     public void orderReturnTest() { | 
 |  |  |         agentConsumer.orderReturnMoney("7"); | 
 |  |  |     } | 
 |  |  | } |