首页代码拷贝到V3
This commit is contained in:
parent
43af43dd24
commit
1b653ff985
|
@ -2,9 +2,10 @@
|
|||
logging:
|
||||
#日志级别 指定目录级别
|
||||
level:
|
||||
root: info
|
||||
root: error
|
||||
encodings: UTF-8
|
||||
file:
|
||||
# 日志保存路径
|
||||
path: /home/webservice/zt/log
|
||||
spring:
|
||||
datasource:
|
||||
|
@ -16,6 +17,5 @@ spring:
|
|||
password: bd993088e8a7c3dc5f44441617f9b4bf
|
||||
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
|
||||
savefile:
|
||||
# 文件保存路径
|
||||
path: /home/webservice/zt/file
|
||||
ax:
|
||||
url: http://127.0.0.1:9081/kangarooDataCenterV3/entranceController/externalCallInterface
|
|
@ -0,0 +1,24 @@
|
|||
package com.hzya.frame.home.dao;
|
||||
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.home.entity.HomeEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IHomeDao extends IBaseDao<HomeEntity, String> {
|
||||
|
||||
|
||||
List<HomeEntity> getAppErrorNum(HomeEntity homeEntity);
|
||||
|
||||
List<HomeEntity> appApiNum(HomeEntity homeEntity);
|
||||
|
||||
List<HomeEntity> useApiNum(HomeEntity homeEntity);
|
||||
|
||||
HomeEntity taskNumRun(HomeEntity homeEntity);
|
||||
HomeEntity taskNumStop(HomeEntity homeEntity);
|
||||
|
||||
List<HomeEntity> sevenerrornum(HomeEntity homeEntity);
|
||||
|
||||
List<HomeEntity> sevensuccessnum(HomeEntity homeEntity);
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.hzya.frame.home.dao.impl;
|
||||
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
import com.hzya.frame.home.dao.IHomeDao;
|
||||
import com.hzya.frame.home.entity.HomeEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository(value = "HomeDaoImpl")
|
||||
public class HomeDaoImpl extends MybatisGenericDao<HomeEntity, String> implements IHomeDao {
|
||||
|
||||
|
||||
@Override
|
||||
public List<HomeEntity> getAppErrorNum(HomeEntity entity) {
|
||||
List<HomeEntity> o = (List<HomeEntity>) super.selectList(getSqlIdPrifx() + "getAppErrorNum", entity);
|
||||
return o;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HomeEntity> appApiNum(HomeEntity entity) {
|
||||
List<HomeEntity> o = (List<HomeEntity>) super.selectList(getSqlIdPrifx() + "appApiNum", entity);
|
||||
return o;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HomeEntity> useApiNum(HomeEntity entity) {
|
||||
List<HomeEntity> o = (List<HomeEntity>) super.selectList(getSqlIdPrifx() + "useApiNum", entity);
|
||||
return o;
|
||||
}
|
||||
@Override
|
||||
public List<HomeEntity> sevenerrornum(HomeEntity entity) {
|
||||
List<HomeEntity> o = (List<HomeEntity>) super.selectList(getSqlIdPrifx() + "sevenerrornum", entity);
|
||||
return o;
|
||||
}
|
||||
@Override
|
||||
public List<HomeEntity> sevensuccessnum(HomeEntity entity) {
|
||||
List<HomeEntity> o = (List<HomeEntity>) super.selectList(getSqlIdPrifx() + "sevensuccessnum", entity);
|
||||
return o;
|
||||
}
|
||||
@Override
|
||||
public HomeEntity taskNumRun(HomeEntity entity) {
|
||||
HomeEntity o = (HomeEntity) super.selectOne(getSqlIdPrifx() + "taskNumRun", entity);
|
||||
return o;
|
||||
}
|
||||
@Override
|
||||
public HomeEntity taskNumStop(HomeEntity entity) {
|
||||
HomeEntity o = (HomeEntity) super.selectOne(getSqlIdPrifx() + "taskNumStop", entity);
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
package com.hzya.frame.home.entity;
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
|
||||
|
||||
public class HomeEntity extends BaseEntity {
|
||||
//应用id
|
||||
private String appId;
|
||||
|
||||
//应用图标
|
||||
private String path;
|
||||
//
|
||||
private String name;
|
||||
|
||||
//数量
|
||||
private Integer num;
|
||||
//正常数量
|
||||
private Integer normalNum;
|
||||
//异常数量
|
||||
private Integer abnormalNum;
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public Integer getNormalNum() {
|
||||
return normalNum;
|
||||
}
|
||||
|
||||
public void setNormalNum(Integer normalNum) {
|
||||
this.normalNum = normalNum;
|
||||
}
|
||||
|
||||
public Integer getAbnormalNum() {
|
||||
return abnormalNum;
|
||||
}
|
||||
|
||||
public void setAbnormalNum(Integer abnormalNum) {
|
||||
this.abnormalNum = abnormalNum;
|
||||
}
|
||||
|
||||
public Integer getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(Integer num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hzya.frame.home.dao.impl.HomeDaoImpl">
|
||||
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="getAppErrorNum" resultType="com.hzya.frame.home.entity.HomeEntity" parameterType="com.hzya.frame.home.entity.HomeEntity">
|
||||
SELECT
|
||||
receive_app as appId,
|
||||
count( 1 ) as num
|
||||
FROM
|
||||
sys_message_manage_log
|
||||
WHERE sts = 'Y' and status = '4'
|
||||
GROUP BY
|
||||
receive_app
|
||||
</select>
|
||||
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="appApiNum" resultType="com.hzya.frame.home.entity.HomeEntity" parameterType="com.hzya.frame.home.entity.HomeEntity">
|
||||
SELECT
|
||||
api.app_id as appId,
|
||||
app.app_logo as path,
|
||||
count( 1 ) as num
|
||||
FROM
|
||||
sys_application_api api
|
||||
left join sys_application app on app.id = api.app_id and app.sts = 'Y'
|
||||
WHERE api.sts = 'Y' and api.app_id is not null
|
||||
GROUP BY
|
||||
api.app_id
|
||||
</select>
|
||||
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="useApiNum" resultType="com.hzya.frame.home.entity.HomeEntity" parameterType="com.hzya.frame.home.entity.HomeEntity">
|
||||
SELECT
|
||||
a.app_id as appId,
|
||||
COUNT( a.api_id ) as normalNum
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
app_id,
|
||||
api_id
|
||||
FROM
|
||||
sys_application_api_auth_detail
|
||||
WHERE
|
||||
sts = 'Y'
|
||||
GROUP BY
|
||||
api_id
|
||||
) a
|
||||
left join sys_application_api api on api.id = a.api_id and api.sts = 'Y'
|
||||
WHERE api.id is not null
|
||||
GROUP BY
|
||||
a.app_id
|
||||
|
||||
</select>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="taskNumRun" resultType="com.hzya.frame.home.entity.HomeEntity" parameterType="com.hzya.frame.home.entity.HomeEntity">
|
||||
SELECT
|
||||
count( 1 ) as normalNum
|
||||
FROM
|
||||
integration_task_monitoring
|
||||
WHERE
|
||||
sts = 'Y'
|
||||
AND typed = '1'
|
||||
</select>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="taskNumStop" resultType="com.hzya.frame.home.entity.HomeEntity" parameterType="com.hzya.frame.home.entity.HomeEntity">
|
||||
SELECT
|
||||
count( 1 ) as abnormalNum
|
||||
FROM
|
||||
integration_task_monitoring
|
||||
WHERE
|
||||
sts = 'Y'
|
||||
AND typed = '2'
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="sevenerrornum" resultType="com.hzya.frame.home.entity.HomeEntity" parameterType="com.hzya.frame.home.entity.HomeEntity">
|
||||
SELECT
|
||||
count( id ) as abnormalNum,
|
||||
DATE_FORMAT( create_time, '%Y-%m-%d' ) as name
|
||||
FROM
|
||||
sys_message_manage_log
|
||||
WHERE sts = 'Y' and status = '4' and
|
||||
create_time BETWEEN DATE_SUB( NOW(), INTERVAL 6 DAY ) AND NOW()
|
||||
GROUP BY
|
||||
DATE_FORMAT( create_time, '%Y%m%d' )
|
||||
ORDER BY
|
||||
DATE_FORMAT(
|
||||
create_time,
|
||||
'%Y%m%d')
|
||||
</select>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="sevensuccessnum" resultType="com.hzya.frame.home.entity.HomeEntity" parameterType="com.hzya.frame.home.entity.HomeEntity">
|
||||
SELECT
|
||||
count( id ) as normalNum,
|
||||
DATE_FORMAT( create_time, '%Y-%m-%d' ) as name
|
||||
FROM
|
||||
sys_message_manage_log_success
|
||||
WHERE sts = 'Y' and status = '3' and
|
||||
create_time BETWEEN DATE_SUB( NOW(), INTERVAL 6 DAY ) AND NOW()
|
||||
GROUP BY
|
||||
DATE_FORMAT( create_time, '%Y%m%d' )
|
||||
ORDER BY
|
||||
DATE_FORMAT(
|
||||
create_time,
|
||||
'%Y%m%d')
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.hzya.frame.home.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
import com.hzya.frame.home.entity.HomeEntity;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
||||
public interface IHomeService extends IBaseService<HomeEntity, String> {
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 分组统计应用下接口日志表失败的数量(返回应用名称、失败数)
|
||||
* @Date 10:17 上午 2024/5/11
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity appErrorNum(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 分组统计应用下面api的总数量,以及是否有授权的api数量,(返回应用名称、api总数量、启用数量、停用数量)
|
||||
* @Date 10:17 上午 2024/5/11
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity appApiNum(JSONObject jsonObject);
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 查询任务监控表数据(返回任务名称、状态、总数、上次耗时、上次执行时间)
|
||||
* @Date 10:17 上午 2024/5/11
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity taskNum(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 统计最近7天内api成功和失败数量
|
||||
* @Date 10:17 上午 2024/5/11
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity sevenNum(JSONObject jsonObject);
|
||||
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
package com.hzya.frame.home.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
import com.hzya.frame.home.dao.IHomeDao;
|
||||
import com.hzya.frame.home.entity.HomeEntity;
|
||||
import com.hzya.frame.home.service.IHomeService;
|
||||
import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service(value = "homeService")
|
||||
public class HomeServiceImpl extends BaseService<HomeEntity, String> implements IHomeService {
|
||||
|
||||
private IHomeDao homeDao;
|
||||
@Resource
|
||||
private ISysApplicationDao sysApplicationDao;
|
||||
@Autowired
|
||||
public void setSysApplicationApiDao(IHomeDao dao) {
|
||||
this.homeDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 分组统计应用下接口日志表失败的数量(返回应用名称、失败数)
|
||||
* @Date 10:17 上午 2024/5/11
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity appErrorNum(JSONObject jsonObject) {
|
||||
HomeEntity homeEntity = new HomeEntity();
|
||||
List<HomeEntity> homeEntities = homeDao.getAppErrorNum(homeEntity);
|
||||
if(homeEntities != null && homeEntities.size() > 0){
|
||||
SysApplicationEntity sysApplicationEntity = new SysApplicationEntity();
|
||||
sysApplicationEntity.setSts("Y");
|
||||
List<SysApplicationEntity> sysApplicationEntities = sysApplicationDao.queryByLike(sysApplicationEntity);
|
||||
if(sysApplicationEntities != null && sysApplicationEntities.size() > 0){
|
||||
for (int i = 0; i < homeEntities.size(); i++) {
|
||||
for (int a = 0; a < sysApplicationEntities.size(); a++) {
|
||||
if(homeEntities.get(i).getAppId()!= null && sysApplicationEntities.get(a).getId().equals(homeEntities.get(i).getAppId())){
|
||||
homeEntities.get(i).setPath(sysApplicationEntities.get(a).getAppLogo());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功",homeEntities);
|
||||
}
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 分组统计应用下面api的总数量,以及是否有授权的api数量,(返回应用名称、api总数量、启用数量、停用数量)
|
||||
* @Date 10:17 上午 2024/5/11
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity appApiNum(JSONObject jsonObject) {
|
||||
HomeEntity homeEntity = new HomeEntity();
|
||||
List<HomeEntity> homeEntities = homeDao.appApiNum(homeEntity);
|
||||
if(homeEntities != null && homeEntities.size() > 0){
|
||||
List<HomeEntity> useApiNum = homeDao.useApiNum(homeEntity);
|
||||
if(useApiNum != null && useApiNum.size() > 0){
|
||||
for (int i = 0; i < homeEntities.size(); i++) {
|
||||
for (int a = 0; a < useApiNum.size(); a++) {
|
||||
if(homeEntities.get(i).getAppId()!= null && useApiNum.get(a).getAppId().equals(homeEntities.get(i).getAppId())){
|
||||
homeEntities.get(i).setNormalNum(useApiNum.get(a).getNormalNum());
|
||||
homeEntities.get(i).setAbnormalNum(homeEntities.get(i).getNum() - useApiNum.get(a).getNormalNum());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SysApplicationEntity sysApplicationEntity = new SysApplicationEntity();
|
||||
sysApplicationEntity.setSts("Y");
|
||||
List<SysApplicationEntity> sysApplicationEntities = sysApplicationDao.queryByLike(sysApplicationEntity);
|
||||
if(sysApplicationEntities != null && sysApplicationEntities.size() > 0){
|
||||
for (int i = 0; i < homeEntities.size(); i++) {
|
||||
for (int a = 0; a < sysApplicationEntities.size(); a++) {
|
||||
if(homeEntities.get(i).getAppId()!= null && sysApplicationEntities.get(a).getId().equals(homeEntities.get(i).getAppId())){
|
||||
homeEntities.get(i).setPath(sysApplicationEntities.get(a).getAppLogo());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功",homeEntities);
|
||||
}
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 查询任务监控表数据(返回任务名称、状态、总数、上次耗时、上次执行时间)
|
||||
* @Date 10:17 上午 2024/5/11
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity taskNum(JSONObject jsonObject) {
|
||||
HomeEntity homeEntity = new HomeEntity();
|
||||
HomeEntity runhome = homeDao.taskNumRun(homeEntity);
|
||||
HomeEntity stophome = homeDao.taskNumStop(homeEntity);
|
||||
homeEntity.setNormalNum(runhome.getNormalNum());
|
||||
homeEntity.setAbnormalNum(stophome.getAbnormalNum());
|
||||
homeEntity.setNum(runhome.getNormalNum() + stophome.getAbnormalNum());
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功",homeEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 统计最近7天内api成功和失败数量
|
||||
* @Date 10:17 上午 2024/5/11
|
||||
* @param jsonObject
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity sevenNum(JSONObject jsonObject) {
|
||||
List<HomeEntity> homeEntities = new ArrayList<>();
|
||||
HomeEntity homeEntity = new HomeEntity();
|
||||
List<HomeEntity> errornum = homeDao.sevenerrornum(homeEntity);
|
||||
List<HomeEntity> successnum = homeDao.sevensuccessnum(homeEntity);
|
||||
for (int i = 6; i >=0; i--) {
|
||||
String date = LocalDate.now().minusDays(i).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
HomeEntity entity = new HomeEntity();
|
||||
entity.setName(date);
|
||||
entity.setNormalNum(0);
|
||||
entity.setAbnormalNum(0);
|
||||
for (int a = 0; a < errornum.size(); a++) {
|
||||
if(date.equals(errornum.get(a).getName())){
|
||||
entity.setAbnormalNum(errornum.get(a).getAbnormalNum());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
for (int a = 0; a < successnum.size(); a++) {
|
||||
if(date.equals(successnum.get(a).getName())){
|
||||
entity.setNormalNum(successnum.get(a).getNormalNum());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
homeEntities.add(entity);
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功",homeEntities);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue