首页数据接口+图标移除

This commit is contained in:
zhanghan11 2024-05-09 18:16:07 +08:00
parent 4cde6327e9
commit 54a59a9d86
11 changed files with 375 additions and 185 deletions

View File

@ -46,4 +46,13 @@ public class OmOrderAnalysisController extends BaseController {
public void fileDownload(HttpServletResponse response, HttpServletRequest request) {
omOrderAnalysisService.downloadReport(response);
}
/**
* 系统首页
*/
@GetMapping("/homepageData")
public AjaxResult homepage() {
return AjaxResult.success(omOrderAnalysisService.homepage());
}
}

View File

@ -36,4 +36,48 @@ public interface OmOrderAnalysisMapper
* @return
*/
public List<Map<String,Object>> selectCountAndAmountByDate(String tenantId);
/**
* 查询统计数据
*
* @return
*/
public Map<String,Object> selectTotalData();
/**
* 查询知识库统计数据
*
* @return
*/
public Map<String,Long> selectKnowledgeTotalData();
/**
* 查询课程统计数据
*
* @return
*/
public Map<String,Long> selectCourseTotalData();
/**
* 查询每月订单统计数据
*
* @return
*/
public List<Integer> selectMonthOrderTotalData();
/**
* 查询每月帖子统计数据
*
* @return
*/
public List<Integer> selectMonthPostTotalData();
/**
* 查询每月考试统计数据
*
* @return
*/
public List<Map<String,Object>> selectMonthExamTotalData();
}

View File

@ -27,4 +27,10 @@ public interface IOmOrderAnalysisService
*/
void downloadReport(HttpServletResponse response);
/**
* 首页数据
*
*/
public Map<String,Object> homepage();
}

View File

@ -50,6 +50,7 @@ public class OmOrderAnalysisServiceImpl implements IOmOrderAnalysisService {
private OmOrderAnalysisMapper omOrderAnalysisMapper;
@Autowired
private IOmTeamInfoService omTeamInfoService;
/**
* 查询分析数据
*
@ -155,7 +156,7 @@ public class OmOrderAnalysisServiceImpl implements IOmOrderAnalysisService {
// 获取团队名称
String teamName = omTeamInfoService.selectOmTeamInfoByTenantId(SecurityUtils.getTenantId()).getTeamName();
// 设置文本内容
r.setText(teamName+"分析报告");
r.setText(teamName + "分析报告");
// 设置段落居中
p.setAlignment(ParagraphAlignment.CENTER);
// 将BufferedImage转换为字节数组
@ -178,7 +179,7 @@ public class OmOrderAnalysisServiceImpl implements IOmOrderAnalysisService {
r.addPicture(new ByteArrayInputStream(dateNumChartBytes), XWPFDocument.PICTURE_TYPE_PNG, "dateNumChart", Units.toEMU(500), Units.toEMU(500)); // 设置图片大小和位置
r.addPicture(new ByteArrayInputStream(dateAmountChartBytes), XWPFDocument.PICTURE_TYPE_PNG, "dateAmountChart", Units.toEMU(500), Units.toEMU(500)); // 设置图片大小和位置
r.addPicture(new ByteArrayInputStream(typeNumChartBytes), XWPFDocument.PICTURE_TYPE_PNG,"typeNumChart", Units.toEMU(500), Units.toEMU(500)); // 设置图片大小和位置
r.addPicture(new ByteArrayInputStream(typeNumChartBytes), XWPFDocument.PICTURE_TYPE_PNG, "typeNumChart", Units.toEMU(500), Units.toEMU(500)); // 设置图片大小和位置
r.addPicture(new ByteArrayInputStream(typeAmountChartBytes), XWPFDocument.PICTURE_TYPE_PNG, "typeAmountChart", Units.toEMU(500), Units.toEMU(500)); // 设置图片大小和位置
} catch (InvalidFormatException e) {
e.printStackTrace();
@ -287,4 +288,36 @@ public class OmOrderAnalysisServiceImpl implements IOmOrderAnalysisService {
return ChartFactory.createPieChart(title, dataset,
true, true, true);
}
/**
* 首页数据
*/
@Override
public Map<String, Object> homepage() {
Map<String, Object> map = new HashMap<>();
// 知识库数量
Map<String, Long> kbMap = omOrderAnalysisMapper.selectKnowledgeTotalData();
map.put("pieKbNum", kbMap);
// 课程数量
Map<String, Long> courseMap = omOrderAnalysisMapper.selectCourseTotalData();
map.put("piecourseNum", courseMap);
// 统计总数
Map<String, Object> totalMap = omOrderAnalysisMapper.selectTotalData();
totalMap.put("kbNum", kbMap.values().stream(). mapToLong(Long::longValue).sum());
totalMap.put("courseNUm", courseMap.values().stream(). mapToLong(Long::longValue).sum());
map.put("totalNum", totalMap);
// 每月订单数量
map.put("monthOrderNum", omOrderAnalysisMapper.selectMonthOrderTotalData());
// 每月帖子数量
map.put("monthPostNum", omOrderAnalysisMapper.selectMonthPostTotalData());
// 每月考试通过率及考生人数
List<Map<String, Object>> list = omOrderAnalysisMapper.selectMonthExamTotalData();
map.put("monthExamPassRate", list.stream()
.map(itemMap -> itemMap.get("rate"))
.collect(Collectors.toList()));
map.put("monthExamPassNum", list.stream()
.map(itemMap -> itemMap.get("total"))
.collect(Collectors.toList()));
return map;
}
}

