|
@@ -1,12 +1,15 @@
|
|
package cn.iselab.mooctest.site.common.aspect;
|
|
package cn.iselab.mooctest.site.common.aspect;
|
|
|
|
|
|
|
|
+import cn.iselab.mooctest.rpc.user.data.AddIntegralDTO;
|
|
import cn.iselab.mooctest.site.common.annotation.PointChange;
|
|
import cn.iselab.mooctest.site.common.annotation.PointChange;
|
|
|
|
+import cn.iselab.mooctest.site.rpc.user.IntegralService;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.aspectj.lang.JoinPoint;
|
|
import org.aspectj.lang.JoinPoint;
|
|
import org.aspectj.lang.annotation.AfterReturning;
|
|
import org.aspectj.lang.annotation.AfterReturning;
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
import org.aspectj.lang.annotation.Pointcut;
|
|
import org.aspectj.lang.annotation.Pointcut;
|
|
import org.aspectj.lang.reflect.MethodSignature;
|
|
import org.aspectj.lang.reflect.MethodSignature;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
@@ -19,6 +22,9 @@ import java.lang.reflect.Method;
|
|
@Component
|
|
@Component
|
|
public class PointAspect {
|
|
public class PointAspect {
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ IntegralService integralService;
|
|
|
|
+
|
|
@Pointcut("@annotation(pointChange)")
|
|
@Pointcut("@annotation(pointChange)")
|
|
private void pointcut(PointChange pointChange){}
|
|
private void pointcut(PointChange pointChange){}
|
|
|
|
|
|
@@ -26,7 +32,10 @@ public class PointAspect {
|
|
public void afterReturning(PointChange pointChange) {
|
|
public void afterReturning(PointChange pointChange) {
|
|
|
|
|
|
Long userId = (Long) SecurityUtils.getSubject().getSession().getAttribute("userId");
|
|
Long userId = (Long) SecurityUtils.getSubject().getSession().getAttribute("userId");
|
|
-
|
|
|
|
|
|
+ AddIntegralDTO dto=new AddIntegralDTO();
|
|
|
|
+ dto.setUserId(userId);
|
|
|
|
+ dto.setEvent(pointChange.value());
|
|
|
|
+ integralService.checkIntegral(dto);
|
|
System.out.println("Point Change : user="+userId+" event="+pointChange.value());
|
|
System.out.println("Point Change : user="+userId+" event="+pointChange.value());
|
|
|
|
|
|
}
|
|
}
|