Commit 8fdf7b3e by 杨林龙

Merge remote-tracking branch 'origin/develop' into develop

2 parents d269e89f 81e83535
......@@ -25,7 +25,7 @@ public class VehicleMonitorConvert {
public static StayPointListVO buildStayPointListVO(StayPointRecordDTO stayPointRecordDTO,
VehicleDeviceWorkOrder vehicleDeviceWorkOrder,
String sn) {
String sn, String address) {
StayPointListVO stayPointListVO = new StayPointListVO();
Optional.ofNullable(vehicleDeviceWorkOrder)
.map(VehicleDeviceWorkOrder::getWorkOrderNo)
......@@ -64,6 +64,7 @@ public class VehicleMonitorConvert {
.map(StayPointRecordDTO::getStayGps)
.map(GpsLocation::getElng)
.ifPresent(stayPointListVO::setElng);
stayPointListVO.setAddress(address);
return stayPointListVO;
}
......@@ -143,7 +144,7 @@ public class VehicleMonitorConvert {
return residentRequest;
}
public static ResidentListVO buildResidentListVO(ResidentDTO residentDTO, VehicleDeviceWorkOrder common) {
public static ResidentListVO buildResidentListVO(ResidentDTO residentDTO, VehicleDeviceWorkOrder common, String address) {
ResidentListVO residentListVO = new ResidentListVO();
Optional.ofNullable(common)
.map(VehicleDeviceWorkOrder::getWorkOrderNo)
......@@ -178,6 +179,7 @@ public class VehicleMonitorConvert {
residentListVO.setBlng(residentDTO.getBlng());
residentListVO.setElat(residentDTO.getElat());
residentListVO.setElng(residentDTO.getElng());
residentListVO.setAddress(address);
return residentListVO;
}
......
package cn.com.glsx.admin.modules.model.export;
import cn.com.glsx.admin.modules.model.BaseOrgDto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
......@@ -10,7 +11,7 @@ import lombok.Data;
* @Date 2021/5/20
*/
@Data
public class VehicleInfoExport {
public class VehicleInfoExport extends BaseOrgDto {
/**
* 车辆ID
......
......@@ -95,4 +95,10 @@ public class ResidentListVO implements Serializable {
*/
@ApiModelProperty(value = "经度偏移")
private String elng;
/**
* 停留地址
* */
@ApiModelProperty(value = "停留地址")
private String address;
}
......@@ -82,4 +82,10 @@ public class StayPointListVO implements Serializable {
* */
@ApiModelProperty(value = "停留经度")
private String elng;
/**
* 停留地址
* */
@ApiModelProperty(value = "停留地址")
private String address;
}
......@@ -384,8 +384,55 @@ public class VehicleMonitorService {
List<StayPointRecordDTO> stayPointRecord = getStayPointList(search, request);
//获取车辆,工单信息
VehicleDeviceWorkOrder commonInfo = vehicleDeviceService.getVehicleDeviceWorkOrderBySn(search.getSn());
//获取地址信息
List<LngLatDTO> lngLats = stayPointRecord.stream()
.filter(e -> Objects.nonNull(e.getStayGps()))
.map(e -> new LngLatDTO(e.getStayGps().getElng(), e.getStayGps().getElat()))
.collect(Collectors.toList());
LngLatAddressDTO addressDTO = remoteGpsBsService.getAddressMap(lngLats);
Map<String, String> addressMap = Optional.ofNullable(addressDTO)
.map(LngLatAddressDTO::getAddress)
.orElse(Maps.newHashMap());
return stayPointRecord.stream()
.map(stayPoint -> VehicleMonitorConvert.buildStayPointListVO(stayPoint, commonInfo, search.getSn(), Optional.ofNullable(stayPoint.getStayGps())
.map(e -> e.getElat() + e.getElng())
.map(addressMap::get)
.orElse(Constants.EMPTY_CONTENT_EXCEL)))
.collect(Collectors.toList());
}
/**
* 停留点列表导出
*/
public List<StayPointListExport> exportStayPointList(StayPointSearch search) {
StayPointRequest request = VehicleMonitorConvert.buildStayPointRequest(search);
//获取停留点列表
List<StayPointRecordDTO> stayPointRecord = getStayPointList(search, request);
//获取地址信息
List<LngLatDTO> lngLats = stayPointRecord.stream()
.filter(e -> Objects.nonNull(e.getStayGps()))
.map(e -> new LngLatDTO(e.getStayGps().getElng(), e.getStayGps().getElat()))
.collect(Collectors.toList());
LngLatAddressDTO addressDTO = remoteGpsBsService.getAddressMap(lngLats);
Map<String, String> addressMap = Optional.ofNullable(addressDTO)
.map(LngLatAddressDTO::getAddress)
.orElse(Maps.newHashMap());
//获取车辆,工单信息
VehicleDeviceWorkOrder commonInfo = vehicleDeviceService.getVehicleDeviceWorkOrderBySn(search.getSn());
return stayPointRecord.stream()
.map(stayPoint -> VehicleMonitorConvert.buildStayPointListVO(stayPoint, commonInfo, search.getSn()))
.filter(Objects::nonNull)
.map(stayPoint -> {
String address = Optional.ofNullable(stayPoint.getStayGps())
.map(e -> e.getElat() + e.getElng())
.map(addressMap::get)
.orElse(Constants.EMPTY_CONTENT_EXCEL);
return VehicleMonitorConvert.buildStayPointListExport(stayPoint, commonInfo, search.getSn(), address);
})
.collect(Collectors.toList());
}
......@@ -417,42 +464,41 @@ public class VehicleMonitorService {
return stayPointRecord;
}
/**
* 停留点列表导出
* 常驻地列表
*/
public List<StayPointListExport> exportStayPointList(StayPointSearch search) {
StayPointRequest request = VehicleMonitorConvert.buildStayPointRequest(search);
//获取停留点列表
List<StayPointRecordDTO> stayPointRecord = getStayPointList(search, request);
public List<ResidentListVO> queryResidentList(ResidentSearch search) {
ResidentRequest request = buildResidentRequest(search);
List<ResidentDTO> residentList = remoteFeignResidentService.getResidentList(request);
if (CollectionUtils.isEmpty(residentList)) {
return Lists.newArrayList();
}
//查询设备,车辆,工单等信息
VehicleDeviceWorkOrder commonInfo = vehicleDeviceService.getVehicleDeviceWorkOrderBySn(search.getSn());
//获取地址信息
List<LngLatDTO> lngLats = stayPointRecord.stream()
.filter(e -> Objects.nonNull(e.getStayGps()))
.map(e -> new LngLatDTO(e.getStayGps().getElng(), e.getStayGps().getElat()))
List<LngLatDTO> lngLats = residentList.stream()
.map(e -> new LngLatDTO(e.getElng(), e.getElat()))
.collect(Collectors.toList());
LngLatAddressDTO addressDTO = remoteGpsBsService.getAddressMap(lngLats);
Map<String, String> addressMap = Optional.ofNullable(addressDTO)
.map(LngLatAddressDTO::getAddress)
.orElse(Maps.newHashMap());
//获取车辆,工单信息
VehicleDeviceWorkOrder commonInfo = vehicleDeviceService.getVehicleDeviceWorkOrderBySn(search.getSn());
return stayPointRecord.stream()
.filter(Objects::nonNull)
.map(stayPoint -> {
String address = Optional.ofNullable(stayPoint.getStayGps())
.map(e -> e.getElat() + e.getElng())
.map(addressMap::get)
.orElse(Constants.EMPTY_CONTENT_EXCEL);
return VehicleMonitorConvert.buildStayPointListExport(stayPoint, commonInfo, search.getSn(), address);
})
return residentList.stream()
.map(e -> VehicleMonitorConvert.buildResidentListVO(e, commonInfo, addressMap.get(e.getElat() + e.getElng())))
.collect(Collectors.toList());
}
/**
* 常驻地列表
* 导出常驻地
*/
public List<ResidentListVO> queryResidentList(ResidentSearch search) {
public List<ResidentListExport> exportResidentList(ResidentSearch search) {
ResidentRequest request = buildResidentRequest(search);
List<ResidentDTO> residentList = remoteFeignResidentService.getResidentList(request);
......@@ -463,8 +509,18 @@ public class VehicleMonitorService {
//查询设备,车辆,工单等信息
VehicleDeviceWorkOrder commonInfo = vehicleDeviceService.getVehicleDeviceWorkOrderBySn(search.getSn());
//获取地址信息
List<LngLatDTO> lngLats = residentList.stream()
.map(e -> new LngLatDTO(e.getElng(), e.getElat()))
.collect(Collectors.toList());
LngLatAddressDTO addressDTO = remoteGpsBsService.getAddressMap(lngLats);
Map<String, String> addressMap = Optional.ofNullable(addressDTO)
.map(LngLatAddressDTO::getAddress)
.orElse(Maps.newHashMap());
return residentList.stream()
.map(e -> VehicleMonitorConvert.buildResidentListVO(e, commonInfo))
.filter(Objects::nonNull)
.map(resident -> VehicleMonitorConvert.buildResidentListExport(resident, commonInfo, addressMap.get(resident.getElat() + resident.getElng())))
.collect(Collectors.toList());
}
......@@ -524,33 +580,4 @@ public class VehicleMonitorService {
}
return new ImmutablePair<>(startDate, endDate);
}
/**
* 导出常驻地
*/
public List<ResidentListExport> exportResidentList(ResidentSearch search) {
ResidentRequest request = buildResidentRequest(search);
List<ResidentDTO> residentList = remoteFeignResidentService.getResidentList(request);
if (CollectionUtils.isEmpty(residentList)) {
return Lists.newArrayList();
}
//查询设备,车辆,工单等信息
VehicleDeviceWorkOrder commonInfo = vehicleDeviceService.getVehicleDeviceWorkOrderBySn(search.getSn());
//获取地址信息
List<LngLatDTO> lngLats = residentList.stream()
.map(e -> new LngLatDTO(e.getElng(), e.getElat()))
.collect(Collectors.toList());
LngLatAddressDTO addressDTO = remoteGpsBsService.getAddressMap(lngLats);
Map<String, String> addressMap = Optional.ofNullable(addressDTO)
.map(LngLatAddressDTO::getAddress)
.orElse(Maps.newHashMap());
return residentList.stream()
.filter(Objects::nonNull)
.map(resident -> VehicleMonitorConvert.buildResidentListExport(resident, commonInfo, addressMap.get(resident.getElat() + resident.getElng())))
.collect(Collectors.toList());
}
}
......@@ -1023,6 +1023,8 @@ public class VehicleService extends AbstractCommonService {
List<VehicleInfoPageDTO> vehicleInfoList = vehicleMapper.searchVehicleInfo(search);
organizationApiService.drawAllLevel(vehicleInfoList);
//过滤DeviceType为空的数据,预防空指针
Map<String, Integer> snsMap = vehicleInfoList.stream().filter(m -> m.getDeviceType() != null)
.collect(Collectors.toMap(VehicleInfoPageDTO::getSn, VehicleInfoPageDTO::getDeviceType, (o, n) -> n));
......@@ -1032,6 +1034,7 @@ public class VehicleService extends AbstractCommonService {
String supAdjFreq = PropertiesUtils.getProperty("support.adj.freq");
for (VehicleInfoPageDTO vehicleInfo : vehicleInfoList) {
vehicleInfo.setCreator(vehicleInfo.getBelongLevels());
//设置车辆类型
vehicleInfo.setVehicleTypeStr(VehicleTypeEnum.getNameByCode(vehicleInfo.getVehicleType()));
vehicleInfo.setVehicleUsageStr(VehicleUsageEnum.getNameByCode(vehicleInfo.getVehicleUsages()));
......@@ -1048,7 +1051,6 @@ public class VehicleService extends AbstractCommonService {
}
}
//organizationApiService.drawAllLevel(vehicleInfoList);
return new PageInfo<>(vehicleInfoList);
}
......@@ -1125,6 +1127,8 @@ public class VehicleService extends AbstractCommonService {
List<VehicleInfoExport> vehicleInfoList = vehicleMapper.exportVehicleInfo(search);
organizationApiService.drawAllLevel(vehicleInfoList);
//过滤DeviceType为空的数据,预防空指针
Map<String, Integer> snsMap = vehicleInfoList.stream().filter(m -> m.getDeviceType() != null)
.collect(Collectors.toMap(VehicleInfoExport::getSn, VehicleInfoExport::getDeviceType, (o, n) -> n));
......@@ -1132,6 +1136,7 @@ public class VehicleService extends AbstractCommonService {
Map<String, DeviceStatusModel> deviceStatusMap = remoteFeignDeviceService.getDeviceStatusBySns(snsMap);
for (VehicleInfoExport vehicleInfo : vehicleInfoList) {
vehicleInfo.setCreator(vehicleInfo.getBatteryLevel());
//设置车辆类型
vehicleInfo.setVehicleTypeStr(VehicleTypeEnum.getNameByCode(vehicleInfo.getVehicleType()));
vehicleInfo.setVehicleUsageStr(VehicleUsageEnum.getNameByCode(vehicleInfo.getVehicleUsages()));
......@@ -1157,8 +1162,6 @@ public class VehicleService extends AbstractCommonService {
setAdjustFreq(vehicleInfo);
}
//organizationApiService.drawReportOrganization(vehicleInfoList);
return vehicleInfoList;
}
......
......@@ -471,7 +471,6 @@
tv.settle_flag settleFlag,
tv.created_date activateTime,
ddf.`status` AS freqStatus,
concat(tdept.department_name,'/',tu.username) creator,
tv.created_by createdBy
from t_vehicle tv
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
......@@ -479,7 +478,6 @@
left join t_device td on td.sn = tvd.sn
left join t_device_location tdl on tdl.sn = tvd.sn
left join t_user tu on tu.id = tv.created_by
left join t_department tdept on tdept.id = tu.department_id
left join (select vehicle_id, sn, status from (SELECT * FROM t_device_freq order by created_date desc) temp GROUP BY temp.sn) ddf on ddf.vehicle_id = tv.id and ddf.sn =
td.sn
where tv.del_flag = 0
......@@ -568,7 +566,6 @@
ddf.timer AS timer,
ddf.`week` AS `week`,
ddf.week_timer AS weekTimer,
concat(tdept.department_name,'/',tu2.username) creator,
tu.username,
tu.account operation
from t_vehicle tv
......@@ -579,7 +576,6 @@
left join (select * from (SELECT * FROM t_device_freq order by created_date desc) temp GROUP BY temp.sn) ddf on ddf.vehicle_id = tv.id and ddf.sn = td.sn
left join t_user tu on tu.id = ddf.created_by
left join t_user tu2 on tu2.id = tv.created_by
left join t_department tdept on tdept.id = tu2.department_id
where tv.del_flag = 0
and tvd.bind_status = 1
and tvd.del_flag = 0
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!