View File

@ -39,4 +39,80 @@
> (YEAR (SYSDATE()) - 3)
GROUP BY date_year_month
</select>
<select id="selectKnowledgeTotalData" resultType="map">
SELECT (SELECT COUNT(0) FROM kb_history) history,
(SELECT COUNT(0) FROM kb_ceramics) ceramics,
(SELECT COUNT(0) FROM kb_papermaking) papermaking,
(SELECT COUNT(0) FROM kb_chemical_industry) chemicalIndustry
</select>
<select id="selectCourseTotalData" resultType="map">
SELECT (SELECT COUNT(0) FROM course_online_info) onlineNum,
(SELECT COUNT(0) FROM course_video_info) videoNum,
(SELECT COUNT(0) FROM course_document_info) documentNum
</select>
<select id="selectTotalData" resultType="map">
SELECT (SELECT COUNT(0) FROM om_team_info WHERE del_flag = '0') teamNum,
(SELECT COUNT(0) FROM om_order_info WHERE del_flag = '0') orderNum,
(SELECT COUNT(0) FROM exam_paper_info) examinerNum,
(SELECT COUNT(0) FROM community_post_info) postNum
</select>
<select id="selectMonthOrderTotalData" resultType="int">
SELECT IFNULL(o.num, 0) num
FROM month_data m
LEFT JOIN (
SELECT COUNT(0) num,
(MONTH (create_time)) AS date_month
FROM `om_order_info`
WHERE (YEAR (create_time)) = YEAR (
SYSDATE())
GROUP BY date_month ) o
ON m.month_num = o.date_month
ORDER BY
m.month_num
</select>
<select id="selectMonthPostTotalData" resultType="int">
SELECT IFNULL(p.num, 0) num
FROM month_data m
LEFT JOIN
(SELECT COUNT(0) num,
(MONTH (post_time)) AS date_month
FROM `community_post_info`
WHERE (YEAR (post_time)) = YEAR (
SYSDATE())
GROUP BY date_month)p
ON m.month_num=p.date_month
ORDER BY
m.month_num
</select>
<select id="selectMonthExamTotalData" resultType="map">
SELECT m.month_num,
CASE
WHEN IFNULL(p.num, 0) = 0 THEN
0
ELSE ROUND((p.num / (p.num + IFNULL(up.num, 0)) * 100), 2)
END rate,
IFNULL(p.num, 0) + IFNULL(up.num, 0) total
FROM month_data m
LEFT JOIN (
SELECT COUNT(0) num,
(MONTH (exam_start_time)) AS month_num
FROM `exam_paper_info`
WHERE STATUS = 1
AND (YEAR (exam_start_time)) = YEAR (SYSDATE())
GROUP BY month_num ) p
ON m.month_num = p.month_num
LEFT JOIN (
SELECT COUNT(0) num,
(MONTH ( exam_start_time )) AS month_num
FROM
`exam_paper_info`
WHERE
STATUS = 0
AND (YEAR ( exam_start_time )) = YEAR (SYSDATE())
GROUP BY
month_num
) up ON m.month_num = up.month_num
ORDER BY
m.month_num
</select>
</mapper>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,208 +1,212 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
/>
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
<title><%= webpackConfig.name %></title>
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
<style>
html,
body,
#app {
height: 100%;
margin: 0px;
padding: 0px;
}
.chromeframe {
margin: 0.2em 0;
background: #ccc;
color: #000;
padding: 0.2em 0;
}
#loader-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999999;
}
#loader {
display: block;
position: relative;
left: 50%;
top: 50%;
width: 150px;
height: 150px;
margin: -75px 0 0 -75px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #FFF;
-webkit-animation: spin 2s linear infinite;
-ms-animation: spin 2s linear infinite;
-moz-animation: spin 2s linear infinite;
-o-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
z-index: 1001;
}
#loader:before {
content: "";
position: absolute;
top: 5px;
left: 5px;
right: 5px;
bottom: 5px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #FFF;
-webkit-animation: spin 3s linear infinite;
-moz-animation: spin 3s linear infinite;
-o-animation: spin 3s linear infinite;
-ms-animation: spin 3s linear infinite;
animation: spin 3s linear infinite;
}
#loader:after {
content: "";
position: absolute;
top: 15px;
left: 15px;
right: 15px;
bottom: 15px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #FFF;
-moz-animation: spin 1.5s linear infinite;
-o-animation: spin 1.5s linear infinite;
-ms-animation: spin 1.5s linear infinite;
-webkit-animation: spin 1.5s linear infinite;
animation: spin 1.5s linear infinite;
}
@-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
<!--[if lt IE 11
]><script>
window.location.href = "/html/ie.html";
</script><!
[endif]-->
<style>
html,
body,
#app {
height: 100%;
margin: 0px;
padding: 0px;
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
.chromeframe {
margin: 0.2em 0;
background: #ccc;
color: #000;
padding: 0.2em 0;
}
}
@keyframes spin {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
#loader-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999999;
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
#loader {
display: block;
position: relative;
left: 50%;
top: 50%;
width: 150px;
height: 150px;
margin: -75px 0 0 -75px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #fff;
-webkit-animation: spin 2s linear infinite;
-ms-animation: spin 2s linear infinite;
-moz-animation: spin 2s linear infinite;
-o-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
z-index: 1001;
}
}
#loader:before {
content: "";
position: absolute;
top: 5px;
left: 5px;
right: 5px;
bottom: 5px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #fff;
-webkit-animation: spin 3s linear infinite;
-moz-animation: spin 3s linear infinite;
-o-animation: spin 3s linear infinite;
-ms-animation: spin 3s linear infinite;
animation: spin 3s linear infinite;
}
#loader-wrapper .loader-section {
position: fixed;
top: 0;
width: 51%;
height: 100%;
background: #7171C6;
z-index: 1000;
-webkit-transform: translateX(0);
-ms-transform: translateX(0);
transform: translateX(0);
}
#loader:after {
content: "";
position: absolute;
top: 15px;
left: 15px;
right: 15px;
bottom: 15px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #fff;
-moz-animation: spin 1.5s linear infinite;
-o-animation: spin 1.5s linear infinite;
-ms-animation: spin 1.5s linear infinite;
-webkit-animation: spin 1.5s linear infinite;
animation: spin 1.5s linear infinite;
}
#loader-wrapper .loader-section.section-left {
left: 0;
}
@-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#loader-wrapper .loader-section.section-right {
right: 0;
}
@keyframes spin {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#loader-wrapper .loader-section {
position: fixed;
top: 0;
width: 51%;
height: 100%;
background: #7171c6;
z-index: 1000;
-webkit-transform: translateX(0);
-ms-transform: translateX(0);
transform: translateX(0);
}
.loaded #loader-wrapper .loader-section.section-left {
-webkit-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
-webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
}
#loader-wrapper .loader-section.section-left {
left: 0;
}
.loaded #loader-wrapper .loader-section.section-right {
-webkit-transform: translateX(100%);
-ms-transform: translateX(100%);
transform: translateX(100%);
-webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
}
#loader-wrapper .loader-section.section-right {
right: 0;
}
.loaded #loader {
opacity: 0;
-webkit-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.loaded #loader-wrapper .loader-section.section-left {
-webkit-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
-webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}
.loaded #loader-wrapper {
visibility: hidden;
-webkit-transform: translateY(-100%);
-ms-transform: translateY(-100%);
transform: translateY(-100%);
-webkit-transition: all 0.3s 1s ease-out;
transition: all 0.3s 1s ease-out;
}
.loaded #loader-wrapper .loader-section.section-right {
-webkit-transform: translateX(100%);
-ms-transform: translateX(100%);
transform: translateX(100%);
-webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}
.no-js #loader-wrapper {
display: none;
}
.loaded #loader {
opacity: 0;
-webkit-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.no-js h1 {
color: #222222;
}
.loaded #loader-wrapper {
visibility: hidden;
-webkit-transform: translateY(-100%);
-ms-transform: translateY(-100%);
transform: translateY(-100%);
-webkit-transition: all 0.3s 1s ease-out;
transition: all 0.3s 1s ease-out;
}
#loader-wrapper .load_title {
font-family: 'Open Sans';
color: #FFF;
font-size: 19px;
width: 100%;
text-align: center;
z-index: 9999999999999;
position: absolute;
top: 60%;
opacity: 1;
line-height: 30px;
}
.no-js #loader-wrapper {
display: none;
}
#loader-wrapper .load_title span {
font-weight: normal;
font-style: italic;
font-size: 13px;
color: #FFF;
opacity: 0.5;
}
</style>
.no-js h1 {
color: #222222;
}
#loader-wrapper .load_title {
font-family: "Open Sans";
color: #fff;
font-size: 19px;
width: 100%;
text-align: center;
z-index: 9999999999999;
position: absolute;
top: 60%;
opacity: 1;
line-height: 30px;
}
#loader-wrapper .load_title span {
font-weight: normal;
font-style: italic;
font-size: 13px;
color: #fff;
opacity: 0.5;
}
</style>
</head>
<body>
<div id="app">
<div id="loader-wrapper">
<div id="loader"></div>
<div class="loader-section section-left"></div>
<div class="loader-section section-right"></div>
<div class="load_title">正在加载系统资源,请耐心等待</div>
</div>
</div>
<div id="loader-wrapper">
<div id="loader"></div>
<div class="loader-section section-left"></div>
<div class="loader-section section-right"></div>
<div class="load_title">正在加载系统资源,请耐心等待</div>
</div>
</div>
</body>
</html>

View File

@ -7,3 +7,11 @@ export function getData() {
method: "get",
});
}
// 首页数据查询
export function getHomepageData() {
return request({
url: "/order/analysis/homepageData",
method: "get",
});
}

View File

@ -65,7 +65,7 @@ export default {
data() {
return {
title: process.env.VUE_APP_TITLE,
logo: logoImg,
logo: null, //logoImg,
};
},
};

View File

@ -1,14 +1,24 @@
<template>
<div>首页</div>
<div> <el-button @click="getData">首页</el-button>
</div>
</template>
<script>
import { getHomepageData } from "@/api/order/analysis";
export default {
name: "Index",
data() {
return {};
},
created() {
this.getData();
},
methods: {
getData() {
getHomepageData().then((res) => {
console.log(res);
});
},
goTarget(href) {
window.open(href, "_blank");
},