History

上级 59c4e58a
......@@ -27,7 +27,7 @@ import org.maxkey.entity.HistoryLogs;
* @author Crystal.sea
*
*/
public interface HistoryLogsMapper extends IJpaBaseMapper<HistoryLogs> {
public interface HistorySystemLogsMapper extends IJpaBaseMapper<HistoryLogs> {
}
......@@ -19,14 +19,14 @@ package org.maxkey.persistence.service;
import org.apache.mybatis.jpa.persistence.JpaBaseService;
import org.maxkey.entity.HistoryLogs;
import org.maxkey.persistence.mapper.HistoryLogsMapper;
import org.maxkey.persistence.mapper.HistorySystemLogsMapper;
import org.springframework.stereotype.Repository;
@Repository
public class HistoryLogsService extends JpaBaseService<HistoryLogs>{
public class HistorySystemLogsService extends JpaBaseService<HistoryLogs>{
public HistoryLogsService() {
super(HistoryLogsMapper.class);
public HistorySystemLogsService() {
super(HistorySystemLogsMapper.class);
}
......@@ -34,8 +34,8 @@ public class HistoryLogsService extends JpaBaseService<HistoryLogs>{
* @see com.connsec.db.service.BaseService#getMapper()
*/
@Override
public HistoryLogsMapper getMapper() {
public HistorySystemLogsMapper getMapper() {
// TODO Auto-generated method stub
return (HistoryLogsMapper)super.getMapper();
return (HistorySystemLogsMapper)super.getMapper();
}
}
<?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="org.maxkey.persistence.mapper.HistoryLogsMapper" >
<mapper namespace="org.maxkey.persistence.mapper.HistorySystemLogsMapper" >
<sql id="where_statement">
<if test="id != null and id != ''">
......
<?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="org.maxkey.persistence.mapper.HistoryLogsMapper" >
<mapper namespace="org.maxkey.persistence.mapper.HistorySystemLogsMapper" >
<sql id="where_statement">
<if test="id != null and id != ''">
......
<?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="org.maxkey.persistence.mapper.HistoryLogsMapper" >
<sql id="where_statement">
<if test="id != null and id != ''">
and id = #{id}
</if>
<if test="serviceName != null and serviceName != '' ">
and lower(servicename) like lower(concat('%',#{serviceName},'%'))
</if>
<if test="message != null and message != '' ">
and lower(message) like lower(concat('%',#{message},'%'))
</if>
<if test="startDate != null and startDate != '' ">
and createddate between #{startDate} and #{endDate}
</if>
<if test="createdBy != null and createdBy != ''">
and createdby = #{createdBy}
</if>
<if test="username != null and username != ''">
and lower(username) like lower(concat('%',#{username},'%'))
</if>
<if test="messageType != null and messageType != ''">
and messagetype = #{messageType}
</if>
<if test="operateType != null and operateType != ''">
and operatetype = #{operateType}
</if>
</sql>
<select id="queryPageResults" parameterType="HistoryLogs" resultType="HistoryLogs">
select
id,
tid,
tname,
servicename ,
code,
message ,
content,
operatetype,
messagetype,
username,
createddate,
createdby
from mxk_history_logs
where 1 = 1
<include refid="where_statement"/>
order by createddate desc
</select>
<?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="org.maxkey.persistence.mapper.HistorySystemLogsMapper" >
<sql id="where_statement">
<if test="id != null and id != ''">
and id = #{id}
</if>
<if test="serviceName != null and serviceName != '' ">
and lower(servicename) like lower(concat('%',#{serviceName},'%'))
</if>
<if test="message != null and message != '' ">
and lower(message) like lower(concat('%',#{message},'%'))
</if>
<if test="startDate != null and startDate != '' ">
and createddate between #{startDate} and #{endDate}
</if>
<if test="createdBy != null and createdBy != ''">
and createdby = #{createdBy}
</if>
<if test="username != null and username != ''">
and lower(username) like lower(concat('%',#{username},'%'))
</if>
<if test="messageType != null and messageType != ''">
and messagetype = #{messageType}
</if>
<if test="operateType != null and operateType != ''">
and operatetype = #{operateType}
</if>
</sql>
<select id="queryPageResults" parameterType="HistoryLogs" resultType="HistoryLogs">
select
id,
tid,
tname,
servicename ,
code,
message ,
content,
operatetype,
messagetype,
username,
createddate,
createdby
from mxk_history_logs
where 1 = 1
<include refid="where_statement"/>
order by createddate desc
</select>
</mapper>
\ No newline at end of file
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.web.historys.contorller;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.mybatis.jpa.persistence.JpaPageResults;
import org.maxkey.entity.HistoryLoginApps;
import org.maxkey.persistence.service.HistoryLoginAppsService;
import org.maxkey.util.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 单点登录日志查询
*
* @author Crystal.sea
*
*/
@Controller
@RequestMapping(value={"/historys"})
public class LoginAppsHistoryController {
final static Logger _logger = LoggerFactory.getLogger(LoginAppsHistoryController.class);
@Autowired
protected HistoryLoginAppsService historyLoginAppsService;
@RequestMapping(value={"/loginAppsHistoryList"})
public String loginAppsHistoryList(){
return "historys/loginAppsHistoryList";
}
/**
* @param loginAppsHistory
* @return
*/
@RequestMapping(value={"/loginAppsHistoryList/grid"})
@ResponseBody
public JpaPageResults<HistoryLoginApps> loginAppsHistoryGrid(@ModelAttribute("historyLoginApp") HistoryLoginApps historyLoginApp){
_logger.debug("historys/loginAppsHistory/datagrid/ "+historyLoginApp);
historyLoginApp.setId(null);
return historyLoginAppsService.queryPageResults(historyLoginApp);
}
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat(DateUtils.FORMAT_DATE_HH_MM_SS);
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
}
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.web.historys.contorller;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.mybatis.jpa.persistence.JpaPageResults;
import org.maxkey.entity.HistoryLogin;
import org.maxkey.persistence.service.HistoryLoginService;
import org.maxkey.util.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 登录日志查询
*
* @author Crystal.sea
*
*/
@Controller
@RequestMapping(value={"/historys"})
public class LoginHistoryController {
final static Logger _logger = LoggerFactory.getLogger(LoginHistoryController.class);
@Autowired
HistoryLoginService loginHistoryService;
@RequestMapping(value={"/loginHistoryList"})
public String loginHistoryList(){
return "historys/loginHistoryList";
}
/**
* @param HistoryLogin
* @return
*/
@RequestMapping(value={"/loginHistoryList/grid"})
@ResponseBody
public JpaPageResults<HistoryLogin> logAuthsGrid(@ModelAttribute("historyLogin") HistoryLogin historyLogin){
_logger.debug("historys/loginHistory/datagrid/ "+historyLogin);
return loginHistoryService.queryPageResults(historyLogin);
}
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat(DateUtils.FORMAT_DATE_HH_MM_SS);
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
}
......@@ -15,19 +15,12 @@
*/
package org.maxkey.web.contorller;
package org.maxkey.web.historys.contorller;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.mybatis.jpa.persistence.JpaPageResults;
import org.maxkey.entity.HistoryLogin;
import org.maxkey.entity.HistoryLoginApps;
import org.maxkey.entity.HistoryLogs;
import org.maxkey.entity.HistorySynchronizer;
import org.maxkey.persistence.service.HistoryLoginAppsService;
import org.maxkey.persistence.service.HistoryLoginService;
import org.maxkey.persistence.service.HistoryLogsService;
import org.maxkey.persistence.service.HistorySynchronizerService;
import org.maxkey.util.DateUtils;
import org.slf4j.Logger;
......@@ -43,107 +36,38 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 登录日志和操作日志查询
* 同步器日志查询
*
* @author Crystal.sea
*
*/
@Controller
@RequestMapping(value={"/logs"})
public class LogsController {
final static Logger _logger = LoggerFactory.getLogger(LogsController.class);
@Autowired
HistoryLoginService loginHistoryService;
@Autowired
protected HistoryLoginAppsService loginAppsHistoryService;
@Autowired
HistoryLogsService logsService;
@RequestMapping(value={"/historys"})
public class SynchronizerHistoryController {
final static Logger _logger = LoggerFactory.getLogger(SynchronizerHistoryController.class);
@Autowired
@Qualifier("historySynchronizerService")
HistorySynchronizerService historySynchronizerService;
/**
* 查询操作日志
* @param logs
* @return
*/
@RequestMapping(value={"/grid"})
@ResponseBody
public JpaPageResults<HistoryLogs> logsDataGrid(@ModelAttribute("logs") HistoryLogs logs){
_logger.debug("logs/datagrid/ logsGrid() "+logs);
return logsService.queryPageResults(logs);
}
@RequestMapping(value={"/list"})
public String List(){
return "logs/logsList";
}
@RequestMapping(value={"/loginHistoryList"})
public String loginHistoryList(){
return "logs/loginHistoryList";
}
/**
* @param HistoryLogin
* @return
*/
@RequestMapping(value={"/loginHistory/grid"})
@ResponseBody
public JpaPageResults<HistoryLogin> logAuthsGrid(@ModelAttribute("loginHistory") HistoryLogin loginHistory){
_logger.debug("logs/loginHistory/datagrid/ "+loginHistory);
return loginHistoryService.queryPageResults(loginHistory);
}
@RequestMapping(value={"/loginAppsHistoryList"})
public String loginAppsHistoryList(){
return "logs/loginAppsHistoryList";
}
/**
* @param loginAppsHistory
* @return
*/
@RequestMapping(value={"/loginAppsHistory/grid"})
@ResponseBody
public JpaPageResults<HistoryLoginApps> loginAppsHistoryGrid(@ModelAttribute("loginAppsHistory") HistoryLoginApps loginAppsHistory){
_logger.debug("logs/loginAppsHistory/datagrid/ "+loginAppsHistory);
loginAppsHistory.setId(null);
return loginAppsHistoryService.queryPageResults(loginAppsHistory);
}
@RequestMapping(value={"/historySynchronizerList"})
@RequestMapping(value={"/synchronizerHistoryList"})
public String historySynchronizerList(){
return "logs/historySynchronizerList";
return "historys/synchronizerHistoryList";
}
/**
* @param historySynchronizer
* @return
*/
@RequestMapping(value={"/historySynchronizer/grid"})
@RequestMapping(value={"/synchronizerHistoryList/grid"})
@ResponseBody
public JpaPageResults<HistorySynchronizer> historySynchronizerGrid(@ModelAttribute("historySynchronizer") HistorySynchronizer historySynchronizer){
_logger.debug("logs/historySynchronizer/grid/ "+historySynchronizer);
_logger.debug("historys/synchronizerHistory/grid/ "+historySynchronizer);
return historySynchronizerService.queryPageResults(historySynchronizer);
}
@RequestMapping(value={"/provisioningEventList"})
public String provisioningEntryList(){
return "logs/provisioningEventList";
}
@InitBinder
public void initBinder(WebDataBinder binder) {
......
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.web.historys.contorller;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.mybatis.jpa.persistence.JpaPageResults;
import org.maxkey.entity.HistoryLogs;
import org.maxkey.persistence.service.HistorySystemLogsService;
import org.maxkey.util.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 系统操作日志查询
*
* @author Crystal.sea
*
*/
@Controller
@RequestMapping(value={"/historys"})
public class SystemLogsController {
final static Logger _logger = LoggerFactory.getLogger(SystemLogsController.class);
@Autowired
HistorySystemLogsService historySystemLogsService;
@RequestMapping(value={"/systemLogsList"})
public String List(){
return "historys/systemLogsList";
}
/**
* 查询操作日志
* @param logs
* @return
*/
@RequestMapping(value={"/systemLogsList/grid"})
@ResponseBody
public JpaPageResults<HistoryLogs> logsDataGrid(@ModelAttribute("historyLog") HistoryLogs historyLog){
_logger.debug("historys/historyLog/ logsGrid() "+historyLog);
return historySystemLogsService.queryPageResults(historyLog);
}
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat(DateUtils.FORMAT_DATE_HH_MM_SS);
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
}
package org.maxkey.web.historys.contorller;
\ No newline at end of file
......@@ -19,10 +19,9 @@ package org.maxkey.web.interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.maxkey.entity.HistoryLogs;
import org.maxkey.entity.UserInfo;
import org.maxkey.persistence.service.HistoryLogsService;
import org.maxkey.persistence.service.HistorySystemLogsService;
import org.maxkey.util.JsonUtils;
import org.maxkey.web.WebContext;
import org.maxkey.web.message.Message;
......@@ -30,7 +29,6 @@ import org.maxkey.web.message.MessageScope;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.AsyncHandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
......@@ -49,8 +47,7 @@ public class HistoryLogsAdapter implements AsyncHandlerInterceptor {
private static final Logger _logger = LoggerFactory.getLogger(HistoryLogsAdapter.class);
@Autowired
@Qualifier("historyLogsService")
private HistoryLogsService historyLogsService;
private HistorySystemLogsService historySystemLogsService;
// after the handler is executed
@Override
......@@ -61,7 +58,7 @@ public class HistoryLogsAdapter implements AsyncHandlerInterceptor {
if(message.getMessageScope() == MessageScope.DB || message.getMessageScope() == MessageScope.DB_CLIENT) {//判断message类型
UserInfo userInfo =WebContext.getUserInfo();//取得当前用户信息
//创建日志记录
HistoryLogs logs = new HistoryLogs(
HistoryLogs historyLog = new HistoryLogs(
message.getServiceName(),
message.getCode(),
message.getMessage(),
......@@ -72,8 +69,8 @@ public class HistoryLogsAdapter implements AsyncHandlerInterceptor {
userInfo==null?null:userInfo.getUsername(),
""
);
_logger.debug("insert db logs content : "+logs);
historyLogsService.insert(logs);//日志插入数据库
_logger.debug("insert db logs content : " + historyLog);
historySystemLogsService.insert(historyLog);//日志插入数据库
if(message.getMessageScope() == MessageScope.DB) {//message类型仅插入数据库
WebContext.clearMessage();//清除message
}
......
......@@ -94,7 +94,7 @@
</table>
</form>
</div>
<table data-url="<@base />/logs/loginAppsHistory/grid"
<table data-url="<@base />/historys/loginAppsHistoryList/grid"
id="datagrid"
data-toggle="table"
data-classes="table table-bordered table-hover table-striped"
......
......@@ -94,7 +94,7 @@
</table>
</form>
</div>
<table data-url="<@base />/logs/loginHistory/grid"
<table data-url="<@base />/historys/loginHistoryList/grid"
id="datagrid"
data-toggle="table"
data-classes="table table-bordered table-hover table-striped"
......
......@@ -94,7 +94,7 @@
</table>
</form>
</div>
<table data-url="<@base />/logs/historySynchronizer/grid"
<table data-url="<@base />/historys/synchronizerHistoryList/grid"
id="datagrid"
data-toggle="table"
data-classes="table table-bordered table-hover table-striped"
......
......@@ -94,7 +94,7 @@
</table>
</form>
</div>
<table data-url="<@base />/logs/grid"
<table data-url="<@base />/historys/systemLogsList/grid"
id="datagrid"
data-toggle="table"
data-classes="table table-bordered table-hover table-striped"
......
......@@ -130,25 +130,25 @@
</a>
<ul>
<li>
<a class="side-nav-menu" href="<@base />/logs/loginHistoryList/">
<a class="side-nav-menu" href="<@base />/historys/loginHistoryList/">
<@locale code="navs.audit.login"/>
<span class="fa fa-fw fa-eraser"></span>
</a>
</li>
<li>
<a class="side-nav-menu" href="<@base />/logs/loginAppsHistoryList/">
<a class="side-nav-menu" href="<@base />/historys/loginAppsHistoryList/">
<@locale code="navs.audit.loginapps"/>
<span class="fa fa-fw fa-eraser"></span>
</a>
</li>
<li>
<a class="side-nav-menu" href="<@base />/logs/historySynchronizerList/">
<a class="side-nav-menu" href="<@base />/historys/synchronizerHistoryList/">
<@locale code="navs.audit.synchronizer"/>
<span class="fa fa-fw fa-eraser"></span>
</a>
</li>
<li>
<a class="side-nav-menu" href="<@base />/logs/list/">
<a class="side-nav-menu" href="<@base />/historys/systemLogsList/">
<@locale code="navs.audit.operate"/>
<span class="fa fa-fw fa-eraser"></span>
</a>
......
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.web.historys.contorller;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.mybatis.jpa.persistence.JpaPageResults;
import org.maxkey.entity.HistoryLoginApps;
import org.maxkey.persistence.service.HistoryLoginAppsService;
import org.maxkey.util.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 单点登录日志查询.
*
* @author Crystal.sea
*
*/
@Controller
@RequestMapping(value = { "/historys" })
public class HistoryLoginAppsController {
static final Logger _logger = LoggerFactory.getLogger(HistoryLoginAppsController.class);
@Autowired
protected HistoryLoginAppsService historyLoginAppsService;
@RequestMapping(value = { "/loginAppsList" })
public String loginAppHistoryList() {
return "historys/loginAppsList";
}
/**
* 查询单点登录日志.
*
* @param logsSso
* @return
*/
@RequestMapping(value = { "/loginAppsList/grid" })
@ResponseBody
public JpaPageResults<HistoryLoginApps> logsSsoGrid(
@ModelAttribute("historyLoginApps") HistoryLoginApps historyLoginApps) {
_logger.debug("history/loginApps/grid/ logsGrid() " + historyLoginApps);
historyLoginApps.setId(null);
return historyLoginAppsService.queryPageResults(historyLoginApps);
}
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat(DateUtils.FORMAT_DATE_HH_MM_SS);
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
}
......@@ -15,7 +15,7 @@
*/
package org.maxkey.web.contorller;
package org.maxkey.web.historys.contorller;
import java.text.SimpleDateFormat;
import java.util.Date;
......@@ -25,7 +25,7 @@ import org.maxkey.entity.HistoryLoginApps;
import org.maxkey.entity.HistoryLogs;
import org.maxkey.persistence.service.HistoryLoginAppsService;
import org.maxkey.persistence.service.HistoryLoginService;
import org.maxkey.persistence.service.HistoryLogsService;
import org.maxkey.persistence.service.HistorySystemLogsService;
import org.maxkey.util.DateUtils;
import org.maxkey.web.WebContext;
import org.slf4j.Logger;
......@@ -40,7 +40,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 登录日志和操作日志查询.
* 登录日志查询.
*
* @author Crystal.sea
*
......@@ -48,37 +48,13 @@ import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping(value = { "/historys" })
public class HistorysController {
static final Logger _logger = LoggerFactory.getLogger(HistorysController.class);
public class HistoryLoginController {
static final Logger _logger = LoggerFactory.getLogger(HistoryLoginController.class);
@Autowired
HistoryLoginService historyLoginService;
@Autowired
protected HistoryLoginAppsService historyLoginAppsService;
@Autowired
HistoryLogsService historyLogsService;
@RequestMapping(value = { "/logs" })
public String List() {
return "historys/logsList";
}
/**
* 查询操作日志.
*
* @param logs
* @return
*/
@RequestMapping(value = { "/logs/grid" })
@ResponseBody
public JpaPageResults<HistoryLogs> logsDataGrid(@ModelAttribute("historyLogs") HistoryLogs historyLogs) {
_logger.debug("history/logs/grid/ logsGrid() " + historyLogs);
return historyLogsService.queryPageResults(historyLogs);
}
@RequestMapping(value = { "/login" })
@RequestMapping(value = { "/loginList" })
public String authList() {
return "historys/loginList";
}
......@@ -89,7 +65,7 @@ public class HistorysController {
* @param logsAuth
* @return
*/
@RequestMapping(value = { "/login/grid" })
@RequestMapping(value = { "/loginList/grid" })
@ResponseBody
public JpaPageResults<HistoryLogin> logAuthsGrid(@ModelAttribute("historyLogin") HistoryLogin historyLogin) {
_logger.debug("history/login/grid/ logsGrid() " + historyLogin);
......@@ -97,27 +73,6 @@ public class HistorysController {
return historyLoginService.queryPageResults(historyLogin);
}
@RequestMapping(value = { "/loginApps" })
public String loginAppHistoryList() {
return "historys/loginAppsList";
}
/**
* 查询单点登录日志.
*
* @param logsSso
* @return
*/
@RequestMapping(value = { "/loginApps/grid" })
@ResponseBody
public JpaPageResults<HistoryLoginApps> logsSsoGrid(
@ModelAttribute("historyLoginApps") HistoryLoginApps historyLoginApps) {
_logger.debug("history/loginApps/grid/ logsGrid() " + historyLoginApps);
historyLoginApps.setId(null);
return historyLoginAppsService.queryPageResults(historyLoginApps);
}
@InitBinder
public void initBinder(WebDataBinder binder) {
......
/*
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.maxkey.web.historys.contorller;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.mybatis.jpa.persistence.JpaPageResults;
import org.maxkey.entity.HistoryLogs;
import org.maxkey.persistence.service.HistorySystemLogsService;
import org.maxkey.util.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 操作日志查询.
*
* @author Crystal.sea
*
*/
@Controller
@RequestMapping(value = { "/historys" })
public class HistorySystemLogsController {
static final Logger _logger = LoggerFactory.getLogger(HistorySystemLogsController.class);
@Autowired
HistorySystemLogsService historySystemLogsService;
@RequestMapping(value = { "/systemLogsList" })
public String List() {
return "historys/systemLogsList";
}
/**
* 查询操作日志.
*
* @param logs
* @return
*/
@RequestMapping(value = { "/systemLogsList/grid" })
@ResponseBody
public JpaPageResults<HistoryLogs> logsDataGrid(@ModelAttribute("historyLogs") HistoryLogs historyLogs) {
_logger.debug("history/systemLogs/grid/ systemLogs() " + historyLogs);
return historySystemLogsService.queryPageResults(historyLogs);
}
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat(DateUtils.FORMAT_DATE_HH_MM_SS);
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
}
package org.maxkey.web.historys.contorller;
\ No newline at end of file
......@@ -19,10 +19,9 @@ package org.maxkey.web.interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.maxkey.entity.HistoryLogs;
import org.maxkey.entity.UserInfo;
import org.maxkey.persistence.service.HistoryLogsService;
import org.maxkey.persistence.service.HistorySystemLogsService;
import org.maxkey.util.JsonUtils;
import org.maxkey.web.WebContext;
import org.maxkey.web.message.Message;
......@@ -30,7 +29,6 @@ import org.maxkey.web.message.MessageScope;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.AsyncHandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
......@@ -48,8 +46,7 @@ public class HistoryLogsAdapter implements AsyncHandlerInterceptor {
private static final Logger _logger = LoggerFactory.getLogger(HistoryLogsAdapter.class);
@Autowired
@Qualifier("historyLogsService")
private HistoryLogsService historyLogsService;
private HistorySystemLogsService historySystemLogsService;
/**
* after the handler is executed.
......@@ -79,7 +76,7 @@ public class HistoryLogsAdapter implements AsyncHandlerInterceptor {
""
);
_logger.debug("insert db historyLogs content : " + historyLogs);
historyLogsService.insert(historyLogs);//日志插入数据库
historySystemLogsService.insert(historyLogs);//日志插入数据库
//message类型仅插入数据库
if (message.getMessageScope() == MessageScope.DB) {
WebContext.clearMessage();//清除message
......
......@@ -50,7 +50,7 @@
</div>
<div class="mainwrap" id="main">
<table data-url="<@base />/historys/loginApps/grid"
<table data-url="<@base />/historys/loginAppsList/grid"
id="datagrid"
data-toggle="table"
data-classes="table table-bordered table-hover table-striped"
......
......@@ -50,7 +50,7 @@
<div class="mainwrap" id="main">
<table data-url="<@base />/historys/login/grid"
<table data-url="<@base />/historys/loginList/grid"
id="datagrid"
data-toggle="table"
data-classes="table table-bordered table-hover table-striped"
......
......@@ -35,7 +35,7 @@
<div class="mainwrap" id="main">
<table data-url="<@base />/historys/logs/grid"
<table data-url="<@base />/historys/systemLogsList/grid"
id="datagrid"
data-toggle="table"
data-classes="table table-bordered table-hover table-striped"
......
......@@ -49,24 +49,24 @@
</li>
<!--日志审计-->
<li id="nav_primay_15" class="nav_primay_level primaryleft" xpath="">
<a href="<@base/>/historys/login"><@locale code="navs.audit"/></a>
<a href="<@base/>/historys/loginList"><@locale code="navs.audit"/></a>
<div id="nav_child_1501" class="nav_second_child">
<ul>
<!--登录日志-->
<li id="nav_second_1501" class="nav_second_level">
<a href="<@base/>/historys/login"><@locale code="navs.audit.login"/></a>
<a href="<@base/>/historys/loginList"><@locale code="navs.audit.login"/></a>
</li>
</ul>
<ul>
<!--访问日志-->
<li id="nav_second_1502" class="nav_second_level">
<a href="<@base/>/historys/loginApps"><@locale code="navs.audit.signon"/></a>
<a href="<@base/>/historys/loginAppsList"><@locale code="navs.audit.signon"/></a>
</li>
</ul>
<ul>
<!--操作日志-->
<li id="nav_second_1503" class="nav_second_level">
<a href="<@base/>/historys/logs"><@locale code="navs.audit.operation"/></a>
<a href="<@base/>/historys/systemLogsList"><@locale code="navs.audit.operation"/></a>
</li>
</ul>
</div>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册