jinpengyong
2021-08-02 dce0021131e955bac968cb2a7e24ce3673eb1a3b
screen-api/src/main/java/com/moral/api/utils/OperationLogUtils.java
@@ -8,6 +8,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.moral.api.entity.UserLog;
import com.moral.api.service.UserLogService;
@@ -18,17 +19,15 @@
@Component
public class OperationLogUtils {
    private static UserLogService userLogService;
    @Autowired
    public void setUserLogService(UserLogService userLogService) {
        this.userLogService = userLogService;
    }
    private UserLogService userLogService;
    public static void insertLog(HttpServletRequest request, String content) {
    @Transactional
    public void insertLog(HttpServletRequest request, String content, String type) {
        String token = request.getHeader("token");
        Map<String, Object> currentUserInfo = (Map<String, Object>) TokenUtils.getUserInfoByToken(token);
        UserLog userLog = new UserLog();
        userLog.setType(type);
        userLog.setIp(WebUtils.getIpAddr(request));
        userLog.setOperateId((Integer) currentUserInfo.get("userId"));
        Map<String, Object> orgInfo = (Map<String, Object>) currentUserInfo.get("organization");