fix: 修正hour处理

dev
huangfeng 2 months ago
parent 5367dad14b
commit c9cf6dcb7b

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

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

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

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

Loading…
Cancel
Save