Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-task-sxj
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2e61ce4e
authored
Apr 01, 2026
by
范富荣
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化对接思享驾接口逻辑
1 parent
b27a705b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
10 deletions
src/main/java/cn/com/glsx/schedulerjob/task/modules/service/AlarmJobService.java
src/main/java/cn/com/glsx/schedulerjob/task/modules/service/QyproAdminApiFacade.java
src/main/java/cn/com/glsx/schedulerjob/task/taskscheduler/RegularStopoverPointJob.java
src/test/java/cn/com/glsx/schedulerjob/task/modules/service/AlarmJobServiceTest.java
src/main/java/cn/com/glsx/schedulerjob/task/modules/service/AlarmJobService.java
View file @
2e61ce4
...
@@ -151,7 +151,13 @@ public class AlarmJobService {
...
@@ -151,7 +151,13 @@ public class AlarmJobService {
if
(
CollectionUtils
.
isNotEmpty
(
collect
))
{
if
(
CollectionUtils
.
isNotEmpty
(
collect
))
{
for
(
LightSensorAlarmItem
item
:
collect
)
{
for
(
LightSensorAlarmItem
item
:
collect
)
{
try
{
try
{
qyproAdminApiFacade
.
syncDeviceWarningContent
(
JSON
.
toJSONString
(
item
));
qyproAdminApiFacade
.
syncDeviceWarningContent
(
item
.
getId
(),
item
.
getImei
(),
item
.
getVinNumber
(),
String
.
valueOf
(
item
.
getMessDataType
()),
JSON
.
toJSONString
(
item
)
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"光敏预警同步第三方失败, item:{}"
,
item
,
e
);
log
.
error
(
"光敏预警同步第三方失败, item:{}"
,
item
,
e
);
}
}
...
@@ -269,7 +275,13 @@ public class AlarmJobService {
...
@@ -269,7 +275,13 @@ public class AlarmJobService {
}
}
for
(
AbnormalGatherAlarmItem
item
:
collect
)
{
for
(
AbnormalGatherAlarmItem
item
:
collect
)
{
try
{
try
{
qyproAdminApiFacade
.
syncDeviceWarningContent
(
JSON
.
toJSONString
(
item
));
qyproAdminApiFacade
.
syncDeviceWarningContent
(
item
.
getId
(),
item
.
getImei
(),
item
.
getVinNumber
(),
item
.
getMessDataType
(),
JSON
.
toJSONString
(
item
)
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"异常聚集预警同步第三方失败, item:{}"
,
item
,
e
);
log
.
error
(
"异常聚集预警同步第三方失败, item:{}"
,
item
,
e
);
}
}
...
@@ -310,7 +322,13 @@ public class AlarmJobService {
...
@@ -310,7 +322,13 @@ public class AlarmJobService {
}
}
for
(
BlackAreaWarnRequest
item
:
collect
)
{
for
(
BlackAreaWarnRequest
item
:
collect
)
{
try
{
try
{
qyproAdminApiFacade
.
syncDeviceWarningContent
(
JSON
.
toJSONString
(
item
));
qyproAdminApiFacade
.
syncDeviceWarningContent
(
item
.
getId
(),
item
.
getDeviceNumber
(),
item
.
getVinNumber
(),
String
.
valueOf
(
item
.
getMessDataType
()),
JSON
.
toJSONString
(
item
)
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"黑区预警同步第三方失败, item:{}"
,
item
,
e
);
log
.
error
(
"黑区预警同步第三方失败, item:{}"
,
item
,
e
);
}
}
...
@@ -345,8 +363,8 @@ public class AlarmJobService {
...
@@ -345,8 +363,8 @@ public class AlarmJobService {
public
void
sendDeviceLocation
(
String
date
)
{
public
void
sendDeviceLocation
(
String
date
)
{
Date
now
=
new
Date
();
Date
now
=
new
Date
();
if
(
StringUtils
.
isBlank
(
date
))
{
if
(
StringUtils
.
isBlank
(
date
))
{
//
取今日日期
//
默认取昨日
date
=
DateUtil
.
formatDate
(
now
);
date
=
DateUtil
.
formatDate
(
DateUtil
.
offsetDay
(
now
,
-
1
)
);
}
}
String
beginTime
=
date
+
" 00:00:00"
;
String
beginTime
=
date
+
" 00:00:00"
;
String
endTime
=
date
+
" 23:59:59"
;
String
endTime
=
date
+
" 23:59:59"
;
...
@@ -411,7 +429,10 @@ public class AlarmJobService {
...
@@ -411,7 +429,10 @@ public class AlarmJobService {
}
}
DateTime
parse
=
DateUtil
.
parse
(
trackPointDTO
.
getDateTime
());
DateTime
parse
=
DateUtil
.
parse
(
trackPointDTO
.
getDateTime
());
dataItem
.
setT
(
parse
.
getTime
());
dataItem
.
setT
(
parse
.
getTime
());
//增加电量判空
if
(
x
.
getSoc
()
!=
null
)
{
dataItem
.
setBat
(
x
.
getSoc
());
dataItem
.
setBat
(
x
.
getSoc
());
}
return
dataItem
;
return
dataItem
;
}).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
}).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
// 发送 GPS 信息同步请求(第三方接口支持 Token 认证)
// 发送 GPS 信息同步请求(第三方接口支持 Token 认证)
...
...
src/main/java/cn/com/glsx/schedulerjob/task/modules/service/QyproAdminApiFacade.java
View file @
2e61ce4
...
@@ -39,14 +39,29 @@ public class QyproAdminApiFacade implements DisposableBean {
...
@@ -39,14 +39,29 @@ public class QyproAdminApiFacade implements DisposableBean {
/**
/**
* 预警信息内容格式同步:POST {@value #API_DEVICE_WARNING_CONTENT},Token 模式(与 {@link ApiClient#main} 示例一致)。
* 预警信息内容格式同步: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 或解析失败
* @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
();
ApiClient
client
=
getOrCreateClient
();
if
(
client
==
null
)
{
if
(
client
==
null
)
{
return
;
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
++)
{
for
(
int
attempt
=
1
;
attempt
<=
WARNING_CONTENT_MAX_ATTEMPTS
;
attempt
++)
{
log
.
info
(
"Qypro warning-content 请求 attempt={}/{} api={} body={}"
,
log
.
info
(
"Qypro warning-content 请求 attempt={}/{} api={} body={}"
,
attempt
,
WARNING_CONTENT_MAX_ATTEMPTS
,
API_DEVICE_WARNING_CONTENT
,
jsonBody
);
attempt
,
WARNING_CONTENT_MAX_ATTEMPTS
,
API_DEVICE_WARNING_CONTENT
,
jsonBody
);
...
...
src/main/java/cn/com/glsx/schedulerjob/task/taskscheduler/RegularStopoverPointJob.java
View file @
2e61ce4
...
@@ -23,7 +23,7 @@ public class RegularStopoverPointJob implements SimpleJob {
...
@@ -23,7 +23,7 @@ public class RegularStopoverPointJob implements SimpleJob {
try
{
try
{
log
.
info
(
"开始推送车辆常停地,参数:{}"
,
shardingContext
.
getJobParameter
());
log
.
info
(
"开始推送车辆常停地,参数:{}"
,
shardingContext
.
getJobParameter
());
// 处理数据
// 处理数据
alarmJobService
.
sendRegularStopoverPointData
();
//
alarmJobService.sendRegularStopoverPointData();
log
.
info
(
"推送车辆常停地完成,参数:{}"
,
shardingContext
.
getJobParameter
());
log
.
info
(
"推送车辆常停地完成,参数:{}"
,
shardingContext
.
getJobParameter
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"推送车辆常停地异常,参数:{}"
,
shardingContext
.
getJobParameter
(),
e
);
log
.
error
(
"推送车辆常停地异常,参数:{}"
,
shardingContext
.
getJobParameter
(),
e
);
...
...
src/test/java/cn/com/glsx/schedulerjob/task/modules/service/AlarmJobServiceTest.java
View file @
2e61ce4
...
@@ -40,7 +40,7 @@ public class AlarmJobServiceTest {
...
@@ -40,7 +40,7 @@ public class AlarmJobServiceTest {
@Test
@Test
public
void
testSendAggregateAlarmMsg
()
{
public
void
testSendAggregateAlarmMsg
()
{
alarmJobService
.
sendAggregateAlarmMsg
(
null
,
2
);
alarmJobService
.
sendAggregateAlarmMsg
(
null
,
3
);
}
}
@Test
@Test
...
@@ -59,7 +59,8 @@ public class AlarmJobServiceTest {
...
@@ -59,7 +59,8 @@ public class AlarmJobServiceTest {
@Test
@Test
public
void
testSendDeviceLocation
()
{
public
void
testSendDeviceLocation
()
{
String
date
=
"2025-12-01"
;
String
date
=
"2025-02-20"
;
String
sn
=
"1510922145"
;
alarmJobService
.
sendDeviceLocation
(
date
);
alarmJobService
.
sendDeviceLocation
(
date
);
}
}
...
...
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