1. data-fall에 데이터가 없는 경우 NoContent 처리

2. 버전 업데이트
This commit is contained in:
장선애 2023-09-12 13:57:39 +09:00
parent c9046a0fb4
commit 867c398692
5 changed files with 39 additions and 48 deletions

View File

@ -5,7 +5,7 @@ plugins {
}
group = 'inc.sdt.controlcentermanagement'
version = '0.0.5'
version = '0.0.6'
java {
sourceCompatibility = '17'

View File

@ -1,4 +1,4 @@
aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin 003960268191.dkr.ecr.ap-northeast-2.amazonaws.com
docker build --platform linux/amd64 -t control-center-management ../../
docker tag control-center-management:latest 003960268191.dkr.ecr.ap-northeast-2.amazonaws.com/sdt-cloud/control-center-management:0.0.5
docker push 003960268191.dkr.ecr.ap-northeast-2.amazonaws.com/sdt-cloud/control-center-management:0.0.5
docker tag control-center-management:latest 003960268191.dkr.ecr.ap-northeast-2.amazonaws.com/sdt-cloud/control-center-management:0.0.6
docker push 003960268191.dkr.ecr.ap-northeast-2.amazonaws.com/sdt-cloud/control-center-management:0.0.6

View File

@ -26,3 +26,8 @@ Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb25JZCI6ImQxZGJlYWExL
"voltageOffset" : 1.5,
"ampereOffset": 1.1
}
### 통계 디테일 조회
GET http://localhost:8087/chambers/stats/detail/1
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb25JZCI6ImQxZGJlYWExLWY5ZTUtNGE4OC1hMWM4LTYzMWQ4NTMyOWJmYyIsInJvbGVzIjpbIlJPTEVfQURNSU5JU1RSQVRPUiJdLCJpZCI6IjdjYTBjZWQ5LTk1YjEtNDgzMC05YmJhLWZmZTUwNWVmYzgzMiIsInN1YiI6InNkdC5kZXZAc2R0LmluYyIsImlhdCI6MTY5NDQ5MjIyMSwiZXhwIjoxNjk0NDk1ODIxfQ.ZKa8-eKnJr0VDnGMmExAQnXFTfE4Y38OsI3nZ18S80E

View File

@ -8,7 +8,6 @@ import inc.sdt.controlcentermanagement.presentation.StatsCntRecord;
import inc.sdt.controlcentermanagement.presentation.StatsDetailRecord;
import inc.sdt.controlcentermanagement.presentation.StatsRecord;
import inc.sdt.controlcentermanagement.presentation.support.CustomPage;
import inc.sdt.controlcentermanagement.presentation.support.CustomPageable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@ -83,7 +82,8 @@ public class DefaultStatsService implements StatsService{
}
});
}
} else {
throw new NoSuchElementException();
}
}
StatsCntRecord onCntRecord = new StatsCntRecord(onCnt.get(), onTotalCnt.get());
@ -99,6 +99,7 @@ public class DefaultStatsService implements StatsService{
@Override
public Page<StatsDetailRecord> getChamberStatsDetail(int page, int size, String chamberNumber) {
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);
List<StatsDetailRecord> statsDetailRecords = new LinkedList<>();
@ -134,24 +135,8 @@ public class DefaultStatsService implements StatsService{
}
});
}
}
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);
} else {
throw new NoSuchElementException();
}
}));

View File

@ -24,10 +24,11 @@ class RestControllerExceptionHandler {
return ExceptionResponse.builder(HttpStatus.BAD_REQUEST)
.build(e.getBindingResult().getAllErrors().get(0).getDefaultMessage());
}
@ExceptionHandler
@ResponseStatus(HttpStatus.NOT_FOUND)
ExceptionResponse handleNoSuchElementException(NoSuchElementException e) {
return ExceptionResponse.builder(HttpStatus.NOT_FOUND)
.build(e.getMessage() + " does not exist.");
@ExceptionHandler(value = NoSuchElementException.class)
@ResponseStatus(HttpStatus.NO_CONTENT)
ExceptionResponse handleNoContentException(NoSuchElementException e) {
return ExceptionResponse.builder(HttpStatus.NO_CONTENT)
.build(e.getMessage());
}
}