Merge branch 'feature/SCDD-220' into feature/SCDD-222-화면-데이터-api-개발

This commit is contained in:
ihyeon-yong 2023-09-08 15:18:17 +09:00
commit efff31605b
6 changed files with 48 additions and 35 deletions

View File

@ -50,9 +50,9 @@ class DefaultTubeService implements TubeService {
DeployRequest deployRequest = DeployRequest.builder() DeployRequest deployRequest = DeployRequest.builder()
.assetCode(request.getAssetCode()) .assetCode(request.getAssetCode())
.deviceType("nodeq")
.appName(request.getSlotNumber()) .appName(request.getSlotNumber())
.commandType(CommandType.JSON) .commandType(CommandType.JSON)
.name("") // TODO
.parameters(tubeMap) .parameters(tubeMap)
.build(); .build();
@ -83,9 +83,9 @@ 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)
.deviceType("nodeq")
.appName(slotNumber) .appName(slotNumber)
.commandType(CommandType.JSON) .commandType(CommandType.JSON)
.name("") // TODO
.parameters(tube) .parameters(tube)
.build(); .build();

View File

@ -7,17 +7,16 @@ import java.util.Map;
*/ */
public class DeployRequest { public class DeployRequest {
private String assetCode; private String assetCode;
private String deviceType;
private String appName; private String appName;
private String commandType; private String commandType;
// private String fileName; // TODO: deployer에 추가되면 추가 private String name;
private Map<String, String> parameters; private Map<String, String> parameters;
public DeployRequest(String assetCode, String deviceType, String appName, String commandType, Map<String, String> parameters) { public DeployRequest(String assetCode, String appName, String commandType, String name, Map<String, String> parameters) {
this.assetCode = assetCode; this.assetCode = assetCode;
this.deviceType = deviceType;
this.appName = appName; this.appName = appName;
this.commandType = commandType; this.commandType = commandType;
this.name = name;
this.parameters = parameters; this.parameters = parameters;
} }
@ -29,9 +28,6 @@ public class DeployRequest {
return assetCode; return assetCode;
} }
public String getDeviceType() {
return deviceType;
}
public String getAppName() { public String getAppName() {
return appName; return appName;
@ -41,6 +37,10 @@ public class DeployRequest {
return commandType; return commandType;
} }
public String getName() {
return name;
}
public Map<String, String> getParameters() { public Map<String, String> getParameters() {
return parameters; return parameters;
} }
@ -49,18 +49,18 @@ public class DeployRequest {
public String toString() { public String toString() {
return "DeployRequest{" + return "DeployRequest{" +
"assetCode='" + assetCode + '\'' + "assetCode='" + assetCode + '\'' +
", deviceType='" + deviceType + '\'' +
", appName='" + appName + '\'' + ", appName='" + appName + '\'' +
", commandType=" + commandType + ", commandType='" + commandType + '\'' +
", name='" + name + '\'' +
", parameters=" + parameters + ", parameters=" + parameters +
'}'; '}';
} }
public static final class Builder { public static final class Builder {
private String assetCode; private String assetCode;
private String deviceType;
private String appName; private String appName;
private String commandType; private String commandType;
private String name;
private Map<String, String> parameters; private Map<String, String> parameters;
private Builder() { private Builder() {
@ -71,11 +71,6 @@ public class DeployRequest {
return this; return this;
} }
public Builder deviceType(String deviceType) {
this.deviceType = deviceType;
return this;
}
public Builder appName(String appName) { public Builder appName(String appName) {
this.appName = appName; this.appName = appName;
return this; return this;
@ -86,13 +81,18 @@ public class DeployRequest {
return this; return this;
} }
public Builder name(String name) {
this.name = name;
return this;
}
public Builder parameters(Map<String, String> parameters) { public Builder parameters(Map<String, String> parameters) {
this.parameters = parameters; this.parameters = parameters;
return this; return this;
} }
public DeployRequest build() { public DeployRequest build() {
return new DeployRequest(assetCode, deviceType, appName, commandType, parameters); return new DeployRequest(assetCode, appName, commandType, name, parameters);
} }
} }
} }

View File

@ -5,29 +5,35 @@ package inc.sdt.controlcentermanagement.domain;
*/ */
public class Tube { public class Tube {
private String code; private String code;
private String offset; private Float voltageOffset;
private Float ampereOffset;
protected Tube() { protected Tube() {
} }
public Tube(String code, String offset) { public Tube(String code, Float voltageOffset, Float ampereOffset) {
this.code = code; this.code = code;
this.offset = offset; this.voltageOffset = voltageOffset;
this.ampereOffset = ampereOffset;
} }
public String getCode() { public String getCode() {
return code; return code;
} }
public String getOffset() { public Float getVoltageOffset() {
return offset; return voltageOffset;
}
public Float getAmpereOffset() {
return ampereOffset;
} }
@Override @Override
public String toString() { public String toString() {
return "Tube{" + return "Tube{" +
"number='" + code + '\'' + "code='" + code + '\'' +
", offset=" + offset + ", voltageOffset=" + voltageOffset +
", ampereOffset=" + ampereOffset +
'}'; '}';
} }
} }

View File

@ -40,7 +40,7 @@ public class SlotNoSQLRepository implements SlotRepositoryDelegate {
.chamberNumber(slotDocument.getChamberNumber()) .chamberNumber(slotDocument.getChamberNumber())
.tube(slotDocument.getTube() .tube(slotDocument.getTube()
.stream() .stream()
.map(tubeDocument -> new Tube(tubeDocument.getCode(), tubeDocument.getOffset())) .map(tubeDocument -> new Tube(tubeDocument.getCode(), tubeDocument.getVoltageOffset(), tubeDocument.getAmpereOffset()))
.toList()) .toList())
.build(); .build();
} }

View File

@ -5,26 +5,33 @@ package inc.sdt.controlcentermanagement.infrastructure.nosql;
*/ */
public class TubeDocument { public class TubeDocument {
private String code; private String code;
private String offset; private Float voltageOffset;
private Float ampereOffset;
public TubeDocument(String code, String offset) { public TubeDocument(String code, Float voltageOffset, Float ampereOffset) {
this.code = code; this.code = code;
this.offset = offset; this.voltageOffset = voltageOffset;
this.ampereOffset = ampereOffset;
} }
public String getCode() { public String getCode() {
return code; return code;
} }
public String getOffset() { public Float getVoltageOffset() {
return offset; return voltageOffset;
}
public Float getAmpereOffset() {
return ampereOffset;
} }
@Override @Override
public String toString() { public String toString() {
return "TubeDocument{" + return "TubeDocument{" +
"id='" + code + '\'' + "code='" + code + '\'' +
", offset=" + offset + ", voltageOffset=" + voltageOffset +
", ampereOffset=" + ampereOffset +
'}'; '}';
} }
} }

View File

@ -29,7 +29,7 @@ class SlotNoSQLRepositoryTest {
private Slot to(SlotDocument slotDocument) { private Slot to(SlotDocument slotDocument) {
List<Tube> tube = slotDocument.getTube().stream() List<Tube> tube = slotDocument.getTube().stream()
.map(tubeDocument -> new Tube(tubeDocument.getCode(), tubeDocument.getOffset())).toList(); .map(tubeDocument -> new Tube(tubeDocument.getCode(), tubeDocument.getVoltageOffset(), tubeDocument.getAmpereOffset())).toList();
return Slot.builder() return Slot.builder()
.id(slotDocument.getId()) .id(slotDocument.getId())
.slotNumber(slotDocument.getSlotNumber()) .slotNumber(slotDocument.getSlotNumber())