Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rpc-dj-supervisor
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 6a98a448
authored
Mar 18, 2026
by
谢海旭
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
v5.7.0版本 飞行督导:AI分析生成对接接口
1 parent
aa21e720
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
302 additions
and
7 deletions
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/job/SupervisorMonthlyTrainingAiAnalysisJob.java
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/job/SupervisorPersonalAiAnalysisJob.java
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/job/SupervisorTrainingAiAnalysisJob.java
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/job/SupervisorWeeklyTrainingAiAnalysisJob.java
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/service/SupervisorAiAnalysisRecordService.java
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/service/SupervisorDashboardService.java
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/service/SupervisorEmployeeTrainingInfoService.java
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/service/SupervisorTaskInfoService.java
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/job/SupervisorMonthlyTrainingAiAnalysisJob.java
0 → 100644
View file @
6a98a44
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
job
;
import
cn.com.glsx.dj.supervisor.enums.TimeDimensionEnum
;
import
cn.com.glsx.dj.supervisor.service.SupervisorAiAnalysisRecordService
;
import
cn.com.glsx.dj.supervisor.service.SupervisorTaskInfoService
;
import
cn.com.glsx.dj.supervisor.utils.DateUtils
;
import
cn.com.glsx.merchants.model.response.MerchantStaffResponse
;
import
com.dangdang.ddframe.job.api.ShardingContext
;
import
com.dangdang.ddframe.job.api.simple.SimpleJob
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
/**
* 督导团队培训数据 AI 分析定时任务 - 月维度
* 每月 1 号凌晨 1 点 20 分执行,查询上月(1 号至最后一天)数据,
* 对全部在职飞行督导下各团队的培训数据发起 AI 分析任务。
* 分析结果以"生成中"状态异步保存到 supervisor_ai_analysis_record 表,
* 由 SupervisorAiAnalysisQueryJob 轮询回写最终结果。
*/
@Slf4j
@Service
@ElasticJobConf
(
name
=
"SupervisorMonthlyTrainingAiAnalysisJob"
,
cron
=
"0 20 1 1 * ?"
,
description
=
"督导团队培训数据月维度AI分析任务"
,
overwrite
=
true
)
public
class
SupervisorMonthlyTrainingAiAnalysisJob
implements
SimpleJob
{
@Autowired
private
SupervisorTaskInfoService
supervisorTaskInfoService
;
@Autowired
private
SupervisorAiAnalysisRecordService
supervisorAiAnalysisRecordService
;
@Override
public
void
execute
(
ShardingContext
shardingContext
)
{
log
.
info
(
"督导团队培训数据 AI 分析任务(月)开始执行"
);
try
{
// 计算上月的起始和结束日期
Date
today
=
new
Date
();
String
startDate
=
DateUtils
.
formatDate
(
DateUtils
.
getDateStartMonth
(
DateUtils
.
addDate
(
today
,
"month"
,
-
1
)));
String
endDate
=
DateUtils
.
formatDate
(
DateUtils
.
getDateEndMonth
(
DateUtils
.
addDate
(
today
,
"month"
,
-
1
)));
log
.
info
(
"本次分析周期:{} ~ {}"
,
startDate
,
endDate
);
List
<
MerchantStaffResponse
>
supervisorList
=
supervisorTaskInfoService
.
listAllEffectiveSupervisors
();
if
(
CollectionUtils
.
isEmpty
(
supervisorList
))
{
log
.
warn
(
"未查询到在职飞行督导,任务结束"
);
return
;
}
log
.
info
(
"共查询到 {} 名在职飞行督导,开始逐一处理"
,
supervisorList
.
size
());
for
(
MerchantStaffResponse
supervisor
:
supervisorList
)
{
try
{
supervisorAiAnalysisRecordService
.
processSupervisorTrainingAiAnalysis
(
supervisor
,
startDate
,
endDate
,
TimeDimensionEnum
.
MONTHLY
.
getCode
());
}
catch
(
Exception
e
)
{
log
.
error
(
"处理督导培训 AI 分析异常(月),supervisorPhone={},error={}"
,
supervisor
.
getStaffPhone
(),
e
.
getMessage
(),
e
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"督导团队培训数据 AI 分析任务(月)执行异常"
,
e
);
}
log
.
info
(
"督导团队培训数据 AI 分析任务(月)执行结束"
);
}
}
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/job/SupervisorPersonalAiAnalysisJob.java
0 → 100644
View file @
6a98a44
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
job
;
import
cn.com.glsx.dj.supervisor.service.SupervisorAiAnalysisRecordService
;
import
cn.com.glsx.dj.supervisor.service.SupervisorTaskInfoService
;
import
cn.com.glsx.dj.supervisor.utils.DateUtils
;
import
cn.com.glsx.merchants.model.response.MerchantStaffResponse
;
import
com.dangdang.ddframe.job.api.ShardingContext
;
import
com.dangdang.ddframe.job.api.simple.SimpleJob
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* 督导下组员个人综合数据 AI 分析定时任务(日维度)
* 每日凌晨 1 点 30 分执行,查询昨天数据,遍历全部在职飞行督导,
* 再遍历每个督导的每名组员,将业绩、行为、培训数据聚合为纯文本,
* 发起 AI 大模型分析,结果以"生成中"状态异步保存到 supervisor_ai_analysis_record 表,
* 由 SupervisorAiAnalysisQueryJob 轮询回写最终结果。
*/
@Slf4j
@Service
@ElasticJobConf
(
name
=
"SupervisorPersonalAiAnalysisJob"
,
cron
=
"0 30 1 * * ?"
,
description
=
"督导团队成员个人综合数据日维度AI分析任务"
,
overwrite
=
true
)
public
class
SupervisorPersonalAiAnalysisJob
implements
SimpleJob
{
@Autowired
private
SupervisorTaskInfoService
supervisorTaskInfoService
;
@Autowired
private
SupervisorAiAnalysisRecordService
supervisorAiAnalysisRecordService
;
@Override
public
void
execute
(
ShardingContext
shardingContext
)
{
log
.
info
(
"督导团队成员个人综合 AI 分析任务(日)开始执行"
);
try
{
// 昨天日期(yyyy-MM-dd)
String
yesterday
=
DateUtils
.
getDayStartDate
(
1
,
false
);
log
.
info
(
"本次分析日期:{}"
,
yesterday
);
List
<
MerchantStaffResponse
>
supervisorList
=
supervisorTaskInfoService
.
listAllEffectiveSupervisors
();
if
(
CollectionUtils
.
isEmpty
(
supervisorList
))
{
log
.
warn
(
"未查询到在职飞行督导,任务结束"
);
return
;
}
log
.
info
(
"共查询到 {} 名在职飞行督导,开始逐一处理"
,
supervisorList
.
size
());
for
(
MerchantStaffResponse
supervisor
:
supervisorList
)
{
try
{
supervisorAiAnalysisRecordService
.
processSupervisorPersonalAiAnalysis
(
supervisor
,
yesterday
);
}
catch
(
Exception
e
)
{
log
.
error
(
"处理督导个人综合 AI 分析异常(日),supervisorPhone={},error={}"
,
supervisor
.
getStaffPhone
(),
e
.
getMessage
(),
e
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"督导团队成员个人综合 AI 分析任务(日)执行异常"
,
e
);
}
log
.
info
(
"督导团队成员个人综合 AI 分析任务(日)执行结束"
);
}
}
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/job/SupervisorTrainingAiAnalysisJob.java
0 → 100644
View file @
6a98a44
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
job
;
import
cn.com.glsx.dj.supervisor.enums.TimeDimensionEnum
;
import
cn.com.glsx.dj.supervisor.service.SupervisorAiAnalysisRecordService
;
import
cn.com.glsx.dj.supervisor.service.SupervisorTaskInfoService
;
import
cn.com.glsx.dj.supervisor.utils.DateUtils
;
import
cn.com.glsx.merchants.model.response.MerchantStaffResponse
;
import
com.dangdang.ddframe.job.api.ShardingContext
;
import
com.dangdang.ddframe.job.api.simple.SimpleJob
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* 督导团队培训数据 AI 分析定时任务 - 日维度
* 每日凌晨 1 点执行,查询前一天数据,对全部在职飞行督导下各团队的培训数据发起 AI 分析任务。
* 分析结果以"生成中"状态异步保存到 supervisor_ai_analysis_record 表,
* 由 SupervisorAiAnalysisQueryJob 轮询回写最终结果。
*/
@Slf4j
@Service
@ElasticJobConf
(
name
=
"SupervisorTrainingAiAnalysisJob"
,
cron
=
"0 0 1 * * ?"
,
description
=
"督导团队培训数据日维度AI分析任务"
,
overwrite
=
true
)
public
class
SupervisorTrainingAiAnalysisJob
implements
SimpleJob
{
@Autowired
private
SupervisorTaskInfoService
supervisorTaskInfoService
;
@Autowired
private
SupervisorAiAnalysisRecordService
supervisorAiAnalysisRecordService
;
@Override
public
void
execute
(
ShardingContext
shardingContext
)
{
log
.
info
(
"督导团队培训数据 AI 分析任务(日)开始执行"
);
try
{
// 前一天日期(yyyy-MM-dd)
String
yesterday
=
DateUtils
.
getDayStartDate
(
1
,
false
);
log
.
info
(
"本次分析日期:{}"
,
yesterday
);
List
<
MerchantStaffResponse
>
supervisorList
=
supervisorTaskInfoService
.
listAllEffectiveSupervisors
();
if
(
CollectionUtils
.
isEmpty
(
supervisorList
))
{
log
.
warn
(
"未查询到在职飞行督导,任务结束"
);
return
;
}
log
.
info
(
"共查询到 {} 名在职飞行督导,开始逐一处理"
,
supervisorList
.
size
());
for
(
MerchantStaffResponse
supervisor
:
supervisorList
)
{
try
{
supervisorAiAnalysisRecordService
.
processSupervisorTrainingAiAnalysis
(
supervisor
,
yesterday
,
yesterday
,
TimeDimensionEnum
.
DAILY
.
getCode
());
}
catch
(
Exception
e
)
{
log
.
error
(
"处理督导培训 AI 分析异常(日),supervisorPhone={},error={}"
,
supervisor
.
getStaffPhone
(),
e
.
getMessage
(),
e
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"督导团队培训数据 AI 分析任务(日)执行异常"
,
e
);
}
log
.
info
(
"督导团队培训数据 AI 分析任务(日)执行结束"
);
}
}
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/job/SupervisorWeeklyTrainingAiAnalysisJob.java
0 → 100644
View file @
6a98a44
package
cn
.
com
.
glsx
.
dj
.
supervisor
.
job
;
import
cn.com.glsx.dj.supervisor.enums.TimeDimensionEnum
;
import
cn.com.glsx.dj.supervisor.service.SupervisorAiAnalysisRecordService
;
import
cn.com.glsx.dj.supervisor.service.SupervisorTaskInfoService
;
import
cn.com.glsx.dj.supervisor.utils.DateUtils
;
import
cn.com.glsx.merchants.model.response.MerchantStaffResponse
;
import
com.dangdang.ddframe.job.api.ShardingContext
;
import
com.dangdang.ddframe.job.api.simple.SimpleJob
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
/**
* 督导团队培训数据 AI 分析定时任务 - 周维度
* 每周一凌晨 1 点 15 分执行,查询上周(周一至周日)数据,
* 对全部在职飞行督导下各团队的培训数据发起 AI 分析任务。
* 分析结果以"生成中"状态异步保存到 supervisor_ai_analysis_record 表,
* 由 SupervisorAiAnalysisQueryJob 轮询回写最终结果。
*/
@Slf4j
@Service
@ElasticJobConf
(
name
=
"SupervisorWeeklyTrainingAiAnalysisJob"
,
cron
=
"0 15 1 ? * 2"
,
description
=
"督导团队培训数据周维度AI分析任务"
,
overwrite
=
true
)
public
class
SupervisorWeeklyTrainingAiAnalysisJob
implements
SimpleJob
{
@Autowired
private
SupervisorTaskInfoService
supervisorTaskInfoService
;
@Autowired
private
SupervisorAiAnalysisRecordService
supervisorAiAnalysisRecordService
;
@Override
public
void
execute
(
ShardingContext
shardingContext
)
{
log
.
info
(
"督导团队培训数据 AI 分析任务(周)开始执行"
);
try
{
// 计算上周的周一和周日
Date
today
=
new
Date
();
String
startDate
=
DateUtils
.
formatDate
(
DateUtils
.
getMondayOfWeek
(
DateUtils
.
addDate
(
today
,
"day"
,
-
7
)));
String
endDate
=
DateUtils
.
formatDate
(
DateUtils
.
getSundayOfWeek
(
DateUtils
.
addDate
(
today
,
"day"
,
-
7
)));
log
.
info
(
"本次分析周期:{} ~ {}"
,
startDate
,
endDate
);
List
<
MerchantStaffResponse
>
supervisorList
=
supervisorTaskInfoService
.
listAllEffectiveSupervisors
();
if
(
CollectionUtils
.
isEmpty
(
supervisorList
))
{
log
.
warn
(
"未查询到在职飞行督导,任务结束"
);
return
;
}
log
.
info
(
"共查询到 {} 名在职飞行督导,开始逐一处理"
,
supervisorList
.
size
());
for
(
MerchantStaffResponse
supervisor
:
supervisorList
)
{
try
{
supervisorAiAnalysisRecordService
.
processSupervisorTrainingAiAnalysis
(
supervisor
,
startDate
,
endDate
,
TimeDimensionEnum
.
WEEKLY
.
getCode
());
}
catch
(
Exception
e
)
{
log
.
error
(
"处理督导培训 AI 分析异常(周),supervisorPhone={},error={}"
,
supervisor
.
getStaffPhone
(),
e
.
getMessage
(),
e
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"督导团队培训数据 AI 分析任务(周)执行异常"
,
e
);
}
log
.
info
(
"督导团队培训数据 AI 分析任务(周)执行结束"
);
}
}
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/service/SupervisorAiAnalysisRecordService.java
View file @
6a98a44
This diff is collapsed.
Click to expand it.
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/service/SupervisorDashboardService.java
View file @
6a98a44
...
@@ -275,7 +275,7 @@ public class SupervisorDashboardService {
...
@@ -275,7 +275,7 @@ public class SupervisorDashboardService {
* @param bizs 业务类型
* @param bizs 业务类型
* @return 门店及门店员工手机号列表
* @return 门店及门店员工手机号列表
*/
*/
p
rivate
Map
<
Integer
,
List
<
EmployeeRanking
>>
getSupervisorStoreAndEmployeePhoneList
(
String
supervisorId
,
p
ublic
Map
<
Integer
,
List
<
EmployeeRanking
>>
getSupervisorStoreAndEmployeePhoneList
(
String
supervisorId
,
Integer
bizs
)
{
Integer
bizs
)
{
Map
<
Integer
,
List
<
EmployeeRanking
>>
result
=
new
HashMap
<>();
Map
<
Integer
,
List
<
EmployeeRanking
>>
result
=
new
HashMap
<>();
...
...
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/service/SupervisorEmployeeTrainingInfoService.java
View file @
6a98a44
...
@@ -31,6 +31,12 @@ public class SupervisorEmployeeTrainingInfoService {
...
@@ -31,6 +31,12 @@ public class SupervisorEmployeeTrainingInfoService {
@Autowired
@Autowired
private
SupervisorTaskInfoMapper
supervisorTaskInfoMapper
;
private
SupervisorTaskInfoMapper
supervisorTaskInfoMapper
;
@Autowired
private
SupervisorDashboardService
supervisorDashboardService
;
@Autowired
private
SupervisorTaskInfoService
supervisorTaskInfoService
;
/**
/**
* 根据条件查询全部员工培训信息列表
* 根据条件查询全部员工培训信息列表
*
*
...
@@ -38,11 +44,33 @@ public class SupervisorEmployeeTrainingInfoService {
...
@@ -38,11 +44,33 @@ public class SupervisorEmployeeTrainingInfoService {
* @return 员工培训信息列表
* @return 员工培训信息列表
*/
*/
public
List
<
EmployeeTrainingInfoDTO
>
getAllEmployeeTrainingInfo
(
EmployeeTrainingInfoRequestDTO
request
)
{
public
List
<
EmployeeTrainingInfoDTO
>
getAllEmployeeTrainingInfo
(
EmployeeTrainingInfoRequestDTO
request
)
{
// TODO 1、根据督导手机号、业务类型 关联查询全部员工信息
// 1、根据督导手机号查询督导uuid
// 2、单个员工查询
String
supervisorUUID
=
supervisorTaskInfoService
.
getSupervisorUUIDByPhone
(
request
.
getSupervisorPhone
());
// 3、判空处理等
if
(
supervisorUUID
==
null
)
{
List
<
String
>
phoneList
=
new
ArrayList
<
String
>();
log
.
warn
(
"未找到督导信息,supervisorPhone={}"
,
request
.
getSupervisorPhone
());
phoneList
.
add
(
"13603070903"
);
return
new
ArrayList
<>();
}
// 2、根据督导uuid和业务类型,获取督导下所有门店及员工信息
Map
<
Integer
,
List
<
EmployeeRanking
>>
storeEmployeeMap
=
supervisorDashboardService
.
getSupervisorStoreAndEmployeePhoneList
(
supervisorUUID
,
request
.
getBusinessType
());
if
(
CollectionUtils
.
isEmpty
(
storeEmployeeMap
))
{
log
.
warn
(
"督导下没有员工信息,supervisorPhone={}"
,
request
.
getSupervisorPhone
());
return
new
ArrayList
<>();
}
// 3、提取全部员工手机号(去重)
List
<
String
>
phoneList
=
storeEmployeeMap
.
values
().
stream
()
.
flatMap
(
List:
:
stream
)
.
map
(
EmployeeRanking:
:
getEmployeePhone
)
.
filter
(
phone
->
phone
!=
null
&&
!
phone
.
isEmpty
())
.
distinct
()
.
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
phoneList
))
{
log
.
warn
(
"督导下员工手机号为空,supervisorPhone={}"
,
request
.
getSupervisorPhone
());
return
new
ArrayList
<>();
}
List
<
BeiSenEmployeeListResonseDTO
>
beiSenEmployeeList
=
supervisorLearningCenterService
.
listEmployeeInfoByStaffPhone
(
phoneList
);
List
<
BeiSenEmployeeListResonseDTO
>
beiSenEmployeeList
=
supervisorLearningCenterService
.
listEmployeeInfoByStaffPhone
(
phoneList
);
List
<
Integer
>
beiSenUserIdList
=
beiSenEmployeeList
.
stream
().
map
(
beiSenEmployeeListResonseDTO
->
beiSenEmployeeListResonseDTO
.
getUserID
()).
collect
(
Collectors
.
toList
());
List
<
Integer
>
beiSenUserIdList
=
beiSenEmployeeList
.
stream
().
map
(
beiSenEmployeeListResonseDTO
->
beiSenEmployeeListResonseDTO
.
getUserID
()).
collect
(
Collectors
.
toList
());
...
...
rpc-dj-supervisor/src/main/java/cn/com/glsx/dj/supervisor/service/SupervisorTaskInfoService.java
View file @
6a98a44
...
@@ -779,7 +779,7 @@ public class SupervisorTaskInfoService {
...
@@ -779,7 +779,7 @@ public class SupervisorTaskInfoService {
* @param supervisorPhone
* @param supervisorPhone
* @return
* @return
*/
*/
p
rivate
String
getSupervisorUUIDByPhone
(
String
supervisorPhone
)
{
p
ublic
String
getSupervisorUUIDByPhone
(
String
supervisorPhone
)
{
List
<
MerchantStaffResponse
>
supervisorList
=
getMerchantStaffByPhone
(
supervisorPhone
);
List
<
MerchantStaffResponse
>
supervisorList
=
getMerchantStaffByPhone
(
supervisorPhone
);
if
(
CollectionUtils
.
isEmpty
(
supervisorList
))
{
if
(
CollectionUtils
.
isEmpty
(
supervisorList
))
{
return
null
;
return
null
;
...
...
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