資源簡(jiǎn)介
旅游管理系統(tǒng)包括以下幾個(gè)模塊:用戶管理,角色管理,資源權(quán)限管理,訪問(wèn)日志,資源權(quán)限管理,產(chǎn)品管理,訂單管理等六個(gè)模塊
內(nèi)有包含詳細(xì)的功能描述文檔,是一個(gè)比較系統(tǒng)的利用ssh框架,B\S模式開(kāi)發(fā)的系統(tǒng),比較完善的運(yùn)用到了各功能間框架的整合
代碼片段和文件信息
package?com.itheima.ssm.aop;
import?java.util.Date;
import?javax.servlet.http.HttpServletRequest;
import?java.lang.reflect.Method;
import?org.aspectj.lang.JoinPoint;
import?org.aspectj.lang.annotation.After;
import?org.aspectj.lang.annotation.Aspect;
import?org.aspectj.lang.annotation.Before;
import?org.springframework.beans.factory.annotation.Autowired;
import?org.springframework.security.core.context.SecurityContext;
import?org.springframework.security.core.context.SecurityContextHolder;
import?org.springframework.security.core.userdetails.User;
import?org.springframework.stereotype.Component;
import?org.springframework.web.bind.annotation.RequestMapping;
import?com.itheima.ssm.entity.SysLog;
import?com.itheima.ssm.service.SysLogService;
@Component
@Aspect
public?class?LogAop?{
@Autowired
private?HttpServletRequest?request;
@Autowired
private?SysLogService?sysLogService;
//?開(kāi)始時(shí)間
private?Date?visitTime;
//?訪問(wèn)的類
private?Class?clazz;
//?訪問(wèn)的方法
private?Method?method;
//?前置通知
@Before(“execution(*?com.itheima.ssm.controller.*.*(..))“)
public?void?doBefore(JoinPoint?jp)?throws?NoSuchMethodException?{
//?當(dāng)前時(shí)間就是開(kāi)始訪問(wèn)的時(shí)間
visitTime?=?new?Date();
//?具體要訪問(wèn)的類
clazz?=?jp.getTarget().getClass();
//?獲取訪問(wèn)的方法的名稱
String?methodName?=?jp.getSignature().getName();
//?獲取訪問(wèn)的方法的參數(shù)
object[]?args?=?jp.getArgs();
//?獲取具體執(zhí)行的方法的Method對(duì)象
if?(args?==?null?||?args.length?==?0)?{
//?只能獲取無(wú)參數(shù)的方法
method?=?clazz.getMethod(methodName);
}?else?{
Class[]?classArgs?=?new?Class[args.length];
for?(int?i?=?0;?i? classArgs[i]?=?args[i].getClass();
}
clazz.getMethod(methodName?classArgs);
}
}
//?后置通知
@After(“execution(*?com.itheima.ssm.controller.*.*(..))“)
public?void?doAfter(JoinPoint?jp)?throws?Exception?{
//?獲取訪問(wèn)的時(shí)長(zhǎng)
long?time?=?new?Date().getTime()?-?visitTime.getTime();
String?url?=?““;
//?獲取url
if?(clazz?!=?null?&&?method?!=?null?&&?clazz?!=?LogAop.class)?{
//?1、獲取類上的@RequestMapping(“/orders“)
RequestMapping?classAnnotation?=?(RequestMapping)?clazz.getAnnotation(RequestMapping.class);
if?(classAnnotation?!=?null)?{
String[]?classValue?=?classAnnotation.value();
//?2、獲取方法上的@RequestMapping(xxx)
RequestMapping?methodAnnotation?=?method.getAnnotation(RequestMapping.class);
if?(methodAnnotation?!=?null)?{
String[]?methodValue?=?methodAnnotation.value();
url?=?classValue[0]?+?methodValue[0];
//?獲取訪問(wèn)的ip
String?ip?=?request.getRemoteAddr();
//?獲取當(dāng)前操作的用戶
SecurityContext?context?=?SecurityContextHolder.getContext();
User?user?=?(User)?context.getAuthentication().getPrincipal();
String?username?=?user.getUsername();
//?將日志相關(guān)信息封裝到SysLog對(duì)象中
SysLog?sysLog?=?new?SysLog();
sysLog.setExecutionTime(time);
sysLog.setIp(ip);
sysLog.setMethod(“[類名]“+clazz.getName()+“[方法名]“+method.getName());
sysLog.setUrl(url);
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-12-21?15:05??151413124_張順_實(shí)訓(xùn)\
?????目錄???????????0??2018-12-19?14:01??151413124_張順_實(shí)訓(xùn)\code\
?????目錄???????????0??2018-12-21?15:04??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\
?????文件?????????930??2018-12-07?11:28??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\.classpath
?????文件???????????8??2018-12-07?10:08??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\.gitignore
?????文件????????1044??2018-12-04?18:40??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\.project
?????目錄???????????0??2018-12-21?15:04??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\.settings\
?????文件?????????567??2018-12-04?18:40??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\.settings\.jsdtscope
?????文件?????????364??2018-12-04?18:40??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\.settings\org.eclipse.jdt.core.prefs
?????文件?????????637??2018-12-06?15:11??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\.settings\org.eclipse.wst.common.component
?????文件?????????345??2018-12-04?18:40??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件??????????49??2018-12-04?18:40??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件???????????6??2018-12-04?18:40??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????目錄???????????0??2018-12-21?15:04??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\
?????目錄???????????0??2018-12-19?14:01??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\me
?????文件??????????39??2018-12-04?18:40??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\me
?????目錄???????????0??2018-12-21?15:04??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\WEB-INF\
?????文件????????2426??2018-12-06?13:11??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\WEB-INF\web.xm
?????目錄???????????0??2018-12-21?15:04??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\css\
?????文件????????2425??2018-12-04?18:54??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\css\st
?????文件???????14259??2018-12-05?15:39??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\failer.jsp
?????目錄???????????0??2018-12-19?14:01??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\img\
?????文件????????2163??2018-12-04?18:54??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\img\american-express.png
?????文件????????8117??2018-12-04?18:54??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\img\avatar.png
?????文件???????13539??2018-12-04?18:54??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\img\avatar04.png
?????文件????????8262??2018-12-04?18:54??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\img\avatar2.png
?????文件????????9241??2018-12-04?18:54??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\img\avatar3.png
?????文件????????7578??2018-12-04?18:54??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\img\avatar5.png
?????文件??????123770??2018-12-04?18:54??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\img\boxed-bg.jpg
?????文件???????43677??2018-12-04?18:54??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\img\boxed-bg.png
?????文件??????221181??2018-12-04?18:54??151413124_張順_實(shí)訓(xùn)\code\web2_shixun\WebContent\img\center.jpg
............此處省略1347個(gè)文件信息
評(píng)論
共有 條評(píng)論