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; |
//package com.daqing.financial.crms.config;
|
||||||
|
//
|
||||||
import org.springframework.context.annotation.Bean; |
//import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Configuration; |
//import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
import org.springframework.web.cors.CorsConfiguration; |
//import org.springframework.web.servlet.ModelAndView;
|
||||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; |
//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
import org.springframework.web.filter.CorsFilter; |
//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 |
// * @auther River
|
||||||
public class CorsConfig { |
// * @date 2020/9/25 15:09
|
||||||
|
// */
|
||||||
@Bean |
//@Configuration
|
||||||
public CorsFilter corsFilter() { |
//public class CorsConfig extends WebMvcConfigurerAdapter {
|
||||||
final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource(); |
//
|
||||||
final CorsConfiguration corsConfiguration = new CorsConfiguration(); |
//
|
||||||
/*是否允许请求带有验证信息*/ |
// @Override
|
||||||
corsConfiguration.setAllowCredentials(true); |
// public void addInterceptors(InterceptorRegistry registry) {
|
||||||
/*允许访问的客户端域名*/ |
// registry.addInterceptor(new HandlerInterceptor() {
|
||||||
corsConfiguration.addAllowedOrigin("*"); |
// @Override
|
||||||
/*允许服务端访问的客户端请求头*/ |
// public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||||
corsConfiguration.addAllowedHeader("*"); |
// throws Exception {
|
||||||
/*允许访问的方法名,GET POST等*/ |
// // boolean isTrue = envConfig.getIsDev();//判断是测试服才需要解决跨域问题
|
||||||
corsConfiguration.addAllowedMethod("*"); |
// //if (isTrue) {
|
||||||
urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration); |
// response.addHeader("Access-Control-Allow-Origin", "*");
|
||||||
return new CorsFilter(urlBasedCorsConfigurationSource); |
// 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; |
package com.daqing.financial.hrauth.dao; |
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
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 com.daqing.framework.domain.hrms.LoginLog; |
||||||
import org.apache.ibatis.annotations.Mapper; |
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
@Mapper |
@Mapper |
||||||
public interface LoginLogMapper extends BaseMapper<LoginLog> { |
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; |
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
import com.daqing.financial.hrauth.dao.LoginLogMapper; |
import com.daqing.financial.hrauth.dao.LoginLogMapper; |
||||||
import com.daqing.financial.hrauth.service.LoginLogService; |
import com.daqing.financial.hrauth.service.LoginLogService; |
||||||
import com.daqing.framework.domain.hrms.LoginLog; |
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; |
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
@Service |
@Service |
||||||
public class LoginLogServiceImpl extends ServiceImpl<LoginLogMapper, LoginLog> implements LoginLogService { |
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; |
//package com.daqing.financial.hrms.config;
|
||||||
|
//
|
||||||
import org.springframework.context.annotation.Bean; |
//import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration; |
//import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.cors.CorsConfiguration; |
//import org.springframework.web.cors.CorsConfiguration;
|
||||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; |
//import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||||
import org.springframework.web.filter.CorsFilter; |
//import org.springframework.web.filter.CorsFilter;
|
||||||
|
//
|
||||||
/** |
///**
|
||||||
* 实现基本的跨域请求 |
// * 实现基本的跨域请求
|
||||||
* |
// *
|
||||||
* @auther River |
// * @auther River
|
||||||
* @date 2020/9/25 15:09 |
// * @date 2020/9/25 15:09
|
||||||
*/ |
// */
|
||||||
@Configuration |
//@Configuration
|
||||||
public class CorsConfig { |
//public class CorsConfig {
|
||||||
|
//
|
||||||
@Bean |
// @Bean
|
||||||
public CorsFilter corsFilter() { |
// public CorsFilter corsFilter() {
|
||||||
final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource(); |
// final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();
|
||||||
final CorsConfiguration corsConfiguration = new CorsConfiguration(); |
// final CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||||
/*是否允许请求带有验证信息*/ |
// /*是否允许请求带有验证信息*/
|
||||||
corsConfiguration.setAllowCredentials(true); |
// corsConfiguration.setAllowCredentials(true);
|
||||||
/*允许访问的客户端域名*/ |
// /*允许访问的客户端域名*/
|
||||||
corsConfiguration.addAllowedOrigin("*"); |
// corsConfiguration.addAllowedOrigin("*");
|
||||||
/*允许服务端访问的客户端请求头*/ |
// /*允许服务端访问的客户端请求头*/
|
||||||
corsConfiguration.addAllowedHeader("*"); |
// corsConfiguration.addAllowedHeader("*");
|
||||||
/*允许访问的方法名,GET POST等*/ |
// /*允许访问的方法名,GET POST等*/
|
||||||
corsConfiguration.addAllowedMethod("*"); |
// corsConfiguration.addAllowedMethod("*");
|
||||||
urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration); |
// urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration);
|
||||||
return new CorsFilter(urlBasedCorsConfigurationSource); |
// return new CorsFilter(urlBasedCorsConfigurationSource);
|
||||||
} |
// }
|
||||||
} |
//}
|
||||||
|
@ -1,4 +1,7 @@ |
|||||||
jwt.ignoreUrlList=/apiHrmsAuth/hrms/auth/userlogin/getBackPwd,\ |
jwt.ignoreUrlList=/apiHrmsAuth/hrms/auth/userlogin/getBackPwd,\ |
||||||
/apiHrmsAuth/hrms/auth/userlogin/login,\ |
/apiHrmsAuth/hrms/auth/userlogin/login,\ |
||||||
/apiHrmsAuth/hrms/auth/userlogin/verifyMobile,\ |
/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