Преглед на файлове

考试系统插件提交

pans преди 8 месеца
родител
ревизия
0f9aa6aa93
променени са 100 файла, в които са добавени 226 реда и са изтрити 3405 реда
  1. 16 0
      pom.xml
  2. 12 0
      snowy-modules/snowy-web-app/pom.xml
  3. 11 31
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/pom.xml
  4. 0 49
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/application/ApplicationContextProvider.java
  5. 0 28
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/property/CookieConfig.java
  6. 0 50
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/property/PasswordKeyConfig.java
  7. 0 92
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/property/QnConfig.java
  8. 0 94
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/property/SystemConfig.java
  9. 0 93
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/property/WxConfig.java
  10. 0 73
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/exception/ExceptionHandle.java
  11. 0 70
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/mvc/WebMvcConfiguration.java
  12. 0 68
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/AuthenticationBean.java
  13. 0 35
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/LoginAuthenticationEntryPoint.java
  14. 0 26
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestAccessDeniedHandler.java
  15. 0 27
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestAuthenticationFailureHandler.java
  16. 0 83
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestAuthenticationProvider.java
  17. 0 64
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestAuthenticationSuccessHandler.java
  18. 0 52
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestDetailsServiceImpl.java
  19. 0 67
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestLoginAuthenticationFilter.java
  20. 0 54
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestLogoutSuccessHandler.java
  21. 0 31
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestTokenBasedRememberMeServices.java
  22. 0 63
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestUtil.java
  23. 0 136
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/SecurityConfigurer.java
  24. 0 68
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/wx/TokenHandlerInterceptor.java
  25. 18 28
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/context/WebContext.java
  26. 0 50
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/context/WxContext.java
  27. 0 40
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/ErrorController.java
  28. 22 28
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/admin/DashboardController.java
  29. 12 12
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/admin/ExamPaperAnswerController.java
  30. 15 16
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/admin/MessageController.java
  31. 0 103
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/admin/UploadController.java
  32. 0 152
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/admin/UserController.java
  33. 33 38
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/student/DashboardController.java
  34. 0 51
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/student/UploadController.java
  35. 0 140
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/student/UserController.java
  36. 0 22
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/wx/BaseWXApiController.java
  37. 0 85
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/wx/student/AuthController.java
  38. 0 129
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/wx/student/DashboardController.java
  39. 0 135
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/wx/student/ExamPaperAnswerController.java
  40. 0 57
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/wx/student/ExamPaperController.java
  41. 0 150
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/wx/student/UserController.java
  42. 3 3
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/ExamPaper.java
  43. 3 3
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/ExamPaperAnswer.java
  44. 3 3
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/ExamPaperQuestionCustomerAnswer.java
  45. 3 3
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/Message.java
  46. 3 3
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/MessageUser.java
  47. 3 3
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/Question.java
  48. 3 3
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/TaskExam.java
  49. 3 3
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/TaskExamCustomerAnswer.java
  50. 3 3
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/User.java
  51. 4 4
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/UserEventLog.java
  52. 3 3
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/UserToken.java
  53. 0 82
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/listener/CalculateExamPaperAnswerListener.java
  54. 0 25
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/listener/EmailSendListener.java
  55. 0 35
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/listener/UserLogListener.java
  56. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/BaseMapper.java
  57. 2 2
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/ExamPaperAnswerMapper.java
  58. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/ExamPaperMapper.java
  59. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/ExamPaperQuestionCustomerAnswerMapper.java
  60. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/MessageMapper.java
  61. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/MessageUserMapper.java
  62. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/QuestionMapper.java
  63. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/SubjectMapper.java
  64. 3 3
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/TaskExamCustomerAnswerMapper.java
  65. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/TaskExamMapper.java
  66. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/TextContentMapper.java
  67. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/UserEventLogMapper.java
  68. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/ExamPaperAnswerMapper.xml
  69. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/ExamPaperMapper.xml
  70. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/ExamPaperQuestionCustomerAnswerMapper.xml
  71. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/MessageMapper.xml
  72. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/MessageUserMapper.xml
  73. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/QuestionMapper.xml
  74. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/SubjectMapper.xml
  75. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/TaskExamCustomerAnswerMapper.xml
  76. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/TaskExamMapper.xml
  77. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/TextContentMapper.xml
  78. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/UserEventLogMapper.xml
  79. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/UserMapper.xml
  80. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/UserTokenMapper.xml
  81. 0 131
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/repository/UserMapper.java
  82. 0 11
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/repository/UserTokenMapper.java
  83. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/QuestionService.java
  84. 2 2
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/TaskExamCustomerAnswerService.java
  85. 0 128
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/UserService.java
  86. 0 46
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/UserTokenService.java
  87. 0 62
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/AuthenticationServiceImpl.java
  88. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/BaseServiceImpl.java
  89. 5 5
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/ExamPaperAnswerServiceImpl.java
  90. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/ExamPaperQuestionCustomerAnswerServiceImpl.java
  91. 2 2
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/ExamPaperServiceImpl.java
  92. 0 48
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/FileUploadImpl.java
  93. 2 2
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/MessageServiceImpl.java
  94. 2 2
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/QuestionServiceImpl.java
  95. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/SubjectServiceImpl.java
  96. 4 4
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/TaskExamCustomerAnswerImpl.java
  97. 2 2
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/TaskExamServiceImpl.java
  98. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/TextContentServiceImpl.java
  99. 1 1
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/UserEventLogServiceImpl.java
  100. 0 160
      snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/UserServiceImpl.java

+ 16 - 0
pom.xml

@@ -346,6 +346,22 @@
                 <version>${snowy.version}</version>
             </dependency>
 
+            <!-- snowy-plugin-exam-func -->
+            <dependency>
+                <groupId>vip.xiaonuo</groupId>
+                <artifactId>snowy-plugin-exam-api</artifactId>
+                <version>${snowy.version}</version>
+            </dependency>
+
+
+            <dependency>
+                <groupId>vip.xiaonuo</groupId>
+                <artifactId>snowy-plugin-exam-func</artifactId>
+                <version>${snowy.version}</version>
+            </dependency>
+
+
+
             <!-- snowy-plugin-urp-api -->
             <dependency>
                 <groupId>vip.xiaonuo</groupId>

+ 12 - 0
snowy-modules/snowy-web-app/pom.xml

@@ -141,6 +141,18 @@
             <artifactId>snowy-plugin-disk-func</artifactId>
         </dependency>
 
+        <!-- snowy-plugin-exam-func -->
+        <dependency>
+            <groupId>vip.xiaonuo</groupId>
+            <artifactId>snowy-plugin-exam-api</artifactId>
+        </dependency>
+
+
+        <dependency>
+            <groupId>vip.xiaonuo</groupId>
+            <artifactId>snowy-plugin-exam-func</artifactId>
+        </dependency>
+
         <!-- bootstrap 配置加载 -->
         <dependency>
             <groupId>org.springframework.cloud</groupId>

+ 11 - 31
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/pom.xml

@@ -20,22 +20,6 @@
         <dependency>
             <groupId>vip.xiaonuo</groupId>
             <artifactId>snowy-common</artifactId>
-            <version>${project.parent.version}</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>com.fhs-opensource</groupId>
-                    <artifactId>easy-trans-spring-boot-starter</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>com.fhs-opensource</groupId>
-                    <artifactId>easy-trans-mybatis-plus-extend</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-security</artifactId>
-            <version>${spring.boot.version}</version>
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
@@ -58,16 +42,13 @@
             <artifactId>spring-boot-starter-undertow</artifactId>
             <version>${spring.boot.version}</version>
         </dependency>
+
         <dependency>
             <groupId>org.mybatis.spring.boot</groupId>
             <artifactId>mybatis-spring-boot-starter</artifactId>
             <version>2.1.0</version>
         </dependency>
-        <dependency>
-            <groupId>com.github.pagehelper</groupId>
-            <artifactId>pagehelper-spring-boot-starter</artifactId>
-            <version>1.2.12</version>
-        </dependency>
+
 
 
         <dependency>
@@ -93,18 +74,17 @@
             <artifactId>modelmapper</artifactId>
             <version>2.3.3</version>
         </dependency>
-
+        <dependency>
+            <groupId>com.github.jsqlparser</groupId>
+            <artifactId>jsqlparser</artifactId>
+            <version>4.4</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
             <version>3.9</version>
         </dependency>
 
-        <dependency>
-            <groupId>com.qiniu</groupId>
-            <artifactId>qiniu-java-sdk</artifactId>
-            <version>7.2.25</version>
-        </dependency>
 
         <dependency>
             <groupId>org.springframework.boot</groupId>
@@ -112,12 +92,12 @@
             <version>${spring.boot.version}</version>
             <scope>test</scope>
         </dependency>
+
         <dependency>
-            <groupId>org.springframework.security</groupId>
-            <artifactId>spring-security-test</artifactId>
-            <scope>test</scope>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <version>1.2.12</version>
         </dependency>
-
         <!-- hot debug -->
         <dependency>
             <groupId>org.springframework.boot</groupId>

+ 0 - 49
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/application/ApplicationContextProvider.java

@@ -1,49 +0,0 @@
-package vip.xiaonuo.exam.configuration.application;
-
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.stereotype.Component;
-
-/**
- * @version 3.5.0
- * @description: The type Application context provider.
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-@Component
-public class ApplicationContextProvider implements ApplicationContextAware {
-    private static ApplicationContext context;
-
-    private ApplicationContextProvider() {
-    }
-
-    @Override
-    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
-        context = applicationContext;
-    }
-
-    /**
-     * Gets bean.
-     *
-     * @param <T>    the type parameter
-     * @param aClass the a class
-     * @return the bean
-     */
-    public static <T> T getBean(Class<T> aClass) {
-        return context.getBean(aClass);
-    }
-
-    /**
-     * Gets bean.
-     *
-     * @param <T>  the type parameter
-     * @param name the name
-     * @return the bean
-     */
-    @SuppressWarnings("unchecked")
-    public static <T> T getBean(String name) {
-        return (T) context.getBean(name);
-    }
-}
-

+ 0 - 28
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/property/CookieConfig.java

@@ -1,28 +0,0 @@
-package vip.xiaonuo.exam.configuration.property;
-
-/**
- * @version 3.5.0
- * @description: The type Cookie config.
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-public class CookieConfig {
-
-    /**
-     * Gets name.
-     *
-     * @return the name
-     */
-    public static String getName() {
-        return "xzs";
-    }
-
-    /**
-     * Gets interval.
-     *
-     * @return the interval
-     */
-    public static Integer getInterval() {
-        return 30 * 24 * 60 * 60;
-    }
-}

+ 0 - 50
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/property/PasswordKeyConfig.java

@@ -1,50 +0,0 @@
-package vip.xiaonuo.exam.configuration.property;
-
-/**
- * @version 3.5.0
- * @description: The type Password key config.
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-public class PasswordKeyConfig {
-    private String publicKey;
-
-    private String privateKey;
-
-    /**
-     * Gets public key.
-     *
-     * @return the public key
-     */
-    public String getPublicKey() {
-        return publicKey;
-    }
-
-    /**
-     * Sets public key.
-     *
-     * @param publicKey the public key
-     */
-    public void setPublicKey(String publicKey) {
-        this.publicKey = publicKey;
-    }
-
-    /**
-     * Gets private key.
-     *
-     * @return the private key
-     */
-    public String getPrivateKey() {
-        return privateKey;
-    }
-
-    /**
-     * Sets private key.
-     *
-     * @param privateKey the private key
-     */
-    public void setPrivateKey(String privateKey) {
-        this.privateKey = privateKey;
-    }
-
-}

+ 0 - 92
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/property/QnConfig.java

@@ -1,92 +0,0 @@
-package vip.xiaonuo.exam.configuration.property;
-
-
-import java.time.Duration;
-import java.util.List;
-
-/**
- * @version 3.5.0
- * @description: The type Qn config.
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-public class QnConfig {
-
-    private String url;
-    private String bucket;
-    private String accessKey;
-    private String secretKey;
-
-    /**
-     * Gets url.
-     *
-     * @return the url
-     */
-    public String getUrl() {
-        return url;
-    }
-
-    /**
-     * Sets url.
-     *
-     * @param url the url
-     */
-    public void setUrl(String url) {
-        this.url = url;
-    }
-
-    /**
-     * Gets bucket.
-     *
-     * @return the bucket
-     */
-    public String getBucket() {
-        return bucket;
-    }
-
-    /**
-     * Sets bucket.
-     *
-     * @param bucket the bucket
-     */
-    public void setBucket(String bucket) {
-        this.bucket = bucket;
-    }
-
-    /**
-     * Gets access key.
-     *
-     * @return the access key
-     */
-    public String getAccessKey() {
-        return accessKey;
-    }
-
-    /**
-     * Sets access key.
-     *
-     * @param accessKey the access key
-     */
-    public void setAccessKey(String accessKey) {
-        this.accessKey = accessKey;
-    }
-
-    /**
-     * Gets secret key.
-     *
-     * @return the secret key
-     */
-    public String getSecretKey() {
-        return secretKey;
-    }
-
-    /**
-     * Sets secret key.
-     *
-     * @param secretKey the secret key
-     */
-    public void setSecretKey(String secretKey) {
-        this.secretKey = secretKey;
-    }
-
-}

+ 0 - 94
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/property/SystemConfig.java

@@ -1,94 +0,0 @@
-package vip.xiaonuo.exam.configuration.property;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-import java.util.List;
-
-
-/**
- * @version 3.5.0
- * @description: The type System config.
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-@ConfigurationProperties(prefix = "system")
-public class SystemConfig {
-
-    private PasswordKeyConfig pwdKey;
-    private List<String> securityIgnoreUrls;
-    private WxConfig wx;
-    private QnConfig qn;
-
-    /**
-     * Gets pwd key.
-     *
-     * @return the pwd key
-     */
-    public PasswordKeyConfig getPwdKey() {
-        return pwdKey;
-    }
-
-    /**
-     * Sets pwd key.
-     *
-     * @param pwdKey the pwd key
-     */
-    public void setPwdKey(PasswordKeyConfig pwdKey) {
-        this.pwdKey = pwdKey;
-    }
-
-    /**
-     * Gets security ignore urls.
-     *
-     * @return the security ignore urls
-     */
-    public List<String> getSecurityIgnoreUrls() {
-        return securityIgnoreUrls;
-    }
-
-    /**
-     * Sets security ignore urls.
-     *
-     * @param securityIgnoreUrls the security ignore urls
-     */
-    public void setSecurityIgnoreUrls(List<String> securityIgnoreUrls) {
-        this.securityIgnoreUrls = securityIgnoreUrls;
-    }
-
-    /**
-     * Gets wx.
-     *
-     * @return the wx
-     */
-    public WxConfig getWx() {
-        return wx;
-    }
-
-    /**
-     * Sets wx.
-     *
-     * @param wx the wx
-     */
-    public void setWx(WxConfig wx) {
-        this.wx = wx;
-    }
-
-    /**
-     * Gets qn.
-     *
-     * @return the qn
-     */
-    public QnConfig getQn() {
-        return qn;
-    }
-
-    /**
-     * Sets qn.
-     *
-     * @param qn the qn
-     */
-    public void setQn(QnConfig qn) {
-        this.qn = qn;
-    }
-
-}

+ 0 - 93
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/property/WxConfig.java

@@ -1,93 +0,0 @@
-package vip.xiaonuo.exam.configuration.property;
-
-
-import java.time.Duration;
-import java.util.List;
-
-/**
- * @version 3.5.0
- * @description: The type Wx config.
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-public class WxConfig {
-
-
-    private String appid;
-    private String secret;
-    private Duration tokenToLive;
-    private List<String> securityIgnoreUrls;
-
-    /**
-     * Gets appid.
-     *
-     * @return the appid
-     */
-    public String getAppid() {
-        return appid;
-    }
-
-    /**
-     * Sets appid.
-     *
-     * @param appid the appid
-     */
-    public void setAppid(String appid) {
-        this.appid = appid;
-    }
-
-    /**
-     * Gets secret.
-     *
-     * @return the secret
-     */
-    public String getSecret() {
-        return secret;
-    }
-
-    /**
-     * Sets secret.
-     *
-     * @param secret the secret
-     */
-    public void setSecret(String secret) {
-        this.secret = secret;
-    }
-
-    /**
-     * Gets token to live.
-     *
-     * @return the token to live
-     */
-    public Duration getTokenToLive() {
-        return tokenToLive;
-    }
-
-    /**
-     * Sets token to live.
-     *
-     * @param tokenToLive the token to live
-     */
-    public void setTokenToLive(Duration tokenToLive) {
-        this.tokenToLive = tokenToLive;
-    }
-
-    /**
-     * Gets security ignore urls.
-     *
-     * @return the security ignore urls
-     */
-    public List<String> getSecurityIgnoreUrls() {
-        return securityIgnoreUrls;
-    }
-
-    /**
-     * Sets security ignore urls.
-     *
-     * @param securityIgnoreUrls the security ignore urls
-     */
-    public void setSecurityIgnoreUrls(List<String> securityIgnoreUrls) {
-        this.securityIgnoreUrls = securityIgnoreUrls;
-    }
-
-}

+ 0 - 73
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/exception/ExceptionHandle.java

@@ -1,73 +0,0 @@
-package vip.xiaonuo.exam.configuration.spring.exception;
-
-import vip.xiaonuo.exam.base.RestResponse;
-import vip.xiaonuo.exam.base.SystemCode;
-import vip.xiaonuo.exam.utility.ErrorUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.validation.BindException;
-import org.springframework.validation.FieldError;
-import org.springframework.web.bind.MethodArgumentNotValidException;
-import org.springframework.web.bind.annotation.ControllerAdvice;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import java.util.stream.Collectors;
-
-/**
- * @version 3.5.0
- * @description: The type Exception handle.
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-@ControllerAdvice
-public class ExceptionHandle {
-    private final static Logger logger = LoggerFactory.getLogger(ExceptionHandle.class);
-
-    /**
-     * Handler rest response.
-     *
-     * @param e the e
-     * @return the rest response
-     */
-    @ExceptionHandler(Exception.class)
-    @ResponseBody
-    public RestResponse handler(Exception e) {
-        logger.error(e.getMessage(), e);
-        return new RestResponse<>(SystemCode.InnerError.getCode(), SystemCode.InnerError.getMessage());
-    }
-
-    /**
-     * Handler rest response.
-     *
-     * @param e the e
-     * @return the rest response
-     */
-    @ExceptionHandler(MethodArgumentNotValidException.class)
-    @ResponseBody
-    public RestResponse handler(MethodArgumentNotValidException e) {
-        String errorMsg = e.getBindingResult().getAllErrors().stream().map(file -> {
-            FieldError fieldError = (FieldError) file;
-            return ErrorUtil.parameterErrorFormat(fieldError.getField(), fieldError.getDefaultMessage());
-        }).collect(Collectors.joining());
-        return new RestResponse<>(SystemCode.ParameterValidError.getCode(), errorMsg);
-    }
-
-    /**
-     * Handler rest response.
-     *
-     * @param e the e
-     * @return the rest response
-     */
-    @ExceptionHandler(BindException.class)
-    @ResponseBody
-    public RestResponse handler(BindException e) {
-        String errorMsg = e.getBindingResult().getAllErrors().stream().map(file -> {
-            FieldError fieldError = (FieldError) file;
-            return ErrorUtil.parameterErrorFormat(fieldError.getField(), fieldError.getDefaultMessage());
-        }).collect(Collectors.joining());
-        return new RestResponse<>(SystemCode.ParameterValidError.getCode(), errorMsg);
-    }
-
-
-}

+ 0 - 70
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/mvc/WebMvcConfiguration.java

