Add ETC command points
This commit is contained in:
parent
65c40fab6f
commit
412ede0301
|
@ -7,6 +7,7 @@ import com.isu.gaswellwatch.modbus.CommandService;
|
|||
import com.isu.gaswellwatch.vo.command.CollectCommand;
|
||||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -25,13 +26,13 @@ public class CommandController {
|
|||
|
||||
@PostMapping(value = "/control")
|
||||
@OperationLog(description = "下发控制指令", type = LogType.ADD)
|
||||
public Response<String> control(@RequestBody Command command) {
|
||||
public Response<String> control(@RequestBody @Validated Command command) {
|
||||
return this.commandService.control(command);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/collect")
|
||||
@OperationLog(description = "下发采集指令", type = LogType.ADD)
|
||||
public Response<String> collect(@RequestBody CollectCommand command) {
|
||||
public Response<String> collect(@RequestBody @Validated CollectCommand command) {
|
||||
return this.commandService.collect(command);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.stream.Collectors;
|
|||
public class Redis2DBPersistenceService {
|
||||
|
||||
public static final String DEFAULT_DATA_TABLE = "t_device_data_";
|
||||
private static final String DEVICE_INFO_SQL = "SELECT d.*, dp.code as modbus_device_product_code from device d "
|
||||
public static final String DEVICE_INFO_SQL = "SELECT d.*, dp.code as modbus_device_product_code from device d "
|
||||
+ "join dictionary dp on dp.id = d.product where d.id = ";
|
||||
private static final String EXISTS_TABLE_SQL = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA"
|
||||
+ " IN ('gaswellwatch', 'gas_well_watch') AND TABLE_NAME='$TableName$'";
|
||||
|
|
|
@ -1,20 +1,29 @@
|
|||
package com.isu.gaswellwatch.modbus.impl;
|
||||
|
||||
import com.isu.gaswellwatch.dao.DeviceDao;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
||||
import com.isu.gaswellwatch.entity.Response;
|
||||
import com.isu.gaswellwatch.modbus.CommandService;
|
||||
import com.isu.gaswellwatch.modbus.data.PersistenceHandler;
|
||||
import com.isu.gaswellwatch.modbus.data.Redis2DBPersistenceService;
|
||||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.data.redis.core.HashOperations;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.http.RequestEntity;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
@ -26,7 +35,9 @@ import java.util.Objects;
|
|||
@RequiredArgsConstructor
|
||||
public class CommandServiceImpl implements CommandService {
|
||||
|
||||
private final DeviceDao deviceDao;
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
@Resource(name = "stringRedisTemplate")
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
private final RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
@Override
|
||||
|
@ -46,16 +57,38 @@ public class CommandServiceImpl implements CommandService {
|
|||
if (ObjectUtils.isEmpty(modbusCommands)) {
|
||||
return Response.failed("Modbus command is empty");
|
||||
}
|
||||
this.deviceDao.getDeviceById(command.getDeviceId());
|
||||
HashOperations<String, String, String> operations = this.redisTemplate.opsForHash();
|
||||
Map<String, String> deviceInfoMap = operations.entries(
|
||||
PersistenceHandler.DEVICE_INFO_CACHE + command.getDeviceId());
|
||||
if (ObjectUtils.isEmpty(deviceInfoMap)) {
|
||||
Map<String, Object> deviceInfo = this.jdbcTemplate.queryForMap(
|
||||
Redis2DBPersistenceService.DEVICE_INFO_SQL + command.getDeviceId());
|
||||
if (ObjectUtils.isNotEmpty(deviceInfo)) {
|
||||
deviceInfoMap = new HashMap<>(deviceInfo.size());
|
||||
for (Map.Entry<String, Object> entry : deviceInfo.entrySet()) {
|
||||
deviceInfoMap.put(entry.getKey(),
|
||||
Objects.isNull(entry.getValue()) ? null : String.valueOf(entry.getValue()));
|
||||
}
|
||||
operations.putAll(PersistenceHandler.DEVICE_INFO_CACHE + command.getDeviceId(), deviceInfoMap);
|
||||
}
|
||||
}
|
||||
|
||||
modbusCommands.forEach(item -> {
|
||||
// .key(StringUtils.joinWith("/", identifier,
|
||||
// MapUtil.getStr(item, "deviceId"),
|
||||
// MapUtil.getStr(item, "commandId"),
|
||||
// timestamp))
|
||||
item.setKey("");
|
||||
item.setIdentifier("");
|
||||
});
|
||||
String identifier;
|
||||
long timestamp = System.currentTimeMillis();
|
||||
for (ModbusCommandDto item : modbusCommands) {
|
||||
if (StringUtils.isBlank(item.getCommand())) {
|
||||
return Response.failed("Modbus command is empty");
|
||||
}
|
||||
if (item.getLength() < 10) {
|
||||
return Response.failed("Modbus command return message length failed");
|
||||
}
|
||||
identifier = MapUtil.getStr(deviceInfoMap, "gateway_sn");
|
||||
item.setKey(StringUtils.joinWith("/", identifier,
|
||||
MapUtil.getStr(deviceInfoMap, "deviceId"),
|
||||
MapUtil.getStr(deviceInfoMap, "commandId"),
|
||||
timestamp));
|
||||
item.setIdentifier(identifier);
|
||||
}
|
||||
RequestEntity<Collection<ModbusCommandDto>> request = RequestEntity
|
||||
.post("http://localhost:9999/modbus-tcp/" + type)
|
||||
.body(modbusCommands);
|
||||
|
|
|
@ -3,9 +3,9 @@ package com.isu.gaswellwatch.vo.command;
|
|||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
||||
import com.isu.gaswellwatch.vo.command.knpcv1.TurnOff;
|
||||
import com.isu.gaswellwatch.vo.command.knpcv1.TurnOn;
|
||||
import com.isu.gaswellwatch.vo.command.knpcv1.mode.*;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -25,14 +25,18 @@ import java.util.Objects;
|
|||
*/
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "code")
|
||||
@JsonSubTypes(value = {
|
||||
@JsonSubTypes.Type(value = TurnOn.class, name = Command.KNPCV1_TURN_ON_THE_WELL),
|
||||
@JsonSubTypes.Type(value = TurnOff.class, name = Command.KNPCV1_TURN_OFF_THE_WELL),
|
||||
@JsonSubTypes.Type(value = TimerMode.class, name = Command.KNPCV1_RUN_TIMER),
|
||||
@JsonSubTypes.Type(value = TimingMode.class, name = Command.KNPCV1_RUN_TIMING),
|
||||
@JsonSubTypes.Type(value = ManualMode.class, name = Command.KNPCV1_RUN_MANUAL),
|
||||
@JsonSubTypes.Type(value = PlungerMode.class, name = Command.KNPCV1_RUN_PLUNGER),
|
||||
@JsonSubTypes.Type(value = PressureMode.class, name = Command.KNPCV1_RUN_PRESSURE),
|
||||
@JsonSubTypes.Type(value = TimePressureMode.class, name = Command.KNPCV1_RUN_TIME_PRESSURE),
|
||||
@JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.etc.TurnOn.class, name = Command.ETC_TURN_ON_THE_WELL),
|
||||
@JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.etc.TurnOff.class, name = Command.ETC_TURN_OFF_THE_WELL),
|
||||
@JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.scss.TurnOn.class, name = Command.SCSS_TURN_ON_THE_WELL),
|
||||
@JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.scss.TurnOff.class, name = Command.SCSS_TURN_OFF_THE_WELL),
|
||||
@JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.knpcv1.TurnOn.class, name = Command.KNPCV1_TURN_ON_THE_WELL),
|
||||
@JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.knpcv1.TurnOff.class, name = Command.KNPCV1_TURN_OFF_THE_WELL),
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
|
@ -57,8 +61,26 @@ public abstract class Command implements Serializable {
|
|||
public static final String KNPCV1_RUN_TIME_PRESSURE = "KNPCV1.RUN.TIME_PRESSURE";
|
||||
/* 点表类型:KNPCV1 end */
|
||||
|
||||
/* 点表类型:SCSS start */
|
||||
/* 开关井 */
|
||||
public static final String SCSS_TURN_ON_THE_WELL = "SCSS.TURN_ON_THE_WELL";
|
||||
public static final String SCSS_TURN_OFF_THE_WELL = "SCSS.TURN_OFF_THE_WELL";
|
||||
/* 运行模式*/
|
||||
|
||||
/* 点表类型:SCSS end */
|
||||
|
||||
/* 点表类型:ETC start */
|
||||
/* 开关井 */
|
||||
public static final String ETC_TURN_ON_THE_WELL = "ETC.TURN_ON_THE_WELL";
|
||||
public static final String ETC_TURN_OFF_THE_WELL = "ETC.TURN_OFF_THE_WELL";
|
||||
/* 运行模式*/
|
||||
|
||||
/* 点表类型:ETC end */
|
||||
|
||||
@NotBlank(message = "指令编码不能为空")
|
||||
private String code;
|
||||
|
||||
@NotNull(message = "下发设备标识不能为空")
|
||||
private Long deviceId;
|
||||
|
||||
public Collection<ModbusCommandDto> buildModbusCommand() {
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package com.isu.gaswellwatch.vo.command.etc;
|
||||
|
||||
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
||||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
import com.isu.gaswellwatch.vo.command.Timing;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:shilong.wang@alpha-ess.com">王仕龙</a>
|
||||
* 2024/11/27 22:56
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@SuperBuilder
|
||||
public class PlungerTimer extends Command implements Timing {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 888739283997908251L;
|
||||
|
||||
/**
|
||||
* 柱塞上升时间。[0-999]:[0-59]:[0-59]
|
||||
*/
|
||||
@NotBlank(message = "柱塞上升时间不能为空")
|
||||
private String plungerRiseTime;
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
return super.validate() && StringUtils.isNotBlank(this.plungerRiseTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ModbusCommandDto> builderModbusCommand() {
|
||||
StringBuilder command = new StringBuilder(60);
|
||||
// 0003*2->hex
|
||||
// 地址码 功能码 起始地址 连续长度 连续字长
|
||||
// 01 10 006A 0003 06
|
||||
command.append("0110006A000306").append(this.toHexString(this.plungerRiseTime));
|
||||
return List.of(ModbusCommandDto.builder().command(command.toString()).length(16).build());
|
||||
}
|
||||
|
||||
public void setPlungerRiseTime(String plungerRiseTime) {
|
||||
this.plungerRiseTime = this.timingValidate(plungerRiseTime, "plungerRiseTime");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.isu.gaswellwatch.vo.command.etc;
|
||||
|
||||
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
||||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
import com.isu.gaswellwatch.vo.command.Timing;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:shilong.wang@alpha-ess.com">王仕龙</a>
|
||||
* 2024/11/27 23:04
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@SuperBuilder
|
||||
public class SensorDelay extends Command implements Timing {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -126267138442242492L;
|
||||
/**
|
||||
* 到达传感器延时时间。[0-999]:[0-59]:[0-59]
|
||||
*/
|
||||
@NotBlank(message = "到达传感器延时时间不能为空")
|
||||
private String arrivalSensorDelayTime;
|
||||
/**
|
||||
* 关井时间。[0-999]:[0-59]:[0-59]
|
||||
*/
|
||||
@NotBlank(message = "关井时间不能为空")
|
||||
private String wellShutInTime;
|
||||
/**
|
||||
* 续流时间。[0-999]:[0-59]:[0-59]
|
||||
*/
|
||||
@NotBlank(message = "续流时间不能为空")
|
||||
private String afterFlowTime;
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
return super.validate()
|
||||
&& StringUtils.isNotBlank(this.afterFlowTime)
|
||||
&& StringUtils.isNotBlank(this.wellShutInTime)
|
||||
&& StringUtils.isNotBlank(this.arrivalSensorDelayTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ModbusCommandDto> builderModbusCommand() {
|
||||
StringBuilder command = new StringBuilder(60);
|
||||
// 0009*2->hex
|
||||
// 地址码 功能码 起始地址 连续长度 连续字长
|
||||
// 01 10 008B 0009 12
|
||||
command.append("0110008B000912")
|
||||
.append(this.toHexString(this.arrivalSensorDelayTime))
|
||||
.append(this.toHexString(this.wellShutInTime))
|
||||
.append(this.toHexString(this.afterFlowTime));
|
||||
return List.of(ModbusCommandDto.builder().command(command.toString()).length(16).build());
|
||||
}
|
||||
|
||||
public void setAfterFlowTime(String afterFlowTime) {
|
||||
this.afterFlowTime = this.timingValidate(afterFlowTime, "afterFlowTime");
|
||||
}
|
||||
|
||||
public void setWellShutInTime(String wellShutInTime) {
|
||||
this.wellShutInTime = this.timingValidate(wellShutInTime, "wellShutInTime");
|
||||
}
|
||||
|
||||
public void setArrivalSensorDelayTime(String arrivalSensorDelayTime) {
|
||||
this.arrivalSensorDelayTime = this.timingValidate(arrivalSensorDelayTime, "arrivalSensorDelayTime");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.isu.gaswellwatch.vo.command.etc;
|
||||
|
||||
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
||||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:scwsl@foxmail.com">王仕龙</a>
|
||||
* 2024/11/27 22:44
|
||||
*/
|
||||
public class TurnOff extends Command {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 5520601184417717931L;
|
||||
|
||||
public TurnOff() {
|
||||
this.setCode("ETC.TURN_OFF_THE_WELL");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ModbusCommandDto> builderModbusCommand() {
|
||||
return List.of(ModbusCommandDto.builder().command("01050001FF00").length(16).build());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.isu.gaswellwatch.vo.command.etc;
|
||||
|
||||
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
||||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:scwsl@foxmail.com">王仕龙</a>
|
||||
* 2024/11/27 22:48
|
||||
*/
|
||||
public class TurnOn extends Command {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 7288866205502636187L;
|
||||
|
||||
public TurnOn() {
|
||||
this.setCode("ETC.TURN_ON_THE_WELL");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ModbusCommandDto> builderModbusCommand() {
|
||||
return List.of(ModbusCommandDto.builder().command("01050001FF00").length(16).build());
|
||||
}
|
||||
|
||||
}
|
|
@ -4,6 +4,7 @@ import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
|||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
import com.isu.gaswellwatch.vo.command.Timing;
|
||||
import com.isu.gaswellwatch.vo.command.knpcv1.ChangeRunMode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -37,10 +38,12 @@ public class PlungerMode extends ChangeRunMode implements Timing {
|
|||
/**
|
||||
* 柱塞模式续流时长。[0-999]:[0-59]:[0-59]
|
||||
*/
|
||||
@NotBlank(message = "续流时长不能为空")
|
||||
private String plugSustainTime;
|
||||
/**
|
||||
* 柱塞模式关井时长。[0-999]:[0-59]:[0-59]
|
||||
*/
|
||||
@NotBlank(message = "关井时长不能为空")
|
||||
private String plugCloseTime;
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
|||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
import com.isu.gaswellwatch.vo.command.Timing;
|
||||
import com.isu.gaswellwatch.vo.command.knpcv1.ChangeRunMode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -62,21 +63,25 @@ public class PressureMode extends ChangeRunMode implements Timing {
|
|||
* 最大开井时长
|
||||
*/
|
||||
@Builder.Default
|
||||
@NotBlank(message = "最大开井时长不能为空")
|
||||
private String maxOpenWell = "00:00:00";
|
||||
/**
|
||||
* 最小开井时长
|
||||
*/
|
||||
@Builder.Default
|
||||
@NotBlank(message = "最小开井时长不能为空")
|
||||
private String minOpenWell = "00:00:00";
|
||||
/**
|
||||
* 最大关井时长
|
||||
*/
|
||||
@Builder.Default
|
||||
@NotBlank(message = "最大关井时长不能为空")
|
||||
private String maxCloseWell = "00:00:00";
|
||||
/**
|
||||
* 最小关井时长
|
||||
*/
|
||||
@Builder.Default
|
||||
@NotBlank(message = "最小关井时长不能为空")
|
||||
private String minCloseWell = "00:00:00";
|
||||
/**
|
||||
* 开井压力保护使能
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
|||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
import com.isu.gaswellwatch.vo.command.Timing;
|
||||
import com.isu.gaswellwatch.vo.command.knpcv1.ChangeRunMode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -51,6 +52,7 @@ public class TimePressureMode extends ChangeRunMode implements Timing {
|
|||
* 时压模式开井时长
|
||||
*/
|
||||
@Builder.Default
|
||||
@NotBlank(message = "开井时长不能为空")
|
||||
private String tpOpenTiming = "00:00:00";
|
||||
/**
|
||||
* 时压模式关井源
|
||||
|
@ -73,6 +75,7 @@ public class TimePressureMode extends ChangeRunMode implements Timing {
|
|||
* 时压模式关井时长
|
||||
*/
|
||||
@Builder.Default
|
||||
@NotBlank(message = "关井时长不能为空")
|
||||
private String tpCloseTiming = "00:00:00";
|
||||
/**
|
||||
* 时压模式压力稳定时长:秒,[0-120]
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
|||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
import com.isu.gaswellwatch.vo.command.Timing;
|
||||
import com.isu.gaswellwatch.vo.command.knpcv1.ChangeRunMode;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -52,24 +53,26 @@ public class TimerMode extends ChangeRunMode implements Timing {
|
|||
* 定时器1开井时间
|
||||
*/
|
||||
@Builder.Default
|
||||
@NotNull(message = "定时器1开井时间不能为空")
|
||||
private LocalTime timer1Open = LocalTime.MIN;
|
||||
/**
|
||||
* 定时器1关井时间
|
||||
*/
|
||||
@Builder.Default
|
||||
@NotNull(message = "定时器1关井时间不能为空")
|
||||
private LocalTime timer1Close = LocalTime.MIN;
|
||||
|
||||
/**
|
||||
* 定时器2开井时间
|
||||
*/
|
||||
@Builder.Default
|
||||
@NotNull(message = "定时器2开井时间不能为空")
|
||||
private LocalTime timer2Open = LocalTime.MIN;
|
||||
/**
|
||||
* 定时器2关井时间
|
||||
*/
|
||||
@Builder.Default
|
||||
@NotNull(message = "定时器2关井时间不能为空")
|
||||
private LocalTime timer2Close = LocalTime.MIN;
|
||||
|
||||
/**
|
||||
* 定时器3开井时间
|
||||
*/
|
||||
|
@ -80,7 +83,6 @@ public class TimerMode extends ChangeRunMode implements Timing {
|
|||
*/
|
||||
@Builder.Default
|
||||
private LocalTime timer3Close = LocalTime.MIN;
|
||||
|
||||
/**
|
||||
* 定时器4开井时间
|
||||
*/
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
|||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
import com.isu.gaswellwatch.vo.command.Timing;
|
||||
import com.isu.gaswellwatch.vo.command.knpcv1.ChangeRunMode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -30,16 +31,19 @@ public class TimingMode extends ChangeRunMode implements Timing {
|
|||
* 计时器开井时长。[0-999]:[0-59]:[0-59]
|
||||
*/
|
||||
@Builder.Default
|
||||
@NotBlank(message = "开井时长不能为空")
|
||||
private String timingOpen = "00:00:00";
|
||||
/**
|
||||
* 计时器关井时长。[0-999]:[0-59]:[0-59]
|
||||
*/
|
||||
@Builder.Default
|
||||
@NotBlank(message = "关井时长不能为空")
|
||||
private String timingClose = "00:00:00";
|
||||
/**
|
||||
* 计时器延时时长。[0-999]:[0-59]:[0-59]
|
||||
*/
|
||||
@Builder.Default
|
||||
@NotBlank(message = "延时时长不能为空")
|
||||
private String timingCelay = "00:00:00";
|
||||
|
||||
public TimingMode() {
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.isu.gaswellwatch.vo.command.scss;
|
||||
|
||||
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
||||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:scwsl@foxmail.com">王仕龙</a>
|
||||
* 2024/11/27 22:40
|
||||
*/
|
||||
public class TurnOff extends Command {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 5520601184417717931L;
|
||||
|
||||
public TurnOff() {
|
||||
this.setCode("SCSS.TURN_OFF_THE_WELL");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ModbusCommandDto> builderModbusCommand() {
|
||||
return List.of(ModbusCommandDto.builder().command("010500010000").length(16).build());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.isu.gaswellwatch.vo.command.scss;
|
||||
|
||||
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
||||
import com.isu.gaswellwatch.vo.command.Command;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:scwsl@foxmail.com">王仕龙</a>
|
||||
* 2024/11/27 22:57
|
||||
*/
|
||||
public class TurnOn extends Command {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 7288866205502636187L;
|
||||
|
||||
public TurnOn() {
|
||||
this.setCode("SCSS.TURN_ON_THE_WELL");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ModbusCommandDto> builderModbusCommand() {
|
||||
return List.of(ModbusCommandDto.builder().command("01050001FF00").length(16).build());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue