|
|
@ -624,14 +624,17 @@ public class ReportServiceImpl implements ReportService { |
|
|
|
List<PlanGenerationEntity> plans = planService.planGeneration(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null ,DateUtil.format(new Date(),"yyyy")); |
|
|
|
List<PlanGenerationEntity> plans = planService.planGeneration(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null ,DateUtil.format(new Date(),"yyyy")); |
|
|
|
// 查询站点设备
|
|
|
|
// 查询站点设备
|
|
|
|
List<RideDeviceVo> devices = deviceService.rideDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); |
|
|
|
List<RideDeviceVo> devices = deviceService.rideDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); |
|
|
|
List<RunMonthEntity> runs = new ArrayList<>(); |
|
|
|
|
|
|
|
stations.forEach(station->{ |
|
|
|
stations.forEach(station->{ |
|
|
|
RunMonthEntity run = new RunMonthEntity(); |
|
|
|
RunMonthEntity run = new RunMonthEntity(); |
|
|
|
|
|
|
|
run.setTenantId(station.getTenantId()); |
|
|
|
|
|
|
|
run.setCreateDept(station.getRefDept()); |
|
|
|
|
|
|
|
run.setCreateUser(station.getCreateUser()); |
|
|
|
|
|
|
|
run.setUpdateUser(station.getUpdateUser()); |
|
|
|
run.setStationCode(station.getCode()); |
|
|
|
run.setStationCode(station.getCode()); |
|
|
|
run.setStationName(station.getName()); |
|
|
|
run.setStationName(station.getName()); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
calendar.setTime(DateUtil.parse("2024-04-01 00:00:00",DateUtil.PATTERN_DATETIME)); |
|
|
|
calendar.setTime(new Date()); |
|
|
|
//calendar.add(Calendar.DAY_OF_MONTH,-1);
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-1); |
|
|
|
run.setMonth(DateUtil.format(calendar.getTime(),"yyyy-MM")); |
|
|
|
run.setMonth(DateUtil.format(calendar.getTime(),"yyyy-MM")); |
|
|
|
List<RideDeviceVo> stationDevices = devices.stream().filter(device->device.getDepartment().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
List<RideDeviceVo> stationDevices = devices.stream().filter(device->device.getDepartment().equals(station.getRefDept())).collect(Collectors.toList()); |
|
|
|
if(CollectionUtil.isEmpty(stationDevices)){ |
|
|
|
if(CollectionUtil.isEmpty(stationDevices)){ |
|
|
@ -645,9 +648,9 @@ public class ReportServiceImpl implements ReportService { |
|
|
|
run.setCurveData(this.curveData(stationDevices)); |
|
|
|
run.setCurveData(this.curveData(stationDevices)); |
|
|
|
// TODO 运行数据分析
|
|
|
|
// TODO 运行数据分析
|
|
|
|
// TODO 运行建议及其他
|
|
|
|
// TODO 运行建议及其他
|
|
|
|
runs.add(run); |
|
|
|
runMonService.save(run); |
|
|
|
}); |
|
|
|
}); |
|
|
|
runMonService.saveBatch(runs); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -686,8 +689,7 @@ public class ReportServiceImpl implements ReportService { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Double generate(int type,String deviceCode,double ride) { |
|
|
|
private Double generate(int type,String deviceCode,double ride) { |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
calendar.setTime(DateUtil.parse("2024-04-01 00:00:00",DateUtil.PATTERN_DATETIME)); |
|
|
|
calendar.setTime(new Date()); |
|
|
|
//calendar.setTime(new Date());
|
|
|
|
|
|
|
|
String end = null,start = null; |
|
|
|
String end = null,start = null; |
|
|
|
int cycleType = 5; |
|
|
|
int cycleType = 5; |
|
|
|
switch (type){ |
|
|
|
switch (type){ |
|
|
@ -723,8 +725,7 @@ public class ReportServiceImpl implements ReportService { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Double planGenerate(int type, String stationCode,List<PlanGenerationEntity> plans) { |
|
|
|
private Double planGenerate(int type, String stationCode,List<PlanGenerationEntity> plans) { |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
calendar.setTime(DateUtil.parse("2024-04-01 00:00:00",DateUtil.PATTERN_DATETIME)); |
|
|
|
calendar.setTime(new Date()); |
|
|
|
//calendar.setTime(new Date());
|
|
|
|
|
|
|
|
if(type == 0){ |
|
|
|
if(type == 0){ |
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-1); |
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-1); |
|
|
|
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY) + 1); |
|
|
|
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY) + 1); |
|
|
@ -761,8 +762,7 @@ public class ReportServiceImpl implements ReportService { |
|
|
|
// 确定查询时间范围: 年、月
|
|
|
|
// 确定查询时间范围: 年、月
|
|
|
|
Date startDate,endDate; |
|
|
|
Date startDate,endDate; |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
calendar.setTime(DateUtil.parse("2024-04-01 00:00:00",DateUtil.PATTERN_DATETIME)); |
|
|
|
calendar.setTime(new Date()); |
|
|
|
//calendar.setTime(new Date());
|
|
|
|
|
|
|
|
endDate = calendar.getTime(); |
|
|
|
endDate = calendar.getTime(); |
|
|
|
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); |
|
|
|
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); |
|
|
|
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); |
|
|
|
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); |
|
|
@ -835,8 +835,7 @@ public class ReportServiceImpl implements ReportService { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private String alarmData(String code) { |
|
|
|
private String alarmData(String code) { |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
calendar.setTime(DateUtil.parse("2024-04-01 00:00:00",DateUtil.PATTERN_DATETIME)); |
|
|
|
calendar.setTime(new Date()); |
|
|
|
//calendar.setTime(new Date());
|
|
|
|
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-1); |
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-1); |
|
|
|
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
calendar.add(Calendar.MONTH,-1); |
|
|
|
calendar.add(Calendar.MONTH,-1); |
|
|
@ -943,12 +942,10 @@ public class ReportServiceImpl implements ReportService { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private List<EchartVo> curve(List<AttributeVo> attributes, String deviceCode) { |
|
|
|
private List<EchartVo> curve(List<AttributeVo> attributes, String deviceCode) { |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
calendar.setTime(DateUtil.parse("2024-04-01 23:59:59",DateUtil.PATTERN_DATETIME)); |
|
|
|
calendar.setTime(DateUtil.parse(DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 23:59:59",DateUtil.PATTERN_DATETIME)); |
|
|
|
//calendar.setTime(DateUtil.parse(DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 23:59:59",DateUtil.PATTERN_DATETIME));
|
|
|
|
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-1); |
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-1); |
|
|
|
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
calendar.add(Calendar.MONTH,-1); |
|
|
|
calendar.add(Calendar.MONTH,-1); |
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,1); |
|
|
|
|
|
|
|
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); |
|
|
|
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); |
|
|
|
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); |
|
|
|
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); |
|
|
|
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); |
|
|
|
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); |
|
|
|