新增老版维尔普斯数据解析入库逻辑

This commit is contained in:
wangshilong 2025-02-22 02:13:22 +08:00
parent 4841c936b2
commit 686a200dd6
18 changed files with 908 additions and 21 deletions

View File

@ -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:";

View File

@ -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 <a href="mailto:shilong.wang@alpha-ess.com">王仕龙</a>
* 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<String, Object> 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<String, Object> commandPointMap, ModbusMessage.MessagePoint point) {
point.setValue(this.decode(commandPointMap, point.getValue()));
}
}

View File

@ -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 <a href="mailto:shilong.wang@alpha-ess.com">王仕龙</a>
* 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<String, Object> 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<String, Object> commandPointMap, ModbusMessage.MessagePoint point) {
point.setValue(this.decode(commandPointMap, point.getValue()));
}
}

View File

@ -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 <a href="mailto:shilong.wang@alpha-ess.com">王仕龙</a>
* 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<String, Object> 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<String, Object> commandPointMap, ModbusMessage.MessagePoint point) {
point.setValue(this.decode(commandPointMap, point.getValue()));
}
}

View File

@ -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 <a href="mailto:shilong.wang@alpha-ess.com">王仕龙</a>
* 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<String, Object> 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<String, Object> commandPointMap, ModbusMessage.MessagePoint point) {
point.setValue(this.decode(commandPointMap, point.getValue()));
}
}

View File

@ -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 <a href="mailto:shilong.wang@alpha-ess.com">王仕龙</a>
* 2025/2/22 01:07
*/
@Component(PersistenceHandler.MI_WEPS_PLUG_MODBUS_TYPE)
public class MiWepsPlugPersistenceHandler extends AbstractPersistenceHandler {
private static final Map<String, String> 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<String, Map<String, Object>> insert(String tableName, String cacheKey) {
String insertTableSQL = this.getResource("sql/INSERT_MI_WEPS_PLUG.sql");
insertTableSQL = StringUtils.replace(insertTableSQL, "$TableName$", tableName);
Map<String, Object> oldRow = this.getLastRow(tableName);
Map<String, Object> newRow = this.redisTemplate.opsForHash().entries(cacheKey);
this.jdbcTemplate.execute(insertTableSQL, new PreparedStatementCallback<Object>() {
@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<String, String> getColumnMappingMap() {
return MI_WEPS_PLUG_COLUMN_MAPPING_MAP;
}
}

View File

@ -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<DeviceDao, Device> 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<String, Dictionary> 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<DeviceDao, Device> 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<String, Dictionary> plugStatusMap = this.dictionaryService.getValueMapByType("plugStatus");

View File

@ -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;
}

View File

@ -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);

View File

@ -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 <a href="mailto:scwsl@foxmail.com">王仕龙</a>
* 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<ModbusCommandDto> builderModbusCommand() {
return List.of(ModbusCommandDto.builder().command("010600400002").length(16).build());
}
}

View File

@ -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 <a href="mailto:scwsl@foxmail.com">王仕龙</a>
* 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<ModbusCommandDto> builderModbusCommand() {
return List.of(ModbusCommandDto.builder().command("010600400001").length(16).build());
}
}

View File

@ -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');

View File

