Merged in feature/SCDD-224 (pull request #1)

feature/SCDD-224
This commit is contained in:
Sunae Jang 2023-09-11 05:25:26 +00:00
commit 6df23e3327
5 changed files with 40 additions and 24 deletions

View File

@ -5,7 +5,7 @@ plugins {
}
group = 'inc.sdt.controlcentermanagement'
version = '0.0.3'
version = '0.0.4'
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.3
docker push 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.4

View File

@ -1,21 +1,20 @@
## ON/OFF 제어
#PATCH http://13.209.39.139:30870/chamber/1/tube/toggle
PATCH http://13.209.39.139:32171/chamber/1/tube/toggle
#PATCH http://localhost:8087/chamber/1/tube/toggle
PATCH http://13.209.39.139:32171/chambers/1/tube/toggle
#PATCH http://localhost:8087/chambers/1/tube/toggle
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb25JZCI6ImQxZGJlYWExLWY5ZTUtNGE4OC1hMWM4LTYzMWQ4NTMyOWJmYyIsInJvbGVzIjpbIlJPTEVfQURNSU5JU1RSQVRPUiJdLCJpZCI6IjcyYTUxZDUwLTYwMDEtNDAwYy04NjNmLWZlOGU2OGE1MGExMCIsInN1YiI6InNhLmphbmdAc2R0LmluYyIsImlhdCI6MTY5NDEzNjg4OCwiZXhwIjoxNjk0MTQwNDg4fQ.likh7Ix7p4Yf2iwankLG71VGrgCDzQzhn9Z7QJK0blg
{"command": "ON"}
//{
// "command" : "OFF",
// "assetCode" : "NODEQ-TEST-1",
// "slotNumber" : "1-1",
// "tube": [
// {"code": "1"}, {"code": "3"}, {"code": "11"}, {"code": "16"}
// ]
//}
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb25JZCI6ImQxZGJlYWExLWY5ZTUtNGE4OC1hMWM4LTYzMWQ4NTMyOWJmYyIsInJvbGVzIjpbIlJPTEVfQURNSU5JU1RSQVRPUiJdLCJpZCI6IjdjYTBjZWQ5LTk1YjEtNDgzMC05YmJhLWZmZTUwNWVmYzgzMiIsInN1YiI6InNkdC5kZXZAc2R0LmluYyIsImlhdCI6MTY5NDQwNjA5NywiZXhwIjoxNjk0NDA5Njk3fQ.U1u44yrvZxT-jZzO3WN6i5hMvY2fDl5_DJFT49c6-0s
{
"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 제어
#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<>();
for (Tube tube : request.getTube()) {
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;
tubeMap.put(String.valueOf(tubeKey), String.valueOf(request.getCommand().ordinal()));
}
DeployRequest deployRequest = DeployRequest.builder()
.assetCode(request.getAssetCode())
.appName(request.getSlotNumber())
.appName("awx_collector")
.commandType(CommandType.JSON)
.name("") // TODO
.parameters(tubeMap)
.build();
@ -89,9 +88,8 @@ class DefaultTubeService implements TubeService {
resultMap.forEach((assetCode, slot) -> slot.forEach((slotNumber, tube) -> {
DeployRequest deployRequest = DeployRequest.builder()
.assetCode(assetCode)
.appName(slotNumber)
.appName("awx_collector")
.commandType(CommandType.JSON)
.name("") // TODO
.parameters(tube)
.build();

View File

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