Commit f573188a authored by 喻春霖's avatar 喻春霖

fixed

parent 0d488e30
......@@ -18,7 +18,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
@Controller
@RequestMapping("com/chineseall/eden/authcenter/log")
@RequestMapping("log")
public class AuthLogController {
private static final String USER_NAME = "admin";
......@@ -55,94 +55,8 @@ public class AuthLogController {
ModelAndView mv = new ModelAndView();
String flag = (String) request.getSession().getAttribute("loginFlag");
if(StringUtils.isNotEmpty(flag)){
mv.setViewName("loginstat");
// 累计登录人次
Map<String, Object> params1 = new HashMap<>();
params1.put("authSource", "上海运营中心");
params1.put("getUserInfoSuccessFlag", true);
Long loginCounts = authLogService.countLoginByParams(params1);
mv.addObject("data_total", loginCounts);
// 电教馆累计登录人次
Map<String, Object> params2 = new HashMap<>();
params2.put("authSource", "上海运营中心");
params2.put("getUserInfoSuccessFlag", true);
params2.put("oauthType", OauthType.dianjiaoguan.name());
Long dianjiaoguanLoginCounts = authLogService.countLoginByParams(params2);
mv.addObject("data_total_djg", dianjiaoguanLoginCounts);
// 省运营累计登录人次
Map<String, Object> params3 = new HashMap<>();
params3.put("authSource", "上海运营中心");
params3.put("getUserInfoSuccessFlag", true);
params3.put("oauthType", OauthType.edenoperation.name());
Long edenoperationLoginCounts = authLogService.countLoginByParams(params3);
mv.addObject("data_total_syy", edenoperationLoginCounts);
// 近30日累计登录人次
Map<String, Object> params4 = new HashMap<>();
params4.put("authSource", "上海运营中心");
params4.put("getUserInfoSuccessFlag", true);
params4.put("beginTime", getZeroTime(DateUtils.addDays(new Date(), -29)));
Long loginCounts30Day = authLogService.countLoginByParams(params4);
mv.addObject("data_30", loginCounts30Day);
// 电教馆近30日累计登录人次
Map<String, Object> params5 = new HashMap<>();
params5.put("authSource", "上海运营中心");
params5.put("getUserInfoSuccessFlag", true);
params5.put("oauthType", OauthType.dianjiaoguan.name());
params5.put("beginTime", getZeroTime(DateUtils.addDays(new Date(), -29)));
Long dianjiaoguanLoginCounts30Day = authLogService.countLoginByParams(params5);
mv.addObject("data_30_djg", dianjiaoguanLoginCounts30Day);
// 省运营近30日累计登录人次
Map<String, Object> params6 = new HashMap<>();
params6.put("authSource", "上海运营中心");
params6.put("getUserInfoSuccessFlag", true);
params6.put("oauthType", OauthType.edenoperation.name());
params6.put("beginTime", getZeroTime(DateUtils.addDays(new Date(), -29)));
Long edenoperationLoginCounts30Day = authLogService.countLoginByParams(params6);
mv.addObject("data_30_syy", edenoperationLoginCounts30Day);
// 近7日累计登录人次
Map<String, Object> params7 = new HashMap<>();
params7.put("authSource", "上海运营中心");
params7.put("getUserInfoSuccessFlag", true);
params7.put("beginTime", getZeroTime(DateUtils.addDays(new Date(), -6)));
Long loginCounts7Day = authLogService.countLoginByParams(params7);
mv.addObject("data_7", loginCounts7Day);
// 电教馆近7日累计登录人次
Map<String, Object> params8 = new HashMap<>();
params8.put("authSource", "上海运营中心");
params8.put("getUserInfoSuccessFlag", true);
params8.put("oauthType", OauthType.dianjiaoguan.name());
params8.put("beginTime", getZeroTime(DateUtils.addDays(new Date(), -6)));
Long dianjiaoguanLoginCounts7Day = authLogService.countLoginByParams(params8);
mv.addObject("data_7_djj", dianjiaoguanLoginCounts7Day);
// 省运营近7日累计登录人次
Map<String, Object> params9 = new HashMap<>();
params9.put("authSource", "上海运营中心");
params9.put("getUserInfoSuccessFlag", true);
params9.put("oauthType", OauthType.edenoperation.name());
params9.put("beginTime", getZeroTime(DateUtils.addDays(new Date(), -6)));
Long edenoperationLoginCounts7Day = authLogService.countLoginByParams(params9);
mv.addObject("data_7_syy", edenoperationLoginCounts7Day);
// 近7日登录人次查询
List<String> dates = new ArrayList<>();
List<Long> dianjiaoguanDay7counts = new ArrayList<>();
List<Long> edenoperationDay7counts = new ArrayList<>();
for(int i = 0;i<7;i++){
dates.add(getDateDtr(DateUtils.addDays(new Date(), -(6-i))));
Map<String, Object> params = new HashMap<>();
params.put("authSource", "上海运营中心");
params.put("getUserInfoSuccessFlag", true);
params.put("beginTime", getZeroTime(DateUtils.addDays(new Date(), -(6-i))));
params.put("endTime", getEndTime(DateUtils.addDays(new Date(), -(6-i))));
params.put("oauthType", OauthType.dianjiaoguan.name());
Long dianjiaoguanCounts = authLogService.countLoginByParams(params);
dianjiaoguanDay7counts.add(dianjiaoguanCounts);
params.put("oauthType", OauthType.edenoperation.name());
Long edenoperationCounts = authLogService.countLoginByParams(params);
edenoperationDay7counts.add(edenoperationCounts);
}
mv.addObject("data_time", dates);
mv.addObject("data_djg", dianjiaoguanDay7counts);
mv.addObject("data_syy", edenoperationDay7counts);
mv.setViewName("statistics");
} else {
response.sendRedirect("adminLogin");
return null;
......
body {
overflow: auto;
}
.static{
width: 800px;
margin: 0 auto;
background-color: white;
}
.static-title{
font-size: 20px;
text-align: center;
padding-top: 50px;
padding-bottom: 30px;
margin-top: 0;
}
.p-class{
margin-left: 120px;
display: flex;
}
.p-label{
flex-basis: 200px;
text-align: right;
margin-right: 10px;
}
.p-num{
margin-right: 10px;
}
body {
overflow: auto;
}
.statistics-header{
width: 100%;
display: flex;
background-color: white;
align-items: center;
justify-content: space-between;
}
.flex {
/* flex: 1; */
}
.statistics-content {
margin: 20px 20px;
display: flex;
}
.statistics-content-item {
background-color: white;
margin: 10px 5px;
overflow: hidden;
}
.statistics-content-item-title {
padding: 20px 0 0 20px;
font-size: 14px;
}
.nums-total {
width: 162px;
height: 81px;
display: inline-block;
}
.nums-title {
color: white;
margin: 10px 10px;
font-weight: 700;
}
.nums-total-nums {
font-size: 24px;
}
.idp-total-nums {
color: rgb(77, 160, 255);
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<!DOCTYPE html>
<!--[if lt IE 7]>
<html xmlns:th="http://www.thymeleaf.org">
<html xmlns:th="http://www.w3.org/1999/xhtml" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>
<html xmlns:th="http://www.w3.org/1999/xhtml" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>
<html xmlns:th="http://www.w3.org/1999/xhtml" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" xmlns:th="http://www.w3.org/1999/xhtml">
<!--<![endif]-->
<head>
<meta charset="utf-8" />
<!--<meta http-equiv="X-UA-Compatible" content="IE=edge">-->
<meta content="" name="description" />
<meta content="width=device-width, initial-scale=1" name="viewport" />
<title>上海市中小学数字教材</title>
<link rel="stylesheet" th:href="@{/static/css/main_0327.css}" />
<link rel="stylesheet" th:href="@{/static/css/statistics.css}" />
<link rel="stylesheet" th:href="@{/static/css/bootstrap.min.css}" />
<link rel="stylesheet" th:href="@{/static/css/normalize.css}" />
<link rel="stylesheet" type="text/css" href="http://unpkg.com/view-design/dist/styles/iview.css">
<script type="text/javascript" src=../static/js/jquery-1.10.2.min.js"></script>
<script src="../static/js/echarts.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script type="text/javascript" src="http://unpkg.com/view-design/dist/iview.min.js"></script>
<!-- <link rel="stylesheet" th:href="@{/static/css/main_0327.css}"/>
<link rel="stylesheet" href="@{/static/css/statistics.css}"/>
<link rel="stylesheet" th:href="@{/static/css/bootstrap.min.css}"/>
<link rel="stylesheet" th:href="@{/static/css/normalize.css}"/>
<script type="text/javascript" th:src="@{/static/js/jquery-1.10.2.min.js}"></script>
<script src="@{/static/js/echarts.min.js}"></script> -->
</head>
<body style="background-color: rgb(244, 245, 245);">
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a
href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<!-- Add your site or application content here -->
<div id="app" class="static">
<div class="statistics-header">
<div class="flex" style="display: flex; align-items: center;">
<img src="../static/img/Rlogo.jpg" style="margin-left: 30px; width: 250px;" alt="">
<Divider type="vertical" style="height: 26px;"></Divider>
<p style="font-size: 14px;">发现服务 · 速享之旅</p>
</div>
<div class="flex">
<img src="../static/img/top-title.png" style="height: 22px;" alt="">
</div>
<div class="flex" style="display: flex;">
<i-select v-model="app" @on-change="refresh" style="width: 120px; margin: 0 5px;">
<i-option v-for="item in appList" :value="item.code" :label="item.name"></i-option>
</i-select>
<i-select v-model="time" @on-change="refresh" style="width: 120px; margin: 0 5px;">
<i-option v-for="item in timeType" :value="item.code" :label="item.name"></i-option>
</i-select>
<i-select v-if="time === 'year'" v-model="year" @on-change="refresh" style="width: 120px; margin: 0 5px;">
<i-option v-for="item in yearList" :value="item.code" :label="item.name"></i-option>
</i-select>
<i-select v-if="time === 'month'" v-model="month" @on-change="refresh" style="width: 120px; margin: 0 5px;">
<i-option v-for="item in monthList" :value="item.code" :label="item.name"></i-option>
</i-select>
</div>
</div>
<div class="statistics-content">
<div style="width: 25%;">
<div class="statistics-content-item">
<p class="statistics-content-item-title">应用来源</p>
<div id="app-source" style="width: 95%;height: calc(40vh - 80px); margin: 5px 5px;"></div>
</div>
<div class="statistics-content-item">
<p class="statistics-content-item-title">来源环境分析</p>
<div id="app-env-browser" style="width: 95%;height: calc(30vh - 90px); margin: 5px 5px;"></div>
<div id="app-env-system" style="width: 95%;height: calc(30vh - 90px); margin: 5px 5px;"></div>
</div>
</div>
<div style="width: 50%;">
<div class="statistics-content-item">
<p class="statistics-content-item-title">认证数据统计</p>
<div style="display: flex;">
<div style="width: 48%; height: calc(60vh - 160px); padding: 20px 0 0 20px; overflow-y: auto;">
<div class="nums-total" style="background: url(../static/img/blue-bg.png);">
<p class="nums-title">总认证人数</p>
<p class="nums-title"><span class="nums-total-nums" v-text="nums">24582</span></p>
</div>
<div class="nums-total" style="background: url(../static/img/green-bg.png);">
<p class="nums-title">基础教育统一认证人数</p>
<p class="nums-title"><span class="nums-total-nums" v-text="numsJcjy">24164</span></p>
</div>
<div style="margin-top: 10px; line-height: 1.5;">
<p v-for="item in numsIdpList">通过<span v-text="item.name"></span>子域认证:<span class="idp-total-nums" v-text="item.value"></span>
</p>
</div>
</div>
<div id="idp" style="width: 48%; height: calc(60vh - 160px); margin: 5px 5px;"></div>
</div>
</div>
<div class="statistics-content-item">
<p class="statistics-content-item-title">认证登陆高峰时间</p>
<div id="nums-by-time" style="width: 100%; height: calc(40vh - 80px)"></div>
</div>
</div>
<div style="width: 25%;">
<div class="statistics-content-item">
<p class="statistics-content-item-title">身份认证</p>
<div id="user-type" style="width: 95%;height: calc(40vh - 80px); margin: 5px 5px;"></div>
</div>
<div class="statistics-content-item">
<p class="statistics-content-item-title">认证热点单位</p>
<div id="user-org" style="height: calc(60vh - 160px);">
<p style="padding: 10px 20px 0 20px" v-for="item in userOrgList"><span
style="color: orange; font-weight: 900;">·</span><span v-text="item.name"></span><span
style="float: right;" v-text="item.count"></span></p>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var baseUrl = "https://ds-test.etextbook.cn/";
new Vue({
el: '#app',
data: {
year: 'all',
yearList: [
{ code: 'all', name: '全部' },
{ code: 2020, name: '2020年' }
],
month: 1,
monthList: [
{ code: 1, name: '1月' },
{ code: 2, name: '2月' },
{ code: 3, name: '3月' },
{ code: 4, name: '4月' },
{ code: 5, name: '5月' },
{ code: 6, name: '6月' },
{ code: 7, name: '7月' },
{ code: 8, name: '8月' },
{ code: 9, name: '9月' },
{ code: 10, name: '10月' },
{ code: 11, name: '11月' },
{ code: 12, name: '12月' },
],
time: 'year',
timeType: [
{code: 'year', name: '按年统计'},
{code: 'month', name: '按月统计'},
],
app: 'all',
appList: [],
numsIdpList: [
],
userOrgList: [],
nums: 0,
numsJcjy: 0,
},
mounted: function () {
this.init();
this.refresh();
},
methods: {
init: function () {
this.appList = [{ code: 'all', name: '全部' }]
var _this = this;
$.ajax({
type: 'GET',
url: baseUrl + 'authcenter/logstatistics/auth_apps',
success: function (result) {
_this.appList = _this.appList.concat(result.data)
},
error: function (e) {
console.log(e)
}
})
},
refresh: function () {
this.initSource();
this.initAppEnv();
this.initNums();
this.initNumsByTime();
this.initUserType();
this.initUserOrg();
},
initSource: function () {
var myChart = echarts.init(document.getElementById('app-source'), 'light');
var option = {
tooltip: {
trigger: "item",
formatter: "{a} <br/>{b}: {c} ({d}%)"
},
legend: {
bottom: 10,
data: ["数字教材", "阅览室", "其他"]
},
series: [
{
name: "应用来源",
type: "pie",
radius: ["30%", "50%"],
label: {
position: 'outside',
alignTo: 'edge',
margin: 10,
formatter: "{per|{d}%}",
rich: {
per: {
color: "black"
}
}
},
data: [
{ value: 21105, name: "数字教材" },
{ value: 3186, name: "阅览室" },
{ value: 271, name: "其他" }
]
}
]
};
let params = {
clientId: this.app,
year: this.year,
month: this.month
}
var _this = this;
$.ajax({
url: baseUrl + 'authcenter/logstatistics/app?' + _this.getParams(params),
success: function (result) {
// _this.appList = _this.appList.concat(result.data.data)
var legend = [];
var data = [];
for (var i = 0; i < result.data.length; i++) {
var element = result.data[i];
legend.push(element.name);
data.push({ value: element.count, name: element.name })
}
option.legend.data = legend;
option.series[0].data = data;
myChart.setOption(option);
},
error: function (e) {
console.log(e)
}
})
},
initAppEnv: function () {
let params = {
clientId: this.app,
year: this.year,
month: this.month
}
var _this = this;
$.ajax({
url: baseUrl + 'authcenter/logstatistics/environment?' + _this.getParams(params),
success: function (result) {
var legendSystem = [], dataSystem = [], legendBroswer = [], dataBrowser = [];
for (var i = 0; i < result.data.os.length; i++) {
var element = result.data.os[i];
legendSystem.push(element.name);
dataSystem.push({ value: element.count, name: element.name })
}
for (var i = 0; i < result.data.browser.length; i++) {
var element = result.data.browser[i];
legendBroswer.push(element.name);
dataBrowser.push({ value: element.count, name: element.name })
}
var myChartBrowser = echarts.init(document.getElementById('app-env-browser'), 'light');
var optionBrowser = {
tooltip: {
trigger: "item",
formatter: "{a} <br/>{b}: {c} ({d}%)"
},
legend: {
orient: 'vertical',
right: 'right',
top: 'middle',
data: legendBroswer,
formatter: function (name) {
var target;
for (var i = 0, l = dataBrowser.length; i < l; i++) {
if (dataBrowser[i].name == name) {
target = dataBrowser[i].value;
}
}
return name + ' ' + target;
}
},
series: [
{
name: "浏览器类型",
type: "pie",
radius: ["30%", "50%"],
center: ['30%', '50%'],
label: {
position: 'inner',
formatter: "{per|{d}%}",
rich: {
per: {
color: "black"
}
}
},
data: dataBrowser
}
]
};
myChartBrowser.setOption(optionBrowser);
var myChartSystem = echarts.init(document.getElementById('app-env-system'), 'light');
var optionSystem = {
tooltip: {
trigger: "item",
formatter: "{a} <br/>{b}: {c} ({d}%)"
},
legend: {
orient: 'vertical',
right: 'right',
top: 'middle',
data: legendSystem,
formatter: function (name) {
var target;
for (var i = 0, l = dataSystem.length; i < l; i++) {
if (dataSystem[i].name == name) {
target = dataSystem[i].value;
}
}
return name + ' ' + target;
}
},
series: [
{
name: "操作系统类型",
type: "pie",
radius: ["30%", "50%"],
center: ['30%', '50%'],
label: {
position: 'inner',
formatter: "{per|{d}%}",
rich: {
per: {
color: "black"
}
}
},
data: dataSystem
}
]
};
myChartSystem.setOption(optionSystem);
},
error: function (e) {
console.log(e)
}
})
},
initNums: function () {
var _this = this;
$.getJSON('./js/SHdata.json', function (SHjson) {
var myChartNums = echarts.init(document.getElementById("idp"), 'light');
// 第二个参数为导入地图文件
echarts.registerMap('shanghai', SHjson);
var optionNums = {
tooltip: {
trigger: 'item',
formatter: "{b}: {c}"
},
visualMap: {
show: false,
min: 0,
max: 418,
text: ['高', '低'],
realtime: false,
calculable: true,
inRange: {
color: ['lightskyblue', 'yellow', 'orangered']
}
},
series: [
{
type: 'map',
mapType: 'shanghai',
data: [],
}
]
};
let params = {
clientId: _this.app,
year: _this.year,
month: _this.month
}
$.ajax({
url: baseUrl + 'authcenter/logstatistics/auth?' + _this.getParams(params),
success: function (result) {
_this.nums = result.data.all_auth;
_this.numsJcjy = result.data.cas_edu_auth;
_this.numsIdpList = result.data.area_auth;
var legend = [], data = [];
for (var i = 0; i < result.data.area_auth.length; i++) {
var element = result.data.area_auth[i];
legend.push(element.name);
data.push({ value: element.count, name: element.name })
}
_this.numsIdpList = data;
optionNums.series[0].data = data
myChartNums.setOption(optionNums);
},
error: function (e) {
console.log(e)
}
})
})
},
initNumsByTime: function () {
var optionNumsByTime = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value'
},
series: [{
data: [],
type: 'line',
areaStyle: {}
}]
};
let params = {
clientId: this.app,
year: this.year,
month: this.month
}
var _this = this;
$.ajax({
url: baseUrl + 'authcenter/logstatistics/auth_pick_times?' + _this.getParams(params),
success: function (result) {
var legend = [], data = [];
for (var i = 0; i < result.data.length; i++) {
var element = result.data[i];
legend.push(element.name);
data.push({ value: element.count, name: element.name })
}
optionNumsByTime.xAxis.data = legend;
optionNumsByTime.series[0].data = data;
var myChartNumsByTime = echarts.init(document.getElementById("nums-by-time"), 'light');
myChartNumsByTime.setOption(optionNumsByTime);
},
error: function (e) {
console.log(e)
}
})
},
initUserType: function () {
var optionUserType = {
tooltip: {
trigger: "item",
formatter: "{a} <br/>{b}: {c} ({d}%)"
},
legend: {
bottom: 10,
data: []
},
series: [
{
name: "访客身份",
type: "pie",
radius: ["30%", "50%"],
label: {
position: 'outside',
alignTo: 'edge',
margin: 10,
formatter: "{per|{d}%}",
rich: {
per: {
color: "black"
}
}
},
data: []
}
]
};
let params = {
clientId: this.app,
year: this.year,
month: this.month
}
var _this = this;
$.ajax({
url: baseUrl + 'authcenter/logstatistics/auth_user_type?' + _this.getParams(params),
success: function (result) {
var legend = [], data = [];
for (var i = 0; i < result.data.length; i++) {
var element = result.data[i];
legend.push(element.name);
data.push({ value: element.count, name: element.name })
}
optionUserType.legend.data = legend;
optionUserType.series[0].data = data;
var myChartUserType = echarts.init(document.getElementById('user-type'), 'light');
myChartUserType.setOption(optionUserType);
},
error: function (e) {
console.log(e)
}
})
},
initUserOrg: function () {
let params = {
clientId: this.app,
year: this.year,
month: this.month
}
var _this = this;
$.ajax({
url: baseUrl + 'authcenter/logstatistics/auth_hot_org?' + _this.getParams(params),
success: function (result) {
_this.userOrgList = result.data
},
error: function (e) {
console.log(e)
}
})
},
getParams: function (params) {
if (!params) return '';
let res = '';
let keys = Object.keys(params);
for (let i = 0; i < keys.length; i++) {
if (params[keys[i]] !== 'all' && (keys[i] === 'clientId' || keys[i] === this.time)) {
if (res !== '') res += '&'
res = res + keys[i] + '=' + params[keys[i]];
}
}
return res;
}
},
})
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment