#
Junjie
2024-04-13 e9a4418c14ef68fb454300b092c413e8df259ec2
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/common/aspect/OperationLogAspect.java
@@ -4,10 +4,10 @@
import com.zy.asrs.common.utils.IpTools;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.wcs.common.annotation.OperationLog;
import com.zy.asrs.wcs.sys.entity.OperationRecord;
import com.zy.asrs.wcs.sys.entity.User;
import com.zy.asrs.wcs.sys.service.OperationRecordService;
import com.zy.asrs.wcs.utils.Utils;
import com.zy.asrs.wcs.system.entity.OperationRecord;
import com.zy.asrs.wcs.system.entity.User;
import com.zy.asrs.wcs.system.service.OperationRecordService;
import com.zy.asrs.wcs.utils.CommonUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.aspectj.lang.reflect.MethodSignature;
@@ -93,7 +93,7 @@
        User user = getLoginUser();
        if (user != null) {
            record.setUserId(user.getId());
            record.setHostId(user.getHostId());
//            record.setHostId(user.getHostId());
        }
        // 记录请求地址、请求方式、ip
        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
@@ -105,7 +105,7 @@
        // 记录异常信息
        if (e != null) {
            record.setResult(0);
            record.setErr(Utils.sub(e.toString(), MAX_LENGTH));
            record.setErr(CommonUtils.sub(e.toString(), MAX_LENGTH));
        } else {
            record.setResult(1);
        }
@@ -117,11 +117,11 @@
        }
        // 记录请求参数
        if (ol.param() && request != null) {
            record.setRequest(Utils.sub(getParams(joinPoint, request), MAX_LENGTH));
            record.setRequest(CommonUtils.sub(getParams(joinPoint, request), MAX_LENGTH));
        }
        // 记录请求结果
        if (ol.result() && result != null) {
            record.setResponse(Utils.sub(JSON.toJSONString(result), MAX_LENGTH));
            record.setResponse(CommonUtils.sub(JSON.toJSONString(result), MAX_LENGTH));
        }
        operationRecordService.saveAsync(record);
    }
@@ -154,7 +154,7 @@
        Map<String, String[]> map = Collections.unmodifiableMap(request.getParameterMap());
        for (Map.Entry<String, String[]> entry : map.entrySet()) {
            paramsMap.put(entry.getKey(), Utils.join(entry.getValue(), ","));
            paramsMap.put(entry.getKey(), CommonUtils.join(entry.getValue(), ","));
        }
        if (paramsMap.keySet().size() > 0) {