Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rpc-dj-strategy
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 8b7d102b
authored
Jun 26, 2026
by
章家宝
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:新增自定义参数
1 parent
957d6d1e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
8 deletions
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/job/InspectionCustomerTagJob.java
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/InspectionCustomerTagSyncService.java
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/job/InspectionCustomerTagJob.java
View file @
8b7d102
...
@@ -29,7 +29,8 @@ public class InspectionCustomerTagJob implements SimpleJob {
...
@@ -29,7 +29,8 @@ public class InspectionCustomerTagJob implements SimpleJob {
public
void
execute
(
ShardingContext
shardingContext
)
{
public
void
execute
(
ShardingContext
shardingContext
)
{
log
.
info
(
"AI客户标签同步定时任务开始执行"
);
log
.
info
(
"AI客户标签同步定时任务开始执行"
);
try
{
try
{
inspectionCustomerTagSyncService
.
syncCustomerTagFromInspection
();
// 自定义参数如:指定开始、截止日期范围{"startDate":"2026-06-01","endDate":"2026-06-22"}
inspectionCustomerTagSyncService
.
syncCustomerTagFromInspection
(
shardingContext
.
getJobParameter
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"AI客户标签同步定时任务执行异常"
,
e
);
log
.
error
(
"AI客户标签同步定时任务执行异常"
,
e
);
}
}
...
...
rpc-dj-strategy/src/main/java/cn/com/glsx/dj/strategy/service/InspectionCustomerTagSyncService.java
View file @
8b7d102
...
@@ -97,19 +97,42 @@ public class InspectionCustomerTagSyncService {
...
@@ -97,19 +97,42 @@ public class InspectionCustomerTagSyncService {
private
volatile
Map
<
Integer
,
String
>
categoryCodeCache
;
private
volatile
Map
<
Integer
,
String
>
categoryCodeCache
;
/**
/**
* 同步昨天的 AI 客户标签数据
* 同步 AI 客户标签数据
*
* @param jobParameter 任务参数,JSON格式,如:{"startDate":"2026-06-01","endDate":"2026-06-22"}。
* 为空时默认跑昨天的数据
* @since 2026/06/26
*/
*/
public
void
syncCustomerTagFromInspection
()
{
public
void
syncCustomerTagFromInspection
(
String
jobParameter
)
{
log
.
info
(
"AI客户标签同步任务开始执行
"
);
log
.
info
(
"AI客户标签同步任务开始执行
, jobParameter={}"
,
jobParameter
);
try
{
try
{
// 初始化维度和枚举缓存
// 初始化维度和枚举缓存
initTagCache
();
initTagCache
();
// 计算昨天的日期范围
// 计算日期范围
Date
yesterday
=
DateUtil
.
offsetDay
(
new
Date
(),
-
1
);
DateTimeFormatter
dateFormatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
String
startTime
=
DateUtil
.
beginOfDay
(
yesterday
).
toString
(
"yyyy-MM-dd HH:mm:ss"
);
LocalDate
startLocalDate
;
String
endTime
=
DateUtil
.
endOfDay
(
yesterday
).
toString
(
"yyyy-MM-dd HH:mm:ss"
);
LocalDate
endLocalDate
;
if
(
StrUtil
.
isBlank
(
jobParameter
))
{
// 空参默认:昨天
LocalDate
yesterday
=
LocalDate
.
now
().
minusDays
(
1
);
startLocalDate
=
yesterday
;
endLocalDate
=
yesterday
;
}
else
{
JSONObject
params
=
JSONUtil
.
parseObj
(
jobParameter
);
String
startDateStr
=
params
.
getStr
(
"startDate"
);
String
endDateStr
=
params
.
getStr
(
"endDate"
);
startLocalDate
=
LocalDate
.
parse
(
startDateStr
,
dateFormatter
);
endLocalDate
=
LocalDate
.
parse
(
endDateStr
,
dateFormatter
);
}
// 开始时间补全为 0 点 0 分 0 秒,结束时间补全为 23 点 59 分 59 秒
Date
startTimeDate
=
cn
.
com
.
glsx
.
dj
.
strategy
.
util
.
DateUtil
.
getStartOfDay
(
startLocalDate
);
Date
endTimeDate
=
cn
.
com
.
glsx
.
dj
.
strategy
.
util
.
DateUtil
.
getEndOfDay
(
endLocalDate
);
String
startTime
=
DateUtil
.
format
(
startTimeDate
,
"yyyy-MM-dd HH:mm:ss"
);
String
endTime
=
DateUtil
.
format
(
endTimeDate
,
"yyyy-MM-dd HH:mm:ss"
);
log
.
info
(
"同步时间范围:{} - {}"
,
startTime
,
endTime
);
log
.
info
(
"同步时间范围:{} - {}"
,
startTime
,
endTime
);
...
...
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