Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hqzhdj
cloud-web
Commits
40b9be36
Commit
40b9be36
authored
Nov 12, 2025
by
wangxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消息数量接口
parent
38e3b12f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
476 additions
and
0 deletions
+476
-0
cloud-web-manage/src/main/java/com/yizhi/application/dashboard/controller/PromptStatisticsController.java
+203
-0
cloud-web-manage/src/main/java/com/yizhi/application/vo/PromptStatisticsVO.java
+26
-0
cloud-web-student/src/main/java/com/yizhi/application/promptStatistics/PromptStatisticsController.java
+201
-0
cloud-web-student/src/main/java/com/yizhi/application/vo/PromptStatisticsVO.java
+26
-0
pom.xml
+20
-0
No files found.
cloud-web-manage/src/main/java/com/yizhi/application/dashboard/controller/PromptStatisticsController.java
0 → 100644
View file @
40b9be36
package
com
.
yizhi
.
application
.
dashboard
.
controller
;
import
com.yizhi.application.vo.PromptStatisticsVO
;
import
com.yizhi.core.application.context.ContextHolder
;
import
com.yizhi.core.application.context.RequestContext
;
import
com.yizhi.research.application.feign.ResearchClient
;
import
com.yizhi.research.application.vo.BaseModel
;
import
com.yizhi.research.application.vo.api.PageVo
;
import
com.yizhi.training.application.feign.TrainingProjectClient
;
import
com.yizhi.training.application.vo.api.TrainingProjectMyParamVo
;
import
com.yizhi.util.application.domain.Response
;
import
com.yizhi.exam.application.feign.ExamApiClient
;
import
com.yizhi.exam.application.vo.dashboard.ExamDashboardQueryVO
;
import
com.yizhi.research.application.vo.domain.ResearchVo
;
import
com.yizhi.training.application.vo.api.TrainingProjectListVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Date
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.plugins.Page
;
@Api
(
tags
=
"提示统计接口"
)
@RestController
@RequestMapping
(
"/manage/prompt"
)
public
class
PromptStatisticsController
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
PromptStatisticsController
.
class
);
@Autowired
private
ResearchClient
researchClient
;
@Autowired
private
TrainingProjectClient
trainingProjectClient
;
@Autowired
private
ExamApiClient
examApiClient
;
@ApiOperation
(
value
=
"获取提示统计信息"
,
notes
=
"获取总提示数量及各类提示数量统计"
)
@GetMapping
(
"/statistics"
)
public
Response
<
PromptStatisticsVO
>
getPromptStatistics
()
{
try
{
LOGGER
.
error
(
"获取提示统计信息"
);
PromptStatisticsVO
statistics
=
new
PromptStatisticsVO
();
RequestContext
context
=
ContextHolder
.
get
();
// 1. 获取未参与的工作任务数量(调研表biz_type=1,已上架且处于调研期间)
Integer
workTaskCount
=
getUnparticipatedWorkTaskCount
(
context
);
statistics
.
setWorkTaskCount
(
workTaskCount
);
// 2. 获取未参与的主题活动数量(培训项目已上架未结束)
Integer
themeActivityCount
=
getUnparticipatedThemeActivityCount
(
context
);
statistics
.
setThemeActivityCount
(
themeActivityCount
);
// 3. 获取未参与的投票数量(调研表biz_type=2,已上架)
Integer
voteCount
=
getUnparticipatedVoteCount
(
context
);
statistics
.
setVoteCount
(
voteCount
);
// 4. 获取未参与的培训测试数量(考试相关的提示数量)
Integer
trainingTestCount
=
getUnparticipatedTrainingTestCount
(
context
);
statistics
.
setTrainingTestCount
(
trainingTestCount
);
// 5. 计算总提示数量
int
totalPromptCount
=
workTaskCount
+
themeActivityCount
+
voteCount
+
trainingTestCount
;
statistics
.
setTotalPromptCount
(
totalPromptCount
);
return
Response
.
ok
(
statistics
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取提示统计信息失败"
,
e
);
return
Response
.
fail
(
"500"
,
"获取提示统计信息失败"
);
}
}
/**
* 获取未参与的工作任务数量(调研表biz_type=1,已上架且处于调研期间)
* @param context
* @return
*/
private
Integer
getUnparticipatedWorkTaskCount
(
RequestContext
context
)
{
try
{
PageVo
pageVo
=
new
PageVo
();
pageVo
.
setAccountId
(
context
.
getAccountId
());
pageVo
.
setDate
(
new
Date
());
pageVo
.
setPageNo
(
1
);
pageVo
.
setPageSize
(
1
);
pageVo
.
setBizType
(
1
);
// 调研类型
pageVo
.
setState
(
2
);
// 进行中的任务(未完成,未参与)
BaseModel
<
PageVo
>
model
=
new
BaseModel
<>();
model
.
setDate
(
new
Date
());
model
.
setObj
(
pageVo
);
model
.
setContext
(
context
);
// 获取未参与的调研列表,只取数量
Page
<
ResearchVo
>
response
=
researchClient
.
apiListPage
(
model
);
if
(
response
!=
null
)
{
return
response
.
getTotal
();
}
return
0
;
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取未参与的工作任务数量失败"
,
e
);
return
0
;
}
}
/**
* 获取未参与的主题活动数量(培训项目已上架未结束)
* @param context
* @return
*/
private
Integer
getUnparticipatedThemeActivityCount
(
RequestContext
context
)
{
try
{
TrainingProjectMyParamVo
paramVo
=
new
TrainingProjectMyParamVo
();
paramVo
.
setPageNo
(
1
);
paramVo
.
setPageSize
(
1
);
paramVo
.
setType
(
2
);
// 进行中的活动
com
.
yizhi
.
training
.
application
.
model
.
BaseModel
<
TrainingProjectMyParamVo
>
model
=
new
com
.
yizhi
.
training
.
application
.
model
.
BaseModel
<>();
model
.
setContext
(
context
);
model
.
setDate
(
new
Date
());
model
.
setObj
(
paramVo
);
// 获取未参与的培训项目列表,只取数量
Page
<
TrainingProjectListVo
>
response
=
trainingProjectClient
.
apiMyPageList
(
model
);
if
(
response
!=
null
)
{
return
response
.
getTotal
();
}
return
0
;
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取未参与的主题活动数量失败"
,
e
);
return
0
;
}
}
/**
* 获取未参与的投票数量(调研表biz_type=2,已上架)
* @param context
* @return
*/
private
Integer
getUnparticipatedVoteCount
(
RequestContext
context
)
{
try
{
PageVo
pageVo
=
new
PageVo
();
pageVo
.
setAccountId
(
context
.
getAccountId
());
pageVo
.
setDate
(
new
Date
());
pageVo
.
setPageNo
(
1
);
pageVo
.
setPageSize
(
1
);
pageVo
.
setBizType
(
2
);
// 投票类型
pageVo
.
setState
(
2
);
// 进行中的投票(未完成,未参与)
BaseModel
<
PageVo
>
model
=
new
BaseModel
<>();
model
.
setDate
(
new
Date
());
model
.
setObj
(
pageVo
);
model
.
setContext
(
context
);
// 获取未参与的投票列表,只取数量
Page
<
ResearchVo
>
response
=
researchClient
.
apiListPage
(
model
);
if
(
response
!=
null
)
{
return
response
.
getTotal
();
}
return
0
;
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取未参与的投票数量失败"
,
e
);
return
0
;
}
}
/**
* 获取未参与的培训测试数量(考试相关的提示数量)
* @param context
* @return
*/
private
Integer
getUnparticipatedTrainingTestCount
(
RequestContext
context
)
{
try
{
// 使用考试dashboard接口获取考试统计信息
ExamDashboardQueryVO
query
=
new
ExamDashboardQueryVO
();
query
.
setSiteId
(
context
.
getSiteId
());
// 设置最近7天的时间范围
Date
endDate
=
new
Date
();
Date
startDate
=
new
Date
(
endDate
.
getTime
()
-
7
*
24
*
60
*
60
*
1000L
);
query
.
setStartDate
(
startDate
);
query
.
setEndDate
(
endDate
);
Map
<
Long
,
Integer
>
examData
=
examApiClient
.
getExamDashboardData
(
query
);
// 返回考试数量
return
examData
!=
null
?
examData
.
size
()
:
0
;
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取未参与的培训测试数量失败"
,
e
);
return
0
;
}
}
}
\ No newline at end of file
cloud-web-manage/src/main/java/com/yizhi/application/vo/PromptStatisticsVO.java
0 → 100644
View file @
40b9be36
package
com
.
yizhi
.
application
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
"提示统计VO"
)
public
class
PromptStatisticsVO
{
@ApiModelProperty
(
value
=
"总提示数量"
)
private
Integer
totalPromptCount
;
@ApiModelProperty
(
value
=
"工作任务提示数量"
)
private
Integer
workTaskCount
;
@ApiModelProperty
(
value
=
"主题活动提示数量"
)
private
Integer
themeActivityCount
;
@ApiModelProperty
(
value
=
"我要投票提示数量"
)
private
Integer
voteCount
;
@ApiModelProperty
(
value
=
"培训测试提示数量"
)
private
Integer
trainingTestCount
;
}
\ No newline at end of file
cloud-web-student/src/main/java/com/yizhi/application/promptStatistics/PromptStatisticsController.java
0 → 100644
View file @
40b9be36
package
com
.
yizhi
.
application
.
promptStatistics
;
import
com.yizhi.application.vo.PromptStatisticsVO
;
import
com.yizhi.core.application.context.ContextHolder
;
import
com.yizhi.core.application.context.RequestContext
;
import
com.yizhi.research.application.feign.ResearchClient
;
import
com.yizhi.research.application.vo.BaseModel
;
import
com.yizhi.research.application.vo.api.PageVo
;
import
com.yizhi.training.application.feign.TrainingProjectClient
;
import
com.yizhi.training.application.vo.api.TrainingProjectMyParamVo
;
import
com.yizhi.util.application.domain.Response
;
import
com.yizhi.exam.application.feign.ExamApiClient
;
import
com.yizhi.exam.application.vo.dashboard.ExamDashboardQueryVO
;
import
com.yizhi.research.application.vo.domain.ResearchVo
;
import
com.yizhi.training.application.vo.api.TrainingProjectListVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Date
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.plugins.Page
;
@Api
(
tags
=
"提示统计接口"
)
@RestController
@RequestMapping
(
"/api/prompt"
)
public
class
PromptStatisticsController
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
PromptStatisticsController
.
class
);
@Autowired
private
ResearchClient
researchClient
;
@Autowired
private
TrainingProjectClient
trainingProjectClient
;
@Autowired
private
ExamApiClient
examApiClient
;
@ApiOperation
(
value
=
"获取提示统计信息"
,
notes
=
"获取总提示数量及各类提示数量统计"
)
@GetMapping
(
"/statistics"
)
public
Response
<
PromptStatisticsVO
>
getPromptStatistics
()
{
try
{
PromptStatisticsVO
statistics
=
new
PromptStatisticsVO
();
RequestContext
context
=
ContextHolder
.
get
();
// 1. 获取工作任务数量(调研表biz_type=1,已上架且处于调研期间)
Integer
workTaskCount
=
getWorkTaskCount
(
context
);
statistics
.
setWorkTaskCount
(
workTaskCount
);
// 2. 获取主题活动数量(培训项目已上架未结束)
Integer
themeActivityCount
=
getThemeActivityCount
(
context
);
statistics
.
setThemeActivityCount
(
themeActivityCount
);
// 3. 获取我要投票数量(调研表biz_type=2,已上架)
Integer
voteCount
=
getVoteCount
(
context
);
statistics
.
setVoteCount
(
voteCount
);
// 4. 获取培训测试数量(考试相关的提示数量)
Integer
trainingTestCount
=
getTrainingTestCount
(
context
);
statistics
.
setTrainingTestCount
(
trainingTestCount
);
// 5. 计算总提示数量
int
totalPromptCount
=
workTaskCount
+
themeActivityCount
+
voteCount
+
trainingTestCount
;
statistics
.
setTotalPromptCount
(
totalPromptCount
);
return
Response
.
ok
(
statistics
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取提示统计信息失败"
,
e
);
return
Response
.
fail
(
"500"
,
"获取提示统计信息失败"
);
}
}
/**
* 获取工作任务数量
* @param context
* @return
*/
private
Integer
getWorkTaskCount
(
RequestContext
context
)
{
try
{
PageVo
pageVo
=
new
PageVo
();
pageVo
.
setAccountId
(
context
.
getAccountId
());
pageVo
.
setDate
(
new
Date
());
pageVo
.
setPageNo
(
1
);
pageVo
.
setPageSize
(
1
);
pageVo
.
setBizType
(
1
);
// 调研类型
pageVo
.
setState
(
2
);
// 进行中的任务
BaseModel
<
PageVo
>
model
=
new
BaseModel
<>();
model
.
setDate
(
new
Date
());
model
.
setObj
(
pageVo
);
model
.
setContext
(
context
);
// 获取调研列表,只取数量
Page
<
ResearchVo
>
response
=
researchClient
.
apiListPage
(
model
);
if
(
response
!=
null
)
{
return
response
.
getTotal
();
}
return
0
;
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取工作任务数量失败"
,
e
);
return
0
;
}
}
/**
* 获取主题活动数量
* @param context
* @return
*/
private
Integer
getThemeActivityCount
(
RequestContext
context
)
{
try
{
TrainingProjectMyParamVo
paramVo
=
new
TrainingProjectMyParamVo
();
paramVo
.
setPageNo
(
1
);
paramVo
.
setPageSize
(
1
);
paramVo
.
setType
(
2
);
// 进行中的活动
com
.
yizhi
.
training
.
application
.
model
.
BaseModel
<
TrainingProjectMyParamVo
>
model
=
new
com
.
yizhi
.
training
.
application
.
model
.
BaseModel
<>();
model
.
setContext
(
context
);
model
.
setDate
(
new
Date
());
model
.
setObj
(
paramVo
);
// 获取培训项目列表,只取数量
Page
<
TrainingProjectListVo
>
response
=
trainingProjectClient
.
apiMyPageList
(
model
);
if
(
response
!=
null
)
{
return
response
.
getTotal
();
}
return
0
;
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取主题活动数量失败"
,
e
);
return
0
;
}
}
/**
* 获取投票数量
* @param context
* @return
*/
private
Integer
getVoteCount
(
RequestContext
context
)
{
try
{
PageVo
pageVo
=
new
PageVo
();
pageVo
.
setAccountId
(
context
.
getAccountId
());
pageVo
.
setDate
(
new
Date
());
pageVo
.
setPageNo
(
1
);
pageVo
.
setPageSize
(
1
);
pageVo
.
setBizType
(
2
);
// 投票类型
pageVo
.
setState
(
2
);
// 进行中的投票
BaseModel
<
PageVo
>
model
=
new
BaseModel
<>();
model
.
setDate
(
new
Date
());
model
.
setObj
(
pageVo
);
model
.
setContext
(
context
);
// 获取投票列表,只取数量
Page
<
ResearchVo
>
response
=
researchClient
.
apiListPage
(
model
);
if
(
response
!=
null
)
{
return
response
.
getTotal
();
}
return
0
;
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取投票数量失败"
,
e
);
return
0
;
}
}
/**
* 获取培训测试数量
* @param context
* @return
*/
private
Integer
getTrainingTestCount
(
RequestContext
context
)
{
try
{
// 使用考试dashboard接口获取考试统计信息
ExamDashboardQueryVO
query
=
new
ExamDashboardQueryVO
();
query
.
setSiteId
(
context
.
getSiteId
());
// 设置最近7天的时间范围
Date
endDate
=
new
Date
();
Date
startDate
=
new
Date
(
endDate
.
getTime
()
-
7
*
24
*
60
*
60
*
1000L
);
query
.
setStartDate
(
startDate
);
query
.
setEndDate
(
endDate
);
Map
<
Long
,
Integer
>
examData
=
examApiClient
.
getExamDashboardData
(
query
);
// 返回考试数量
return
examData
!=
null
?
examData
.
size
()
:
0
;
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取培训测试数量失败"
,
e
);
return
0
;
}
}
}
\ No newline at end of file
cloud-web-student/src/main/java/com/yizhi/application/vo/PromptStatisticsVO.java
0 → 100644
View file @
40b9be36
package
com
.
yizhi
.
application
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
"提示统计VO"
)
public
class
PromptStatisticsVO
{
@ApiModelProperty
(
value
=
"总提示数量"
)
private
Integer
totalPromptCount
;
@ApiModelProperty
(
value
=
"工作任务提示数量"
)
private
Integer
workTaskCount
;
@ApiModelProperty
(
value
=
"主题活动提示数量"
)
private
Integer
themeActivityCount
;
@ApiModelProperty
(
value
=
"我要投票提示数量"
)
private
Integer
voteCount
;
@ApiModelProperty
(
value
=
"培训测试提示数量"
)
private
Integer
trainingTestCount
;
}
\ No newline at end of file
pom.xml
View file @
40b9be36
...
@@ -175,6 +175,26 @@
...
@@ -175,6 +175,26 @@
<artifactId>
cloud-customproject-api
</artifactId>
<artifactId>
cloud-customproject-api
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.yizhi
</groupId>
<artifactId>
cloud-common-api
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.yizhi
</groupId>
<artifactId>
cloud-util
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.yizhi
</groupId>
<artifactId>
cloud-core
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<!-- 签到api 依赖 -->
<!-- 签到api 依赖 -->
<dependency>
<dependency>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment