MainTest.java
2.76 KB
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
package com.viontech.fanxing.query;
import cn.hutool.poi.excel.cell.FormulaCellValue;
import com.viontech.fanxing.commons.model.DictCode;
import com.viontech.fanxing.commons.model.Traffic;
import com.viontech.fanxing.commons.vo.TrafficVo;
import com.viontech.fanxing.query.model.export.ETrafficModel;
import com.viontech.fanxing.query.runner.ExportDataJob;
import com.viontech.fanxing.query.service.adapter.TrafficService;
import com.viontech.fanxing.query.service.main.OpsClientService;
import com.viontech.keliu.util.DateUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Profile;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.util.Date;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
/**
* .
*
* @author 谢明辉
* @date 2021/11/26
*/
@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles("test")
public class MainTest {
@Resource
private OpsClientService opsClientService;
@Resource
private TrafficService trafficService;
@Test
public void test() {
Traffic traffic = trafficService.selectByPrimaryKey(5808875);
TrafficVo trafficVo = new TrafficVo(traffic);
ETrafficModel e = new ETrafficModel();
Date eventTime = trafficVo.getEventTime();
e.setEventTime(DateUtil.format(DateUtil.FORMAT_FULL, eventTime));
e.setPicName(new FormulaCellValue("HYPERLINK(\"https://www.baidu.com/\",\"下载\")"));
e.setLocation(trafficVo.getLocationName());
e.setPlateNumber(trafficVo.getPlateNumber());
Map<String, DictCode> vehicleTypeDict = opsClientService.vehicleTypeDict();
Map<String, DictCode> vehicleColorDict = opsClientService.vehicleColorDict();
Map<String, DictCode> plateColorDict = opsClientService.plateColorDict();
Map<String, DictCode> vehicleBrandDict = opsClientService.vehicleBrandDict();
String plateColor = Optional.ofNullable(plateColorDict.get(trafficVo.getPlateColor())).map(DictCode::getName).orElse("未识别");
String vehicleType = Optional.ofNullable(vehicleTypeDict.get(trafficVo.getVehicleType())).map(DictCode::getName).orElse("未识别");
String vehicleBrand = Optional.ofNullable(vehicleBrandDict.get(trafficVo.getVehicleLogo())).map(DictCode::getName).orElse("未识别");
String vehicleColor = Optional.ofNullable(vehicleColorDict.get(trafficVo.getVehicleColor())).map(DictCode::getName).orElse("未识别");
e.setPlateColor(plateColor);
e.setVehicleType(vehicleType);
e.setVehicleBrand(vehicleBrand);
e.setVehicleColor(vehicleColor);
}
}