|
|
|
@ -9,8 +9,10 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
|
|
import com.ruoyi.common.utils.PageUtils;
|
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
|
import com.ruoyi.database.domain.DevopsDeviceInfo;
|
|
|
|
|
import com.ruoyi.database.domain.TransitImpUserRecord;
|
|
|
|
|
import com.ruoyi.database.domain.TransitImpVehicleRecord;
|
|
|
|
|
import com.ruoyi.database.service.DevopsDeviceInfoService;
|
|
|
|
|
import com.ruoyi.database.service.TransitImpVehicleRecordService;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
@ -20,10 +22,13 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 重点人车辆记录表(TransitImpVehicleRecord)Controller
|
|
|
|
@ -38,31 +43,41 @@ import java.util.List;
|
|
|
|
|
public class TransitImpVehicleRecordController extends BaseController {
|
|
|
|
|
|
|
|
|
|
private final TransitImpVehicleRecordService transitImpVehicleRecordService;
|
|
|
|
|
private final DevopsDeviceInfoService devopsDeviceInfoService;
|
|
|
|
|
|
|
|
|
|
@GetMapping
|
|
|
|
|
@ApiOperation("查询重点人车辆记录表")
|
|
|
|
|
public TableDataInfo<TransitImpVehicleRecord> list(TransitImpVehicleRecord transitImpVehicleRecord) throws Exception{
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
List<DevopsDeviceInfo> deviceInfos = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getParentMonitoringType, 1).list();
|
|
|
|
|
List<String> collect = deviceInfos.stream().map(devopsDeviceInfo -> devopsDeviceInfo.getGbsChannelNo()).collect(Collectors.toList());
|
|
|
|
|
QueryWrapper<TransitImpVehicleRecord> queryWrapper = new QueryWrapper<>(transitImpVehicleRecord);
|
|
|
|
|
if (transitImpVehicleRecord.getFirstTime() != null && transitImpVehicleRecord.getEndTime() != null) {
|
|
|
|
|
queryWrapper.between("partition_field", transitImpVehicleRecord.getFirstTime(), transitImpVehicleRecord.getEndTime());
|
|
|
|
|
}
|
|
|
|
|
queryWrapper.in("device_code",collect);
|
|
|
|
|
if (transitImpVehicleRecord.getFirstTime() != null){
|
|
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
|
|
calendar.setTime(simpleDateFormat.parse(transitImpVehicleRecord.getFirstTime()));
|
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
|
|
queryWrapper.between("partition_field", transitImpVehicleRecord.getFirstTime(),simpleDateFormat.format(calendar.getTime()));
|
|
|
|
|
queryWrapper.orderByDesc("partition_field");
|
|
|
|
|
}else {
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
LocalDateTime minusDay = now.minusDays(1);
|
|
|
|
|
queryWrapper.between("partition_field",formatter.format(minusDay),formatter.format(now));
|
|
|
|
|
queryWrapper.orderByDesc("partition_field");
|
|
|
|
|
}
|
|
|
|
|
int count = transitImpVehicleRecordService.count(queryWrapper);
|
|
|
|
|
PageUtils.startPage();
|
|
|
|
|
List<TransitImpVehicleRecord> list = transitImpVehicleRecordService.list(queryWrapper);
|
|
|
|
|
List<TransitImpVehicleRecord> impVehicleRecords = new ArrayList<>();
|
|
|
|
|
for (TransitImpVehicleRecord transitImpVehicleRecord1 : list){
|
|
|
|
|
Date partitionField = transitImpVehicleRecord1.getPartitionField();
|
|
|
|
|
String format = dateFormat.format(partitionField);
|
|
|
|
|
transitImpVehicleRecord1.setElapsedTime(format);
|
|
|
|
|
impVehicleRecords.add(transitImpVehicleRecord1);
|
|
|
|
|
if (!"unknown".equals(transitImpVehicleRecord1.getPlateNo())) {
|
|
|
|
|
Date partitionField = transitImpVehicleRecord1.getPartitionField();
|
|
|
|
|
String format = dateFormat.format(partitionField);
|
|
|
|
|
transitImpVehicleRecord1.setElapsedTime(format);
|
|
|
|
|
impVehicleRecords.add(transitImpVehicleRecord1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
TableDataInfo dataTable = getDataTable(impVehicleRecords);
|
|
|
|
|
dataTable.setTotal(count);
|
|
|
|
|