20260729:平台对接优化
This commit is contained in:
parent
7877a3ccec
commit
f05b96b43a
@ -30,7 +30,11 @@
|
||||
"Bash(sips:*)",
|
||||
"Bash(mysql -h localhost -u root -pfastbee fastbee -e \"SELECT id, name, config_json FROM bridge WHERE id = 9;\")",
|
||||
"Bash(mysql:*)",
|
||||
"Bash(git:*)"
|
||||
"Bash(git:*)",
|
||||
"mcp__filesystem__search_files",
|
||||
"Bash(grep:*)",
|
||||
"mcp__filesystem__list_directory_with_sizes",
|
||||
"Bash(find /Users/admin/IdeaProjects/fastbee -type d -name *oss* -o -type d -name *storage* -o -type d -name *plugs*)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,8 +8,10 @@ TARGET_PORT = 8888 # 请根据实际情况修改
|
||||
|
||||
# 元数组 modbus 指令
|
||||
MODBUS_DATA_HEX = (
|
||||
"7e80D20C4C6A55D57e",
|
||||
"01030400110018AA3C"
|
||||
"7e80D9A718F9362A7e",
|
||||
"0103204135317841ab8e39bf27bccd3f1fb19ac2b231bbc0b6f82040ae3207c3f9f80efa23",
|
||||
"020320413b9fa441acd34dc0024a003fa2a59ac2af34a0c18e17ea413167dbc3f9c7fe6d40",
|
||||
"0303204139565641ab21ddbff6af333fe26800c2aec626c18685244176ee82c3f9bd7568c8",
|
||||
)
|
||||
|
||||
# 重要-四川远德MQTT推送
|
||||
|
||||
@ -33,11 +33,13 @@ Content-Length: 0\r
|
||||
IP_POOL = ("1.113.12.33","1.113.12.34","1.113.12.35")
|
||||
|
||||
if __name__ == "__main__":
|
||||
TARGET_IP = "127.0.0.1" # 本地测试
|
||||
|
||||
LOCAL_IP = "1.113.12.33" # 模拟IP
|
||||
TARGET_IP = "127.0.0.1" # 本地测试(服务器地址)
|
||||
TARGET_PORT = 5061 # SIP端口
|
||||
|
||||
# 模拟攻击:连续发送20个请求
|
||||
for i in range(100):
|
||||
for i in range(50):
|
||||
sip_id = str(7000 + i)
|
||||
response = send_sip_register(TARGET_IP, TARGET_PORT, sip_id)
|
||||
print(f"[{sip_id}] {response.split(chr(13))[0] if response else 'No response'}")
|
||||
@ -128,14 +128,15 @@ public class PlatformPushScheduledJob {
|
||||
return;
|
||||
}
|
||||
|
||||
Date dataTime = resolveLatestDataTime(mapping);
|
||||
// 数据库 last_push_time 为 DATETIME(秒精度),此处截断毫秒,
|
||||
// 避免 Redis 中带毫秒的时间与库中已截断的时间比较时误判为"数据变化"而重复推送
|
||||
Date dataTime = truncateToSeconds(resolveLatestDataTime(mapping));
|
||||
if (dataTime == null) {
|
||||
log.warn("[PlatformPushJob] 设备 {} 无有效数据时间,跳过推送", mapping.getSerialNumber());
|
||||
return;
|
||||
}
|
||||
if (mapping.getLastPushTime() != null && !dataTime.after(mapping.getLastPushTime())) {
|
||||
log.info("[PlatformPushJob] 数据未变化,跳过重复推送 mappingId={} dataTime={} lastPushTime={}",
|
||||
mapping.getId(), dataTime, mapping.getLastPushTime());
|
||||
log.info("[PlatformPushJob] 数据未变化,跳过重复推送 mappingId={} dataTime={} lastPushTime={}", mapping.getId(), dataTime, mapping.getLastPushTime());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -320,4 +321,14 @@ public class PlatformPushScheduledJob {
|
||||
}
|
||||
return interfaceMapper.selectById(mapping.getPushInterfaceId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 截断毫秒,与 DATETIME 字段的存储精度保持一致
|
||||
*/
|
||||
private Date truncateToSeconds(Date date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
return new Date(date.getTime() / 1000 * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user