fix: 修正hour处理

dev
huangfeng 2 months ago
parent 5367dad14b
commit c9cf6dcb7b

@ -1,9 +1,11 @@
package com.shxy.xymanager_common.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
public class ScheduleDetailsDto implements Serializable {
private Integer id;

@ -12,7 +12,6 @@ public class StatChannel {
Integer channelId;
List<StatPreset> presets = new ArrayList<>();
List<String> hourList;
List<ScheduleDetailsDto> scheduleList;
public void addPhoto(TerminalPhotoSelectListModel.PhotoBean photo) {
StatPreset the = null;
@ -24,10 +23,10 @@ public class StatChannel {
}
if (the == null) {
the = new StatPreset();
the.init(hourList);
the.setPresetId(photo.getPresetId());
presets.add(the);
}
the.init(hourList);
the.addPhoto(photo);
}
@ -51,7 +50,6 @@ public class StatChannel {
if (CollectionUtils.isEmpty(list)) {
return;
}
scheduleList = list;
for (ScheduleDetailsDto detail : list) {
StatPreset the = null;
for (StatPreset item : presets) {

@ -14,11 +14,13 @@ public class StatPreset {
List<ScheduleDetailsDto> scheduleList = new ArrayList<>();
public void init(List<String> hourList) {
for (String str : hourList) {
StatHour hour = new StatHour();
hour.setHour(str);
hour.setBase(2);
hours.add(hour);
if (hours.size() == 0) {
for (String str : hourList) {
StatHour hour = new StatHour();
hour.setHour(str);
hour.setBase(2);
hours.add(hour);
}
}
}

@ -28,10 +28,10 @@ public class StatTerm {
}
if (the == null) {
the = new StatChannel();
the.setHourList(hourList);
the.setChannelId(photo.getChannelid());
channels.add(the);
}
the.setHourList(hourList);
the.addPhoto(photo);
}

Loading…
Cancel
Save