commit
5075e01b19
31 changed files with 534 additions and 112 deletions
@ -0,0 +1,25 @@ |
||||
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.UserLoginLogRequest; |
||||
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, UserLoginLogRequest userLoginLogRequest); |
||||
} |
@ -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,56 @@ |
||||
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.UserLoginLogRequest; |
||||
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, UserLoginLogRequest userLoginLogRequest) { |
||||
PageUtils data = loginLogService.queryPage(page, size,userLoginLogRequest); |
||||
return new ResponseResult<PageUtils>().SUCCESS(data); |
||||
} |
||||
|
||||
} |
@ -1,9 +1,15 @@ |
||||
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 com.daqing.framework.domain.hrms.request.UserLoginLogRequest; |
||||
import com.daqing.framework.domain.hrms.request.UserLoginRequest; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
@Mapper |
||||
public interface LoginLogMapper extends BaseMapper<LoginLog> { |
||||
IPage<LoginLog> pageByCondition(Page page,@Param("loginLog") UserLoginLogRequest userLoginLogRequest); |
||||
} |
||||
|
@ -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,30 @@ |
||||
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.domain.hrms.request.UserLoginLogRequest; |
||||
import com.daqing.framework.domain.hrms.request.UserLoginRequest; |
||||
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, UserLoginLogRequest userLoginLogRequest) { |
||||
//分页参数
|
||||
if (page <= 0) { |
||||
page = 1; |
||||
} |
||||
if (size <= 0) { |
||||
size = 10; |
||||
} |
||||
IPage<LoginLog> loginLogVo = this.getBaseMapper().pageByCondition(new Page(page, size),userLoginLogRequest); |
||||
|
||||
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,39 @@ |
||||
<?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> |
||||
<resultMap type="com.daqing.framework.domain.hrms.LoginLogEntity" id="userLoginLogMap"> |
||||
<result property="id" column="id"/> |
||||
</resultMap> |
||||
|
||||
<select id="pageByCondition" parameterType="com.daqing.framework.domain.hrms.request.UserLoginLogRequest" resultMap="userLoginLogMap"> |
||||
SELECT |
||||
hll.user_id,hll.login_num,hll.create_time,hll.newest_time,he.name as empName,he.job_number, |
||||
he.phone,hp.name as posName,hd.name as deptName |
||||
FROM hrms_login_log hll |
||||
left join hrms_employee he on he.user_id=hll.user_id |
||||
left join hrms_employee_position hep on hep.emp_id=he.id |
||||
left join hrms_position hp on hp.id=hep.position_id |
||||
left join hrms_employee_dept hed on hed.employee_id=he.id |
||||
left join hrms_dept hd on hd.id=hed.dept_id |
||||
<where> |
||||
<if test="loginLog.name != null and loginLog.name != ''"> |
||||
AND he.`name` LIKE CONCAT('%',#{loginLog.name},'%') |
||||
</if> |
||||
<if test="loginLog.jobNumber != null and loginLog.jobNumber != ''"> |
||||
AND he.job_number = #{loginLog.jobNumber} |
||||
</if> |
||||
<if test="loginLog.startTime != null and loginLog.startTime != '' "> |
||||
AND hll.create_time >= #{loginLog.startTime} |
||||
</if> |
||||
<if test="loginLog.endTime != null and loginLog.endTime != '' "> |
||||
AND hll.create_time <= #{loginLog.endTime} |
||||
</if> |
||||
</where> |
||||
</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);
|
||||
// }
|
||||
//}
|
||||
|
@ -0,0 +1,44 @@ |
||||
package com.daqing.framework.domain.hrms; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
|
||||
import java.util.Date; |
||||
|
||||
@Data |
||||
@TableName("hrms_login_log") |
||||
public class LoginLogEntity { |
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
private int id; |
||||
|
||||
//用户id
|
||||
private Long userId; |
||||
|
||||
//登录次数
|
||||
private int loginNum; |
||||
|
||||
//创建时间
|
||||
private Date createTime; |
||||
|
||||
//最新登录时间
|
||||
private Date newestTime; |
||||
|
||||
//员工姓名
|
||||
private String empName; |
||||
|
||||
//工号
|
||||
private String jobNumber; |
||||
|
||||
//联系电话
|
||||
private String phone; |
||||
|
||||
//职位
|
||||
private String posName; |
||||
|
||||
//部门名称
|
||||
private String deptName; |
||||
|
||||
} |
@ -0,0 +1,40 @@ |
||||
package com.daqing.framework.domain.hrms.request; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotBlank; |
||||
import javax.validation.constraints.Pattern; |
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 修改平台超管员密码请求体对象 |
||||
* |
||||
* @author gongsj |
||||
* @email gongsj@gmail.com |
||||
* @date 2020-09-07 17:12:14 |
||||
*/ |
||||
@Data |
||||
public class UpdatePwdRequest implements Serializable { |
||||
|
||||
/** |
||||
* 手机账号 |
||||
*/ |
||||
@Pattern(regexp = "^1(3([0-35-9]\\d|4[1-8])|4[14-9]\\d|5([0125689]\\d|7[1-79])|66\\d|7[2-35-8]\\d|8\\d{2}|9[13589]\\d)\\d{7}$",message = "手机号格式不正确!") |
||||
private String phoneAccount; |
||||
|
||||
/** |
||||
* 新密码 |
||||
*/ |
||||
@Pattern(regexp = "^(?=.*[0-9].*)(?=.*[A-Z].*)(?=.*[a-z].*).{6,20}$",message = "密码格式不正确!") |
||||
private String newPwd; |
||||
/** |
||||
* 确认密码 |
||||
*/ |
||||
private String confirmPwd; |
||||
|
||||
/** |
||||
* 原密码 |
||||
*/ |
||||
@NotBlank(message = "当前密码不能为空!") |
||||
private String password; |
||||
} |
@ -0,0 +1,32 @@ |
||||
package com.daqing.framework.domain.hrms.request; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 登录日志请求体对象 |
||||
* |
||||
* @author gongsj |
||||
* @email gongsj@gmail.com |
||||
* @date 2020-09-07 17:12:14 |
||||
*/ |
||||
@Data |
||||
public class UserLoginLogRequest implements Serializable { |
||||
/** |
||||
* 姓名 |
||||
*/ |
||||
private String name; |
||||
/** |
||||
* 工号 |
||||
*/ |
||||
private String jobNumber; |
||||
/** |
||||
* 开始时间 |
||||
*/ |
||||
private String startTime; |
||||
/** |
||||
* 结束时间 |
||||
*/ |
||||
private String endTime; |
||||
} |
@ -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