admin
2022-04-07 e1cc0d03fadc2d251d36c0dc3650f75e830d5363
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
77
78
79
80
81
82
83
84
85
86
87
package test.goldcorn;
 
import com.yeshi.makemoney.app.Application;
import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord;
import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType;
import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetFrequencyConfigException;
import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetPriceException;
import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetRecordException;
import com.yeshi.makemoney.app.exception.goldcorn.GoldCornMakeException;
import com.yeshi.makemoney.app.exception.user.UserInfoException;
import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService;
import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornMakeService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
 
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
 
/**
 * @author hxh
 * @title: GoldCornTest
 * @description: TODO
 * @date 2022/4/7 10:13
 */
@SpringBootTest(classes = Application.class)
public class GoldCornTest {
 
    @Resource
    private GoldCornGetRecordService goldCornGetRecordService;
 
    @Resource
    private GoldCornMakeService goldCornMakeService;
 
    @Test
    public void addGoldRecord() throws GoldCornGetRecordException {
        GoldCornGetRecord record = new GoldCornGetRecord();
        record.setCornNum(10);
        record.setUid(2L);
        record.setType(GoldCornGetType.readNovel);
        record.setLevel(GoldCornGetRecord.LEVEL_OWN);
        record.setDay("2022-04-07");
        goldCornGetRecordService.add(record);
    }
 
    @Test
    public void statistic() {
        Long count = goldCornGetRecordService.getGoldCornByDay(null, "2022-04-07");
        System.out.println(count);
 
        count = goldCornGetRecordService.countUidsByDay("2022-04-07");
        System.out.println(count);
 
        List<Long> uidList = goldCornGetRecordService.getUidsByDay("2022-04-07", 1, 1);
        for (Long id : uidList) {
            System.out.println(id);
        }
        uidList = goldCornGetRecordService.getUidsByDay("2022-04-07", 2, 1);
        for (Long id : uidList) {
            System.out.println(id);
        }
        uidList = goldCornGetRecordService.getUidsByDay("2022-04-07", 3, 1);
        for (Long id : uidList) {
            System.out.println(id);
        }
 
 
    }
 
    @Test
    public void makeGoldCorn() {
        try {
            goldCornMakeService.addGoldCorn(22380L, GoldCornGetType.watchVideo, new Date());
//            goldCornMakeService.addGoldCorn(22380L,GoldCornGetType.readNovel,new Date());
        } catch (UserInfoException e) {
            e.printStackTrace();
        } catch (GoldCornGetPriceException e) {
            e.printStackTrace();
        } catch (GoldCornGetFrequencyConfigException e) {
            e.printStackTrace();
        } catch (GoldCornMakeException e) {
            e.printStackTrace();
        }
    }
 
 
}