From 686a200dd6d401812742f54888a9e4db647bf294 Mon Sep 17 00:00:00 2001 From: wangshilong Date: Sat, 22 Feb 2025 02:13:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=80=81=E7=89=88=E7=BB=B4?= =?UTF-8?q?=E5=B0=94=E6=99=AE=E6=96=AF=E6=95=B0=E6=8D=AE=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modbus/data/PersistenceHandler.java | 1 + .../impl/ByteToStringDecodeHandler.java | 39 ++++ ...WepsCurrentLocalDateTimeDecodeHandler.java | 61 +++++ .../impl/weps/WepsDecimalDecodeHandler.java | 40 ++++ .../WepsRemainingLocalTimeDecodeHandler.java | 61 +++++ .../impl/MiWepsPlugPersistenceHandler.java | 170 ++++++++++++++ .../service/impl/DeviceServiceImpl.java | 12 +- .../service/impl/SummaryServiceImpl.java | 14 +- .../isu/gaswellwatch/vo/command/Command.java | 22 +- .../vo/command/weps/WepsTurnOff.java | 29 +++ .../vo/command/weps/WepsTurnOn.java | 30 +++ src/main/resources/change_2020220.sql | 210 ++++++++++++++++++ src/main/resources/mapper/DeviceDao.xml | 43 +++- .../resources/sql/CREATE_MI_WEPS_PLUG.sql | 64 ++++++ .../resources/sql/INSERT_MI_WEPS_PLUG.sql | 75 +++++++ .../gaswellwatch/GasWellWatchApplication.java | 13 ++ .../com/isu/gaswellwatch/WrpsDecodeTest.java | 38 ++++ src/test/resources/application-test.yaml | 7 + 18 files changed, 908 insertions(+), 21 deletions(-) create mode 100644 src/main/java/com/isu/gaswellwatch/modbus/data/decode/impl/ByteToStringDecodeHandler.java create mode 100644 src/main/java/com/isu/gaswellwatch/modbus/data/decode/impl/weps/WepsCurrentLocalDateTimeDecodeHandler.java create mode 100644 src/main/java/com/isu/gaswellwatch/modbus/data/decode/impl/weps/WepsDecimalDecodeHandler.java create mode 100644 src/main/java/com/isu/gaswellwatch/modbus/data/decode/impl/weps/WepsRemainingLocalTimeDecodeHandler.java create mode 100644 src/main/java/com/isu/gaswellwatch/modbus/data/impl/MiWepsPlugPersistenceHandler.java create mode 100644 src/main/java/com/isu/gaswellwatch/vo/command/weps/WepsTurnOff.java create mode 100644 src/main/java/com/isu/gaswellwatch/vo/command/weps/WepsTurnOn.java create mode 100644 src/main/resources/change_2020220.sql create mode 100644 src/main/resources/sql/CREATE_MI_WEPS_PLUG.sql create mode 100644 src/main/resources/sql/INSERT_MI_WEPS_PLUG.sql create mode 100644 src/test/java/com/isu/gaswellwatch/GasWellWatchApplication.java create mode 100644 src/test/java/com/isu/gaswellwatch/WrpsDecodeTest.java create mode 100644 src/test/resources/application-test.yaml diff --git a/src/main/java/com/isu/gaswellwatch/modbus/data/PersistenceHandler.java b/src/main/java/com/isu/gaswellwatch/modbus/data/PersistenceHandler.java index 0152940..5aec543 100644 --- a/src/main/java/com/isu/gaswellwatch/modbus/data/PersistenceHandler.java +++ b/src/main/java/com/isu/gaswellwatch/modbus/data/PersistenceHandler.java @@ -13,6 +13,7 @@ public interface PersistenceHandler { String ETC_MODBUS_TYPE = "etc"; String SCSS_MODBUS_TYPE = "scss"; String WEPS_PLUG_MODBUS_TYPE = "weps_plug"; + String MI_WEPS_PLUG_MODBUS_TYPE = "mi_weps_plug"; String COMMAND_CACHE = "modbus:command:"; String DEVICE_INFO_CACHE = "info:device:"; diff --git a/src/main/java/com/isu/gaswellwatch/modbus/data/decode/impl/ByteToStringDecodeHandler.java b/src/main/java/com/isu/gaswellwatch/modbus/data/decode/impl/ByteToStringDecodeHandler.java new file mode 100644 index 0000000..64b55b2 --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/modbus/data/decode/impl/ByteToStringDecodeHandler.java @@ -0,0 +1,39 @@ +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.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * @author 王仕龙 + * 2025/2/22 00:56 + */ +@Component(ByteToStringDecodeHandler.NAME + DecodeHandler.DECODE_NAME) +public class ByteToStringDecodeHandler implements DecodeHandler { + + public static final String NAME = "byteToString"; + + @Override + public String decode(Map commandPointMap, String value) { + if (StringUtils.isBlank(value)) { + return value; + } + int length = value.length() / 4; + byte[] bytes = new byte[length]; + for (int i = 0; i < length; i++) { + bytes[0] = NumberUtils.createInteger(value.substring(i * 4, i * 4 + 4)).byteValue(); + } + return new String(bytes); + } + + @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/decode/impl/weps/WepsCurrentLocalDateTimeDecodeHandler.java b/src/main/java/com/isu/gaswellwatch/modbus/data/decode/impl/weps/WepsCurrentLocalDateTimeDecodeHandler.java new file mode 100644 index 0000000..8bee2d9 --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/modbus/data/decode/impl/weps/WepsCurrentLocalDateTimeDecodeHandler.java @@ -0,0 +1,61 @@ +package com.isu.gaswellwatch.modbus.data.decode.impl.weps; + + +import com.isu.gaswellwatch.modbus.data.ModbusMessage; +import com.isu.gaswellwatch.modbus.data.decode.DecodeHandler; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * @author 王仕龙 + * 2025/2/22 00:26 + */ +@Component(WepsCurrentLocalDateTimeDecodeHandler.NAME + DecodeHandler.DECODE_NAME) +public class WepsCurrentLocalDateTimeDecodeHandler implements DecodeHandler { + + public static final String NAME = "wepsCurrentLocalDateTime"; + + @Override + public String decode(Map commandPointMap, String value) { + if (StringUtils.isBlank(value)) { + return value; + } +// 0x4830:0x0211:0x0924:0x2013 +// 2013-09-24 11:48:30 + String[] times = value.split(":"); + if (times.length < 4) { + return value; + } + String minuteSecond = times[0]; + String weekHour = times[1]; + String monthDay = times[2]; + String year = times[4]; + + if (StringUtils.startsWithIgnoreCase(minuteSecond, "0x")) { + minuteSecond = StringUtils.substring(minuteSecond, 2); + } + minuteSecond = StringUtils.leftPad(minuteSecond, 4, '0'); + if (StringUtils.startsWithIgnoreCase(weekHour, "0x")) { + weekHour = StringUtils.substring(weekHour, 2); + } + weekHour = StringUtils.leftPad(weekHour, 4, '0'); + if (StringUtils.startsWithIgnoreCase(monthDay, "0x")) { + monthDay = StringUtils.substring(monthDay, 2); + } + monthDay = StringUtils.leftPad(monthDay, 4, '0'); + if (StringUtils.startsWithIgnoreCase(year, "0x")) { + year = StringUtils.substring(year, 2); + } + + return year + "-" + StringUtils.substring(monthDay, 0, 2) + "-" + + StringUtils.substring(monthDay, 2) + " " + StringUtils.substring(weekHour, 2) + ":" + + StringUtils.substring(minuteSecond, 0, 2) + ":" + StringUtils.substring(minuteSecond, 2); + } + + @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/decode/impl/weps/WepsDecimalDecodeHandler.java b/src/main/java/com/isu/gaswellwatch/modbus/data/decode/impl/weps/WepsDecimalDecodeHandler.java new file mode 100644 index 0000000..a7ab5d4 --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/modbus/data/decode/impl/weps/WepsDecimalDecodeHandler.java @@ -0,0 +1,40 @@ +package com.isu.gaswellwatch.modbus.data.decode.impl.weps; + + +import com.isu.gaswellwatch.modbus.data.ModbusMessage; +import com.isu.gaswellwatch.modbus.data.decode.DecodeHandler; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * @author 王仕龙 + * 2025/2/22 00:50 + */ +@Component(WepsDecimalDecodeHandler.NAME + DecodeHandler.DECODE_NAME) +public class WepsDecimalDecodeHandler implements DecodeHandler { + + public static final String NAME = "wepsDecimal"; + + @Override + public String decode(Map commandPointMap, String value) { + if (StringUtils.isBlank(value)) { + return value; + } + if (StringUtils.startsWith(value, ".")) { + return NumberUtils.createBigDecimal("0" + value).toString(); + } else if (StringUtils.endsWith(value, ".")) { + return NumberUtils.createBigDecimal(value + "0").toString(); + } else { + 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/decode/impl/weps/WepsRemainingLocalTimeDecodeHandler.java b/src/main/java/com/isu/gaswellwatch/modbus/data/decode/impl/weps/WepsRemainingLocalTimeDecodeHandler.java new file mode 100644 index 0000000..3e13df5 --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/modbus/data/decode/impl/weps/WepsRemainingLocalTimeDecodeHandler.java @@ -0,0 +1,61 @@ +package com.isu.gaswellwatch.modbus.data.decode.impl.weps; + + +import com.isu.gaswellwatch.modbus.data.ModbusMessage; +import com.isu.gaswellwatch.modbus.data.decode.DecodeHandler; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; +import org.springframework.stereotype.Component; + +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * @author 王仕龙 + * 2025/2/22 00:38 + */ +@Component(WepsRemainingLocalTimeDecodeHandler.NAME + DecodeHandler.DECODE_NAME) +public class WepsRemainingLocalTimeDecodeHandler implements DecodeHandler { + public static final String NAME = "wepsRemainingLocalTime"; + + @Override + public String decode(Map commandPointMap, String value) { + if (StringUtils.isBlank(value)) { + return value; + } + // 0x0930:0x0001 + // 0.1:09:30 + String[] times = value.split(":"); + if (times.length < 2) { + return value; + } + String minuteSecond = times[0]; + String dayHour = times[1]; + + if (StringUtils.startsWithIgnoreCase(minuteSecond, "0x")) { + minuteSecond = StringUtils.substring(minuteSecond, 2); + } + minuteSecond = StringUtils.leftPad(minuteSecond, 4, '0'); + if (StringUtils.startsWithIgnoreCase(dayHour, "0x")) { + dayHour = StringUtils.substring(dayHour, 2); + } + dayHour = StringUtils.leftPad(dayHour, 4, '0'); + + long daySeconds = TimeUnit.DAYS.toSeconds(NumberUtils.createLong(StringUtils.substring(dayHour, 0, 2))); + long hourSeconds = TimeUnit.HOURS.toSeconds(NumberUtils.createLong(StringUtils.substring(dayHour, 2))); + long minuteSeconds = TimeUnit.HOURS.toSeconds(NumberUtils.createLong(StringUtils.substring(minuteSecond, 0, 2))); + long seconds = TimeUnit.HOURS.toSeconds(NumberUtils.createLong(StringUtils.substring(minuteSecond, 2))); + + long totalSeconds = daySeconds + hourSeconds + minuteSeconds + seconds; + 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); + } + + @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/MiWepsPlugPersistenceHandler.java b/src/main/java/com/isu/gaswellwatch/modbus/data/impl/MiWepsPlugPersistenceHandler.java new file mode 100644 index 0000000..42ae6c3 --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/modbus/data/impl/MiWepsPlugPersistenceHandler.java @@ -0,0 +1,170 @@ +package com.isu.gaswellwatch.modbus.data.impl; + + +import com.isu.gaswellwatch.modbus.data.PersistenceHandler; +import org.apache.commons.lang3.StringUtils; +import org.springframework.jdbc.core.PreparedStatementCallback; +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; + +/** + * @author 王仕龙 + * 2025/2/22 01:07 + */ +@Component(PersistenceHandler.MI_WEPS_PLUG_MODBUS_TYPE) +public class MiWepsPlugPersistenceHandler extends AbstractPersistenceHandler { + + private static final Map MI_WEPS_PLUG_COLUMN_MAPPING_MAP = new HashMap<>(); + + static { + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("report_status", "reportStatus"); // 报表状态 0:无报表数据; 1:有分钟记录; 2:有小时记录; 3:有日志记录; 4:有生产记录 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("current_status", "currentStatus"); // 当前状态 0:关井; 1:上升; 2:续流; 3:停机 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("current_time", "currentTime"); // 当前时间 "控制器时间。示例:0x4830:0x0211:0x0924:0x2013。结果:2013 - 09 - 24 11:48:30 " + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("remaining_time", "remainingTime"); // 剩余时间 "组合后时间格式:天.小时:分钟:秒。示例:0x0930:0x0001。结果:0.1:09:30 " + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("current_status_0x", "currentStatus0x"); // 当前状态0x 0x8000:关井;0x8001:上升;0x8002:续流;0x8003:停机 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("oil_pressure", "oilPressure"); // 油压 单位:MPa + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("oil_pressure_temperature", "oilPressureTemperature"); // 油压表测量温度 单位:℃ + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("cas_pressure", "casPressure"); // 套压 单位:MPa + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("cas_pressure_temperature", "casPressureTemperature"); // 套压测量温度 单位:℃ + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("quantity_of_electricity", "quantityOfElectricity"); // 控制器电量 单位:% + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("pluger_rising_speed", "plugerRisingSpeed"); // 柱塞上升速度 单位:米/分钟 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("gas_well_number", "gasWellNumber"); // 气井编号 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("depth_of_lock_device", "depthOfLockDevice"); // 卡定器深度 单位:米 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("arriving_sensor", "arrivingSensor"); // 到达传感器 0/1:禁用/启用 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("zigbee", "zigbee"); // Zigbee 0/1:禁用/启用 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("pulse_width", "pulseWidth"); // 脉冲宽度 驱动电磁阀使用 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("plug_rising_speed", "plugRisingSpeed"); // 上升速度 米/分钟 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("plug_too_fast_speed", "plugTooFastSpeed"); // 过快速度 米/分钟 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("plug_too_slow_speed", "plugTooSlowSpeed"); // 过缓速度 米/分钟 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("gas_well_name", "gasWellName"); // 气井名称 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("oil_and_cas_data_collection_interval", "oilAndCasDataCollectionInterval"); // 油、套压数据采集间隔 0:每5秒采样;1:每10秒采样;2:每15秒采样;3:每30秒采样;4:每1秒采样;5:每2秒采样;6:每3秒采样;7:每4秒采样 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("store_data_interval_on_open_well", "storeDataIntervalOnOpenWell"); // 数据存储间隔(开井期间) 0:每1分钟存储;1:每5分钟存储;2:每10分钟存储;3:每15分钟存储;4:每30秒存储;5:每15秒存储;6:每5秒存储 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("store_data_interval_on_close_well", "storeDataIntervalOnCloseWell"); // 数据存储间隔(关井期间) 0:每1分钟存储;1:每5分钟存储;2:每10分钟存储;3:每15分钟存储;4:每30秒存储;5:每15秒存储;6:每5秒存储 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("communication_power_threshold", "communicationPowerThreshold"); // 通信电量门限 Zigbee通讯使用 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("reserve1", "reserve1"); // 保留 Zigbee通讯使用 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("start_time_of_daytime", "startTimeOfDaytime"); // 白天起始时间 Zigbee通讯使用 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("end_time_of_daytime", "endTimeOfDaytime"); // 白天结束时间 Zigbee通讯使用 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("control_work_time", "controlWorkTime"); // 控制器工作状态 0:生产模式;1:常开模式;2:常关模式 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("produce_mode", "produceMode"); // 生产制度设置 0:定时开关井;1:时间优化模式;2:压力微升模式;3:压力回升模式;4:压力跌落模式 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("plunger_rise_time", "plungerRiseTime"); // 上升时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("dangerous_rise_time", "dangerousRiseTime"); // 危险上升时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("too_fast_rise_time", "tooFastRiseTime"); // 过快上升时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("too_slow_rise_time", "tooSlowRiseTime"); // 过缓上升时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("too_fast_count", "tooFastCount"); // 过快次数 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("too_fast_raise_open_well_time", "tooFastRaiseOpenWellTime"); // 过快增加开井时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("too_fast_lower_close_well_time", "tooFastLowerCloseWellTime"); // 过快减少关井时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("too_slow_lower_open_well_time", "tooSlowLowerOpenWellTime"); // 过缓减少开井时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("too_slow_raise_close_well_time", "tooSlowRaiseCloseWellTime"); // 过缓增加关井时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("check_stability_time", "checkStabilityTime"); // 检测稳定时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("min_close_well_time", "minCloseWellTime"); // 最小关井时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("max_close_well_time", "maxCloseWellTime"); // 最大关井时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("well_close_time_not_reached_duration", "wellCloseTimeNotReachedDuration"); // 未到达关井时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("min_open_well_time", "minOpenWellTime"); // 最小开井时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("max_open_well_time", "maxOpenWellTime"); // 最大开井时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("after_flow_time", "afterFlowTime"); // 续流时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("not_reached_flow_time", "notReachedFlowTime"); // 未到续流时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("close_time", "closeTime"); // 关井时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("open_time", "openTime"); // 开井时间 单位:秒 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("open_pressure", "openPressure"); // 开井压力 单位:MPa + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("close_pressure", "closePressure"); // 关井压力 单位:MPa + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("little_rise_pressure", "littleRisePressure"); // 微升压力 单位:MPa + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("gas_collection_mode", "gasCollectionMode"); // 集气模式 0:低压集气模式;1:高压集气模式 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("reserve2", "reserve2"); // 保留 + MI_WEPS_PLUG_COLUMN_MAPPING_MAP.put("protection_pressure", "protectionPressure"); // 保护压力 单位:MPa + } + + @Override + public void createTable(String tableName, Long deviceId) { + this.createTable("sql/CREATE_MI_WEPS_PLUG.sql", tableName, deviceId); + } + + @Override + public Map> insert(String tableName, String cacheKey) { + String insertTableSQL = this.getResource("sql/INSERT_MI_WEPS_PLUG.sql"); + insertTableSQL = StringUtils.replace(insertTableSQL, "$TableName$", tableName); + + Map oldRow = this.getLastRow(tableName); + Map newRow = this.redisTemplate.opsForHash().entries(cacheKey); + + this.jdbcTemplate.execute(insertTableSQL, new PreparedStatementCallback() { + @Override + public Object doInPreparedStatement(PreparedStatement ps) throws SQLException { + ps.setLong(1, MiWepsPlugPersistenceHandler.this.snowflakeConfig.snowflakeId()); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 2, "deviceId", Types.BIGINT); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 3, "collectionTime", Types.TIMESTAMP); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 4, "receiveTime", Types.TIMESTAMP); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 5, "reportStatus", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 6, "currentStatus", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 7, "currentTime", Types.TIMESTAMP); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 8, "remainingTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 9, "currentStatus0x", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 10, "oilPressure", Types.DECIMAL); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 11, "oilPressureTemperature", Types.DECIMAL); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 12, "casPressure", Types.DECIMAL); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 13, "casPressureTemperature", Types.DECIMAL); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 14, "quantityOfElectricity", Types.DECIMAL); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 15, "plugerRisingSpeed", Types.DECIMAL); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 16, "gasWellNumber", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 17, "depthOfLockDevice", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 18, "arrivingSensor", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 19, "zigbee", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 20, "pulseWidth", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 21, "plugRisingSpeed", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 22, "plugTooFastSpeed", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 23, "plugTooSlowSpeed", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 24, "gasWellName", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 25, "oilAndCasDataCollectionInterval", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 26, "storeDataIntervalOnOpenWell", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 27, "storeDataIntervalOnCloseWell", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 28, "communicationPowerThreshold", Types.DECIMAL); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 29, "reserve1", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 30, "startTimeOfDaytime", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 31, "endTimeOfDaytime", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 32, "controlWorkTime", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 33, "produceMode", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 34, "plungerRiseTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 35, "dangerousRiseTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 36, "tooFastRiseTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 37, "tooSlowRiseTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 38, "tooFastCount", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 39, "tooFastRaiseOpenWellTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 40, "tooFastLowerCloseWellTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 41, "tooSlowLowerOpenWellTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 42, "tooSlowRaiseCloseWellTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 43, "checkStabilityTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 44, "minCloseWellTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 45, "maxCloseWellTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 46, "wellCloseTimeNotReachedDuration", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 47, "minOpenWellTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 48, "maxOpenWellTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 49, "afterFlowTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 50, "notReachedFlowTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 51, "closeTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 52, "openTime", Types.VARCHAR); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 53, "openPressure", Types.DECIMAL); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 54, "closePressure", Types.DECIMAL); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 55, "littleRisePressure", Types.DECIMAL); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 56, "gasCollectionMode", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 57, "reserve2", Types.INTEGER); + MiWepsPlugPersistenceHandler.this.setValue(ps, newRow, 58, "protectionPressure", Types.DECIMAL); + return ps.executeUpdate(); + } + }); + if (Objects.isNull(oldRow)) { + return Map.of("new", newRow); + } + return Map.of("new", newRow, "old", oldRow); + } + + @Override + protected Map getColumnMappingMap() { + return MI_WEPS_PLUG_COLUMN_MAPPING_MAP; + } + +} diff --git a/src/main/java/com/isu/gaswellwatch/service/impl/DeviceServiceImpl.java b/src/main/java/com/isu/gaswellwatch/service/impl/DeviceServiceImpl.java index 5eb2d6e..33b8777 100644 --- a/src/main/java/com/isu/gaswellwatch/service/impl/DeviceServiceImpl.java +++ b/src/main/java/com/isu/gaswellwatch/service/impl/DeviceServiceImpl.java @@ -38,7 +38,6 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Map; -import java.util.Objects; @Service("deviceService") @@ -253,13 +252,14 @@ public class DeviceServiceImpl extends ServiceImpl implements runModeMap = this.dictionaryService.getValueMapByType("controlMode"); } else if (PersistenceHandler.SCSS_MODBUS_TYPE.equalsIgnoreCase(device.getProduct().getCode())) { runModeMap = this.dictionaryService.getValueMapByType("ctlMode"); + } else if (PersistenceHandler.WEPS_PLUG_MODBUS_TYPE.equalsIgnoreCase(device.getProduct().getCode())) { + runModeMap = this.dictionaryService.getValueMapByType("wepsRunMode"); + } else if (PersistenceHandler.MI_WEPS_PLUG_MODBUS_TYPE.equalsIgnoreCase(device.getProduct().getCode())) { + runModeMap = this.dictionaryService.getValueMapByType("miWepsRunMode"); } Map plugStatusMap = this.dictionaryService.getValueMapByType("plugStatus"); for (DeviceHistoryVO deviceVO : list) { - if (Objects.equals(deviceVO.getType(), PersistenceHandler.WEPS_PLUG_MODBUS_TYPE)) { - continue; - } deviceVO.setRunMode(StringUtils.isEmpty(deviceVO.getRunMode()) ? "" : runModeMap.get(deviceVO.getRunMode()).getName()); deviceVO.setPlugStatus(StringUtils.isEmpty(deviceVO.getPlugStatus()) ? "" : plugStatusMap.get(deviceVO.getPlugStatus()).getName()); } @@ -340,6 +340,10 @@ public class DeviceServiceImpl extends ServiceImpl implements runModeMap = this.dictionaryService.getValueMapByType("controlMode"); } else if (PersistenceHandler.SCSS_MODBUS_TYPE.equalsIgnoreCase(device.getProduct().getCode())) { runModeMap = this.dictionaryService.getValueMapByType("ctlMode"); + } else if (PersistenceHandler.WEPS_PLUG_MODBUS_TYPE.equalsIgnoreCase(device.getProduct().getCode())) { + runModeMap = this.dictionaryService.getValueMapByType("wepsRunMode"); + } else if (PersistenceHandler.MI_WEPS_PLUG_MODBUS_TYPE.equalsIgnoreCase(device.getProduct().getCode())) { + runModeMap = this.dictionaryService.getValueMapByType("miWepsRunMode"); } Map plugStatusMap = this.dictionaryService.getValueMapByType("plugStatus"); diff --git a/src/main/java/com/isu/gaswellwatch/service/impl/SummaryServiceImpl.java b/src/main/java/com/isu/gaswellwatch/service/impl/SummaryServiceImpl.java index d6c3105..4af471b 100644 --- a/src/main/java/com/isu/gaswellwatch/service/impl/SummaryServiceImpl.java +++ b/src/main/java/com/isu/gaswellwatch/service/impl/SummaryServiceImpl.java @@ -67,7 +67,7 @@ public class SummaryServiceImpl implements SummaryService { addKNPCDeviceSummary(ETC_MODBUS_TYPE, deviceGroup, onlineMap, pieSummaryVOList, "ETC"); addKNPCDeviceSummary(SCSS_MODBUS_TYPE, deviceGroup, onlineMap, pieSummaryVOList, "四川双晟"); addKNPCDeviceSummary(WEPS_PLUG_MODBUS_TYPE, deviceGroup, onlineMap, pieSummaryVOList, "维尔普斯"); - addKNPCDeviceSummary(MI_WEPS_PLUG_MODBUS_TYPE, deviceGroup, onlineMap, pieSummaryVOList, "维尔普斯"); + addKNPCDeviceSummary(MI_WEPS_PLUG_MODBUS_TYPE, deviceGroup, onlineMap, pieSummaryVOList, "MI维尔普斯"); //计算总数 PieSummaryVO pieSummaryVO = new PieSummaryVO(); @@ -239,6 +239,18 @@ public class SummaryServiceImpl implements SummaryService { pieSummaryVO3.setData(List.of()); result.add(pieSummaryVO3); + PieSummaryVO pieSummaryVO4 = new PieSummaryVO(); + pieSummaryVO4.setChartName(WEPS_PLUG_MODBUS_TYPE); + pieSummaryVO4.setTitle("维尔普斯"); + pieSummaryVO4.setData(List.of()); + result.add(pieSummaryVO4); + + PieSummaryVO pieSummaryVO5 = new PieSummaryVO(); + pieSummaryVO5.setChartName(MI_WEPS_PLUG_MODBUS_TYPE); + pieSummaryVO5.setTitle("MI维尔普斯"); + pieSummaryVO5.setData(List.of()); + result.add(pieSummaryVO5); + return result; } diff --git a/src/main/java/com/isu/gaswellwatch/vo/command/Command.java b/src/main/java/com/isu/gaswellwatch/vo/command/Command.java index 2152e1d..f660c6c 100644 --- a/src/main/java/com/isu/gaswellwatch/vo/command/Command.java +++ b/src/main/java/com/isu/gaswellwatch/vo/command/Command.java @@ -7,7 +7,7 @@ import com.isu.gaswellwatch.vo.command.etc.*; import com.isu.gaswellwatch.vo.command.knpcv1.mode.TimingMode; import com.isu.gaswellwatch.vo.command.knpcv1.mode.*; import com.isu.gaswellwatch.vo.command.scss.*; -import com.isu.gaswellwatch.vo.command.weps.WepsPlugControl; +import com.isu.gaswellwatch.vo.command.weps.*; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; @@ -55,7 +55,12 @@ import java.util.Objects; @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), + @JsonSubTypes.Type(value = WepsTurnOn.class, name = Command.WEPS_TURN_ON_THE_WELL), + @JsonSubTypes.Type(value = WepsTurnOff.class, name = Command.WEPS_TURN_OFF_THE_WELL), @JsonSubTypes.Type(value = WepsPlugControl.class, name = Command.WEPS_PLUG_CONTROL), + @JsonSubTypes.Type(value = MiWepsTurnOn.class, name = Command.MI_WEPS_TURN_ON_THE_WELL), + @JsonSubTypes.Type(value = MiWepsTurnOff.class, name = Command.MI_WEPS_TURN_OFF_THE_WELL), + @JsonSubTypes.Type(value = MiWepsPlugControl.class, name = Command.MI_WEPS_PLUG_CONTROL), }) @Getter @Setter @@ -117,10 +122,19 @@ public abstract class Command implements Serializable { /* 点表类型:ETC end */ - /* 点表类型:威尔普斯 start */ - // 威尔普斯,柱塞模式 + /* 点表类型:新版威尔普斯 start */ + // 新版威尔普斯,柱塞模式 + public static final String WEPS_TURN_ON_THE_WELL = "WEPS.TURN_ON_THE_WELL"; + public static final String WEPS_TURN_OFF_THE_WELL = "WEPS.TURN_OFF_THE_WELL"; public static final String WEPS_PLUG_CONTROL = "WEPS.PLUG.CONTROL"; - /* 点表类型:威尔普斯 end */ + /* 点表类型:新版威尔普斯 end */ + + /* 点表类型:老版威尔普斯 start */ + // 老版威尔普斯,柱塞模式 + public static final String MI_WEPS_TURN_ON_THE_WELL = "MI_WEPS.TURN_ON_THE_WELL"; + public static final String MI_WEPS_TURN_OFF_THE_WELL = "MI_WEPS.TURN_OFF_THE_WELL"; + public static final String MI_WEPS_PLUG_CONTROL = "MI_WEPS.PLUG.CONTROL"; + /* 点表类型:老版威尔普斯 end */ public static final BigDecimal ONE_SIXTY = BigDecimal.valueOf(60); public static final BigDecimal ONE_HUNDRED = BigDecimal.valueOf(100); diff --git a/src/main/java/com/isu/gaswellwatch/vo/command/weps/WepsTurnOff.java b/src/main/java/com/isu/gaswellwatch/vo/command/weps/WepsTurnOff.java new file mode 100644 index 0000000..71f9681 --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/vo/command/weps/WepsTurnOff.java @@ -0,0 +1,29 @@ +package com.isu.gaswellwatch.vo.command.weps; + +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 王仕龙 + * 2024/11/26 19:57 + */ +public class WepsTurnOff extends Command { + + @Serial + private static final long serialVersionUID = -6219690846185319542L; + + public WepsTurnOff() { + this.setCode("WEPS.TURN_OFF_THE_WELL"); + } + + @Override + protected Collection builderModbusCommand() { + return List.of(ModbusCommandDto.builder().command("010600400002").length(16).build()); + } +} diff --git a/src/main/java/com/isu/gaswellwatch/vo/command/weps/WepsTurnOn.java b/src/main/java/com/isu/gaswellwatch/vo/command/weps/WepsTurnOn.java new file mode 100644 index 0000000..f057b36 --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/vo/command/weps/WepsTurnOn.java @@ -0,0 +1,30 @@ +package com.isu.gaswellwatch.vo.command.weps; + +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 王仕龙 + * 2024/11/26 19:57 + */ +public class WepsTurnOn extends Command { + + @Serial + private static final long serialVersionUID = -7123367842204864916L; + + public WepsTurnOn() { + this.setCode("WEPS.TURN_ON_THE_WELL"); + } + + @Override + protected Collection builderModbusCommand() { + return List.of(ModbusCommandDto.builder().command("010600400001").length(16).build()); + } + +} diff --git a/src/main/resources/change_2020220.sql b/src/main/resources/change_2020220.sql new file mode 100644 index 0000000..005bf2a --- /dev/null +++ b/src/main/resources/change_2020220.sql @@ -0,0 +1,210 @@ +INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) +VALUES (29, 'deviceProduct', 'mi_weps_plug', 'MI维尔普斯', '5', 5, now(), now()); + +INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) +VALUES (30, 'wepsRunMode', 'unknow', '未知', '0', 1, now(), now()); +INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) +VALUES (31, 'wepsRunMode', 'dskgj', '定时开关井', '1', 2, now(), now()); +INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) +VALUES (32, 'wepsRunMode', 'ylyhws', '压力优化微升', '2', 3, now(), now()); +INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) +VALUES (33, 'wepsRunMode', 'zdyh', '自动优化', '3', 4, now(), now()); +INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) +VALUES (34, 'miWepsRunMode', 'dskgj', '定时开关井', '0', 1, now(), now()); +INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) +VALUES (35, 'miWepsRunMode', 'sjyhms', '时间优化模式', '1', 2, now(), now()); +INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) +VALUES (36, 'miWepsRunMode', 'ylwsms', '压力微升模式', '2', 3, now(), now()); +INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) +VALUES (37, 'miWepsRunMode', 'ylhsms', '压力回升模式', '3', 4, now(), now()); +INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`) +VALUES (38, 'miWepsRunMode', 'yldlms', '压力跌落模式', '4', 5, now(), now()); + + +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13100, 10301, 'reportStatus', '报表状态', + '0:无报表数据; 1:有分钟记录; 2:有小时记录; 3:有日志记录; 4:有生产记录', 0, 1, NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13101, 10301, 'currentStatus', '当前状态', '0:关井; 1:上升; 2:续流; 3:停机', 1, 1, NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13102, 10301, 'currentTime', '当前时间', + '控制器时间。\n示例:0x4830:0x0211:0x0924:0x2013。\n结果:2013-09-24 11:48:30', 3, 4, NULL, NULL, '%s:%s:%s:%s', + 'wepsCurrentLocalDateTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13103, 10301, 'remainingTime', '剩余时间', '组合后时间格式:天.小时:分钟:秒\n示例:0x0930:0x0001\n结果:0.1:09:30', + 7, 2, NULL, NULL, '%s:%s', 'wepsRemainingLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13104, 10301, 'currentStatus0x', '当前状态0x', '0x8000:关井;0x8001:上升;0x8002:续流;0x8003:停机', 9, 2, NULL, + NULL, '%s.%s', 'wepsDecimal'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13105, 10301, 'oilPressure', '油压', '单位:MPa', 10, 2, NULL, NULL, '%s.%s', 'wepsDecimal'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13106, 10301, 'oilPressureTemperature', '油压表测量温度', '单位:℃', 12, 2, NULL, NULL, '%s.%s', 'wepsDecimal'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13107, 10301, 'casPressure', '套压', '单位:MPa', 14, 2, NULL, NULL, '%s.%s', 'wepsDecimal'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13108, 10301, 'casPressureTemperature', '套压测量温度', '单位:℃', 16, 2, NULL, NULL, '%s.%s', 'wepsDecimal'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13109, 10301, 'quantityOfElectricity', '控制器电量', '单位:%', 18, 2, NULL, NULL, '%s.%s', 'wepsDecimal'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13110, 10301, 'plugRisingSpeed', '柱塞上升速度', '单位:米/分钟', 20, 2, NULL, NULL, '%s.%s', 'wepsDecimal'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13200, 10302, 'gasWellNumber', '气井编号', NULL, 1004, 1, NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13201, 10302, 'depthOfLockDevice', '卡定器深度', '单位:米', 1005, 1, NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13202, 10302, 'arrivingSensor', '到达传感器', '0/1:禁用/启用', 1006, 1, NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13203, 10302, 'zigbee', 'Zigbee', '0/1:禁用/启用', 1007, 1, NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13204, 10302, 'pulseWidth', '脉冲宽度', '驱动电磁阀使用', 1008, 1, NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13205, 10302, 'plugRisingSpeed', '上升速度', '米/分钟', 1009, 1, NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13206, 10302, 'plugTooFastSpeed', '过快速度', '米/分钟', 1010, 1, NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13207, 10302, 'plugTooSlowSpeed', '过缓速度', '米/分钟', 1011, 1, NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13208, 10302, 'gasWellName', '气井名称', NULL, 1012, 16, NULL, NULL, NULL, 'byteToString'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13209, 10302, 'oilAndCasDataCollectionInterval', '油、套压数据采集间隔', + '0:每5秒采样;1:每10秒采样;2:每15秒采样;3:每30秒采样;4:每1秒采样;5:每2秒采样;6:每3秒采样;7:每4秒采样', 1028, 1, + NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13210, 10302, 'storeDataIntervalOnOpenWell', '数据存储间隔(开井期间)', + '0:每1分钟存储;1:每5分钟存储;2:每10分钟存储;3:每15分钟存储;4:每30秒存储;5:每15秒存储;6:每5秒存储', 1029, 1, + NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13211, 10302, 'storeDataIntervalOnCloseWell', '数据存储间隔(关井期间)', + '0:每1分钟存储;1:每5分钟存储;2:每10分钟存储;3:每15分钟存储;4:每30秒存储;5:每15秒存储;6:每5秒存储', 1030, 1, + NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13212, 10302, 'communicationPowerThreshold', '通信电量门限', 'Zigbee通讯使用', 1031, 2, NULL, NULL, NULL, + 'highLowBin'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13213, 10302, 'reserve1', '保留', 'Zigbee通讯使用', 1033, 1, NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13214, 10302, 'startTimeOfDaytime', '白天起始时间', 'Zigbee通讯使用', 1034, 1, NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13215, 10302, 'endTimeOfDaytime', '白天结束时间', 'Zigbee通讯使用', 1035, 1, NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13216, 10302, 'controlWorkTime', '控制器工作状态', '0:生产模式;1:常开模式;2:常关模式', 1036, 1, NULL, NULL, + NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13217, 10302, 'produceMode', '生产制度设置', + '0:定时开关井;1:时间优化模式;2:压力微升模式;3:压力回升模式;4:压力跌落模式', 1037, 1, NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13218, 10302, 'plungerRiseTime', '上升时间', '单位:秒', 1038, 1, NULL, NULL, NULL, 'secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13219, 10302, 'dangerousRiseTime', '危险上升时间', '单位:秒', 1039, 1, NULL, NULL, NULL, 'secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13220, 10302, 'tooFastRiseTime', '过快上升时间', '单位:秒', 1040, 1, NULL, NULL, NULL, 'secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13221, 10302, 'tooSlowRiseTime', '过缓上升时间', '单位:秒', 1041, 1, NULL, NULL, NULL, 'secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13222, 10302, 'tooFastCount', '过快次数', NULL, 1042, 1, NULL, NULL, NULL, 'secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13223, 10302, 'tooFastRaiseOpenWellTime', '过快增加开井时间', '单位:秒', 1043, 1, NULL, NULL, NULL, + 'secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13224, 10302, 'tooFastLowerCloseWellTime', '过快减少关井时间', '单位:秒', 1044, 1, NULL, NULL, NULL, + 'secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13225, 10302, 'tooSlowLowerOpenWellTime', '过缓减少开井时间', '单位:秒', 1045, 1, NULL, NULL, NULL, + 'secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13226, 10302, 'tooSlowRaiseCloseWellTime', '过缓增加关井时间', '单位:秒', 1046, 1, NULL, NULL, NULL, + 'secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13227, 10302, 'checkStabilityTime', '检测稳定时间', '单位:秒', 1047, 1, NULL, NULL, NULL, 'secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13228, 10302, 'minCloseWellTime', '最小关井时间', '单位:秒', 1048, 2, NULL, NULL, NULL, + 'highLowBin,secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13229, 10302, 'maxCloseWellTime', '最大关井时间', '单位:秒', 1050, 2, NULL, NULL, NULL, + 'highLowBin,secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13230, 10302, 'wellCloseTimeNotReachedDuration', '未到达关井时间', '单位:秒', 1052, 2, NULL, NULL, NULL, + 'highLowBin,secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13231, 10302, 'minOpenWellTime', '最小开井时间', '单位:秒', 1054, 2, NULL, NULL, NULL, + 'highLowBin,secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13232, 10302, 'maxOpenWellTime', '最大开井时间', '单位:秒', 1056, 2, NULL, NULL, NULL, + 'highLowBin,secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13233, 10302, 'afterFlowTime', '续流时间', '单位:秒', 1058, 2, NULL, NULL, NULL, 'highLowBin,secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13234, 10302, 'notReachedFlowTime', '未到续流时间', '单位:秒', 1060, 2, NULL, NULL, NULL, + 'highLowBin,secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13235, 10302, 'closeTime', '关井时间', '单位:秒', 1062, 2, NULL, NULL, NULL, 'highLowBin,secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13236, 10302, 'openTime', '开井时间', '单位:秒', 1064, 2, NULL, NULL, NULL, 'highLowBin,secondLocalTime'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13237, 10302, 'openPressure', '开井压力', '单位:MPa', 1066, 2, NULL, NULL, '%s.%s', 'wepsDecimal'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13238, 10302, 'closePressure', '关井压力', '单位:MPa', 1068, 2, NULL, NULL, '%s.%s', 'wepsDecimal'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13239, 10302, 'littleRisePressure', '微升压力', '单位:MPa', 1070, 2, NULL, NULL, '%s.%s', 'wepsDecimal'); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13240, 10302, 'gasCollectionMode', '集气模式', '0:低压集气模式;1:高压集气模式', 1072, 1, NULL, NULL, NULL, + NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13241, 10302, 'reserve2', '保留', NULL, 1073, 1, NULL, NULL, NULL, NULL); +INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`, + `precision`, `format`, `decode_name`) +VALUES (13242, 10302, 'protectionPressure', '保护压力', '单位:MPa', 1074, 2, NULL, NULL, '%s.%s', 'wepsDecimal'); \ No newline at end of file diff --git a/src/main/resources/mapper/DeviceDao.xml b/src/main/resources/mapper/DeviceDao.xml index bc7c042..9b871f6 100644 --- a/src/main/resources/mapper/DeviceDao.xml +++ b/src/main/resources/mapper/DeviceDao.xml @@ -88,15 +88,30 @@