tube stats detail 삭제된 코드 재추가
This commit is contained in:
parent
2aed8b9f65
commit
4c553d2938
|
@ -38,6 +38,7 @@ public class DefaultStatsService implements StatsService{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StatsRecord> getChamberStats() {
|
public List<StatsRecord> getChamberStats() {
|
||||||
|
log.info("[getChamberStats]");
|
||||||
List<Slot> all= slotRepositoryDelegate.getAll();
|
List<Slot> all= slotRepositoryDelegate.getAll();
|
||||||
|
|
||||||
Map<String, List<Slot>> groupByChamber = all.stream().collect(Collectors.groupingBy(Slot::getChamberNumber));
|
Map<String, List<Slot>> groupByChamber = all.stream().collect(Collectors.groupingBy(Slot::getChamberNumber));
|
||||||
|
@ -62,28 +63,27 @@ public class DefaultStatsService implements StatsService{
|
||||||
log.info("optional = {}",optional);
|
log.info("optional = {}",optional);
|
||||||
if(optional.isPresent()){
|
if(optional.isPresent()){
|
||||||
List<DataResource> content = optional.get().getContent();
|
List<DataResource> content = optional.get().getContent();
|
||||||
for (DataResource dataResource : content) {
|
for(DataResource dataResource : content){
|
||||||
dataResource.getData().forEach((key, value) -> {
|
dataResource.getData().forEach((key, value)->{
|
||||||
if (key.contains("er2")) {
|
if(key.contains("er2")){
|
||||||
errTotalCnt.updateAndGet(v -> v + 1);
|
errTotalCnt.updateAndGet(v -> v + 1);
|
||||||
if ((int) value > 0) {
|
if((int)value > 0){
|
||||||
err2Cnt.updateAndGet(v -> v + 1);
|
err2Cnt.updateAndGet(v -> v + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key.contains("do")) {
|
if(key.contains("do")){
|
||||||
onTotalCnt.updateAndGet(v -> v + 1);
|
onTotalCnt.updateAndGet(v -> v + 1);
|
||||||
offTotalCnt.updateAndGet(v -> v + 1);
|
offTotalCnt.updateAndGet(v -> v + 1);
|
||||||
if ((int) value > 0) {
|
if((int)value > 0){
|
||||||
onCnt.updateAndGet(v -> v + 1);
|
onCnt.updateAndGet(v -> v + 1);
|
||||||
} else {
|
}else{
|
||||||
offCnt.updateAndGet(v -> v + 1);
|
offCnt.updateAndGet(v -> v + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
throw new NoSuchElementException();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StatsCntRecord onCntRecord = new StatsCntRecord(onCnt.get(), onTotalCnt.get());
|
StatsCntRecord onCntRecord = new StatsCntRecord(onCnt.get(), onTotalCnt.get());
|
||||||
|
@ -98,8 +98,8 @@ public class DefaultStatsService implements StatsService{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<StatsDetailRecord> getChamberStatsDetail(int page, int size, String chamberNumber) {
|
public Page<StatsDetailRecord> getChamberStatsDetail(int page, int size, String chamberNumber) {
|
||||||
|
log.info("[getChamberStatsDetail] chamberNumber: {}", chamberNumber);
|
||||||
List<Slot> all= slotRepositoryDelegate.getAll().stream().filter(slot -> slot.getChamberNumber().equals(chamberNumber)).toList();
|
List<Slot> all= slotRepositoryDelegate.getAll().stream().filter(slot -> slot.getChamberNumber().equals(chamberNumber)).toList();
|
||||||
if (all.isEmpty()) throw new NoSuchElementException();
|
|
||||||
Pageable pageable = PageRequest.of(page, size);
|
Pageable pageable = PageRequest.of(page, size);
|
||||||
|
|
||||||
List<StatsDetailRecord> statsDetailRecords = new LinkedList<>();
|
List<StatsDetailRecord> statsDetailRecords = new LinkedList<>();
|
||||||
|
@ -120,24 +120,43 @@ public class DefaultStatsService implements StatsService{
|
||||||
|
|
||||||
if(optional.isPresent()){
|
if(optional.isPresent()){
|
||||||
List<DataResource> content = optional.get().getContent();
|
List<DataResource> content = optional.get().getContent();
|
||||||
for (DataResource dataResource : content) {
|
for(DataResource dataResource : content){
|
||||||
dataResource.getData().forEach((key, value) -> {
|
dataResource.getData().forEach((key, value)->{
|
||||||
if (key.startsWith("current")) {
|
if(key.startsWith("current")){
|
||||||
currentMap.put(key.replace("current", ""), value);
|
currentMap.put(key.replace("current",""), value);
|
||||||
} else if (key.startsWith("voltage")) {
|
}else if(key.startsWith("voltage")){
|
||||||
voltageMap.put(key.replace("voltage", ""), value);
|
voltageMap.put(key.replace("voltage",""), value);
|
||||||
} else if (key.startsWith("do")) {
|
}else if(key.startsWith("do")){
|
||||||
doMap.put(key.replace("do", ""), value);
|
doMap.put(key.replace("do",""), value);
|
||||||
} else if (key.startsWith("er1")) {
|
}else if(key.startsWith("er1")){
|
||||||
er1Map.put(key.replace("er1", ""), value);
|
er1Map.put(key.replace("er1",""), value);
|
||||||
} else if (key.startsWith("er2")) {
|
}else if(key.startsWith("er2")){
|
||||||
er2Map.put(key.replace("er2", ""), value);
|
er2Map.put(key.replace("er2",""), value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new NoSuchElementException();
|
throw new NoSuchElementException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(int i=0 ; i < 16 ; i++){
|
||||||
|
StatsDetailRecord statsDetailRecord = new StatsDetailRecord(
|
||||||
|
slot.getAssetCode(),
|
||||||
|
slot.getSlotNumber(),
|
||||||
|
String.valueOf(i),
|
||||||
|
"status",
|
||||||
|
String.valueOf(voltageMap.get(String.valueOf(i))),
|
||||||
|
String.valueOf(currentMap.get(String.valueOf(i))),
|
||||||
|
String.valueOf(doMap.get(String.valueOf(i))),
|
||||||
|
String.valueOf(er1Map.get(String.valueOf(i))),
|
||||||
|
String.valueOf(er2Map.get(String.valueOf(i))),
|
||||||
|
"passTime",
|
||||||
|
"retentionRate",
|
||||||
|
String.valueOf(slot.getTube().get(i).getVoltageOffset()),
|
||||||
|
String.valueOf(slot.getTube().get(i).getAmpereOffset())
|
||||||
|
);
|
||||||
|
statsDetailRecords.add(statsDetailRecord);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
statsDetailRecords.sort(new StatsDetailSlotNumberComparator());
|
statsDetailRecords.sort(new StatsDetailSlotNumberComparator());
|
||||||
|
|
Loading…
Reference in New Issue