JudgmentService.java
5.95 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
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
package cn.com.glsx.admin.modules.service;
import cn.com.glsx.admin.common.enums.TypeConverseEunm;
import cn.com.glsx.admin.modules.mapper.VehicleMapper;
import cn.com.glsx.admin.modules.model.export.JudgmentExport;
import cn.com.glsx.admin.modules.model.param.JudgmentSearch;
import cn.com.glsx.admin.modules.remote.RemoteGpsBsService;
import cn.com.glsx.admin.modules.remote.RemoteStuJudgeAlarmService;
import cn.com.glsx.alarm.services.model.StuJudgeAlarmDto;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* 大数据研判 service
*
* @author yll
*/
@Slf4j
@Service
public class JudgmentService {
@Autowired
private RemoteStuJudgeAlarmService remoteStuJudgeAlarmService;
@Autowired
private VehicleMapper vehicleMapper;
@Autowired
private RemoteGpsBsService remoteGpsBsService;
/**
* 查询大数据研判数据列表
*
* @param judgmentSearch
* @return
*/
public PageInfo findJudgmentList(JudgmentSearch judgmentSearch) {
List<JudgmentExport> judgmentList = vehicleMapper.findJudgmentList(judgmentSearch);
if (CollectionUtil.isEmpty(judgmentList)) {
return new PageInfo<>();
}
log.info("查询大数据研判数据列表的条数" + judgmentList.size());
List<String> snList = judgmentList.stream().map(JudgmentExport::getSn).collect(Collectors.toList());
PageInfo stuJudgeAlarmListByPage = remoteStuJudgeAlarmService.searchStuJudgeAlarmListByPage(snList, judgmentSearch);
List<StuJudgeAlarmDto> stuJudgeAlarmList = JSON.parseArray(JSON.toJSONString(stuJudgeAlarmListByPage.getList()), StuJudgeAlarmDto.class);
if (CollectionUtil.isEmpty(stuJudgeAlarmList)) {
return new PageInfo<>();
}
List<JudgmentExport> judgmentExportList = Lists.newArrayList();
stuJudgeAlarmList.forEach(stuJudgeAlarm -> {
for (JudgmentExport judgmentExportTemp : judgmentList) {
if (stuJudgeAlarm.getSn().equals(judgmentExportTemp.getSn())) {
JudgmentExport judgmentExport = new JudgmentExport();
BeanUtils.copyProperties(judgmentExportTemp, judgmentExport);
judgmentExport.setSourceStr(TypeConverseEunm.SourceEnum.getStrBySourceType(judgmentExport.getSource()));
judgmentExport.setAlarmType(stuJudgeAlarm.getAlarmType());
judgmentExport.setAlarmTypeStr(TypeConverseEunm.AlarmTypeEnum.getStrByAlarmType(stuJudgeAlarm.getAlarmType()));
judgmentExport.setAlarmStatus(stuJudgeAlarm.getAlarmStatus());
judgmentExport.setAlarmStatusStr(TypeConverseEunm.AlarmStatusEnum.getStrByAlarmStatus(stuJudgeAlarm.getAlarmStatus()));
judgmentExport.setGeoCode(stuJudgeAlarm.getGeoCode());
judgmentExport.setAlarmAddress(stuJudgeAlarm.getAlarmAddress());
judgmentExport.setAlarmBeginTime(stuJudgeAlarm.getAlarmBeginTime());
judgmentExport.setAlarmEndTime(stuJudgeAlarm.getAlarmEndTime());
judgmentExport.setAlarmLng(stuJudgeAlarm.getAlarmLng());
judgmentExport.setAlarmLat(stuJudgeAlarm.getAlarmLat());
judgmentExport.setAlarmAddress(stuJudgeAlarm.getAlarmAddress());
judgmentExportList.add(judgmentExport);
}
}
});
stuJudgeAlarmListByPage.setList(judgmentExportList);
return stuJudgeAlarmListByPage;
}
public List<JudgmentExport> exportJudgmentList(JudgmentSearch judgmentSearch) {
List<JudgmentExport> judgmentList = vehicleMapper.findJudgmentList(judgmentSearch);
if (ObjectUtil.isNull(judgmentList)) {
return null;
}
log.info("查询大数据研判数据列表的条数" + judgmentList.size());
List<String> snList = judgmentList.stream().map(JudgmentExport::getSn).collect(Collectors.toList());
List<StuJudgeAlarmDto> stuJudgeAlarmDtoList = remoteStuJudgeAlarmService.searchStuJudgeAlarmDataList(snList, judgmentSearch);
if (CollectionUtil.isEmpty(stuJudgeAlarmDtoList)) {
return null;
}
List<JudgmentExport> judgmentExportList = Lists.newArrayList();
stuJudgeAlarmDtoList.forEach(stuJudgeAlarm -> {
for (JudgmentExport judgmentExportTemp : judgmentList) {
if (stuJudgeAlarm.getSn().equals(judgmentExportTemp.getSn())) {
JudgmentExport judgmentExport = new JudgmentExport();
BeanUtils.copyProperties(judgmentExportTemp, judgmentExport);
judgmentExport.setSourceStr(TypeConverseEunm.SourceEnum.getStrBySourceType(judgmentExport.getSource()));
judgmentExport.setAlarmType(stuJudgeAlarm.getAlarmType());
judgmentExport.setAlarmTypeStr(TypeConverseEunm.AlarmTypeEnum.getStrByAlarmType(stuJudgeAlarm.getAlarmType()));
judgmentExport.setAlarmStatus(stuJudgeAlarm.getAlarmStatus());
judgmentExport.setAlarmStatusStr(TypeConverseEunm.AlarmStatusEnum.getStrByAlarmStatus(stuJudgeAlarm.getAlarmStatus()));
judgmentExport.setGeoCode(stuJudgeAlarm.getGeoCode());
judgmentExport.setAlarmAddress(stuJudgeAlarm.getAlarmAddress());
judgmentExport.setAlarmBeginTime(stuJudgeAlarm.getAlarmBeginTime());
judgmentExport.setAlarmEndTime(stuJudgeAlarm.getAlarmEndTime());
judgmentExportList.add(judgmentExport);
}
}
});
return judgmentExportList;
}
}