@@ -1,70 +0,0 @@
-package vip.xiaonuo.exam.configuration.spring.mvc;
-
-import vip.xiaonuo.exam.configuration.property.SystemConfig;
-import vip.xiaonuo.exam.configuration.spring.wx.TokenHandlerInterceptor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.*;
-
-import java.util.List;
-
-
-/**
- * @version 3.5.0
- * @description: The type Web mvc configuration.
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-@Configuration
-public class WebMvcConfiguration extends WebMvcConfigurationSupport {
-
-    private final TokenHandlerInterceptor tokenHandlerInterceptor;
-    private final SystemConfig systemConfig;
-
-    /**
-     * Instantiates a new Web mvc configuration.
-     *
-     * @param tokenHandlerInterceptor the token handler interceptor
-     * @param systemConfig            the system config
-     */
-    @Autowired
-    public WebMvcConfiguration(TokenHandlerInterceptor tokenHandlerInterceptor, SystemConfig systemConfig) {
-        this.tokenHandlerInterceptor = tokenHandlerInterceptor;
-        this.systemConfig = systemConfig;
-    }
-
-    @Override
-    public void addViewControllers(ViewControllerRegistry registry) {
-        registry.addRedirectViewController("/", "/student/index.html");
-        registry.addRedirectViewController("/student", "/student/index.html");
-        registry.addRedirectViewController("/admin", "/admin/index.html");
-    }
-
-    @Override
-    public void addResourceHandlers(ResourceHandlerRegistry registry) {
-        registry.addResourceHandler("/**")
-                .addResourceLocations("classpath:/static/")
-                .setCachePeriod(31556926);
-    }
-
-    @Override
-    public void addInterceptors(InterceptorRegistry registry) {
-        List<String> securityIgnoreUrls = systemConfig.getWx().getSecurityIgnoreUrls();
-        String[] ignores = new String[securityIgnoreUrls.size()];
-        registry.addInterceptor(tokenHandlerInterceptor)
-                .addPathPatterns("/api/wx/**")
-                .excludePathPatterns(securityIgnoreUrls.toArray(ignores));
-        super.addInterceptors(registry);
-    }
-
-    @Override
-    public void addCorsMappings(CorsRegistry registry) {
-        registry.addMapping("/**")
-                .allowCredentials(true)
-                .allowedMethods("*")
-                .allowedOrigins("*")
-                .allowedHeaders("*");
-        super.addCorsMappings(registry);
-    }
-
-}

+ 0 - 68
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/AuthenticationBean.java

@@ -1,68 +0,0 @@
-package vip.xiaonuo.exam.configuration.spring.security;
-
-/**
- * @version 3.5.0
- * @description: The type Authentication bean.
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-public class AuthenticationBean {
-    private String userName;
-    private String password;
-    private boolean remember;
-
-    /**
-     * Gets user name.
-     *
-     * @return the user name
-     */
-    public String getUserName() {
-        return userName;
-    }
-
-    /**
-     * Sets user name.
-     *
-     * @param userName the user name
-     */
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
-
-    /**
-     * Gets password.
-     *
-     * @return the password
-     */
-    public String getPassword() {
-        return password;
-    }
-
-    /**
-     * Sets password.
-     *
-     * @param password the password
-     */
-    public void setPassword(String password) {
-        this.password = password;
-    }
-
-    /**
-     * Is remember boolean.
-     *
-     * @return the boolean
-     */
-    public boolean isRemember() {
-        return remember;
-    }
-
-    /**
-     * Sets remember.
-     *
-     * @param remember the remember
-     */
-    public void setRemember(boolean remember) {
-        this.remember = remember;
-    }
-
-}

+ 0 - 35
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/LoginAuthenticationEntryPoint.java

@@ -1,35 +0,0 @@
-package vip.xiaonuo.exam.configuration.spring.security;
-
-import vip.xiaonuo.exam.base.SystemCode;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
-import org.springframework.stereotype.Component;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * @version 3.5.0
- * @description: 未登录
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-@Component
-public final class LoginAuthenticationEntryPoint extends LoginUrlAuthenticationEntryPoint {
-
-    /**
-     * Instantiates a new Login authentication entry point.
-     */
-    public LoginAuthenticationEntryPoint() {
-        super("/api/user/login");
-    }
-
-    @Override
-    public void commence(HttpServletRequest request, HttpServletResponse response,
-                         AuthenticationException authException) throws IOException, ServletException {
-        RestUtil.response(response, SystemCode.UNAUTHORIZED);
-    }
-
-}

+ 0 - 26
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestAccessDeniedHandler.java

@@ -1,26 +0,0 @@
-package vip.xiaonuo.exam.configuration.spring.security;
-
-import vip.xiaonuo.exam.base.SystemCode;
-import org.springframework.security.access.AccessDeniedException;
-import org.springframework.security.web.access.AccessDeniedHandler;
-import org.springframework.stereotype.Component;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-
-/**
- * @version 3.5.0
- * @description: 没权限
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-@Component
-public class RestAccessDeniedHandler implements AccessDeniedHandler {
-    @Override
-    public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AccessDeniedException e) throws IOException, ServletException {
-        RestUtil.response(httpServletResponse, SystemCode.AccessDenied);
-    }
-}

+ 0 - 27
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestAuthenticationFailureHandler.java

@@ -1,27 +0,0 @@
-package vip.xiaonuo.exam.configuration.spring.security;
-
-import vip.xiaonuo.exam.base.SystemCode;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
-import org.springframework.stereotype.Component;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-
-/**
- * @version 3.5.0
- * @description: 账号验证异常
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-@Component
-public class RestAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler {
-
-    @Override
-    public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {
-        RestUtil.response(response, SystemCode.AuthError.getCode(), exception.getMessage());
-    }
-}

+ 0 - 83
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestAuthenticationProvider.java

@@ -1,83 +0,0 @@
-package vip.xiaonuo.exam.configuration.spring.security;
-
-
-import vip.xiaonuo.exam.context.WebContext;
-import vip.xiaonuo.exam.domain.enums.RoleEnum;
-import vip.xiaonuo.exam.domain.enums.UserStatusEnum;
-import vip.xiaonuo.exam.service.AuthenticationService;
-import vip.xiaonuo.exam.service.UserService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.authentication.AuthenticationProvider;
-import org.springframework.security.authentication.BadCredentialsException;
-import org.springframework.security.authentication.LockedException;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
-import org.springframework.security.core.userdetails.User;
-import org.springframework.security.core.userdetails.UsernameNotFoundException;
-import org.springframework.stereotype.Component;
-
-import java.util.ArrayList;
-
-
-/**
- * @version 3.5.0
- * @description: 登录用户名密码验证
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-@Component
-public class RestAuthenticationProvider implements AuthenticationProvider {
-
-    private final AuthenticationService authenticationService;
-    private final UserService userService;
-    private final WebContext webContext;
-
-    /**
-     * Instantiates a new Rest authentication provider.
-     *
-     * @param authenticationService the authentication service
-     * @param userService           the user service
-     * @param webContext            the web context
-     */
-    @Autowired
-    public RestAuthenticationProvider(AuthenticationService authenticationService, UserService userService, WebContext webContext) {
-        this.authenticationService = authenticationService;
-        this.userService = userService;
-        this.webContext = webContext;
-    }
-
-    @Override
-    public Authentication authenticate(Authentication authentication) throws AuthenticationException {
-        String username = authentication.getName();
-        String password = (String) authentication.getCredentials();
-
-        vip.xiaonuo.exam.domain.User user = userService.getUserByUserName(username);
-        if (user == null) {
-            throw new UsernameNotFoundException("用户名或密码错误");
-        }
-
-        boolean result = authenticationService.authUser(user, username, password);
-        if (!result) {
-            throw new BadCredentialsException("用户名或密码错误");
-        }
-
-        UserStatusEnum userStatusEnum = UserStatusEnum.fromCode(user.getStatus());
-        if (UserStatusEnum.Disable == userStatusEnum) {
-            throw new LockedException("用户被禁用");
-        }
-
-        ArrayList<GrantedAuthority> grantedAuthorities = new ArrayList<>();
-        grantedAuthorities.add(new SimpleGrantedAuthority(RoleEnum.fromCode(user.getRole()).getRoleName()));
-
-        User authUser = new User(user.getUserName(), user.getPassword(), grantedAuthorities);
-        return new UsernamePasswordAuthenticationToken(authUser, authUser.getPassword(), authUser.getAuthorities());
-    }
-
-    @Override
-    public boolean supports(Class<?> aClass) {
-        return true;
-    }
-}

+ 0 - 64
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestAuthenticationSuccessHandler.java

@@ -1,64 +0,0 @@
-package vip.xiaonuo.exam.configuration.spring.security;
-
-import vip.xiaonuo.exam.base.SystemCode;
-import vip.xiaonuo.exam.domain.UserEventLog;
-import vip.xiaonuo.exam.event.UserEvent;
-import vip.xiaonuo.exam.service.UserService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.userdetails.User;
-import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
-import org.springframework.stereotype.Component;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Date;
-
-
-/**
- * @version 3.5.0
- * @description: 登录成功返回
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-@Component
-public class RestAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
-
-    private final ApplicationEventPublisher eventPublisher;
-    private final UserService userService;
-
-    /**
-     * Instantiates a new Rest authentication success handler.
-     *
-     * @param eventPublisher the event publisher
-     * @param userService    the user service
-     */
-    @Autowired
-    public RestAuthenticationSuccessHandler(ApplicationEventPublisher eventPublisher, UserService userService) {
-        this.eventPublisher = eventPublisher;
-        this.userService = userService;
-    }
-
-    @Override
-    public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
-        Object object = authentication.getPrincipal();
-        if (null != object) {
-            User springUser = (User) object;
-            vip.xiaonuo.exam.domain.User user = userService.getUserByUserName(springUser.getUsername());
-            if (null != user) {
-                UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date());
-                userEventLog.setContent(user.getUserName() + " 登录了学之思开源考试系统");
-                eventPublisher.publishEvent(new UserEvent(userEventLog));
-                vip.xiaonuo.exam.domain.User newUser = new vip.xiaonuo.exam.domain.User();
-                newUser.setUserName(user.getUserName());
-                newUser.setImagePath(user.getImagePath());
-                RestUtil.response(response, SystemCode.OK.getCode(), SystemCode.OK.getMessage(), newUser);
-            }
-        } else {
-            RestUtil.response(response, SystemCode.UNAUTHORIZED.getCode(), SystemCode.UNAUTHORIZED.getMessage());
-        }
-    }
-}

+ 0 - 52
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestDetailsServiceImpl.java

@@ -1,52 +0,0 @@
-package vip.xiaonuo.exam.configuration.spring.security;
-
-import vip.xiaonuo.exam.domain.enums.RoleEnum;
-import vip.xiaonuo.exam.service.UserService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
-import org.springframework.security.core.userdetails.User;
-import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.security.core.userdetails.UsernameNotFoundException;
-import org.springframework.stereotype.Component;
-
-import java.util.ArrayList;
-
-
-/**
- * @version 3.5.0
- * @description: 验证通过之后,第二、三...请求,会调用此类
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-@Component
-public class RestDetailsServiceImpl implements UserDetailsService {
-
-    private final UserService userService;
-
-    /**
-     * Instantiates a new Rest details service.
-     *
-     * @param userService the user service
-     */
-    @Autowired
-    public RestDetailsServiceImpl(UserService userService) {
-        this.userService = userService;
-    }
-
-    @Override
-    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
-
-        vip.xiaonuo.exam.domain.User user = userService.getUserByUserName(username);
-
-        if (user == null) {
-            throw new UsernameNotFoundException("Username  not found.");
-        }
-
-        ArrayList<GrantedAuthority> grantedAuthorities = new ArrayList<>();
-        grantedAuthorities.add(new SimpleGrantedAuthority(RoleEnum.fromCode(user.getRole()).getRoleName()));
-
-        return new User(user.getUserName(), user.getPassword(), grantedAuthorities);
-    }
-}

+ 0 - 67
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestLoginAuthenticationFilter.java

@@ -1,67 +0,0 @@
-package vip.xiaonuo.exam.configuration.spring.security;
-
-import vip.xiaonuo.exam.configuration.property.CookieConfig;
-
-import vip.xiaonuo.exam.utility.JsonUtil;
-import org.slf4j.LoggerFactory;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
-import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices;
-import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.InputStream;
-
-
-/**
- * @version 3.5.0
- * @description: 登录参数序列化
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-public class RestLoginAuthenticationFilter extends AbstractAuthenticationProcessingFilter {
-    private final org.slf4j.Logger logger = LoggerFactory.getLogger(RestLoginAuthenticationFilter.class);
-
-    /**
-     * Instantiates a new Rest login authentication filter.
-     */
-    public RestLoginAuthenticationFilter() {
-        super(new AntPathRequestMatcher("/api/user/login", "POST"));
-    }
-
-    @Override
-    public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
-        UsernamePasswordAuthenticationToken authRequest;
-        try (InputStream is = request.getInputStream()) {
-            AuthenticationBean authenticationBean = JsonUtil.toJsonObject(is, AuthenticationBean.class);
-            request.setAttribute(TokenBasedRememberMeServices.DEFAULT_PARAMETER, authenticationBean.isRemember());
-            authRequest = new UsernamePasswordAuthenticationToken(authenticationBean.getUserName(), authenticationBean.getPassword());
-        } catch (IOException e) {
-            logger.error(e.getMessage(), e);
-            authRequest = new UsernamePasswordAuthenticationToken("", "");
-        }
-        setDetails(request, authRequest);
-        return this.getAuthenticationManager().authenticate(authRequest);
-
-    }
-
-    /**
-     * Sets user details service.
-     *
-     * @param userDetailsService the user details service
-     */
-    void setUserDetailsService(UserDetailsService userDetailsService) {
-        RestTokenBasedRememberMeServices tokenBasedRememberMeServices = new RestTokenBasedRememberMeServices(CookieConfig.getName(), userDetailsService);
-        tokenBasedRememberMeServices.setTokenValiditySeconds(CookieConfig.getInterval());
-        setRememberMeServices(tokenBasedRememberMeServices);
-    }
-
-    private void setDetails(HttpServletRequest request, UsernamePasswordAuthenticationToken authRequest) {
-        authRequest.setDetails(authenticationDetailsSource.buildDetails(request));
-    }
-}

+ 0 - 54
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestLogoutSuccessHandler.java

@@ -1,54 +0,0 @@
-package vip.xiaonuo.exam.configuration.spring.security;
-
-import vip.xiaonuo.exam.base.SystemCode;
-import vip.xiaonuo.exam.domain.User;
-import vip.xiaonuo.exam.domain.UserEventLog;
-import vip.xiaonuo.exam.event.UserEvent;
-import vip.xiaonuo.exam.service.UserService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler;
-import org.springframework.stereotype.Component;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Date;
-
-
-/**
- * @version 3.5.0
- * @description: 用户登出
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-@Component
-public class RestLogoutSuccessHandler extends SimpleUrlLogoutSuccessHandler {
-
-    private final ApplicationEventPublisher eventPublisher;
-    private final UserService userService;
-
-    /**
-     * Instantiates a new Rest logout success handler.
-     *
-     * @param eventPublisher the event publisher
-     * @param userService    the user service
-     */
-    @Autowired
-    public RestLogoutSuccessHandler(ApplicationEventPublisher eventPublisher, UserService userService) {
-        this.eventPublisher = eventPublisher;
-        this.userService = userService;
-    }
-
-    @Override
-    public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
-        org.springframework.security.core.userdetails.User springUser = (org.springframework.security.core.userdetails.User) authentication.getPrincipal();
-        if (null != springUser) {
-            User user = userService.getUserByUserName(springUser.getUsername());
-            UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date());
-            userEventLog.setContent(user.getUserName() + " 登出了学之思开源考试系统");
-            eventPublisher.publishEvent(new UserEvent(userEventLog));
-        }
-        RestUtil.response(response, SystemCode.OK);
-    }
-}

+ 0 - 31
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestTokenBasedRememberMeServices.java

@@ -1,31 +0,0 @@
-package vip.xiaonuo.exam.configuration.spring.security;
-
-import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices;
-
-import javax.servlet.http.HttpServletRequest;
-
-
-/**
- * @version 3.5.0
- * @description: 记住我,Cookie
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-public class RestTokenBasedRememberMeServices extends TokenBasedRememberMeServices {
-    /**
-     * Instantiates a new Rest token based remember me services.
-     *
-     * @param key                the key
-     * @param userDetailsService the user details service
-     */
-    public RestTokenBasedRememberMeServices(String key, UserDetailsService userDetailsService) {
-        super(key, userDetailsService);
-    }
-
-    @Override
-    protected boolean rememberMeRequested(HttpServletRequest request, String parameter) {
-        return (boolean) request.getAttribute(DEFAULT_PARAMETER);
-    }
-
-}

+ 0 - 63
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/RestUtil.java

@@ -1,63 +0,0 @@
-package vip.xiaonuo.exam.configuration.spring.security;
-
-import vip.xiaonuo.exam.base.RestResponse;
-import vip.xiaonuo.exam.base.SystemCode;
-import vip.xiaonuo.exam.utility.JsonUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-
-/**
- * @version 3.5.0
- * @description: The type Rest util.
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-public class RestUtil {
-    private static final Logger logger = LoggerFactory.getLogger(RestUtil.class);
-
-
-    /**
-     * Response.
-     *
-     * @param response   the response
-     * @param systemCode the system code
-     */
-    public static void response(HttpServletResponse response, SystemCode systemCode) {
-        response(response, systemCode.getCode(), systemCode.getMessage());
-    }
-
-    /**
-     * Response.
-     *
-     * @param response   the response
-     * @param systemCode the system code
-     * @param msg        the msg
-     */
-    public static void response(HttpServletResponse response, int systemCode, String msg) {
-        response(response, systemCode, msg, null);
-    }
-
-
-    /**
-     * Response.
-     *
-     * @param response   the response
-     * @param systemCode the system code
-     * @param msg        the msg
-     * @param content    the content
-     */
-    public static void response(HttpServletResponse response, int systemCode, String msg, Object content) {
-        try {
-            RestResponse res = new RestResponse<>(systemCode, msg, content);
-            String resStr = JsonUtil.toJsonStr(res);
-            response.setContentType("application/json;charset=utf-8");
-            response.getWriter().write(resStr);
-        } catch (IOException e) {
-            logger.error(e.getMessage(), e);
-        }
-    }
-}

+ 0 - 136
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/security/SecurityConfigurer.java

