zqy
2025-07-15 fd29ca6cef3074b7d43fc0885ffe5bfe730bfd42
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
package com.ruoyi;
 
import com.ruoyi.domain.*;
import com.ruoyi.service.*;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
 
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
 
/**
 * @Version 1.0
 * @Author Jin_quan Ou
 * @Date 2023-03-22 19:11
 */
@SpringBootTest
public class insertData {
 
    @Autowired
    private ZfEventService zfEventService;
 
    @Autowired
    private ZfDoctorService zfDoctorService;
 
    @Autowired
    private ZfEquipmentService zfEquipmentService;
 
    @Autowired
    ZfCollectionService zfCollectionService;
 
    @Autowired
    ZfEconomyService zfEconomyService;
 
    @Test
    public void insert() {
        List<String> people = Arrays.asList("张三,张强,张力", "张萌,张蒙", "张旺,张点,张可", "张章,张常", "张璇,张为,张强,张力");
        List<String> address = Arrays.asList("花园", "海滩", "公园", "游乐场", "田园", "农庄");
        System.out.println(zfEventService);
//        ZfEvent zfEvent = null;
//
//        for (int i = 0; i < 200; i++) {
//            zfEvent = new ZfEvent();
//            int peopleRandom = new Random().nextInt(5);//0-4的随机数
//            int addressRandom = new Random().nextInt(6);//0-5的随机数
//
//            String base = "abcdefghijklmnopqrstuvwxyz";
//            int strRandom1 = new Random().nextInt(16);//0-15的随机数
//            int strRandom2 = new Random().nextInt(16);//0-15的随机数
//            String title = base.substring(strRandom1, strRandom1 + 8);
//            String remark = base.substring(strRandom2, strRandom2 + 8);
//
//            zfEvent.setPeople(people.get(peopleRandom));
//            zfEvent.setAddress(address.get(addressRandom));
//            zfEvent.setTitle(title);
//            zfEvent.setRemark(remark);
//            zfEventService.save(zfEvent);
//
//        }
 
    }
 
    @Test
    void insertDoctor() {
        List<String> l1 = Arrays.asList("牙科", "神经科", "外科");
        List<String> l2 = Arrays.asList("牙痛", "头痛", "皮肤炎");
        List<String> l3 = Arrays.asList("一个月", "半个月", "一天");
        List<String> l4 = Arrays.asList("白芷10g", "中医药1", "中医药2");
        List<String> l5 = Arrays.asList("维生素C", "布洛芬", "皮康霜");
        List<String> l6 = Arrays.asList("缓解牙痛", "缓解头痛", "缓解皮肤炎");
        List<String> l7 = Arrays.asList("张三", "李四", "王五");
        List<String> l8 = Arrays.asList("专治牙痛", "专治头痛", "专治皮肤炎");
 
        ZfDoctor zfDoctor = null;
        int count = 0;
        for (int i = 0; i < 200; i++) {
            count = count % 3;
            zfDoctor = new ZfDoctor();
            zfDoctor.setType(l1.get(count));
            zfDoctor.setSymptom(l2.get(count));
            zfDoctor.setDuration(l3.get(count));
            zfDoctor.setCmedical(l4.get(count));
            zfDoctor.setWmedical(l5.get(count));
            zfDoctor.setEffect(l6.get(count));
            zfDoctor.setSuitable(l7.get(count));
            zfDoctor.setRemark(l8.get(count));
            zfDoctor.setUrl("profile/upload/2023/03/19/test7_20230319222030A007.jpg");
            count++;
            zfDoctorService.save(zfDoctor);
        }
    }
 
    @Test
    void insertEquipment() {
        List<String> l1 = Arrays.asList("电视", "电冰箱", "电脑");
        List<String> l2 = Arrays.asList("2020-11-11", "2021-11-12", "2022-12-08");
        List<String> l3 = Arrays.asList("张三", "李四", "王五");
        List<String> l4 = Arrays.asList("夏普液晶电视", "西门子电冰箱", "苹果电脑");
        List<String> l5 = Arrays.asList("客厅", "厨房", "卧室");
        List<String> l6 = Arrays.asList("4k超高清", "双开门", "M2芯片");
 
 
        ZfEquipment zfEquipment = null;
        int count = 0;
        for (int i = 0; i < 200; i++) {
            count = count % 3;
            zfEquipment = new ZfEquipment();
            zfEquipment.setName(l1.get(count));
            zfEquipment.setBuyer(l3.get(count));
            zfEquipment.setContent(l4.get(count));
            zfEquipment.setLocation(l5.get(count));
            zfEquipment.setRemark(l6.get(count));
            zfEquipment.setUrl("profile/upload/2023/03/19/test7_20230319222030A007.jpg");
            count++;
            zfEquipmentService.save(zfEquipment);
        }
    }
 
    @Test
    void insertCollection() throws ParseException {
        List<String> l1 = Arrays.asList("2020-11-11", "2021-11-12", "2022-12-08");
        List<String> l2 = Arrays.asList("邮票", "日本军刀", "瓷器");
        List<String> l3 = Arrays.asList("十二生肖纪念邮票", "天目影打刀", "青花瓷");
        List<String> l4 = Arrays.asList("购买", "获赠", "拍卖");
        List<String> l5 = Arrays.asList("张三", "李四", "王五");
        List<String> l6 = Arrays.asList("10000", "16000", "28000");
        List<String> l7 = Arrays.asList("床头柜", "酒柜", "客厅电视柜");
        List<String> l8 = Arrays.asList("十二生肖", "宝刀未老", "古董瓷器");
        List<String> l9 = Arrays.asList("1", "2", "3", "4");
 
        Random type = new Random();
        Random source = new Random();
        Random own = new Random();
        Random family = new Random();
 
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
 
 
        ZfCollection zfCollection = null;
 
        for (int i = 0; i < 50; i++) {
            int typeNum = type.nextInt(3);
            int sourceNum = source.nextInt(3);
            int ownNum = own.nextInt(3);
//            int familyNum = family.nextInt(4);
 
            zfCollection = new ZfCollection();
            zfCollection.setHappenTime(simpleDateFormat.parse(l1.get(typeNum)));
            zfCollection.setType(l2.get(typeNum));
            zfCollection.setName(l3.get(typeNum));
            zfCollection.setSource(l4.get(sourceNum));
            zfCollection.setOwner(l5.get(ownNum));
            zfCollection.setPrice(l6.get(typeNum));
            zfCollection.setLocation(l7.get(typeNum));
            zfCollection.setRemark(l8.get(typeNum));
            //zfCollection.setFamilyId(4);
            zfCollection.setUrl("profile/upload/2023/03/19/test7_20230319222030A007.jpg");
 
            zfCollectionService.save(zfCollection);
        }
    }
 
 
    @Test
    void insertEconomy() throws ParseException {
        List<String> l1 = Arrays.asList("2020-11-11", "2021-11-12", "2022-12-08");
        List<String> l2 = Arrays.asList("-8000", "+10000");
        List<String> l3 = Arrays.asList("供楼", "存款");
        List<String> l4 = Arrays.asList("张三", "李四");
        List<String> l5 = Arrays.asList("20000", "30000");
        List<Integer> l6 = Arrays.asList(0,1);
        List<String> l9 = Arrays.asList("1", "2", "3", "4");
 
        Random type = new Random();
        Random source = new Random();
        Random own = new Random();
        Random family = new Random();
 
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
 
 
        ZfEconomy zfEconomy = null;
 
        for (int i = 0; i < 400; i++) {
            int timeNum = type.nextInt(3);
            int typeNum = source.nextInt(2);
            int ownNum = own.nextInt(3);
            int familyNum = family.nextInt(4);
 
            zfEconomy = new ZfEconomy();
            zfEconomy.setCreateTime(simpleDateFormat.parse(l1.get(timeNum)));
//            zfEconomy.setType(l6.get(typeNum));
//            zfEconomy.setPrice(l2.get(typeNum));
//            zfEconomy.setUseFor(l3.get(typeNum));
//            zfEconomy.setUsePeople(l4.get(typeNum));
//            zfEconomy.setKind(l6.get(typeNum));
//            zfEconomy.setBalance(l5.get(typeNum));
//            zfEconomy.setRemark(l3.get(typeNum));
//            zfEconomy.setFamilyId(l9.get(familyNum));
            zfEconomy.setUrl("profile/upload/2023/03/19/test7_20230319222030A007.jpg");
 
            zfEconomyService.save(zfEconomy);
        }
 
    }
 
 
    @Autowired
    ZfCleanService zfCleanService;
    @Test
    void insertClean() {
        List<Integer> l1 = Arrays.asList(0,1);
        List<String> l2 = Arrays.asList("所有人", "张三");
        List<String> l3 = Arrays.asList("玻璃窗", "被子");
        List<String> l4 = Arrays.asList("玻璃水洗", "折好放被袋");
        List<String> l5 = Arrays.asList("杂物房", "衣柜");
        List<String> l6 = Arrays.asList("窗户", "收纳柜");
        List<String> l7 = Arrays.asList("1", "2", "3", "4");
        List<String> l9 = Arrays.asList("擦玻璃要小心","叠被子要细心");
 
        ZfClean zfClean=null;
        int count=0;
        int familyNum = 0;
        Random family = new Random();
 
        for (int i = 0; i < 100; i++) {
            count=i%2;
            familyNum=family.nextInt(4);
            zfClean=new ZfClean();
            zfClean.setKind(l1.get(count));
            zfClean.setSuitable(l2.get(count));
            zfClean.setType(l3.get(count));
            zfClean.setMethod(l4.get(count));
            zfClean.setPlace(l5.get(count));
            zfClean.setLocation(l6.get(count));
            zfClean.setRemark(l9.get(count));
            zfClean.setUrl("profile/upload/2023/03/19/test7_20230319222030A007.jpg");
         //   zfClean.setFamilyId(l7.get(familyNum));
            zfCleanService.save(zfClean);
        }
 
    }
 
}