Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-standard-interfaces
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d55c9020
authored
Apr 01, 2026
by
范富荣
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化对接思享驾接口逻辑
1 parent
0299db72
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
8 deletions
src/main/java/cn/com/glsx/stdinterface/modules/service/AlarmElectricFenceService.java
src/main/java/cn/com/glsx/stdinterface/modules/service/AlarmWarnAnalyseService.java
src/main/java/cn/com/glsx/stdinterface/modules/service/QyproAdminApiFacade.java
src/main/java/cn/com/glsx/stdinterface/modules/service/VehicleDeviceService.java
src/main/resources/mapper/VehicleDeviceMapper.xml
src/test/java/cn/com/glsx/stdinterface/modules/service/VehicleDeviceServiceTest.java
src/main/java/cn/com/glsx/stdinterface/modules/service/AlarmElectricFenceService.java
View file @
d55c902
...
...
@@ -241,7 +241,13 @@ public class AlarmElectricFenceService {
x
.
setIsAlarm
(
1
);
//发送请求
try
{
qyproAdminApiFacade
.
syncDeviceWarningContent
(
JSON
.
toJSONString
(
x
));
qyproAdminApiFacade
.
syncDeviceWarningContent
(
x
.
getId
(),
x
.
getImei
(),
x
.
getVinNumber
(),
String
.
valueOf
(
x
.
getMessDataType
()),
JSON
.
toJSONString
(
x
)
);
}
catch
(
Exception
e
)
{
log
.
error
(
"围栏报警第三方同步失败, item={}"
,
x
,
e
);
}
...
...
src/main/java/cn/com/glsx/stdinterface/modules/service/AlarmWarnAnalyseService.java
View file @
d55c902
...
...
@@ -158,10 +158,13 @@ public class AlarmWarnAnalyseService {
log
.
info
(
"日期[{}],查询设备分离报警数据结束, 当前pageNum[{}]"
,
date
,
pageNum
);
break
;
}
List
<
String
>
snList
=
deviceSeparationAlarmList
.
stream
().
flatMap
(
x
->
{
List
<
String
>
snList
=
deviceSeparationAlarmList
.
stream
().
f
ilter
(
x
->
StringUtils
.
isNotBlank
(
x
.
getDeviceInfo
())).
f
latMap
(
x
->
{
String
[]
split
=
x
.
getDeviceInfo
().
split
(
";"
);
return
Arrays
.
stream
(
split
);
}).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
snList
))
{
continue
;
}
//根据设备号查询设备信息
List
<
Device
>
devices
=
deviceMapper
.
selectBySns
(
snList
);
Map
<
String
,
Device
>
deviceMap
=
new
HashMap
<>();
...
...
@@ -170,7 +173,7 @@ public class AlarmWarnAnalyseService {
deviceMap
=
devices
.
stream
().
collect
(
Collectors
.
toMap
(
Device:
:
getSn
,
Function
.
identity
()));
}
Map
<
String
,
Device
>
finalDeviceMap
=
deviceMap
;
deviceSeparationAlarmList
.
forEach
(
x
->
{
deviceSeparationAlarmList
.
stream
().
filter
(
x
->
StringUtils
.
isNotBlank
(
x
.
getDeviceInfo
())).
forEach
(
x
->
{
String
[]
split
=
x
.
getDeviceInfo
().
split
(
";"
);
for
(
String
rawSn
:
split
)
{
String
sn
=
StringUtils
.
trimToEmpty
(
rawSn
);
...
...
@@ -192,7 +195,13 @@ public class AlarmWarnAnalyseService {
}
}
try
{
qyproAdminApiFacade
.
syncDeviceWarningContent
(
JSON
.
toJSONString
(
item
));
qyproAdminApiFacade
.
syncDeviceWarningContent
(
item
.
getId
(),
item
.
getImei
(),
item
.
getVinNumber
(),
item
.
getMessDataType
(),
JSON
.
toJSONString
(
item
)
);
}
catch
(
Exception
e
)
{
log
.
error
(
"设备分离预警同步第三方失败, item:{}"
,
item
,
e
);
}
...
...
src/main/java/cn/com/glsx/stdinterface/modules/service/QyproAdminApiFacade.java
View file @
d55c902
...
...
@@ -38,14 +38,29 @@ public class QyproAdminApiFacade implements DisposableBean {
/**
* 预警信息内容格式同步:POST {@value #API_DEVICE_WARNING_CONTENT},Token 模式(与 {@link ApiClient#main} 示例一致)。
*
* @param jsonBody application/json 请求体
* @param id 设备ID
* @param imei IMEI号
* @param vinNumber VIN号
* @param messDataType 消息类型
* @param contentJson 内容JSON
* @throws ApiClient.ApiException 业务 code 非 200 或解析失败
*/
public
void
syncDeviceWarningContent
(
String
jsonBody
)
{
public
void
syncDeviceWarningContent
(
String
id
,
String
imei
,
String
vinNumber
,
String
messDataType
,
String
contentJson
)
{
if
(
StringUtils
.
isAnyBlank
(
id
,
imei
,
vinNumber
))
{
log
.
warn
(
"Qypro warning-content 参数缺失,跳过请求 id={}, imei={}, vinNumber={}"
,
id
,
imei
,
vinNumber
);
return
;
}
ApiClient
client
=
getOrCreateClient
();
if
(
client
==
null
)
{
return
;
}
JSONObject
payload
=
new
JSONObject
();
payload
.
put
(
"id"
,
id
);
payload
.
put
(
"imei"
,
imei
);
payload
.
put
(
"vin_number"
,
vinNumber
);
payload
.
put
(
"mess_data_type"
,
messDataType
);
payload
.
put
(
"content"
,
contentJson
);
String
jsonBody
=
payload
.
toJSONString
();
for
(
int
attempt
=
1
;
attempt
<=
WARNING_CONTENT_MAX_ATTEMPTS
;
attempt
++)
{
log
.
info
(
"Qypro warning-content 请求 attempt={}/{} api={} body={}"
,
attempt
,
WARNING_CONTENT_MAX_ATTEMPTS
,
API_DEVICE_WARNING_CONTENT
,
jsonBody
);
...
...
src/main/java/cn/com/glsx/stdinterface/modules/service/VehicleDeviceService.java
View file @
d55c902
...
...
@@ -243,7 +243,13 @@ public class VehicleDeviceService {
}
//发送请求
try
{
qyproAdminApiFacade
.
syncDeviceWarningContent
(
JSON
.
toJSONString
(
offlineAlarmInfo
));
qyproAdminApiFacade
.
syncDeviceWarningContent
(
offlineAlarmInfo
.
getId
(),
offlineAlarmInfo
.
getImei
(),
offlineAlarmInfo
.
getVinNumber
(),
offlineAlarmInfo
.
getMessDataType
(),
JSON
.
toJSONString
(
offlineAlarmInfo
)
);
}
catch
(
Exception
e
)
{
log
.
error
(
"离线报警第三方同步失败, item:{}"
,
offlineAlarmInfo
,
e
);
}
...
...
src/main/resources/mapper/VehicleDeviceMapper.xml
View file @
d55c902
...
...
@@ -199,7 +199,7 @@
select tvd.sn, tv.vin,tvd.wire_type as wireType,tdp.soc, tvd.created_date as createDate
from t_vehicle tv
left join t_vehicle_device tvd on tv.id =tvd.vehicle_id
left join t_device_power tdp on tvd.sn = tdp.sn and tdp.del_flag = 0
left join t_device_power tdp on tvd.sn = tdp.sn and tdp.del_flag = 0
and tdp.vd_id = tvd.id
where tvd.del_flag = 0
and tv.created_by in (
select id from t_user tu where tu.tenant_id =#{tenantId} and tu.del_flag =0
...
...
src/test/java/cn/com/glsx/stdinterface/modules/service/VehicleDeviceServiceTest.java
View file @
d55c902
...
...
@@ -37,4 +37,9 @@ public class VehicleDeviceServiceTest {
public
void
testPushSXJOfflineAlarmData
()
throws
Exception
{
Boolean
flag
=
vehicleDeviceService
.
pushSXJOfflineAlarmData
(
null
);
}
@Test
public
void
testPushSXJDeviceSeparationAlarmData
()
throws
Exception
{
Boolean
flag
=
vehicleDeviceService
.
pushSXJDeviceSeparationAlarmData
(
null
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment