diff --git a/maxkey-persistence/src/main/java/org/maxkey/persistence/mapper/HistoryLogsMapper.java b/maxkey-persistence/src/main/java/org/maxkey/persistence/mapper/HistorySystemLogsMapper.java similarity index 91% rename from maxkey-persistence/src/main/java/org/maxkey/persistence/mapper/HistoryLogsMapper.java rename to maxkey-persistence/src/main/java/org/maxkey/persistence/mapper/HistorySystemLogsMapper.java index 5f801a214..208758f62 100644 --- a/maxkey-persistence/src/main/java/org/maxkey/persistence/mapper/HistoryLogsMapper.java +++ b/maxkey-persistence/src/main/java/org/maxkey/persistence/mapper/HistorySystemLogsMapper.java @@ -27,7 +27,7 @@ import org.maxkey.entity.HistoryLogs; * @author Crystal.sea * */ -public interface HistoryLogsMapper extends IJpaBaseMapper { +public interface HistorySystemLogsMapper extends IJpaBaseMapper { } diff --git a/maxkey-persistence/src/main/java/org/maxkey/persistence/service/HistoryLogsService.java b/maxkey-persistence/src/main/java/org/maxkey/persistence/service/HistorySystemLogsService.java similarity index 75% rename from maxkey-persistence/src/main/java/org/maxkey/persistence/service/HistoryLogsService.java rename to maxkey-persistence/src/main/java/org/maxkey/persistence/service/HistorySystemLogsService.java index 833b3a7f0..1a2897d00 100644 --- a/maxkey-persistence/src/main/java/org/maxkey/persistence/service/HistoryLogsService.java +++ b/maxkey-persistence/src/main/java/org/maxkey/persistence/service/HistorySystemLogsService.java @@ -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{ +public class HistorySystemLogsService extends JpaBaseService{ - public HistoryLogsService() { - super(HistoryLogsMapper.class); + public HistorySystemLogsService() { + super(HistorySystemLogsMapper.class); } @@ -34,8 +34,8 @@ public class HistoryLogsService extends JpaBaseService{ * @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(); } } diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/highgo/HistoryLogsMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/highgo/HistorySystemLogsMapper.xml similarity index 95% rename from maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/highgo/HistoryLogsMapper.xml rename to maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/highgo/HistorySystemLogsMapper.xml index 350d4da18..a9da59fb4 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/highgo/HistoryLogsMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/highgo/HistorySystemLogsMapper.xml @@ -1,6 +1,6 @@ - + diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/mysql/HistoryLogsMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/mysql/HistorySystemLogsMapper.xml similarity index 95% rename from maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/mysql/HistoryLogsMapper.xml rename to maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/mysql/HistorySystemLogsMapper.xml index 350d4da18..a9da59fb4 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/mysql/HistoryLogsMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/mysql/HistorySystemLogsMapper.xml @@ -1,6 +1,6 @@ - + diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistoryLogsMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistorySystemLogsMapper.xml similarity index 92% rename from maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistoryLogsMapper.xml rename to maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistorySystemLogsMapper.xml index e323926e8..a9da59fb4 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistoryLogsMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistorySystemLogsMapper.xml @@ -1,55 +1,55 @@ - - - - - - - and id = #{id} - - - and lower(servicename) like lower(concat('%',#{serviceName},'%')) - - - and lower(message) like lower(concat('%',#{message},'%')) - - - and createddate between #{startDate} and #{endDate} - - - and createdby = #{createdBy} - - - - and lower(username) like lower(concat('%',#{username},'%')) - - - and messagetype = #{messageType} - - - and operatetype = #{operateType} - - - - - - + + + + + + + and id = #{id} + + + and lower(servicename) like lower(concat('%',#{serviceName},'%')) + + + and lower(message) like lower(concat('%',#{message},'%')) + + + and createddate between #{startDate} and #{endDate} + + + and createdby = #{createdBy} + + + + and lower(username) like lower(concat('%',#{username},'%')) + + + and messagetype = #{messageType} + + + and operatetype = #{operateType} + + + + + + \ No newline at end of file diff --git a/maxkey-web-manage/src/main/java/org/maxkey/web/contorller/LogsController.java b/maxkey-web-manage/src/main/java/org/maxkey/web/contorller/LogsController.java deleted file mode 100644 index 861ef2908..000000000 --- a/maxkey-web-manage/src/main/java/org/maxkey/web/contorller/LogsController.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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.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; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -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={"/logs"}) -public class LogsController { -final static Logger _logger = LoggerFactory.getLogger(LogsController.class); - - @Autowired - HistoryLoginService loginHistoryService; - - @Autowired - protected HistoryLoginAppsService loginAppsHistoryService; - - @Autowired - HistoryLogsService logsService; - - @Autowired - @Qualifier("historySynchronizerService") - HistorySynchronizerService historySynchronizerService; - - /** - * 查询操作日志 - * @param logs - * @return - */ - @RequestMapping(value={"/grid"}) - @ResponseBody - public JpaPageResults 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 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 loginAppsHistoryGrid(@ModelAttribute("loginAppsHistory") HistoryLoginApps loginAppsHistory){ - _logger.debug("logs/loginAppsHistory/datagrid/ "+loginAppsHistory); - loginAppsHistory.setId(null); - return loginAppsHistoryService.queryPageResults(loginAppsHistory); - } - - @RequestMapping(value={"/historySynchronizerList"}) - public String historySynchronizerList(){ - return "logs/historySynchronizerList"; - } - - /** - * @param historySynchronizer - * @return - */ - @RequestMapping(value={"/historySynchronizer/grid"}) - @ResponseBody - public JpaPageResults historySynchronizerGrid(@ModelAttribute("historySynchronizer") HistorySynchronizer historySynchronizer){ - _logger.debug("logs/historySynchronizer/grid/ "+historySynchronizer); - return historySynchronizerService.queryPageResults(historySynchronizer); - } - - - @RequestMapping(value={"/provisioningEventList"}) - public String provisioningEntryList(){ - return "logs/provisioningEventList"; - } - - - - @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)); - } -} diff --git a/maxkey-web-manage/src/main/java/org/maxkey/web/historys/contorller/LoginAppsHistoryController.java b/maxkey-web-manage/src/main/java/org/maxkey/web/historys/contorller/LoginAppsHistoryController.java new file mode 100644 index 000000000..40444ee70 --- /dev/null +++ b/maxkey-web-manage/src/main/java/org/maxkey/web/historys/contorller/LoginAppsHistoryController.java @@ -0,0 +1,77 @@ +/* + * 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 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)); + } +} diff --git a/maxkey-web-manage/src/main/java/org/maxkey/web/historys/contorller/LoginHistoryController.java b/maxkey-web-manage/src/main/java/org/maxkey/web/historys/contorller/LoginHistoryController.java new file mode 100644 index 000000000..0799d9805 --- /dev/null +++ b/maxkey-web-manage/src/main/java/org/maxkey/web/historys/contorller/LoginHistoryController.java @@ -0,0 +1,75 @@ +/* + * 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 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)); + } +} diff --git a/maxkey-web-manage/src/main/java/org/maxkey/web/historys/contorller/SynchronizerHistoryController.java b/maxkey-web-manage/src/main/java/org/maxkey/web/historys/contorller/SynchronizerHistoryController.java new file mode 100644 index 000000000..08e2d7770 --- /dev/null +++ b/maxkey-web-manage/src/main/java/org/maxkey/web/historys/contorller/SynchronizerHistoryController.java @@ -0,0 +1,78 @@ +/* + * 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.HistorySynchronizer; +import org.maxkey.persistence.service.HistorySynchronizerService; +import org.maxkey.util.DateUtils; +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.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 SynchronizerHistoryController { +final static Logger _logger = LoggerFactory.getLogger(SynchronizerHistoryController.class); + + @Autowired + @Qualifier("historySynchronizerService") + HistorySynchronizerService historySynchronizerService; + + + @RequestMapping(value={"/synchronizerHistoryList"}) + public String historySynchronizerList(){ + return "historys/synchronizerHistoryList"; + } + + /** + * @param historySynchronizer + * @return + */ + @RequestMapping(value={"/synchronizerHistoryList/grid"}) + @ResponseBody + public JpaPageResults historySynchronizerGrid(@ModelAttribute("historySynchronizer") HistorySynchronizer historySynchronizer){ + _logger.debug("historys/synchronizerHistory/grid/ "+historySynchronizer); + return historySynchronizerService.queryPageResults(historySynchronizer); + } + + + @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)); + } +} diff --git a/maxkey-web-manage/src/main/java/org/maxkey/web/historys/contorller/SystemLogsController.java b/maxkey-web-manage/src/main/java/org/maxkey/web/historys/contorller/SystemLogsController.java new file mode 100644 index 000000000..ee0415e73 --- /dev/null +++ b/maxkey-web-manage/src/main/java/org/maxkey/web/historys/contorller/SystemLogsController.java @@ -0,0 +1,79 @@ +/* + * 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 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)); + } +} diff --git a/maxkey-web-manage/src/main/java/org/maxkey/web/historys/contorller/package-info.java b/maxkey-web-manage/src/main/java/org/maxkey/web/historys/contorller/package-info.java new file mode 100644 index 000000000..36959d2cd --- /dev/null +++ b/maxkey-web-manage/src/main/java/org/maxkey/web/historys/contorller/package-info.java @@ -0,0 +1 @@ +package org.maxkey.web.historys.contorller; \ No newline at end of file diff --git a/maxkey-web-manage/src/main/java/org/maxkey/web/interceptor/HistoryLogsAdapter.java b/maxkey-web-manage/src/main/java/org/maxkey/web/interceptor/HistoryLogsAdapter.java index 5edb8cc22..d58e5aaff 100644 --- a/maxkey-web-manage/src/main/java/org/maxkey/web/interceptor/HistoryLogsAdapter.java +++ b/maxkey-web-manage/src/main/java/org/maxkey/web/interceptor/HistoryLogsAdapter.java @@ -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 } diff --git a/maxkey-web-manage/src/main/resources/templates/views/logs/loginAppsHistoryList.ftl b/maxkey-web-manage/src/main/resources/templates/views/historys/loginAppsHistoryList.ftl similarity index 98% rename from maxkey-web-manage/src/main/resources/templates/views/logs/loginAppsHistoryList.ftl rename to maxkey-web-manage/src/main/resources/templates/views/historys/loginAppsHistoryList.ftl index d84ec8c3c..404eab9a0 100644 --- a/maxkey-web-manage/src/main/resources/templates/views/logs/loginAppsHistoryList.ftl +++ b/maxkey-web-manage/src/main/resources/templates/views/historys/loginAppsHistoryList.ftl @@ -94,7 +94,7 @@ - -
-
-
  • - + <@locale code="navs.audit.login"/>
  • - + <@locale code="navs.audit.loginapps"/>
  • - + <@locale code="navs.audit.synchronizer"/>
  • - + <@locale code="navs.audit.operate"/> diff --git a/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/HistoryLoginAppsController.java b/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/HistoryLoginAppsController.java new file mode 100644 index 000000000..e9668aa5d --- /dev/null +++ b/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/HistoryLoginAppsController.java @@ -0,0 +1,80 @@ +/* + * 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 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)); + } +} diff --git a/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/HistorysController.java b/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/HistoryLoginController.java similarity index 62% rename from maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/HistorysController.java rename to maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/HistoryLoginController.java index 5ae3c77f5..642475b97 100644 --- a/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/HistorysController.java +++ b/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/HistoryLoginController.java @@ -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 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 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 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) { diff --git a/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/HistorySystemLogsController.java b/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/HistorySystemLogsController.java new file mode 100644 index 000000000..f533223bc --- /dev/null +++ b/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/HistorySystemLogsController.java @@ -0,0 +1,76 @@ +/* + * 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 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)); + } +} diff --git a/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/package-info.java b/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/package-info.java new file mode 100644 index 000000000..36959d2cd --- /dev/null +++ b/maxkey-web-maxkey/src/main/java/org/maxkey/web/historys/contorller/package-info.java @@ -0,0 +1 @@ +package org.maxkey.web.historys.contorller; \ No newline at end of file diff --git a/maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/HistoryLogsAdapter.java b/maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/HistoryLogsAdapter.java index 7cd774657..530842b1e 100644 --- a/maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/HistoryLogsAdapter.java +++ b/maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/HistoryLogsAdapter.java @@ -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 diff --git a/maxkey-web-maxkey/src/main/resources/templates/views/historys/loginAppsList.ftl b/maxkey-web-maxkey/src/main/resources/templates/views/historys/loginAppsList.ftl index ccd8fce50..3dedd56ea 100644 --- a/maxkey-web-maxkey/src/main/resources/templates/views/historys/loginAppsList.ftl +++ b/maxkey-web-maxkey/src/main/resources/templates/views/historys/loginAppsList.ftl @@ -50,7 +50,7 @@
    -
-
-