@ -88,15 +88,30 @@
<select id="historyPage" resultType="com.isu.gaswellwatch.vo.DeviceHistoryVO">
select t.collection_time,t.oil_pressure,t.cas_pressure,t.pre_pressure
<if test="deviceProduct!=null and deviceProduct=='knpc'">
,t.run_mode,t.status_end_time,t.temperature,t.humidity,t.well_status,t.plug_status
</if>
<if test="deviceProduct!=null and deviceProduct=='etc'">,t.current_status_remaining_time as
statusEndTime,t.controller_current_status as runMode,t.solenoid_valve_status as wellStatus
</if>
<if test="deviceProduct!=null and deviceProduct=='scss'">,t.ctl_model as runMode,t.remaining_time_action as
statusEndTime,t.solar_voltage,t.first_solenoid_status as wellStatus
</if>
<choose>
<when test="deviceProduct!=null and deviceProduct=='knpc'">
,'knpc' as type,t.run_mode,t.status_end_time,t.temperature,t.humidity,t.well_status,t.plug_status
</when>
<when test="deviceProduct!=null and deviceProduct=='etc'">
,'etc' as type,t.current_status_remaining_time as statusEndTime
,t.controller_current_status as runMode,t.solenoid_valve_status as wellStatus
</when>
<when test="deviceProduct!=null and deviceProduct=='scss'">
,'scss' as type,t.ctl_model as runMode,t.remaining_time_action as statusEndTime
,t.solar_voltage,t.first_solenoid_status as wellStatus
</when>
<when test="deviceProduct!=null and deviceProduct=='weps_plug'">
,'weps_plug' as type,case t.run_mode as runMode
,case t.solenoid_valve_status when 2 then t.open_well_remaining_time
when 1 then t.close_well_remaining_time else null end as statusEndTime
,case t.solenoid_valve_status when 2 then 0 when 1 then 1 else null end as wellStatus
</when>
<when test="deviceProduct!=null and deviceProduct=='mi_weps_plug'">
,t.produce_mode as runMode,t.remaining_time as statusEndTime
,case t.current_status when 0 then 0 else 1 end as wellStatus
,t.current_status as plugStatus
</when>
</choose>
from ${tableName} t
<where>
t.device_id = #{deviceId}
@ -184,11 +199,15 @@
,t.solar_voltage,t.first_solenoid_status as wellStatus
</when>
<when test="deviceProduct!=null and deviceProduct=='weps_plug'">
,'weps_plug' as type,case t.run_mode when 1 then '定时开关井模式'
when 2 then '压力优化微升模式' when 3 then '自动优化模式' else '未知' end as runMode
,'weps_plug' as type,case t.run_mode as runMode
,case t.solenoid_valve_status when 2 then t.open_well_remaining_time
when 1 then t.close_well_remaining_time else null end as statusEndTime
,case t.solenoid_valve_status when 2 then '关井' when 1 then '开井' else null end as wellStatus
,case t.solenoid_valve_status when 2 then 0 when 1 then 1 else null end as wellStatus
</when>
<when test="deviceProduct!=null and deviceProduct=='mi_weps_plug'">
,t.produce_mode as runMode,t.remaining_time as statusEndTime
,case t.current_status when 0 then 0 else 1 end as wellStatus
,t.current_status as plugStatus
</when>
</choose>
from ${tableName} t

View File

@ -0,0 +1,64 @@
CREATE TABLE `$TableName$`
(
`id` bigint NOT NULL COMMENT '主键',
`device_id` int NOT NULL COMMENT '设备标识',
`created_time` datetime NOT NULL COMMENT '数据落库时间',
`collection_time` datetime NOT NULL COMMENT '采集指令下发时间',
`receive_time` datetime NOT NULL COMMENT '接收到数据时间',
`report_status` int NULL DEFAULT NULL COMMENT '报表状态 - 0:无报表数据; 1:有分钟记录; 2:有小时记录; 3:有日志记录; 4:有生产记录',
`current_status` int NULL DEFAULT NULL COMMENT '当前状态 - 0:关井; 1:上升; 2:续流; 3:停机',
`current_time` datetime NULL DEFAULT NULL COMMENT '当前时间 - "控制器时间。示例0x4830:0x0211:0x0924:0x2013。结果2013-09-24 11:48:30"',
`remaining_time` varchar(10) NULL DEFAULT NULL COMMENT '剩余时间 - "组合后时间格式:天.小时:分钟:秒。示例0x0930:0x0001。结果0.1:09:30"',
`current_status_0x` varchar(10) NULL DEFAULT NULL COMMENT '当前状态0x - 0x8000:关井0x8001:上升0x8002:续流0x8003:停机',
`oil_pressure` decimal(12, 4) NULL DEFAULT NULL COMMENT '油压 - 单位MPa',
`oil_pressure_temperature` decimal(12, 4) NULL DEFAULT NULL COMMENT '油压表测量温度 - 单位:℃',
`cas_pressure` decimal(12, 4) NULL DEFAULT NULL COMMENT '套压 - 单位MPa',
`cas_pressure_temperature` decimal(12, 4) NULL DEFAULT NULL COMMENT '套压测量温度 - 单位:℃',
`quantity_of_electricity` decimal(12, 4) NULL DEFAULT NULL COMMENT '控制器电量 - 单位:%',
`pluger_rising_speed` decimal(12, 4) NULL DEFAULT NULL COMMENT '柱塞上升速度 - 单位:米/分钟',
`gas_well_number` int NULL DEFAULT NULL COMMENT '气井编号',
`depth_of_lock_device` int NULL DEFAULT NULL COMMENT '卡定器深度 - 单位:米',
`arriving_sensor` int NULL DEFAULT NULL COMMENT '到达传感器 - 0/1禁用/启用',
`zigbee` int NULL DEFAULT NULL COMMENT 'Zigbee - 0/1禁用/启用',
`pulse_width` int NULL DEFAULT NULL COMMENT '脉冲宽度 - 驱动电磁阀使用',
`plug_rising_speed` int NULL DEFAULT NULL COMMENT '上升速度 - 米/分钟',
`plug_too_fast_speed` int NULL DEFAULT NULL COMMENT '过快速度 - 米/分钟',
`plug_too_slow_speed` int NULL DEFAULT NULL COMMENT '过缓速度 - 米/分钟',
`gas_well_name` varchar(100) NULL DEFAULT NULL COMMENT '气井名称',
`oil_and_cas_data_collection_interval` int NULL DEFAULT NULL COMMENT '油、套压数据采集间隔 - 0每5秒采样1每10秒采样2每15秒采样3每30秒采样4每1秒采样5每2秒采样6每3秒采样7每4秒采样',
`store_data_interval_on_open_well` int NULL DEFAULT NULL COMMENT '数据存储间隔(开井期间) - 0每1分钟存储1每5分钟存储2每10分钟存储3每15分钟存储4每30秒存储5每15秒存储6每5秒存储',
`store_data_interval_on_close_well` int NULL DEFAULT NULL COMMENT '数据存储间隔(关井期间) - 0每1分钟存储1每5分钟存储2每10分钟存储3每15分钟存储4每30秒存储5每15秒存储6每5秒存储',
`communication_power_threshold` decimal(12, 4) NULL DEFAULT NULL COMMENT '通信电量门限 - Zigbee通讯使用',
`reserve1` int NULL DEFAULT NULL COMMENT '保留 - Zigbee通讯使用',
`start_time_of_daytime` int NULL DEFAULT NULL COMMENT '白天起始时间 - Zigbee通讯使用',
`end_time_of_daytime` int NULL DEFAULT NULL COMMENT '白天结束时间 - Zigbee通讯使用',
`control_work_time` int NULL DEFAULT NULL COMMENT '控制器工作状态 - 0生产模式1常开模式2常关模式',
`produce_mode` int NULL DEFAULT NULL COMMENT '生产制度设置 - 0定时开关井1时间优化模式2压力微升模式3压力回升模式4压力跌落模式',
`plunger_rise_time` varchar(10) NULL DEFAULT NULL COMMENT '上升时间 - 单位:秒',
`dangerous_rise_time` varchar(10) NULL DEFAULT NULL COMMENT '危险上升时间 - 单位:秒',
`too_fast_rise_time` varchar(10) NULL DEFAULT NULL COMMENT '过快上升时间 - 单位:秒',
`too_slow_rise_time` varchar(10) NULL DEFAULT NULL COMMENT '过缓上升时间 - 单位:秒',
`too_fast_count` int NULL DEFAULT NULL COMMENT '过快次数',
`too_fast_raise_open_well_time` varchar(10) NULL DEFAULT NULL COMMENT '过快增加开井时间 - 单位:秒',
`too_fast_lower_close_well_time` varchar(10) NULL DEFAULT NULL COMMENT '过快减少关井时间 - 单位:秒',
`too_slow_lower_open_well_time` varchar(10) NULL DEFAULT NULL COMMENT '过缓减少开井时间 - 单位:秒',
`too_slow_raise_close_well_time` varchar(10) NULL DEFAULT NULL COMMENT '过缓增加关井时间 - 单位:秒',
`check_stability_time` varchar(10) NULL DEFAULT NULL COMMENT '检测稳定时间 - 单位:秒',
`min_close_well_time` varchar(10) NULL DEFAULT NULL COMMENT '最小关井时间 - 单位:秒',
`max_close_well_time` varchar(10) NULL DEFAULT NULL COMMENT '最大关井时间 - 单位:秒',
`well_close_time_not_reached_duration` varchar(10) NULL DEFAULT NULL COMMENT '未到达关井时间 - 单位:秒',
`min_open_well_time` varchar(10) NULL DEFAULT NULL COMMENT '最小开井时间 - 单位:秒',
`max_open_well_time` varchar(10) NULL DEFAULT NULL COMMENT '最大开井时间 - 单位:秒',
`after_flow_time` varchar(10) NULL DEFAULT NULL COMMENT '续流时间 - 单位:秒',
`not_reached_flow_time` varchar(10) NULL DEFAULT NULL COMMENT '未到续流时间 - 单位:秒',
`close_time` varchar(10) NULL DEFAULT NULL COMMENT '关井时间 - 单位:秒',
`open_time` varchar(10) NULL DEFAULT NULL COMMENT '开井时间 - 单位:秒',
`open_pressure` decimal(12, 4) NULL DEFAULT NULL COMMENT '开井压力 - 单位MPa',
`close_pressure` decimal(12, 4) NULL DEFAULT NULL COMMENT '关井压力 - 单位MPa',
`little_rise_pressure` decimal(12, 4) NULL DEFAULT NULL COMMENT '微升压力 - 单位MPa',
`gas_collection_mode` int NULL DEFAULT NULL COMMENT '集气模式 - 0低压集气模式1高压集气模式',
`reserve2` int NULL DEFAULT NULL COMMENT '保留',
`protection_pressure` decimal(12, 4) NULL DEFAULT NULL COMMENT '保护压力 - 单位MPa',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `udx_device_create_time` (`device_id` ASC, `collection_time` ASC) USING BTREE COMMENT '设备采集数据唯一键'
) ENGINE = InnoDB COMMENT = '维尔普斯设备ID$DeviceId$的采集数据'

