Merge remote-tracking branch 'origin/develop_master' into develop_master
# Conflicts: # adc-da-slrs/src/main/java/com/adc/da/slrs/sysLog/entity/SysLog.java
This commit is contained in:
@@ -21,4 +21,8 @@ public enum BusinessType {
|
|||||||
* 查询
|
* 查询
|
||||||
*/
|
*/
|
||||||
SEARCH,
|
SEARCH,
|
||||||
|
/**
|
||||||
|
* 下载
|
||||||
|
*/
|
||||||
|
DOWNLOAD,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import java.lang.annotation.*;
|
|||||||
@Documented
|
@Documented
|
||||||
public @interface EpcLog {
|
public @interface EpcLog {
|
||||||
|
|
||||||
String value() default "";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模块
|
* 模块
|
||||||
*/
|
*/
|
||||||
@@ -25,4 +23,7 @@ public @interface EpcLog {
|
|||||||
|
|
||||||
String description();
|
String description();
|
||||||
|
|
||||||
|
String speclaiValue() default "";
|
||||||
|
String speclaiFlag() default "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
package com.adc.da.Log;
|
package com.adc.da.Log;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
import com.adc.da.slrs.sysLog.entity.SysLog;
|
import com.adc.da.slrs.sysLog.entity.SysLog;
|
||||||
import com.adc.da.slrs.sysLog.service.ISysLogService;
|
import com.adc.da.slrs.sysLog.service.ISysLogService;
|
||||||
import com.adc.da.util.LoginUserUtil;
|
import com.adc.da.util.LoginUserUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.annotation.AfterReturning;
|
import org.aspectj.lang.annotation.AfterReturning;
|
||||||
@@ -13,6 +17,7 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -47,14 +52,15 @@ public class logs {
|
|||||||
* 后置通知(在方法执行之后并返回数据) 用于拦截Controller层无异常的操作
|
* 后置通知(在方法执行之后并返回数据) 用于拦截Controller层无异常的操作
|
||||||
* @param joinPoint 切点
|
* @param joinPoint 切点
|
||||||
*/
|
*/
|
||||||
@AfterReturning("logPointCut()")
|
@AfterReturning(value = "logPointCut()",returning="returnValue")
|
||||||
public void after(JoinPoint joinPoint){
|
public void after(JoinPoint joinPoint, Object returnValue){
|
||||||
Executor executor = Executors.newCachedThreadPool();
|
Executor executor = Executors.newCachedThreadPool();
|
||||||
try {
|
try {
|
||||||
String description = getControllerMethodInfo(joinPoint).get("description").toString();
|
String description = getControllerMethodInfo(joinPoint).get("description").toString();
|
||||||
|
String speclaiValue = getControllerMethodInfo(joinPoint).get("speclaiValue").toString();
|
||||||
|
String speclaiFlag = getControllerMethodInfo(joinPoint).get("speclaiFlag").toString();
|
||||||
Map<String, String[]> logParams = request.getParameterMap();
|
Map<String, String[]> logParams = request.getParameterMap();
|
||||||
// String principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString();
|
System.out.println(returnValue);
|
||||||
|
|
||||||
SysLog log = new SysLog();
|
SysLog log = new SysLog();
|
||||||
// ##请求用户
|
// ##请求用户
|
||||||
log.setUserId(LoginUserUtil.getUserId());
|
log.setUserId(LoginUserUtil.getUserId());
|
||||||
@@ -62,18 +68,29 @@ public class logs {
|
|||||||
log.setOperLocation(description);
|
log.setOperLocation(description);
|
||||||
// ##日志类型
|
// ##日志类型
|
||||||
log.setOper(String.valueOf(getControllerMethodInfo(joinPoint).get("type")));
|
log.setOper(String.valueOf(getControllerMethodInfo(joinPoint).get("type")));
|
||||||
// ##日志请求url
|
|
||||||
// log.setRequestUrl(request.getRequestURI());…
|
|
||||||
// ##请求方式
|
|
||||||
// log.setRequestType(request.getMethod());
|
|
||||||
// ##请求参数
|
// ##请求参数
|
||||||
log.setJson(logParams.toString());
|
StringBuilder stringBuilder=new StringBuilder();
|
||||||
|
for (String s:logParams.keySet()) {
|
||||||
|
if (!s.equals("_t")) {
|
||||||
|
stringBuilder.append("," + s + "=" + logParams.get(s)[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.setJson(stringBuilder.substring(1,stringBuilder.length()));
|
||||||
|
|
||||||
|
//特殊处理
|
||||||
|
if ("1".equals(speclaiFlag)){
|
||||||
|
//这个是国内或者海外的查询接
|
||||||
|
String gson=new Gson().toJson(returnValue);
|
||||||
|
JSONObject jsonObject= JSON.parseObject(gson);
|
||||||
|
JSONObject object= JSON.parseObject(jsonObject.getString("data"));
|
||||||
|
log.setSpecial(object.getString("standSort")+" "+object.getString("standNumber")+"-"+object.getString("standYear")+" "+object.getString("standName")+" "+speclaiValue);
|
||||||
|
}
|
||||||
// ##请求开始时间
|
// ##请求开始时间
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
// ##请求耗时
|
// ##请求耗时
|
||||||
Long logElapsedTime = endTime - beginTime;
|
Long logElapsedTime = endTime - beginTime;
|
||||||
log.setRunTime(logElapsedTime.intValue());
|
log.setRunTime(logElapsedTime.intValue());
|
||||||
|
log.setOperTime(DateTime.of(new Date()));
|
||||||
// ##调用线程保存至log表
|
// ##调用线程保存至log表
|
||||||
executor.execute(new SaveSystemLogThread(log, sysLogService));
|
executor.execute(new SaveSystemLogThread(log, sysLogService));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -123,7 +140,9 @@ public class logs {
|
|||||||
Method[] methods = targetClass.getMethods();
|
Method[] methods = targetClass.getMethods();
|
||||||
|
|
||||||
String description = "";
|
String description = "";
|
||||||
Integer type = null;
|
String type = null;
|
||||||
|
String speclaiValue = "";
|
||||||
|
String speclaiFlag = "";
|
||||||
|
|
||||||
for(Method method : methods) {
|
for(Method method : methods) {
|
||||||
if(!method.getName().equals(methodName)) {
|
if(!method.getName().equals(methodName)) {
|
||||||
@@ -135,9 +154,13 @@ public class logs {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
description = method.getAnnotation(EpcLog.class).description();
|
description = method.getAnnotation(EpcLog.class).description();
|
||||||
type = method.getAnnotation(EpcLog.class).businessType().ordinal();
|
type = method.getAnnotation(EpcLog.class).businessType().name();
|
||||||
|
speclaiValue = method.getAnnotation(EpcLog.class).speclaiValue();
|
||||||
|
speclaiFlag = method.getAnnotation(EpcLog.class).speclaiFlag();
|
||||||
map.put("description", description);
|
map.put("description", description);
|
||||||
map.put("type", type);
|
map.put("type", type);
|
||||||
|
map.put("speclaiValue",speclaiValue);
|
||||||
|
map.put("speclaiFlag",speclaiFlag);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -89,7 +89,6 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
|
|||||||
|
|
||||||
@ApiOperation(value = "|SarStandardsInfoEO|自定义分页查询")
|
@ApiOperation(value = "|SarStandardsInfoEO|自定义分页查询")
|
||||||
@GetMapping("/getSarStandardsInfoPage")
|
@GetMapping("/getSarStandardsInfoPage")
|
||||||
@EpcLog(description = "国内库或国外库查询",businessType = BusinessType.SEARCH)
|
|
||||||
//@RequiresPermissions("lawss:sarStandardsInfo:getSarStandardsInfoPage")
|
//@RequiresPermissions("lawss:sarStandardsInfo:getSarStandardsInfoPage")
|
||||||
public ResponseMessage<PageInfo<SarStandardsInfo>> getSarStandardsInfoPage(SarStandardsInfoEOPage page,@RequestParam(defaultValue = "0") String mark) throws Exception {
|
public ResponseMessage<PageInfo<SarStandardsInfo>> getSarStandardsInfoPage(SarStandardsInfoEOPage page,@RequestParam(defaultValue = "0") String mark) throws Exception {
|
||||||
if (null != page.getNowOrderBy()) {
|
if (null != page.getNowOrderBy()) {
|
||||||
@@ -507,7 +506,7 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
|
|||||||
|
|
||||||
@ApiOperation(value = "|SarStandardsInfoEO|详情")
|
@ApiOperation(value = "|SarStandardsInfoEO|详情")
|
||||||
@GetMapping("/getStandInfoById")
|
@GetMapping("/getStandInfoById")
|
||||||
//@RequiresPermissions("lawss:sarStandardsInfo:get")
|
@EpcLog(description = "国内详情查询",businessType = BusinessType.SEARCH,speclaiFlag = "1",speclaiValue = "查询详情")
|
||||||
public ResponseMessage<SarStandardsInfo> find(String id) throws Exception {
|
public ResponseMessage<SarStandardsInfo> find(String id) throws Exception {
|
||||||
SarStandardsInfo result = sarStandardsInfoEOService.selectStandardsInfoByKey(id);
|
SarStandardsInfo result = sarStandardsInfoEOService.selectStandardsInfoByKey(id);
|
||||||
return Result.success(result);
|
return Result.success(result);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.adc.da.slrs.sysLog.entity;
|
package com.adc.da.slrs.sysLog.entity;
|
||||||
|
|
||||||
import com.adc.da.base.entity.BaseEntity;
|
import com.adc.da.base.entity.BaseEntity;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -30,7 +29,7 @@ public class SysLog extends BaseEntity {
|
|||||||
private String userId;
|
private String userId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "操作时间")
|
@ApiModelProperty(value = "操作时间")
|
||||||
private String operTime;
|
private DateTime operTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "操作类型")
|
@ApiModelProperty(value = "操作类型")
|
||||||
private String oper;
|
private String oper;
|
||||||
@@ -56,6 +55,9 @@ public class SysLog extends BaseEntity {
|
|||||||
@ApiModelProperty(value = "接口耗时")
|
@ApiModelProperty(value = "接口耗时")
|
||||||
private int runTime;
|
private int runTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "特殊处理的接口展示内容")
|
||||||
|
private String special;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String account;
|
private String account;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user