Commit d098084a by 杨林龙

车辆信息报表导出增加区省市 巡回员字段 + 优化车辆导出报表逻辑

1 parent 41a5659c
package cn.com.glsx.admin.modules.model.export;
import cn.com.glsx.admin.modules.model.ReportOrgDto;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
......@@ -9,32 +10,32 @@ import lombok.Data;
* @Date 2021/5/20
*/
@Data
public class TrialDriveVehicleExport {
public class TrialDriveVehicleExport extends ReportOrgDto {
/**
* 特约店名称
*/
@ExcelProperty(value = "特约店名称", index = 0)
@ExcelProperty(value = "特约店名称", index = 4)
private String shopName;
/**
* 特约点代码
*/
@ExcelProperty(value = "特约店编码", index = 1)
@ExcelProperty(value = "特约店编码", index = 5)
private String shopCode;
/**
* 车架号
*/
@ExcelProperty(value = "车架号", index = 2)
@ExcelProperty(value = "车架号", index = 6)
private String vin;
/**
* 车型
*/
@ExcelProperty(value = "车系", index = 3)
@ExcelProperty(value = "车系", index = 7)
private String seriesName;
/**
* 车型
*/
@ExcelProperty(value = "车型", index = 4)
@ExcelProperty(value = "车型", index = 8)
private String typeName;
/**
* 配置
......@@ -44,27 +45,27 @@ public class TrialDriveVehicleExport {
/**
* 车牌
*/
@ExcelProperty(value = "车牌", index = 5)
@ExcelProperty(value = "车牌", index = 9)
private String licensePlate;
/**
* 车辆外部颜色
*/
@ExcelProperty(value = "外色", index = 6)
@ExcelProperty(value = "外色", index = 10)
private String color;
/**
* 车辆内饰颜色
*/
@ExcelProperty(value = "内色", index = 7)
@ExcelProperty(value = "内色", index = 11)
private String innerColor;
/**
* 服役类型:0未上牌,1已上牌
*/
@ExcelProperty(value = "服役类型", index = 8)
@ExcelProperty(value = "服役类型", index = 12)
private String serveType;
/**
* 设备号
*/
@ExcelProperty(value = "设备号", index = 9)
@ExcelProperty(value = "设备号", index = 13)
private String sns;
}
package cn.com.glsx.admin.modules.model.export;
import cn.com.glsx.admin.modules.model.ReportOrgDto;
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 VehicleInfoReportExport {
public class VehicleInfoReportExport extends ReportOrgDto {
/**
* 车辆ID
*/
......@@ -27,19 +28,19 @@ public class VehicleInfoReportExport {
/**
* 车主姓名
*/
@ExcelProperty(value = "车主姓名", index = 0)
@ExcelProperty(value = "车主姓名", index = 4)
private String ownerName;
/**
* 车架号VIN码
*/
@ExcelProperty(value = "车架号VIN码", index = 1)
@ExcelProperty(value = "车架号VIN码", index = 5)
private String vin;
/**
* 设备号
*/
@ExcelProperty(value = "设备号", index = 2)
@ExcelProperty(value = "设备号", index = 6)
private String sn;
/**
......@@ -51,13 +52,13 @@ public class VehicleInfoReportExport {
/**
* 设备类型字符串 1 有线 0无线
*/
@ExcelProperty(value = "设备类型", index = 3)
@ExcelProperty(value = "设备类型", index = 7)
private String deviceTypeStr;
/**
* 车型
*/
@ExcelProperty(value = "车型", index = 4)
@ExcelProperty(value = "车型", index = 8)
private String modelName;
/**
......@@ -69,7 +70,7 @@ public class VehicleInfoReportExport {
/**
* 车辆标签 车辆类型 1:试乘试驶车 2:深度体验车'
*/
@ExcelProperty(value = "车辆标签", index = 5)
@ExcelProperty(value = "车辆标签", index = 9)
private String vehicleTypeStr;
/**
......@@ -81,13 +82,13 @@ public class VehicleInfoReportExport {
/**
* 车辆用途字符串 1 专属用途 2 非专属用途
*/
@ExcelProperty(value = "车辆用途", index = 6)
@ExcelProperty(value = "车辆用途", index = 10)
private String vehicleUsageStr;
/**
* 激活时间
*/
@ExcelProperty(value = "激活时间", index = 7)
@ExcelProperty(value = "激活时间", index = 11)
private String activateTime;
/**
......@@ -99,13 +100,13 @@ public class VehicleInfoReportExport {
/**
* 设备状态字符串 (0 行驶中 1 静止 2离线 3 在线)
*/
@ExcelProperty(value = "设备状态", index = 8)
@ExcelProperty(value = "设备状态", index = 12)
private String deviceStateStr;
/**
* 特殊状态
*/
@ExcelProperty(value = "特殊状态", index = 9)
@ExcelProperty(value = "特殊状态", index = 13)
private String specialState;
/**
......
......@@ -484,6 +484,7 @@ public class VehicleService {
tdve.setServeType("已上牌");
}
});
organizationApiService.drawReportOrganization(list);
return list;
}
......@@ -1041,35 +1042,6 @@ public class VehicleService {
}
}
R<DeviceStatusModel> deviceStatusBySn = deviceFeignService.getDeviceStatusBySn(vehicleInfoPageDTO.getSn(), 0L);
log.info("查询设备状态返回结果===" + JSON.toJSONString(deviceStatusBySn));
if (deviceStatusBySn != null) {
// 状态(0 行驶中 1 静止 2离线 3 在线)
DeviceStatusModel deviceStatusModel = deviceStatusBySn.getData(DeviceStatusModel.class);
if (deviceStatusModel != null) {
Integer deviceStatus = deviceStatusModel.getStatus();
if (deviceStatus != null) {
vehicleInfoPageDTO.setDeviceState(deviceStatus);
switch (deviceStatus) {
case 0:
vehicleInfoPageDTO.setDeviceStateStr("行驶中");
break;
case 1:
vehicleInfoPageDTO.setDeviceStateStr("静止");
break;
case 2:
vehicleInfoPageDTO.setDeviceStateStr("离线");
break;
case 3:
vehicleInfoPageDTO.setDeviceStateStr("在线");
break;
default:
log.info("不存在设备状态");
}
}
}
}
// 判断是否支持高阶调频
setEnableFreParam(vehicleInfoPageDTO);
//设置设备是否支持调频
......@@ -1086,6 +1058,44 @@ public class VehicleService {
}
}
}
List<String> sns = vehicleInfoList.stream().map(VehicleInfoPageDTO::getSn).collect(Collectors.toList());
R<List<DeviceStatusModel>> listDeviceStatusR = deviceFeignService.listDeviceStatusBySns(sns, 0L);
if (listDeviceStatusR != null) {
// 状态(0 行驶中 1 静止 2离线 3 在线)
List<DeviceStatusModel> deviceStatusModelList = listDeviceStatusR.getDataList(new TypeToken<List<DeviceStatusModel>>() {
}.getType());
if (CollectionUtils.isNotEmpty(deviceStatusModelList)) {
for (DeviceStatusModel deviceStatusModel : deviceStatusModelList) {
Integer deviceStatus = deviceStatusModel.getStatus();
if (deviceStatus != null) {
for (VehicleInfoPageDTO vehicleInfoPageDTO : vehicleInfoList) {
if (vehicleInfoPageDTO.getSn().equals(deviceStatusModel.getSn())) {
vehicleInfoPageDTO.setDeviceState(deviceStatus);
switch (deviceStatus) {
case 0:
vehicleInfoPageDTO.setDeviceStateStr("行驶中");
break;
case 1:
vehicleInfoPageDTO.setDeviceStateStr("静止");
break;
case 2:
vehicleInfoPageDTO.setDeviceStateStr("离线");
break;
case 3:
vehicleInfoPageDTO.setDeviceStateStr("在线");
break;
default:
log.info("不存在设备状态");
}
}
}
}
}
}
}
// 暂时删除设备状态的筛选条件
// if (search.getDeviceState() != null) {
// vehicleInfoList.removeIf(vehicleInfoPageDTO -> {
......@@ -1097,6 +1107,7 @@ public class VehicleService {
// return true;
// });
// }
return new PageInfo<>(vehicleInfoList);
}
......@@ -1196,35 +1207,45 @@ public class VehicleService {
vehicleInfoReportExport.setSpecialState("调频关闭");
}
}
}
List<String> sns = vehicleInfoReportExportList.stream().map(VehicleInfoReportExport::getSn).collect(Collectors.toList());
R<List<DeviceStatusModel>> listDeviceStatusR = deviceFeignService.listDeviceStatusBySns(sns, 0L);
if (listDeviceStatusR != null) {
// 状态(0 行驶中 1 静止 2离线 3 在线)
List<DeviceStatusModel> deviceStatusModelList = listDeviceStatusR.getDataList(new TypeToken<List<DeviceStatusModel>>() {
}.getType());
R<DeviceStatusModel> deviceStatusBySn = deviceFeignService.getDeviceStatusBySn(vehicleInfoReportExport.getSn(), 0L);
if (deviceStatusBySn != null) {
// 状态(0 行驶中 1 静止 2离线 3 在线)
DeviceStatusModel deviceStatusModel = deviceStatusBySn.getData(DeviceStatusModel.class);
if (deviceStatusModel != null) {
if (CollectionUtils.isNotEmpty(deviceStatusModelList)) {
for (DeviceStatusModel deviceStatusModel : deviceStatusModelList) {
Integer deviceStatus = deviceStatusModel.getStatus();
if (deviceStatus != null) {
vehicleInfoReportExport.setDeviceState(deviceStatus);
switch (deviceStatus) {
case 0:
vehicleInfoReportExport.setDeviceStateStr("行驶中");
break;
case 1:
vehicleInfoReportExport.setDeviceStateStr("静止");
break;
case 2:
vehicleInfoReportExport.setDeviceStateStr("离线");
break;
case 3:
vehicleInfoReportExport.setDeviceStateStr("在线");
break;
default:
log.info("不存在设备状态");
for (VehicleInfoReportExport vehicleInfoReportExport : vehicleInfoReportExportList) {
if (vehicleInfoReportExport.getSn().equals(deviceStatusModel.getSn())) {
vehicleInfoReportExport.setDeviceState(deviceStatus);
switch (deviceStatus) {
case 0:
vehicleInfoReportExport.setDeviceStateStr("行驶中");
break;
case 1:
vehicleInfoReportExport.setDeviceStateStr("静止");
break;
case 2:
vehicleInfoReportExport.setDeviceStateStr("离线");
break;
case 3:
vehicleInfoReportExport.setDeviceStateStr("在线");
break;
default:
log.info("不存在设备状态");
}
}
}
}
}
}
}
// 暂时删除设备状态的筛选条件
// if (search.getDeviceState() != null) {
// vehicleInfoReportExportList.removeIf(vehicleInfoReportExport -> {
......@@ -1236,7 +1257,7 @@ public class VehicleService {
// return true;
// });
// }
organizationApiService.drawReportOrganization(vehicleInfoReportExportList);
return vehicleInfoReportExportList;
}
......
......@@ -188,8 +188,10 @@
tv.color,
tv.inner_color innerColor,
tv.serve_type serveType,
tu.username shopName, tu.account shopCode,
tvd.sn sns
tu.username shopName,
tu.account shopCode,
tvd.sn sns ,
tv.created_by as createdBy
from t_vehicle tv
inner join t_trial_drive_vehicle ttdv on ttdv.vehicle_id = tv.id
left join t_vehicle_device tvd on tv.id = tvd.vehicle_id and tvd.bind_status = 1 and tvd.del_flag = 0 and tvd.trial_type = 1
......@@ -351,7 +353,8 @@
tv.vehicle_type ,
tv.vehicle_usages ,
td.activate_time ,
ddf.`status` AS freqStatus
ddf.`status` AS freqStatus ,
tv.created_by as createdBy
from t_vehicle tv
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
left join t_device td on td.sn = tvd.sn
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!