View File

@ -0,0 +1,75 @@
INSERT INTO `$TableName$`(`id`, `device_id`, `created_time`, `collection_time`, `receive_time`, `report_status`,
`current_status`, `current_time`, `remaining_time`, `current_status_0x`,
`oil_pressure`, `oil_pressure_temperature`, `cas_pressure`, `cas_pressure_temperature`,
`quantity_of_electricity`, `pluger_rising_speed`, `gas_well_number`, `depth_of_lock_device`,
`arriving_sensor`, `zigbee`, `pulse_width`, `plug_rising_speed`, `plug_too_fast_speed`,
`plug_too_slow_speed`, `gas_well_name`, `oil_and_cas_data_collection_interval`,
`store_data_interval_on_open_well`, `store_data_interval_on_close_well`,
`communication_power_threshold`, `reserve1`, `start_time_of_daytime`,
`end_time_of_daytime`, `control_work_time`, `produce_mode`, `plunger_rise_time`,
`dangerous_rise_time`, `too_fast_rise_time`, `too_slow_rise_time`, `too_fast_count`,
`too_fast_raise_open_well_time`, `too_fast_lower_close_well_time`,
`too_slow_lower_open_well_time`, `too_slow_raise_close_well_time`,
`check_stability_time`, `min_close_well_time`, `max_close_well_time`,
`well_close_time_not_reached_duration`, `min_open_well_time`,
`max_open_well_time`, `after_flow_time`, `not_reached_flow_time`, `close_time`,
`open_time`, `open_pressure`, `close_pressure`, `little_rise_pressure`, `gas_collection_mode`,
`reserve2`, `protection_pressure`)
VALUES (?, ?, NOW(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON DUPLICATE KEY
UPDATE receive_time =
VALUES (receive_time), report_status =
VALUES (report_status), current_status =
VALUES (current_status), `current_time` =
VALUES (`current_time`), remaining_time =
VALUES (remaining_time), current_status_0x =
VALUES (current_status_0x), oil_pressure =
VALUES (oil_pressure), oil_pressure_temperature =
VALUES (oil_pressure_temperature), cas_pressure =
VALUES (cas_pressure), cas_pressure_temperature =
VALUES (cas_pressure_temperature), quantity_of_electricity =
VALUES (quantity_of_electricity), pluger_rising_speed =
VALUES (pluger_rising_speed), gas_well_number =
VALUES (gas_well_number), depth_of_lock_device =
VALUES (depth_of_lock_device), arriving_sensor =
VALUES (arriving_sensor), zigbee =
VALUES (zigbee), pulse_width =
VALUES (pulse_width), plug_rising_speed =
VALUES (plug_rising_speed), plug_too_fast_speed =
VALUES (plug_too_fast_speed), plug_too_slow_speed =
VALUES (plug_too_slow_speed), gas_well_name =
VALUES (gas_well_name), oil_and_cas_data_collection_interval =
VALUES (oil_and_cas_data_collection_interval), store_data_interval_on_open_well =
VALUES (store_data_interval_on_open_well), store_data_interval_on_close_well =
VALUES (store_data_interval_on_close_well), communication_power_threshold =
VALUES (communication_power_threshold), reserve1 =
VALUES (reserve1), start_time_of_daytime =
VALUES (start_time_of_daytime), end_time_of_daytime =
VALUES (end_time_of_daytime), control_work_time =
VALUES (control_work_time), produce_mode =
VALUES (produce_mode), plunger_rise_time =
VALUES (plunger_rise_time), dangerous_rise_time =
VALUES (dangerous_rise_time), too_fast_rise_time =
VALUES (too_fast_rise_time), too_slow_rise_time =
VALUES (too_slow_rise_time), too_fast_count =
VALUES (too_fast_count), too_fast_raise_open_well_time =
VALUES (too_fast_raise_open_well_time), too_fast_lower_close_well_time =
VALUES (too_fast_lower_close_well_time), too_slow_lower_open_well_time =
VALUES (too_slow_lower_open_well_time), too_slow_raise_close_well_time =
VALUES (too_slow_raise_close_well_time), check_stability_time =
VALUES (check_stability_time), min_close_well_time =
VALUES (min_close_well_time), max_close_well_time =
VALUES (max_close_well_time), well_close_time_not_reached_duration =
VALUES (well_close_time_not_reached_duration), min_open_well_time =
VALUES (min_open_well_time), max_open_well_time =
VALUES (max_open_well_time), after_flow_time =
VALUES (after_flow_time), not_reached_flow_time =
VALUES (not_reached_flow_time), close_time =
VALUES (close_time), open_time =
VALUES (open_time), open_pressure =
VALUES (open_pressure), close_pressure =
VALUES (close_pressure), little_rise_pressure =
VALUES (little_rise_pressure), gas_collection_mode =
VALUES (gas_collection_mode), reserve2 =
VALUES (reserve2), protection_pressure =
VALUES (protection_pressure)

View File

@ -0,0 +1,13 @@
package com.isu.gaswellwatch;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class GasWellWatchApplication {
public static void main(String[] args) {
SpringApplication.run(GasWellWatchApplication.class, args);
}
}

View File

@ -0,0 +1,38 @@
package com.isu.gaswellwatch;
import com.isu.gaswellwatch.modbus.data.listener.DynamicRabbitListener;
import jakarta.annotation.Resource;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
/**
* @author <a href="mailto:shilong.wang@alpha-ess.com">王仕龙</a>
* 2025/2/20 21:13
*/
@SpringBootTest
@ActiveProfiles("test")
public class WrpsDecodeTest {
private String message = "562E53352E31332E34305831/50001/10300/1740053970000/1740053974379/01034001D4017300000001000003F10000000000920000000000000000000100020002000000000032000000000078052801F40032003C003C00780019003C0CE20003FE8C";
@Resource
private DynamicRabbitListener dynamicRabbitListener;
@Test
public void testWrpsDecode() {
Message testMessage = Mockito.mock(Message.class);
MessageProperties testMessageProperties = Mockito.mock(MessageProperties.class);
Mockito.doReturn(this.message.getBytes()).when(testMessage).getBody();
Mockito.doReturn(testMessageProperties).when(testMessage).getMessageProperties();
Mockito.doReturn("/modbus/collect/0").when(testMessageProperties).getConsumerQueue();
this.dynamicRabbitListener.getComposeListener().onMessage(testMessage);
}
}

View File

@ -0,0 +1,7 @@
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://localhost:3306/gas_well_watch?characterEncoding=UTF-8&useUnicode=true&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: dev
password: 1qaz@WSX
driver-class-name: com.mysql.cj.jdbc.Driver