From c56c06f152b70d7e39b9366ca340f67d21e73113 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 31 Oct 2022 11:35:07 +0800
Subject: [PATCH] 20220902

---
 src/test/java/cc/mrbird/febs/AgentTest.java |   62 ++++++++++++++++++++++++-------
 1 files changed, 48 insertions(+), 14 deletions(-)

diff --git a/src/test/java/cc/mrbird/febs/AgentTest.java b/src/test/java/cc/mrbird/febs/AgentTest.java
index a2f3a42..853c2c3 100644
--- a/src/test/java/cc/mrbird/febs/AgentTest.java
+++ b/src/test/java/cc/mrbird/febs/AgentTest.java
@@ -5,16 +5,21 @@
 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;
@@ -127,7 +132,7 @@
 
         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){
             //抽奖记录
@@ -501,23 +506,43 @@
     @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
@@ -591,4 +616,13 @@
     public void profitJobTest() {
         profitJob.profitJob();
     }
+
+
+    @Autowired
+    private AgentConsumer agentConsumer;
+
+    @Test
+    public void orderReturnTest() {
+        agentConsumer.orderReturnMoney("7");
+    }
 }

--
Gitblit v1.9.1