Helius
2021-09-26 c2a08e408b08e21a7595eaeaaf8483c5df030d24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package cc.mrbird.febs;
 
import cc.mrbird.febs.common.enumerates.AgentLevelEnum;
import cc.mrbird.febs.mall.entity.AgentInfo;
import cc.mrbird.febs.mall.entity.DataDictionaryCustom;
import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper;
import cc.mrbird.febs.mall.service.IAgentService;
import cc.mrbird.febs.rabbit.producter.AgentProducer;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.weaver.loadtime.Agent;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
 
import java.math.BigDecimal;
 
/**
 * @author wzy
 * @date 2021-09-25
 **/
@Slf4j
@SpringBootTest
public class AgentTest {
 
    @Autowired
    private AgentProducer agentProducer;
 
    @Autowired
    private DataDictionaryCustomMapper dataDictionaryCustomMapper;
 
    @Autowired
    private IAgentService agentService;
 
    @Test
    public void agentTest() {
//        agentProducer.sendDelayMsg(1L, 10000L);
    }
 
    @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);
    }
 
    @Test
    public void insertData() {
        int i = 1;
        for (AgentLevelEnum value : AgentLevelEnum.values()) {
            DataDictionaryCustom data = new DataDictionaryCustom();
            data.setType("AGENT_LEVEL");
            data.setDescription(value.getName());
            data.setCode(value.name());
            data.setValue(String.valueOf(i));
            dataDictionaryCustomMapper.insert(data);
        }
 
    }
 
    @Test
    public void autoLevelUp() {
        // agentService.autoUpAgentLevel(3L);
        agentProducer.sendAutoLevelUpMsg(3L);
    }
}