parent
21f8e314a9
commit
39f77de163
18 changed files with 283 additions and 81 deletions
@ -0,0 +1,24 @@ |
||||
package com.daqing.financial.hrauth; |
||||
|
||||
import com.daqing.framework.domain.crms.request.CustomerRequest; |
||||
import com.daqing.framework.domain.hrms.request.LoginRequest; |
||||
import com.daqing.framework.domain.hrms.request.UserLoginRequest; |
||||
import com.daqing.framework.model.response.ResponseResult; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
|
||||
/** |
||||
* @Author: gongsj. |
||||
* @Description: 登录controllerApi定义 |
||||
* @Date:Created in 2020/09/07 11:33. |
||||
* @Modified By: |
||||
*/ |
||||
@Api(value = "系统日志相关操作", tags = "提供系统日志相关操作") |
||||
public interface SystemLogControllerApi { |
||||
|
||||
@ApiOperation(value = "系统日志列表") |
||||
ResponseResult list(Integer page, Integer size); |
||||
|
||||
@ApiOperation(value = "登录日志列表") |
||||
ResponseResult loginLogList(Integer page, Integer size); |
||||
} |
@ -1,33 +1,50 @@ |
||||
package com.daqing.financial.crms.config; |
||||
|
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.web.cors.CorsConfiguration; |
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; |
||||
import org.springframework.web.filter.CorsFilter; |
||||
|
||||
/** |
||||
* 实现基本的跨域请求 |
||||
* |
||||
* @auther River |
||||
* @date 2020/9/25 15:09 |
||||
*/ |
||||
@Configuration |
||||
public class CorsConfig { |
||||
|
||||
@Bean |
||||
public CorsFilter corsFilter() { |
||||
final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource(); |
||||
final CorsConfiguration corsConfiguration = new CorsConfiguration(); |
||||
/*是否允许请求带有验证信息*/ |
||||
corsConfiguration.setAllowCredentials(true); |
||||
/*允许访问的客户端域名*/ |
||||
corsConfiguration.addAllowedOrigin("*"); |
||||
/*允许服务端访问的客户端请求头*/ |
||||
corsConfiguration.addAllowedHeader("*"); |
||||
/*允许访问的方法名,GET POST等*/ |
||||
corsConfiguration.addAllowedMethod("*"); |
||||
urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration); |
||||
return new CorsFilter(urlBasedCorsConfigurationSource); |
||||
} |
||||
} |
||||
//package com.daqing.financial.crms.config;
|
||||
//
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.web.servlet.HandlerInterceptor;
|
||||
//import org.springframework.web.servlet.ModelAndView;
|
||||
//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import javax.servlet.http.HttpServletResponse;
|
||||
//
|
||||
///**
|
||||
// * 实现基本的跨域请求
|
||||
// *
|
||||
// * @auther River
|
||||
// * @date 2020/9/25 15:09
|
||||
// */
|
||||
//@Configuration
|
||||
//public class CorsConfig extends WebMvcConfigurerAdapter {
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public void addInterceptors(InterceptorRegistry registry) {
|
||||
// registry.addInterceptor(new HandlerInterceptor() {
|
||||
// @Override
|
||||
// public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
// throws Exception {
|
||||
// // boolean isTrue = envConfig.getIsDev();//判断是测试服才需要解决跨域问题
|
||||
// //if (isTrue) {
|
||||
// response.addHeader("Access-Control-Allow-Origin", "*");
|
||||
// response.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
||||
// response.addHeader("Access-Control-Allow-Headers",
|
||||
// "Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,token");
|
||||
// // }
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||
// ModelAndView modelAndView) throws Exception {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||
// Exception ex) throws Exception {
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//}
|
||||
|
@ -0,0 +1,55 @@ |
||||
package com.daqing.financial.hrauth.controller; |
||||
|
||||
import com.daqing.financial.hrauth.SystemLogControllerApi; |
||||
import com.daqing.financial.hrauth.UserLoginControllerApi; |
||||
import com.daqing.financial.hrauth.annotation.Log; |
||||
import com.daqing.financial.hrauth.enums.OperationType; |
||||
import com.daqing.financial.hrauth.enums.OperationUnit; |
||||
import com.daqing.financial.hrauth.service.LoginLogService; |
||||
import com.daqing.financial.hrauth.service.SystemLogService; |
||||
import com.daqing.financial.hrauth.service.UserLoginService; |
||||
import com.daqing.framework.domain.hrms.EmployeeEntity; |
||||
import com.daqing.framework.domain.hrms.SystemLog; |
||||
import com.daqing.framework.domain.hrms.request.LoginRequest; |
||||
import com.daqing.framework.domain.hrms.request.UserLoginRequest; |
||||
import com.daqing.framework.model.response.ResponseResult; |
||||
import com.daqing.framework.utils.PageUtils; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.validation.Valid; |
||||
|
||||
|
||||
/** |
||||
* @auther River |
||||
* @date 2020/9/22 15:27 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/hrms/auth/systemLog") |
||||
@Api(tags = {"日志管理"}) |
||||
public class SystemLogController implements SystemLogControllerApi { |
||||
|
||||
@Autowired |
||||
private SystemLogService systemLogService; |
||||
@Autowired |
||||
private LoginLogService loginLogService; |
||||
|
||||
@GetMapping("/list") |
||||
@Log(detail = "系统日志列表",level = 3,operationUnit = OperationUnit.ROLE,operationType = OperationType.SELECT) |
||||
public ResponseResult list(@RequestParam("page") Integer page, |
||||
@RequestParam("size") Integer size) { |
||||
PageUtils data = systemLogService.queryPage(page, size); |
||||
return new ResponseResult<PageUtils>().SUCCESS(data); |
||||
} |
||||
|
||||
@GetMapping("/loginLogList") |
||||
@Log(detail = "登录日志列表",level = 3,operationUnit = OperationUnit.ROLE,operationType = OperationType.SELECT) |
||||
public ResponseResult loginLogList(@RequestParam("page") Integer page, |
||||
@RequestParam("size") Integer size) { |
||||
PageUtils data = loginLogService.queryPage(page, size); |
||||
return new ResponseResult<PageUtils>().SUCCESS(data); |
||||
} |
||||
|
||||
} |
@ -1,9 +1,12 @@ |
||||
package com.daqing.financial.hrauth.dao; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.daqing.framework.domain.hrms.LoginLog; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
@Mapper |
||||
public interface LoginLogMapper extends BaseMapper<LoginLog> { |
||||
IPage<LoginLog> pageByCondition(Page page); |
||||
} |
||||
|
@ -0,0 +1,11 @@ |
||||
package com.daqing.financial.hrauth.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.daqing.framework.domain.hrms.EmployeeEntity; |
||||
import com.daqing.framework.domain.hrms.LoginLog; |
||||
import com.daqing.framework.domain.hrms.SystemLog; |
||||
import com.daqing.framework.utils.PageUtils; |
||||
|
||||
public interface SystemLogService extends IService<SystemLog> { |
||||
PageUtils queryPage(Integer page, Integer size); |
||||
} |
@ -1,11 +1,28 @@ |
||||
package com.daqing.financial.hrauth.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.daqing.financial.hrauth.dao.LoginLogMapper; |
||||
import com.daqing.financial.hrauth.service.LoginLogService; |
||||
import com.daqing.framework.domain.hrms.LoginLog; |
||||
import com.daqing.framework.domain.hrms.SystemLog; |
||||
import com.daqing.framework.utils.PageUtils; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service |
||||
public class LoginLogServiceImpl extends ServiceImpl<LoginLogMapper, LoginLog> implements LoginLogService { |
||||
@Override |
||||
public PageUtils queryPage(Integer page, Integer size) { |
||||
//分页参数
|
||||
if (page <= 0) { |
||||
page = 1; |
||||
} |
||||
if (size <= 0) { |
||||
size = 10; |
||||
} |
||||
IPage<LoginLog> loginLogVo = this.getBaseMapper().pageByCondition(new Page(page, size)); |
||||
|
||||
return new PageUtils(loginLogVo); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,32 @@ |
||||
package com.daqing.financial.hrauth.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.daqing.financial.hrauth.dao.LoginLogMapper; |
||||
import com.daqing.financial.hrauth.dao.SystemLogMapper; |
||||
import com.daqing.financial.hrauth.service.LoginLogService; |
||||
import com.daqing.financial.hrauth.service.SystemLogService; |
||||
import com.daqing.framework.domain.hrms.EmployeeEntity; |
||||
import com.daqing.framework.domain.hrms.LoginLog; |
||||
import com.daqing.framework.domain.hrms.SystemLog; |
||||
import com.daqing.framework.domain.hrms.ext.EmployeeVO; |
||||
import com.daqing.framework.utils.PageUtils; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service |
||||
public class SystemLogServiceImpl extends ServiceImpl<SystemLogMapper, SystemLog> implements SystemLogService { |
||||
@Override |
||||
public PageUtils queryPage(Integer page, Integer size) { |
||||
//分页参数
|
||||
if (page <= 0) { |
||||
page = 1; |
||||
} |
||||
if (size <= 0) { |
||||
size = 10; |
||||
} |
||||
IPage<SystemLog> systemLogVo = this.getBaseMapper().pageByCondition(new Page(page, size)); |
||||
|
||||
return new PageUtils(systemLogVo); |
||||
} |
||||
} |
@ -0,0 +1,14 @@ |
||||
<?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.daqing.financial.hrauth.dao.LoginLogMapper"> |
||||
<!-- 可根据自己的需求,是否要使用 --> |
||||
<resultMap type="com.daqing.framework.domain.hrms.LoginLog" id="LoginLogMap"> |
||||
<result property="id" column="id"/> |
||||
</resultMap> |
||||
|
||||
<select id="pageByCondition" resultMap="LoginLogMap"> |
||||
SELECT * FROM hrms_login_log |
||||
</select> |
||||
|
||||
</mapper> |
@ -0,0 +1,16 @@ |
||||
<?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.daqing.financial.hrauth.dao.SystemLogMapper"> |
||||
<!-- 可根据自己的需求,是否要使用 --> |
||||
<resultMap type="com.daqing.framework.domain.hrms.SystemLog" id="SystemLogMap"> |
||||
<result property="id" column="id"/> |
||||
</resultMap> |
||||
|
||||
<select id="pageByCondition" resultMap="SystemLogMap"> |
||||
SELECT * |
||||
FROM |
||||
sys_action_log |
||||
</select> |
||||
|
||||
</mapper> |
@ -1,33 +1,33 @@ |
||||
package com.daqing.financial.hrms.config; |
||||
|
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.web.cors.CorsConfiguration; |
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; |
||||
import org.springframework.web.filter.CorsFilter; |
||||
|
||||
/** |
||||
* 实现基本的跨域请求 |
||||
* |
||||
* @auther River |
||||
* @date 2020/9/25 15:09 |
||||
*/ |
||||
@Configuration |
||||
public class CorsConfig { |
||||
|
||||
@Bean |
||||
public CorsFilter corsFilter() { |
||||
final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource(); |
||||
final CorsConfiguration corsConfiguration = new CorsConfiguration(); |
||||
/*是否允许请求带有验证信息*/ |
||||
corsConfiguration.setAllowCredentials(true); |
||||
/*允许访问的客户端域名*/ |
||||
corsConfiguration.addAllowedOrigin("*"); |
||||
/*允许服务端访问的客户端请求头*/ |
||||
corsConfiguration.addAllowedHeader("*"); |
||||
/*允许访问的方法名,GET POST等*/ |
||||
corsConfiguration.addAllowedMethod("*"); |
||||
urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration); |
||||
return new CorsFilter(urlBasedCorsConfigurationSource); |
||||
} |
||||
} |
||||
//package com.daqing.financial.hrms.config;
|
||||
//
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.web.cors.CorsConfiguration;
|
||||
//import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
//import org.springframework.web.filter.CorsFilter;
|
||||
//
|
||||
///**
|
||||
// * 实现基本的跨域请求
|
||||
// *
|
||||
// * @auther River
|
||||
// * @date 2020/9/25 15:09
|
||||
// */
|
||||
//@Configuration
|
||||
//public class CorsConfig {
|
||||
//
|
||||
// @Bean
|
||||
// public CorsFilter corsFilter() {
|
||||
// final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();
|
||||
// final CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
// /*是否允许请求带有验证信息*/
|
||||
// corsConfiguration.setAllowCredentials(true);
|
||||
// /*允许访问的客户端域名*/
|
||||
// corsConfiguration.addAllowedOrigin("*");
|
||||
// /*允许服务端访问的客户端请求头*/
|
||||
// corsConfiguration.addAllowedHeader("*");
|
||||
// /*允许访问的方法名,GET POST等*/
|
||||
// corsConfiguration.addAllowedMethod("*");
|
||||
// urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration);
|
||||
// return new CorsFilter(urlBasedCorsConfigurationSource);
|
||||
// }
|
||||
//}
|
||||
|
@ -1,4 +1,7 @@ |
||||
jwt.ignoreUrlList=/apiHrmsAuth/hrms/auth/userlogin/getBackPwd,\ |
||||
/apiHrmsAuth/hrms/auth/userlogin/login,\ |
||||
/apiHrmsAuth/hrms/auth/userlogin/verifyMobile,\ |
||||
/api-crms/sweagger-ui.html |
||||
/api-crms/sweagger-ui.html,\ |
||||
/api-crms/crms/customer/excelTemplate,\ |
||||
/api-crms/crms/customer/excelExport,\ |
||||
/api-crms/crms/customer/excelImport |
Loading…
Reference in new issue