1. Tube 개별 on/off 제어 request 수정

2. 버전 업데이트
This commit is contained in:
장선애 2023-09-11 14:17:49 +09:00
parent 59c0de7f25
commit 224f279735
5 changed files with 40 additions and 24 deletions

View File

@ -5,7 +5,7 @@ plugins {
} }
group = 'inc.sdt.controlcentermanagement' group = 'inc.sdt.controlcentermanagement'
version = '0.0.3' version = '0.0.4'
java { java {
sourceCompatibility = '17' 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 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 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.3 docker tag control-center-management:latest 003960268191.dkr.ecr.ap-northeast-2.amazonaws.com/sdt-cloud/control-center-management:0.0.4
docker push 003960268191.dkr.ecr.ap-northeast-2.amazonaws.com/sdt-cloud/control-center-management:0.0.3 docker push 003960268191.dkr.ecr.ap-northeast-2.amazonaws.com/sdt-cloud/control-center-management:0.0.4

View File

@ -1,21 +1,20 @@
## ON/OFF 제어 ## ON/OFF 제어
#PATCH http://13.209.39.139:30870/chamber/1/tube/toggle #PATCH http://13.209.39.139:30870/chamber/1/tube/toggle
PATCH http://13.209.39.139:32171/chamber/1/tube/toggle PATCH http://13.209.39.139:32171/chambers/1/tube/toggle
#PATCH http://localhost:8087/chamber/1/tube/toggle #PATCH http://localhost:8087/chambers/1/tube/toggle
Content-Type: application/json Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb25JZCI6ImQxZGJlYWExLWY5ZTUtNGE4OC1hMWM4LTYzMWQ4NTMyOWJmYyIsInJvbGVzIjpbIlJPTEVfQURNSU5JU1RSQVRPUiJdLCJpZCI6IjcyYTUxZDUwLTYwMDEtNDAwYy04NjNmLWZlOGU2OGE1MGExMCIsInN1YiI6InNhLmphbmdAc2R0LmluYyIsImlhdCI6MTY5NDEzNjg4OCwiZXhwIjoxNjk0MTQwNDg4fQ.likh7Ix7p4Yf2iwankLG71VGrgCDzQzhn9Z7QJK0blg Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb25JZCI6ImQxZGJlYWExLWY5ZTUtNGE4OC1hMWM4LTYzMWQ4NTMyOWJmYyIsInJvbGVzIjpbIlJPTEVfQURNSU5JU1RSQVRPUiJdLCJpZCI6IjdjYTBjZWQ5LTk1YjEtNDgzMC05YmJhLWZmZTUwNWVmYzgzMiIsInN1YiI6InNkdC5kZXZAc2R0LmluYyIsImlhdCI6MTY5NDQwNjA5NywiZXhwIjoxNjk0NDA5Njk3fQ.U1u44yrvZxT-jZzO3WN6i5hMvY2fDl5_DJFT49c6-0s
{"command": "ON"}
//{
// "command" : "OFF",
// "assetCode" : "NODEQ-TEST-1",
// "slotNumber" : "1-1",
// "tube": [
// {"code": "1"}, {"code": "3"}, {"code": "11"}, {"code": "16"}
// ]
//}
{
"command" : "ON",
"assetCode" : "NQ-R04-TEST-003",
"tube": [
{"slotNumber": "1", "code": "1"},
{"slotNumber": "1", "code": "3"},
{"slotNumber": "1", "code": "11"},
{"slotNumber": "4", "code": "16"}
]
}
### offset 제어 ### offset 제어
#PATCH http://localhost:8087/chambers/1/slots/1/tubes/1 #PATCH http://localhost:8087/chambers/1/slots/1/tubes/1

View File

@ -49,16 +49,15 @@ class DefaultTubeService implements TubeService {
Map<String, String> tubeMap = new LinkedHashMap<>(); Map<String, String> tubeMap = new LinkedHashMap<>();
for (Tube tube : request.getTube()) { for (Tube tube : request.getTube()) {
Map<String, Integer> tubeOffsetMap = this.tubeOffset(); Map<String, Integer> tubeOffsetMap = this.tubeOffset();
int tubeOffset = tubeOffsetMap.getOrDefault(request.getSlotNumber(), 1); int tubeOffset = tubeOffsetMap.getOrDefault(tube.getSlotNumber(), 1);
int tubeKey = Integer.parseInt(tube.getCode()) + tubeOffset; int tubeKey = Integer.parseInt(tube.getCode()) + tubeOffset;
tubeMap.put(String.valueOf(tubeKey), String.valueOf(request.getCommand().ordinal())); tubeMap.put(String.valueOf(tubeKey), String.valueOf(request.getCommand().ordinal()));
} }
DeployRequest deployRequest = DeployRequest.builder() DeployRequest deployRequest = DeployRequest.builder()
.assetCode(request.getAssetCode()) .assetCode(request.getAssetCode())
.appName(request.getSlotNumber()) .appName("awx_collector")
.commandType(CommandType.JSON) .commandType(CommandType.JSON)
.name("") // TODO
.parameters(tubeMap) .parameters(tubeMap)
.build(); .build();
@ -89,9 +88,8 @@ class DefaultTubeService implements TubeService {
resultMap.forEach((assetCode, slot) -> slot.forEach((slotNumber, tube) -> { resultMap.forEach((assetCode, slot) -> slot.forEach((slotNumber, tube) -> {
DeployRequest deployRequest = DeployRequest.builder() DeployRequest deployRequest = DeployRequest.builder()
.assetCode(assetCode) .assetCode(assetCode)
.appName(slotNumber) .appName("awx_collector")
.commandType(CommandType.JSON) .commandType(CommandType.JSON)
.name("") // TODO
.parameters(tube) .parameters(tube)
.build(); .build();

View File

@ -4,18 +4,30 @@ package inc.sdt.controlcentermanagement.domain;
* @author sunae.jang (sa.jang@sdt.inc) * @author sunae.jang (sa.jang@sdt.inc)
*/ */
public class Tube { public class Tube {
private String slotNumber;
private String code; private String code;
private Float voltageOffset; private Float voltageOffset;
private Float ampereOffset; private Float ampereOffset;
protected Tube() { protected Tube() {
} }
public Tube(String slotNumber, String code, Float voltageOffset, Float ampereOffset) {
this.slotNumber = slotNumber;
this.code = code;
this.voltageOffset = voltageOffset;
this.ampereOffset = ampereOffset;
}
public Tube(String code, Float voltageOffset, Float ampereOffset) { public Tube(String code, Float voltageOffset, Float ampereOffset) {
this.code = code; this.code = code;
this.voltageOffset = voltageOffset; this.voltageOffset = voltageOffset;
this.ampereOffset = ampereOffset; this.ampereOffset = ampereOffset;
} }
public String getSlotNumber() {
return slotNumber;
}
public String getCode() { public String getCode() {
return code; return code;
} }
@ -31,7 +43,8 @@ public class Tube {
@Override @Override
public String toString() { public String toString() {
return "Tube{" + return "Tube{" +
"code='" + code + '\'' + "slotNumber='" + slotNumber + '\'' +
", code='" + code + '\'' +
", voltageOffset=" + voltageOffset + ", voltageOffset=" + voltageOffset +
", ampereOffset=" + ampereOffset + ", ampereOffset=" + ampereOffset +
'}'; '}';
@ -42,6 +55,7 @@ public class Tube {
} }
public static final class Builder { public static final class Builder {
private String slotNumber;
private String code; private String code;
private Float voltageOffset; private Float voltageOffset;
private Float ampereOffset; private Float ampereOffset;
@ -49,6 +63,11 @@ public class Tube {
private Builder() { private Builder() {
} }
public Builder slotNumber(String slotNumber) {
this.slotNumber = slotNumber;
return this;
}
public Builder code(String code) { public Builder code(String code) {
this.code = code; this.code = code;
return this; return this;
@ -65,7 +84,7 @@ public class Tube {
} }
public Tube build() { public Tube build() {
return new Tube(code, voltageOffset, ampereOffset); return new Tube(slotNumber, code, voltageOffset, ampereOffset);
} }
} }
} }