Commit b607ead6 authored by JiangSN's avatar JiangSN

更新首页图表、增加查询访问量定时任务、修改省平台接口token判断逻辑

parent f2d73dfe
......@@ -61,10 +61,10 @@ export default {
this.chart = echarts.init(this.$el, 'macarons')
this.setOptions(this.chartData)
},
setOptions({ expectedData, actualData } = {}) {
setOptions({ sptData, zjbData, data } = {}) {
this.chart.setOption({
xAxis: {
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
data: data,
boundaryGap: false,
axisTick: {
show: false
......@@ -90,26 +90,29 @@ export default {
}
},
legend: {
data: ['expected', 'actual']
data: ['省平台', '住建部']
},
series: [{
name: 'expected', itemStyle: {
name: '省平台', itemStyle: {
normal: {
color: '#FF005A',
lineStyle: {
color: '#FF005A',
width: 2
},
areaStyle: {
color: '#fedbdd'
}
}
},
smooth: true,
type: 'line',
data: expectedData,
data: sptData,
animationDuration: 2800,
animationEasing: 'cubicInOut'
},
{
name: 'actual',
name: '住建部',
smooth: true,
type: 'line',
itemStyle: {
......@@ -124,7 +127,7 @@ export default {
}
}
},
data: actualData,
data: zjbData,
animationDuration: 2800,
animationEasing: 'quadraticOut'
}]
......
<template>
<el-row :gutter="40" class="panel-group">
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('newVisitis')">
<div class="card-panel" @click="handleSetLineChartData('Day')">
<div class="card-panel-icon-wrapper icon-people">
<svg-icon icon-class="visits" class-name="card-panel-icon" />
<svg-icon icon-class="visits" class-name="card-panel-icon"/>
</div>
<div class="card-panel-description">
<div class="card-panel-text">
日访问量
省平台-当日访问量
</div>
<count-to :start-val="0" :end-val="this.visits" :duration="2600" class="card-panel-num" />
<count-to :start-val="0" :end-val="this.visitorVolume.sptDay" :duration="2600" class="card-panel-num"/>
</div>
</div>
</el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('messages')">
<div class="card-panel" @click="handleSetLineChartData('Day')">
<div class="card-panel-icon-wrapper icon-people">
<svg-icon icon-class="visits" class-name="card-panel-icon" />
<svg-icon icon-class="visits" class-name="card-panel-icon"/>
</div>
<div class="card-panel-description">
<div class="card-panel-text">
每月访问量
住建部-当日访问量
</div>
<count-to :start-val="0" :end-val="this.totalview" :duration="3000" class="card-panel-num" />
<count-to :start-val="0" :end-val="this.visitorVolume.zjbDay" :duration="3200" class="card-panel-num"/>
</div>
</div>
</el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('purchases')">
<div class="card-panel" @click="handleSetLineChartData('Month')">
<div class="card-panel-icon-wrapper icon-message">
<svg-icon icon-class="tree" class-name="card-panel-icon"/>
</div>
<div class="card-panel-description">
<div class="card-panel-text">
任务调度
省平台-当月访问量
</div>
<count-to :start-val="0" :end-val="'----'" :duration="3200" class="card-panel-num" />
<count-to :start-val="0" :end-val="this.visitorVolume.sptMonth" :duration="3000" class="card-panel-num"/>
</div>
</div>
</el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('shoppings')">
<div class="card-panel" @click="handleSetLineChartData('Month')">
<div class="card-panel-icon-wrapper icon-shopping">
<svg-icon icon-class="shopping" class-name="card-panel-icon" />
<svg-icon icon-class="shopping" class-name="card-panel-icon"/>
</div>
<div class="card-panel-description">
<div class="card-panel-text">
住建部-当月访问量
</div>
<count-to :start-val="0" :end-val="'----'" :duration="3600" class="card-panel-num" />
<count-to :start-val="0" :end-val="this.visitorVolume.zjbMonth" :duration="3600" class="card-panel-num"/>
</div>
</div>
</el-col>
......@@ -60,13 +60,14 @@ import CountTo from 'vue-count-to'
export default {
props: {
visits: {
type: String,
default: 0
},
totalview: {
type: String,
default: 0
visitorVolume: {
type: Object,
default: {
sptDay: 0,
sptMonth: 0,
zjbDay: 0,
zjbMonth: 0
}
},
},
components: {
......@@ -170,7 +171,7 @@ export default {
}
}
@media (max-width:550px) {
@media (max-width: 550px) {
.card-panel-description {
display: none;
}
......
<template>
<div class="dashboard-container">
<div class="dashboard-editor-container">
<!-- <github-corner class="github-corner" />-->
<panel-group @handleSetLineChartData="handleSetLineChartData" />
<panel-group @handleSetLineChartData="handleSetLineChartData" :visitorVolume="this.visitorVolume"/>
<a href="javascript:" style="font-size: 20pt;margin: auto;text-align: center;">{{ this.name }}</a>
<el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
<line-chart :chart-data="lineChartData" />
<line-chart :chart-data="lineChartData"/>
</el-row>
<el-row :gutter="32">
<!-- <el-row :gutter="32">
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<radar-chart />
......@@ -24,7 +23,7 @@
<bar-chart />
</div>
</el-col>
</el-row>
</el-row>-->
</div>
</div>
</template>
......@@ -38,22 +37,18 @@ import PieChart from '@/components/Echarts/PieChart'
import BarChart from '@/components/Echarts/BarChart'
const lineChartData = {
newVisitis: {
expectedData: [100, 120, 161, 134, 105, 160, 165],
actualData: [120, 82, 91, 154, 162, 140, 145]
},
messages: {
expectedData: [200, 192, 120, 144, 160, 130, 140],
actualData: [180, 160, 151, 106, 145, 150, 130]
Day: {
sptData: [],
zjbData: [],
data: []
},
purchases: {
expectedData: [80, 100, 121, 104, 105, 90, 100],
actualData: [120, 90, 100, 138, 142, 130, 130]
Month: {
//expectedData
sptData: [],
//expectedData
zjbData: [],
data: []
},
shoppings: {
expectedData: [130, 140, 141, 142, 145, 150, 160],
actualData: [120, 82, 91, 154, 162, 140, 130]
}
}
export default {
......@@ -67,40 +62,87 @@ export default {
},
data() {
return {
lineChartData: lineChartData.newVisitis
name: '每日访问量',
visitorVolume: {
sptDay: 0,
sptMonth: 0,
zjbDay: 0,
zjbMonth: 0
},
lineChartData: lineChartData.Day
}
},
methods: {
init() {
this.getDataList();
},
getDataList() {
this.$http.post("api/IndexController/selectVisitsList").then(function (res) {
for (const re of res.body.content) {
switch (re.LABLE) {
case "住建部当日" :
this.visitorVolume.zjbDay = re.SL;
break;
case "住建部当月" :
this.visitorVolume.zjbMonth = re.SL;
break;
case "省平台当日" :
this.visitorVolume.sptDay = re.SL;
break;
default :
this.visitorVolume.sptMonth = re.SL;
break;
}
}
})
this.$http.post("api/IndexController/selectMyfwlList").then(function (res) {
lineChartData.Month.data = []
lineChartData.Month.sptData = []
lineChartData.Month.zjbData = []
for (const re of res.body.content) {
lineChartData.Month.data.push(re.YUEFEN)
lineChartData.Month.sptData.push(re.SPTYFWL)
lineChartData.Month.zjbData.push(re.ZJBYFWL)
}
})
this.$http.post("api/IndexController/selectMrfwlList").then(function (res) {
lineChartData.Day.data = []
lineChartData.Day.sptData = []
lineChartData.Day.zjbData = []
for (const re of res.body.content) {
lineChartData.Day.data.push(re.RIQI)
lineChartData.Day.sptData.push(re.SPTRFWL)
lineChartData.Day.zjbData.push(re.ZJBRFWL)
}
})
},
handleSetLineChartData(type) {
type === "Day" ? this.name = "每日访问量" : this.name = "每月访问量"
this.lineChartData = lineChartData[type]
}
},
mounted() {
this.init();
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.dashboard-editor-container {
.dashboard-editor-container {
padding: 32px;
background-color: rgb(240, 242, 245);
position: relative;
.github-corner {
position: absolute;
top: 0;
border: 0;
right: 0;
}
.chart-wrapper {
background: #fff;
padding: 16px 16px 0;
margin-bottom: 32px;
}
}
}
@media (max-width:1024px) {
@media (max-width: 1024px) {
.chart-wrapper {
padding: 8px;
}
}
}
</style>
......@@ -7,5 +7,11 @@ import java.util.Map;
public interface IndexMapper extends BaseMapper<Map> {
List<Map> selectDemo();
List<Map> selectVisitsList();
List<Map> selectMyfwlList();
List<Map> selectMrfwlList();
List<Map> insertIntoFwl();
}
......@@ -17,7 +17,7 @@ import java.util.Map;
* @version V1.0
* @Title: gatewayZsjJlController
* @Package el-admin
* @Description: TODO(调用政务外网接口控制器)
* @Description: 调用政务外网接口控制器
* @date 2021/10/11 10:53
*/
@RestController
......
package me.zhengjie.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.AnonymousAccess;
import me.zhengjie.service.IndexService;
......@@ -9,12 +10,15 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* @author JiangHeJia
* @version V1.0
* @Title: IndexController
* @Package el-admin
* @Description: TODO(首页展示信息查询控制器)
* @Description: 首页展示信息查询控制器
* @date 2021/10/12 21:28
*/
@RestController
......@@ -27,9 +31,25 @@ public class IndexController {
private IndexService indexService;
@AnonymousAccess
@RequestMapping("/selectDemo")
public R selectDemo() {
return new R<>(indexService.selectDemo());
@ApiOperation("接口访问量查询")
@RequestMapping("/selectVisitsList")
public R selectVisitsList() {
List<Map> visits = indexService.selectVisitsList();
return new R<>(visits);
}
@AnonymousAccess
@ApiOperation("接口月访问量图表查询")
@RequestMapping("/selectMyfwlList")
public R selectMyfwlList() {
List<Map> visits = indexService.selectMyfwlList();
return new R<>(visits);
}
@AnonymousAccess
@ApiOperation("接口日访问量图表查询")
@RequestMapping("/selectMrfwlList")
public R selectMrfwlList() {
List<Map> visits = indexService.selectMrfwlList();
return new R<>(visits);
}
}
......@@ -2,17 +2,46 @@ package me.zhengjie.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
/**
* @author JiangHeJia
* @version V1.0
* @Title: IndexService
* @Package el-admin
* @Description: 首页展示信息查询接口
* @date 2021/10/12 21:30
*/
public interface IndexService extends IService<Map> {
/**
* @Title: selectVisitsList
* @Description: 接口访问量查询接口
* @date: 2021/10/27 10:38
*/
List<Map> selectVisitsList();
/**
* 领导-管理部贷款逾期情况
* @return
* @Title: selectMyfwlList
* @Description: 每月访问量展示查询接口
* @date: 2021/10/27 14:38
*/
List<Map> selectDemo();
List<Map> selectMyfwlList();
/**
* @Title: selectMrfwlList
* @Description: 每日访问量展示查询接口
* @date: 2021/10/27 14:38
*/
List<Map> selectMrfwlList();
/**
* @Title: insertIntoFwl
* @Description: 调用访问量存储过程接口
* @date: 2021/10/27 14:38
*/
List<Map> insertIntoFwl();
}
......@@ -14,7 +14,7 @@ import java.util.Map;
* @version V1.0
* @Title: IndexServiceImpl
* @Package el-admin
* @Description: TODO()
* @Description: 首页展示信息查询接口实现类
* @date 2021/10/12 21:30
*/
@Service
......@@ -23,9 +23,47 @@ public class IndexServiceImpl extends ServiceImpl<IndexMapper, Map> implements I
@Autowired
private IndexMapper indexMapper;
/**
* @Title: selectVisitsList
* @Description: 接口访问量查询实现
* * @param null:
* * @return: List<Map>
* @date: 2021/10/27 10:40
*/
@Override
public List<Map> selectVisitsList() {
return indexMapper.selectVisitsList();
}
/**
* @Title: selectMyfwlList
* @Description: 每月访问量展示查询实现
* * @return: List<Map>
* @date: 2021/10/27 10:40
*/
@Override
public List<Map> selectMyfwlList() {
return indexMapper.selectMyfwlList();
}
/**
* @Title: selectMrfwlList
* @Description: 每日访问量展示查询实现
* * @return: List<Map>
* @date: 2021/10/27 10:40
*/
@Override
public List<Map> selectMrfwlList() {
return indexMapper.selectMrfwlList();
}
/**
* @Title: selectMrfwlList
* @Description: 调用访问量存储过程接口
* * @return: List<Map>
* @date: 2021/10/27 10:40
*/
@Override
public List<Map> selectDemo() {
return indexMapper.selectDemo();
public List<Map> insertIntoFwl() {
return indexMapper.insertIntoFwl();
}
}
......@@ -35,11 +35,15 @@ import java.util.*;
* @version V1.0
* @Title: shengneiUtil
* @Package eladmin
* @Description: TODO(政务外网访问工具类)
* @Description: 政务外网访问工具类
* @date 2021/9/14 16:57
*/
@Log
public class shengneiUtil {
@Autowired
static RedisUtils redisUtils;
/**
* httpclient
*
......@@ -61,12 +65,9 @@ public class shengneiUtil {
return HttpClients.createDefault();
}
@Autowired
static RedisUtils redisUtils;
/**
* 获取token
*
* @return
*/
public static void getToken(CloseableHttpClient httpClinet) {
......@@ -174,11 +175,16 @@ public class shengneiUtil {
obj.put("format", "JSON");
obj.put("timestamp", da);
log.info("发送内容" + obj);
//todo-sn 2021/10/11 10:30 Ash:判断token是否失效,失效重新获取token后再次发送请求;未测试
//todo-sn 2021/10/13 15:51 Ash: 判断token是否为空,为空获取token
if (Objects.equals(redisUtils.get("access_token"), "") || Objects.equals(redisUtils.get("access_token"), null)) {
// 查询redis中是否有token,没有获取一遍。
if (Objects.equals(redisUtils.get("access_token"), null)) {
getToken(httpClinet);
}
String doPost = doPost(url, obj.toString(), redisUtils.get("access_token").toString(), httpClinet);
Map resultMap = JSONUtil.toMap(doPost);
// 返回状态码为400003(第三方接口查询失败)时,重新获取一遍token。
if ("400003".equals(resultMap.get("code"))) {
getToken(httpClinet);
}
return doPost(url, obj.toString(), redisUtils.get("access_token").toString(), httpClinet);
return doPost;
}
}
......@@ -2,10 +2,42 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="me.zhengjie.MybatisMapper.IndexMapper">
<!-- 领导-贷款逾期-->
<select id="selectDemo" resultType="java.util.Map">
<select id="selectVisitsList" resultType="java.util.Map">
<![CDATA[
select * from sjgx_sys_log
select count(x.id) SL, '省平台当日' lable
from v_sjgx_mrfwl x
where x.lable = 'SPT'
and to_char(x.RQ, 'yyyymmdd') = to_char(sysdate, 'yyyymmdd')
union
select count(x.id) SL, '省平台当月' lable
from v_sjgx_mrfwl x
where x.lable = 'spt'
and to_char(x.RQ, 'yyyymm') = to_char(sysdate, 'yyyymm')
union
select count(x.id) SL,'住建部当日' lable
from v_sjgx_mrfwl x
where x.lable = 'zjb'
and to_char(x.RQ, 'yyyymmdd') = to_char(sysdate, 'yyyymmdd')
union
select count(x.id) SL,'住建部当月' lable
from v_sjgx_mrfwl x
where x.lable = 'zjb'
and to_char(x.RQ, 'yyyymm') = to_char(sysdate, 'yyyymm')
]]>
</select>
<select id="selectMyfwlList" resultType="java.util.Map">
<![CDATA[
select * from SJGX_SYYFWLZSB
]]>
</select>
<select id="selectMrfwlList" resultType="java.util.Map">
<![CDATA[
select * from SJGX_SYRFWLZSB
]]>
</select>
<select id="insertIntoFwl" resultType="java.util.Map">
<![CDATA[
call P_SJGX_FWL()
]]>
</select>
</mapper>
......@@ -18,6 +18,7 @@ package me.zhengjie.modules.quartz.task;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.service.IndexService;
import me.zhengjie.util.shengneiUtil;
import me.zhengjie.utils.RedisUtils;
import org.apache.http.NameValuePair;
......@@ -30,17 +31,24 @@ import java.util.ArrayList;
import java.util.List;
/**
* 测试用
* @author Zheng Jie
* @date 2019-01-08
* 定时任务
* @author JiangHeJia
* @date 2021/10/27
*/
@Slf4j
@Component
public class TestTask {
public class TimingTask {
@Autowired
RedisUtils redisUtils;
public void runToken(){
@Autowired
private IndexService indexService;
/**
* @Title: timingToken
* @Description: 定时获取省平台token
* @date: 2021/10/27 15:37
*/
public void timingToken(){
CloseableHttpClient httpClinet = shengneiUtil.createSSLClientDefault();
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
//client_id
......@@ -58,4 +66,12 @@ public class TestTask {
log.info("返回token为空");
}
}
/**
* @Title: timingVisitorVolume
* @Description: 定时调用更新访问量存储过程
* @date: 2021/10/27 15:37
*/
public void timingVisitorVolume (){
indexService.insertIntoFwl();
}
}
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