Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rpc-mindworkplate
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 96e878b0
authored
Jun 26, 2026
by
章家宝
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:新增定时任务传参
1 parent
eb7cf542
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
10 deletions
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/service/InspectionCustomerTagService.java
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/service/InspectionCustomerTagService.java
View file @
96e878b
...
@@ -21,6 +21,8 @@ import org.springframework.stereotype.Service;
...
@@ -21,6 +21,8 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -175,29 +177,38 @@ public class InspectionCustomerTagService {
...
@@ -175,29 +177,38 @@ public class InspectionCustomerTagService {
* 查询指定时间范围内未处理的批次,并提交客户标签分析任务
* 查询指定时间范围内未处理的批次,并提交客户标签分析任务
*
*
* @param jobParameter JSON格式参数,如:{"startDate":"2026-06-01","endDate":"2026-06-22"}
* @param jobParameter JSON格式参数,如:{"startDate":"2026-06-01","endDate":"2026-06-22"}
* 如果没有入参,则默认使用昨天的时间范围
* @return 处理的批次数量
* @return 处理的批次数量
*/
*/
public
int
processHistoricalTags
(
String
jobParameter
)
{
public
int
processHistoricalTags
(
String
jobParameter
)
{
log
.
info
(
"开始处理历史客户标签分析,参数:{}"
,
jobParameter
);
log
.
info
(
"开始处理历史客户标签分析,参数:{}"
,
jobParameter
);
DateTimeFormatter
dateFormatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
DateTimeFormatter
dateTimeFormatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
String
startTime
;
String
endTime
;
// 解析JSON参数
// 解析JSON参数
String
startTime
=
null
;
String
endTime
=
null
;
if
(
StringUtils
.
isNotBlank
(
jobParameter
))
{
if
(
StringUtils
.
isNotBlank
(
jobParameter
))
{
try
{
try
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
jobParameter
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
jobParameter
);
startTime
=
jsonObject
.
getString
(
"startDate"
);
String
startDate
=
jsonObject
.
getString
(
"startDate"
);
endTime
=
jsonObject
.
getString
(
"endDate"
);
String
endDate
=
jsonObject
.
getString
(
"endDate"
);
// 开始时间从0点开始
startTime
=
LocalDate
.
parse
(
startDate
,
dateFormatter
).
atStartOfDay
().
format
(
dateTimeFormatter
);
// 结束时间到23:59:59
endTime
=
LocalDate
.
parse
(
endDate
,
dateFormatter
).
atTime
(
23
,
59
,
59
).
format
(
dateTimeFormatter
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"解析任务参数失败:{}"
,
jobParameter
,
e
);
log
.
error
(
"解析任务参数失败:{}"
,
jobParameter
,
e
);
return
0
;
return
0
;
}
}
}
}
else
{
// 没有入参,使用昨天的时间范围
// 检查时间范围参数
LocalDate
yesterday
=
LocalDate
.
now
().
minusDays
(
1
);
if
(
StringUtils
.
isEmpty
(
startTime
)
||
StringUtils
.
isEmpty
(
endTime
))
{
startTime
=
yesterday
.
atStartOfDay
().
format
(
dateTimeFormatter
);
log
.
warn
(
"历史客户标签分析任务参数不完整,startDate={}, endDate={},跳过执行"
,
startTime
,
endTime
);
endTime
=
yesterday
.
atTime
(
23
,
59
,
59
).
format
(
dateTimeFormatter
);
return
0
;
}
}
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