Ver código fonte

本地测试

chenxz 7 anos atrás
pai
commit
586d113825

+ 10 - 1
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/common/aspect/PointAspect.java

@@ -1,12 +1,15 @@
 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.rpc.user.IntegralService;
 import org.apache.shiro.SecurityUtils;
 import org.aspectj.lang.JoinPoint;
 import org.aspectj.lang.annotation.AfterReturning;
 import org.aspectj.lang.annotation.Aspect;
 import org.aspectj.lang.annotation.Pointcut;
 import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.stereotype.Component;
 
@@ -19,6 +22,9 @@ import java.lang.reflect.Method;
 @Component
 public class PointAspect {
 
+    @Autowired
+    IntegralService integralService;
+
     @Pointcut("@annotation(pointChange)")
     private void pointcut(PointChange pointChange){}
 
@@ -26,7 +32,10 @@ public class PointAspect {
     public void afterReturning(PointChange pointChange) {
 
         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());
 
     }

+ 4 - 0
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/web/ctrl/TestController.java

@@ -1,5 +1,7 @@
 package cn.iselab.mooctest.site.web.ctrl;
 
+import cn.iselab.mooctest.rpc.user.constants.IntegralEventConstants;
+import cn.iselab.mooctest.site.common.annotation.PointChange;
 import cn.iselab.mooctest.site.common.constant.UrlConstants;
 import cn.iselab.mooctest.site.configure.ClientFeatureConfiguration;
 import cn.iselab.mooctest.site.configure.realm.DefaultUsernamepasswordToken;
@@ -22,6 +24,7 @@ import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.authc.AccountException;
 import org.apache.shiro.authz.annotation.RequiresUser;
 import org.apache.shiro.subject.Subject;
+import org.aspectj.lang.annotation.Pointcut;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -75,6 +78,7 @@ public class TestController {
 
     private Logger LOG = LoggerFactory.getLogger(getClass());
 
+    @PointChange(value = "login")
     @RequestMapping(value = "/api/test/login", method = RequestMethod.POST)
     public UserVO login(@RequestBody UserVO userVO, BindingResult bindingResult, HttpServletRequest request) {
         if (bindingResult.hasErrors()) {

+ 95 - 0
mooctest-site-server/src/main/resources/application.yaml

@@ -20,6 +20,101 @@ spring:
     properties.hibernate.dialect: org.hibernate.dialect.MySQL5Dialect
 
 ---
+
+spring:
+    profiles: dev
+    datasource:
+        url: jdbc:mysql://101.37.175.111:3306/mooctest_main_dev?useUnicode=yes&characterEncoding=UTF-8
+        username: mooctest
+        password: secr3t!
+    dubbo:
+        application.name: local-dubbo-main-site-provider-consumer3
+        registry.address: zookeeper://127.0.0.1:2181
+        protocol.name: dubbo
+        protocol.port: 20884
+        scan: cn.iselab.mooctest.site.rpc
+        monitor.protocol: registry
+        timeout: 120000
+        shutdown.hook: true
+    rabbitmq:
+        host: 121.199.32.102
+        port: 5672
+        username: mooctest
+        password: mooctestPassword
+        virtual-host: dev
+    redis:
+        host: 114.55.91.27
+        port: 6379
+        password:
+        pool:
+            max-active: 8
+            max-wait: -1
+            max-idle: 8
+            min-idle: 0
+
+featureSwitch:
+    default:
+        role: worker
+    client:
+        sms: true
+        email: true
+        oss: true
+        webide: true
+        wechat: false
+    server:
+        rpcDevService: true
+        mongoServer: true
+        UserService: true
+        enableRabbitListener: false
+        initExamScheduler: false
+mongodb:
+    host: 114.55.91.27
+    port: 80
+    db: testGraph
+    reportCollection: report
+    mutationCollection: mutation
+    caseGraghCollection: caseGraph
+    caughtNodeCollection: caughtNode
+    userCatchCollection: userCatch
+    catchCollection: catch
+    sumCatchCollection: sumCatch
+    competeAnalysisCollection: competeAnalysisResult
+    difficultAnalysisCollection: difficultAnalysisResult
+    timeAnalysisCollection: timeAnalysisResult
+    targetGraphCollection: targetGraph
+    base64Auth: Basic YWRtaW46Y2hhbmdlaXQ=
+
+oss:
+    bucketName:
+        dev: mooctest-dev
+        static: mooctest-mutation
+        main: mooctest-site-dev
+        app: kikbug-public
+        target: target
+    bucket: mooctest-site-dev
+    accessKeyId: IvS323TIcWUT57MG
+    accessKeySecret: dYml7rvT8stQkoSjMYlfRTxNj9dEsI
+    endPoint: http://oss-cn-shanghai.aliyuncs.com
+    expireTime: 600
+    region: oss-cn-shanghai
+    roleArn: acs:ram::1525065817051996:role/oss-archives
+
+server:
+    port: 8080
+
+logging.config: classpath:log4j2.yaml
+#logging.access.enabled: false
+
+host: http://local.mooctest.net
+
+webIDE:
+    address: 47.97.4.113:8000
+
+celeryServer:
+    host: 121.199.32.102
+    port: 5002
+
+---
 # 私有云服务环境
 spring:
     profiles: privatecloud

+ 3 - 3
mooctest-site-server/src/main/resources/bootstrap.yaml

@@ -4,10 +4,10 @@ spring:
         name: mooctest-site-server
     cloud:
         zookeeper:
-            enabled: true  # true:开启zookeeper外部化配置, false:读取本地配置;
+            enabled: false  # true:开启zookeeper外部化配置, false:读取本地配置;
             connect-string: 101.37.175.111:2181
             config:
                 root: /config
-                enabled: true
+                enabled: false
                 watcher:
-                    enabled: true
+                    enabled: false