@@ -1,136 +0,0 @@
-package vip.xiaonuo.exam.configuration.spring.security;
-
-import vip.xiaonuo.exam.configuration.property.CookieConfig;
-import vip.xiaonuo.exam.configuration.property.SystemConfig;
-import vip.xiaonuo.exam.domain.enums.RoleEnum;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
-import org.springframework.web.cors.CorsConfiguration;
-import org.springframework.web.cors.CorsConfigurationSource;
-import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
-
-import java.util.Collections;
-import java.util.List;
-
-
-/**
- * @version 3.5.0
- * @description: The type Security configurer.
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-@Configuration
-@EnableWebSecurity
-public class SecurityConfigurer {
-
-    /**
-     * The type Form login web security configurer adapter.
-     */
-    @Configuration
-    public static class FormLoginWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
-
-        private final SystemConfig systemConfig;
-        private final LoginAuthenticationEntryPoint restAuthenticationEntryPoint;
-        private final RestAuthenticationProvider restAuthenticationProvider;
-        private final RestDetailsServiceImpl formDetailsService;
-        private final RestAuthenticationSuccessHandler restAuthenticationSuccessHandler;
-        private final RestAuthenticationFailureHandler restAuthenticationFailureHandler;
-        private final RestLogoutSuccessHandler restLogoutSuccessHandler;
-        private final RestAccessDeniedHandler restAccessDeniedHandler;
-
-        /**
-         * Instantiates a new Form login web security configurer adapter.
-         *
-         * @param systemConfig                     the system config
-         * @param restAuthenticationEntryPoint     the rest authentication entry point
-         * @param restAuthenticationProvider       the rest authentication provider
-         * @param formDetailsService               the form details service
-         * @param restAuthenticationSuccessHandler the rest authentication success handler
-         * @param restAuthenticationFailureHandler the rest authentication failure handler
-         * @param restLogoutSuccessHandler         the rest logout success handler
-         * @param restAccessDeniedHandler          the rest access denied handler
-         */
-        @Autowired
-        public FormLoginWebSecurityConfigurerAdapter(SystemConfig systemConfig, LoginAuthenticationEntryPoint restAuthenticationEntryPoint, RestAuthenticationProvider restAuthenticationProvider, RestDetailsServiceImpl formDetailsService, RestAuthenticationSuccessHandler restAuthenticationSuccessHandler, RestAuthenticationFailureHandler restAuthenticationFailureHandler, RestLogoutSuccessHandler restLogoutSuccessHandler, RestAccessDeniedHandler restAccessDeniedHandler) {
-            this.systemConfig = systemConfig;
-            this.restAuthenticationEntryPoint = restAuthenticationEntryPoint;
-            this.restAuthenticationProvider = restAuthenticationProvider;
-            this.formDetailsService = formDetailsService;
-            this.restAuthenticationSuccessHandler = restAuthenticationSuccessHandler;
-            this.restAuthenticationFailureHandler = restAuthenticationFailureHandler;
-            this.restLogoutSuccessHandler = restLogoutSuccessHandler;
-            this.restAccessDeniedHandler = restAccessDeniedHandler;
-        }
-
-        /**
-         * @param http http
-         * @throws Exception exception
-         *                   csrf is the from submit get method
-         */
-        @Override
-        protected void configure(HttpSecurity http) throws Exception {
-            http.headers().frameOptions().disable();
-
-            List<String> securityIgnoreUrls = systemConfig.getSecurityIgnoreUrls();
-            String[] ignores = new String[securityIgnoreUrls.size()];
-            http
-                    .addFilterAt(authenticationFilter(), UsernamePasswordAuthenticationFilter.class)
-                    .exceptionHandling().authenticationEntryPoint(restAuthenticationEntryPoint)
-                    .and().authenticationProvider(restAuthenticationProvider)
-                    .authorizeRequests()
-                    .antMatchers(securityIgnoreUrls.toArray(ignores)).permitAll()
-                    .antMatchers("/api/admin/**").hasRole(RoleEnum.ADMIN.getName())
-                    .antMatchers("/api/student/**").hasRole(RoleEnum.STUDENT.getName())
-                    .anyRequest().permitAll()
-                    .and().exceptionHandling().accessDeniedHandler(restAccessDeniedHandler)
-                    .and().formLogin().successHandler(restAuthenticationSuccessHandler).failureHandler(restAuthenticationFailureHandler)
-                    .and().logout().logoutUrl("/api/user/logout").logoutSuccessHandler(restLogoutSuccessHandler).invalidateHttpSession(true)
-                    .and().rememberMe().key(CookieConfig.getName()).tokenValiditySeconds(CookieConfig.getInterval()).userDetailsService(formDetailsService)
-                    .and().csrf().disable()
-                    .cors();
-        }
-
-
-        /**
-         * Cors configuration source cors configuration source.
-         *
-         * @return the cors configuration source
-         */
-        @Bean
-        public CorsConfigurationSource corsConfigurationSource() {
-            final CorsConfiguration configuration = new CorsConfiguration();
-            configuration.setMaxAge(3600L);
-            configuration.setAllowedOrigins(Collections.singletonList("*"));
-            configuration.setAllowedMethods(Collections.singletonList("*"));
-            configuration.setAllowCredentials(true);
-            configuration.setAllowedHeaders(Collections.singletonList("*"));
-            final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
-            source.registerCorsConfiguration("/api/**", configuration);
-            return source;
-        }
-
-
-        /**
-         * Authentication filter rest login authentication filter.
-         *
-         * @return the rest login authentication filter
-         * @throws Exception the exception
-         */
-        @Bean
-        public RestLoginAuthenticationFilter authenticationFilter() throws Exception {
-            RestLoginAuthenticationFilter authenticationFilter = new RestLoginAuthenticationFilter();
-            authenticationFilter.setAuthenticationSuccessHandler(restAuthenticationSuccessHandler);
-            authenticationFilter.setAuthenticationFailureHandler(restAuthenticationFailureHandler);
-            authenticationFilter.setAuthenticationManager(authenticationManagerBean());
-            authenticationFilter.setUserDetailsService(formDetailsService);
-            return authenticationFilter;
-        }
-
-
-    }
-}

+ 0 - 68
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/configuration/spring/wx/TokenHandlerInterceptor.java

@@ -1,68 +0,0 @@
-package vip.xiaonuo.exam.configuration.spring.wx;
-
-import vip.xiaonuo.exam.base.SystemCode;
-import vip.xiaonuo.exam.configuration.spring.security.RestUtil;
-import vip.xiaonuo.exam.context.WxContext;
-import vip.xiaonuo.exam.domain.User;
-import vip.xiaonuo.exam.domain.UserToken;
-import vip.xiaonuo.exam.service.UserService;
-import vip.xiaonuo.exam.service.UserTokenService;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.web.servlet.HandlerInterceptor;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Date;
-
-@Component
-public class TokenHandlerInterceptor implements HandlerInterceptor {
-
-    private final UserTokenService userTokenService;
-    private final UserService userService;
-    private final WxContext wxContext;
-
-    @Autowired
-    public TokenHandlerInterceptor(UserTokenService userTokenService, UserService userService, WxContext wxContext) {
-        this.userTokenService = userTokenService;
-        this.userService = userService;
-        this.wxContext = wxContext;
-    }
-
-    @Override
-    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
-        String token = request.getHeader("token");
-        if (StringUtils.isEmpty(token)) {
-            RestUtil.response(response, SystemCode.UNAUTHORIZED);
-            return false;
-        }
-
-        if (StringUtils.isBlank(token)) {
-            RestUtil.response(response, SystemCode.UNAUTHORIZED);
-            return false;
-        }
-
-        if (token.length() != 36) {
-            RestUtil.response(response, SystemCode.UNAUTHORIZED);
-            return false;
-        }
-
-        UserToken userToken = userTokenService.getToken(token);
-        if (null == userToken) {
-            RestUtil.response(response, SystemCode.UNAUTHORIZED);
-            return false;
-        }
-
-        Date now = new Date();
-        User user = userService.getUserByUserName(userToken.getUserName());
-        if (now.before(userToken.getEndTime())) {
-            wxContext.setContext(user,userToken);
-            return true;
-        } else {   //refresh token
-            UserToken refreshToken = userTokenService.insertUserToken(user);
-            RestUtil.response(response, SystemCode.AccessTokenError.getCode(), SystemCode.AccessTokenError.getMessage(), refreshToken.getToken());
-            return false;
-        }
-    }
-}

+ 18 - 28
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/context/WebContext.java

@@ -1,12 +1,10 @@
 package vip.xiaonuo.exam.context;
 
-import vip.xiaonuo.exam.domain.User;
-import vip.xiaonuo.exam.service.UserService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.context.SecurityContextHolder;
+
 import org.springframework.stereotype.Component;
 import org.springframework.web.context.request.RequestAttributes;
 import org.springframework.web.context.request.RequestContextHolder;
+import vip.xiaonuo.exam.domain.User;
 
 /**
  * @version 3.3.0
@@ -17,17 +15,8 @@ import org.springframework.web.context.request.RequestContextHolder;
 @Component
 public class WebContext {
     private static final String USER_ATTRIBUTES = "USER_ATTRIBUTES";
-    private final UserService userService;
 
-    /**
-     * Instantiates a new Web context.
-     *
-     * @param userService the user service
-     */
-    @Autowired
-    public WebContext(UserService userService) {
-        this.userService = userService;
-    }
+
 
 
     /**
@@ -45,19 +34,20 @@ public class WebContext {
      * @return the current user
      */
     public User getCurrentUser() {
-        User user = (User) RequestContextHolder.currentRequestAttributes().getAttribute(USER_ATTRIBUTES, RequestAttributes.SCOPE_REQUEST);
-        if (null != user) {
-            return user;
-        } else {
-            org.springframework.security.core.userdetails.User springUser = (org.springframework.security.core.userdetails.User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
-            if (null == springUser) {
-                return null;
-            }
-            user = userService.getUserByUserName(springUser.getUsername());
-            if (null != user) {
-                setCurrentUser(user);
-            }
-            return user;
-        }
+//        User user = (User) RequestContextHolder.currentRequestAttributes().getAttribute(USER_ATTRIBUTES, RequestAttributes.SCOPE_REQUEST);
+//        if (null != user) {
+//            return user;
+//        } else {
+//            org.springframework.security.core.userdetails.User springUser = (org.springframework.security.core.userdetails.User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
+//            if (null == springUser) {
+//                return null;
+//            }
+//         //   user = userService.getUserByUserName(springUser.getUsername());
+//            if (null != user) {
+//                setCurrentUser(user);
+//            }
+//            return user;
+//        }
+        return null;
     }
 }

+ 0 - 50
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/context/WxContext.java

@@ -1,50 +0,0 @@
-package vip.xiaonuo.exam.context;
-
-import vip.xiaonuo.exam.domain.User;
-import vip.xiaonuo.exam.domain.UserToken;
-import org.springframework.stereotype.Component;
-import org.springframework.web.context.request.RequestAttributes;
-import org.springframework.web.context.request.RequestContextHolder;
-
-/**
- * @version 3.3.0
- * @description: The enum System code.
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/5/25 10:45
- */
-@Component
-public class WxContext {
-
-    private static final String USER_ATTRIBUTES = "USER_ATTRIBUTES";
-    private static final String USER_TOKEN_ATTRIBUTES = "USER_TOKEN_ATTRIBUTES";
-
-
-    /**
-     * Sets context.
-     *
-     * @param user      the user
-     * @param userToken the user token
-     */
-    public void setContext(User user, UserToken userToken) {
-        RequestContextHolder.currentRequestAttributes().setAttribute(USER_ATTRIBUTES, user, RequestAttributes.SCOPE_REQUEST);
-        RequestContextHolder.currentRequestAttributes().setAttribute(USER_TOKEN_ATTRIBUTES, userToken, RequestAttributes.SCOPE_REQUEST);
-    }
-
-    /**
-     * Gets current user.
-     *
-     * @return the current user
-     */
-    public User getCurrentUser() {
-        return (User) RequestContextHolder.currentRequestAttributes().getAttribute(USER_ATTRIBUTES, RequestAttributes.SCOPE_REQUEST);
-    }
-
-    /**
-     * Gets current user token.
-     *
-     * @return the current user token
-     */
-    public UserToken getCurrentUserToken() {
-        return (UserToken) RequestContextHolder.currentRequestAttributes().getAttribute(USER_TOKEN_ATTRIBUTES, RequestAttributes.SCOPE_REQUEST);
-    }
-}

+ 0 - 40
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/ErrorController.java

@@ -1,40 +0,0 @@
-package vip.xiaonuo.exam.controller;
-
-import vip.xiaonuo.exam.base.SystemCode;
-import org.springframework.boot.autoconfigure.web.ErrorProperties;
-import org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController;
-import org.springframework.boot.web.servlet.error.DefaultErrorAttributes;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.HashMap;
-import java.util.Map;
-
-@RestController
-public class ErrorController extends BasicErrorController {
-
-    private static final String PATH = "/error";
-
-    public ErrorController() {
-        super(new DefaultErrorAttributes(), new ErrorProperties());
-    }
-
-    @RequestMapping(produces = {MediaType.APPLICATION_JSON_VALUE})
-    @ResponseBody
-    public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
-        Map<String, Object> error = new HashMap<>(2);
-        error.put("code", SystemCode.InnerError.getCode());
-        error.put("message", SystemCode.InnerError.getMessage());
-        return new ResponseEntity<>(error, HttpStatus.OK);
-    }
-
-
-    public String getErrorPath() {
-        return PATH;
-    }
-}

+ 22 - 28
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/admin/DashboardController.java

@@ -2,15 +2,9 @@ package vip.xiaonuo.exam.controller.admin;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 import vip.xiaonuo.exam.base.BaseApiController;
-import vip.xiaonuo.exam.base.RestResponse;
 import vip.xiaonuo.exam.service.*;
-import vip.xiaonuo.exam.utility.DateTimeUtil;
-import vip.xiaonuo.exam.viewmodel.admin.dashboard.IndexVM;
-
-import java.util.List;
 
 @RestController("AdminDashboardController")
 @RequestMapping(value = "/api/admin/dashboard")
@@ -31,26 +25,26 @@ public class DashboardController extends BaseApiController {
         this.userEventLogService = userEventLogService;
     }
 
-    @RequestMapping(value = "/index", method = RequestMethod.POST)
-    public RestResponse<IndexVM> Index() {
-        IndexVM vm = new IndexVM();
-
-        Integer examPaperCount = examPaperService.selectAllCount();
-        Integer questionCount = questionService.selectAllCount();
-        Integer doExamPaperCount = examPaperAnswerService.selectAllCount();
-        Integer doQuestionCount = examPaperQuestionCustomerAnswerService.selectAllCount();
-
-        vm.setExamPaperCount(examPaperCount);
-        vm.setQuestionCount(questionCount);
-        vm.setDoExamPaperCount(doExamPaperCount);
-        vm.setDoQuestionCount(doQuestionCount);
-
-        List<Integer> mothDayUserActionValue = userEventLogService.selectMothCount();
-        List<Integer> mothDayDoExamQuestionValue = examPaperQuestionCustomerAnswerService.selectMothCount();
-        vm.setMothDayUserActionValue(mothDayUserActionValue);
-        vm.setMothDayDoExamQuestionValue(mothDayDoExamQuestionValue);
-
-        vm.setMothDayText(DateTimeUtil.MothDay());
-        return RestResponse.ok(vm);
-    }
+//    @RequestMapping(value = "/index", method = RequestMethod.POST)
+//    public RestResponse<IndexVM> Index() {
+//        IndexVM vm = new IndexVM();
+//
+//        Integer examPaperCount = examPaperService.selectAllCount();
+//        Integer questionCount = questionService.selectAllCount();
+//        Integer doExamPaperCount = examPaperAnswerService.selectAllCount();
+//        Integer doQuestionCount = examPaperQuestionCustomerAnswerService.selectAllCount();
+//
+//        vm.setExamPaperCount(examPaperCount);
+//        vm.setQuestionCount(questionCount);
+//        vm.setDoExamPaperCount(doExamPaperCount);
+//        vm.setDoQuestionCount(doQuestionCount);
+//
+//        List<Integer> mothDayUserActionValue = userEventLogService.selectMothCount();
+//        List<Integer> mothDayDoExamQuestionValue = examPaperQuestionCustomerAnswerService.selectMothCount();
+//        vm.setMothDayUserActionValue(mothDayUserActionValue);
+//        vm.setMothDayDoExamQuestionValue(mothDayDoExamQuestionValue);
+//
+//        vm.setMothDayText(DateTimeUtil.MothDay());
+//        return RestResponse.ok(vm);
+  //  }
 }

+ 12 - 12
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/admin/ExamPaperAnswerController.java

@@ -1,22 +1,22 @@
 package vip.xiaonuo.exam.controller.admin;
 
+import com.github.pagehelper.PageInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
 import vip.xiaonuo.exam.base.BaseApiController;
 import vip.xiaonuo.exam.base.RestResponse;
 import vip.xiaonuo.exam.domain.ExamPaperAnswer;
 import vip.xiaonuo.exam.domain.Subject;
-import vip.xiaonuo.exam.domain.User;
-
 import vip.xiaonuo.exam.service.ExamPaperAnswerService;
 import vip.xiaonuo.exam.service.SubjectService;
-import vip.xiaonuo.exam.service.UserService;
 import vip.xiaonuo.exam.utility.DateTimeUtil;
 import vip.xiaonuo.exam.utility.ExamUtil;
 import vip.xiaonuo.exam.utility.PageInfoHelper;
-import vip.xiaonuo.exam.viewmodel.student.exampaper.ExamPaperAnswerPageResponseVM;
 import vip.xiaonuo.exam.viewmodel.admin.paper.ExamPaperAnswerPageRequestVM;
-import com.github.pagehelper.PageInfo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import vip.xiaonuo.exam.viewmodel.student.exampaper.ExamPaperAnswerPageResponseVM;
 
 @RestController("AdminExamPaperAnswerController")
 @RequestMapping(value = "/api/admin/examPaperAnswer")
@@ -24,13 +24,13 @@ public class ExamPaperAnswerController extends BaseApiController {
 
     private final ExamPaperAnswerService examPaperAnswerService;
     private final SubjectService subjectService;
-    private final UserService userService;
+
 
     @Autowired
-    public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, SubjectService subjectService, UserService userService) {
+    public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, SubjectService subjectService) {
         this.examPaperAnswerService = examPaperAnswerService;
         this.subjectService = subjectService;
-        this.userService = userService;
+
     }
 
 
@@ -46,8 +46,8 @@ public class ExamPaperAnswerController extends BaseApiController {
             vm.setPaperScore(ExamUtil.scoreToVM(e.getPaperScore()));
             vm.setSubjectName(subject.getName());
             vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime()));
-            User user = userService.selectById(e.getCreateUser());
-            vm.setUserName(user.getUserName());
+         //   User user = userService.selectById(Integer.valueOf(e.getCreateUser()));
+          //  vm.setUserName(user.getUserName());
             return vm;
         });
         return RestResponse.ok(page);

+ 15 - 16
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/admin/MessageController.java

@@ -7,7 +7,6 @@ import vip.xiaonuo.exam.domain.Message;
 import vip.xiaonuo.exam.domain.MessageUser;
 import vip.xiaonuo.exam.domain.User;
 import vip.xiaonuo.exam.service.MessageService;
-import vip.xiaonuo.exam.service.UserService;
 import vip.xiaonuo.exam.utility.DateTimeUtil;
 import vip.xiaonuo.exam.utility.PageInfoHelper;
 import vip.xiaonuo.exam.viewmodel.admin.message.MessagePageRequestVM;
@@ -30,12 +29,12 @@ import java.util.stream.Collectors;
 public class MessageController extends BaseApiController {
 
     private final MessageService messageService;
-    private final UserService userService;
+
 
     @Autowired
-    public MessageController(MessageService messageService, UserService userService) {
+    public MessageController(MessageService messageService) {
         this.messageService = messageService;
-        this.userService = userService;
+
     }
 
     @RequestMapping(value = "/page", method = RequestMethod.POST)
@@ -58,27 +57,27 @@ public class MessageController extends BaseApiController {
     @RequestMapping(value = "/send", method = RequestMethod.POST)
     public RestResponse send(@RequestBody @Valid MessageSendVM model) {
         User user = getCurrentUser();
-        List<User> receiveUser = userService.selectByIds(model.getReceiveUserIds());
+  //      List<User> receiveUser = userService.selectByIds(model.getReceiveUserIds());
         Date now = new Date();
         Message message = new Message();
         message.setTitle(model.getTitle());
         message.setContent(model.getContent());
         message.setCreateTime(now);
         message.setReadCount(0);
-        message.setReceiveUserCount(receiveUser.size());
+      //  message.setReceiveUserCount(receiveUser.size());
         message.setSendUserId(user.getId());
         message.setSendUserName(user.getUserName());
         message.setSendRealName(user.getRealName());
-        List<MessageUser> messageUsers = receiveUser.stream().map(d -> {
-            MessageUser messageUser = new MessageUser();
-            messageUser.setCreateTime(now);
-            messageUser.setReaded(false);
-            messageUser.setReceiveRealName(d.getRealName());
-            messageUser.setReceiveUserId(d.getId());
-            messageUser.setReceiveUserName(d.getUserName());
-            return messageUser;
-        }).collect(Collectors.toList());
-        messageService.sendMessage(message, messageUsers);
+//        List<MessageUser> messageUsers = receiveUser.stream().map(d -> {
+//            MessageUser messageUser = new MessageUser();
+//            messageUser.setCreateTime(now);
+//            messageUser.setReaded(false);
+//            messageUser.setReceiveRealName(d.getRealName());
+//            messageUser.setReceiveUserId(d.getId());
+//            messageUser.setReceiveUserName(d.getUserName());
+//            return messageUser;
+//        }).collect(Collectors.toList());
+        messageService.sendMessage(message, null);
         return RestResponse.ok();
     }
 

+ 0 - 103
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/admin/UploadController.java

@@ -1,103 +0,0 @@
-package vip.xiaonuo.exam.controller.admin;
-
-
-import vip.xiaonuo.exam.base.BaseApiController;
-import vip.xiaonuo.exam.base.RestResponse;
-import vip.xiaonuo.exam.configuration.property.SystemConfig;
-import vip.xiaonuo.exam.service.FileUpload;
-import vip.xiaonuo.exam.service.UserService;
-import vip.xiaonuo.exam.viewmodel.admin.file.UeditorConfigVM;
-import vip.xiaonuo.exam.viewmodel.admin.file.UploadResultVM;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-
-
-@RequestMapping("/api/admin/upload")
-@RestController("AdminUploadController")
-public class UploadController extends BaseApiController {
-
-    private final FileUpload fileUpload;
-    private final SystemConfig systemConfig;
-    private static final Logger logger = LoggerFactory.getLogger(UploadController.class);
-    private static final String IMAGE_UPLOAD = "imgUpload";
-    private static final String IMAGE_UPLOAD_FILE = "upFile";
-    private final UserService userService;
-
-    @Autowired
-    public UploadController(FileUpload fileUpload, SystemConfig systemConfig, UserService userService) {
-        this.fileUpload = fileUpload;
-        this.systemConfig = systemConfig;
-        this.userService = userService;
-    }
-
-    @ResponseBody
-    @RequestMapping("/configAndUpload")
-    public Object upload(HttpServletRequest request, HttpServletResponse response) {
-        String action = request.getParameter("action");
-        if (action.equals(IMAGE_UPLOAD)) {
-            try {
-                MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest) request;
-                MultipartFile multipartFile = multipartHttpServletRequest.getFile(IMAGE_UPLOAD_FILE);
-                long attachSize = multipartFile.getSize();
-                String imgName = multipartFile.getOriginalFilename();
-                String filePath;
-                try (InputStream inputStream = multipartFile.getInputStream()) {
-                    filePath = fileUpload.uploadFile(inputStream, attachSize, imgName);
-                }
-                String imageType = imgName.substring(imgName.lastIndexOf("."));
-                UploadResultVM uploadResultVM = new UploadResultVM();
-                uploadResultVM.setOriginal(imgName);
-                uploadResultVM.setName(imgName);
-                uploadResultVM.setUrl(filePath);
-                uploadResultVM.setSize(multipartFile.getSize());
-                uploadResultVM.setType(imageType);
-                uploadResultVM.setState("SUCCESS");
-                return uploadResultVM;
-            } catch (IOException e) {
-                logger.error(e.getMessage(), e);
-            }
-        } else {
-            UeditorConfigVM ueditorConfigVM = new UeditorConfigVM();
-            ueditorConfigVM.setImageActionName(IMAGE_UPLOAD);
-            ueditorConfigVM.setImageFieldName(IMAGE_UPLOAD_FILE);
-            ueditorConfigVM.setImageMaxSize(2048000L);
-            ueditorConfigVM.setImageAllowFiles(Arrays.asList(".png", ".jpg", ".jpeg", ".gif", ".bmp"));
-            ueditorConfigVM.setImageCompressEnable(true);
-            ueditorConfigVM.setImageCompressBorder(1600);
-            ueditorConfigVM.setImageInsertAlign("none");
-            ueditorConfigVM.setImageUrlPrefix("");
-            ueditorConfigVM.setImagePathFormat("");
-            return ueditorConfigVM;
-        }
-        return null;
-    }
-
-
-    @RequestMapping("/image")
-    @ResponseBody
-    public RestResponse questionUploadAndReadExcel(HttpServletRequest request) {
-        MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest) request;
-        MultipartFile multipartFile = multipartHttpServletRequest.getFile("file");
-        long attachSize = multipartFile.getSize();
-        String imgName = multipartFile.getOriginalFilename();
-        try (InputStream inputStream = multipartFile.getInputStream()) {
-            String filePath = fileUpload.uploadFile(inputStream, attachSize, imgName);
-            userService.changePicture(getCurrentUser(), filePath);
-            return RestResponse.ok(filePath);
-        } catch (IOException e) {
-            return RestResponse.fail(2, e.getMessage());
-        }
-    }
-
-
-}

+ 0 - 152
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/admin/UserController.java

@@ -1,152 +0,0 @@
-package vip.xiaonuo.exam.controller.admin;
-
-import vip.xiaonuo.exam.base.BaseApiController;
-import vip.xiaonuo.exam.base.RestResponse;
-import vip.xiaonuo.exam.domain.other.KeyValue;
-import vip.xiaonuo.exam.domain.User;
-import vip.xiaonuo.exam.domain.UserEventLog;
-import vip.xiaonuo.exam.domain.enums.UserStatusEnum;
-import vip.xiaonuo.exam.service.AuthenticationService;
-import vip.xiaonuo.exam.service.UserEventLogService;
-import vip.xiaonuo.exam.service.UserService;
-import vip.xiaonuo.exam.utility.DateTimeUtil;
-
-import vip.xiaonuo.exam.utility.PageInfoHelper;
-import com.github.pagehelper.PageInfo;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import vip.xiaonuo.exam.viewmodel.admin.user.*;
-
-import javax.validation.Valid;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-
-
-@RestController("AdminUserController")
-@RequestMapping(value = "/api/admin/user")
-public class UserController extends BaseApiController {
-
-    private final UserService userService;
-    private final UserEventLogService userEventLogService;
-    private final AuthenticationService authenticationService;
-
-    @Autowired
-    public UserController(UserService userService, UserEventLogService userEventLogService, AuthenticationService authenticationService) {
-        this.userService = userService;
-        this.userEventLogService = userEventLogService;
-        this.authenticationService = authenticationService;
-    }
-
-
-    @RequestMapping(value = "/page/list", method = RequestMethod.POST)
-    public RestResponse<PageInfo<UserResponseVM>> pageList(@RequestBody UserPageRequestVM model) {
-        PageInfo<User> pageInfo = userService.userPage(model);
-        PageInfo<UserResponseVM> page = PageInfoHelper.copyMap(pageInfo, d -> UserResponseVM.from(d));
-        return RestResponse.ok(page);
-    }
-
-
-    @RequestMapping(value = "/event/page/list", method = RequestMethod.POST)
-    public RestResponse<PageInfo<UserEventLogVM>> eventPageList(@RequestBody UserEventPageRequestVM model) {
-        PageInfo<UserEventLog> pageInfo = userEventLogService.page(model);
-        PageInfo<UserEventLogVM> page = PageInfoHelper.copyMap(pageInfo, d -> {
-            UserEventLogVM vm = modelMapper.map(d, UserEventLogVM.class);
-            vm.setCreateTime(DateTimeUtil.dateFormat(d.getCreateTime()));
-            return vm;
-        });
-        return RestResponse.ok(page);
-    }
-
-    @RequestMapping(value = "/select/{id}", method = RequestMethod.POST)
-    public RestResponse<UserResponseVM> select(@PathVariable Integer id) {
-        User user = userService.getUserById(id);
-        UserResponseVM userVm = UserResponseVM.from(user);
-        return RestResponse.ok(userVm);
-    }
-
-    @RequestMapping(value = "/current", method = RequestMethod.POST)
-    public RestResponse<UserResponseVM> current() {
-        User user = getCurrentUser();
-        UserResponseVM userVm = UserResponseVM.from(user);
-        return RestResponse.ok(userVm);
-    }
-
-
-    @RequestMapping(value = "/edit", method = RequestMethod.POST)
-    public RestResponse<User> edit(@RequestBody @Valid UserCreateVM model) {
-        if (model.getId() == null) {  //create
-            User existUser = userService.getUserByUserName(model.getUserName());
-            if (null != existUser) {
-                return new RestResponse<>(2, "用户已存在");
-            }
-
-            if (StringUtils.isBlank(model.getPassword())) {
-                return new RestResponse<>(3, "密码不能为空");
-            }
-        }
-        if (StringUtils.isBlank(model.getBirthDay())) {
-            model.setBirthDay(null);
-        }
-        User user = modelMapper.map(model, User.class);
-
-        if (model.getId() == null) {
-            String encodePwd = authenticationService.pwdEncode(model.getPassword());
-            user.setPassword(encodePwd);
-            user.setUserUuid(UUID.randomUUID().toString());
-            user.setCreateTime(new Date());
-            user.setLastActiveTime(new Date());
-            user.setDeleted(false);
-            userService.insertByFilter(user);
-        } else {
-            if (!StringUtils.isBlank(model.getPassword())) {
-                String encodePwd = authenticationService.pwdEncode(model.getPassword());
-                user.setPassword(encodePwd);
-            }
-            user.setModifyTime(new Date());
-            userService.updateByIdFilter(user);
-        }
-        return RestResponse.ok(user);
-    }
-
-
-    @RequestMapping(value = "/update", method = RequestMethod.POST)
-    public RestResponse update(@RequestBody @Valid UserUpdateVM model) {
-        User user = userService.selectById(getCurrentUser().getId());
-        modelMapper.map(model, user);
-        user.setModifyTime(new Date());
-        userService.updateByIdFilter(user);
-        return RestResponse.ok();
-    }
-
-
-    @RequestMapping(value = "/changeStatus/{id}", method = RequestMethod.POST)
-    public RestResponse<Integer> changeStatus(@PathVariable Integer id) {
-        User user = userService.getUserById(id);
-        UserStatusEnum userStatusEnum = UserStatusEnum.fromCode(user.getStatus());
-        Integer newStatus = userStatusEnum == UserStatusEnum.Enable ? UserStatusEnum.Disable.getCode() : UserStatusEnum.Enable.getCode();
-        user.setStatus(newStatus);
-        user.setModifyTime(new Date());
-        userService.updateByIdFilter(user);
-        return RestResponse.ok(newStatus);
-    }
-
-
-    @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
-    public RestResponse delete(@PathVariable Integer id) {
-        User user = userService.getUserById(id);
-        user.setDeleted(true);
-        userService.updateByIdFilter(user);
-        return RestResponse.ok();
-    }
-
-
-    @RequestMapping(value = "/selectByUserName", method = RequestMethod.POST)
-    public RestResponse<List<KeyValue>> selectByUserName(@RequestBody String userName) {
-        List<KeyValue> keyValues = userService.selectByUserName(userName);
-        return RestResponse.ok(keyValues);
-    }
-
-}

+ 33 - 38
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/student/DashboardController.java

@@ -1,27 +1,23 @@
 package vip.xiaonuo.exam.controller.student;
 
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
 import vip.xiaonuo.exam.base.BaseApiController;
 import vip.xiaonuo.exam.base.RestResponse;
 import vip.xiaonuo.exam.domain.TaskExam;
 import vip.xiaonuo.exam.domain.TaskExamCustomerAnswer;
 import vip.xiaonuo.exam.domain.TextContent;
 import vip.xiaonuo.exam.domain.User;
-import vip.xiaonuo.exam.domain.enums.ExamPaperTypeEnum;
 import vip.xiaonuo.exam.domain.task.TaskItemAnswerObject;
 import vip.xiaonuo.exam.domain.task.TaskItemObject;
-
 import vip.xiaonuo.exam.service.*;
-import vip.xiaonuo.exam.utility.DateTimeUtil;
 import vip.xiaonuo.exam.utility.JsonUtil;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-import vip.xiaonuo.exam.viewmodel.student.dashboard.*;
+import vip.xiaonuo.exam.viewmodel.student.dashboard.TaskItemPaperVm;
+import vip.xiaonuo.exam.viewmodel.student.dashboard.TaskItemVm;
 
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -29,7 +25,7 @@ import java.util.stream.Collectors;
 @RequestMapping(value = "/api/student/dashboard")
 public class DashboardController extends BaseApiController {
 
-    private final UserService userService;
+
     private final ExamPaperService examPaperService;
     private final QuestionService questionService;
     private final TaskExamService taskExamService;
@@ -37,8 +33,7 @@ public class DashboardController extends BaseApiController {
     private final TextContentService textContentService;
 
     @Autowired
-    public DashboardController(UserService userService, ExamPaperService examPaperService, QuestionService questionService, TaskExamService taskExamService, TaskExamCustomerAnswerService taskExamCustomerAnswerService, TextContentService textContentService) {
-        this.userService = userService;
+    public DashboardController( ExamPaperService examPaperService, QuestionService questionService, TaskExamService taskExamService, TaskExamCustomerAnswerService taskExamCustomerAnswerService, TextContentService textContentService) {
         this.examPaperService = examPaperService;
         this.questionService = questionService;
         this.taskExamService = taskExamService;
@@ -46,31 +41,31 @@ public class DashboardController extends BaseApiController {
         this.textContentService = textContentService;
     }
 
-    @RequestMapping(value = "/index", method = RequestMethod.POST)
-    public RestResponse<IndexVM> index() {
-        IndexVM indexVM = new IndexVM();
-        User user = getCurrentUser();
-
-        PaperFilter fixedPaperFilter = new PaperFilter();
-        fixedPaperFilter.setGradeLevel(user.getUserLevel());
-        fixedPaperFilter.setExamPaperType(ExamPaperTypeEnum.Fixed.getCode());
-        indexVM.setFixedPaper(examPaperService.indexPaper(fixedPaperFilter));
-
-        PaperFilter timeLimitPaperFilter = new PaperFilter();
-        timeLimitPaperFilter.setDateTime(new Date());
-        timeLimitPaperFilter.setGradeLevel(user.getUserLevel());
-        timeLimitPaperFilter.setExamPaperType(ExamPaperTypeEnum.TimeLimit.getCode());
-
-        List<PaperInfo> limitPaper = examPaperService.indexPaper(timeLimitPaperFilter);
-        List<PaperInfoVM> paperInfoVMS = limitPaper.stream().map(d -> {
-            PaperInfoVM vm = modelMapper.map(d, PaperInfoVM.class);
-            vm.setStartTime(DateTimeUtil.dateFormat(d.getLimitStartTime()));
-            vm.setEndTime(DateTimeUtil.dateFormat(d.getLimitEndTime()));
-            return vm;
-        }).collect(Collectors.toList());
-        indexVM.setTimeLimitPaper(paperInfoVMS);
-        return RestResponse.ok(indexVM);
-    }
+//    @RequestMapping(value = "/index", method = RequestMethod.POST)
+//    public RestResponse<IndexVM> index() {
+//        IndexVM indexVM = new IndexVM();
+//        User user = getCurrentUser();
+//
+//        PaperFilter fixedPaperFilter = new PaperFilter();
+//        fixedPaperFilter.setGradeLevel(user.getUserLevel());
+//        fixedPaperFilter.setExamPaperType(ExamPaperTypeEnum.Fixed.getCode());
+//        indexVM.setFixedPaper(examPaperService.indexPaper(fixedPaperFilter));
+//
+//        PaperFilter timeLimitPaperFilter = new PaperFilter();
+//        timeLimitPaperFilter.setDateTime(new Date());
+//        timeLimitPaperFilter.setGradeLevel(user.getUserLevel());
+//        timeLimitPaperFilter.setExamPaperType(ExamPaperTypeEnum.TimeLimit.getCode());
+//
+//        List<PaperInfo> limitPaper = examPaperService.indexPaper(timeLimitPaperFilter);
+//        List<PaperInfoVM> paperInfoVMS = limitPaper.stream().map(d -> {
+//            PaperInfoVM vm = modelMapper.map(d, PaperInfoVM.class);
+//            vm.setStartTime(DateTimeUtil.dateFormat(d.getLimitStartTime()));
+//            vm.setEndTime(DateTimeUtil.dateFormat(d.getLimitEndTime()));
+//            return vm;
+//        }).collect(Collectors.toList());
+//        indexVM.setTimeLimitPaper(paperInfoVMS);
+//        return RestResponse.ok(indexVM);
+//    }
 
 
     @RequestMapping(value = "/task", method = RequestMethod.POST)

+ 0 - 51
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/student/UploadController.java

@@ -1,51 +0,0 @@
-package vip.xiaonuo.exam.controller.student;
-
-
-import vip.xiaonuo.exam.base.BaseApiController;
-import vip.xiaonuo.exam.base.RestResponse;
-import vip.xiaonuo.exam.service.FileUpload;
-import vip.xiaonuo.exam.service.UserService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-
-import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
-import java.io.InputStream;
-
-
-@RequestMapping("/api/student/upload")
-@RestController("StudentUploadController")
-public class UploadController extends BaseApiController {
-
-    private final FileUpload fileUpload;
-    private final UserService userService;
-
-    @Autowired
-    public UploadController(FileUpload fileUpload, UserService userService) {
-        this.fileUpload = fileUpload;
-        this.userService = userService;
-    }
-
-
-    @RequestMapping("/image")
-    @ResponseBody
-    public RestResponse questionUploadAndReadExcel(HttpServletRequest request) {
-        MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest) request;
-        MultipartFile multipartFile = multipartHttpServletRequest.getFile("file");
-        long attachSize = multipartFile.getSize();
-        String imgName = multipartFile.getOriginalFilename();
-        try (InputStream inputStream = multipartFile.getInputStream()) {
-            String filePath = fileUpload.uploadFile(inputStream, attachSize, imgName);
-            userService.changePicture(getCurrentUser(), filePath);
-            return RestResponse.ok(filePath);
-        } catch (IOException e) {
-            return RestResponse.fail(2, e.getMessage());
-        }
-    }
-
-
-}

+ 0 - 140
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/student/UserController.java

@@ -1,140 +0,0 @@
-package vip.xiaonuo.exam.controller.student;
-
-import vip.xiaonuo.exam.base.BaseApiController;
-import vip.xiaonuo.exam.base.RestResponse;
-import vip.xiaonuo.exam.domain.Message;
-import vip.xiaonuo.exam.domain.MessageUser;
-import vip.xiaonuo.exam.domain.User;
-import vip.xiaonuo.exam.domain.UserEventLog;
-import vip.xiaonuo.exam.domain.enums.RoleEnum;
-import vip.xiaonuo.exam.domain.enums.UserStatusEnum;
-import vip.xiaonuo.exam.event.UserEvent;
-import vip.xiaonuo.exam.service.AuthenticationService;
-import vip.xiaonuo.exam.service.MessageService;
-import vip.xiaonuo.exam.service.UserEventLogService;
-import vip.xiaonuo.exam.service.UserService;
-import vip.xiaonuo.exam.utility.DateTimeUtil;
-import vip.xiaonuo.exam.utility.PageInfoHelper;
-
-import com.github.pagehelper.PageInfo;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.web.bind.annotation.*;
-import vip.xiaonuo.exam.viewmodel.student.user.*;
-
-import javax.validation.Valid;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-import java.util.stream.Collectors;
-
-@RestController("StudentUserController")
-@RequestMapping(value = "/api/student/user")
-public class UserController extends BaseApiController {
-
-    private final UserService userService;
-    private final UserEventLogService userEventLogService;
-    private final MessageService messageService;
-    private final AuthenticationService authenticationService;
-    private final ApplicationEventPublisher eventPublisher;
-
-    @Autowired
-    public UserController(UserService userService, UserEventLogService userEventLogService, MessageService messageService, AuthenticationService authenticationService, ApplicationEventPublisher eventPublisher) {
-        this.userService = userService;
-        this.userEventLogService = userEventLogService;
-        this.messageService = messageService;
-        this.authenticationService = authenticationService;
-        this.eventPublisher = eventPublisher;
-    }
-
-    @RequestMapping(value = "/current", method = RequestMethod.POST)
-    public RestResponse<UserResponseVM> current() {
-        User user = getCurrentUser();
-        UserResponseVM userVm = UserResponseVM.from(user);
-        return RestResponse.ok(userVm);
-    }
-
-
-    @RequestMapping(value = "/register", method = RequestMethod.POST)
-    public RestResponse register(@RequestBody @Valid UserRegisterVM model) {
-        User existUser = userService.getUserByUserName(model.getUserName());
-        if (null != existUser) {
-            return new RestResponse<>(2, "用户已存在");
-        }
-        User user = modelMapper.map(model, User.class);
-        String encodePwd = authenticationService.pwdEncode(model.getPassword());
-        user.setUserUuid(UUID.randomUUID().toString());
-        user.setPassword(encodePwd);
-        user.setRole(RoleEnum.STUDENT.getCode());
-        user.setStatus(UserStatusEnum.Enable.getCode());
-        user.setLastActiveTime(new Date());
-        user.setCreateTime(new Date());
-        user.setDeleted(false);
-        userService.insertByFilter(user);
-        UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date());
-        userEventLog.setContent("欢迎 " + user.getUserName() + " 注册来到学之思开源考试系统");
-        eventPublisher.publishEvent(new UserEvent(userEventLog));
-        return RestResponse.ok();
-    }
-
-
-    @RequestMapping(value = "/update", method = RequestMethod.POST)
-    public RestResponse update(@RequestBody @Valid UserUpdateVM model) {
-        if (StringUtils.isBlank(model.getBirthDay())) {
-            model.setBirthDay(null);
-        }
-        User user = userService.selectById(getCurrentUser().getId());
-        modelMapper.map(model, user);
-        user.setModifyTime(new Date());
-        userService.updateByIdFilter(user);
-        UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date());
-        userEventLog.setContent(user.getUserName() + " 更新了个人资料");
-        eventPublisher.publishEvent(new UserEvent(userEventLog));
-        return RestResponse.ok();
-    }
-
-    @RequestMapping(value = "/log", method = RequestMethod.POST)
-    public RestResponse<List<UserEventLogVM>> log() {
-        User user = getCurrentUser();
-        List<UserEventLog> userEventLogs = userEventLogService.getUserEventLogByUserId(user.getId());
-        List<UserEventLogVM> userEventLogVMS = userEventLogs.stream().map(d -> {
-            UserEventLogVM vm = modelMapper.map(d, UserEventLogVM.class);
-            vm.setCreateTime(DateTimeUtil.dateFormat(d.getCreateTime()));
-            return vm;
-        }).collect(Collectors.toList());
-        return RestResponse.ok(userEventLogVMS);
-    }
-
-    @RequestMapping(value = "/message/page", method = RequestMethod.POST)
-    public RestResponse<PageInfo<MessageResponseVM>> messagePageList(@RequestBody MessageRequestVM messageRequestVM) {
-        messageRequestVM.setReceiveUserId(getCurrentUser().getId());
-        PageInfo<MessageUser> messageUserPageInfo = messageService.studentPage(messageRequestVM);
-        List<Integer> ids = messageUserPageInfo.getList().stream().map(d -> d.getMessageId()).collect(Collectors.toList());
-        List<Message> messages = ids.size() != 0 ? messageService.selectMessageByIds(ids) : null;
-        PageInfo<MessageResponseVM> page = PageInfoHelper.copyMap(messageUserPageInfo, e -> {
-            MessageResponseVM vm = modelMapper.map(e, MessageResponseVM.class);
-            messages.stream().filter(d -> e.getMessageId().equals(d.getId())).findFirst().ifPresent(message -> {
-                vm.setTitle(message.getTitle());
-                vm.setContent(message.getContent());
-                vm.setSendUserName(message.getSendUserName());
-            });
-            vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime()));
-            return vm;
-        });
-        return RestResponse.ok(page);
-    }
-
-    @RequestMapping(value = "/message/unreadCount", method = RequestMethod.POST)
-    public RestResponse unReadCount() {
-        Integer count = messageService.unReadCount(getCurrentUser().getId());
-        return RestResponse.ok(count);
-    }
-
-    @RequestMapping(value = "/message/read/{id}", method = RequestMethod.POST)
-    public RestResponse read(@PathVariable Integer id) {
-        messageService.read(id);
-        return RestResponse.ok();
-    }
-
-}

+ 0 - 22
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/wx/BaseWXApiController.java

@@ -1,22 +0,0 @@
-package vip.xiaonuo.exam.controller.wx;
-
-import vip.xiaonuo.exam.context.WxContext;
-import vip.xiaonuo.exam.domain.User;
-import vip.xiaonuo.exam.domain.UserToken;
-import vip.xiaonuo.exam.utility.ModelMapperSingle;
-import org.modelmapper.ModelMapper;
-import org.springframework.beans.factory.annotation.Autowired;
-
-public class BaseWXApiController {
-    protected final static ModelMapper modelMapper = ModelMapperSingle.Instance();
-    @Autowired
-    private WxContext wxContext;
-
-    protected User getCurrentUser() {
-        return wxContext.getCurrentUser();
-    }
-
-    protected UserToken getUserToken() {
-        return wxContext.getCurrentUserToken();
-    }
-}

+ 0 - 85
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/wx/student/AuthController.java

@@ -1,85 +0,0 @@
-package vip.xiaonuo.exam.controller.wx.student;
-
-import vip.xiaonuo.exam.base.RestResponse;
-import vip.xiaonuo.exam.configuration.property.SystemConfig;
-import vip.xiaonuo.exam.controller.wx.BaseWXApiController;
-import vip.xiaonuo.exam.domain.UserToken;
-import vip.xiaonuo.exam.domain.enums.UserStatusEnum;
-import vip.xiaonuo.exam.service.AuthenticationService;
-import vip.xiaonuo.exam.service.UserService;
-import vip.xiaonuo.exam.service.UserTokenService;
-import vip.xiaonuo.exam.utility.WxUtil;
-import vip.xiaonuo.exam.viewmodel.wx.student.user.BindInfo;
-import vip.xiaonuo.exam.domain.User;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
-import javax.validation.constraints.NotBlank;
-
-
-@Controller("WXStudentAuthController")
-@RequestMapping(value = "/api/wx/student/auth")
-@ResponseBody
-public class AuthController extends BaseWXApiController {
-
-    private final SystemConfig systemConfig;
-    private final AuthenticationService authenticationService;
-    private final UserService userService;
-    private final UserTokenService userTokenService;
-
-    @Autowired
-    public AuthController(SystemConfig systemConfig, AuthenticationService authenticationService, UserService userService, UserTokenService userTokenService) {
-        this.systemConfig = systemConfig;
-        this.authenticationService = authenticationService;
-        this.userService = userService;
-        this.userTokenService = userTokenService;
-    }
-
-    @RequestMapping(value = "/bind", method = RequestMethod.POST)
-    public RestResponse bind(@Valid BindInfo model) {
-        User user = userService.getUserByUserName(model.getUserName());
-        if (user == null) {
-            return RestResponse.fail(2, "用户名或密码错误");
-        }
-        boolean result = authenticationService.authUser(user, model.getUserName(), model.getPassword());
-        if (!result) {
-            return RestResponse.fail(2, "用户名或密码错误");
-        }
-        UserStatusEnum userStatusEnum = UserStatusEnum.fromCode(user.getStatus());
-        if (UserStatusEnum.Disable == userStatusEnum) {
-            return RestResponse.fail(3, "用户被禁用");
-        }
-        String code = model.getCode();
-        String openid = WxUtil.getOpenId(systemConfig.getWx().getAppid(), systemConfig.getWx().getSecret(), code);
-        if (null == openid) {
-            return RestResponse.fail(4, "获取微信OpenId失败");
-        }
-        user.setWxOpenId(openid);
-        UserToken userToken = userTokenService.bind(user);
-        return RestResponse.ok(userToken.getToken());
-    }
-
-
-    @RequestMapping(value = "/checkBind", method = RequestMethod.POST)
-    public RestResponse checkBind(@Valid @NotBlank String code) {
-        String openid = WxUtil.getOpenId(systemConfig.getWx().getAppid(), systemConfig.getWx().getSecret(), code);
-        if (null == openid) {
-            return RestResponse.fail(3, "获取微信OpenId失败");
-        }
-        UserToken userToken = userTokenService.checkBind(openid);
-        if (null != userToken) {
-            return RestResponse.ok(userToken.getToken());
-        }
-        return RestResponse.fail(2, "用户未绑定");
-    }
-
-
-    @RequestMapping(value = "/unBind", method = RequestMethod.POST)
-    public RestResponse unBind() {
-        UserToken userToken = getUserToken();
-        userTokenService.unBind(userToken);
-        return RestResponse.ok();
-    }
-}

+ 0 - 129
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/wx/student/DashboardController.java

@@ -1,129 +0,0 @@
-package vip.xiaonuo.exam.controller.wx.student;
-
-import vip.xiaonuo.exam.base.RestResponse;
-import vip.xiaonuo.exam.controller.wx.BaseWXApiController;
-import vip.xiaonuo.exam.domain.TaskExam;
-import vip.xiaonuo.exam.domain.TaskExamCustomerAnswer;
-import vip.xiaonuo.exam.domain.TextContent;
-import vip.xiaonuo.exam.domain.User;
-import vip.xiaonuo.exam.domain.enums.ExamPaperTypeEnum;
-import vip.xiaonuo.exam.domain.task.TaskItemAnswerObject;
-import vip.xiaonuo.exam.domain.task.TaskItemObject;
-import vip.xiaonuo.exam.service.ExamPaperService;
-import vip.xiaonuo.exam.service.TaskExamCustomerAnswerService;
-import vip.xiaonuo.exam.service.TaskExamService;
-import vip.xiaonuo.exam.service.TextContentService;
-import vip.xiaonuo.exam.utility.DateTimeUtil;
-import vip.xiaonuo.exam.utility.JsonUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseBody;
-import vip.xiaonuo.exam.viewmodel.student.dashboard.*;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.stream.Collectors;
-
-
-@Controller("WXStudentDashboardController")
-@RequestMapping(value = "/api/wx/student/dashboard")
-@ResponseBody
-public class DashboardController extends BaseWXApiController {
-
-    private final ExamPaperService examPaperService;
-    private final TextContentService textContentService;
-    private final TaskExamService taskExamService;
-    private final TaskExamCustomerAnswerService taskExamCustomerAnswerService;
-
-    @Autowired
-    public DashboardController(ExamPaperService examPaperService, TextContentService textContentService, TaskExamService taskExamService, TaskExamCustomerAnswerService taskExamCustomerAnswerService) {
-        this.examPaperService = examPaperService;
-        this.textContentService = textContentService;
-        this.taskExamService = taskExamService;
-        this.taskExamCustomerAnswerService = taskExamCustomerAnswerService;
-    }
-
-    @RequestMapping(value = "/index", method = RequestMethod.POST)
-    public RestResponse<IndexVM> index() {
-        IndexVM indexVM = new IndexVM();
-        User user = getCurrentUser();
-
-        PaperFilter fixedPaperFilter = new PaperFilter();
-        fixedPaperFilter.setGradeLevel(user.getUserLevel());
-        fixedPaperFilter.setExamPaperType(ExamPaperTypeEnum.Fixed.getCode());
-        indexVM.setFixedPaper(examPaperService.indexPaper(fixedPaperFilter));
-
-        PaperFilter timeLimitPaperFilter = new PaperFilter();
-        timeLimitPaperFilter.setDateTime(new Date());
-        timeLimitPaperFilter.setGradeLevel(user.getUserLevel());
-        timeLimitPaperFilter.setExamPaperType(ExamPaperTypeEnum.TimeLimit.getCode());
-
-        List<PaperInfo> limitPaper = examPaperService.indexPaper(timeLimitPaperFilter);
-        List<PaperInfoVM> paperInfoVMS = limitPaper.stream().map(d -> {
-            PaperInfoVM vm = modelMapper.map(d, PaperInfoVM.class);
-            vm.setStartTime(DateTimeUtil.dateFormat(d.getLimitStartTime()));
-            vm.setEndTime(DateTimeUtil.dateFormat(d.getLimitEndTime()));
-            return vm;
-        }).collect(Collectors.toList());
-        indexVM.setTimeLimitPaper(paperInfoVMS);
-        return RestResponse.ok(indexVM);
-    }
-
-    @RequestMapping(value = "/task", method = RequestMethod.POST)
-    public RestResponse<List<TaskItemVm>> task() {
-        User user = getCurrentUser();
-        List<TaskExam> taskExams = taskExamService.getByGradeLevel(user.getUserLevel());
-        if (taskExams.size() == 0) {
-            return RestResponse.ok(new ArrayList<>());
-        }
-        List<Integer> tIds = taskExams.stream().map(taskExam -> taskExam.getId()).collect(Collectors.toList());
-        List<TaskExamCustomerAnswer> taskExamCustomerAnswers = taskExamCustomerAnswerService.selectByTUid(tIds, user.getId());
-        List<TaskItemVm> vm = taskExams.stream().map(t -> {
-            TaskItemVm itemVm = new TaskItemVm();
-            itemVm.setId(t.getId());
-            itemVm.setTitle(t.getTitle());
-            TaskExamCustomerAnswer taskExamCustomerAnswer = taskExamCustomerAnswers.stream()
-                    .filter(tc -> tc.getTaskExamId().equals(t.getId())).findFirst().orElse(null);
-            List<TaskItemPaperVm> paperItemVMS = getTaskItemPaperVm(t.getFrameTextContentId(), taskExamCustomerAnswer);
-            itemVm.setPaperItems(paperItemVMS);
-            return itemVm;
-        }).collect(Collectors.toList());
-        return RestResponse.ok(vm);
-    }
-
-
-    private List<TaskItemPaperVm> getTaskItemPaperVm(Integer tFrameId, TaskExamCustomerAnswer taskExamCustomerAnswers) {
-        TextContent textContent = textContentService.selectById(tFrameId);
-        List<TaskItemObject> paperItems = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemObject.class);
-
-        List<TaskItemAnswerObject> answerPaperItems = null;
-        if (null != taskExamCustomerAnswers) {
-            TextContent answerTextContent = textContentService.selectById(taskExamCustomerAnswers.getTextContentId());
-            answerPaperItems = JsonUtil.toJsonListObject(answerTextContent.getContent(), TaskItemAnswerObject.class);
-        }
-
-
-        List<TaskItemAnswerObject> finalAnswerPaperItems = answerPaperItems;
-        return paperItems.stream().map(p -> {
-                    TaskItemPaperVm ivm = new TaskItemPaperVm();
-                    ivm.setExamPaperId(p.getExamPaperId());
-                    ivm.setExamPaperName(p.getExamPaperName());
-                    if (null != finalAnswerPaperItems) {
-                        finalAnswerPaperItems.stream()
-                                .filter(a -> a.getExamPaperId().equals(p.getExamPaperId()))
-                                .findFirst()
-                                .ifPresent(a -> {
-                                    ivm.setExamPaperAnswerId(a.getExamPaperAnswerId());
-                                    ivm.setStatus(a.getStatus());
-                                });
-                    }
-                    return ivm;
-                }
-        ).collect(Collectors.toList());
-    }
-
-
-}

+ 0 - 135
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/wx/student/ExamPaperAnswerController.java

@@ -1,135 +0,0 @@
-package vip.xiaonuo.exam.controller.wx.student;
-
-import vip.xiaonuo.exam.base.RestResponse;
-import vip.xiaonuo.exam.controller.wx.BaseWXApiController;
-import vip.xiaonuo.exam.domain.*;
-import vip.xiaonuo.exam.domain.enums.QuestionTypeEnum;
-import vip.xiaonuo.exam.event.CalculateExamPaperAnswerCompleteEvent;
-import vip.xiaonuo.exam.event.UserEvent;
-import vip.xiaonuo.exam.service.ExamPaperAnswerService;
-import vip.xiaonuo.exam.service.ExamPaperService;
-import vip.xiaonuo.exam.service.SubjectService;
-import vip.xiaonuo.exam.utility.DateTimeUtil;
-import vip.xiaonuo.exam.utility.ExamUtil;
-import vip.xiaonuo.exam.utility.PageInfoHelper;
-import vip.xiaonuo.exam.viewmodel.admin.exam.ExamPaperEditRequestVM;
-import vip.xiaonuo.exam.viewmodel.student.exampaper.ExamPaperAnswerPageResponseVM;
-import vip.xiaonuo.exam.viewmodel.student.exampaper.ExamPaperAnswerPageVM;
-import com.github.pagehelper.PageInfo;
-import vip.xiaonuo.exam.viewmodel.student.exam.ExamPaperReadVM;
-import vip.xiaonuo.exam.viewmodel.student.exam.ExamPaperSubmitItemVM;
-import vip.xiaonuo.exam.viewmodel.student.exam.ExamPaperSubmitVM;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.validation.Valid;
-import java.util.*;
-import java.util.stream.Collectors;
-
-
-@Controller("WXStudentExamPaperAnswerController")
-@RequestMapping(value = "/api/wx/student/exampaper/answer")
-@ResponseBody
-public class ExamPaperAnswerController extends BaseWXApiController {
-
-    private final ExamPaperAnswerService examPaperAnswerService;
-    private final SubjectService subjectService;
-    private final ApplicationEventPublisher eventPublisher;
-    private final ExamPaperService examPaperService;
-
-    @Autowired
-    public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, SubjectService subjectService, ApplicationEventPublisher eventPublisher, ExamPaperService examPaperService) {
-        this.examPaperAnswerService = examPaperAnswerService;
-        this.subjectService = subjectService;
-        this.eventPublisher = eventPublisher;
-        this.examPaperService = examPaperService;
-    }
-
-    @RequestMapping(value = "/pageList", method = RequestMethod.POST)
-    public RestResponse<PageInfo<ExamPaperAnswerPageResponseVM>> pageList(@Valid ExamPaperAnswerPageVM model) {
-        model.setCreateUser(getCurrentUser().getId());
-        PageInfo<ExamPaperAnswer> pageInfo = examPaperAnswerService.studentPage(model);
-        PageInfo<ExamPaperAnswerPageResponseVM> page = PageInfoHelper.copyMap(pageInfo, e -> {
-            ExamPaperAnswerPageResponseVM vm = modelMapper.map(e, ExamPaperAnswerPageResponseVM.class);
-            Subject subject = subjectService.selectById(vm.getSubjectId());
-            vm.setDoTime(ExamUtil.secondToVM(e.getDoTime()));
-            vm.setSystemScore(ExamUtil.scoreToVM(e.getSystemScore()));
-            vm.setUserScore(ExamUtil.scoreToVM(e.getUserScore()));
-            vm.setPaperScore(ExamUtil.scoreToVM(e.getPaperScore()));
-            vm.setSubjectName(subject.getName());
-            vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime()));
-            return vm;
-        });
-        return RestResponse.ok(page);
-    }
-
-
-    @RequestMapping(value = "/answerSubmit", method = RequestMethod.POST)
-    public RestResponse answerSubmit(HttpServletRequest request) {
-        ExamPaperSubmitVM examPaperSubmitVM = requestToExamPaperSubmitVM(request);
-        User user = getCurrentUser();
-        ExamPaperAnswerInfo examPaperAnswerInfo = examPaperAnswerService.calculateExamPaperAnswer(examPaperSubmitVM, user);
-        if (null == examPaperAnswerInfo) {
-            return RestResponse.fail(2, "试卷不能重复做");
-        }
-        ExamPaperAnswer examPaperAnswer = examPaperAnswerInfo.getExamPaperAnswer();
-        Integer userScore = examPaperAnswer.getUserScore();
-        String scoreVm = ExamUtil.scoreToVM(userScore);
-        UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date());
-        String content = user.getUserName() + " 提交试卷:" + examPaperAnswerInfo.getExamPaper().getName()
-                + " 得分:" + scoreVm
-                + " 耗时:" + ExamUtil.secondToVM(examPaperAnswer.getDoTime());
-        userEventLog.setContent(content);
-        eventPublisher.publishEvent(new CalculateExamPaperAnswerCompleteEvent(examPaperAnswerInfo));
-        eventPublisher.publishEvent(new UserEvent(userEventLog));
-        return RestResponse.ok(scoreVm);
-    }
-
-    private ExamPaperSubmitVM requestToExamPaperSubmitVM(HttpServletRequest request) {
-        ExamPaperSubmitVM examPaperSubmitVM = new ExamPaperSubmitVM();
-        examPaperSubmitVM.setId(Integer.parseInt(request.getParameter("id")));
-        examPaperSubmitVM.setDoTime(Integer.parseInt(request.getParameter("doTime")));
-        List<String> parameterNames = Collections.list(request.getParameterNames()).stream()
-                .filter(n -> n.contains("_"))
-                .collect(Collectors.toList());
-        //题目答案按序号分组
-        Map<String, List<String>> questionGroup = parameterNames.stream().collect(Collectors.groupingBy(p -> p.substring(0, p.indexOf("_"))));
-        List<ExamPaperSubmitItemVM> answerItems = new ArrayList<>();
-        questionGroup.forEach((k, v) -> {
-            ExamPaperSubmitItemVM examPaperSubmitItemVM = new ExamPaperSubmitItemVM();
-            String p = v.get(0);
-            String[] keys = p.split("_");
-            examPaperSubmitItemVM.setQuestionId(Integer.parseInt(keys[1]));
-            examPaperSubmitItemVM.setItemOrder(Integer.parseInt(keys[0]));
-            QuestionTypeEnum typeEnum = QuestionTypeEnum.fromCode(Integer.parseInt(keys[2]));
-            if (v.size() == 1) {
-                String content = request.getParameter(p);
-                examPaperSubmitItemVM.setContent(content);
-                if (typeEnum == QuestionTypeEnum.MultipleChoice) {
-                    examPaperSubmitItemVM.setContentArray(Arrays.asList(content.split(",")));
-                }
-            } else {  //多个空 填空题
-                List<String> answers = v.stream().sorted(Comparator.comparingInt(ExamUtil::lastNum)).map(inputKey -> request.getParameter(inputKey)).collect(Collectors.toList());
-                examPaperSubmitItemVM.setContentArray(answers);
-            }
-            answerItems.add(examPaperSubmitItemVM);
-        });
-        examPaperSubmitVM.setAnswerItems(answerItems);
-        return examPaperSubmitVM;
-    }
-
-
-    @PostMapping(value = "/read/{id}")
-    public RestResponse<ExamPaperReadVM> read(@PathVariable Integer id) {
-        ExamPaperReadVM vm = new ExamPaperReadVM();
-        ExamPaperAnswer examPaperAnswer = examPaperAnswerService.selectById(id);
-        ExamPaperEditRequestVM paper = examPaperService.examPaperToVM(examPaperAnswer.getExamPaperId());
-        ExamPaperSubmitVM answer = examPaperAnswerService.examPaperAnswerToVM(examPaperAnswer.getId());
-        vm.setPaper(paper);
-        vm.setAnswer(answer);
-        return RestResponse.ok(vm);
-    }
-}

+ 0 - 57
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/wx/student/ExamPaperController.java

@@ -1,57 +0,0 @@
-package vip.xiaonuo.exam.controller.wx.student;
-
-import vip.xiaonuo.exam.base.RestResponse;
-import vip.xiaonuo.exam.controller.wx.BaseWXApiController;
-import vip.xiaonuo.exam.domain.ExamPaper;
-import vip.xiaonuo.exam.domain.Subject;
-import vip.xiaonuo.exam.service.ExamPaperService;
-import vip.xiaonuo.exam.service.SubjectService;
-import vip.xiaonuo.exam.utility.DateTimeUtil;
-import vip.xiaonuo.exam.utility.PageInfoHelper;
-import vip.xiaonuo.exam.viewmodel.admin.exam.ExamPaperEditRequestVM;
-import vip.xiaonuo.exam.viewmodel.student.exam.ExamPaperPageResponseVM;
-import vip.xiaonuo.exam.viewmodel.student.exam.ExamPaperPageVM;
-import com.github.pagehelper.PageInfo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
-
-
-@Controller("WXStudentExamController")
-@RequestMapping(value = "/api/wx/student/exampaper")
-@ResponseBody
-public class ExamPaperController extends BaseWXApiController {
-
-    private final ExamPaperService examPaperService;
-    private final SubjectService subjectService;
-
-    @Autowired
-    public ExamPaperController(ExamPaperService examPaperService, SubjectService subjectService) {
-        this.examPaperService = examPaperService;
-        this.subjectService = subjectService;
-    }
-
-
-    @RequestMapping(value = "/select/{id}", method = RequestMethod.POST)
-    public RestResponse<ExamPaperEditRequestVM> select(@PathVariable Integer id) {
-        ExamPaperEditRequestVM vm = examPaperService.examPaperToVM(id);
-        return RestResponse.ok(vm);
-    }
-
-
-    @RequestMapping(value = "/pageList", method = RequestMethod.POST)
-    public RestResponse<PageInfo<ExamPaperPageResponseVM>> pageList(@Valid ExamPaperPageVM model) {
-        model.setLevelId(getCurrentUser().getUserLevel());
-        PageInfo<ExamPaper> pageInfo = examPaperService.studentPage(model);
-        PageInfo<ExamPaperPageResponseVM> page = PageInfoHelper.copyMap(pageInfo, e -> {
-            ExamPaperPageResponseVM vm = modelMapper.map(e, ExamPaperPageResponseVM.class);
-            Subject subject = subjectService.selectById(vm.getSubjectId());
-            vm.setSubjectName(subject.getName());
-            vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime()));
-            return vm;
-        });
-        return RestResponse.ok(page);
-    }
-}

+ 0 - 150
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/wx/student/UserController.java

@@ -1,150 +0,0 @@
-package vip.xiaonuo.exam.controller.wx.student;
-
-import vip.xiaonuo.exam.base.RestResponse;
-import vip.xiaonuo.exam.controller.wx.BaseWXApiController;
-import vip.xiaonuo.exam.domain.Message;
-import vip.xiaonuo.exam.domain.MessageUser;
-import vip.xiaonuo.exam.domain.User;
-import vip.xiaonuo.exam.domain.UserEventLog;
-import vip.xiaonuo.exam.domain.enums.RoleEnum;
-import vip.xiaonuo.exam.domain.enums.UserStatusEnum;
-import vip.xiaonuo.exam.event.UserEvent;
-import vip.xiaonuo.exam.service.AuthenticationService;
-import vip.xiaonuo.exam.service.MessageService;
-import vip.xiaonuo.exam.service.UserEventLogService;
-import vip.xiaonuo.exam.service.UserService;
-import vip.xiaonuo.exam.utility.DateTimeUtil;
-import vip.xiaonuo.exam.utility.PageInfoHelper;
-
-import com.github.pagehelper.PageInfo;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.*;
-import vip.xiaonuo.exam.viewmodel.student.user.*;
-
-import javax.validation.Valid;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-import java.util.stream.Collectors;
-
-
-@Controller("WXStudentUserController")
-@RequestMapping(value = "/api/wx/student/user")
-@ResponseBody
-public class UserController extends BaseWXApiController {
-
-    private final UserService userService;
-    private final UserEventLogService userEventLogService;
-    private final MessageService messageService;
-    private final AuthenticationService authenticationService;
-    private final ApplicationEventPublisher eventPublisher;
-
-    @Autowired
-    public UserController(UserService userService, UserEventLogService userEventLogService, MessageService messageService, AuthenticationService authenticationService, ApplicationEventPublisher eventPublisher) {
-        this.userService = userService;
-        this.userEventLogService = userEventLogService;
-        this.messageService = messageService;
-        this.authenticationService = authenticationService;
-        this.eventPublisher = eventPublisher;
-    }
-
-    @RequestMapping(value = "/current", method = RequestMethod.POST)
-    public RestResponse<UserResponseVM> current() {
-        User user = getCurrentUser();
-        UserResponseVM userVm = UserResponseVM.from(user);
-        userVm.setBirthDay(DateTimeUtil.dateShortFormat(user.getBirthDay()));
-        return RestResponse.ok(userVm);
-    }
-
-    @RequestMapping(value = "/register", method = RequestMethod.POST)
-    public RestResponse register(@Valid UserRegisterVM model) {
-        User existUser = userService.getUserByUserName(model.getUserName());
-        if (null != existUser) {
-            return new RestResponse<>(2, "用户已存在");
-        }
-        User user = modelMapper.map(model, User.class);
-        String encodePwd = authenticationService.pwdEncode(model.getPassword());
-        user.setUserUuid(UUID.randomUUID().toString());
-        user.setPassword(encodePwd);
-        user.setRole(RoleEnum.STUDENT.getCode());
-        user.setStatus(UserStatusEnum.Enable.getCode());
-        user.setLastActiveTime(new Date());
-        user.setCreateTime(new Date());
-        user.setDeleted(false);
-        userService.insertByFilter(user);
-        UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date());
-        userEventLog.setContent("欢迎 " + user.getUserName() + " 注册来到学之思开源考试系统");
-        eventPublisher.publishEvent(new UserEvent(userEventLog));
-        return RestResponse.ok();
-    }
-
-    @RequestMapping(value = "/update", method = RequestMethod.POST)
-    public RestResponse<UserResponseVM> update(@Valid UserUpdateVM model) {
-        if (StringUtils.isBlank(model.getBirthDay())) {
-            model.setBirthDay(null);
-        }
-        User user = userService.selectById(getCurrentUser().getId());
-        modelMapper.map(model, user);
-        user.setModifyTime(new Date());
-        userService.updateByIdFilter(user);
-        UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date());
-        userEventLog.setContent(user.getUserName() + " 更新了个人资料");
-        eventPublisher.publishEvent(new UserEvent(userEventLog));
-        UserResponseVM userVm = UserResponseVM.from(user);
-        return RestResponse.ok(userVm);
-    }
-
-    @RequestMapping(value = "/log", method = RequestMethod.POST)
-    public RestResponse<List<UserEventLogVM>> log() {
-        User user = getCurrentUser();
-        List<UserEventLog> userEventLogs = userEventLogService.getUserEventLogByUserId(user.getId());
-        List<UserEventLogVM> userEventLogVMS = userEventLogs.stream().map(d -> {
-            UserEventLogVM vm = modelMapper.map(d, UserEventLogVM.class);
-            vm.setCreateTime(DateTimeUtil.dateFormat(d.getCreateTime()));
-            return vm;
-        }).collect(Collectors.toList());
-        return RestResponse.ok(userEventLogVMS);
-    }
-
-    @RequestMapping(value = "/message/page", method = RequestMethod.POST)
-    public RestResponse<PageInfo<MessageResponseVM>> messagePageList(MessageRequestVM messageRequestVM) {
-        messageRequestVM.setReceiveUserId(getCurrentUser().getId());
-        PageInfo<MessageUser> messageUserPageInfo = messageService.studentPage(messageRequestVM);
-        List<Integer> ids = messageUserPageInfo.getList().stream().map(d -> d.getMessageId()).collect(Collectors.toList());
-        List<Message> messages = ids.size() != 0 ? messageService.selectMessageByIds(ids) : null;
-        PageInfo<MessageResponseVM> page = PageInfoHelper.copyMap(messageUserPageInfo, e -> {
-            MessageResponseVM vm = modelMapper.map(e, MessageResponseVM.class);
-            messages.stream().filter(d -> e.getMessageId().equals(d.getId())).findFirst().ifPresent(message -> {
-                vm.setTitle(message.getTitle());
-                vm.setContent(message.getContent());
-                vm.setSendUserName(message.getSendUserName());
-            });
-            vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime()));
-            return vm;
-        });
-        return RestResponse.ok(page);
-    }
-
-    @RequestMapping(value = "/message/detail/{id}", method = RequestMethod.POST)
-    public RestResponse messageDetail(@PathVariable Integer id) {
-        Message message = messageService.messageDetail(id);
-        return RestResponse.ok(message);
-    }
-
-
-    @RequestMapping(value = "/message/unreadCount", method = RequestMethod.POST)
-    public RestResponse unReadCount() {
-        Integer count = messageService.unReadCount(getCurrentUser().getId());
-        return RestResponse.ok(count);
-    }
-
-    @RequestMapping(value = "/message/read/{id}", method = RequestMethod.POST)
-    public RestResponse read(@PathVariable Integer id) {
-        messageService.read(id);
-        return RestResponse.ok();
-    }
-
-}

+ 3 - 3
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/ExamPaper.java

@@ -59,7 +59,7 @@ public class ExamPaper implements Serializable {
      */
     private Integer frameTextContentId;
 
-    private Integer createUser;
+    private String createUser;
 
     private Date createTime;
 
@@ -155,11 +155,11 @@ public class ExamPaper implements Serializable {
         this.frameTextContentId = frameTextContentId;
     }
 
-    public Integer getCreateUser() {
+    public String getCreateUser() {
         return createUser;
     }
 
-    public void setCreateUser(Integer createUser) {
+    public void setCreateUser(String createUser) {
         this.createUser = createUser;
     }
 

+ 3 - 3
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/ExamPaperAnswer.java

@@ -64,7 +64,7 @@ public class ExamPaperAnswer implements Serializable {
     /**
      * 学生
      */
-    private Integer createUser;
+    private String createUser;
 
     /**
      * 提交时间
@@ -169,11 +169,11 @@ public class ExamPaperAnswer implements Serializable {
         this.status = status;
     }
 
-    public Integer getCreateUser() {
+    public String getCreateUser() {
         return createUser;
     }
 
-    public void setCreateUser(Integer createUser) {
+    public void setCreateUser(String createUser) {
         this.createUser = createUser;
     }
 

+ 3 - 3
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/ExamPaperQuestionCustomerAnswer.java

@@ -67,7 +67,7 @@ public class ExamPaperQuestionCustomerAnswer implements Serializable {
     /**
      * 做题人
      */
-    private Integer createUser;
+    private String createUser;
 
     private Date createTime;
 
@@ -169,11 +169,11 @@ public class ExamPaperQuestionCustomerAnswer implements Serializable {
         this.doRight = doRight;
     }
 
-    public Integer getCreateUser() {
+    public String getCreateUser() {
         return createUser;
     }
 
-    public void setCreateUser(Integer createUser) {
+    public void setCreateUser(String createUser) {
         this.createUser = createUser;
     }
 

+ 3 - 3
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/Message.java

@@ -26,7 +26,7 @@ public class Message implements Serializable {
     /**
      * 发送者用户ID
      */
-    private Integer sendUserId;
+    private String sendUserId;
 
     /**
      * 发送者用户名
@@ -81,11 +81,11 @@ public class Message implements Serializable {
         this.createTime = createTime;
     }
 
-    public Integer getSendUserId() {
+    public String getSendUserId() {
         return sendUserId;
     }
 
-    public void setSendUserId(Integer sendUserId) {
+    public void setSendUserId(String sendUserId) {
         this.sendUserId = sendUserId;
     }
 

+ 3 - 3
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/MessageUser.java

@@ -17,7 +17,7 @@ public class MessageUser implements Serializable {
     /**
      * 接收人ID
      */
-    private Integer receiveUserId;
+    private String receiveUserId;
 
     /**
      * 接收人用户名
@@ -57,11 +57,11 @@ public class MessageUser implements Serializable {
         this.messageId = messageId;
     }
 
-    public Integer getReceiveUserId() {
+    public String getReceiveUserId() {
         return receiveUserId;
     }
 
-    public void setReceiveUserId(Integer receiveUserId) {
+    public void setReceiveUserId(String receiveUserId) {
         this.receiveUserId = receiveUserId;
     }
 

+ 3 - 3
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/Question.java

@@ -51,7 +51,7 @@ public class Question implements Serializable {
     /**
      * 创建人
      */
-    private Integer createUser;
+    private String createUser;
 
     /**
      * 1.正常
@@ -129,11 +129,11 @@ public class Question implements Serializable {
         this.infoTextContentId = infoTextContentId;
     }
 
-    public Integer getCreateUser() {
+    public String getCreateUser() {
         return createUser;
     }
 
-    public void setCreateUser(Integer createUser) {
+    public void setCreateUser(String createUser) {
         this.createUser = createUser;
     }
 

+ 3 - 3
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/TaskExam.java

@@ -27,7 +27,7 @@ public class TaskExam implements Serializable {
     /**
      * 创建者
      */
-    private Integer createUser;
+    private String createUser;
 
     /**
      * 创建时间
@@ -73,11 +73,11 @@ public class TaskExam implements Serializable {
         this.frameTextContentId = frameTextContentId;
     }
 
-    public Integer getCreateUser() {
+    public String getCreateUser() {
         return createUser;
     }
 
-    public void setCreateUser(Integer createUser) {
+    public void setCreateUser(String createUser) {
         this.createUser = createUser;
     }
 

+ 3 - 3
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/TaskExamCustomerAnswer.java

@@ -17,7 +17,7 @@ public class TaskExamCustomerAnswer implements Serializable {
     /**
      * 创建者
      */
-    private Integer createUser;
+    private String createUser;
 
     /**
      * 创建时间
@@ -45,11 +45,11 @@ public class TaskExamCustomerAnswer implements Serializable {
         this.taskExamId = taskExamId;
     }
 
-    public Integer getCreateUser() {
+    public String getCreateUser() {
         return createUser;
     }
 
-    public void setCreateUser(Integer createUser) {
+    public void setCreateUser(String createUser) {
         this.createUser = createUser;
     }
 

+ 3 - 3
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/User.java

@@ -7,7 +7,7 @@ public class User implements Serializable {
 
     private static final long serialVersionUID = -7797183521247423117L;
 
-    private Integer id;
+    private String id;
 
     private String userUuid;
 
@@ -70,11 +70,11 @@ public class User implements Serializable {
      */
     private String wxOpenId;
 
-    public Integer getId() {
+    public String getId() {
         return id;
     }
 
-    public void setId(Integer id) {
+    public void setId(String id) {
         this.id = id;
     }
 

+ 4 - 4
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/UserEventLog.java

@@ -12,7 +12,7 @@ public class UserEventLog implements Serializable {
 
     }
 
-    public UserEventLog(Integer userId, String userName, String realName, Date createTime) {
+    public UserEventLog(String userId, String userName, String realName, Date createTime) {
         this.userId = userId;
         this.userName = userName;
         this.realName = realName;
@@ -24,7 +24,7 @@ public class UserEventLog implements Serializable {
     /**
      * 用户id
      */
-    private Integer userId;
+    private String userId;
 
     /**
      * 用户名
@@ -54,11 +54,11 @@ public class UserEventLog implements Serializable {
         this.id = id;
     }
 
-    public Integer getUserId() {
+    public String getUserId() {
         return userId;
     }
 
-    public void setUserId(Integer userId) {
+    public void setUserId(String userId) {
         this.userId = userId;
     }
 

+ 3 - 3
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/domain/UserToken.java

@@ -17,7 +17,7 @@ public class UserToken implements Serializable {
     /**
      * 用户Id
      */
-    private Integer userId;
+    private String userId;
 
     /**
      * 微信小程序openId
@@ -55,11 +55,11 @@ public class UserToken implements Serializable {
         this.token = token == null ? null : token.trim();
     }
 
-    public Integer getUserId() {
+    public String getUserId() {
         return userId;
     }
 
-    public void setUserId(Integer userId) {
+    public void setUserId(String userId) {
         this.userId = userId;
     }
 

+ 0 - 82
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/listener/CalculateExamPaperAnswerListener.java

@@ -1,82 +0,0 @@
-package vip.xiaonuo.exam.listener;
-
-
-import vip.xiaonuo.exam.domain.*;
-import vip.xiaonuo.exam.domain.enums.ExamPaperTypeEnum;
-import vip.xiaonuo.exam.domain.enums.QuestionTypeEnum;
-import vip.xiaonuo.exam.event.CalculateExamPaperAnswerCompleteEvent;
-import vip.xiaonuo.exam.service.ExamPaperAnswerService;
-import vip.xiaonuo.exam.service.ExamPaperQuestionCustomerAnswerService;
-import vip.xiaonuo.exam.service.TaskExamCustomerAnswerService;
-import vip.xiaonuo.exam.service.TextContentService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationListener;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.Date;
-import java.util.List;
-
-
-/**
- * @version 3.5.0
- * @description: The type Calculate exam paper answer listener.
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-@Component
-public class CalculateExamPaperAnswerListener implements ApplicationListener<CalculateExamPaperAnswerCompleteEvent> {
-
-    private final ExamPaperAnswerService examPaperAnswerService;
-    private final ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService;
-    private final TextContentService textContentService;
-    private final TaskExamCustomerAnswerService examCustomerAnswerService;
-
-    /**
-     * Instantiates a new Calculate exam paper answer listener.
-     *
-     * @param examPaperAnswerService                 the exam paper answer service
-     * @param examPaperQuestionCustomerAnswerService the exam paper question customer answer service
-     * @param textContentService                     the text content service
-     * @param examCustomerAnswerService              the exam customer answer service
-     */
-    @Autowired
-    public CalculateExamPaperAnswerListener(ExamPaperAnswerService examPaperAnswerService, ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService, TextContentService textContentService, TaskExamCustomerAnswerService examCustomerAnswerService) {
-        this.examPaperAnswerService = examPaperAnswerService;
-        this.examPaperQuestionCustomerAnswerService = examPaperQuestionCustomerAnswerService;
-        this.textContentService = textContentService;
-        this.examCustomerAnswerService = examCustomerAnswerService;
-    }
-
-    @Override
-    @Transactional
-    public void onApplicationEvent(CalculateExamPaperAnswerCompleteEvent calculateExamPaperAnswerCompleteEvent) {
-        Date now = new Date();
-
-        ExamPaperAnswerInfo examPaperAnswerInfo = (ExamPaperAnswerInfo) calculateExamPaperAnswerCompleteEvent.getSource();
-        ExamPaper examPaper = examPaperAnswerInfo.getExamPaper();
-        ExamPaperAnswer examPaperAnswer = examPaperAnswerInfo.getExamPaperAnswer();
-        List<ExamPaperQuestionCustomerAnswer> examPaperQuestionCustomerAnswers = examPaperAnswerInfo.getExamPaperQuestionCustomerAnswers();
-
-        examPaperAnswerService.insertByFilter(examPaperAnswer);
-        examPaperQuestionCustomerAnswers.stream().filter(a -> QuestionTypeEnum.needSaveTextContent(a.getQuestionType())).forEach(d -> {
-            TextContent textContent = new TextContent(d.getAnswer(), now);
-            textContentService.insertByFilter(textContent);
-            d.setTextContentId(textContent.getId());
-            d.setAnswer(null);
-        });
-        examPaperQuestionCustomerAnswers.forEach(d -> {
-            d.setExamPaperAnswerId(examPaperAnswer.getId());
-        });
-        examPaperQuestionCustomerAnswerService.insertList(examPaperQuestionCustomerAnswers);
-
-        switch (ExamPaperTypeEnum.fromCode(examPaper.getPaperType())) {
-            case Task: {
-                examCustomerAnswerService.insertOrUpdate(examPaper, examPaperAnswer, now);
-                break;
-            }
-            default:
-                break;
-        }
-    }
-}

+ 0 - 25
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/listener/EmailSendListener.java

@@ -1,25 +0,0 @@
-package vip.xiaonuo.exam.listener;
-
-import vip.xiaonuo.exam.domain.User;
-import vip.xiaonuo.exam.event.OnRegistrationCompleteEvent;
-import org.springframework.context.ApplicationListener;
-import org.springframework.lang.NonNull;
-import org.springframework.stereotype.Component;
-
-
-/**
- * @version 3.5.0
- * @description: The type Email send listener.
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-@Component
-public class EmailSendListener implements ApplicationListener<OnRegistrationCompleteEvent> {
-
-    @Override
-    @NonNull
-    public void onApplicationEvent(OnRegistrationCompleteEvent event) {
-        User user = event.getUser();
-        System.out.println("User register Email sender :" + user.getUserName());
-    }
-}

+ 0 - 35
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/listener/UserLogListener.java

@@ -1,35 +0,0 @@
-package vip.xiaonuo.exam.listener;
-
-import vip.xiaonuo.exam.event.UserEvent;
-import vip.xiaonuo.exam.service.UserEventLogService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationListener;
-import org.springframework.stereotype.Component;
-
-/**
- * @version 3.5.0
- * @description: The type User log listener.
- * Copyright (C), 2020-2024, 武汉思维跳跃科技有限公司
- * @date 2021/12/25 9:45
- */
-@Component
-public class UserLogListener implements ApplicationListener<UserEvent> {
-
-    private final UserEventLogService userEventLogService;
-
-    /**
-     * Instantiates a new User log listener.
-     *
-     * @param userEventLogService the user event log service
-     */
-    @Autowired
-    public UserLogListener(UserEventLogService userEventLogService) {
-        this.userEventLogService = userEventLogService;
-    }
-
-    @Override
-    public void onApplicationEvent(UserEvent userEvent) {
-        userEventLogService.insertByFilter(userEvent.getUserEventLog());
-    }
-
-}

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/repository/BaseMapper.java → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/BaseMapper.java

@@ -1,4 +1,4 @@
-package vip.xiaonuo.exam.repository;
+package vip.xiaonuo.exam.mapper;
 
 public interface BaseMapper<T> {
 

+ 2 - 2
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/repository/ExamPaperAnswerMapper.java → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/ExamPaperAnswerMapper.java

@@ -1,4 +1,4 @@
-package vip.xiaonuo.exam.repository;
+package vip.xiaonuo.exam.mapper;
 
 import vip.xiaonuo.exam.domain.ExamPaperAnswer;
 import vip.xiaonuo.exam.domain.other.KeyValue;
@@ -19,7 +19,7 @@ public interface ExamPaperAnswerMapper extends BaseMapper<ExamPaperAnswer> {
 
     List<KeyValue> selectCountByDate(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
 
-    ExamPaperAnswer getByPidUid(@Param("pid") Integer paperId, @Param("uid") Integer uid);
+    ExamPaperAnswer getByPidUid(@Param("pid") Integer paperId, @Param("uid") String uid);
 
     List<ExamPaperAnswer> adminPage(ExamPaperAnswerPageRequestVM requestVM);
 }

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/repository/ExamPaperMapper.java → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/ExamPaperMapper.java

@@ -1,4 +1,4 @@
-package vip.xiaonuo.exam.repository;
+package vip.xiaonuo.exam.mapper;
 
 import vip.xiaonuo.exam.domain.ExamPaper;
 import vip.xiaonuo.exam.domain.other.KeyValue;

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/repository/ExamPaperQuestionCustomerAnswerMapper.java → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/ExamPaperQuestionCustomerAnswerMapper.java

@@ -1,4 +1,4 @@
-package vip.xiaonuo.exam.repository;
+package vip.xiaonuo.exam.mapper;
 
 import vip.xiaonuo.exam.domain.ExamPaperQuestionCustomerAnswer;
 import vip.xiaonuo.exam.domain.other.ExamPaperAnswerUpdate;

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/repository/MessageMapper.java → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/MessageMapper.java

@@ -1,4 +1,4 @@
-package vip.xiaonuo.exam.repository;
+package vip.xiaonuo.exam.mapper;
 
 import vip.xiaonuo.exam.domain.Message;
 import vip.xiaonuo.exam.viewmodel.admin.message.MessagePageRequestVM;

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/repository/MessageUserMapper.java → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/MessageUserMapper.java

@@ -1,4 +1,4 @@
-package vip.xiaonuo.exam.repository;
+package vip.xiaonuo.exam.mapper;
 
 import vip.xiaonuo.exam.domain.MessageUser;
 import vip.xiaonuo.exam.viewmodel.student.user.MessageRequestVM;

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/repository/QuestionMapper.java → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/QuestionMapper.java

@@ -1,4 +1,4 @@
-package vip.xiaonuo.exam.repository;
+package vip.xiaonuo.exam.mapper;
 
 import vip.xiaonuo.exam.domain.other.KeyValue;
 import vip.xiaonuo.exam.domain.Question;

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/repository/SubjectMapper.java → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/SubjectMapper.java

@@ -1,4 +1,4 @@
-package vip.xiaonuo.exam.repository;
+package vip.xiaonuo.exam.mapper;
 
 import vip.xiaonuo.exam.domain.Subject;
 import vip.xiaonuo.exam.viewmodel.admin.education.SubjectPageRequestVM;

+ 3 - 3
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/repository/TaskExamCustomerAnswerMapper.java → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/TaskExamCustomerAnswerMapper.java

@@ -1,4 +1,4 @@
-package vip.xiaonuo.exam.repository;
+package vip.xiaonuo.exam.mapper;
 
 import vip.xiaonuo.exam.domain.TaskExamCustomerAnswer;
 import org.apache.ibatis.annotations.Mapper;
@@ -9,7 +9,7 @@ import java.util.List;
 @Mapper
 public interface TaskExamCustomerAnswerMapper extends BaseMapper<TaskExamCustomerAnswer> {
 
-    TaskExamCustomerAnswer getByTUid(@Param("tid") Integer tid, @Param("uid") Integer uid);
+    TaskExamCustomerAnswer getByTUid(@Param("tid") Integer tid, @Param("uid") String uid);
 
-    List<TaskExamCustomerAnswer> selectByTUid(@Param("taskIds") List<Integer> taskIds, @Param("uid") Integer uid);
+    List<TaskExamCustomerAnswer> selectByTUid(@Param("taskIds") List<Integer> taskIds, @Param("uid") String uid);
 }

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/repository/TaskExamMapper.java → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/TaskExamMapper.java

@@ -1,4 +1,4 @@
-package vip.xiaonuo.exam.repository;
+package vip.xiaonuo.exam.mapper;
 
 import vip.xiaonuo.exam.domain.TaskExam;
 import vip.xiaonuo.exam.viewmodel.admin.task.TaskPageRequestVM;

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/repository/TextContentMapper.java → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/TextContentMapper.java

@@ -1,4 +1,4 @@
-package vip.xiaonuo.exam.repository;
+package vip.xiaonuo.exam.mapper;
 
 import vip.xiaonuo.exam.domain.TextContent;
 import org.apache.ibatis.annotations.Mapper;

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/repository/UserEventLogMapper.java → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/UserEventLogMapper.java

@@ -1,4 +1,4 @@
-package vip.xiaonuo.exam.repository;
+package vip.xiaonuo.exam.mapper;
 
 import vip.xiaonuo.exam.domain.UserEventLog;
 import vip.xiaonuo.exam.domain.other.KeyValue;

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/resources/mapper/ExamPaperAnswerMapper.xml → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/ExamPaperAnswerMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="vip.xiaonuo.exam.repository.ExamPaperAnswerMapper">
+<mapper namespace="vip.xiaonuo.exam.mapper.ExamPaperAnswerMapper">
   <resultMap id="BaseResultMap" type="vip.xiaonuo.exam.domain.ExamPaperAnswer">
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="exam_paper_id" jdbcType="INTEGER" property="examPaperId" />

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/resources/mapper/ExamPaperMapper.xml → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/ExamPaperMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="vip.xiaonuo.exam.repository.ExamPaperMapper">
+<mapper namespace="vip.xiaonuo.exam.mapper.ExamPaperMapper">
   <resultMap id="BaseResultMap" type="vip.xiaonuo.exam.domain.ExamPaper">
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="name" jdbcType="VARCHAR" property="name" />

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/resources/mapper/ExamPaperQuestionCustomerAnswerMapper.xml → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/ExamPaperQuestionCustomerAnswerMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="vip.xiaonuo.exam.repository.ExamPaperQuestionCustomerAnswerMapper">
+<mapper namespace="vip.xiaonuo.exam.mapper.ExamPaperQuestionCustomerAnswerMapper">
   <resultMap id="BaseResultMap" type="vip.xiaonuo.exam.domain.ExamPaperQuestionCustomerAnswer">
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="question_id" jdbcType="INTEGER" property="questionId" />

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/resources/mapper/MessageMapper.xml → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/MessageMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="vip.xiaonuo.exam.repository.MessageMapper">
+<mapper namespace="vip.xiaonuo.exam.mapper.MessageMapper">
   <resultMap id="BaseResultMap" type="vip.xiaonuo.exam.domain.Message">
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="title" jdbcType="VARCHAR" property="title" />

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/resources/mapper/MessageUserMapper.xml → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/MessageUserMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="vip.xiaonuo.exam.repository.MessageUserMapper">
+<mapper namespace="vip.xiaonuo.exam.mapper.MessageUserMapper">
   <resultMap id="BaseResultMap" type="vip.xiaonuo.exam.domain.MessageUser">
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="message_id" jdbcType="INTEGER" property="messageId" />

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/resources/mapper/QuestionMapper.xml → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/QuestionMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="vip.xiaonuo.exam.repository.QuestionMapper">
+<mapper namespace="vip.xiaonuo.exam.mapper.QuestionMapper">
   <resultMap id="BaseResultMap" type="vip.xiaonuo.exam.domain.Question">
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="question_type" jdbcType="INTEGER" property="questionType" />

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/resources/mapper/SubjectMapper.xml → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/SubjectMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="vip.xiaonuo.exam.repository.SubjectMapper">
+<mapper namespace="vip.xiaonuo.exam.mapper.SubjectMapper">
   <resultMap id="BaseResultMap" type="vip.xiaonuo.exam.domain.Subject">
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="name" jdbcType="VARCHAR" property="name" />

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/resources/mapper/TaskExamCustomerAnswerMapper.xml → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/TaskExamCustomerAnswerMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="vip.xiaonuo.exam.repository.TaskExamCustomerAnswerMapper">
+<mapper namespace="vip.xiaonuo.exam.mapper.TaskExamCustomerAnswerMapper">
   <resultMap id="BaseResultMap" type="vip.xiaonuo.exam.domain.TaskExamCustomerAnswer">
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="task_exam_id" jdbcType="INTEGER" property="taskExamId" />

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/resources/mapper/TaskExamMapper.xml → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/TaskExamMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="vip.xiaonuo.exam.repository.TaskExamMapper">
+<mapper namespace="vip.xiaonuo.exam.mapper.TaskExamMapper">
   <resultMap id="BaseResultMap" type="vip.xiaonuo.exam.domain.TaskExam">
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="title" jdbcType="VARCHAR" property="title" />

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/resources/mapper/TextContentMapper.xml → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/TextContentMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="vip.xiaonuo.exam.repository.TextContentMapper">
+<mapper namespace="vip.xiaonuo.exam.mapper.TextContentMapper">
   <resultMap id="BaseResultMap" type="vip.xiaonuo.exam.domain.TextContent">
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="content" jdbcType="VARCHAR" property="content" />

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/resources/mapper/UserEventLogMapper.xml → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/UserEventLogMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="vip.xiaonuo.exam.repository.UserEventLogMapper">
+<mapper namespace="vip.xiaonuo.exam.mapper.UserEventLogMapper">
   <resultMap id="BaseResultMap" type="vip.xiaonuo.exam.domain.UserEventLog">
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="user_id" jdbcType="INTEGER" property="userId" />

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/resources/mapper/UserMapper.xml → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/UserMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="vip.xiaonuo.exam.repository.UserMapper">
+<mapper namespace="vip.xiaonuo.exam.mapper.UserMapper">
   <resultMap id="BaseResultMap" type="vip.xiaonuo.exam.domain.User">
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="user_uuid" jdbcType="VARCHAR" property="userUuid" />

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/resources/mapper/UserTokenMapper.xml → snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/UserTokenMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="vip.xiaonuo.exam.repository.UserTokenMapper">
+<mapper namespace="vip.xiaonuo.exam.mapper.UserTokenMapper">
   <resultMap id="BaseResultMap" type="vip.xiaonuo.exam.domain.UserToken">
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="token" jdbcType="VARCHAR" property="token" />

+ 0 - 131
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/repository/UserMapper.java

@@ -1,131 +0,0 @@
-package vip.xiaonuo.exam.repository;
-
-import vip.xiaonuo.exam.domain.other.KeyValue;
-import vip.xiaonuo.exam.domain.User;
-import vip.xiaonuo.exam.viewmodel.admin.user.UserPageRequestVM;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-import java.util.Map;
-
-
-@Mapper
-public interface UserMapper extends BaseMapper<User> {
-
-    /**
-     * getAllUser
-     *
-     * @return List<User>
-     */
-    List<User> getAllUser();
-
-    /**
-     * getUserById
-     *
-     * @param id id
-     * @return User
-     */
-    User getUserById(Integer id);
-
-    /**
-     * getUserByUserName
-     *
-     * @param username username
-     * @return User
-     */
-    User getUserByUserName(String username);
-
-    /**
-     * getUserByUserNamePwd
-     *
-     * @param username username
-     * @param pwd      pwd
-     * @return User
-     */
-    User getUserByUserNamePwd(@Param("username") String username, @Param("pwd") String pwd);
-
-    /**
-     * getUserByUuid
-     *
-     * @param uuid uuid
-     * @return User
-     */
-    User getUserByUuid(String uuid);
-
-    /**
-     * userPageList
-     *
-     * @param map userPageList
-     * @return List<User>
-     */
-    List<User> userPageList(Map<String, Object> map);
-
-
-    /**
-     * userPageCount
-     *
-     * @param map map
-     * @return Integer
-     */
-    Integer userPageCount(Map<String, Object> map);
-
-
-    /**
-     * @param requestVM requestVM
-     * @return List<User>
-     */
-    List<User> userPage(UserPageRequestVM requestVM);
-
-
-    /**
-     * insertUser
-     *
-     * @param user user
-     */
-    void insertUser(User user);
-
-    /**
-     * insertUsers
-     *
-     * @param users users
-     */
-    void insertUsers(List<User> users);
-
-    /**
-     * updateUser
-     *
-     * @param user user
-     */
-    void updateUser(User user);
-
-    /**
-     * updateUsersAge
-     *
-     * @param map map
-     */
-    void updateUsersAge(Map<String, Object> map);
-
-    /**
-     * deleteUsersByIds
-     *
-     * @param ids ids
-     */
-    void deleteUsersByIds(List<Integer> ids);
-
-    /**
-     * insertUserSql
-     *
-     * @param user user
-     */
-    void insertUserSql(User user);
-
-    Integer selectAllCount();
-
-    List<KeyValue> selectByUserName(String userName);
-
-    List<User> selectByIds(List<Integer> ids);
-
-
-    User selectByWxOpenId(@Param("wxOpenId") String wxOpenId);
-}

+ 0 - 11
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/repository/UserTokenMapper.java

@@ -1,11 +0,0 @@
-package vip.xiaonuo.exam.repository;
-
-import vip.xiaonuo.exam.domain.UserToken;
-import org.apache.ibatis.annotations.Mapper;
-
-@Mapper
-public interface UserTokenMapper extends BaseMapper<UserToken> {
-
-    UserToken getToken(String token);
-
-}

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/QuestionService.java

@@ -11,7 +11,7 @@ public interface QuestionService extends BaseService<Question> {
 
     PageInfo<Question> page(QuestionPageRequestVM requestVM);
 
-    Question insertFullQuestion(QuestionEditRequestVM model, Integer userId);
+    Question insertFullQuestion(QuestionEditRequestVM model, String userId);
 
     Question updateFullQuestion(QuestionEditRequestVM model);
 

+ 2 - 2
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/TaskExamCustomerAnswerService.java

@@ -11,7 +11,7 @@ public interface TaskExamCustomerAnswerService extends BaseService<TaskExamCusto
 
     void insertOrUpdate(ExamPaper examPaper, ExamPaperAnswer examPaperAnswer, Date now);
 
-    TaskExamCustomerAnswer selectByTUid(Integer tid, Integer uid);
+    TaskExamCustomerAnswer selectByTUid(Integer tid, String uid);
 
-    List<TaskExamCustomerAnswer> selectByTUid(List<Integer> taskIds, Integer uid);
+    List<TaskExamCustomerAnswer> selectByTUid(List<Integer> taskIds, String uid);
 }

+ 0 - 128
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/UserService.java

@@ -1,128 +0,0 @@
-package vip.xiaonuo.exam.service;
-
-import vip.xiaonuo.exam.domain.other.KeyValue;
-import vip.xiaonuo.exam.domain.User;
-import vip.xiaonuo.exam.viewmodel.admin.user.UserPageRequestVM;
-import com.github.pagehelper.PageInfo;
-
-import java.util.List;
-
-
-public interface UserService extends BaseService<User> {
-
-    /**
-     * getUsers
-     *
-     * @return List<User>
-     */
-    List<User> getUsers();
-
-    /**
-     * getUserById
-     *
-     * @param id id
-     * @return User
-     */
-    User getUserById(Integer id);
-
-    /**
-     * getUserByUserName
-     *
-     * @param username username
-     * @return User
-     */
-    User getUserByUserName(String username);
-
-    /**
-     * getUserByUserName
-     *
-     * @param username username
-     * @param pwd      pwd
-     * @return User
-     */
-    User getUserByUserNamePwd(String username, String pwd);
-
-    /**
-     * getUserByUuid
-     *
-     * @param uuid uuid
-     * @return User
-     */
-    User getUserByUuid(String uuid);
-
-    /**
-     * userPageList
-     *
-     * @param name      name
-     * @param pageIndex pageIndex
-     * @param pageSize  pageSize
-     * @return List<User>
-     */
-    List<User> userPageList(String name, Integer pageIndex, Integer pageSize);
-
-
-    /**
-     * userPageCount
-     *
-     * @param name name
-     * @return Integer
-     */
-    Integer userPageCount(String name);
-
-
-    /**
-     * @param requestVM requestVM
-     * @return PageInfo<User>
-     */
-    PageInfo<User> userPage(UserPageRequestVM requestVM);
-
-
-    /**
-     * insertUser
-     *
-     * @param user user
-     */
-    void insertUser(User user);
-
-    /**
-     * insertUsers
-     *
-     * @param users users
-     */
-    void insertUsers(List<User> users);
-
-    /**
-     * updateUser
-     *
-     * @param user user
-     */
-    void updateUser(User user);
-
-    /**
-     * updateUsersAge
-     *
-     * @param age
-     * @param ids
-     */
-    void updateUsersAge(Integer age, List<Integer> ids);
-
-    /**
-     * deleteUserByIds
-     *
-     * @param ids
-     */
-    void deleteUserByIds(List<Integer> ids);
-
-
-    Integer selectAllCount();
-
-
-    List<KeyValue> selectByUserName(String userName);
-
-
-    List<User> selectByIds(List<Integer> ids);
-
-    User selectByWxOpenId(String wxOpenId);
-
-    void changePicture(User user, String imagePath);
-}

+ 0 - 46
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/UserTokenService.java

@@ -1,46 +0,0 @@
-package vip.xiaonuo.exam.service;
-
-import vip.xiaonuo.exam.domain.User;
-import vip.xiaonuo.exam.domain.UserToken;
-
-public interface UserTokenService extends BaseService<UserToken> {
-
-    /**
-     * 微信token绑定
-     *
-     * @param user user
-     * @return UserToken
-     */
-    UserToken bind(User user);
-
-    /**
-     * 检查微信openId是否绑定过
-     *
-     * @param openId openId
-     * @return UserToken
-     */
-    UserToken checkBind(String openId);
-
-    /**
-     * 根据token获取UserToken,带缓存的
-     *
-     * @param token token
-     * @return UserToken
-     */
-    UserToken getToken(String token);
-
-    /**
-     * 插入用户Token
-     *
-     * @param user user
-     * @return UserToken
-     */
-    UserToken insertUserToken(User user);
-
-    /**
-     * 微信小程序退出,清除缓存
-     *
-     * @param userToken userToken
-     */
-    void unBind(UserToken userToken);
-}

+ 0 - 62
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/AuthenticationServiceImpl.java

@@ -1,62 +0,0 @@
-package vip.xiaonuo.exam.service.impl;
-
-import vip.xiaonuo.exam.configuration.property.SystemConfig;
-import vip.xiaonuo.exam.domain.User;
-import vip.xiaonuo.exam.service.AuthenticationService;
-import vip.xiaonuo.exam.service.UserService;
-import vip.xiaonuo.exam.utility.RsaUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-
-@Service
-public class AuthenticationServiceImpl implements AuthenticationService {
-
-
-    private final UserService userService;
-    private final SystemConfig systemConfig;
-
-    @Autowired
-    public AuthenticationServiceImpl(UserService userService, SystemConfig systemConfig) {
-        this.userService = userService;
-        this.systemConfig = systemConfig;
-    }
-
-
-    /**
-     * @param username username
-     * @param password password
-     * @return boolean
-     */
-    @Override
-    public boolean authUser(String username, String password) {
-        User user = userService.getUserByUserName(username);
-        return authUser(user, username, password);
-    }
-
-
-    @Override
-    public boolean authUser(User user, String username, String password) {
-        if (user == null) {
-            return false;
-        }
-        String encodePwd = user.getPassword();
-        if (null == encodePwd || encodePwd.length() == 0) {
-            return false;
-        }
-        String pwd = pwdDecode(encodePwd);
-        return pwd.equals(password);
-    }
-
-    @Override
-    public String pwdEncode(String password) {
-        return RsaUtil.rsaEncode(systemConfig.getPwdKey().getPublicKey(), password);
-    }
-
-    @Override
-    public String pwdDecode(String encodePwd) {
-        return RsaUtil.rsaDecode(systemConfig.getPwdKey().getPrivateKey(), encodePwd);
-    }
-
-
-}

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/BaseServiceImpl.java

@@ -1,6 +1,6 @@
 package vip.xiaonuo.exam.service.impl;
 
-import vip.xiaonuo.exam.repository.BaseMapper;
+import vip.xiaonuo.exam.mapper.BaseMapper;
 import vip.xiaonuo.exam.service.BaseService;
 
 public abstract class BaseServiceImpl<T> implements BaseService<T> {

+ 5 - 5
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/ExamPaperAnswerServiceImpl.java

@@ -8,10 +8,10 @@ import vip.xiaonuo.exam.domain.exam.ExamPaperTitleItemObject;
 import vip.xiaonuo.exam.domain.other.KeyValue;
 import vip.xiaonuo.exam.domain.other.ExamPaperAnswerUpdate;
 import vip.xiaonuo.exam.domain.task.TaskItemAnswerObject;
-import vip.xiaonuo.exam.repository.ExamPaperAnswerMapper;
-import vip.xiaonuo.exam.repository.ExamPaperMapper;
-import vip.xiaonuo.exam.repository.QuestionMapper;
-import vip.xiaonuo.exam.repository.TaskExamCustomerAnswerMapper;
+import vip.xiaonuo.exam.mapper.ExamPaperAnswerMapper;
+import vip.xiaonuo.exam.mapper.ExamPaperMapper;
+import vip.xiaonuo.exam.mapper.QuestionMapper;
+import vip.xiaonuo.exam.mapper.TaskExamCustomerAnswerMapper;
 import vip.xiaonuo.exam.service.ExamPaperAnswerService;
 import vip.xiaonuo.exam.service.ExamPaperQuestionCustomerAnswerService;
 import vip.xiaonuo.exam.service.TextContentService;
@@ -130,7 +130,7 @@ public class ExamPaperAnswerServiceImpl extends BaseServiceImpl<ExamPaperAnswer>
                 //任务试卷批改完成后,需要更新任务的状态
                 ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(examPaperAnswer.getExamPaperId());
                 Integer taskId = examPaper.getTaskExamId();
-                Integer userId = examPaperAnswer.getCreateUser();
+                String userId = examPaperAnswer.getCreateUser();
                 TaskExamCustomerAnswer taskExamCustomerAnswer = taskExamCustomerAnswerMapper.getByTUid(taskId, userId);
                 TextContent textContent = textContentService.selectById(taskExamCustomerAnswer.getTextContentId());
                 List<TaskItemAnswerObject> taskItemAnswerObjects = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemAnswerObject.class);

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/ExamPaperQuestionCustomerAnswerServiceImpl.java

@@ -5,7 +5,7 @@ import vip.xiaonuo.exam.domain.other.ExamPaperAnswerUpdate;
 import vip.xiaonuo.exam.domain.other.KeyValue;
 import vip.xiaonuo.exam.domain.TextContent;
 import vip.xiaonuo.exam.domain.enums.QuestionTypeEnum;
-import vip.xiaonuo.exam.repository.ExamPaperQuestionCustomerAnswerMapper;
+import vip.xiaonuo.exam.mapper.ExamPaperQuestionCustomerAnswerMapper;
 import vip.xiaonuo.exam.service.ExamPaperQuestionCustomerAnswerService;
 import vip.xiaonuo.exam.service.TextContentService;
 import vip.xiaonuo.exam.utility.DateTimeUtil;

+ 2 - 2
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/ExamPaperServiceImpl.java

@@ -6,8 +6,8 @@ import vip.xiaonuo.exam.domain.enums.ExamPaperTypeEnum;
 import vip.xiaonuo.exam.domain.exam.ExamPaperQuestionItemObject;
 import vip.xiaonuo.exam.domain.exam.ExamPaperTitleItemObject;
 import vip.xiaonuo.exam.domain.other.KeyValue;
-import vip.xiaonuo.exam.repository.ExamPaperMapper;
-import vip.xiaonuo.exam.repository.QuestionMapper;
+import vip.xiaonuo.exam.mapper.ExamPaperMapper;
+import vip.xiaonuo.exam.mapper.QuestionMapper;
 import vip.xiaonuo.exam.service.ExamPaperService;
 import vip.xiaonuo.exam.service.QuestionService;
 import vip.xiaonuo.exam.service.SubjectService;

+ 0 - 48
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/FileUploadImpl.java

@@ -1,48 +0,0 @@
-package vip.xiaonuo.exam.service.impl;
-
-import vip.xiaonuo.exam.configuration.property.QnConfig;
-import vip.xiaonuo.exam.configuration.property.SystemConfig;
-import vip.xiaonuo.exam.service.FileUpload;
-import com.google.gson.Gson;
-import com.qiniu.common.QiniuException;
-import com.qiniu.http.Response;
-import com.qiniu.storage.Configuration;
-import com.qiniu.storage.Region;
-import com.qiniu.storage.UploadManager;
-import com.qiniu.storage.model.DefaultPutRet;
-import com.qiniu.util.Auth;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.io.InputStream;
-
-@Service
-public class FileUploadImpl implements FileUpload {
-    private final Logger logger = LoggerFactory.getLogger(FileUpload.class);
-    private final SystemConfig systemConfig;
-
-
-    @Autowired
-    public FileUploadImpl(SystemConfig systemConfig) {
-        this.systemConfig = systemConfig;
-    }
-
-    @Override
-    public String uploadFile(InputStream inputStream, long size, String extName) {
-        QnConfig qnConfig = systemConfig.getQn();
-        Configuration cfg = new Configuration(Region.region2());
-        UploadManager uploadManager = new UploadManager(cfg);
-        Auth auth = Auth.create(qnConfig.getAccessKey(), qnConfig.getSecretKey());
-        String upToken = auth.uploadToken(qnConfig.getBucket());
-        try {
-            Response response = uploadManager.put(inputStream, null, upToken, null, null);
-            DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
-            return qnConfig.getUrl() + "/" + putRet.key;
-        } catch (QiniuException ex) {
-            logger.error(ex.getMessage(), ex);
-        }
-        return null;
-    }
-}

+ 2 - 2
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/MessageServiceImpl.java

@@ -2,8 +2,8 @@ package vip.xiaonuo.exam.service.impl;
 
 import vip.xiaonuo.exam.domain.Message;
 import vip.xiaonuo.exam.domain.MessageUser;
-import vip.xiaonuo.exam.repository.MessageMapper;
-import vip.xiaonuo.exam.repository.MessageUserMapper;
+import vip.xiaonuo.exam.mapper.MessageMapper;
+import vip.xiaonuo.exam.mapper.MessageUserMapper;
 import vip.xiaonuo.exam.service.MessageService;
 import vip.xiaonuo.exam.viewmodel.admin.message.MessagePageRequestVM;
 import vip.xiaonuo.exam.viewmodel.student.user.MessageRequestVM;

+ 2 - 2
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/QuestionServiceImpl.java

@@ -7,7 +7,7 @@ import vip.xiaonuo.exam.domain.enums.QuestionStatusEnum;
 import vip.xiaonuo.exam.domain.enums.QuestionTypeEnum;
 import vip.xiaonuo.exam.domain.question.QuestionItemObject;
 import vip.xiaonuo.exam.domain.question.QuestionObject;
-import vip.xiaonuo.exam.repository.QuestionMapper;
+import vip.xiaonuo.exam.mapper.QuestionMapper;
 import vip.xiaonuo.exam.service.QuestionService;
 import vip.xiaonuo.exam.service.SubjectService;
 import vip.xiaonuo.exam.service.TextContentService;
@@ -55,7 +55,7 @@ public class QuestionServiceImpl extends BaseServiceImpl<Question> implements Qu
 
     @Override
     @Transactional
-    public Question insertFullQuestion(QuestionEditRequestVM model, Integer userId) {
+    public Question insertFullQuestion(QuestionEditRequestVM model, String userId) {
         Date now = new Date();
         Integer gradeLevel = subjectService.levelBySubjectId(model.getSubjectId());
 

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/SubjectServiceImpl.java

@@ -1,7 +1,7 @@
 package vip.xiaonuo.exam.service.impl;
 
 import vip.xiaonuo.exam.domain.Subject;
-import vip.xiaonuo.exam.repository.SubjectMapper;
+import vip.xiaonuo.exam.mapper.SubjectMapper;
 import vip.xiaonuo.exam.service.SubjectService;
 import vip.xiaonuo.exam.viewmodel.admin.education.SubjectPageRequestVM;
 import com.github.pagehelper.PageHelper;

+ 4 - 4
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/TaskExamCustomerAnswerImpl.java

@@ -5,7 +5,7 @@ import vip.xiaonuo.exam.domain.ExamPaperAnswer;
 import vip.xiaonuo.exam.domain.TaskExamCustomerAnswer;
 import vip.xiaonuo.exam.domain.TextContent;
 import vip.xiaonuo.exam.domain.task.TaskItemAnswerObject;
-import vip.xiaonuo.exam.repository.TaskExamCustomerAnswerMapper;
+import vip.xiaonuo.exam.mapper.TaskExamCustomerAnswerMapper;
 import vip.xiaonuo.exam.service.TaskExamCustomerAnswerService;
 import vip.xiaonuo.exam.service.TextContentService;
 import vip.xiaonuo.exam.utility.JsonUtil;
@@ -32,7 +32,7 @@ public class TaskExamCustomerAnswerImpl extends BaseServiceImpl<TaskExamCustomer
     @Override
     public void insertOrUpdate(ExamPaper examPaper, ExamPaperAnswer examPaperAnswer, Date now) {
         Integer taskId = examPaper.getTaskExamId();
-        Integer userId = examPaperAnswer.getCreateUser();
+        String userId = examPaperAnswer.getCreateUser();
         TaskExamCustomerAnswer taskExamCustomerAnswer = taskExamCustomerAnswerMapper.getByTUid(taskId, userId);
         if (null == taskExamCustomerAnswer) {
             taskExamCustomerAnswer = new TaskExamCustomerAnswer();
@@ -54,12 +54,12 @@ public class TaskExamCustomerAnswerImpl extends BaseServiceImpl<TaskExamCustomer
     }
 
     @Override
-    public TaskExamCustomerAnswer selectByTUid(Integer tid, Integer uid) {
+    public TaskExamCustomerAnswer selectByTUid(Integer tid, String uid) {
         return taskExamCustomerAnswerMapper.getByTUid(tid, uid);
     }
 
     @Override
-    public List<TaskExamCustomerAnswer> selectByTUid(List<Integer> taskIds, Integer uid) {
+    public List<TaskExamCustomerAnswer> selectByTUid(List<Integer> taskIds, String uid) {
         return taskExamCustomerAnswerMapper.selectByTUid(taskIds, uid);
     }
 }

+ 2 - 2
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/TaskExamServiceImpl.java

@@ -5,8 +5,8 @@ import vip.xiaonuo.exam.domain.TaskExam;
 import vip.xiaonuo.exam.domain.TextContent;
 import vip.xiaonuo.exam.domain.User;
 import vip.xiaonuo.exam.domain.task.TaskItemObject;
-import vip.xiaonuo.exam.repository.ExamPaperMapper;
-import vip.xiaonuo.exam.repository.TaskExamMapper;
+import vip.xiaonuo.exam.mapper.ExamPaperMapper;
+import vip.xiaonuo.exam.mapper.TaskExamMapper;
 import vip.xiaonuo.exam.service.TaskExamService;
 import vip.xiaonuo.exam.service.TextContentService;
 import vip.xiaonuo.exam.service.enums.ActionEnum;

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/TextContentServiceImpl.java

@@ -1,7 +1,7 @@
 package vip.xiaonuo.exam.service.impl;
 
 import vip.xiaonuo.exam.domain.TextContent;
-import vip.xiaonuo.exam.repository.TextContentMapper;
+import vip.xiaonuo.exam.mapper.TextContentMapper;
 import vip.xiaonuo.exam.service.TextContentService;
 import vip.xiaonuo.exam.utility.JsonUtil;
 import org.springframework.beans.factory.annotation.Autowired;

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/UserEventLogServiceImpl.java

@@ -2,7 +2,7 @@ package vip.xiaonuo.exam.service.impl;
 
 import vip.xiaonuo.exam.domain.UserEventLog;
 import vip.xiaonuo.exam.domain.other.KeyValue;
-import vip.xiaonuo.exam.repository.UserEventLogMapper;
+import vip.xiaonuo.exam.mapper.UserEventLogMapper;
 import vip.xiaonuo.exam.service.UserEventLogService;
 import vip.xiaonuo.exam.utility.DateTimeUtil;
 import vip.xiaonuo.exam.viewmodel.admin.user.UserEventPageRequestVM;

+ 0 - 160
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/UserServiceImpl.java

@@ -1,160 +0,0 @@
-package vip.xiaonuo.exam.service.impl;
-
-import vip.xiaonuo.exam.domain.other.KeyValue;
-import vip.xiaonuo.exam.exception.BusinessException;
-import vip.xiaonuo.exam.domain.User;
-import vip.xiaonuo.exam.event.OnRegistrationCompleteEvent;
-import vip.xiaonuo.exam.repository.UserMapper;
-import vip.xiaonuo.exam.service.UserService;
-import vip.xiaonuo.exam.viewmodel.admin.user.UserPageRequestVM;
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-
-@Service
-public class UserServiceImpl extends BaseServiceImpl<User> implements UserService {
-
-    private final UserMapper userMapper;
-    private final ApplicationEventPublisher eventPublisher;
-
-    @Autowired
-    public UserServiceImpl(UserMapper userMapper, ApplicationEventPublisher eventPublisher) {
-        super(userMapper);
-        this.userMapper = userMapper;
-        this.eventPublisher = eventPublisher;
-    }
-
-
-    @Override
-    public List<User> getUsers() {
-        return userMapper.getAllUser();
-    }
-
-    @Override
-    public User getUserById(Integer id) {
-        return userMapper.getUserById(id);
-    }
-
-    @Override
-    public User getUserByUserName(String username) {
-        return userMapper.getUserByUserName(username);
-    }
-
-    @Override
-    public int insertByFilter(User record) {
-        return super.insertByFilter(record);
-    }
-
-    @Override
-    public int updateByIdFilter(User record) {
-        return super.updateByIdFilter(record);
-    }
-
-    @Override
-    public int updateById(User record) {
-        return super.updateById(record);
-    }
-
-    @Override
-    public User getUserByUserNamePwd(String username, String pwd) {
-        return userMapper.getUserByUserNamePwd(username, pwd);
-    }
-
-    @Override
-    public User getUserByUuid(String uuid) {
-        return userMapper.getUserByUuid(uuid);
-    }
-
-    @Override
-    public List<User> userPageList(String name, Integer pageIndex, Integer pageSize) {
-        Map<String, Object> map = new HashMap<>(3);
-        map.put("name", name);
-        map.put("offset", ((int) pageIndex) * pageSize);
-        map.put("limit", pageSize);
-        return userMapper.userPageList(map);
-    }
-
-    @Override
-    public Integer userPageCount(String name) {
-        Map<String, Object> map = new HashMap<>(1);
-        map.put("name", name);
-        return userMapper.userPageCount(map);
-    }
-
-
-    @Override
-    public PageInfo<User> userPage(UserPageRequestVM requestVM) {
-        return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() ->
-                userMapper.userPage(requestVM)
-        );
-    }
-
-
-    @Override
-    public void insertUser(User user) {
-        userMapper.insertSelective(user);
-        eventPublisher.publishEvent(new OnRegistrationCompleteEvent(user));
-    }
-
-    @Override
-    @Transactional(rollbackFor = BusinessException.class)
-    public void insertUsers(List<User> users) {
-        userMapper.insertUsers(users);
-        throw new BusinessException("test BusinessException roll back");
-    }
-
-    @Override
-    public void updateUser(User user) {
-        userMapper.updateUser(user);
-    }
-
-    @Override
-    public void updateUsersAge(Integer age, List<Integer> ids) {
-        Map<String, Object> map = new HashMap<>(2);
-        map.put("idslist", ids);
-        map.put("age", age);
-        userMapper.updateUsersAge(map);
-    }
-
-    @Override
-    public void deleteUserByIds(List<Integer> ids) {
-        userMapper.deleteUsersByIds(ids);
-    }
-
-    @Override
-    public Integer selectAllCount() {
-        return userMapper.selectAllCount();
-    }
-
-    @Override
-    public List<KeyValue> selectByUserName(String userName) {
-        return userMapper.selectByUserName(userName);
-    }
-
-    @Override
-    public List<User> selectByIds(List<Integer> ids) {
-        return userMapper.selectByIds(ids);
-    }
-
-    @Override
-    public User selectByWxOpenId(String wxOpenId) {
-        return userMapper.selectByWxOpenId(wxOpenId);
-    }
-
-    @Override
-    @Transactional
-    public void changePicture(User user, String imagePath) {
-        User changePictureUser = new User();
-        changePictureUser.setId(user.getId());
-        changePictureUser.setImagePath(imagePath);
-        userMapper.updateByPrimaryKeySelective(changePictureUser);
-    }
-}

Някои файлове не бяха показани, защото твърде много файлове са промени