| | |
| | | package com.whyc.util; |
| | | |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.service.UserLogService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.system.ApplicationHome; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | |
| | | /** |
| | | * 通用工具列 |
| | | */ |
| | | @Component |
| | | public class CommonUtil { |
| | | |
| | | private static UserLogService userLogService; |
| | | |
| | | @Autowired |
| | | public void setUserLogService(UserLogService userLogService) { |
| | | CommonUtil.userLogService = userLogService; |
| | | } |
| | | |
| | | /**获取当前Session中的属性user*/ |
| | | public static UserInf getUser(HttpServletRequest request) { |
| | |
| | | File jarFile = applicationHome.getDir(); |
| | | return jarFile.toString(); |
| | | } |
| | | |
| | | /**手动记录特定日志*/ |
| | | public static void record(long uId, int operationType, String msg){ |
| | | userLogService.record(uId,operationType,msg); |
| | | } |
| | | |
| | | /**手动记录特定日志*/ |
| | | public static void record(long uId, int operationType, String msg,String msgDetail){ |
| | | userLogService.record(uId,operationType,msg,msgDetail); |
| | | } |
| | | } |