日志输出格式优化
commit
aaa52613ce
@ -1,42 +0,0 @@
|
|||||||
package cn.estsh.i3plus.core.apiservice.configuration;
|
|
||||||
|
|
||||||
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
|
||||||
import cn.estsh.i3plus.pojo.base.jpa.factory.BaseMongoRepositoryFactoryBean;
|
|
||||||
import cn.estsh.i3plus.pojo.base.jpa.factory.BaseRepositoryFactoryBean;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.core.annotation.Order;
|
|
||||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
|
||||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description : 需要扫描其他包的配置文件
|
|
||||||
* 此类专门添加需要单独加载的其他模块的包
|
|
||||||
* @Reference :
|
|
||||||
* @Author : alwaysfrin
|
|
||||||
* @CreateDate : 2018-12-12 20:49
|
|
||||||
* @Modify:
|
|
||||||
**/
|
|
||||||
@Configuration
|
|
||||||
@Order(0)
|
|
||||||
//扫描需要单独处理的对象类
|
|
||||||
@EntityScan(basePackageClasses = {
|
|
||||||
//需要单独处理的其他模块对象
|
|
||||||
})
|
|
||||||
|
|
||||||
@EnableJpaRepositories(basePackages = {
|
|
||||||
//需要单独处理的其他模块持久化仓
|
|
||||||
}, repositoryFactoryBeanClass = BaseRepositoryFactoryBean.class)
|
|
||||||
|
|
||||||
@EnableMongoRepositories(basePackageClasses = {
|
|
||||||
//需要单独处理的其他模块mongo持久化仓
|
|
||||||
},repositoryFactoryBeanClass = BaseMongoRepositoryFactoryBean.class)
|
|
||||||
public class ScanPackageConfiguration {
|
|
||||||
public static final Logger LOGGER = LoggerFactory.getLogger(CommonConstWords.SYSTEM_LOG);
|
|
||||||
|
|
||||||
public ScanPackageConfiguration(){
|
|
||||||
LOGGER.info("【关联模块加载包处理...】");
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,88 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.controller.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.*;
|
||||||
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
||||||
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
||||||
|
import cn.estsh.impp.framework.base.controller.CoreBaseController;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
||||||
|
import cn.estsh.impp.framework.boot.util.ImppRedis;
|
||||||
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
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 javax.annotation.Resource;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2018-12-10 17:04
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@Api(description = "Dashboard服务")
|
||||||
|
@RequestMapping(PlatformConstWords.BASE_URL + "/dashboard")
|
||||||
|
public class SysDashboardController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService sysUserService;
|
||||||
|
@Autowired
|
||||||
|
private ISysOrganizeService sysOrganizeService;
|
||||||
|
@Autowired
|
||||||
|
private ISysDepartmentService sysDepartmentService;
|
||||||
|
@Autowired
|
||||||
|
private ISysMessageService sysMessageService;
|
||||||
|
@Autowired
|
||||||
|
private ISysLogOperateService sysLogOperateService;
|
||||||
|
@Autowired
|
||||||
|
private ISysLogSystemService sysLogSystemService;
|
||||||
|
// @Autowired
|
||||||
|
// private EurekaServerContext eurekaServerContext;
|
||||||
|
@Resource(name="redisRes")
|
||||||
|
private ImppRedis redisRes;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@ApiOperation(value = "获取dashboard数据")
|
||||||
|
public ResultBean getDashboardData(){
|
||||||
|
try {
|
||||||
|
Map<String,Object> dashboardData = (Map<String, Object>) redisRes.getObject(PlatformConstWords.DASHBOARD_REDIS_KEY);
|
||||||
|
if(dashboardData == null){
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTime(new Date());
|
||||||
|
|
||||||
|
String startTime = sdf.format(new Date());
|
||||||
|
cal.add(Calendar.MINUTE,10);
|
||||||
|
String endTime = sdf.format(cal.getTime());
|
||||||
|
|
||||||
|
dashboardData = new HashMap<>();
|
||||||
|
dashboardData.put("userNum",sysUserService.getSysUserCount());
|
||||||
|
dashboardData.put("orgNum",sysOrganizeService.getSysOrganizeCount());
|
||||||
|
dashboardData.put("deptNum",sysDepartmentService.getSysDepartmentCount());
|
||||||
|
dashboardData.put("logOperate",sysLogOperateService.findNewSysLogOperate(10));
|
||||||
|
dashboardData.put("",sysLogSystemService.queryAvgExecuteTime(startTime,endTime));
|
||||||
|
|
||||||
|
redisRes.putHashMap(PlatformConstWords.DASHBOARD_REDIS_KEY,dashboardData,1000*60);
|
||||||
|
}
|
||||||
|
return ResultBean.success("添加成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultMap(dashboardData);
|
||||||
|
} catch (
|
||||||
|
ImppBusiException busExcep) {
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.dao;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.bson.Document;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 操作日志
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2018-12-11 13:22
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
public interface ISysLogSystemDao {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询时间段内平均请求耗时
|
||||||
|
* @param startTime
|
||||||
|
* @param endTime
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询时间段内平均请求耗时")
|
||||||
|
Map<String,Object> querySysLogOperateAvgExecuteTime(String startTime, String endTime);
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue