# Conflicts: # dq-financial-crms-auth/src/main/resources/bootstrap.properties # dq-financial-hrms/src/main/resources/bootstrap.properties # dq-framework-common/src/main/java/com/daqing/framework/util/Md5Util.java # dq-govern-gateway/src/main/resources/bootstrap.propertiesmaster
commit
1b1e23e82c
210 changed files with 3032 additions and 367 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); |
||||||
|
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,19 @@ |
|||||||
|
|
||||||
|
#·þÎñÃû³Æ |
||||||
|
spring.application.name=dq-financial-crms |
||||||
|
#ÅäÖÃÖÐÐĵØÖ· |
||||||
|
spring.cloud.nacos.config.server-addr=192.168.31.142:8848 |
||||||
|
spring.cloud.nacos.config.namespace=37d72d30-3178-4173-8b5e-269a23355ed9 |
||||||
|
#spring.cloud.nacos.config.group=prod |
||||||
|
|
||||||
|
spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml |
||||||
|
spring.cloud.nacos.config.ext-config[0].group=dev |
||||||
|
spring.cloud.nacos.config.ext-config[0].refresh=true |
||||||
|
|
||||||
|
spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml |
||||||
|
spring.cloud.nacos.config.ext-config[1].group=dev |
||||||
|
spring.cloud.nacos.config.ext-config[1].refresh=true |
||||||
|
|
||||||
|
spring.cloud.nacos.config.ext-config[2].data-id=other.yml |
||||||
|
spring.cloud.nacos.config.ext-config[2].group=dev |
||||||
|
spring.cloud.nacos.config.ext-config[2].refresh=true |
@ -0,0 +1,47 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
|
||||||
|
<configuration> |
||||||
|
<!--定义日志文件的存储地址,使用绝对路径--> |
||||||
|
<property name="LOG_HOME" value="d:/logs/daqing/crms_auth"/> |
||||||
|
|
||||||
|
<!-- Console 输出设置 --> |
||||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
||||||
|
<encoder> |
||||||
|
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> |
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> |
||||||
|
<charset>utf8</charset> |
||||||
|
</encoder> |
||||||
|
</appender> |
||||||
|
|
||||||
|
<!-- 按照每天生成日志文件 --> |
||||||
|
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||||
|
<!--日志文件输出的文件名--> |
||||||
|
<fileNamePattern>${LOG_HOME}/crms_auth.%d{yyyy-MM-dd}.log</fileNamePattern> |
||||||
|
</rollingPolicy> |
||||||
|
<encoder> |
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> |
||||||
|
</encoder> |
||||||
|
</appender> |
||||||
|
|
||||||
|
<!-- 异步输出 --> |
||||||
|
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender"> |
||||||
|
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 --> |
||||||
|
<discardingThreshold>0</discardingThreshold> |
||||||
|
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 --> |
||||||
|
<queueSize>512</queueSize> |
||||||
|
<!-- 添加附加的appender,最多只能添加一个 --> |
||||||
|
<appender-ref ref="FILE"/> |
||||||
|
</appender> |
||||||
|
|
||||||
|
|
||||||
|
<logger name="org.apache.ibatis.cache.decorators.LoggingCache" level="DEBUG" additivity="false"> |
||||||
|
<appender-ref ref="CONSOLE"/> |
||||||
|
</logger> |
||||||
|
<logger name="org.springframework.boot" level="DEBUG"/> |
||||||
|
<root level="info"> |
||||||
|
<!--<appender-ref ref="ASYNC"/>--> |
||||||
|
<appender-ref ref="FILE"/> |
||||||
|
<appender-ref ref="CONSOLE"/> |
||||||
|
</root> |
||||||
|
</configuration> |
@ -0,0 +1,10 @@ |
|||||||
|
<?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.crauth.dao.CustomerLoginDao"> |
||||||
|
|
||||||
|
<select id="getCustomer" parameterType="string" resultType="com.daqing.framework.domain.crms.CustomerEntity"> |
||||||
|
SELECT phone,password FROM crms_customer WHERE phone = #{phone} |
||||||
|
</select> |
||||||
|
|
||||||
|
</mapper> |
Binary file not shown.
@ -0,0 +1,50 @@ |
|||||||
|
//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 {
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
//}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,42 @@ |
|||||||
|
package com.daqing.financial.hrauth.annotation; |
||||||
|
|
||||||
|
|
||||||
|
import com.daqing.financial.hrauth.enums.OperationType; |
||||||
|
import com.daqing.financial.hrauth.enums.OperationUnit; |
||||||
|
|
||||||
|
import java.lang.annotation.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Rogers |
||||||
|
* 操作日志注解 |
||||||
|
* @create 2020-07-03 |
||||||
|
*/ |
||||||
|
@Target({ElementType.METHOD}) |
||||||
|
@Retention(RetentionPolicy.RUNTIME) |
||||||
|
@Documented |
||||||
|
public @interface Log { |
||||||
|
|
||||||
|
/** |
||||||
|
* 方法描述,可使用占位符获取参数:{{tel}} |
||||||
|
*/ |
||||||
|
String detail() default ""; |
||||||
|
|
||||||
|
/** |
||||||
|
* 日志等级:自己定,此处分为1-9 |
||||||
|
*/ |
||||||
|
int level() default 0; |
||||||
|
|
||||||
|
/** |
||||||
|
* 操作类型(enum):主要是select,insert,update,delete |
||||||
|
*/ |
||||||
|
OperationType operationType() default OperationType.UNKNOWN; |
||||||
|
|
||||||
|
/** |
||||||
|
* 被操作的对象(此处使用enum):可以是任何对象,如表名(user),或者是工具(redis) |
||||||
|
*/ |
||||||
|
OperationUnit operationUnit() default OperationUnit.UNKNOWN; |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
@ -0,0 +1,129 @@ |
|||||||
|
package com.daqing.financial.hrauth.aspect; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON; |
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.daqing.financial.hrauth.annotation.Log; |
||||||
|
import com.daqing.financial.hrauth.dao.SystemLogMapper; |
||||||
|
import com.daqing.financial.hrauth.service.TokenService; |
||||||
|
import com.daqing.financial.hrauth.service.UserLoginService; |
||||||
|
import com.daqing.financial.hrauth.util.IpUtils; |
||||||
|
import com.daqing.framework.domain.hrms.SystemLog; |
||||||
|
import com.daqing.framework.domain.hrms.Token; |
||||||
|
import com.daqing.framework.domain.hrms.UserEntity; |
||||||
|
import com.daqing.framework.util.RedisUtil; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.aspectj.lang.JoinPoint; |
||||||
|
import org.aspectj.lang.reflect.MethodSignature; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.scheduling.annotation.Async; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
import org.springframework.web.context.request.RequestContextHolder; |
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.UUID; |
||||||
|
|
||||||
|
/** |
||||||
|
* @ClassName Operation |
||||||
|
* @Description 操作日志类 |
||||||
|
* @Date 2020/9/29 10:06 |
||||||
|
* @Version 1.0 |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
@Component |
||||||
|
public class Operation { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private SystemLogMapper systemLogMapper; |
||||||
|
@Autowired |
||||||
|
private TokenService tokenService; |
||||||
|
@Autowired |
||||||
|
private UserLoginService userLoginService; |
||||||
|
@Async |
||||||
|
public void addOperationLog(JoinPoint joinPoint, Object res, long time, UserEntity systemUser) { |
||||||
|
// synchronized (SysLogAspect.class) {//获得登录用户信息
|
||||||
|
// User systemUser = (User) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature(); |
||||||
|
SystemLog operationLog = new SystemLog(); |
||||||
|
//获取内网地址IpUtils.intranetIp()
|
||||||
|
//获取外网地址IpUtils.internetIp()
|
||||||
|
// operationLog.setIpAddressLan("");
|
||||||
|
// operationLog.setIpAddressWan("");
|
||||||
|
operationLog.setIpAddressLan(IpUtils.intranetIp()); |
||||||
|
//获取不到外网IP设置内网IP
|
||||||
|
if (StringUtils.isBlank(IpUtils.internetIp())) { |
||||||
|
operationLog.setIpAddressWan(IpUtils.intranetIp()); |
||||||
|
} else { |
||||||
|
operationLog.setIpAddressWan(IpUtils.internetIp()); |
||||||
|
} |
||||||
|
// operationLog.setRunTime(time);
|
||||||
|
//operationLog.setRunTime(0L);
|
||||||
|
operationLog.setReturnValue(JSONObject.toJSONString(res)); |
||||||
|
operationLog.setId(UUID.randomUUID().toString()); |
||||||
|
operationLog.setArgs(JSONObject.toJSONString(joinPoint.getArgs())); |
||||||
|
operationLog.setCreateTime(new Date()); |
||||||
|
operationLog.setMethod(signature.getDeclaringTypeName() + "." + signature.getName()); |
||||||
|
operationLog.setUserId(systemUser.getId() + ""); |
||||||
|
operationLog.setUserName(systemUser.getAccount()); |
||||||
|
Log annotation = signature.getMethod().getAnnotation(Log.class); |
||||||
|
if (annotation != null) { |
||||||
|
operationLog.setLogLevel(annotation.level()); |
||||||
|
operationLog.setLogDescribe(getDetail(((MethodSignature) joinPoint.getSignature()).getParameterNames(), joinPoint.getArgs(), annotation)); |
||||||
|
operationLog.setOperationType(annotation.operationType().getValue()); |
||||||
|
operationLog.setOperationUnit(annotation.operationUnit().getValue()); |
||||||
|
} |
||||||
|
|
||||||
|
//这里保存日志
|
||||||
|
// log.info("######记录日志:{}######", operationLog.toString());
|
||||||
|
int b = systemLogMapper.insert(operationLog); |
||||||
|
log.info("######记录日志:{}######", operationLog.toString()); |
||||||
|
if (b<= 0) { |
||||||
|
log.error("#####新增###记录日志失败:{}####", operationLog); |
||||||
|
} |
||||||
|
// }
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 对当前登录用户和占位符处理 |
||||||
|
* |
||||||
|
* @param argNames 方法参数名称数组 |
||||||
|
* @param args 方法参数数组 |
||||||
|
* @param annotation 注解信息 |
||||||
|
* @return 返回处理后的描述 |
||||||
|
*/ |
||||||
|
private String getDetail(String[] argNames, Object[] args, Log annotation) { |
||||||
|
//获得登录用户信息
|
||||||
|
//User systemUser = (User) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
||||||
|
String token = request.getHeader("token"); |
||||||
|
String userId = RedisUtil.get("dq:token:"+token); |
||||||
|
String userEntityStr = RedisUtil.get("dq:userId:"+userId); |
||||||
|
UserEntity systemUser = JSON.parseObject(userEntityStr,UserEntity.class); |
||||||
|
//Token userToken = tokenService.getOne(new QueryWrapper<Token>().eq("token", token));
|
||||||
|
//UserEntity systemUser = userLoginService.getOne(new QueryWrapper<UserEntity>().eq("id",userToken.getUserId()));
|
||||||
|
|
||||||
|
Map<Object, Object> map = new HashMap<>(4); |
||||||
|
for (int i = 0; i < argNames.length; i++) { |
||||||
|
map.put(argNames[i], args[i]); |
||||||
|
} |
||||||
|
|
||||||
|
String detail = annotation.detail(); |
||||||
|
try { |
||||||
|
detail = "'" + systemUser.getAccount() + "'=》" + annotation.detail(); |
||||||
|
for (Map.Entry<Object, Object> entry : map.entrySet()) { |
||||||
|
Object k = entry.getKey(); |
||||||
|
Object v = entry.getValue(); |
||||||
|
detail = detail.replace("{{" + k + "}}", JSONObject.toJSONString(v)); |
||||||
|
} |
||||||
|
} catch (Exception e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
return detail; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,179 @@ |
|||||||
|
package com.daqing.financial.hrauth.aspect; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON; |
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.daqing.financial.hrauth.annotation.Log; |
||||||
|
import com.daqing.financial.hrauth.service.TokenService; |
||||||
|
import com.daqing.financial.hrauth.service.UserLoginService; |
||||||
|
import com.daqing.framework.domain.hrms.Token; |
||||||
|
import com.daqing.framework.domain.hrms.UserEntity; |
||||||
|
import com.daqing.framework.util.RedisUtil; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.aspectj.lang.JoinPoint; |
||||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||||
|
import org.aspectj.lang.annotation.*; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
import org.springframework.web.context.request.RequestContextHolder; |
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @ClassName SysLogAspect |
||||||
|
* @Description 操作日志切面 |
||||||
|
* @Date 2020/9/30 |
||||||
|
* @Version 1.0 |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
@Aspect |
||||||
|
@Component |
||||||
|
public class SysLogAspect { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private Operation operation; |
||||||
|
@Autowired |
||||||
|
private TokenService tokenService; |
||||||
|
@Autowired |
||||||
|
private UserLoginService userLoginService; |
||||||
|
/** |
||||||
|
* 此处的切点是注解的方式,也可以用包名的方式达到相同的效果 |
||||||
|
* '@Pointcut("execution(* com.wwj.springboot.service.impl.*.*(..))")' |
||||||
|
*/ |
||||||
|
@Pointcut("@annotation(com.daqing.financial.hrauth.annotation.Log)") |
||||||
|
public void operationLog() { |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 环绕增强,相当于MethodInterceptor |
||||||
|
*/ |
||||||
|
@Around("operationLog()") |
||||||
|
public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable { |
||||||
|
Object res = null; |
||||||
|
long time = System.currentTimeMillis(); |
||||||
|
try { |
||||||
|
res = joinPoint.proceed(); |
||||||
|
time = System.currentTimeMillis() - time; |
||||||
|
return res; |
||||||
|
} finally { |
||||||
|
try { |
||||||
|
//User systemUser = (User) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
||||||
|
String token = request.getHeader("token"); |
||||||
|
String userId = RedisUtil.get("dq:token:"+token); |
||||||
|
String userEntityStr = RedisUtil.get("dq:userId:"+userId); |
||||||
|
UserEntity systemUser = JSON.parseObject(userEntityStr,UserEntity.class); |
||||||
|
|
||||||
|
//Token userToken = tokenService.getOne(new QueryWrapper<Token>().eq("token", token));
|
||||||
|
//UserEntity systemUser = userLoginService.getOne(new QueryWrapper<UserEntity>().eq("id",userId));
|
||||||
|
operation.addOperationLog(joinPoint,res,time,systemUser); |
||||||
|
//方法执行完成后增加日志
|
||||||
|
// addOperationLog(joinPoint, res, time);
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("LogAspect 操作失败:" + e.getMessage()); |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 对当前登录用户和占位符处理 |
||||||
|
* |
||||||
|
* @param argNames 方法参数名称数组 |
||||||
|
* @param args 方法参数数组 |
||||||
|
* @param annotation 注解信息 |
||||||
|
* @return 返回处理后的描述 |
||||||
|
*/ |
||||||
|
private String getDetail(String[] argNames, Object[] args, Log annotation) { |
||||||
|
//获得登录用户信息
|
||||||
|
//User systemUser = (User) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
||||||
|
UserEntity systemUser = (UserEntity) request.getUserPrincipal(); |
||||||
|
|
||||||
|
Map<Object, Object> map = new HashMap<>(4); |
||||||
|
for (int i = 0; i < argNames.length; i++) { |
||||||
|
map.put(argNames[i], args[i]); |
||||||
|
} |
||||||
|
|
||||||
|
String detail = annotation.detail(); |
||||||
|
try { |
||||||
|
detail = "'" + systemUser.getAccount() + "'=》" + annotation.detail(); |
||||||
|
for (Map.Entry<Object, Object> entry : map.entrySet()) { |
||||||
|
Object k = entry.getKey(); |
||||||
|
Object v = entry.getValue(); |
||||||
|
detail = detail.replace("{{" + k + "}}", JSONObject.toJSONString(v)); |
||||||
|
} |
||||||
|
} catch (Exception e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
return detail; |
||||||
|
} |
||||||
|
|
||||||
|
@Before("operationLog()") |
||||||
|
public void doBeforeAdvice(JoinPoint joinPoint) { |
||||||
|
// System.out.println("进入方法前执行.....");
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 处理完请求,返回内容 |
||||||
|
* |
||||||
|
* @param ret |
||||||
|
*/ |
||||||
|
@AfterReturning(returning = "ret", pointcut = "operationLog()") |
||||||
|
public void doAfterReturning(Object ret) { |
||||||
|
// System.out.println("方法的返回值 : " + ret);
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 后置异常通知 |
||||||
|
*/ |
||||||
|
@AfterThrowing("operationLog()") |
||||||
|
public void throwss(JoinPoint jp) { |
||||||
|
// System.out.println("方法异常时执行.....");
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 后置最终通知,final增强,不管是抛出异常或者正常退出都会执行 |
||||||
|
*/ |
||||||
|
@After("operationLog()") |
||||||
|
public void after(JoinPoint jp) { |
||||||
|
// System.out.println("方法最后执行.....");
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 获取客户端ip地址 |
||||||
|
* |
||||||
|
* @param request |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static String getClientIp(HttpServletRequest request) { |
||||||
|
String ip = request.getHeader("x-forwarded-for"); |
||||||
|
if (ip == null || ip.trim() == "" || "unknown".equalsIgnoreCase(ip)) { |
||||||
|
ip = request.getHeader("Proxy-Client-IP"); |
||||||
|
} |
||||||
|
if (ip == null || ip.trim() == "" || "unknown".equalsIgnoreCase(ip)) { |
||||||
|
ip = request.getHeader("WL-Proxy-Client-IP"); |
||||||
|
} |
||||||
|
if (ip == null || ip.trim() == "" || "unknown".equalsIgnoreCase(ip)) { |
||||||
|
ip = request.getRemoteAddr(); |
||||||
|
} |
||||||
|
// 多个路由时,取第一个非unknown的ip
|
||||||
|
final String[] arr = ip.split(","); |
||||||
|
for (final String str : arr) { |
||||||
|
if (!"unknown".equalsIgnoreCase(str)) { |
||||||
|
ip = str; |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return ip; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -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; |
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 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.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
@Mapper |
@Mapper |
||||||
public interface LoginLogMapper extends BaseMapper<LoginLog> { |
public interface LoginLogMapper extends BaseMapper<LoginLog> { |
||||||
|
IPage<LoginLog> pageByCondition(Page page,@Param("loginLog") UserLoginLogRequest userLoginLogRequest); |
||||||
} |
} |
||||||
|
@ -0,0 +1,20 @@ |
|||||||
|
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.SystemLog; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* @ClassName SystemLogMapper |
||||||
|
* @Description 用户动作记录 |
||||||
|
* @Date 2020/9/30 |
||||||
|
* @Version 1.0 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface SystemLogMapper extends BaseMapper<SystemLog> { |
||||||
|
IPage<SystemLog> pageByCondition(Page page); |
||||||
|
} |
||||||
|
|
@ -0,0 +1,66 @@ |
|||||||
|
package com.daqing.financial.hrauth.enums; |
||||||
|
|
||||||
|
/** |
||||||
|
* 日志操作类型 |
||||||
|
*/ |
||||||
|
public enum BusinessType |
||||||
|
{ |
||||||
|
/** |
||||||
|
* 其它 |
||||||
|
*/ |
||||||
|
OTHER, |
||||||
|
/** |
||||||
|
* 新增 |
||||||
|
*/ |
||||||
|
INSERT, |
||||||
|
/** |
||||||
|
* 修改 |
||||||
|
*/ |
||||||
|
UPDATE, |
||||||
|
/** |
||||||
|
* 删除 |
||||||
|
*/ |
||||||
|
DELETE, |
||||||
|
/** |
||||||
|
* 查询 |
||||||
|
*/ |
||||||
|
SELECT, |
||||||
|
/** |
||||||
|
* 导出 |
||||||
|
*/ |
||||||
|
EXPORT, |
||||||
|
/** |
||||||
|
* 导入 |
||||||
|
*/ |
||||||
|
IMPORT; |
||||||
|
|
||||||
|
public static String getMsg(BusinessType type){ |
||||||
|
String result = null; |
||||||
|
switch (type) { |
||||||
|
case INSERT: |
||||||
|
result = "新增"; |
||||||
|
break; |
||||||
|
case UPDATE: |
||||||
|
result = "修改"; |
||||||
|
break; |
||||||
|
case DELETE: |
||||||
|
result = "删除"; |
||||||
|
break; |
||||||
|
case SELECT: |
||||||
|
result = "查询"; |
||||||
|
break; |
||||||
|
case EXPORT: |
||||||
|
result = "导出"; |
||||||
|
break; |
||||||
|
case IMPORT: |
||||||
|
result = "导入"; |
||||||
|
break; |
||||||
|
case OTHER: |
||||||
|
result = "其它"; |
||||||
|
break; |
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
return result; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,52 @@ |
|||||||
|
package com.daqing.financial.hrauth.enums; |
||||||
|
|
||||||
|
public enum OperationType { |
||||||
|
|
||||||
|
/** |
||||||
|
* 操作类型 |
||||||
|
*/ |
||||||
|
UNKNOWN("UNKNOWN"), |
||||||
|
DELETE("DELETE"), |
||||||
|
SELECT("SELECT"), |
||||||
|
UPDATE("UPDATE"), |
||||||
|
INSERT("INSERT"); |
||||||
|
|
||||||
|
private String value; |
||||||
|
|
||||||
|
public String getValue() { |
||||||
|
return value; |
||||||
|
} |
||||||
|
|
||||||
|
public void setValue(String value) { |
||||||
|
this.value = value; |
||||||
|
} |
||||||
|
|
||||||
|
OperationType(String s) { |
||||||
|
this.value = s; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static String getMsg(BusinessType type){ |
||||||
|
String result = null; |
||||||
|
switch (type) { |
||||||
|
case INSERT: |
||||||
|
result = "新增"; |
||||||
|
break; |
||||||
|
case UPDATE: |
||||||
|
result = "修改"; |
||||||
|
break; |
||||||
|
case DELETE: |
||||||
|
result = "删除"; |
||||||
|
break; |
||||||
|
case SELECT: |
||||||
|
result = "查询"; |
||||||
|
break; |
||||||
|
case OTHER: |
||||||
|
result = "其它"; |
||||||
|
break; |
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
return result; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
package com.daqing.financial.hrauth.enums; |
||||||
|
|
||||||
|
public enum OperationUnit { |
||||||
|
/** |
||||||
|
* 被操作的单元 |
||||||
|
*/ |
||||||
|
UNKNOWN("unknown"), |
||||||
|
USER("user"), |
||||||
|
LOG("log"), |
||||||
|
PERMISSION("permission"), |
||||||
|
ROLE("role"), |
||||||
|
DEVICE("device"), |
||||||
|
WITHDRAW("withdraw"), |
||||||
|
ATRUSER("atrUser"), |
||||||
|
ASSERT("ASSERT"), |
||||||
|
COIN("coin"), |
||||||
|
NOTICE("notice"), |
||||||
|
DATASTATISTIC("datastatistic"), |
||||||
|
BlockGroup("blockGroup"), |
||||||
|
C2C("c2c"), |
||||||
|
USERROLE("userRole"); |
||||||
|
|
||||||
|
private String value; |
||||||
|
|
||||||
|
OperationUnit(String value) { |
||||||
|
this.value = value; |
||||||
|
} |
||||||
|
|
||||||
|
public String getValue() { |
||||||
|
return value; |
||||||
|
} |
||||||
|
|
||||||
|
public void setValue(String value) { |
||||||
|
this.value = value; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -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; |
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.domain.hrms.request.UserLoginLogRequest; |
||||||
|
import com.daqing.framework.domain.hrms.request.UserLoginRequest; |
||||||
|
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, 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,67 @@ |
|||||||
|
package com.daqing.financial.hrauth.util; |
||||||
|
|
||||||
|
import java.net.Inet4Address; |
||||||
|
import java.net.InetAddress; |
||||||
|
import java.net.NetworkInterface; |
||||||
|
import java.util.Enumeration; |
||||||
|
|
||||||
|
/** |
||||||
|
* @ClassName IpUtils |
||||||
|
* @Description Ip工具类,获取ip |
||||||
|
* @Date 2020/9/30 |
||||||
|
* @Version 1.0 |
||||||
|
*/ |
||||||
|
public class IpUtils { |
||||||
|
/*** |
||||||
|
* 获取外网IP |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static String internetIp() { |
||||||
|
try { |
||||||
|
|
||||||
|
Enumeration<NetworkInterface> networks = NetworkInterface.getNetworkInterfaces(); |
||||||
|
InetAddress inetAddress = null; |
||||||
|
Enumeration<InetAddress> inetAddresses = null; |
||||||
|
while (networks.hasMoreElements()) { |
||||||
|
inetAddresses = networks.nextElement().getInetAddresses(); |
||||||
|
while (inetAddresses.hasMoreElements()) { |
||||||
|
inetAddress = inetAddresses.nextElement(); |
||||||
|
if (inetAddress != null |
||||||
|
&& inetAddress instanceof Inet4Address |
||||||
|
&& !inetAddress.isSiteLocalAddress() |
||||||
|
&& !inetAddress.isLoopbackAddress() |
||||||
|
&& inetAddress.getHostAddress().indexOf(":") == -1) { |
||||||
|
return inetAddress.getHostAddress(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return null; |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
|
||||||
|
throw new RuntimeException(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取内网IP |
||||||
|
* |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static String intranetIp() { |
||||||
|
try { |
||||||
|
return InetAddress.getLocalHost().getHostAddress(); |
||||||
|
} catch (Exception e) { |
||||||
|
throw new RuntimeException(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取服务启动host |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static String getHost(){ |
||||||
|
return internetIp()==null?intranetIp():internetIp(); |
||||||
|
} |
||||||
|
} |
@ -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> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,47 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
|
||||||
|
<configuration> |
||||||
|
<!--定义日志文件的存储地址,使用绝对路径--> |
||||||
|
<property name="LOG_HOME" value="d:/logs/daqing/hrms_auth"/> |
||||||
|
|
||||||
|
<!-- Console 输出设置 --> |
||||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
||||||
|
<encoder> |
||||||
|
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> |
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> |
||||||
|
<charset>utf8</charset> |
||||||
|
</encoder> |
||||||
|
</appender> |
||||||
|
|
||||||
|
<!-- 按照每天生成日志文件 --> |
||||||
|
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||||
|
<!--日志文件输出的文件名--> |
||||||
|
<fileNamePattern>${LOG_HOME}/hrms_auth.%d{yyyy-MM-dd}.log</fileNamePattern> |
||||||
|
</rollingPolicy> |
||||||
|
<encoder> |
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> |
||||||
|
</encoder> |
||||||
|
</appender> |
||||||
|
|
||||||
|
<!-- 异步输出 --> |
||||||
|
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender"> |
||||||
|
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 --> |
||||||
|
<discardingThreshold>0</discardingThreshold> |
||||||
|
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 --> |
||||||
|
<queueSize>512</queueSize> |
||||||
|
<!-- 添加附加的appender,最多只能添加一个 --> |
||||||
|
<appender-ref ref="FILE"/> |
||||||
|
</appender> |
||||||
|
|
||||||
|
|
||||||
|
<logger name="org.apache.ibatis.cache.decorators.LoggingCache" level="DEBUG" additivity="false"> |
||||||
|
<appender-ref ref="CONSOLE"/> |
||||||
|
</logger> |
||||||
|
<logger name="org.springframework.boot" level="DEBUG"/> |
||||||
|
<root level="info"> |
||||||
|
<!--<appender-ref ref="ASYNC"/>--> |
||||||
|
<appender-ref ref="FILE"/> |
||||||
|
<appender-ref ref="CONSOLE"/> |
||||||
|
</root> |
||||||
|
</configuration> |
@ -0,0 +1,41 @@ |
|||||||
|
<?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.UserLoginDao"> |
||||||
|
<!-- 可根据自己的需求,是否要使用 --> |
||||||
|
<resultMap type="com.daqing.framework.domain.hrms.UserEntity" id="userMap"> |
||||||
|
<result property="id" column="id"/> |
||||||
|
<result property="account" column="account"/> |
||||||
|
<result property="phoneAccount" column="phone_account"/> |
||||||
|
<result property="password" column="password"/> |
||||||
|
<result property="loginNum" column="login_num"/> |
||||||
|
<result property="createTime" column="create_time"/> |
||||||
|
<result property="motifyTime" column="motify_time"/> |
||||||
|
</resultMap> |
||||||
|
<update id="updatePasswordByPhoneAccount"> |
||||||
|
update hrms_user set password = #{password} where phone_account = #{phoneAccount} |
||||||
|
</update> |
||||||
|
|
||||||
|
<select id="getUser" parameterType="string" resultType="com.daqing.framework.domain.hrms.UserEntity"> |
||||||
|
SELECT account,password FROM hrms_user WHERE account = #{account} |
||||||
|
</select> |
||||||
|
<select id="selectCount" resultType="java.lang.Integer"> |
||||||
|
select count(1) from hrms_user where phone_account = #{phoneAccount} |
||||||
|
</select> |
||||||
|
|
||||||
|
<select id="login" parameterType="com.daqing.framework.domain.hrms.request.LoginRequest" resultType="com.daqing.framework.domain.hrms.UserEntity"> |
||||||
|
select id,account,phone_account,password,login_num from hrms_user |
||||||
|
where del_or_not = 0 and status = 0 |
||||||
|
<if test="phone != null and phone != '' "> |
||||||
|
and phone_account = #{phone} |
||||||
|
</if> |
||||||
|
<if test="wechatId != null and wechatId != '' "> |
||||||
|
and wechat_id = #{wechatId} |
||||||
|
</if> |
||||||
|
|
||||||
|
</select> |
||||||
|
<select id="selectByPhoneAccount" resultType="com.daqing.framework.domain.hrms.UserEntity"> |
||||||
|
SELECT id,account FROM hrms_user WHERE phone_account = #{phoneAccount} |
||||||
|
</select> |
||||||
|
|
||||||
|
</mapper> |
@ -0,0 +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);
|
||||||
|
// }
|
||||||
|
//}
|
@ -0,0 +1,12 @@ |
|||||||
|
#security: |
||||||
|
# oauth2: |
||||||
|
# client: |
||||||
|
# client-id: user-client |
||||||
|
# client-secret: user-secret-8888 |
||||||
|
# user-authorization-uri: http://localhost:7000/oauth/authorize |
||||||
|
# access-token-uri: http://localhost:7000/oauth/token |
||||||
|
# resource: |
||||||
|
# id: user-client |
||||||
|
# user-info-uri: user-info |
||||||
|
# authorization: |
||||||
|
# check-token-access: http://localhost:7000/oauth/check_token |
@ -0,0 +1,12 @@ |
|||||||
|
#security: |
||||||
|
# oauth2: |
||||||
|
# client: |
||||||
|
# client-id: user-client |
||||||
|
# client-secret: user-secret-8888 |
||||||
|
# user-authorization-uri: http://localhost:7000/oauth/authorize |
||||||
|
# access-token-uri: http://localhost:7000/oauth/token |
||||||
|
# resource: |
||||||
|
# id: user-client |
||||||
|
# user-info-uri: user-info |
||||||
|
# authorization: |
||||||
|
# check-token-access: http://localhost:7000/oauth/check_token |
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue