diff --git a/src/main/java/com/isu/gaswellwatch/modbus/data/decode/impl/SecondLocalTimeDecodeHandler.java b/src/main/java/com/isu/gaswellwatch/modbus/data/decode/impl/SecondLocalTimeDecodeHandler.java
new file mode 100644
index 0000000..49c3e16
--- /dev/null
+++ b/src/main/java/com/isu/gaswellwatch/modbus/data/decode/impl/SecondLocalTimeDecodeHandler.java
@@ -0,0 +1,42 @@
+package com.isu.gaswellwatch.modbus.data.decode.impl;
+
+import com.isu.gaswellwatch.modbus.data.ModbusMessage;
+import com.isu.gaswellwatch.modbus.data.decode.DecodeHandler;
+import org.apache.commons.lang3.math.NumberUtils;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 本地时间类型解析器
+ *
+ * @author 王仕龙
+ * 2024/12/09 14:40
+ */
+@Component(SecondLocalTimeDecodeHandler.NAME + DecodeHandler.DECODE_NAME)
+public class SecondLocalTimeDecodeHandler implements DecodeHandler {
+ public static final String NAME = "secondLocalTime";
+
+ @Override
+ public String decode(Map commandPointMap, String value) {
+ if (NumberUtils.isCreatable(value)) {
+ long totalSeconds = NumberUtils.createLong(value);
+ long hours = TimeUnit.SECONDS.toHours(totalSeconds);
+
+ long remainingSeconds = totalSeconds - TimeUnit.HOURS.toSeconds(hours);
+ long minutes = TimeUnit.SECONDS.toMinutes(remainingSeconds);
+
+ remainingSeconds = remainingSeconds - TimeUnit.MINUTES.toSeconds(minutes);
+
+ return String.format("%02d:%02d:%02d", hours, minutes, remainingSeconds);
+ }
+ return value;
+ }
+
+ @Override
+ public void decode(Map commandPointMap, ModbusMessage.MessagePoint point) {
+ point.setValue(this.decode(commandPointMap, point.getValue()));
+ }
+
+}
diff --git a/src/main/java/com/isu/gaswellwatch/modbus/data/impl/AbstractPersistenceHandler.java b/src/main/java/com/isu/gaswellwatch/modbus/data/impl/AbstractPersistenceHandler.java
index ae4faad..83d64db 100644
--- a/src/main/java/com/isu/gaswellwatch/modbus/data/impl/AbstractPersistenceHandler.java
+++ b/src/main/java/com/isu/gaswellwatch/modbus/data/impl/AbstractPersistenceHandler.java
@@ -40,12 +40,22 @@ public abstract class AbstractPersistenceHandler implements PersistenceHandler {
}
protected Map getLastRow(String tableName) {
- return this.jdbcTemplate.queryForList("SELECT * FROM " + tableName + " ORDER BY ID DESC LIMIT 1")
+ Map columnMappingMap = this.getColumnMappingMap();
+ StringBuilder sqlBuilder = new StringBuilder(500);
+ sqlBuilder.append("SELECT id, device_id AS deviceId, created_time AS createdTime, " +
+ "collection_time AS collectionTime, receive_time AS receiveTime");
+ columnMappingMap.forEach((column, field) -> sqlBuilder.append(", ").append(column).append(" AS ").append(field));
+ sqlBuilder.append(" FROM ");
+ sqlBuilder.append(tableName);
+ sqlBuilder.append(" ORDER BY ID DESC LIMIT 1");
+ return this.jdbcTemplate.queryForList(sqlBuilder.toString())
.stream()
.findFirst()
.orElse(null);
}
+ protected abstract Map getColumnMappingMap();
+
protected void setValue(PreparedStatement ps, Map row, int index, String key, int sqlType) throws SQLException {
String value = MapUtil.getStr(row, key);
if (Objects.isNull(value)) {
diff --git a/src/main/java/com/isu/gaswellwatch/modbus/data/impl/EtcPersistenceHandler.java b/src/main/java/com/isu/gaswellwatch/modbus/data/impl/EtcPersistenceHandler.java
index c3df4d1..58e93e9 100644
--- a/src/main/java/com/isu/gaswellwatch/modbus/data/impl/EtcPersistenceHandler.java
+++ b/src/main/java/com/isu/gaswellwatch/modbus/data/impl/EtcPersistenceHandler.java
@@ -18,6 +18,18 @@ import java.util.Objects;
@Component(PersistenceHandler.ETC_MODBUS_TYPE)
public class EtcPersistenceHandler extends AbstractPersistenceHandler {
+ private static final Map ETC_COLUMN_MAPPING_MAP = Map.of(
+ "solenoid_valve_status", "solenoidValveStatus",
+ "controller_current_status", "controllerCurrentStatus",
+ "current_status_remaining_time", "currentStatusRemainingTime",
+ "current_status_start_time", "currentStatusStartTime",
+ "cas_pressure", "casPressure",
+ "oil_pressure", "oilPressure",
+ "plunger_rise_time", "plungerRiseTime",
+ "arrival_sensor_delay_time", "arrivalSensorDelayTime",
+ "well_shut_in_time", "wellShutInTime",
+ "after_flow_time", "afterFlowTime");
+
@Override
public void createTable(String tableName, Long deviceId) {
this.createTable("sql/CREATE_ETC.sql", tableName, deviceId);
@@ -56,4 +68,10 @@ public class EtcPersistenceHandler extends AbstractPersistenceHandler {
}
return Map.of("new", newRow, "old", oldRow);
}
+
+ @Override
+ protected Map getColumnMappingMap() {
+ return ETC_COLUMN_MAPPING_MAP;
+ }
+
}
diff --git a/src/main/java/com/isu/gaswellwatch/modbus/data/impl/Knpcv1PersistenceHandler.java b/src/main/java/com/isu/gaswellwatch/modbus/data/impl/Knpcv1PersistenceHandler.java
index a3b251d..7b6664c 100644
--- a/src/main/java/com/isu/gaswellwatch/modbus/data/impl/Knpcv1PersistenceHandler.java
+++ b/src/main/java/com/isu/gaswellwatch/modbus/data/impl/Knpcv1PersistenceHandler.java
@@ -8,6 +8,7 @@ import org.springframework.stereotype.Component;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;
+import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@@ -18,6 +19,58 @@ import java.util.Objects;
@Component(PersistenceHandler.KNPCV1_MODBUS_TYPE)
public class Knpcv1PersistenceHandler extends AbstractPersistenceHandler {
+ private static final Map KNPC_V1_COLUMN_MAPPING_MAP = new HashMap<>();
+
+ static {
+ KNPC_V1_COLUMN_MAPPING_MAP.put("well_status", "wellStatus");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("plug_status", "plugStatus");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("status_start_time", "statusOpenTime");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("status_end_time", "statusCloseTime");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("oil_pressure", "oilPressure");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("cas_pressure", "casPressure");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("pre_pressure", "prePressure");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("pipe_pressure", "pipePressure");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("liquid_level", "liquidLevel");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("temperature", "temperature");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("humidity", "humidity");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("op_mode", "opmode");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("timer_able1", "timer1");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("timer_able2", "timer2");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("timer_open1", "timer1Open");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("timer_close1", "timer1Close");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("timer_open2", "timer2Open");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("timer_close2", "timer2Close");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("timing_open", "timingOpen");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("timing_close", "timingClose");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("timing_delay", "timingCelay");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("presource", "presource");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("pressure_open", "pressureOpen");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("pressure_close", "pressureClose");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("trigger_type", "triggerType");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("stability_time", "stabilityTime");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("max_open_well", "maxOpenWell");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("max_close_well", "maxCloseWell");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("min_open_well", "minOpenWell");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("min_close_well", "minCloseWell");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("prespro_tect", "presproTect");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("prespro_source", "presproSource");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("open_well_limit_max", "openWellLimitMax");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("open_well_limit_min", "openWellLimitMin");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("plug_init_status", "plugInitStatus");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("plug_sustain_time", "plugSustainTime");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("plug_close_time", "plugCloseTime");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("tp_init_status", "tpInitStatus");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("tp_open_source", "tpOpenSource");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("tp_open_trigger", "tpOpenTrigger");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("tp_open_pressure", "tpOpenPressure");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("tp_open_time", "tpOpenTime");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("tp_close_source", "tpCloseSource");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("tp_close_trigger", "tpCloseTrigger");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("tp_close_pressure", "tpClosePressure");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("tp_close_time", "tpCloseTime");
+ KNPC_V1_COLUMN_MAPPING_MAP.put("tp_stability_time", "tpStabilityTime");
+ }
+
@Override
public void createTable(String tableName, Long deviceId) {
this.createTable("sql/CREATE_KNPCV1.sql", tableName, deviceId);
@@ -95,4 +148,10 @@ public class Knpcv1PersistenceHandler extends AbstractPersistenceHandler {
}
return Map.of("new", newRow, "old", oldRow);
}
+
+ @Override
+ protected Map getColumnMappingMap() {
+ return KNPC_V1_COLUMN_MAPPING_MAP;
+ }
+
}
diff --git a/src/main/java/com/isu/gaswellwatch/modbus/data/impl/ScssPersistenceHandler.java b/src/main/java/com/isu/gaswellwatch/modbus/data/impl/ScssPersistenceHandler.java
index 77ddc01..afa07b3 100644
--- a/src/main/java/com/isu/gaswellwatch/modbus/data/impl/ScssPersistenceHandler.java
+++ b/src/main/java/com/isu/gaswellwatch/modbus/data/impl/ScssPersistenceHandler.java
@@ -8,6 +8,7 @@ import org.springframework.stereotype.Component;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;
+import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@@ -18,6 +19,92 @@ import java.util.Objects;
@Component(PersistenceHandler.SCSS_MODBUS_TYPE)
public class ScssPersistenceHandler extends AbstractPersistenceHandler {
+ private static final Map SCSS_COLUMN_MAPPING_MAP = new HashMap<>();
+
+ static {
+ SCSS_COLUMN_MAPPING_MAP.put("cas_pressure", "casPressure");
+ SCSS_COLUMN_MAPPING_MAP.put("oil_pressure", "oilPressure");
+ SCSS_COLUMN_MAPPING_MAP.put("first_solenoid_status", "firstSolenoidStatus");
+ SCSS_COLUMN_MAPPING_MAP.put("battery_voltage", "batteryVoltage");
+ SCSS_COLUMN_MAPPING_MAP.put("solar_voltage", "solarVoltage");
+ SCSS_COLUMN_MAPPING_MAP.put("remaining_time_action", "remainingTimeAction");
+ SCSS_COLUMN_MAPPING_MAP.put("second_solenoid_status", "secondSolenoidStatus");
+ SCSS_COLUMN_MAPPING_MAP.put("pre_pressure", "prePressure");
+ SCSS_COLUMN_MAPPING_MAP.put("internet_traffic", "internetTraffic");
+ SCSS_COLUMN_MAPPING_MAP.put("load_factor", "loadFactor");
+ SCSS_COLUMN_MAPPING_MAP.put("data_time", "dataTime");
+ SCSS_COLUMN_MAPPING_MAP.put("show_delay", "showDelay");
+ SCSS_COLUMN_MAPPING_MAP.put("open_well_sampling_interval", "openWellSamplingInterval");
+ SCSS_COLUMN_MAPPING_MAP.put("close_well_sampling_interval", "closeWellSamplingInterval");
+ SCSS_COLUMN_MAPPING_MAP.put("ctl_model", "ctlModel");
+ SCSS_COLUMN_MAPPING_MAP.put("min_pressure", "minPressure");
+ SCSS_COLUMN_MAPPING_MAP.put("max_pressure", "maxPressure");
+ SCSS_COLUMN_MAPPING_MAP.put("pressure_min_voltage", "pressureMinVoltage");
+ SCSS_COLUMN_MAPPING_MAP.put("pressure_max_voltage", "pressureMaxVoltage");
+ SCSS_COLUMN_MAPPING_MAP.put("oil_min", "oilMin");
+ SCSS_COLUMN_MAPPING_MAP.put("oil_max", "oliMax");
+ SCSS_COLUMN_MAPPING_MAP.put("oil_min_voltage", "oilMinVoltage");
+ SCSS_COLUMN_MAPPING_MAP.put("oil_max_voltage", "oilMaxVoltage");
+ SCSS_COLUMN_MAPPING_MAP.put("input_pressure_min_value", "inputPressureMinValue");
+ SCSS_COLUMN_MAPPING_MAP.put("input_pressure_max_value", "inputPressureMaxValue");
+ SCSS_COLUMN_MAPPING_MAP.put("input_voltage_min_value", "inputVoltageMinValue");
+ SCSS_COLUMN_MAPPING_MAP.put("input_voltage_max_value", "inputVoltageMaxValue");
+ SCSS_COLUMN_MAPPING_MAP.put("flow_rate_min_value", "flowRateMinValue");
+ SCSS_COLUMN_MAPPING_MAP.put("flow_rate_max_value", "flowRateMaxValue");
+ SCSS_COLUMN_MAPPING_MAP.put("flow_voltage_min_value", "flowVoltageMinValue");
+ SCSS_COLUMN_MAPPING_MAP.put("flow_voltage_max_value", "flowVoltageMaxValue");
+ SCSS_COLUMN_MAPPING_MAP.put("continuous_sampling_interval_duration", "continuousSamplingIntervalDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("sensor_signal_effective_level", "sensorSignalEffectiveLevel");
+ SCSS_COLUMN_MAPPING_MAP.put("pressure_compensation_polarity_flag", "pressureCompensationPolarityFlag");
+ SCSS_COLUMN_MAPPING_MAP.put("pressure_compensation_value_setting", "pressureCompensationValueSetting");
+ SCSS_COLUMN_MAPPING_MAP.put("oil_pressure_compensation_polarity_flag", "oilPressureCompensationPolarityFlag");
+ SCSS_COLUMN_MAPPING_MAP.put("oil_pressure_compensation_value_setting", "oilPressureCompensationValueSetting");
+ SCSS_COLUMN_MAPPING_MAP.put("input_pressure_compensation_polarity_flag", "inputPressureCompensationPolarityFlag");
+ SCSS_COLUMN_MAPPING_MAP.put("input_pressure_compensation_value_setting", "inputPressureCompensationValueSetting");
+ SCSS_COLUMN_MAPPING_MAP.put("flow_compensation_polarity_flag", "flowCompensationPolarityFlag");
+ SCSS_COLUMN_MAPPING_MAP.put("flow_compensation_value_setting", "flowCompensationValueSetting");
+ SCSS_COLUMN_MAPPING_MAP.put("well_open_time_timestamp", "wellOpenTimeTimestamp");
+ SCSS_COLUMN_MAPPING_MAP.put("well_open_pressure_value", "wellOpenPressureValue");
+ SCSS_COLUMN_MAPPING_MAP.put("well_open_oil_pressure_value", "wellOpenOilPressureValue");
+ SCSS_COLUMN_MAPPING_MAP.put("well_open_load_factor_presets", "wellOpenLoadFactorPresets");
+ SCSS_COLUMN_MAPPING_MAP.put("well_close_time_timestamp", "wellCloseTimeTimestamp");
+ SCSS_COLUMN_MAPPING_MAP.put("well_close_pressure_value", "wellClosePressureValue");
+ SCSS_COLUMN_MAPPING_MAP.put("well_close_oil_pressure_value", "wellCloseOilPressureValue");
+ SCSS_COLUMN_MAPPING_MAP.put("well_close_flow_value", "wellCloseFlowValue");
+ SCSS_COLUMN_MAPPING_MAP.put("min_well_open_time_duration", "minWellOpenTimeDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("max_well_open_time_duration", "maxWellOpenTimeDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("min_well_close_time_duration", "minWellCloseTimeDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("max_well_close_time_duration", "maxWellCloseTimeDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("pressure_stabilization_duration", "pressureStabilizationDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("flow_stabilization_duration", "flowStabilizationDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("load_factor_stabilization_duration", "loadFactorStabilizationDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("plunger_delay_duration", "plungerDelayDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("plunger_rise_duration", "plungerRiseDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("continuos_flow_duration", "continuosFlowDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("well_close_time_duration", "wellCloseTimeDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("well_close_time_not_reached_duration", "wellCloseTimeNotReachedDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("well_close_not_reached_count_value", "wellCloseNotReachedCountValue");
+ SCSS_COLUMN_MAPPING_MAP.put("plunger_delay_duration_repeat", "plungerDelayDurationRepeat");
+ SCSS_COLUMN_MAPPING_MAP.put("target_time_timestamp", "targetTimeTimestamp");
+ SCSS_COLUMN_MAPPING_MAP.put("target_time_range_value", "targetTimeRangeValue");
+ SCSS_COLUMN_MAPPING_MAP.put("continuos_flow_increase_duration", "continuosFlowIncreaseDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("continuos_flow_decrease_duration", "continuosFlowDecreaseDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("well_close_increase_duration", "wellCloseIncreaseDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("well_close_decrease_duration", "wellCloseDecreaseDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("min_well_close_time_duration2", "minWellCloseTimeDuration2");
+ SCSS_COLUMN_MAPPING_MAP.put("max_well_close_time_duration2", "maxWellCloseTimeDuration2");
+ SCSS_COLUMN_MAPPING_MAP.put("min_continous_flow_time_duration", "minContinuosFlowTimeDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("max_continous_flow_time_duration", "maxContinuosFlowTimeDuration");
+ SCSS_COLUMN_MAPPING_MAP.put("min_well_open_time_duration2", "minWellOpenTimeDuration2");
+ SCSS_COLUMN_MAPPING_MAP.put("max_well_open_time_duration2", "maxWellOpenTimeDuration2");
+ SCSS_COLUMN_MAPPING_MAP.put("well_open_pressure_value_at_open", "wellOpenPressureValueAtOpen");
+ SCSS_COLUMN_MAPPING_MAP.put("well_open_oil_pressure_value_at_open", "wellOpenOilPressureValueAtOpen");
+ SCSS_COLUMN_MAPPING_MAP.put("well_open_load_factor_presets_at_open", "wellOpenLoadFactorPresetsAtOpen");
+ SCSS_COLUMN_MAPPING_MAP.put("well_close_pressure_value_at_close", "wellClosePressureValueAtClose");
+ SCSS_COLUMN_MAPPING_MAP.put("well_close_oil_ppressure_value_at_close", "wellCloseOilPressureValueAtClose");
+ SCSS_COLUMN_MAPPING_MAP.put("well_close_flow_value_at_close", "wellCloseFlowValueAtClose");
+ }
+
@Override
public void createTable(String tableName, Long deviceId) {
this.createTable("sql/CREATE_SCSS.sql", tableName, deviceId);
@@ -53,22 +140,22 @@ public class ScssPersistenceHandler extends AbstractPersistenceHandler {
ScssPersistenceHandler.this.setValue(ps, newRow, 17, "openWellSamplingInterval", Types.INTEGER);
ScssPersistenceHandler.this.setValue(ps, newRow, 18, "closeWellSamplingInterval", Types.INTEGER);
ScssPersistenceHandler.this.setValue(ps, newRow, 19, "ctlModel", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 20, "minPressure", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 21, "maxPressure", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 22, "pressureMinVoltage", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 23, "pressureMaxVoltage", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 24, "oilMin", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 25, "oliMax", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 26, "oilMinVoltage", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 27, "oilMaxVoltage", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 28, "inputPressureMinValue", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 29, "inputPressureMaxValue", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 30, "inputVoltageMinValue", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 31, "inputVoltageMaxValue", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 32, "flowRateMinValue", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 33, "flowRateMaxValue", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 34, "flowVoltageMinValue", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 35, "flowVoltageMaxValue", Types.INTEGER);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 20, "minPressure", Types.DECIMAL);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 21, "maxPressure", Types.DECIMAL);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 22, "pressureMinVoltage", Types.DECIMAL);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 23, "pressureMaxVoltage", Types.DECIMAL);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 24, "oilMin", Types.DECIMAL);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 25, "oliMax", Types.DECIMAL);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 26, "oilMinVoltage", Types.DECIMAL);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 27, "oilMaxVoltage", Types.DECIMAL);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 28, "inputPressureMinValue", Types.DECIMAL);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 29, "inputPressureMaxValue", Types.DECIMAL);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 30, "inputVoltageMinValue", Types.DECIMAL);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 31, "inputVoltageMaxValue", Types.DECIMAL);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 32, "flowRateMinValue", Types.DECIMAL);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 33, "flowRateMaxValue", Types.DECIMAL);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 34, "flowVoltageMinValue", Types.DECIMAL);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 35, "flowVoltageMaxValue", Types.DECIMAL);
ScssPersistenceHandler.this.setValue(ps, newRow, 36, "continuousSamplingIntervalDuration", Types.INTEGER);
ScssPersistenceHandler.this.setValue(ps, newRow, 37, "sensorSignalEffectiveLevel", Types.INTEGER);
ScssPersistenceHandler.this.setValue(ps, newRow, 38, "pressureCompensationPolarityFlag", Types.INTEGER);
@@ -84,35 +171,35 @@ public class ScssPersistenceHandler extends AbstractPersistenceHandler {
ScssPersistenceHandler.this.setValue(ps, newRow, 48, "wellOpenOilPressureValue", Types.DECIMAL);
ScssPersistenceHandler.this.setValue(ps, newRow, 49, "wellOpenLoadFactorPresets", Types.DECIMAL);
ScssPersistenceHandler.this.setValue(ps, newRow, 50, "wellCloseTimeTimestamp", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 51, "wellClosePressureValue", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 52, "wellCloseOilPressureValue", Types.INTEGER);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 51, "wellClosePressureValue", Types.DECIMAL);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 52, "wellCloseOilPressureValue", Types.DECIMAL);
ScssPersistenceHandler.this.setValue(ps, newRow, 53, "wellCloseFlowValue", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 54, "minWellOpenTimeDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 55, "maxWellOpenTimeDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 56, "minWellCloseTimeDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 57, "maxWellCloseTimeDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 58, "pressureStabilizationDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 59, "flowStabilizationDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 60, "loadFactorStabilizationDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 61, "plungerDelayDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 62, "plungerRiseDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 63, "continuosFlowDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 64, "wellCloseTimeDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 65, "wellCloseTimeNotReachedDuration", Types.INTEGER);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 54, "minWellOpenTimeDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 55, "maxWellOpenTimeDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 56, "minWellCloseTimeDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 57, "maxWellCloseTimeDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 58, "pressureStabilizationDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 59, "flowStabilizationDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 60, "loadFactorStabilizationDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 61, "plungerDelayDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 62, "plungerRiseDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 63, "continuosFlowDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 64, "wellCloseTimeDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 65, "wellCloseTimeNotReachedDuration", Types.VARCHAR);
ScssPersistenceHandler.this.setValue(ps, newRow, 66, "wellCloseNotReachedCountValue", Types.INTEGER);
ScssPersistenceHandler.this.setValue(ps, newRow, 67, "plungerDelayDurationRepeat", Types.INTEGER);
ScssPersistenceHandler.this.setValue(ps, newRow, 68, "targetTimeTimestamp", Types.INTEGER);
ScssPersistenceHandler.this.setValue(ps, newRow, 69, "targetTimeRangeValue", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 70, "continuosFlowIncreaseDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 71, "continuosFlowDecreaseDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 72, "wellCloseIncreaseDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 73, "wellCloseDecreaseDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 74, "minWellCloseTimeDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 75, "maxWellCloseTimeDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 76, "minContinuosFlowTimeDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 77, "maxContinuosFlowTimeDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 78, "minWellOpenTimeDuration", Types.INTEGER);
- ScssPersistenceHandler.this.setValue(ps, newRow, 79, "maxWellOpenTimeDuration", Types.INTEGER);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 70, "continuosFlowIncreaseDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 71, "continuosFlowDecreaseDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 72, "wellCloseIncreaseDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 73, "wellCloseDecreaseDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 74, "minWellCloseTimeDuration2", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 75, "maxWellCloseTimeDuration2", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 76, "minContinuosFlowTimeDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 77, "maxContinuosFlowTimeDuration", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 78, "minWellOpenTimeDuration2", Types.VARCHAR);
+ ScssPersistenceHandler.this.setValue(ps, newRow, 79, "maxWellOpenTimeDuration2", Types.VARCHAR);
ScssPersistenceHandler.this.setValue(ps, newRow, 80, "wellOpenPressureValueAtOpen", Types.INTEGER);
ScssPersistenceHandler.this.setValue(ps, newRow, 81, "wellOpenOilPressureValueAtOpen", Types.INTEGER);
ScssPersistenceHandler.this.setValue(ps, newRow, 82, "wellOpenLoadFactorPresetsAtOpen", Types.INTEGER);
@@ -127,4 +214,10 @@ public class ScssPersistenceHandler extends AbstractPersistenceHandler {
}
return Map.of("new", newRow, "old", oldRow);
}
+
+ @Override
+ protected Map getColumnMappingMap() {
+ return SCSS_COLUMN_MAPPING_MAP;
+ }
+
}
diff --git a/src/main/resources/sql/CREATE_SCSS.sql b/src/main/resources/sql/CREATE_SCSS.sql
index 735451e..16c607d 100644
--- a/src/main/resources/sql/CREATE_SCSS.sql
+++ b/src/main/resources/sql/CREATE_SCSS.sql
@@ -20,22 +20,22 @@ CREATE TABLE `$TableName$`
`open_well_sampling_interval` int NULL DEFAULT NULL COMMENT '开井采样间隔',
`close_well_sampling_interval` int NULL DEFAULT NULL COMMENT '关井采样间隔',
`ctl_model` int NULL DEFAULT NULL COMMENT '控制模式',
- `min_pressure` int NULL DEFAULT NULL COMMENT '套压最小值',
- `max_pressure` int NULL DEFAULT NULL COMMENT '套压最大值',
- `pressure_min_voltage` int NULL DEFAULT NULL COMMENT '套压最小电压',
- `pressure_max_voltage` int NULL DEFAULT NULL COMMENT '套压最大电压',
- `oil_min` int NULL DEFAULT NULL COMMENT '油压最小值',
- `oil_max` int NULL DEFAULT NULL COMMENT '油压最大值',
- `oil_min_voltage` int NULL DEFAULT NULL COMMENT '油压最小电压',
- `oil_max_voltage` int NULL DEFAULT NULL COMMENT '油压最大电压',
- `input_pressure_min_value` int NULL DEFAULT NULL COMMENT '输压最小值',
- `input_pressure_max_value` int NULL DEFAULT NULL COMMENT '输压最大值',
- `input_voltage_min_value` int NULL DEFAULT NULL COMMENT '输压最小电压',
- `input_voltage_max_value` int NULL DEFAULT NULL COMMENT '输压最大电压',
- `flow_rate_min_value` int NULL DEFAULT NULL COMMENT '流量最小值',
- `flow_rate_max_value` int NULL DEFAULT NULL COMMENT '流量最大值',
- `flow_voltage_min_value` int NULL DEFAULT NULL COMMENT '流量最小电压',
- `flow_voltage_max_value` int NULL DEFAULT NULL COMMENT '流量最大电压',
+ `min_pressure` decimal(10, 2) NULL DEFAULT NULL COMMENT '套压最小值',
+ `max_pressure` decimal(10, 2) NULL DEFAULT NULL COMMENT '套压最大值',
+ `pressure_min_voltage` decimal(10, 2) NULL DEFAULT NULL COMMENT '套压最小电压',
+ `pressure_max_voltage` decimal(10, 2) NULL DEFAULT NULL COMMENT '套压最大电压',
+ `oil_min` decimal(10, 2) NULL DEFAULT NULL COMMENT '油压最小值',
+ `oil_max` decimal(10, 2) NULL DEFAULT NULL COMMENT '油压最大值',
+ `oil_min_voltage` decimal(10, 2) NULL DEFAULT NULL COMMENT '油压最小电压',
+ `oil_max_voltage` decimal(10, 2) NULL DEFAULT NULL COMMENT '油压最大电压',
+ `input_pressure_min_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '输压最小值',
+ `input_pressure_max_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '输压最大值',
+ `input_voltage_min_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '输压最小电压',
+ `input_voltage_max_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '输压最大电压',
+ `flow_rate_min_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '流量最小值',
+ `flow_rate_max_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '流量最大值',
+ `flow_voltage_min_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '流量最小电压',
+ `flow_voltage_max_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '流量最大电压',
`continuous_sampling_interval_duration` int NULL DEFAULT NULL COMMENT '连续采样间隔',
`sensor_signal_effective_level` int NULL DEFAULT NULL COMMENT '到达传感器有效电平',
`pressure_compensation_polarity_flag` int NULL DEFAULT NULL COMMENT '套压补偿极性',
@@ -51,35 +51,35 @@ CREATE TABLE `$TableName$`
`well_open_oil_pressure_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '开井油压',
`well_open_load_factor_presets` decimal(10, 2) NULL DEFAULT NULL COMMENT '开井载荷因子预设值',
`well_close_time_timestamp` int NULL DEFAULT NULL COMMENT '关井时间时间戳',
- `well_close_pressure_value` int NULL DEFAULT NULL COMMENT '关井压力值',
- `well_close_oil_pressure_value` int NULL DEFAULT NULL COMMENT '关井油压值',
+ `well_close_pressure_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '关井压力值',
+ `well_close_oil_pressure_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '关井油压值',
`well_close_flow_value` int NULL DEFAULT NULL COMMENT '关井流量值',
- `min_well_open_time_duration` int NULL DEFAULT NULL COMMENT '最小开井时间持续时长',
- `max_well_open_time_duration` int NULL DEFAULT NULL COMMENT '最大开井时间持续时长',
- `min_well_close_time_duration` int NULL DEFAULT NULL COMMENT '最小关井时间持续时长',
- `max_well_close_time_duration` int NULL DEFAULT NULL COMMENT '最大关井时间持续时长',
- `pressure_stabilization_duration` int NULL DEFAULT NULL COMMENT '压力稳定持续时长',
- `flow_stabilization_duration` int NULL DEFAULT NULL COMMENT '流量稳定持续时长',
- `load_factor_stabilization_duration` int NULL DEFAULT NULL COMMENT '载荷因子稳定持续时长',
- `plunger_delay_duration` int NULL DEFAULT NULL COMMENT '柱塞延迟时长',
- `plunger_rise_duration` int NULL DEFAULT NULL COMMENT '柱塞上升时长',
- `continuos_flow_duration` int NULL DEFAULT NULL COMMENT '连续流量持续时长',
- `well_close_time_duration` int NULL DEFAULT NULL COMMENT '关井时间持续时长',
- `well_close_time_not_reached_duration` int NULL DEFAULT NULL COMMENT '关井时间未达到持续时长',
+ `min_well_open_time_duration` varchar(10) NULL DEFAULT NULL COMMENT '最小开井时间持续时长',
+ `max_well_open_time_duration` varchar(10) NULL DEFAULT NULL COMMENT '最大开井时间持续时长',
+ `min_well_close_time_duration` varchar(10) NULL DEFAULT NULL COMMENT '最小关井时间持续时长',
+ `max_well_close_time_duration` varchar(10) NULL DEFAULT NULL COMMENT '最大关井时间持续时长',
+ `pressure_stabilization_duration` varchar(10) NULL DEFAULT NULL COMMENT '压力稳定持续时长',
+ `flow_stabilization_duration` varchar(10) NULL DEFAULT NULL COMMENT '流量稳定持续时长',
+ `load_factor_stabilization_duration` varchar(10) NULL DEFAULT NULL COMMENT '载荷因子稳定持续时长',
+ `plunger_delay_duration` varchar(10) NULL DEFAULT NULL COMMENT '柱塞延迟时长',
+ `plunger_rise_duration` varchar(10) NULL DEFAULT NULL COMMENT '柱塞上升时长',
+ `continuos_flow_duration` varchar(10) NULL DEFAULT NULL COMMENT '连续流量持续时长',
+ `well_close_time_duration` varchar(10) NULL DEFAULT NULL COMMENT '关井时间持续时长',
+ `well_close_time_not_reached_duration` varchar(10) NULL DEFAULT NULL COMMENT '关井时间未达到持续时长',
`well_close_not_reached_count_value` int NULL DEFAULT NULL COMMENT '关井未达到次数值',
`plunger_delay_duration_repeat` int NULL DEFAULT NULL COMMENT '柱塞延迟时长重复次数',
`target_time_timestamp` int NULL DEFAULT NULL COMMENT '目标时间时间戳',
`target_time_range_value` int NULL DEFAULT NULL COMMENT '目标时间范围值',
- `continuos_flow_increase_duration` int NULL DEFAULT NULL COMMENT '连续流量增加持续时长',
- `continuos_flow_decrease_duration` int NULL DEFAULT NULL COMMENT '连续流量减少持续时长',
- `well_close_increase_duration` int NULL DEFAULT NULL COMMENT '关井增加持续时长',
- `well_close_decrease_duration` int NULL DEFAULT NULL COMMENT '关井减少持续时长',
- `min_well_close_time_duration2` int NULL DEFAULT NULL COMMENT '最小关井时间持续时长',
- `max_well_close_time_duration2` int NULL DEFAULT NULL COMMENT '最大关井时间持续时长',
- `min_continous_flow_time_duration` int NULL DEFAULT NULL COMMENT '最小连续流量时间持续时长',
- `max_continous_flow_time_duration` int NULL DEFAULT NULL COMMENT '最大连续流量时间持续时长',
- `min_well_open_time_duration2` int NULL DEFAULT NULL COMMENT '最小开井时间持续时长',
- `max_well_open_time_duration2` int NULL DEFAULT NULL COMMENT '最大开井时间持续时长',
+ `continuos_flow_increase_duration` varchar(10) NULL DEFAULT NULL COMMENT '连续流量增加持续时长',
+ `continuos_flow_decrease_duration` varchar(10) NULL DEFAULT NULL COMMENT '连续流量减少持续时长',
+ `well_close_increase_duration` varchar(10) NULL DEFAULT NULL COMMENT '关井增加持续时长',
+ `well_close_decrease_duration` varchar(10) NULL DEFAULT NULL COMMENT '关井减少持续时长',
+ `min_well_close_time_duration2` varchar(10) NULL DEFAULT NULL COMMENT '最小关井时间持续时长',
+ `max_well_close_time_duration2` varchar(10) NULL DEFAULT NULL COMMENT '最大关井时间持续时长',
+ `min_continous_flow_time_duration` varchar(10) NULL DEFAULT NULL COMMENT '最小连续流量时间持续时长',
+ `max_continous_flow_time_duration` varchar(10) NULL DEFAULT NULL COMMENT '最大连续流量时间持续时长',
+ `min_well_open_time_duration2` varchar(10) NULL DEFAULT NULL COMMENT '最小开井时间持续时长',
+ `max_well_open_time_duration2` varchar(10) NULL DEFAULT NULL COMMENT '最大开井时间持续时长',
`well_open_pressure_value_at_open` int NULL DEFAULT NULL COMMENT '开井时压力值(开井瞬间)',
`well_open_oil_pressure_value_at_open` int NULL DEFAULT NULL COMMENT '开井时油压值(开井瞬间)',
`well_open_load_factor_presets_at_open` int NULL DEFAULT NULL COMMENT '开井时载荷因子预设值(开井瞬间)',