deployerRequest parameters <String, Integer>로 변경

This commit is contained in:
장선애 2023-09-12 14:25:05 +09:00
parent 867c398692
commit 2aed8b9f65
3 changed files with 13 additions and 13 deletions

View File

@ -1,9 +1,9 @@
## 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/chambers/1/tube/toggle #PATCH http://13.209.39.139:32171/chambers/1/tube/toggle
#PATCH http://localhost:8087/chambers/1/tube/toggle PATCH http://localhost:8087/chambers/1/tube/toggle
Content-Type: application/json Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb25JZCI6ImQxZGJlYWExLWY5ZTUtNGE4OC1hMWM4LTYzMWQ4NTMyOWJmYyIsInJvbGVzIjpbIlJPTEVfQURNSU5JU1RSQVRPUiJdLCJpZCI6IjdjYTBjZWQ5LTk1YjEtNDgzMC05YmJhLWZmZTUwNWVmYzgzMiIsInN1YiI6InNkdC5kZXZAc2R0LmluYyIsImlhdCI6MTY5NDQwNjA5NywiZXhwIjoxNjk0NDA5Njk3fQ.U1u44yrvZxT-jZzO3WN6i5hMvY2fDl5_DJFT49c6-0s Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb25JZCI6ImQxZGJlYWExLWY5ZTUtNGE4OC1hMWM4LTYzMWQ4NTMyOWJmYyIsInJvbGVzIjpbIlJPTEVfQURNSU5JU1RSQVRPUiJdLCJpZCI6IjdjYTBjZWQ5LTk1YjEtNDgzMC05YmJhLWZmZTUwNWVmYzgzMiIsInN1YiI6InNkdC5kZXZAc2R0LmluYyIsImlhdCI6MTY5NDQ5NjE4MiwiZXhwIjoxNjk0NDk5NzgyfQ.n5kpWEiOLrZCSwlc-MWYzJtxbFPGZCOk-NBdhKnlrog
{ {
"command" : "ON", "command" : "ON",
@ -12,7 +12,7 @@ Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb25JZCI6ImQxZGJlYWExL
{"slotNumber": "1", "code": "1"}, {"slotNumber": "1", "code": "1"},
{"slotNumber": "1", "code": "3"}, {"slotNumber": "1", "code": "3"},
{"slotNumber": "1", "code": "11"}, {"slotNumber": "1", "code": "11"},
{"slotNumber": "4", "code": "16"} {"slotNumber": "4", "code": "15"}
] ]
} }

View File

@ -43,13 +43,13 @@ class DefaultTubeService implements TubeService {
@Override @Override
public void controlByTubeCode(String authorization, Slot slot) { public void controlByTubeCode(String authorization, Slot slot) {
log.info("[controlByTubeCode] slot: {}", slot); log.info("[controlByTubeCode] slot: {}", slot);
Map<String, String> tubeMap = new LinkedHashMap<>(); Map<String, Integer> tubeMap = new LinkedHashMap<>();
Slot request = this.get(slot.getChamberNumber(), slot.getTube().get(0).getSlotNumber()); // TODO: 현재 단건 컨트롤, 추후 변경 필요 Slot request = this.get(slot.getChamberNumber(), slot.getTube().get(0).getSlotNumber()); // TODO: 현재 단건 컨트롤, 추후 변경 필요
for (Tube tube : slot.getTube()) { for (Tube tube : slot.getTube()) {
Map<String, Integer> tubeOffsetMap = this.tubeOffset(); Map<String, Integer> tubeOffsetMap = this.tubeOffset();
int tubeOffset = tubeOffsetMap.getOrDefault(request.getSlotNumber(), 1); int tubeOffset = tubeOffsetMap.getOrDefault(request.getSlotNumber(), 1);
int tubeKey = Integer.parseInt(request.getTube().get(Integer.parseInt(tube.getCode())).getCode()) + tubeOffset; int tubeKey = Integer.parseInt(request.getTube().get(Integer.parseInt(tube.getCode())).getCode()) + tubeOffset;
tubeMap.put(String.valueOf(tubeKey), String.valueOf(slot.getCommand().ordinal())); tubeMap.put(String.valueOf(tubeKey), slot.getCommand().ordinal());
} }
DeployRequest deployRequest = DeployRequest.builder() DeployRequest deployRequest = DeployRequest.builder()
@ -72,8 +72,8 @@ class DefaultTubeService implements TubeService {
assets.add(slot.getAssetCode()); assets.add(slot.getAssetCode());
} }
assets.forEach(assetCode -> { assets.forEach(assetCode -> {
Map<String, String> parameterMap = new LinkedHashMap<>(); Map<String, Integer> parameterMap = new LinkedHashMap<>();
parameterMap.put("total", String.valueOf(command.ordinal())); parameterMap.put("total", command.ordinal());
for (int i = 1; i <= 2; i++) { for (int i = 1; i <= 2; i++) {
DeployRequest deployRequest = DeployRequest.builder() DeployRequest deployRequest = DeployRequest.builder()
.assetCode(assetCode) .assetCode(assetCode)

View File

@ -11,9 +11,9 @@ public class DeployRequest {
private String commandType; private String commandType;
private String fileName; private String fileName;
private String name; private String name;
private Map<String, String> parameters; private Map<String, Integer> parameters;
public DeployRequest(String assetCode, String appName, String commandType, String fileName, String name, Map<String, String> parameters) { public DeployRequest(String assetCode, String appName, String commandType, String fileName, String name, Map<String, Integer> parameters) {
this.assetCode = assetCode; this.assetCode = assetCode;
this.appName = appName; this.appName = appName;
this.commandType = commandType; this.commandType = commandType;
@ -47,7 +47,7 @@ public class DeployRequest {
return name; return name;
} }
public Map<String, String> getParameters() { public Map<String, Integer> getParameters() {
return parameters; return parameters;
} }
@ -69,7 +69,7 @@ public class DeployRequest {
private String commandType; private String commandType;
private String name; private String name;
private String fileName; private String fileName;
private Map<String, String> parameters; private Map<String, Integer> parameters;
private Builder() { private Builder() {
} }
@ -99,7 +99,7 @@ public class DeployRequest {
return this; return this;
} }
public Builder parameters(Map<String, String> parameters) { public Builder parameters(Map<String, Integer> parameters) {
this.parameters = parameters; this.parameters = parameters;
return this; return this;
} }