Browse Source

Merge branch 'wn'

# Conflicts:
#	sstudy/src/main/java/com/xhkjedu/sstudy/interceptors/RequestInterceptor.java
#	sstudy/src/main/resources/application.properties
tags/正式3.13.0
王宁 1 year ago
parent
commit
05aec62a7c
100 changed files with 2357 additions and 896 deletions
  1. 3
    2
      README.md
  2. 25
    0
      gateway/pom.xml
  3. 3
    3
      gateway/src/main/java/com/xhkjedu/gateway/GatewayApplication.java
  4. 58
    0
      gateway/src/main/java/com/xhkjedu/gateway/advice/GlobalExceptionHandlerAdvice.java
  5. 14
    0
      gateway/src/main/java/com/xhkjedu/gateway/config/ConfigKey.java
  6. 68
    0
      gateway/src/main/java/com/xhkjedu/gateway/config/SpringContextHolder.java
  7. 14
    0
      gateway/src/main/java/com/xhkjedu/gateway/exceptions/GatewayException.java
  8. 58
    0
      gateway/src/main/java/com/xhkjedu/gateway/handler/ErrorHandlerConfiguration.java
  9. 156
    0
      gateway/src/main/java/com/xhkjedu/gateway/handler/ExceptionHandlerCore.java
  10. 84
    0
      gateway/src/main/java/com/xhkjedu/gateway/handler/GlobalExceptionHandler.java
  11. 106
    23
      gateway/src/main/java/com/xhkjedu/gateway/interceptors/DecryptRequestionBodyFilter.java
  12. 24
    0
      gateway/src/main/java/com/xhkjedu/gateway/mapper/ModuleCheckMapper.java
  13. 22
    0
      gateway/src/main/java/com/xhkjedu/gateway/model/TModuleCheck.java
  14. 128
    0
      gateway/src/main/java/com/xhkjedu/gateway/utils/ApiUtil.java
  15. 123
    0
      gateway/src/main/java/com/xhkjedu/gateway/utils/JedisUtil.java
  16. 20
    0
      gateway/src/main/java/com/xhkjedu/gateway/vo/SchoolVo.java
  17. 69
    0
      gateway/src/main/resources/application.properties
  18. 23
    0
      gateway/src/main/resources/mapper/ModuleCheckMapper.xml
  19. 1
    0
      gateway/src/test/java/com/xhkjedu/gateway/GatewayApplicationTests.java
  20. 6
    0
      pom.xml
  21. 4
    1
      register/src/main/resources/application.properties
  22. 0
    6
      sapi/pom.xml
  23. 2
    2
      sapi/src/main/java/com/xhkjedu/sapi/SapiApplication.java
  24. 208
    0
      sapi/src/main/java/com/xhkjedu/sapi/aop/WebControllerAop.java
  25. 14
    13
      sapi/src/main/java/com/xhkjedu/sapi/config/ConfigKey.java
  26. 9
    0
      sapi/src/main/java/com/xhkjedu/sapi/config/RabbitConfig.java
  27. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppLiveController.java
  28. 3
    3
      sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppMonitorController.java
  29. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppRecordController.java
  30. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppScanController.java
  31. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppStuappController.java
  32. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppTeacherappController.java
  33. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppTeacherclientController.java
  34. 7
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppthirdController.java
  35. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppthirdManagerController.java
  36. 3
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppthirdMonitorController.java
  37. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/WebVersionController.java
  38. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/assess/AssessController.java
  39. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/assess/AssessQuotaController.java
  40. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/assess/AssessTemplateController.java
  41. 6
    2
      sapi/src/main/java/com/xhkjedu/sapi/controller/assess/AssessUserController.java
  42. 3
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/cloud/CloudController.java
  43. 14
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/cloud/CloudSyncController.java
  44. 3
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/dock/LcController.java
  45. 5
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/itemtool/ReadController.java
  46. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/itemtool/TodoController.java
  47. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/notice/NoticeController.java
  48. 5
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/research/ResearchController.java
  49. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/research/ResearchUserController.java
  50. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/system/AreazoneController.java
  51. 7
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/system/ModuleController.java
  52. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/system/ModuledefaultController.java
  53. 3
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/system/PictureController.java
  54. 7
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/system/SchoolController.java
  55. 18
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/system/SchoolStypeController.java
  56. 2
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/system/SyserrorController.java
  57. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/system/UserModuleController.java
  58. 0
    31
      sapi/src/main/java/com/xhkjedu/sapi/interceptors/HttpServletFilter.java
  59. 0
    131
      sapi/src/main/java/com/xhkjedu/sapi/interceptors/RequestInterceptor.java
  60. 0
    78
      sapi/src/main/java/com/xhkjedu/sapi/interceptors/RequestWrapper.java
  61. 0
    62
      sapi/src/main/java/com/xhkjedu/sapi/interceptors/WebMvcConfg.java
  62. 28
    0
      sapi/src/main/java/com/xhkjedu/sapi/listener/HandleLogSender.java
  63. 3
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/analyze/SchoolResourceMapper.java
  64. 3
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/cloud/CloudSyncMapper.java
  65. 7
    2
      sapi/src/main/java/com/xhkjedu/sapi/mapper/system/UserMapper.java
  66. 4
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/cloud/TCloudSync.java
  67. 16
    0
      sapi/src/main/java/com/xhkjedu/sapi/service/analyze/SchoolResourceService.java
  68. 1
    1
      sapi/src/main/java/com/xhkjedu/sapi/service/appversion/AppthirdService.java
  69. 8
    8
      sapi/src/main/java/com/xhkjedu/sapi/service/classreport/ClassReportService.java
  70. 20
    6
      sapi/src/main/java/com/xhkjedu/sapi/service/cloud/CloudSyncService.java
  71. 3
    3
      sapi/src/main/java/com/xhkjedu/sapi/service/dock/LcService.java
  72. 2
    2
      sapi/src/main/java/com/xhkjedu/sapi/service/region/RPaperAnalyzeService.java
  73. 28
    0
      sapi/src/main/java/com/xhkjedu/sapi/service/system/SchoolStypeService.java
  74. 2
    2
      sapi/src/main/java/com/xhkjedu/sapi/vo/analyze/SchoolResourceTypeNumVo.java
  75. 0
    116
      sapi/src/main/java/com/xhkjedu/sapi/vo/system/UserVo.java
  76. 15
    18
      sapi/src/main/resources/application.properties
  77. 88
    50
      sapi/src/main/resources/mapper/analyze/SchoolResourceMapper.xml
  78. 24
    22
      sapi/src/main/resources/mapper/analyze/SchoolRoomMapper.xml
  79. 30
    26
      sapi/src/main/resources/mapper/analyze/SchoolSummaryMapper.xml
  80. 32
    28
      sapi/src/main/resources/mapper/analyze/SchoolTaskMapper.xml
  81. 38
    33
      sapi/src/main/resources/mapper/classreport/ClassReportMapper.xml
  82. 23
    2
      sapi/src/main/resources/mapper/cloud/CloudSyncMapper.xml
  83. 15
    15
      sapi/src/main/resources/mapper/itemtool/StudentTodoMapper.xml
  84. 37
    28
      sapi/src/main/resources/mapper/region/RPaperAnalyzeMapper.xml
  85. 42
    21
      sapi/src/main/resources/mapper/region/RResourceAnalyzeMapper.xml
  86. 11
    10
      sapi/src/main/resources/mapper/region/RRoomAnalyzeMapper.xml
  87. 53
    37
      sapi/src/main/resources/mapper/region/RegionAnalyzeMapper.xml
  88. 38
    18
      sapi/src/main/resources/mapper/region/RegionResourceMapper.xml
  89. 40
    25
      sapi/src/main/resources/mapper/region/SAnalyzeMapper.xml
  90. 47
    25
      sapi/src/main/resources/mapper/region/SResourceMapper.xml
  91. 1
    1
      sapi/src/main/resources/mapper/system/SchoolMapper.xml
  92. 12
    2
      sapi/src/main/resources/mapper/system/UserMapper.xml
  93. 2
    2
      sclass/src/main/java/com/xhkjedu/sclass/SclassApplication.java
  94. 208
    0
      sclass/src/main/java/com/xhkjedu/sclass/aop/WebControllerAop.java
  95. 28
    0
      sclass/src/main/java/com/xhkjedu/sclass/config/ConfigKey.java
  96. 24
    0
      sclass/src/main/java/com/xhkjedu/sclass/config/RabbitConfig.java
  97. 24
    1
      sclass/src/main/java/com/xhkjedu/sclass/controller/classroom/ClassroomController.java
  98. 4
    0
      sclass/src/main/java/com/xhkjedu/sclass/controller/classroom/ClassroomVideoController.java
  99. 0
    35
      sclass/src/main/java/com/xhkjedu/sclass/interceptors/HttpServletFilter.java
  100. 0
    0
      sclass/src/main/java/com/xhkjedu/sclass/interceptors/RequestInterceptor.java

+ 3
- 2
README.md View File

@@ -7,8 +7,9 @@ sexam考试
7 7
 slive直播  
8 8
 sstudy作业相  
9 9
 suser用户  
10
-sapi分析及其他  
11
-scommons公共   
10
+sapi分析及其他
11
+slog操作日志
12
+scommons公共
12 13
 
13 14
 资源说明   version 版本  
14 15
 subject 科目  

+ 25
- 0
gateway/pom.xml View File

@@ -43,7 +43,32 @@
43 43
             <groupId>org.springframework</groupId>
44 44
             <artifactId>spring-webmvc</artifactId>
45 45
         </dependency>
46
+        <dependency>
47
+            <groupId>com.alibaba</groupId>
48
+            <artifactId>fastjson</artifactId>
49
+            <version>1.2.56</version>
50
+        </dependency>
51
+         <!--redis -->
52
+        <dependency>
53
+            <groupId>redis.clients</groupId>
54
+            <artifactId>jedis</artifactId>
55
+            <version>2.9.3</version>
56
+        </dependency>
57
+        <dependency>
58
+            <groupId>org.springframework.boot</groupId>
59
+            <artifactId>spring-boot-starter-data-redis</artifactId>
60
+        </dependency>
46 61
 
62
+        <dependency>
63
+            <groupId>mysql</groupId>
64
+            <artifactId>mysql-connector-java</artifactId>
65
+        </dependency>
66
+        <!-- https://mvnrepository.com/artifact/tk.mybatis/mapper-spring-boot-starter -->
67
+        <dependency>
68
+            <groupId>tk.mybatis</groupId>
69
+            <artifactId>mapper-spring-boot-starter</artifactId>
70
+            <version>2.0.2</version>
71
+        </dependency>
47 72
     </dependencies>
48 73
     <dependencyManagement>
49 74
         <dependencies>

+ 3
- 3
gateway/src/main/java/com/xhkjedu/gateway/GatewayApplication.java View File

@@ -2,10 +2,10 @@ package com.xhkjedu.gateway;
2 2
 
3 3
 import org.springframework.boot.SpringApplication;
4 4
 import org.springframework.boot.autoconfigure.SpringBootApplication;
5
-import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
5
+import tk.mybatis.spring.annotation.MapperScan;
6 6
 
7
-@SpringBootApplication
8
-@EnableEurekaClient
7
+@SpringBootApplication(scanBasePackages = "com.xhkjedu")
8
+@MapperScan("com.xhkjedu.gateway.mapper")
9 9
 public class GatewayApplication {
10 10
 
11 11
     public static void main(String[] args) {

+ 58
- 0
gateway/src/main/java/com/xhkjedu/gateway/advice/GlobalExceptionHandlerAdvice.java View File

@@ -0,0 +1,58 @@
1
+package com.xhkjedu.gateway.advice;
2
+
3
+import com.google.common.base.Throwables;
4
+import com.xhkjedu.gateway.exceptions.GatewayException;
5
+import lombok.AllArgsConstructor;
6
+import lombok.Data;
7
+import lombok.extern.slf4j.Slf4j;
8
+import org.springframework.web.bind.annotation.ExceptionHandler;
9
+import org.springframework.web.bind.annotation.RestControllerAdvice;
10
+import org.springframework.web.server.ResponseStatusException;
11
+
12
+import java.net.ConnectException;
13
+
14
+/**
15
+ * @Description 这个不是SpringMVC统一异常处理(具体说明详见:ExceptionHandlerCore)
16
+ * @Author: YWX
17
+ * @Date 2023/11/15 17:52
18
+ **/
19
+@Slf4j
20
+@RestControllerAdvice
21
+public class GlobalExceptionHandlerAdvice {
22
+
23
+    @ExceptionHandler(GatewayException.class)
24
+    public ResultVo handler(GatewayException e) {
25
+        return new ResultVo(e.getCode(), e.getMsg());
26
+    }
27
+
28
+    @ExceptionHandler(ResponseStatusException.class)
29
+    public ResultVo handler(ResponseStatusException e) {
30
+        return new ResultVo(1, e.getReason());
31
+    }
32
+
33
+    @ExceptionHandler(ConnectException.class)
34
+    public ResultVo handler(ConnectException e) {
35
+        log.error(Throwables.getStackTraceAsString(e));
36
+        return new ResultVo(1, "网络异常,请稍候再试!");
37
+    }
38
+
39
+    @ExceptionHandler(Throwable.class)
40
+    public ResultVo handler(Throwable e) {
41
+        log.error(Throwables.getStackTraceAsString(e));
42
+        return new ResultVo(1, "服务器异常");
43
+    }
44
+
45
+}
46
+
47
+@Data
48
+@AllArgsConstructor
49
+class ResultVo{
50
+    private Integer code;// 返回是否成功  0成功 1失败
51
+    private String msg;// 返回提示信息
52
+    private Object obj;// 返回对象或者对象列表
53
+
54
+    public ResultVo(int code, String msg) {
55
+        this.code = code;
56
+        this.msg = msg;
57
+    }
58
+}

+ 14
- 0
gateway/src/main/java/com/xhkjedu/gateway/config/ConfigKey.java View File

@@ -17,4 +17,18 @@ public class ConfigKey {
17 17
         ConfigKey.rqovertime = rqovertime;
18 18
     }
19 19
 
20
+    public static Integer redisumtime;//缓存用户权限模块有效时长
21
+
22
+    @Value("${redisumtime}")
23
+    public void setRedisumtime(Integer redisumtime) {
24
+        ConfigKey.redisumtime = redisumtime;
25
+    }
26
+
27
+    public static Integer redismoduletime;//缓存模块对应操作有效时长
28
+
29
+    @Value("${redismoduletime}")
30
+    public void setRedismoduletime(Integer redismoduletime) {
31
+        ConfigKey.redismoduletime = redismoduletime;
32
+    }
33
+
20 34
 }

+ 68
- 0
gateway/src/main/java/com/xhkjedu/gateway/config/SpringContextHolder.java View File

@@ -0,0 +1,68 @@
1
+package com.xhkjedu.gateway.config;
2
+
3
+import org.springframework.beans.BeansException;
4
+import org.springframework.context.ApplicationContext;
5
+import org.springframework.context.ApplicationContextAware;
6
+import org.springframework.stereotype.Component;
7
+
8
+import java.lang.annotation.Annotation;
9
+import java.util.Map;
10
+
11
+@Component
12
+public class SpringContextHolder implements ApplicationContextAware {
13
+
14
+    private static ApplicationContext applicationContext;
15
+
16
+    @Override
17
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
18
+        SpringContextHolder.applicationContext = applicationContext;
19
+    }
20
+
21
+    public static ApplicationContext getApplicationContext() {
22
+        assertApplicationContext();
23
+        return applicationContext;
24
+    }
25
+
26
+    /**
27
+     * 通过实例类型获取实例
28
+     *
29
+     * @param requiredType 实例类型
30
+     * @param <T>          T
31
+     * @return T
32
+     */
33
+    public static <T> T getBean(Class<T> requiredType) {
34
+        assertApplicationContext();
35
+        return applicationContext.getBean(requiredType);
36
+    }
37
+
38
+    /**
39
+     * 通过实例,名称获取实例
40
+     *
41
+     * @param beanName 实例名称
42
+     * @param <T>      T
43
+     * @return T
44
+     */
45
+    @SuppressWarnings("unchecked")
46
+    public static <T> T getBean(String beanName) {
47
+        assertApplicationContext();
48
+        return (T) applicationContext.getBean(beanName);
49
+    }
50
+
51
+    /**
52
+     * 通过类上的注解获取类
53
+     *
54
+     * @param annotation anno
55
+     * @return map
56
+     */
57
+    public static Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotation) {
58
+        assertApplicationContext();
59
+        return applicationContext.getBeansWithAnnotation(annotation);
60
+    }
61
+
62
+    private static void assertApplicationContext() {
63
+        if (SpringContextHolder.applicationContext == null) {
64
+            throw new RuntimeException("application Context属性为null,请检查是否注入了SpringContextHolder!");
65
+        }
66
+    }
67
+
68
+}

+ 14
- 0
gateway/src/main/java/com/xhkjedu/gateway/exceptions/GatewayException.java View File

@@ -0,0 +1,14 @@
1
+package com.xhkjedu.gateway.exceptions;
2
+
3
+import lombok.Getter;
4
+
5
+@Getter
6
+public class GatewayException extends RuntimeException {
7
+    private Integer code;
8
+    private String msg;
9
+
10
+    public GatewayException(Integer code, String msg) {
11
+        this.code = code;
12
+        this.msg = msg;
13
+    }
14
+}

+ 58
- 0
gateway/src/main/java/com/xhkjedu/gateway/handler/ErrorHandlerConfiguration.java View File

@@ -0,0 +1,58 @@
1
+package com.xhkjedu.gateway.handler;
2
+
3
+import org.springframework.beans.factory.ObjectProvider;
4
+import org.springframework.boot.autoconfigure.web.ServerProperties;
5
+import org.springframework.boot.autoconfigure.web.WebProperties;
6
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
7
+import org.springframework.boot.web.reactive.error.ErrorAttributes;
8
+import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler;
9
+import org.springframework.context.ApplicationContext;
10
+import org.springframework.context.annotation.Bean;
11
+import org.springframework.core.annotation.Order;
12
+import org.springframework.http.codec.ServerCodecConfigurer;
13
+import org.springframework.stereotype.Component;
14
+import org.springframework.web.reactive.result.view.ViewResolver;
15
+
16
+import java.util.Collections;
17
+import java.util.List;
18
+
19
+@Component
20
+@EnableConfigurationProperties({ServerProperties.class, WebProperties.class})
21
+public class ErrorHandlerConfiguration {
22
+
23
+    private final ServerProperties serverProperties;
24
+
25
+    private final ApplicationContext applicationContext;
26
+
27
+    private final WebProperties resourceProperties;
28
+
29
+    private final List<ViewResolver> viewResolvers;
30
+
31
+    private final ServerCodecConfigurer serverCodecConfigurer;
32
+
33
+    public ErrorHandlerConfiguration(ServerProperties serverProperties,
34
+                                     WebProperties resourceProperties,
35
+                                     ObjectProvider<List<ViewResolver>> viewResolversProvider,
36
+                                     ServerCodecConfigurer configurer,
37
+                                     ApplicationContext applicationContext) {
38
+        this.serverProperties = serverProperties;
39
+        this.applicationContext = applicationContext;
40
+        this.resourceProperties = resourceProperties;
41
+        this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList);
42
+        this.serverCodecConfigurer = configurer;
43
+    }
44
+
45
+    @Bean
46
+    @Order
47
+    public ErrorWebExceptionHandler errorWebExceptionHandler(ErrorAttributes attributes) {
48
+        GlobalExceptionHandler exceptionHandler = new GlobalExceptionHandler(
49
+                attributes,
50
+                this.resourceProperties,
51
+                this.serverProperties.getError(),
52
+                this.applicationContext);
53
+        exceptionHandler.setViewResolvers(this.viewResolvers);
54
+        exceptionHandler.setMessageWriters(this.serverCodecConfigurer.getWriters());
55
+        exceptionHandler.setMessageReaders(this.serverCodecConfigurer.getReaders());
56
+        return exceptionHandler;
57
+    }
58
+}

+ 156
- 0
gateway/src/main/java/com/xhkjedu/gateway/handler/ExceptionHandlerCore.java View File

@@ -0,0 +1,156 @@
1
+package com.xhkjedu.gateway.handler;
2
+
3
+import com.google.common.collect.Maps;
4
+import com.xhkjedu.gateway.config.SpringContextHolder;
5
+import lombok.extern.slf4j.Slf4j;
6
+import org.springframework.boot.ApplicationArguments;
7
+import org.springframework.boot.ApplicationRunner;
8
+import org.springframework.http.HttpStatus;
9
+import org.springframework.stereotype.Component;
10
+import org.springframework.web.bind.annotation.*;
11
+
12
+import java.lang.reflect.InvocationTargetException;
13
+import java.lang.reflect.Method;
14
+import java.util.*;
15
+
16
+/**
17
+ * @Description 虽然spring webflux支持springMVC注解,
18
+ *但是,Filter抛出的异常不属于MVC层,所以,处理Filter抛出的异常依旧不能用SpringMVC那一套注解
19
+ *但是我们可以自己模仿做一套和MVC类似的注解
20
+ *该处理类使用SpringMVC的注解
21
+ *让用户可以无感知的像处理MVC层抛出的异常那样处理Filter抛出的异常
22
+ * @Author: YWX
23
+ * @Date 2023/11/16 8:56
24
+ **/
25
+@Slf4j
26
+@Component
27
+public class ExceptionHandlerCore implements ApplicationRunner {
28
+
29
+    /**
30
+     * key是处理异常的类型
31
+     * value是处理异常的方法
32
+     */
33
+    private LinkedHashMap<Class<? extends Throwable>, Node> exceptionHandlerMap;
34
+
35
+    /**
36
+     * 解析类上的注解
37
+     * 将处理异常的方法注册到map中
38
+     */
39
+    private void register(Object exceptionAdvice) {
40
+        Method[] methods = exceptionAdvice.getClass().getMethods();
41
+        Arrays.stream(methods).forEach(method -> {
42
+            ExceptionHandler exceptionHandler = method.getAnnotation(ExceptionHandler.class);
43
+            if (Objects.isNull(exceptionHandler)) {
44
+                return;
45
+            }
46
+            ResponseStatus responseStatus = method.getAnnotation(ResponseStatus.class);
47
+            HttpStatus status = null;
48
+            if (Objects.nonNull(responseStatus)) {
49
+                status = responseStatus.value();
50
+            }
51
+            HttpStatus finalStatus = status;
52
+            Arrays.asList(exceptionHandler.value()).forEach(a -> exceptionHandlerMap.put(a, new Node(method, exceptionAdvice, finalStatus)));
53
+        });
54
+    }
55
+
56
+    /**
57
+     * 根据异常对象获取解决异常的方法
58
+     *
59
+     * @param throwable 异常对象
60
+     * @return handler method
61
+     */
62
+    private Node getHandlerExceptionMethodNode(Throwable throwable) {
63
+        ArrayList<Class<?>> superClass = this.getSuperClass(throwable.getClass());
64
+        for (Class<?> aClass : superClass) {
65
+            Node handlerNode = null;
66
+            if ((handlerNode = exceptionHandlerMap.get(aClass)) != null) {
67
+                return handlerNode;
68
+            }
69
+        }
70
+        return null;
71
+    }
72
+
73
+    @Override
74
+    public void run(ApplicationArguments args) throws Exception {
75
+        Map<String, Object> beans = SpringContextHolder.getBeansWithAnnotation(RestControllerAdvice.class);
76
+        log.info("-------------异常处理对象获取完毕-------------");
77
+        exceptionHandlerMap = Maps.newLinkedHashMapWithExpectedSize(beans.size());
78
+        log.info("-------------异常处理容器内存分配完毕-------------");
79
+        beans.keySet()
80
+             .stream()
81
+             .map(beans::get)
82
+             .forEach(this::register);
83
+        log.info("-------------异常处理方法注册完毕-------------");
84
+    }
85
+
86
+    /**
87
+     * 对外暴露的处理异常的方法
88
+     *
89
+     * @param throwable 处理的异常
90
+     * @return 调用异常后的返回值
91
+     */
92
+    public HashMap<String, Object> handlerException(Throwable throwable) {
93
+        Node exceptionMethodNode = this.getHandlerExceptionMethodNode(throwable);
94
+        if (Objects.isNull(exceptionMethodNode)) {
95
+            log.error("未定义异常处理方法,处理异常失败,异常处理信息如下:{}", throwable.getMessage());
96
+            throw new RuntimeException("未定义异常处理方法,处理异常失败");
97
+        }
98
+        /**
99
+         * 本人水平有限。
100
+         * 现在支持持一个入参类型类{@link Throwable}
101
+         * 后人可以随意扩展~
102
+         */
103
+        Object returnResult = null;
104
+        try {
105
+            returnResult = exceptionMethodNode.method.invoke(exceptionMethodNode.thisObj, throwable);
106
+        } catch (IllegalAccessException | InvocationTargetException e) {
107
+            e.printStackTrace();
108
+        }
109
+        HashMap<String, Object> resultMap = Maps.newHashMapWithExpectedSize(2);
110
+        resultMap.put("status", exceptionMethodNode.status);
111
+        resultMap.put("result", returnResult);
112
+        return resultMap;
113
+    }
114
+
115
+    /**
116
+     * 用于存放方法和方法所在的实例
117
+     */
118
+    private static class Node {
119
+        Node(Method method, Object thisObj, HttpStatus status) {
120
+            this.method = method;
121
+            this.thisObj = thisObj;
122
+            this.status = status;
123
+        }
124
+
125
+        /**
126
+         * 状态码
127
+         */
128
+        HttpStatus status;
129
+        /**
130
+         * 处理异常的方法
131
+         */
132
+        Method method;
133
+        /**
134
+         * 方法所在的实例
135
+         */
136
+        Object thisObj;
137
+    }
138
+
139
+
140
+    /**
141
+     * 获取该类的class以及所有父的class
142
+     *
143
+     * @param clazz this.class
144
+     * @return list
145
+     */
146
+    public ArrayList<Class<?>> getSuperClass(Class<?> clazz) {
147
+        ArrayList<Class<?>> classes = new ArrayList<>();
148
+        classes.add(clazz);
149
+        Class<?> suCl = clazz.getSuperclass();
150
+        while (suCl != null) {
151
+            classes.add(suCl);
152
+            suCl = suCl.getSuperclass();
153
+        }
154
+        return classes;
155
+    }
156
+}

+ 84
- 0
gateway/src/main/java/com/xhkjedu/gateway/handler/GlobalExceptionHandler.java View File

@@ -0,0 +1,84 @@
1
+package com.xhkjedu.gateway.handler;
2
+
3
+import lombok.extern.slf4j.Slf4j;
4
+import org.springframework.boot.autoconfigure.web.ErrorProperties;
5
+import org.springframework.boot.autoconfigure.web.WebProperties;
6
+import org.springframework.boot.autoconfigure.web.reactive.error.DefaultErrorWebExceptionHandler;
7
+import org.springframework.boot.web.error.ErrorAttributeOptions;
8
+import org.springframework.boot.web.reactive.error.ErrorAttributes;
9
+import org.springframework.context.ApplicationContext;
10
+import org.springframework.http.HttpStatus;
11
+import org.springframework.http.MediaType;
12
+import org.springframework.web.reactive.function.BodyInserters;
13
+import org.springframework.web.reactive.function.server.*;
14
+import reactor.core.publisher.Mono;
15
+
16
+import javax.annotation.Resource;
17
+import java.util.Map;
18
+import java.util.Objects;
19
+
20
+/**
21
+ * @Description 全局异常处理
22
+ * @Author: YWX
23
+ * @Date 2023/11/16 8:57
24
+ **/
25
+@Slf4j
26
+public class GlobalExceptionHandler extends DefaultErrorWebExceptionHandler {
27
+
28
+    @Resource
29
+    private ExceptionHandlerCore handlerCore;
30
+
31
+
32
+    public GlobalExceptionHandler(ErrorAttributes errorAttributes, WebProperties webProperties, ErrorProperties errorProperties, ApplicationContext applicationContext) {
33
+        super(errorAttributes, webProperties.getResources(), errorProperties, applicationContext);
34
+    }
35
+
36
+    /**
37
+     * 统一处理异常信息
38
+     */
39
+    @Override
40
+    @SuppressWarnings(value = "unchecked")
41
+    protected Map<String, Object> getErrorAttributes(ServerRequest request, boolean includeStackTrace) {
42
+        Throwable error = super.getError(request);
43
+        //调用处理异常的方法,并将对象转换成map
44
+        return handlerCore.handlerException(error);
45
+    }
46
+
47
+    /**
48
+     * Extract the error attributes from the current request, to be used to populate error
49
+     * views or JSON payloads.
50
+     *
51
+     * @param request the source request
52
+     * @param options options to control error attributes
53
+     * @return the error attributes as a Map
54
+     */
55
+    @Override
56
+    protected Map<String, Object> getErrorAttributes(ServerRequest request, ErrorAttributeOptions options) {
57
+        Throwable error = super.getError(request);
58
+        return handlerCore.handlerException(error);
59
+    }
60
+
61
+    @Override
62
+    protected RouterFunction<ServerResponse> getRoutingFunction(ErrorAttributes errorAttributes) {
63
+        return RouterFunctions.route(RequestPredicates.all(), this::renderErrorResponse);
64
+    }
65
+
66
+    @Override
67
+    protected Mono<ServerResponse> renderErrorResponse(ServerRequest request) {
68
+        boolean includeStackTrace = isIncludeStackTrace(request, MediaType.ALL);
69
+        Map<String, Object> error = getErrorAttributes(request, includeStackTrace);
70
+        return ServerResponse
71
+                .status(getHttpStatus(error))
72
+                .contentType(MediaType.APPLICATION_JSON_UTF8)
73
+                .body(BodyInserters.fromObject(error.get("result")));
74
+    }
75
+
76
+    @Override
77
+    protected int getHttpStatus(Map<String, Object> errorAttributes) {
78
+        HttpStatus status = (HttpStatus) errorAttributes.get("status");
79
+        if (Objects.isNull(status)) {
80
+            return HttpStatus.OK.value();
81
+        }
82
+        return status.value();
83
+    }
84
+}

+ 106
- 23
gateway/src/main/java/com/xhkjedu/gateway/interceptors/DecryptRequestionBodyFilter.java View File

@@ -1,8 +1,17 @@
1 1
 package com.xhkjedu.gateway.interceptors;
2 2
 
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.gateway.config.ConfigKey;
5
+import com.xhkjedu.gateway.exceptions.GatewayException;
6
+import com.xhkjedu.gateway.mapper.ModuleCheckMapper;
7
+import com.xhkjedu.gateway.model.TModuleCheck;
3 8
 import com.xhkjedu.gateway.utils.AES;
9
+import com.xhkjedu.gateway.utils.ApiUtil;
10
+import com.xhkjedu.gateway.utils.JedisUtil;
11
+import com.xhkjedu.gateway.vo.SchoolVo;
4 12
 import lombok.SneakyThrows;
5 13
 import lombok.extern.slf4j.Slf4j;
14
+import org.springframework.beans.factory.annotation.Value;
6 15
 import org.springframework.cloud.gateway.filter.GatewayFilterChain;
7 16
 import org.springframework.cloud.gateway.filter.GlobalFilter;
8 17
 import org.springframework.cloud.gateway.filter.factory.rewrite.CachedBodyOutputMessage;
@@ -15,7 +24,6 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
15 24
 import org.springframework.http.server.reactive.ServerHttpRequestDecorator;
16 25
 import org.springframework.http.server.reactive.ServerHttpResponse;
17 26
 import org.springframework.stereotype.Component;
18
-import org.springframework.util.AntPathMatcher;
19 27
 import org.springframework.util.CollectionUtils;
20 28
 import org.springframework.web.reactive.function.BodyInserter;
21 29
 import org.springframework.web.reactive.function.BodyInserters;
@@ -25,7 +33,10 @@ import org.springframework.web.server.ServerWebExchange;
25 33
 import reactor.core.publisher.Flux;
26 34
 import reactor.core.publisher.Mono;
27 35
 
36
+import javax.annotation.Resource;
28 37
 import java.util.List;
38
+import java.util.Map;
39
+import java.util.stream.Collectors;
29 40
 
30 41
 /**
31 42
  * @Description 请求参数解密
@@ -34,11 +45,16 @@ import java.util.List;
34 45
  **/
35 46
 @Component
36 47
 @Slf4j
37
-public class DecryptRequestionBodyFilter implements GlobalFilter, Ordered {
48
+public class DecryptRequestionBodyFilter extends JedisUtil implements GlobalFilter, Ordered {
49
+    @Value("${Xh-St}")
50
+    private String xhSt;
51
+    @Value("${whitelistAPI}")
52
+    private String whitelistAPI;
38 53
 
39
-    private static String AES_KEY = "XINGHUOLIAOYUAN7";
54
+    private static final String AES_KEY = "XINGHUOLIAOYUAN7";
40 55
 
41
-    private AntPathMatcher antPathMatcher= new AntPathMatcher();
56
+    @Resource
57
+    private ModuleCheckMapper moduleCheckMapper;
42 58
 
43 59
     @SneakyThrows
44 60
     @Override
@@ -49,27 +65,87 @@ public class DecryptRequestionBodyFilter implements GlobalFilter, Ordered {
49 65
         String path = request.getURI().getPath(); // 当前调用方法的url
50 66
         HttpHeaders headers = request.getHeaders();
51 67
 //        log.info("HttpMethod:{},Url:{}", request.getMethod(), request.getURI().getRawPath());
52
-        List<String> decrypts = headers.get("st");
68
+        String st = "Xh-St";
69
+        response.getHeaders().add(st, this.xhSt);
70
+        response.getHeaders().add("Access-Control-Expose-Headers", st);
71
+        List<String> decrypts = headers.get(st);
53 72
         String decrypt = isListNotEmpty(decrypts)?decrypts.get(0):"false";
54
-        if (!decrypt.equals("true")) {
55
-            return chain.filter(exchange);
73
+        boolean rtn = ApiUtil.whiteAPI(path, whitelistAPI);
74
+        if (!rtn && !xhSt.equals(decrypt)) {//非白名单接口验证加密方式
75
+            throw new GatewayException(1, "验证失败,请刷新重试");
76
+        }
77
+        Mono<Void> voidMono;
78
+        if (!"true".equals(decrypt)) {
79
+            //白名单中的接口
80
+            voidMono = returnMononew(chain, exchange);
56 81
         }else{
57
-            return readBody(exchange, chain);
82
+            voidMono = readBody(exchange, chain);
83
+        }
84
+
85
+        String userid = ApiUtil.listToStr(headers.get("Xh-User-Id"));
86
+        //验证token
87
+        String key = ApiUtil.listToStr(headers.get("Xh-Token-Key"));
88
+        String token = ApiUtil.listToStr(headers.get("Xh-Token-Value"));
89
+        if (!rtn) {//非白名单接口验证token
90
+            String redis_token = get(key);//系统缓存中保存的token
91
+
92
+            if (ApiUtil.isEmpty(token) || !token.equals(redis_token)
93
+                    || ApiUtil.isEmpty(key) || !key.split("_")[1].equals(userid)) {
94
+                throw new GatewayException(2, "登录失效");
95
+            } else {
96
+                refreshToken(key, redis_token);//刷新token
97
+            }
58 98
         }
59 99
 
60
-//        //  登录跳过网关验证,检查白名单(配置)最好把不拦截路径放入配置文件,此处通过正则
61
-//        if(antPathMatcher.match("/**/api/login/auth/**",path)){
62
-//            return readBody(exchange, chain);
63
-//        }
64
-//        // 处理参数
65
-//        MediaType contentType = headers.getContentType();
66
-//        long contentLength = headers.getContentLength();
67
-//        if (contentLength > 0) {
68
-//            if (MediaType.APPLICATION_JSON.equals(contentType) || MediaType.APPLICATION_JSON_UTF8.equals(contentType)) {
69
-//                return readBody(exchange, chain);
70
-//            }
71
-//        }
72
-//        return chain.filter(exchange);
100
+        if(ApiUtil.isNotEmpty(userid)){
101
+            //验证操作用户模块权限
102
+            SchoolVo schoolVo = moduleCheckMapper.getSchoolCloudByUserid(Integer.parseInt(userid));
103
+            if(schoolVo.getUsertype() == 1 || schoolVo.getUsertype() == 0){
104
+                String umodule_key = schoolVo.getCloudcode() + "_module_" + schoolVo.getSchoolid() + "_" + userid;
105
+                String umodule_value = get(umodule_key);//获取用户的模块权限
106
+                List<String> userModules = null;//用户模块全新啊
107
+
108
+                if(ApiUtil.isEmpty(umodule_value)){
109
+                    //缓存中用户模块为空,获取用户角色对应所有模块
110
+                    userModules = moduleCheckMapper.listModuleurlsByUserid(Integer.parseInt(userid));
111
+                    if(ApiUtil.isListNotEmpty(userModules)){
112
+                        //用户有模块权限,存入缓存
113
+                        set(umodule_key, userModules, ConfigKey.redisumtime);
114
+                    }else{
115
+                        throw new GatewayException(1, "没有权限");
116
+                    }
117
+                }else{
118
+                    userModules = JSON.parseArray(umodule_value,String.class);
119
+                }
120
+
121
+                String allmodule_key = "modules_operate";//校验模块对应操作
122
+                String allmodule_value = get(allmodule_key);
123
+                List<TModuleCheck> allModules = null;//校验模块对应操作
124
+                if(ApiUtil.isEmpty(allmodule_value)){
125
+                    allModules = moduleCheckMapper.listAllModuleChecks();
126
+                    if(ApiUtil.isListNotEmpty(allModules)){
127
+                        set(allmodule_key,allModules,ConfigKey.redismoduletime);
128
+                    }
129
+                }else{
130
+                    allModules = JSON.parseArray(allmodule_value,TModuleCheck.class);
131
+                }
132
+
133
+                if(ApiUtil.isListNotEmpty(allModules)){
134
+                    //校验模块有值,进行校验。校验模块对应操作如果不在
135
+                    Map<String,List<TModuleCheck>> mMap = allModules.stream().collect(Collectors.groupingBy(m -> m.getOperate()));
136
+                    if(mMap.containsKey(path)){
137
+                        List<TModuleCheck> checkList = mMap.get(path);
138
+                        List<String> checkUrlList = checkList.stream().map(TModuleCheck::getModuleurl).collect(Collectors.toList());
139
+
140
+                        boolean hasIntersection = userModules.stream().anyMatch(checkUrlList::contains);
141
+                        if(!hasIntersection){
142
+                            throw new GatewayException(1, "没有权限");
143
+                        }
144
+                    }
145
+                }
146
+            }
147
+        }
148
+        return voidMono;
73 149
     }
74 150
 
75 151
     ServerHttpRequestDecorator decorate(ServerWebExchange exchange, HttpHeaders headers, CachedBodyOutputMessage outputMessage) {
@@ -92,8 +168,15 @@ public class DecryptRequestionBodyFilter implements GlobalFilter, Ordered {
92 168
     }
93 169
 
94 170
 
95
-    private Mono<Void> returnMononew(GatewayFilterChain chain, ServerWebExchange exchange){
96
-        return chain.filter(exchange).then(Mono.fromRunnable(()->{
171
+    private Mono<Void> returnMononew(GatewayFilterChain chain, ServerWebExchange exchange) {
172
+        long startTime = System.currentTimeMillis();
173
+        return chain.filter(exchange).then(Mono.fromRunnable(() -> {
174
+            long endTime = System.currentTimeMillis();
175
+            long executeTime = endTime - startTime;
176
+            if (executeTime > 1000) {
177
+                String path = exchange.getRequest().getURI().getPath();
178
+                log.error(" {};耗时:{}s", path, executeTime / 1000);
179
+            }
97 180
         }));
98 181
     }
99 182
     private Mono<Void> readBody(ServerWebExchange exchange, GatewayFilterChain chain) {

+ 24
- 0
gateway/src/main/java/com/xhkjedu/gateway/mapper/ModuleCheckMapper.java View File

@@ -0,0 +1,24 @@
1
+package com.xhkjedu.gateway.mapper;
2
+
3
+import com.xhkjedu.gateway.model.TModuleCheck;
4
+import com.xhkjedu.gateway.vo.SchoolVo;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+/**
10
+ * @Description:模块权限表
11
+ * @Author: WN
12
+ * @Date: 2023/11/27 15:18:22
13
+ **/
14
+public interface ModuleCheckMapper {
15
+
16
+    //获取地址对应所有操作
17
+    List<TModuleCheck> listAllModuleChecks();
18
+
19
+    //获取用户当前年份及区域码
20
+    SchoolVo getSchoolCloudByUserid(@Param("userid")Integer userid);
21
+
22
+    //获取用户所属角色对应的所有模块地址
23
+    List<String> listModuleurlsByUserid(@Param("userid")Integer userid);
24
+}

+ 22
- 0
gateway/src/main/java/com/xhkjedu/gateway/model/TModuleCheck.java View File

@@ -0,0 +1,22 @@
1
+package com.xhkjedu.gateway.model;
2
+
3
+import lombok.Data;
4
+
5
+import javax.persistence.Id;
6
+import javax.persistence.Table;
7
+
8
+/**
9
+ * @Description:模块检查
10
+ * @Author: WN
11
+ * @Date: 2023/11/27 15:10:44
12
+ **/
13
+@Data
14
+@Table(name = "t_model_check")
15
+public class TModuleCheck {
16
+    @Id
17
+    private Integer mcid;
18
+
19
+    private String moduleurl;//地址
20
+
21
+    private String operate;//操作
22
+}

+ 128
- 0
gateway/src/main/java/com/xhkjedu/gateway/utils/ApiUtil.java View File

@@ -0,0 +1,128 @@
1
+package com.xhkjedu.gateway.utils;
2
+
3
+import lombok.extern.slf4j.Slf4j;
4
+import org.springframework.util.CollectionUtils;
5
+
6
+import java.text.SimpleDateFormat;
7
+import java.util.Date;
8
+import java.util.List;
9
+
10
+/**
11
+ * @ClassName ApiUtil
12
+ * Description api工具类
13
+ * Author WN
14
+ * Date 2022/2/21 11:08
15
+ **/
16
+@Slf4j
17
+public class ApiUtil {
18
+
19
+    /*
20
+    * @Description 比较当前时间和时间段
21
+    * @Author WN
22
+    * @Date 2023/6/15 11:24:59
23
+    */
24
+    public static boolean compareCurrDateTime(String starttimeStr,String stoptimeStr) throws Exception{
25
+        boolean rtn = false;
26
+        if(isEmpty(starttimeStr) || isEmpty(stoptimeStr)){
27
+            rtn = false;
28
+        }else{
29
+            SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm");
30
+
31
+            Date starttime = sdf.parse(starttimeStr); //开始时间
32
+            Date stoptime = sdf.parse(stoptimeStr); //结束时间
33
+
34
+            Date nowtime = new Date();
35
+            String times = sdf.format(nowtime);
36
+            Date currtime = sdf.parse(times);//当前时间
37
+
38
+            //当前时间在开始时间之前或者等于开始时间  并且 当前时间在结束时间之后或者等于结束时间
39
+            if((starttime.before(currtime) || starttime.equals(currtime)) && (stoptime.after(currtime) || stoptime.equals(currtime))){
40
+                rtn = true;
41
+            }
42
+        }
43
+
44
+        return rtn;
45
+    }
46
+    /**
47
+     * 字符串是否为空
48
+     *
49
+     * @param: @param obj
50
+     * @param: @return
51
+     * @author WN
52
+     */
53
+    public static boolean isNotEmpty(Object obj) {
54
+        if (null == obj || "".equals(obj.toString().trim()) || "null".equals(obj.toString().trim())) {
55
+            return false;
56
+        } else {
57
+            return true;
58
+        }
59
+    }
60
+
61
+    /**
62
+     * 字符串是否为空
63
+     *
64
+     * @param: @param obj
65
+     * @param: @return
66
+     * @author zj
67
+     */
68
+    public static boolean isEmpty(Object obj) {
69
+        if (null == obj || "".equals(obj.toString().trim()) || "null".equals(obj.toString().trim())) {
70
+            return true;
71
+        } else {
72
+            return false;
73
+        }
74
+    }
75
+
76
+    /**
77
+     * @Description 是否是白名单接口
78
+     * @Date 2023/11/16 9:02
79
+     * @Author YWX
80
+     * @Param [requestURI, whitelistAPI]
81
+     * @Return boolean
82
+     **/
83
+    public static boolean whiteAPI(String requestURI, String whitelistAPI) {
84
+        boolean rtn = false;
85
+        if (isEmpty(whitelistAPI)) return rtn;
86
+
87
+        String[] apis = whitelistAPI.split(",");
88
+        for (String api : apis) {
89
+            if (requestURI.contains(api)) {
90
+                rtn = true;
91
+                break;
92
+            }
93
+        }
94
+        return rtn;
95
+    }
96
+
97
+    /**
98
+     * @Description 判断list是否不为空
99
+     * @Date 2023/11/16 9:01
100
+     * @Author YWX
101
+     * @Param [list]
102
+     * @Return boolean
103
+     **/
104
+    public static boolean isListNotEmpty(List list) {
105
+        if (CollectionUtils.isEmpty(list)){
106
+            return false;
107
+        } else {
108
+            return true;
109
+        }
110
+    }
111
+
112
+    /**
113
+     * @Description list转字符
114
+     * @Date 2023/11/16 9:01
115
+     * @Author YWX
116
+     * @Param [list]
117
+     * @Return java.lang.String
118
+     **/
119
+    public static String listToStr(List<String> list) {
120
+        String str = "";
121
+        if (isListNotEmpty(list)) {
122
+            for (String s : list) {
123
+                str += s;
124
+            }
125
+        }
126
+        return str;
127
+    }
128
+}

+ 123
- 0
gateway/src/main/java/com/xhkjedu/gateway/utils/JedisUtil.java View File

@@ -0,0 +1,123 @@
1
+package com.xhkjedu.gateway.utils;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import org.springframework.beans.factory.annotation.Autowired;
5
+import org.springframework.beans.factory.annotation.Value;
6
+import org.springframework.data.redis.core.StringRedisTemplate;
7
+import org.springframework.data.redis.core.ValueOperations;
8
+import org.springframework.stereotype.Component;
9
+
10
+import javax.annotation.PostConstruct;
11
+import java.util.concurrent.TimeUnit;
12
+
13
+/**
14
+ * @author ywx
15
+ * @classname JedisUtil
16
+ * @description Redis工具类
17
+ * @date 2019/8/2 16:48
18
+ **/
19
+@Component
20
+public class JedisUtil {
21
+	@Autowired
22
+	private StringRedisTemplate stringRedisTemplate;
23
+	private ValueOperations<String, String> valueOperations;
24
+
25
+	@PostConstruct
26
+	public void init(){
27
+		this.valueOperations = stringRedisTemplate.opsForValue();
28
+	}
29
+
30
+	/**  默认过期时长,单位:秒 */
31
+	//redis失效时间
32
+	@Value("${redisdatatime}")
33
+	private Integer redisdatatime;
34
+	/**  不设置过期时长 */
35
+	public final static long NOT_EXPIRE = -1;
36
+
37
+	public boolean set(String key, Object value, Integer expire){
38
+		boolean rtn = false;
39
+		valueOperations.set(key, toJson(value));
40
+		if(expire != NOT_EXPIRE){
41
+			rtn = stringRedisTemplate.expire(key, expire, TimeUnit.SECONDS);
42
+		}
43
+		return rtn;
44
+	}
45
+
46
+	public void set(String key, Object value){
47
+		set(key, value, redisdatatime);
48
+	}
49
+
50
+	public Boolean setObject(String key, Object value, int cacheSeconds) {
51
+		String val = toJson(value);
52
+		return set(key,val,cacheSeconds);
53
+	}
54
+
55
+	public <T> T get(String key, Class<T> clazz, long expire) {
56
+		String value = valueOperations.get(key);
57
+		if(expire != NOT_EXPIRE){
58
+			stringRedisTemplate.expire(key, expire, TimeUnit.SECONDS);
59
+		}
60
+		return value == null ? null : fromJson(value, clazz);
61
+	}
62
+
63
+	public <T> T get(String key, Class<T> clazz) {
64
+		return get(key, clazz, NOT_EXPIRE);
65
+	}
66
+
67
+	public String get(String key, long expire) {
68
+		String value = valueOperations.get(key);
69
+		if (expire != NOT_EXPIRE) {
70
+			stringRedisTemplate.expire(key, expire, TimeUnit.SECONDS);
71
+		}
72
+		return value;
73
+	}
74
+
75
+	public String get(String key) {
76
+		try {
77
+			return get(key, NOT_EXPIRE);
78
+		} catch (Exception e) {
79
+			return "0";
80
+		}
81
+	}
82
+
83
+	//获取剩余有效期
84
+	public Long getExpire(String key) {
85
+		return stringRedisTemplate.getExpire(key);
86
+	}
87
+
88
+	//如果token有效期低于10分钟更新有效期
89
+	public void refreshToken(String key,String value) {
90
+		Long expire = getExpire(key);
91
+		if (expire <= 10 * 60) {
92
+			set(key, value);
93
+		}
94
+	}
95
+
96
+	public Object getObject(String key, Class<?> clazz) {
97
+		String value = get(key);
98
+		return fromJson(value, clazz);
99
+	}
100
+
101
+	public boolean delete(String key) {
102
+		return stringRedisTemplate.delete(key);
103
+	}
104
+
105
+	/**
106
+	 * Object转成JSON数据
107
+	 */
108
+	private String toJson(Object object){
109
+		if(object instanceof Integer || object instanceof Long || object instanceof Float ||
110
+				object instanceof Double || object instanceof Boolean || object instanceof String){
111
+			return String.valueOf(object);
112
+		}
113
+		return JSON.toJSONString(object);
114
+	}
115
+
116
+	/**
117
+	 * JSON数据,转成Object
118
+	 */
119
+	private <T> T fromJson(String json, Class<T> clazz){
120
+		return JSON.parseObject(json, clazz);
121
+	}
122
+
123
+}

+ 20
- 0
gateway/src/main/java/com/xhkjedu/gateway/vo/SchoolVo.java View File

@@ -0,0 +1,20 @@
1
+package com.xhkjedu.gateway.vo;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @Description:学校基本信息类
7
+ * @Author: WN
8
+ * @Date: 2023/11/27 14:40:44
9
+ **/
10
+@Data
11
+public class SchoolVo {
12
+    private Integer schoolid;//学校id
13
+
14
+    private Integer year;//学校当前年份
15
+
16
+    //云平台码
17
+    private String cloudcode;
18
+
19
+    private Integer usertype;//用户类型
20
+}

+ 69
- 0
gateway/src/main/resources/application.properties View File

@@ -50,9 +50,78 @@ spring.cloud.gateway.routes[5].filters[1].name=CircuitBreaker
50 50
 spring.cloud.gateway.routes[5].filters[1].args.name=fallbackcmd
51 51
 spring.cloud.gateway.routes[5].filters[1].args.fallbackUri=forward:/fallback
52 52
 
53
+spring.cloud.gateway.routes[6].id=path_slog
54
+spring.cloud.gateway.routes[6].uri=lb://slog
55
+spring.cloud.gateway.routes[6].predicates[0]=Path=/slog/**
56
+spring.cloud.gateway.routes[6].filters[0]=RewritePath=/slog/(?<segment>.*), /$\{segment}
57
+spring.cloud.gateway.routes[6].filters[1].name=CircuitBreaker
58
+spring.cloud.gateway.routes[6].filters[1].args.name=fallbackcmd
59
+spring.cloud.gateway.routes[6].filters[1].args.fallbackUri=forward:/fallback
60
+
53 61
 eureka.client.service-url.defaultZone=http://xhschool:Xhkjedud07@localhost:8081/eureka/
62
+eureka.client.register-with-eureka=true
63
+eureka.client.fetch-registry=true
54 64
 #设置eureka输出日志级别
55 65
 logging.level.com.netflix=error
56 66
 
57 67
 #请求超时时间30s
58 68
 rq.overtime = 30000
69
+
70
+#接口是否加密
71
+Xh-St = false
72
+
73
+#mysql数据库
74
+spring.datasource.url=jdbc:mysql://dbtest.xhkjedu.com:3306/xhkjedu_school_test?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true&allowMultiQueries=true
75
+spring.datasource.username=root
76
+spring.datasource.password=HNxhkjedu!@#07
77
+spring.mvc.hiddenmethod.filter.enabled=true
78
+#数据库连接池配置
79
+spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
80
+#允许的最小空闲数
81
+spring.datasource.hikari.minimum-idle=5
82
+#连接池最大连接数
83
+spring.datasource.hikari.maximum-pool-size=50
84
+spring.datasource.hikari.auto-commit=true
85
+#空闲超时是 180000 毫秒,当数据库连接的空闲时间大于180000毫秒时,这些空闲超时的连接会被关闭,直到超时的空闲连接数达到 minimum-idle的值
86
+spring.datasource.hikari.idle-timeout=180000
87
+spring.datasource.hikari.pool-name=DatebookHikariCP
88
+spring.datasource.hikari.max-lifetime=1800000
89
+#连接超时时间设置,默认是30s
90
+spring.datasource.hikari.connection-timeout=20000
91
+# 测试连接是否可用的query 语句 在oracle是 select 1 from dual  36   28.26
92
+spring.datasource.hikari.connection-test-query=SELECT 1
93
+# 所有Entity别名类所在包
94
+mybatis.type-aliases-package=com.xhkjedu.model,com.xhkjedu.gateway.model
95
+mybatis.mapper-Locations=classpath*:mapper/**/*.xml
96
+#mapper.mappers=com.xhkjedu.base.TkMapper
97
+mybatis.configuration.call-setters-on-nulls=true
98
+mapper.identity=MYSQL
99
+
100
+#redis配置
101
+spring.redis.host=cachetest.xhkjedu.com
102
+spring.redis.port=6379
103
+spring.redis.password=xhkjedud07
104
+#超时时间:单位ms
105
+spring.redis.timeout=5000
106
+#设置过期时间10min
107
+spring.redis.jedis.pool.max-idle=300
108
+#最大等待时间:单位ms //高版本改为maxWaitMillis
109
+spring.redis.jedis.pool.max-wait=1000000
110
+spring.redis.jedis.pool.max-active=60000
111
+#缓存访问数据有效时长5*60*60
112
+redisdatatime=18000
113
+#缓存用户权限模块有效时长60*60*24
114
+redisumtime=86400
115
+#缓存模块对应操作有效时长60*5
116
+redismoduletime=300
117
+
118
+
119
+#白名单接口
120
+whitelistAPI=user/login,/class_student/stu_class,/user/detail,/status/info,/user/qrg,/user/check_user\
121
+  ,/user/update_code,/user/update_pwd_byCode,/user/list_usecret,/user/check_usecret,/user/reset_pwd\
122
+  ,/class_student/import_user,/user/import_teacher\
123
+  ,/get_new,/stype/list,/cloud/detail,/auser/import,/pdf,/epsb/import,\
124
+  ,/section/get_zjr,/csw/add,/xz/import,/agora_token/rtc_token,/epqt/pqs,/eb/get_mn,/scan/save,/eps/sca,/eps/scaer
125
+
126
+#版本号
127
+versionname=Test_v3.13.0

+ 23
- 0
gateway/src/main/resources/mapper/ModuleCheckMapper.xml View File

@@ -0,0 +1,23 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.gateway.mapper.ModuleCheckMapper">
4
+
5
+    <!--获取地址对应所有操作-->
6
+    <select id="listAllModuleChecks" resultType="com.xhkjedu.gateway.model.TModuleCheck">
7
+        select * from t_module_check
8
+    </select>
9
+
10
+    <!--获取用户当前年份及区域码-->
11
+    <select id="getSchoolCloudByUserid" resultType="com.xhkjedu.gateway.vo.SchoolVo">
12
+        select s.year,u.schoolid,u.usertype,(select cloudcode from t_cloud limit 1) cloudcode
13
+        from t_user u left join t_school s on u.schoolid=s.schoolid
14
+        where u.userid=#{userid}
15
+    </select>
16
+
17
+    <!--获取用户所属角色对应的所有模块地址-->
18
+    <select id="listModuleurlsByUserid" resultType="java.lang.String">
19
+        select m.moduleurl from t_module m left join t_role_module rm on m.moduleid=rm.moduleid
20
+        left join t_user_role ur on rm.roleid=ur.roleid
21
+        where ur.userid=#{userid} and m.`level`=2 group by m.moduleurl
22
+    </select>
23
+</mapper>

+ 1
- 0
gateway/src/test/java/com/xhkjedu/gateway/GatewayApplicationTests.java View File

@@ -8,6 +8,7 @@ class GatewayApplicationTests {
8 8
 
9 9
     @Test
10 10
     void contextLoads() {
11
+        System.out.println("网关打印");
11 12
     }
12 13
 
13 14
 }

+ 6
- 0
pom.xml View File

@@ -21,6 +21,7 @@
21 21
         <module>sapi</module>
22 22
         <module>scommons</module>
23 23
         <module>sexam</module>
24
+        <module>slog</module>
24 25
     </modules>
25 26
 
26 27
     <parent>
@@ -87,6 +88,11 @@
87 88
                 <artifactId>sexam</artifactId>
88 89
                 <version>0.0.1-SNAPSHOT</version>
89 90
             </dependency>
91
+            <dependency>
92
+                <groupId>com.xhkjedu</groupId>
93
+                <artifactId>slog</artifactId>
94
+                <version>0.0.1-SNAPSHOT</version>
95
+            </dependency>
90 96
         </dependencies>
91 97
     </dependencyManagement>
92 98
 </project>

+ 4
- 1
register/src/main/resources/application.properties View File

@@ -3,10 +3,13 @@ server.port=8081
3 3
 #禁止注册自己
4 4
 eureka.client.register-with-eureka=false
5 5
 eureka.client.fetch-registry=false
6
-eureka.client.service-url.defaultZone=http://127.0.0.1:8081/eureka/
6
+eureka.client.service-url.defaultZone=http://${spring.security.user.name}:${spring.security.user.password}@127.0.0.1:8081/eureka/
7 7
 
8 8
 spring.security.user.name=xhschool
9 9
 spring.security.user.password=Xhkjedud07
10 10
 
11 11
 #设置eureka输出日志级别
12 12
 logging.level.com.netflix=error
13
+
14
+#版本号
15
+versionname=Test_v3.13.0

+ 0
- 6
sapi/pom.xml View File

@@ -32,12 +32,6 @@
32 32
             <version>3.17</version>
33 33
         </dependency>
34 34
 
35
-        <!--amqp的起步依赖-->
36
-        <dependency>
37
-            <groupId>org.springframework.boot</groupId>
38
-            <artifactId>spring-boot-starter-amqp</artifactId>
39
-        </dependency>
40
-
41 35
     </dependencies>
42 36
     <dependencyManagement>
43 37
         <dependencies>

+ 2
- 2
sapi/src/main/java/com/xhkjedu/sapi/SapiApplication.java View File

@@ -1,17 +1,17 @@
1 1
 package com.xhkjedu.sapi;
2 2
 
3
+import com.xhkjedu.sapi.config.ConfigKey;
3 4
 import org.springframework.boot.SpringApplication;
4 5
 import org.springframework.boot.autoconfigure.SpringBootApplication;
5
-import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
6 6
 import tk.mybatis.spring.annotation.MapperScan;
7 7
 
8 8
 @SpringBootApplication(scanBasePackages = "com.xhkjedu")
9
-@EnableEurekaClient
10 9
 @MapperScan(basePackages = {"com.xhkjedu.sapi.mapper"})
11 10
 public class SapiApplication {
12 11
 
13 12
     public static void main(String[] args) {
14 13
         SpringApplication.run(SapiApplication.class, args);
14
+        System.out.println("构建号:" + ConfigKey.buildnum);
15 15
     }
16 16
 
17 17
 }

+ 208
- 0
sapi/src/main/java/com/xhkjedu/sapi/aop/WebControllerAop.java View File

@@ -0,0 +1,208 @@
1
+package com.xhkjedu.sapi.aop;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.annotation.Action;
5
+import com.xhkjedu.constant.PlatformConstant;
6
+import com.xhkjedu.model.slog.THandleLog;
7
+import com.xhkjedu.sapi.config.ConfigKey;
8
+import com.xhkjedu.sapi.listener.HandleLogSender;
9
+import com.xhkjedu.sapi.mapper.system.UserMapper;
10
+import com.xhkjedu.utils.IpRegionUtil;
11
+import com.xhkjedu.utils.N_Utils;
12
+import com.xhkjedu.vo.ResultVo;
13
+import com.xhkjedu.vo.system.UserVo;
14
+import lombok.extern.slf4j.Slf4j;
15
+import org.aspectj.lang.JoinPoint;
16
+import org.aspectj.lang.annotation.*;
17
+import org.aspectj.lang.reflect.MethodSignature;
18
+import org.springframework.stereotype.Component;
19
+import org.springframework.web.context.request.RequestContextHolder;
20
+import org.springframework.web.context.request.ServletRequestAttributes;
21
+
22
+import javax.annotation.Resource;
23
+import javax.servlet.http.HttpServletRequest;
24
+import java.lang.reflect.Method;
25
+
26
+/*
27
+ * @Description: AOP 操作日志
28
+ * @Author: WN
29
+ * @Date: 2023/11/15 18:52:24
30
+ **/
31
+@Aspect
32
+@Component
33
+@Slf4j
34
+public class WebControllerAop {
35
+    @Resource
36
+    private HandleLogSender handleLogSender;
37
+    @Resource
38
+    private UserMapper userMapper;
39
+
40
+    private THandleLog handleLog;
41
+
42
+    /*
43
+     * @Description 指定切点 匹配 使用@Action修饰所有方法
44
+     * @Date 2023/11/15 18:52:48
45
+     * @Author WN
46
+     * @Return void
47
+     **/
48
+    @Pointcut("execution(public * com.xhkjedu.sapi.controller..*.*(..))")
49
+    public void handleLog() {
50
+    }
51
+
52
+    /*
53
+     * @Description 前置通知,方法调用前被调用
54
+     * @Date 2023/11/15 17:46:51
55
+     * @Param [joinPoint]
56
+     **/
57
+    @Before("handleLog()")
58
+    public void doBefore(JoinPoint joinPoint){
59
+
60
+        //获取方法
61
+        Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
62
+        // 获取AspectAnnotation注解
63
+        Action action = method.getAnnotation(Action.class);
64
+        if (action == null) {
65
+            handleLog = null;
66
+            return;
67
+        }
68
+        // 在此处初始化,避免某些方法不用记录报错
69
+        handleLog = new THandleLog();
70
+
71
+        try {
72
+            // 获取方法名字
73
+            String value = action.value();
74
+            String[] valueStr = value.split("-");
75
+            // 操作名称
76
+            handleLog.setHandlemodel(valueStr[0]);
77
+            handleLog.setHandleaction(valueStr[1]);
78
+
79
+            if(joinPoint.getArgs() != null && joinPoint.getArgs().length > 0){
80
+                Object[] args = joinPoint.getArgs();
81
+                // 设置请求参数
82
+                handleLog.setHandleparas(JSON.toJSONString(args[0]));
83
+            }
84
+
85
+            ServletRequestAttributes ss = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
86
+            if (ss != null) {
87
+                HttpServletRequest request = ss.getRequest();
88
+                Integer userid = request.getIntHeader(PlatformConstant.XH_USER_ID);
89
+                // 用户名
90
+                handleLog.setUserid(request.getIntHeader(PlatformConstant.XH_USER_ID));
91
+                handleLog.setDevicetype(request.getHeader(PlatformConstant.XH_DEVICE));
92
+                handleLog.setVersionnum(request.getHeader(PlatformConstant.XH_VERSION));
93
+                // 请求地址
94
+                handleLog.setHandleurl("/sapi" + request.getRequestURI());
95
+
96
+                //获取请求ip并解析区域
97
+                String ip = N_Utils.getIpAddress(request);
98
+                String region = null;
99
+                if (N_Utils.isNotEmpty(ip)) {
100
+                    IpRegionUtil ipRegionUtil = new IpRegionUtil();
101
+                    region = ipRegionUtil.getIpForAddress(ip, ConfigKey.ipregiondb);
102
+                }
103
+                handleLog.setHandleip(ip);
104
+                handleLog.setHandleaddress(region);
105
+                if(N_Utils.isTrueInteger(userid)){
106
+                    UserVo user = userMapper.getUserInfoForHandleLog(userid);
107
+                    if(user != null){
108
+                        handleLog.setUsertype(user.getUsertype());
109
+                        handleLog.setSchoolid(user.getSchoolid());
110
+                        handleLog.setUsername(user.getUsername());
111
+                        handleLog.setLoginname(user.getLoginname());
112
+                        if(N_Utils.isNotEmpty(handleLog.getDevicetype()) && "p_web".equals(handleLog.getDevicetype())){
113
+                            if(user.getUsertype() == 2){
114
+                                handleLog.setDevicetype(handleLog.getDevicetype()+"_s");
115
+                            }else{
116
+                                handleLog.setDevicetype(handleLog.getDevicetype()+"_t");
117
+                            }
118
+                        }
119
+                    }
120
+                }
121
+            }
122
+        } catch (Exception e) {
123
+            log.error("操作日志doBefore执行异常:" + e.getMessage());
124
+        }
125
+    }
126
+
127
+    /*
128
+     * @Description 处理完请求返回内容 发送mq消息
129
+     * @Date 2023/11/15 17:47:12
130
+     * @Author WN
131
+     * @Param [ret]
132
+     **/
133
+    @AfterReturning(returning = "ret", pointcut = "handleLog()")
134
+    public void doAfterReturning(Object ret){
135
+        if (ret == null) {
136
+            return;
137
+        }
138
+        if (handleLog == null) {
139
+            return;
140
+        }
141
+
142
+        if (ret instanceof ResultVo) {
143
+            ResultVo result = (ResultVo) ret;
144
+            if (result.getCode() == 0) {
145
+                handleLog.setHandlestate(1);
146
+            } else {
147
+                handleLog.setHandlestate(2);
148
+            }
149
+        }
150
+    }
151
+
152
+    /*
153
+     * @Description  后置异常
154
+     * @Date 2023/11/15 17:47:28
155
+     * @Author WN
156
+     * @Param [jp, e] (JoinPoint jp, Exception e)
157
+     **/
158
+    @AfterThrowing(pointcut = "handleLog()", throwing = "e")
159
+    public void throwss(Exception e) {
160
+
161
+        if (handleLog == null) {
162
+            return;
163
+        }
164
+
165
+        handleLog.setHandlestate(2);
166
+    }
167
+
168
+    /*
169
+     * @Description 后置最终通知,final增强,不管是抛出异常或者正常退出都会执行
170
+     * @Date 2023/11/15 17:49:15
171
+     * @Author WN
172
+     * @Param [jp](JoinPoint jp)
173
+     **/
174
+    @After("handleLog()")
175
+    public void after() {
176
+        if (handleLog == null) {
177
+            return;
178
+        }
179
+        sendOut();
180
+    }
181
+
182
+    /*
183
+     * @Description 环绕通知,环绕增强,相当于MethodInterceptor
184
+     * @Date 2023/11/15 17:49:34
185
+     * @Author WN
186
+     * @Param [pjp]
187
+     * @Return java.lang.Object
188
+     **/
189
+    // @Around("handleLog()")
190
+    // public Object arround(ProceedingJoinPoint pjp) {
191
+    //     try {
192
+    //         return pjp.proceed();
193
+    //     } catch (Throwable e) {
194
+    //         e.printStackTrace();
195
+    //     }
196
+    //     return null;
197
+    // }
198
+
199
+    /**
200
+     * 发送消息
201
+     */
202
+    public void sendOut() {
203
+        THandleLog logHandlelogNew = handleLog;
204
+        // log.info("记录操作日志,给rabbitmq发送消息:" + logHandlelogNew.toString());
205
+        handleLogSender.handleLogSend(logHandlelogNew);
206
+    }
207
+
208
+}

+ 14
- 13
sapi/src/main/java/com/xhkjedu/sapi/config/ConfigKey.java View File

@@ -31,19 +31,6 @@ public class ConfigKey {
31 31
         ConfigKey.numadd = numadd;
32 32
     }
33 33
 
34
-    public static Integer redisdatatime;//缓存访问数据有效时长
35
-    public static String secretKey;//secretKey必须为24位
36
-
37
-    @Value("${redisdatatime}")
38
-    public void setRedisdatatime(Integer redisdatatime) {
39
-        ConfigKey.redisdatatime = redisdatatime;
40
-    }
41
-
42
-    @Value("${secretKey}")
43
-    public void setSecretKey(String secretKey) {
44
-        ConfigKey.secretKey = secretKey;
45
-    }
46
-
47 34
     public static String cloudapi;//云平台接口
48 35
     public static String showurl;//文件访问路径
49 36
     public static String oldshowurl;//原文件访问路径
@@ -105,4 +92,18 @@ public class ConfigKey {
105 92
     public void setSyncnum(Integer syncnum) {
106 93
         ConfigKey.syncnum = syncnum;
107 94
     }
95
+
96
+    public static Integer buildnum;//构建号
97
+
98
+    @Value("${buildnum}")
99
+    public void setBuildnum(Integer buildnum){
100
+        this.buildnum = buildnum;
101
+    }
102
+
103
+    public static String ipregiondb;//解析ip地址归属地
104
+
105
+    @Value("${ipregiondb}")
106
+    public void setIpregiondb(String ipregiondb){
107
+        ConfigKey.ipregiondb = ipregiondb;
108
+    }
108 109
 }

+ 9
- 0
sapi/src/main/java/com/xhkjedu/sapi/config/RabbitConfig.java View File

@@ -54,4 +54,13 @@ public class RabbitConfig {
54 54
     public Queue resourceDelQueue2() {
55 55
         return new Queue(resourceDelQueue2);
56 56
     }
57
+
58
+    //生产者mq-操作日志
59
+    @Value("${rabbitmq.handleLogQueue}")
60
+    private String handleLogQueue;
61
+
62
+    @Bean
63
+    public Queue handleLogQueue() {
64
+        return new Queue(handleLogQueue);
65
+    }
57 66
 }

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppLiveController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.appversion;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.appversion.TAppLive;
6 7
 import com.xhkjedu.sapi.service.appversion.AppLiveService;
7 8
 import com.xhkjedu.sapi.vo.appversion.AppversionVo;
@@ -29,6 +30,7 @@ public class AppLiveController {
29 30
     private AppLiveService appLiveService;
30 31
 
31 32
     @PostMapping("/add")
33
+    @Action("直播端-增加")
32 34
     public ResultVo add(@RequestBody TAppLive appclient) {
33 35
         N_Utils.validation(new Object[]{appclient.getVersionname(),"版本名称",2,
34 36
                 appclient.getVersioncode(),"版本号",2,appclient.getVersionpath(),"应用文件",2});
@@ -37,6 +39,7 @@ public class AppLiveController {
37 39
     }
38 40
 
39 41
     @PostMapping("/delete")
42
+    @Action("直播端-删除")
40 43
     public ResultVo delete(@RequestBody TAppLive appclient) {
41 44
         N_Utils.validation(new Object[]{appclient.getVersionid(),"版本id",1});
42 45
         appLiveService.deleteById(appclient.getVersionid());
@@ -44,6 +47,7 @@ public class AppLiveController {
44 47
     }
45 48
 
46 49
     @PostMapping("/update")
50
+    @Action("直播端-修改")
47 51
     public ResultVo update(@RequestBody TAppLive appclient) {
48 52
         N_Utils.validation(new Object[]{appclient.getVersionid(),"版本id",1});
49 53
         appLiveService.update(appclient);

+ 3
- 3
sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppMonitorController.java View File

@@ -4,13 +4,13 @@ import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5 5
 import com.xhkjedu.sapi.model.appversion.TAppMonitor;
6 6
 import com.xhkjedu.sapi.service.appversion.AppMonitorService;
7
+import com.xhkjedu.sapi.vo.appversion.AppMonitorPVo;
8
+import com.xhkjedu.sapi.vo.appversion.AppMonitorVo;
9
+import com.xhkjedu.sapi.vo.appversion.AppSearchVo;
7 10
 import com.xhkjedu.utils.N_Utils;
8 11
 import com.xhkjedu.utils.PageUtil;
9 12
 import com.xhkjedu.vo.PageResult;
10 13
 import com.xhkjedu.vo.ResultVo;
11
-import com.xhkjedu.sapi.vo.appversion.AppMonitorPVo;
12
-import com.xhkjedu.sapi.vo.appversion.AppMonitorVo;
13
-import com.xhkjedu.sapi.vo.appversion.AppSearchVo;
14 14
 import org.springframework.web.bind.annotation.PostMapping;
15 15
 import org.springframework.web.bind.annotation.RequestBody;
16 16
 import org.springframework.web.bind.annotation.RequestMapping;

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppRecordController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.appversion;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.appversion.TAppRecord;
6 7
 import com.xhkjedu.sapi.service.appversion.AppRecordService;
7 8
 import com.xhkjedu.utils.N_Utils;
@@ -29,6 +30,7 @@ public class AppRecordController {
29 30
     private AppRecordService appRecordService;
30 31
 
31 32
     @PostMapping("/add")
33
+    @Action("教师微课端-增加")
32 34
     public ResultVo add(@RequestBody TAppRecord apprecord) {
33 35
         N_Utils.validation(new Object[]{apprecord.getVersionname(),"版本名称",2,
34 36
                 apprecord.getVersioncode(),"版本号",2,apprecord.getVersionpath(),"应用文件",2});
@@ -37,6 +39,7 @@ public class AppRecordController {
37 39
     }
38 40
 
39 41
     @PostMapping("/delete")
42
+    @Action("教师微课端-删除")
40 43
     public ResultVo delete(@RequestBody TAppRecord apprecord) {
41 44
         N_Utils.validation(new Object[]{apprecord.getVersionid(),"版本id",1});
42 45
         appRecordService.deleteById(apprecord.getVersionid());
@@ -44,6 +47,7 @@ public class AppRecordController {
44 47
     }
45 48
 
46 49
     @PostMapping("/update")
50
+    @Action("教师微课端-修改")
47 51
     public ResultVo update(@RequestBody TAppRecord apprecord) {
48 52
         N_Utils.validation(new Object[]{apprecord.getVersionid(),"版本id",1});
49 53
         appRecordService.update(apprecord);

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppScanController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.appversion;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.appversion.TAppScan;
6 7
 import com.xhkjedu.sapi.service.appversion.AppScanService;
7 8
 import com.xhkjedu.sapi.vo.appversion.AppversionVo;
@@ -30,6 +31,7 @@ public class AppScanController {
30 31
     private AppScanService appScanService;
31 32
 
32 33
     @PostMapping("/add")
34
+    @Action("扫描客户端-增加")
33 35
     public ResultVo add(@RequestBody TAppScan appclient) {
34 36
         N_Utils.validation(new Object[]{appclient.getVersionname(),"版本名称",2,
35 37
                 appclient.getVersioncode(),"版本号",2,appclient.getVersionpath(),"应用文件",2});
@@ -38,6 +40,7 @@ public class AppScanController {
38 40
     }
39 41
 
40 42
     @PostMapping("/delete")
43
+    @Action("扫描客户端-删除")
41 44
     public ResultVo delete(@RequestBody TAppScan appclient) {
42 45
         N_Utils.validation(new Object[]{appclient.getVersionid(),"版本id",1});
43 46
         appScanService.deleteById(appclient.getVersionid());
@@ -45,6 +48,7 @@ public class AppScanController {
45 48
     }
46 49
 
47 50
     @PostMapping("/update")
51
+    @Action("扫描客户端-修改")
48 52
     public ResultVo update(@RequestBody TAppScan appclient) {
49 53
         N_Utils.validation(new Object[]{appclient.getVersionid(),"版本id",1});
50 54
         appScanService.update(appclient);

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppStuappController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.appversion;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.appversion.TAppStuapp;
6 7
 import com.xhkjedu.sapi.service.appversion.AppStuappService;
7 8
 import com.xhkjedu.utils.N_Utils;
@@ -31,6 +32,7 @@ public class AppStuappController {
31 32
     private AppStuappService appStuappService;
32 33
 
33 34
     @PostMapping("/add")
35
+    @Action("学生平板端-增加")
34 36
     public ResultVo add(@RequestBody TAppStuapp tAppStuapp) {
35 37
         N_Utils.validation(new Object[]{tAppStuapp.getVersionname(),"版本名称",2,
36 38
                 tAppStuapp.getVersioncode(),"版本号",2,tAppStuapp.getVersionpath(),"应用文件",2});
@@ -39,6 +41,7 @@ public class AppStuappController {
39 41
     }
40 42
 
41 43
     @PostMapping("/delete")
44
+    @Action("学生平板端-删除")
42 45
     public ResultVo delete(@RequestBody TAppStuapp tAppStuapp) {
43 46
         N_Utils.validation(new Object[]{tAppStuapp.getVersionid(),"版本id",1});
44 47
         appStuappService.deleteById(tAppStuapp.getVersionid());
@@ -46,6 +49,7 @@ public class AppStuappController {
46 49
     }
47 50
 
48 51
     @PostMapping("/update")
52
+    @Action("学生平板端-修改")
49 53
     public ResultVo update(@RequestBody TAppStuapp tAppStuapp) {
50 54
         N_Utils.validation(new Object[]{tAppStuapp.getVersionid(),"版本id",1});
51 55
         appStuappService.update(tAppStuapp);

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppTeacherappController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.appversion;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.appversion.TAppTeacherapp;
6 7
 import com.xhkjedu.sapi.service.appversion.AppTeacherappService;
7 8
 import com.xhkjedu.utils.N_Utils;
@@ -30,6 +31,7 @@ public class AppTeacherappController {
30 31
     private AppTeacherappService appTeacherappService;
31 32
 
32 33
     @PostMapping("/add")
34
+    @Action("教师手机端-增加")
33 35
     public ResultVo add(@RequestBody TAppTeacherapp app) {
34 36
         N_Utils.validation(new Object[]{app.getVersionname(),"版本名称",2,
35 37
                 app.getVersioncode(),"版本号",2,app.getVersionpath(),"应用文件",2});
@@ -38,6 +40,7 @@ public class AppTeacherappController {
38 40
     }
39 41
 
40 42
     @PostMapping("/delete")
43
+    @Action("教师手机端-删除")
41 44
     public ResultVo delete(@RequestBody TAppTeacherapp app) {
42 45
         N_Utils.validation(new Object[]{app.getVersionid(),"版本id",1});
43 46
         appTeacherappService.deleteById(app.getVersionid());
@@ -45,6 +48,7 @@ public class AppTeacherappController {
45 48
     }
46 49
 
47 50
     @PostMapping("/update")
51
+    @Action("教师手机端-修改")
48 52
     public ResultVo update(@RequestBody TAppTeacherapp app) {
49 53
         N_Utils.validation(new Object[]{app.getVersionid(),"版本id",1});
50 54
         appTeacherappService.update(app);

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppTeacherclientController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.appversion;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.appversion.TAppTeacherclient;
6 7
 import com.xhkjedu.sapi.service.appversion.AppTeacherclientService;
7 8
 import com.xhkjedu.utils.N_Utils;
@@ -30,6 +31,7 @@ public class AppTeacherclientController {
30 31
     private AppTeacherclientService appTeacherclientService;
31 32
 
32 33
     @PostMapping("/add")
34
+    @Action("教师手机端-增加")
33 35
     public ResultVo add(@RequestBody TAppTeacherclient appclient) {
34 36
         N_Utils.validation(new Object[]{appclient.getVersionname(),"版本名称",2,
35 37
                 appclient.getVersioncode(),"版本号",2,appclient.getVersionpath(),"应用文件",2});
@@ -38,6 +40,7 @@ public class AppTeacherclientController {
38 40
     }
39 41
 
40 42
     @PostMapping("/delete")
43
+    @Action("教师手机端-删除")
41 44
     public ResultVo delete(@RequestBody TAppTeacherclient appclient) {
42 45
         N_Utils.validation(new Object[]{appclient.getVersionid(),"版本id",1});
43 46
         appTeacherclientService.deleteById(appclient.getVersionid());
@@ -45,6 +48,7 @@ public class AppTeacherclientController {
45 48
     }
46 49
 
47 50
     @PostMapping("/update")
51
+    @Action("教师手机端-修改")
48 52
     public ResultVo update(@RequestBody TAppTeacherclient appclient) {
49 53
         N_Utils.validation(new Object[]{appclient.getVersionid(),"版本id",1});
50 54
         appTeacherclientService.update(appclient);

+ 7
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppthirdController.java View File

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.sapi.controller.appversion;
2 2
 
3
+import com.xhkjedu.annotation.Action;
3 4
 import com.xhkjedu.sapi.model.appversion.TAppthird;
4 5
 import com.xhkjedu.sapi.model.appversion.TAppthirdHistory;
5 6
 import com.xhkjedu.sapi.service.appversion.AppthirdService;
@@ -28,6 +29,7 @@ public class AppthirdController {
28 29
     private AppthirdService appthirdService;
29 30
 
30 31
     @PostMapping("/add")
32
+    @Action("第三方应用-增加")
31 33
     public ResultVo add(@RequestBody TAppthird appthird) {
32 34
         N_Utils.validation(new Object[]{
33 35
                 appthird.getAppname(),"第三方应用名称",2,
@@ -39,6 +41,7 @@ public class AppthirdController {
39 41
 
40 42
 
41 43
     @PostMapping("/update")
44
+    @Action("第三方应用-修改")
42 45
     public ResultVo update(@RequestBody TAppthird appthird) {
43 46
         N_Utils.validation(new Object[]{appthird.getAppid(),"第三方应用id",1});
44 47
         appthirdService.update(appthird);
@@ -46,6 +49,7 @@ public class AppthirdController {
46 49
     }
47 50
 
48 51
     @PostMapping("/delete")
52
+    @Action("第三方应用-删除")
49 53
     public ResultVo delete(@RequestBody TAppthird appthird) {
50 54
         N_Utils.validation(new Object[]{appthird.getAppid(),"第三方应用id",1});
51 55
         appthirdService.deleteById(appthird.getAppid());
@@ -54,6 +58,7 @@ public class AppthirdController {
54 58
 
55 59
 
56 60
     @PostMapping("/update_state")
61
+    @Action("第三方应用-修改状态")
57 62
     public ResultVo updateState(@RequestBody TAppthird appthird) {
58 63
         Integer appid = appthird.getAppid();
59 64
         Integer appstate = appthird.getAppstate();
@@ -84,12 +89,14 @@ public class AppthirdController {
84 89
 
85 90
 
86 91
     @PostMapping("/add_history")
92
+    @Action("第三方应用-增加版本")
87 93
     public ResultVo addHistory(@RequestBody TAppthirdHistory history) {
88 94
         Integer id = appthirdService.saveHistory(history);
89 95
         return new ResultVo(0, "保存成功",id);
90 96
     }
91 97
 
92 98
     @PostMapping("/delete_history")
99
+    @Action("第三方应用-删除版本")
93 100
     public ResultVo deleteHistory(@RequestBody TAppthirdHistory history) {
94 101
         N_Utils.validation(new Object[]{history.getApphid(),"第三方应用历史id",1});
95 102
         appthirdService.deleteByApphId(history.getApphid());

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppthirdManagerController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.appversion;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.appversion.TAppthirdManager;
6 7
 import com.xhkjedu.sapi.service.appversion.AppthirdManagerService;
7 8
 import com.xhkjedu.utils.N_Utils;
@@ -29,6 +30,7 @@ public class AppthirdManagerController {
29 30
     private AppthirdManagerService appthirdManagerService;
30 31
 
31 32
     @PostMapping("/add")
33
+    @Action("应用白名单-增加")
32 34
     public ResultVo add(@RequestBody TAppthirdManager manager) {
33 35
         String id = appthirdManagerService.save(manager);
34 36
         if (id == null) {
@@ -39,12 +41,14 @@ public class AppthirdManagerController {
39 41
     }
40 42
 
41 43
     @PostMapping("/delete")
44
+    @Action("应用白名单-删除")
42 45
     public ResultVo delete(@RequestBody TAppthirdManager manager) {
43 46
         appthirdManagerService.deleteById(manager.getMid());
44 47
         return new ResultVo(0,"删除成功");
45 48
     }
46 49
 
47 50
     @PostMapping("/update")
51
+    @Action("应用白名单-修改")
48 52
     public ResultVo update(@RequestBody TAppthirdManager tAppthirdManager) {
49 53
         return appthirdManagerService.update(tAppthirdManager);
50 54
     }

+ 3
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/AppthirdMonitorController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.appversion;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.appversion.TAppthirdMonitor;
6 7
 import com.xhkjedu.sapi.service.appversion.AppthirdMonitorService;
7 8
 import com.xhkjedu.utils.N_Utils;
@@ -32,6 +33,7 @@ public class AppthirdMonitorController {
32 33
     private AppthirdMonitorService appthirdMonitorService;
33 34
 
34 35
     @PostMapping("/add")
36
+    @Action("三方应用监控-增加")
35 37
     public ResultVo add(@RequestBody TAppthirdMonitor monitor) {
36 38
         Integer id = appthirdMonitorService.save(monitor);
37 39
         return new ResultVo(0, "保存成功",id);
@@ -69,6 +71,7 @@ public class AppthirdMonitorController {
69 71
     }
70 72
 
71 73
     @PostMapping("/handle")
74
+    @Action("三方应用监控-标记")
72 75
     public ResultVo handle(@RequestBody AppSearchVo monitor) {
73 76
         N_Utils.validation(new Object[]{monitor.getCreateid(),"处理人id",1,monitor.getSchoolid(),"学校id",1});
74 77
         appthirdMonitorService.handle(monitor);

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/appversion/WebVersionController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.appversion;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.appversion.TWebVersion;
6 7
 import com.xhkjedu.sapi.service.appversion.WebVersionService;
7 8
 import com.xhkjedu.utils.N_Utils;
@@ -30,6 +31,7 @@ public class WebVersionController {
30 31
     private WebVersionService webVersionService;
31 32
 
32 33
     @PostMapping("/add")
34
+    @Action("校园网页端-增加")
33 35
     public ResultVo add(@RequestBody TWebVersion app) {
34 36
         N_Utils.validation(new Object[]{app.getVersionname(), "版本名称", 2
35 37
                 , app.getVersiontype(), "网页端类型", 1, app.getVersioncomm(), "更新内容", 2});
@@ -38,6 +40,7 @@ public class WebVersionController {
38 40
     }
39 41
 
40 42
     @PostMapping("/delete")
43
+    @Action("校园网页端-删除")
41 44
     public ResultVo delete(@RequestBody TWebVersion app) {
42 45
         N_Utils.validation(new Object[]{app.getVersionid(), "版本id", 1});
43 46
         webVersionService.deleteById(app.getVersionid());
@@ -45,6 +48,7 @@ public class WebVersionController {
45 48
     }
46 49
 
47 50
     @PostMapping("/update")
51
+    @Action("校园网页端-修改")
48 52
     public ResultVo update(@RequestBody TWebVersion app) {
49 53
         N_Utils.validation(new Object[]{app.getVersionid(), "版本id", 1});
50 54
         webVersionService.update(app);

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/assess/AssessController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.assess;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.assess.TAssess;
6 7
 import com.xhkjedu.sapi.service.assess.AssessService;
7 8
 import com.xhkjedu.utils.N_Utils;
@@ -30,18 +31,21 @@ public class AssessController {
30 31
     private AssessService assessService;
31 32
 
32 33
     @PostMapping("/add")
34
+    @Action("评价录入-增加")
33 35
     public ResultVo add(@RequestBody TAssess assess) {
34 36
         TAssess tAssess = assessService.save(assess);
35 37
         return new ResultVo(0,"保存成功",tAssess);
36 38
     }
37 39
 
38 40
     @PostMapping("/delete")
41
+    @Action("评价录入-删除")
39 42
     public ResultVo delete(@RequestBody TAssess assess) {
40 43
         assessService.deleteById(assess.getAssessid());
41 44
         return new ResultVo(0,"删除成功");
42 45
     }
43 46
 
44 47
     @PostMapping("/update")
48
+    @Action("评价录入-修改")
45 49
     public ResultVo update(@RequestBody TAssess assess) {
46 50
         assessService.update(assess);
47 51
         return new ResultVo(0,"修改成功");

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/assess/AssessQuotaController.java View File

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.sapi.controller.assess;
2 2
 
3
+import com.xhkjedu.annotation.Action;
3 4
 import com.xhkjedu.sapi.model.assess.TAssessQuota;
4 5
 import com.xhkjedu.sapi.service.assess.AssessQuotaService;
5 6
 import com.xhkjedu.utils.N_Utils;
@@ -27,6 +28,7 @@ public class AssessQuotaController {
27 28
 
28 29
     //保存
29 30
     @PostMapping("/add")
31
+    @Action("评价指标-增加")
30 32
     public ResultVo add(@RequestBody TAssessQuota quota) {
31 33
         String quotaname = quota.getQuotaname();
32 34
         Integer createid = quota.getCreateid();
@@ -38,6 +40,7 @@ public class AssessQuotaController {
38 40
 
39 41
     //删除
40 42
     @PostMapping("/delete")
43
+    @Action("评价指标-删除")
41 44
     public ResultVo delete(@RequestBody TAssessQuota quota) {
42 45
         Integer quotaid = quota.getQuotaid();
43 46
         N_Utils.validation(new Object[]{quotaid,"指标id",1});
@@ -51,6 +54,7 @@ public class AssessQuotaController {
51 54
 
52 55
     //修改
53 56
     @PostMapping("/update")
57
+    @Action("评价指标-修改")
54 58
     public ResultVo update(@RequestBody TAssessQuota quota) {
55 59
         String quotaname = quota.getQuotaname();
56 60
         Integer createid = quota.getCreateid();

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/assess/AssessTemplateController.java View File

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.sapi.controller.assess;
2 2
 
3
+import com.xhkjedu.annotation.Action;
3 4
 import com.xhkjedu.sapi.model.assess.TAssessTemplate;
4 5
 import com.xhkjedu.sapi.service.assess.AssessTemplateService;
5 6
 import com.xhkjedu.utils.N_Utils;
@@ -27,6 +28,7 @@ public class AssessTemplateController {
27 28
 
28 29
     //添加
29 30
     @PostMapping("/add")
31
+    @Action("评价模版-增加")
30 32
     public ResultVo add(@RequestBody TAssessTemplate template) {
31 33
         List<Integer> quotaids = template.getQutoaids();
32 34
         if(quotaids==null || quotaids.size()==0){
@@ -44,6 +46,7 @@ public class AssessTemplateController {
44 46
 
45 47
     //删除
46 48
     @PostMapping("/delete")
49
+    @Action("评价模版-删除")
47 50
     public ResultVo delete(@RequestBody TAssessTemplate template) {
48 51
         Integer templateid = template.getTemplateid();
49 52
         N_Utils.validation(new Object[]{templateid,"模版id",1});
@@ -53,6 +56,7 @@ public class AssessTemplateController {
53 56
 
54 57
     //修改
55 58
     @PostMapping("/update")
59
+    @Action("评价模版-修改")
56 60
     public ResultVo update(@RequestBody TAssessTemplate template) {
57 61
         List<Integer> quotaids = template.getQutoaids();
58 62
         if(quotaids==null || quotaids.size()==0){

+ 6
- 2
sapi/src/main/java/com/xhkjedu/sapi/controller/assess/AssessUserController.java View File

@@ -2,11 +2,12 @@ package com.xhkjedu.sapi.controller.assess;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.assess.TAssessUser;
6 7
 import com.xhkjedu.sapi.service.assess.AssessUserService;
8
+import com.xhkjedu.sapi.utils.PoiUtils;
7 9
 import com.xhkjedu.utils.N_Utils;
8 10
 import com.xhkjedu.utils.PageUtil;
9
-import com.xhkjedu.sapi.utils.PoiUtils;
10 11
 import com.xhkjedu.vo.PageResult;
11 12
 import com.xhkjedu.vo.ResultVo;
12 13
 import org.springframework.web.bind.annotation.PostMapping;
@@ -33,12 +34,14 @@ public class AssessUserController {
33 34
     private AssessUserService assessUserService;
34 35
 
35 36
     @PostMapping("/add")
37
+    @Action("评价录入-增加用户")
36 38
     public ResultVo add(@RequestBody TAssessUser user) {
37 39
         TAssessUser assessUser = assessUserService.save(user);
38 40
         return new ResultVo(0,"保存成功",assessUser);
39 41
     }
40 42
 
41 43
     @PostMapping("/delete")
44
+    @Action("评价录入-删除用户")
42 45
     public ResultVo delete(@RequestBody TAssessUser user) {
43 46
         Integer auid = user.getAuid();
44 47
         N_Utils.validation(new Object[]{auid,"评价用户id",1});
@@ -73,7 +76,8 @@ public class AssessUserController {
73 76
     }
74 77
 
75 78
     @PostMapping("/import")
76
-    public ResultVo importAssess(MultipartFile file, TAssessUser user) {
79
+    @Action("评价录入-导入用户")
80
+    public ResultVo importAssess(TAssessUser user,MultipartFile file) {
77 81
         Integer schoolid = user.getSchoolid();
78 82
         Integer assessid = user.getAssessid();
79 83
         Integer templateid = user.getTemplateid();

+ 3
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/cloud/CloudController.java View File

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.sapi.controller.cloud;
2 2
 
3
+import com.xhkjedu.annotation.Action;
3 4
 import com.xhkjedu.sapi.model.cloud.TCloud;
4 5
 import com.xhkjedu.sapi.service.cloud.CloudService;
5 6
 import com.xhkjedu.utils.N_Utils;
@@ -32,6 +33,7 @@ public class CloudController {
32 33
 
33 34
     //修改主题色
34 35
     @PostMapping("/update")
36
+    @Action("区域信息-修改主题")
35 37
     public ResultVo update(@RequestBody TCloud cloud) {
36 38
         N_Utils.validation(new Object[]{cloud.getCloudid(), "平台id", 1
37 39
         ,cloud.getTheme(),"主题色",2,cloud.getLoginbg(),"登录背景图片",2
@@ -42,6 +44,7 @@ public class CloudController {
42 44
 
43 45
     //修改区域基础信息
44 46
     @PostMapping("/upinfo")
47
+    @Action("区域信息-修改基础信息")
45 48
     public ResultVo updateInfo(@RequestBody TCloud cloud) {
46 49
         N_Utils.validation(new Object[]{cloud.getCloudid(), "平台id", 1,cloud.getCloudname(),"平台名称",2});
47 50
         cloudService.updateInfo(cloud);

+ 14
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/cloud/CloudSyncController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.cloud;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.cloud.TCloudSync;
6 7
 import com.xhkjedu.sapi.service.cloud.CloudSyncService;
7 8
 import com.xhkjedu.utils.N_Utils;
@@ -41,9 +42,22 @@ public class CloudSyncController {
41 42
     }
42 43
 
43 44
     @PostMapping("/sync")
45
+    @Action("同步任务-同步")
44 46
     public ResultVo sync(@RequestBody TCloudSync sync) {
45 47
         N_Utils.validation(new Object[]{sync.getCreateid(), "创建人id", 1
46 48
                 ,sync.getCloudcode(),"平台码",2,sync.getSyncnum(),"一次同步数量",1});
47 49
         return cloudSyncService.sync(sync);
48 50
     }
51
+
52
+    /**
53
+     * @Description 获取同步类型
54
+     * @Date 2023/10/13 15:15
55
+     * @Author YWX
56
+     * @Param []
57
+     * @Return com.xhkjedu.vo.ResultVo
58
+     **/
59
+    @PostMapping("/list_module")
60
+    public ResultVo listModule() {
61
+        return cloudSyncService.listModule();
62
+    }
49 63
 }

+ 3
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/dock/LcController.java View File

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.sapi.controller.dock;
2 2
 
3
+import com.xhkjedu.annotation.Action;
3 4
 import com.xhkjedu.sapi.model.system.TSchool;
4 5
 import com.xhkjedu.sapi.service.dock.LcService;
5 6
 import com.xhkjedu.utils.N_Utils;
@@ -26,6 +27,7 @@ public class LcController {
26 27
 
27 28
     //绑定领创管控信息
28 29
     @PostMapping("/add")
30
+    @Action("领创管控-绑定学校")
29 31
     public ResultVo addSchool(@RequestBody LcSchoolVo school) {
30 32
         Integer schoolid = school.getSchoolid();
31 33
         N_Utils.validation(new Object[]{schoolid,"学校id",1});
@@ -34,6 +36,7 @@ public class LcController {
34 36
 
35 37
     //绑定管理员
36 38
     @PostMapping("/adda")
39
+    @Action("领创管控-绑定学校管理员")
37 40
     public ResultVo addAdmin(@RequestBody TSchool school) {
38 41
         Integer schoolid = school.getSchoolid();
39 42
         N_Utils.validation(new Object[]{schoolid, "学校id", 1});

+ 5
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/itemtool/ReadController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.itemtool;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.itemtool.TRead;
6 7
 import com.xhkjedu.sapi.model.itemtool.TReadStudent;
7 8
 import com.xhkjedu.sapi.service.itemtool.ReadService;
@@ -38,6 +39,7 @@ public class ReadController {
38 39
      * @return com.xhkjedu.vo.ResultVo
39 40
      */
40 41
     @PostMapping("/save")
42
+    @Action("电子书-增加")
41 43
     public ResultVo save(@RequestBody TRead read){
42 44
         N_Utils.validation(new Object[]{read.getReadname(),"阅读标题",2,
43 45
                 read.getReadpath(),"阅读文件",2});
@@ -57,6 +59,7 @@ public class ReadController {
57 59
      * @return com.xhkjedu.vo.ResultVo
58 60
      */
59 61
     @PostMapping("/up")
62
+    @Action("电子书-修改")
60 63
     public ResultVo update(@RequestBody TRead read){
61 64
         N_Utils.validation(new Object[]{
62 65
                 read.getReadid(),"阅读id",1,
@@ -77,6 +80,7 @@ public class ReadController {
77 80
      * @return com.xhkjedu.vo.ResultVo
78 81
      */
79 82
     @PostMapping("/del")
83
+    @Action("电子书-删除")
80 84
     public ResultVo del(@RequestBody TRead read){
81 85
         N_Utils.validation(new Object[]{read.getReadid(),"阅读id",1});
82 86
         Integer result = readService.del(read.getReadid());
@@ -196,6 +200,7 @@ public class ReadController {
196 200
     }
197 201
 
198 202
     @PostMapping("/update_state")
203
+    @Action("电子书-修改状态")
199 204
     public ResultVo updateState(@RequestBody TRead read){
200 205
         Integer readid = read.getReadid();
201 206
         Integer readstate = read.getReadstate();

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/itemtool/TodoController.java View File

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.sapi.controller.itemtool;
2 2
 
3
+import com.xhkjedu.annotation.Action;
3 4
 import com.xhkjedu.sapi.model.itemtool.TTodo;
4 5
 import com.xhkjedu.sapi.service.itemtool.TodoService;
5 6
 import com.xhkjedu.utils.N_Utils;
@@ -25,12 +26,14 @@ public class TodoController {
25 26
     private TodoService todoService;
26 27
 
27 28
     @PostMapping("/add")
29
+    @Action("待办事项-增加")
28 30
     public ResultVo add(@RequestBody TTodo tTodo) {
29 31
         Integer id = todoService.save(tTodo);
30 32
         return new ResultVo(0, "保存成功",id);
31 33
     }
32 34
 
33 35
     @PostMapping("/delete")
36
+    @Action("待办事项-删除")
34 37
     public ResultVo delete(@RequestBody TTodo tTodo) {
35 38
         N_Utils.validation(new Object[]{tTodo.getTodoid(),"待办事项id",1});
36 39
         todoService.deleteById(tTodo.getTodoid());
@@ -38,6 +41,7 @@ public class TodoController {
38 41
     }
39 42
 
40 43
     @PostMapping("/update")
44
+    @Action("待办事项-修改")
41 45
     public ResultVo update(@RequestBody TTodo tTodo) {
42 46
         N_Utils.validation(new Object[]{tTodo.getTodoid(),"待办事项id",1});
43 47
         todoService.update(tTodo);

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/notice/NoticeController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.notice;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.notice.TNotice;
6 7
 import com.xhkjedu.sapi.service.notice.NoticeService;
7 8
 import com.xhkjedu.utils.N_Utils;
@@ -30,12 +31,14 @@ public class NoticeController {
30 31
     private NoticeService noticeService;
31 32
 
32 33
     @PostMapping("/add")
34
+    @Action("通知管理-增加")
33 35
     public ResultVo add(@RequestBody TNotice tNotice) {
34 36
         Integer id = noticeService.save(tNotice);
35 37
         return new ResultVo(0, "保存成功",id);
36 38
     }
37 39
 
38 40
     @PostMapping("/delete")
41
+    @Action("通知管理-删除")
39 42
     public ResultVo delete(@RequestBody TNotice tNotice) {
40 43
         N_Utils.validation(new Object[]{tNotice.getNoticeid(),"通知id",1});
41 44
         noticeService.deleteById(tNotice.getNoticeid());
@@ -43,6 +46,7 @@ public class NoticeController {
43 46
     }
44 47
 
45 48
     @PostMapping("/update")
49
+    @Action("通知管理-修改")
46 50
     public ResultVo update(@RequestBody TNotice tNotice) {
47 51
         N_Utils.validation(new Object[]{tNotice.getNoticeid(),"通知id",1});
48 52
         noticeService.update(tNotice);

+ 5
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/research/ResearchController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.research;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.research.TResearch;
6 7
 import com.xhkjedu.sapi.model.research.TResearchUser;
7 8
 import com.xhkjedu.sapi.service.research.ResearchService;
@@ -60,6 +61,7 @@ public class ResearchController {
60 61
      * @return com.xhkjedu.vo.ResultVo
61 62
      */
62 63
     @PostMapping("/save")
64
+    @Action("教研管理-增加")
63 65
     public ResultVo save(@RequestBody TResearch research){
64 66
         N_Utils.validation(new Object[]{
65 67
                 research.getResearchname(),"教研标题",2,
@@ -81,6 +83,7 @@ public class ResearchController {
81 83
      * @return com.xhkjedu.vo.ResultVo
82 84
      */
83 85
     @PostMapping("/up")
86
+    @Action("教研管理-修改")
84 87
     public ResultVo update(@RequestBody TResearch research){
85 88
         N_Utils.validation(new Object[]{
86 89
                 research.getResearchid(),"教研id",1,
@@ -99,6 +102,7 @@ public class ResearchController {
99 102
      * @return com.xhkjedu.vo.ResultVo
100 103
      */
101 104
     @PostMapping("/del")
105
+    @Action("教研管理-删除")
102 106
     public ResultVo del(@RequestBody TResearch research){
103 107
         N_Utils.validation(new Object[]{
104 108
                 research.getResearchid(),"教研id",1
@@ -172,6 +176,7 @@ public class ResearchController {
172 176
     * @Date 2023/8/8 15:39:05
173 177
     */
174 178
     @PostMapping("deltr")
179
+    @Action("教研管理-删除教师教研")
175 180
     public ResultVo delTeacherResearch(@RequestBody TResearchUser ruser){
176 181
         N_Utils.validation(new Object[]{
177 182
                 ruser.getRuid(),"教师教研id",1,

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/research/ResearchUserController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.research;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.research.TResearch;
6 7
 import com.xhkjedu.sapi.model.research.TResearchUser;
7 8
 import com.xhkjedu.sapi.service.research.ResearchUserService;
@@ -108,6 +109,7 @@ public class ResearchUserController {
108 109
      * @return com.xhkjedu.vo.ResultVo
109 110
      */
110 111
     @PostMapping("/up")
112
+    @Action("教研管理-保存教师教研")
111 113
     public ResultVo up(@RequestBody TResearchUser research){
112 114
         N_Utils.validation(new Object[]{
113 115
                 research.getResearchid(),"教研id",1,
@@ -136,6 +138,7 @@ public class ResearchUserController {
136 138
      * @Date 2023/8/8 15:39:05
137 139
      */
138 140
     @PostMapping("deltr")
141
+    @Action("教研管理-删除教师教研")
139 142
     public ResultVo delTeacherResearch(@RequestBody TResearchUser ruser){
140 143
         N_Utils.validation(new Object[]{ruser.getRuid(),"教师教研id",1,ruser.getUserid(),"当前登录教师id",1});
141 144
         return researchUserService.delTeacherResearch(ruser);
@@ -147,6 +150,7 @@ public class ResearchUserController {
147 150
     * @Date 2023/8/8 16:03:54
148 151
     */
149 152
     @PostMapping("uptr")
153
+    @Action("教研管理-修改教研内容")
150 154
     public ResultVo updateTeacherResearch(@RequestBody TResearchUser ruser){
151 155
         N_Utils.validation(new Object[]{ruser.getRuid(),"教师教研id",1,ruser.getUserid(),"当前登录教师id",1});
152 156
         return researchUserService.updateTeacherResearch(ruser);

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/system/AreazoneController.java View File

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.sapi.controller.system;
2 2
 
3
+import com.xhkjedu.annotation.Action;
3 4
 import com.xhkjedu.sapi.model.system.TAreazone;
4 5
 import com.xhkjedu.sapi.service.system.AreazoneService;
5 6
 import com.xhkjedu.vo.ResultVo;
@@ -25,18 +26,21 @@ public class AreazoneController {
25 26
     private AreazoneService areazoneService;
26 27
 
27 28
     @PostMapping("/add")
29
+    @Action("区域管理-增加")
28 30
     public ResultVo add(@RequestBody TAreazone areazone) {
29 31
         areazoneService.save(areazone);
30 32
         return new ResultVo(0, "保存成功");
31 33
     }
32 34
 
33 35
     @PostMapping("/delete")
36
+    @Action("区域管理-删除")
34 37
     public ResultVo delete(@RequestBody TAreazone areazone) {
35 38
         areazoneService.deleteById(areazone.getAreaid());
36 39
         return new ResultVo(0,"删除成功");
37 40
     }
38 41
 
39 42
     @PostMapping("/update")
43
+    @Action("区域管理-修改")
40 44
     public ResultVo update(@RequestBody TAreazone areazone) {
41 45
         areazoneService.update(areazone);
42 46
         return new ResultVo(0,"修改成功");

+ 7
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/system/ModuleController.java View File

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.sapi.controller.system;
2 2
 
3
+import com.xhkjedu.annotation.Action;
3 4
 import com.xhkjedu.sapi.model.system.TModule;
4 5
 import com.xhkjedu.sapi.service.system.ModuleService;
5 6
 import com.xhkjedu.utils.N_Utils;
@@ -89,6 +90,7 @@ public class ModuleController {
89 90
      * @return com.xhkjedu.vo.ResultVo
90 91
      */
91 92
     @PostMapping("/add")
93
+    @Action("学校模块-增加")
92 94
     public ResultVo add(@RequestBody TModule module){
93 95
         N_Utils.validation(new Object[]{
94 96
                 module.getModulename(),"应用名称",2,
@@ -116,6 +118,7 @@ public class ModuleController {
116 118
      * @return com.xhkjedu.vo.ResultVo
117 119
      */
118 120
     @PostMapping("/up")
121
+    @Action("学校模块-修改")
119 122
     public ResultVo update(@RequestBody TModule module){
120 123
         N_Utils.validation(new Object[]{
121 124
                 module.getModuleid(),"应用id",1,
@@ -136,6 +139,7 @@ public class ModuleController {
136 139
      * @return com.xhkjedu.vo.ResultVo
137 140
      */
138 141
     @PostMapping("/del")
142
+    @Action("学校模块-删除")
139 143
     public ResultVo del(@RequestBody TModule module) {
140 144
         if (N_Utils.isEmpty(module.getModuleid()))
141 145
             return new ResultVo(1,"未选择删除的应用");
@@ -159,6 +163,7 @@ public class ModuleController {
159 163
     }
160 164
 
161 165
     @PostMapping("/move_up")
166
+    @Action("学校模块-移动")
162 167
     public ResultVo moveUp(@RequestBody List<TModule> modules){
163 168
         if (N_Utils.isListEmpty(modules)) {
164 169
             return new ResultVo(1,"要移动的模块信息不能为空");
@@ -178,6 +183,7 @@ public class ModuleController {
178 183
 
179 184
     //设置显示
180 185
     @PostMapping("/dis")
186
+    @Action("学校模块-设置显示")
181 187
     public ResultVo updateModuleDisplay(@RequestBody TModule module){
182 188
         N_Utils.validation(new Object[]{module.getModuleid(),"模块id",2});
183 189
         moduleService.updateModuleDisplay(module.getModuleid(),1);
@@ -186,6 +192,7 @@ public class ModuleController {
186 192
 
187 193
     //设置模块不显示
188 194
     @PostMapping("/nodis")
195
+    @Action("学校模块-设置不显示")
189 196
     public ResultVo updateModuleNoDisplay(@RequestBody TModule module){
190 197
         N_Utils.validation(new Object[]{module.getModuleid(),"模块id",2});
191 198
         moduleService.updateModuleDisplay(module.getModuleid(),10);

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/system/ModuledefaultController.java View File

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.sapi.controller.system;
2 2
 
3
+import com.xhkjedu.annotation.Action;
3 4
 import com.xhkjedu.sapi.model.system.TModuledefault;
4 5
 import com.xhkjedu.sapi.service.system.ModuledefaultService;
5 6
 import com.xhkjedu.utils.N_Utils;
@@ -26,6 +27,7 @@ public class ModuledefaultController {
26 27
     private ModuledefaultService moduledefaultService;
27 28
 
28 29
     @PostMapping("/add")
30
+    @Action("模块管理-增加")
29 31
     public ResultVo add(@RequestBody TModuledefault tModuledefault) {
30 32
         N_Utils.validation(new Object[]{tModuledefault.getBelong(),"模块归属",1});
31 33
         if(tModuledefault.getLevel() == 2){
@@ -35,6 +37,7 @@ public class ModuledefaultController {
35 37
     }
36 38
 
37 39
     @PostMapping("/delete")
40
+    @Action("模块管理-删除")
38 41
     public ResultVo delete(@RequestBody TModuledefault tModuledefault) {
39 42
         N_Utils.validation(new Object[]{tModuledefault.getModuleid(),"模块id",2});
40 43
         moduledefaultService.deleteById(tModuledefault.getModuleid());
@@ -42,6 +45,7 @@ public class ModuledefaultController {
42 45
     }
43 46
 
44 47
     @PostMapping("/update")
48
+    @Action("模块管理-修改")
45 49
     public ResultVo update(@RequestBody TModuledefault tModuledefault) {
46 50
         moduledefaultService.update(tModuledefault);
47 51
         return new ResultVo(0,"修改成功");

+ 3
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/system/PictureController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.system;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.system.TPicture;
6 7
 import com.xhkjedu.sapi.service.system.PictureService;
7 8
 import com.xhkjedu.utils.N_Utils;
@@ -46,12 +47,14 @@ public class PictureController {
46 47
     }
47 48
 
48 49
     @PostMapping("/add")
50
+    @Action("图片管理-增加")
49 51
     public ResultVo add(@RequestBody TPicture picture) {
50 52
         pictureService.add(picture);
51 53
         return new ResultVo(0,"添加成功");
52 54
     }
53 55
 
54 56
     @PostMapping("/del")
57
+    @Action("图片管理-删除")
55 58
     public ResultVo del(@RequestBody TPicture picture) {
56 59
         Integer picid = picture.getPicid();
57 60
         N_Utils.validation(new Object[]{picid,"图片id",1});

+ 7
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/system/SchoolController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.system;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.system.TSchool;
6 7
 import com.xhkjedu.sapi.model.system.TSchoolUpgradeHistory;
7 8
 import com.xhkjedu.sapi.service.system.SchoolService;
@@ -34,6 +35,7 @@ public class SchoolController {
34 35
     private SchoolService schoolService;
35 36
 
36 37
     @PostMapping("/add")
38
+    @Action("学校管理-增加")
37 39
     public ResultVo add(@RequestBody TSchool tSchool) {
38 40
         try {
39 41
             String schoolname = tSchool.getSchoolname();
@@ -48,6 +50,7 @@ public class SchoolController {
48 50
     }
49 51
 
50 52
     @PostMapping("/delete")
53
+    @Action("学校管理-删除")
51 54
     public ResultVo delete(@RequestBody TSchool tSchool) {
52 55
         N_Utils.validation(new Object[]{tSchool.getSchoolid(),"学校id",1});
53 56
         schoolService.deleteById(tSchool.getSchoolid());
@@ -55,6 +58,7 @@ public class SchoolController {
55 58
     }
56 59
 
57 60
     @PostMapping("/update")
61
+    @Action("学校管理-修改")
58 62
     public ResultVo update(@RequestBody TSchool tSchool) {
59 63
         N_Utils.validation(new Object[]{tSchool.getSchoolid(),"学校id",1});
60 64
         schoolService.update(tSchool);
@@ -93,6 +97,7 @@ public class SchoolController {
93 97
 
94 98
     //学年升级
95 99
     @PostMapping("/upgrade")
100
+    @Action("学校管理-学年升级")
96 101
     public ResultVo upgrade(@RequestBody TSchool tSchool) {
97 102
         Integer schoolid = tSchool.getSchoolid();
98 103
         Integer createid = tSchool.getCreateid();
@@ -111,6 +116,7 @@ public class SchoolController {
111 116
 
112 117
     //学年降级
113 118
     @PostMapping("/downgrade")
119
+    @Action("学校管理-学校降级")
114 120
     public ResultVo downgrade(@RequestBody TSchool tSchool) {
115 121
         Integer schoolid = tSchool.getSchoolid();
116 122
         Integer createid = tSchool.getCreateid();
@@ -184,6 +190,7 @@ public class SchoolController {
184 190
      * @Date 2022/9/22 16:24
185 191
      **/
186 192
     @PostMapping("/sfschool")
193
+    @Action("学校管理-保存关联学校")
187 194
     public ResultVo saveSchoolFriend(@RequestBody SchoolParams params) {
188 195
         Integer schoolid = params.getSchoolid();
189 196
         N_Utils.validation(new Object[]{schoolid, "学校id", 1});

+ 18
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/system/SchoolStypeController.java View File

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.sapi.controller.system;
2 2
 
3
+import com.xhkjedu.annotation.Action;
3 4
 import com.xhkjedu.sapi.model.system.TSchoolStype;
4 5
 import com.xhkjedu.sapi.service.system.SchoolStypeService;
5 6
 import com.xhkjedu.utils.N_Utils;
@@ -11,6 +12,7 @@ import org.springframework.web.bind.annotation.RestController;
11 12
 
12 13
 import javax.annotation.Resource;
13 14
 import java.util.List;
15
+import java.util.Map;
14 16
 
15 17
 /**
16 18
 * @author ywx
@@ -25,6 +27,7 @@ public class SchoolStypeController {
25 27
     private SchoolStypeService schoolStypeService;
26 28
 
27 29
     @PostMapping("/add")
30
+    @Action("学校主题-增加")
28 31
     public ResultVo add(@RequestBody List<TSchoolStype> list) {
29 32
         return schoolStypeService.batchSave(list);
30 33
     }
@@ -37,6 +40,7 @@ public class SchoolStypeController {
37 40
     }
38 41
 
39 42
     @PostMapping("/add2")
43
+    @Action("学校主题-增加")
40 44
     public ResultVo add2(@RequestBody List<TSchoolStype> list) {
41 45
         if (N_Utils.isListEmpty(list)) return new ResultVo(1,"学校样式不能为空");
42 46
         return schoolStypeService.batchSave2(list);
@@ -49,4 +53,18 @@ public class SchoolStypeController {
49 53
         List<TSchoolStype> list = schoolStypeService.listAll2(stype);
50 54
         return new ResultVo(0,"获取学校样式列表成功",list);
51 55
     }
56
+
57
+    /*
58
+     * @Description 获取学校样式(设置登录页面获取数据)
59
+     * @Date 2023/11/21 10:19:12
60
+     * @Author WN
61
+     * @Param [stype]
62
+     * @Return com.xhkjedu.vo.ResultVo
63
+     **/
64
+    @PostMapping("/sstyles")
65
+    public ResultVo allList(@RequestBody TSchoolStype stype) {
66
+        N_Utils.validation(new Object[]{stype.getSchoolid(),"学校id",1});
67
+        Map<String,List<TSchoolStype>> rtnMap = schoolStypeService.listSchoolStypeAndDefault(stype);
68
+        return new ResultVo(0,"获取学校样式列表成功",rtnMap);
69
+    }
52 70
 }

+ 2
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/system/SyserrorController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sapi.controller.system;
2 2
 
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.annotation.Action;
5 6
 import com.xhkjedu.sapi.model.system.TSyserror;
6 7
 import com.xhkjedu.sapi.service.system.SyserrorService;
7 8
 import com.xhkjedu.utils.PageUtil;
@@ -28,6 +29,7 @@ public class SyserrorController {
28 29
     private SyserrorService syserrorService;
29 30
 
30 31
     @PostMapping("/add")
32
+    @Action("系统错误-增加")
31 33
     public ResultVo add(@RequestBody TSyserror error) {
32 34
         Integer id = syserrorService.save(error);
33 35
         return new ResultVo(0, "保存成功",id);

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/system/UserModuleController.java View File

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.sapi.controller.system;
2 2
 
3
+import com.xhkjedu.annotation.Action;
3 4
 import com.xhkjedu.sapi.model.system.TUserModule;
4 5
 import com.xhkjedu.sapi.service.system.UserModuleService;
5 6
 import com.xhkjedu.utils.N_Utils;
@@ -43,6 +44,7 @@ public class UserModuleController {
43 44
      * @return com.xhkjedu.vo.ResultVo
44 45
      */
45 46
     @PostMapping("/save")
47
+    @Action("常用应用-增加")
46 48
     public ResultVo save(@RequestBody TUserModule userModule){
47 49
         N_Utils.validation(new Object[]{
48 50
                 userModule.getUserid(),"用户id",1,
@@ -74,6 +76,7 @@ public class UserModuleController {
74 76
      * @return com.xhkjedu.vo.ResultVo
75 77
      */
76 78
     @PostMapping("/up")
79
+    @Action("常用应用-修改")
77 80
     public ResultVo update(@RequestBody TUserModule userModule){
78 81
         N_Utils.validation(new Object[]{
79 82
                 userModule.getUmid(),"用户应用id",1,
@@ -92,6 +95,7 @@ public class UserModuleController {
92 95
      * @return com.xhkjedu.vo.ResultVo
93 96
      */
94 97
     @PostMapping("/del")
98
+    @Action("常用应用-删除")
95 99
     public ResultVo del(@RequestBody TUserModule userModule) {
96 100
         if (!N_Utils.isTrueInteger(userModule.getUmid()))
97 101
             return new ResultVo(1,"未选择删除的常用应用");

+ 0
- 31
sapi/src/main/java/com/xhkjedu/sapi/interceptors/HttpServletFilter.java View File

@@ -1,31 +0,0 @@
1
-package com.xhkjedu.sapi.interceptors;
2
-
3
-import org.springframework.stereotype.Component;
4
-
5
-import javax.servlet.*;
6
-import javax.servlet.http.HttpServletRequest;
7
-import java.io.IOException;
8
-
9
-/**
10
- * @author ywx
11
- * @classname HttpServletFilter
12
- * @description 过滤器 以便http post请求body输入流可多次读取
13
- * @date 2020/11/9 11:25
14
- **/
15
-@Component
16
-public class HttpServletFilter implements Filter {
17
-
18
-    @Override
19
-    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
20
-        ServletRequest requestWrapper = null;
21
-        if (request instanceof HttpServletRequest) {
22
-            requestWrapper = new RequestWrapper((HttpServletRequest) request);
23
-        }
24
-        if (requestWrapper == null) {
25
-            chain.doFilter(request, response);
26
-        } else {
27
-            chain.doFilter(requestWrapper, response);
28
-        }
29
-    }
30
-
31
-}

+ 0
- 131
sapi/src/main/java/com/xhkjedu/sapi/interceptors/RequestInterceptor.java View File

@@ -1,131 +0,0 @@
1
-package com.xhkjedu.sapi.interceptors;
2
-
3
-import com.alibaba.fastjson.JSON;
4
-import com.xhkjedu.exception.MissingParametersException;
5
-import com.xhkjedu.sapi.utils.ApiUtil;
6
-import com.xhkjedu.utils.JedisUtil;
7
-import com.xhkjedu.utils.N_Utils;
8
-import com.xhkjedu.vo.ResultVo;
9
-import lombok.extern.slf4j.Slf4j;
10
-import org.springframework.context.annotation.Configuration;
11
-import org.springframework.web.servlet.HandlerInterceptor;
12
-import org.springframework.web.servlet.ModelAndView;
13
-
14
-import javax.servlet.http.HttpServletRequest;
15
-import javax.servlet.http.HttpServletResponse;
16
-import java.util.Map;
17
-
18
-@Configuration
19
-@Slf4j
20
-public class RequestInterceptor extends JedisUtil implements HandlerInterceptor {
21
-    @Override
22
-    public void afterCompletion(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, Exception arg3)
23
-            throws Exception {
24
-        // 请求结束时间
25
-        Long endTime = System.currentTimeMillis();
26
-        // 从HttpServletRequest获取开始时间
27
-        Long startTime = (Long) arg0.getAttribute("_startTime");
28
-        double time = ((endTime - startTime) * 1.000) / 1000;
29
-        // 打印接口信息及耗时
30
-        if (time > 1) {
31
-            log.error(" {};耗时:{}s", arg0.getRequestURI(), time);
32
-        }
33
-    }
34
-
35
-    @Override
36
-    public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, ModelAndView arg3)
37
-            throws Exception {
38
-
39
-    }
40
-
41
-    /**
42
-     * 在调用controller具体方法前拦截
43
-     */
44
-    @Override
45
-    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
46
-//        log.info("请求的uri:" + request.getRequestURI());
47
-        response.setHeader("Access-Control-Allow-Origin", "*");
48
-        //response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
49
-        response.setContentType("application/json;charset=UTF-8");
50
-
51
-        // 记录请求开始时间
52
-        request.setAttribute("_startTime", System.currentTimeMillis());
53
-        String requestURI = request.getRequestURI();
54
-        String key = request.getHeader("Token-Key");
55
-        String token = request.getHeader("Token-Value");
56
-        if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
57
-                && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
58
-            String redis_token = get(key);//系统缓存中保存的token
59
-            if (redis_token != null && redis_token.equals("0")) {//获取token失败不对比
60
-            } else if (!token.equals(redis_token)) {
61
-                ResultVo result = new ResultVo();
62
-                result.setCode(2);
63
-                result.setMsg("登录失效");
64
-
65
-                response.getWriter().print(JSON.toJSONString(result));
66
-                return false;
67
-            } else {
68
-                refreshToken(key, redis_token);//刷新token
69
-            }
70
-        }
71
-
72
-        if (interceptorApi(requestURI)) {//需要拦截的请求
73
-            String encoding = request.getCharacterEncoding();
74
-            int contentLength = request.getContentLength();
75
-            byte buffer[] = new byte[request.getContentLength()];
76
-            request.getInputStream();
77
-            for (int i = 0;i < contentLength;) {
78
-
79
-                int readLen = request.getInputStream().read(buffer, i, contentLength - i);
80
-                if (readLen == -1) {
81
-                    break;
82
-                }
83
-                i += readLen;
84
-            }
85
-            if (encoding == null) {
86
-                encoding = "UTF-8";
87
-            }
88
-            String params = new String(buffer, encoding);
89
-            Map<String, String> uriMap = ApiUtil.uriMap;
90
-            String params2 = uriMap.get(requestURI);
91
-            if (N_Utils.isNotEmpty(params2) && params2.equals(params)) {
92
-                log.error("地址:{},参数:{}",requestURI,params);
93
-                throw new MissingParametersException("提交过快,请稍后重试");
94
-            } else {
95
-                uriMap.put(requestURI, params);
96
-            }
97
-        }
98
-       /* if("dev".equals(ConfigKey.env)){//开发环境接口不拦截
99
-            return true;
100
-        }*/
101
-        return true;
102
-    }
103
-
104
-    /**
105
-     * 需要拦截的请求
106
-     * @Param [uri]
107
-     * @Author ywx
108
-     * @Date 2020/5/20 14:14
109
-     * @return java.lang.Boolean
110
-     **/
111
-    private Boolean interceptorApi(String uri) {
112
-        boolean rtn = false;
113
-        String[] url = new String[]{
114
-                "/resource/add",//资源--添加
115
-                "/research/save",//教研管理--添加
116
-                "/researchu/up",//教研教师--保存评价
117
-                "/notice/add" //通知--添加
118
-        };
119
-
120
-        for (int i = 0; i < url.length; i++) {
121
-            String urlstr = "/sapi"+url[i];
122
-            if (uri.equals(urlstr)) {
123
-                rtn = true;
124
-                break;
125
-            }
126
-        }
127
-
128
-        return rtn;
129
-    }
130
-
131
-}

+ 0
- 78
sapi/src/main/java/com/xhkjedu/sapi/interceptors/RequestWrapper.java View File

@@ -1,78 +0,0 @@
1
-package com.xhkjedu.sapi.interceptors;
2
-
3
-import lombok.extern.slf4j.Slf4j;
4
-
5
-import javax.servlet.ReadListener;
6
-import javax.servlet.ServletInputStream;
7
-import javax.servlet.http.HttpServletRequest;
8
-import javax.servlet.http.HttpServletRequestWrapper;
9
-import java.io.*;
10
-
11
-/**
12
- * @author ywx
13
- * @classname RequestWrapper
14
- * @description 解决POST请求中的BODY参数不能重复读取多次的问题
15
- * @date 2020/11/9 11:24
16
- **/
17
-@Slf4j
18
-public class RequestWrapper extends HttpServletRequestWrapper {
19
-    private static final int BUFFER_LEN = 128;
20
-
21
-    private final String body;
22
-
23
-    public RequestWrapper(HttpServletRequest request) throws IOException {
24
-        super(request);
25
-        StringBuilder stringBuilder = new StringBuilder();
26
-        BufferedReader bufferedReader = null;
27
-        try {
28
-            InputStream inputStream = request.getInputStream();
29
-            if (inputStream != null) {
30
-                bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
31
-                char[] charBuffer = new char[BUFFER_LEN];
32
-                int bytesRead;
33
-                while ((bytesRead = bufferedReader.read(charBuffer)) > 0) {
34
-                    stringBuilder.append(charBuffer, 0, bytesRead);
35
-                }
36
-            }
37
-        } catch (IOException ex) {
38
-            throw ex;
39
-        } finally {
40
-            if (bufferedReader != null) {
41
-                try {
42
-                    bufferedReader.close();
43
-                } catch (IOException ex) {
44
-                    throw ex;
45
-                }
46
-            }
47
-        }
48
-        body = stringBuilder.toString();
49
-    }
50
-
51
-    @Override
52
-    public ServletInputStream getInputStream() throws IOException {
53
-        final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(body.getBytes());
54
-        ServletInputStream servletInputStream = new ServletInputStream() {
55
-            public boolean isFinished() {
56
-                return false;
57
-            }
58
-            public boolean isReady() {
59
-                return false;
60
-            }
61
-            public void setReadListener(ReadListener readListener) {}
62
-            public int read() throws IOException {
63
-                return byteArrayInputStream.read();
64
-            }
65
-        };
66
-        return servletInputStream;
67
-
68
-    }
69
-    @Override
70
-    public BufferedReader getReader() throws IOException {
71
-        return new BufferedReader(new InputStreamReader(this.getInputStream()));
72
-    }
73
-
74
-    public String getBody() {
75
-        return this.body;
76
-    }
77
-
78
-}

+ 0
- 62
sapi/src/main/java/com/xhkjedu/sapi/interceptors/WebMvcConfg.java View File

@@ -1,62 +0,0 @@
1
-package com.xhkjedu.sapi.interceptors;
2
-
3
-import org.springframework.beans.factory.annotation.Autowired;
4
-import org.springframework.boot.web.servlet.FilterRegistrationBean;
5
-import org.springframework.context.annotation.Bean;
6
-import org.springframework.context.annotation.Configuration;
7
-import org.springframework.web.servlet.config.annotation.CorsRegistry;
8
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
9
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
10
-
11
-import javax.annotation.Resource;
12
-
13
-/**
14
- * @author WN
15
- * @description
16
- * @date 2019/4/3 15:50
17
- **/
18
-@Configuration
19
-public class WebMvcConfg implements WebMvcConfigurer {
20
-
21
-    @Autowired
22
-    private RequestInterceptor requestInterceptor;
23
-    @Resource
24
-    private HttpServletFilter httpServletFilter;
25
-
26
-    /**
27
-     * 拦截器addPathPatterns用于添加拦截规则 excludePathPatterns 用于排除拦截
28
-     * @Param: registry
29
-     * @return void
30
-     * @author wn
31
-     * @date 2019/4/8
32
-     */
33
-    @Override
34
-    public void addInterceptors(InterceptorRegistry registry) {
35
-        registry.addInterceptor(requestInterceptor).addPathPatterns("/**");
36
-    }
37
-
38
-    /**
39
-     * 允许跨域
40
-     * @Param: registry
41
-     * @return void
42
-     * @author wn
43
-     * @date 2019/4/8
44
-     */
45
-    @Override
46
-    public void addCorsMappings(CorsRegistry registry){
47
-        registry.addMapping("/**")
48
-                .allowedOriginPatterns("*")
49
-                .allowCredentials(true)
50
-                .allowedMethods("GET","POST")
51
-                .maxAge(3600);
52
-    }
53
-
54
-    @Bean
55
-    public FilterRegistrationBean registerFilter() {
56
-        FilterRegistrationBean registration = new FilterRegistrationBean();
57
-        registration.setFilter(httpServletFilter);
58
-        registration.addUrlPatterns("/*");
59
-        registration.setOrder(1);
60
-        return registration;
61
-    }
62
-}

+ 28
- 0
sapi/src/main/java/com/xhkjedu/sapi/listener/HandleLogSender.java View File

@@ -0,0 +1,28 @@
1
+package com.xhkjedu.sapi.listener;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.model.slog.THandleLog;
5
+import org.springframework.amqp.core.AmqpTemplate;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.beans.factory.annotation.Value;
8
+import org.springframework.stereotype.Component;
9
+
10
+/*
11
+ * @Description: 操作日志
12
+ * @Author: WN
13
+ * @Date: 2023/11/15 16:20:25
14
+ **/
15
+@Component
16
+public class HandleLogSender {
17
+    @Autowired
18
+    private AmqpTemplate rabbitTemplate;
19
+    //生产者mq
20
+    @Value("${rabbitmq.handleLogQueue}")
21
+    private String handleLogQueue;
22
+
23
+    //操作日志
24
+    public void handleLogSend(THandleLog handleLog) {
25
+        rabbitTemplate.convertAndSend(handleLogQueue, JSON.toJSONString(handleLog));
26
+    }
27
+
28
+}

+ 3
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/analyze/SchoolResourceMapper.java View File

@@ -23,6 +23,9 @@ public interface SchoolResourceMapper {
23 23
     //资源分半--资源格式
24 24
     List<SchoolResourceClassNumVo> listSchoolResourceClassNum(Integer schoolid);
25 25
 
26
+    //获取所有资源resourcetype值
27
+    List<Integer> listAllResourceType();
28
+
26 29
     //资源上传量
27 30
     List<SchoolResourceUploadNumVo> listSchoolResourceUploadNum(Integer schoolid, Long starttime, Long endtime);
28 31
 

+ 3
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/cloud/CloudSyncMapper.java View File

@@ -71,4 +71,7 @@ public interface CloudSyncMapper extends TkMapper<TCloudSync> {
71 71
 
72 72
     //添加知识点外键
73 73
     void addPointFk();
74
+
75
+    //获取同步类型
76
+    List<Map> listModule();
74 77
 }

+ 7
- 2
sapi/src/main/java/com/xhkjedu/sapi/mapper/system/UserMapper.java View File

@@ -1,9 +1,8 @@
1 1
 package com.xhkjedu.sapi.mapper.system;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.sapi.model.gradeclass.TClassStudent;
5 4
 import com.xhkjedu.sapi.model.system.TUser;
6
-import com.xhkjedu.sapi.vo.system.UserVo;
5
+import com.xhkjedu.vo.system.UserVo;
7 6
 import org.apache.ibatis.annotations.Param;
8 7
 import org.springframework.stereotype.Repository;
9 8
 
@@ -40,4 +39,10 @@ public interface UserMapper extends TkMapper<TUser> {
40 39
 
41 40
     //删除学生绑定信息
42 41
     void delBindmac(@Param("schoolid") Integer schoolid);
42
+
43
+    //获取用户信息
44
+    TUser getUserTypeAndSchool(@Param("userid") Integer userid);
45
+
46
+    //获取用户信息用于操作日志
47
+    UserVo getUserInfoForHandleLog(@Param("userid") Integer userid);
43 48
 }

+ 4
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/cloud/TCloudSync.java View File

@@ -50,4 +50,8 @@ public class TCloudSync extends BaseBean {
50 50
     @Transient
51 51
     //详情列表
52 52
     private List<TCloudSyncDetail> syncdetails;
53
+
54
+    @Transient
55
+    //同步的模块
56
+    private List<String> modules;
53 57
 }

+ 16
- 0
sapi/src/main/java/com/xhkjedu/sapi/service/analyze/SchoolResourceService.java View File

@@ -6,8 +6,10 @@ import com.xhkjedu.sapi.vo.analyze.*;
6 6
 import org.springframework.beans.factory.annotation.Autowired;
7 7
 import org.springframework.stereotype.Service;
8 8
 
9
+import java.util.ArrayList;
9 10
 import java.util.Comparator;
10 11
 import java.util.List;
12
+import java.util.Map;
11 13
 import java.util.stream.Collectors;
12 14
 
13 15
 /**
@@ -55,10 +57,24 @@ public class SchoolResourceService {
55 57
         Long endtime = N_Utils.getNowtimestamp();
56 58
         Long starttime = N_Utils.getLongGoTime(type);
57 59
         List<SchoolResourceUploadNumVo> lst = schoolResourceMapper.listSchoolResourceUploadNum(schoolid,starttime,endtime);
60
+        //获取资源resourcetyp的值
61
+        List<Integer> resourcetypes = schoolResourceMapper.listAllResourceType();
58 62
         for(SchoolResourceUploadNumVo rupload : lst){
59 63
             List<SchoolResourceTypeNumVo> rtypelist = rupload.getRtypelist();
60 64
             rtypelist = saveListSchoolResourceTypeNumVo(rtypelist);
61 65
 
66
+            Map<Integer, SchoolResourceTypeNumVo> typeMap = rtypelist.stream().collect(Collectors.toMap(SchoolResourceTypeNumVo::getResourcetype, obj -> obj, (key1, key2) -> key1));
67
+            List<SchoolResourceTypeNumVo> newTypes = new ArrayList<>();
68
+            for(Integer rt : resourcetypes){
69
+                if(typeMap.containsKey(rt)){
70
+                    newTypes.add(typeMap.get(rt));
71
+                }else{
72
+                    SchoolResourceTypeNumVo srt = new SchoolResourceTypeNumVo();
73
+                    srt.setResourcetype(rt);
74
+                    newTypes.add(srt);
75
+                }
76
+            }
77
+            rupload.setRtypelist(newTypes);
62 78
         }
63 79
         return lst;
64 80
     }

+ 1
- 1
sapi/src/main/java/com/xhkjedu/sapi/service/appversion/AppthirdService.java View File

@@ -47,8 +47,8 @@ public class AppthirdService {
47 47
     @Transactional(rollbackFor = Exception.class)
48 48
     public Integer deleteById(Integer appid) {
49 49
         List<String> resourceUrls = appthirdHistoryMapper.listApppath(appid);//获取APP文件
50
-        Integer result = appthirdMapper.deleteByPrimaryKey(appid);
51 50
         handleThirdManager(appid, 2);//处理应用白名单
51
+        Integer result = appthirdMapper.deleteByPrimaryKey(appid);
52 52
         if(N_Utils.isListNotEmpty(resourceUrls)){
53 53
             messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
54 54
         }

+ 8
- 8
sapi/src/main/java/com/xhkjedu/sapi/service/classreport/ClassReportService.java View File

@@ -280,7 +280,7 @@ public class ClassReportService {
280 280
                     }
281 281
                     list1.add(rg);
282 282
                 } catch (Exception e) {
283
-                    log.error("保存预习报告数据出错", e.getMessage());
283
+                    log.error("保存预习报告数据出错:{}", e.getMessage());
284 284
                 }
285 285
             }
286 286
         }
@@ -401,7 +401,7 @@ public class ClassReportService {
401 401
                     }
402 402
                     list1.add(rr);
403 403
                 } catch (Exception e) {
404
-                    log.error("保存课堂数据出错", e.getMessage());
404
+                    log.error("保存课堂数据出错:{}", e.getMessage());
405 405
                 }
406 406
             }
407 407
         }
@@ -577,7 +577,7 @@ public class ClassReportService {
577 577
                     }
578 578
                     list1.add(rp);
579 579
                 } catch (Exception e) {
580
-                    log.error("保存作业数据出错", e.getMessage());
580
+                    log.error("保存作业数据出错:{}", e.getMessage());
581 581
                 }
582 582
             }
583 583
         }
@@ -726,7 +726,7 @@ public class ClassReportService {
726 726
                     }
727 727
                     list1.add(rr);
728 728
                 } catch (Exception e) {
729
-                    log.error("保存背诵数据出错", e.getMessage());
729
+                    log.error("保存背诵数据出错:{}", e.getMessage());
730 730
                 }
731 731
             }
732 732
         }
@@ -822,7 +822,7 @@ public class ClassReportService {
822 822
                     }
823 823
                     list1.add(ref);
824 824
                 } catch (Exception e) {
825
-                    log.error("保存错题辅导数据出错", e.getMessage());
825
+                    log.error("保存错题辅导数据出错:{}", e.getMessage());
826 826
                 }
827 827
             }
828 828
         }
@@ -928,7 +928,7 @@ public class ClassReportService {
928 928
                     }
929 929
                     list1.add(rq);
930 930
                 } catch (Exception e) {
931
-                    log.error("保存错题数据出错", e.getMessage());
931
+                    log.error("保存错题数据出错:{}", e.getMessage());
932 932
                 }
933 933
             }
934 934
         }
@@ -1045,7 +1045,7 @@ public class ClassReportService {
1045 1045
                     }
1046 1046
                     list1.add(rl);
1047 1047
                 } catch (Exception e) {
1048
-                    log.error("保存直播数据出错", e.getMessage());
1048
+                    log.error("保存直播数据出错:{}", e.getMessage());
1049 1049
                 }
1050 1050
             }
1051 1051
         }
@@ -1470,7 +1470,7 @@ public class ClassReportService {
1470 1470
                 }
1471 1471
                 list1.addAll(points);
1472 1472
             } catch (Exception e) {
1473
-                log.error("保存知识点掌握统计出错", e.getMessage());
1473
+                log.error("保存知识点掌握统计出错:{}", e.getMessage());
1474 1474
             }
1475 1475
         }
1476 1476
         return list1;

+ 20
- 6
sapi/src/main/java/com/xhkjedu/sapi/service/cloud/CloudSyncService.java View File

@@ -16,9 +16,7 @@ import org.springframework.util.LinkedMultiValueMap;
16 16
 import org.springframework.util.MultiValueMap;
17 17
 
18 18
 import javax.annotation.Resource;
19
-import java.util.ArrayList;
20
-import java.util.List;
21
-import java.util.Map;
19
+import java.util.*;
22 20
 
23 21
 /**
24 22
  * @author ywx
@@ -53,7 +51,12 @@ public class CloudSyncService {
53 51
         if (lastSync == null || lastSync.getSyncstate() == 1 || lastSync.getSynctask() == 0) {
54 52
             String cloudcode = sync.getCloudcode();
55 53
             Integer begintime = lastSync==null?null:lastSync.getEndtime();
56
-            String param = "{\"cloudcode\": \""+cloudcode+"\",\"begintime\":"+begintime+"}";
54
+            Map map = new HashMap();
55
+            map.put("cloudcode", cloudcode);
56
+            map.put("begintime", begintime);
57
+            //同步所有基本信息
58
+            //map.put("modules", sync.getModules());
59
+            String param = JSON.toJSONString(map);
57 60
             //同步任务
58 61
             ResultVo vo = getResultVo("csync/g",param);
59 62
             if (vo.getCode() != 0) return vo;
@@ -164,7 +167,7 @@ public class CloudSyncService {
164 167
             } else if (synctable.equals("t_point")) {//同步知识点
165 168
                 handleid = (String) list.get(list.size()-1).get("pointid");
166 169
                 cloudSyncMapper.syncPoint(list, N_Utils.getSecondTimestamp());
167
-            } else if (synctable.equals("t_question")) {//同步试题
170
+            } /*else if (synctable.equals("t_question")) {//同步试题
168 171
                 handleid = (String) list.get(list.size()-1).get("questionid");
169 172
                 for (Map question : list) {
170 173
                     Integer ctype = (Integer) question.get("ctype");
@@ -235,7 +238,7 @@ public class CloudSyncService {
235 238
                         log.error("同步【"+synctable+" "+resourceid+"】失败",e.getMessage());
236 239
                     }
237 240
                 }
238
-            }
241
+            }*/
239 242
 
240 243
         } catch (Exception e) {
241 244
             syncnum--;
@@ -265,4 +268,15 @@ public class CloudSyncService {
265 268
     public TCloudSync getCloudInfo() {
266 269
         return cloudSyncMapper.getCloudInfo();
267 270
     }
271
+
272
+    /**
273
+     * @Description 获取同步类型
274
+     * @Date 2023/10/13 15:15
275
+     * @Author YWX
276
+     * @Param []
277
+     * @Return com.xhkjedu.vo.ResultVo
278
+     **/
279
+    public ResultVo listModule() {
280
+        return new ResultVo(0, "获取同步类型成功!", cloudSyncMapper.listModule());
281
+    }
268 282
 }

+ 3
- 3
sapi/src/main/java/com/xhkjedu/sapi/service/dock/LcService.java View File

@@ -5,12 +5,12 @@ import com.xhkjedu.sapi.config.ConfigKey;
5 5
 import com.xhkjedu.sapi.mapper.system.SchoolMapper;
6 6
 import com.xhkjedu.sapi.mapper.system.UserMapper;
7 7
 import com.xhkjedu.sapi.model.system.TSchool;
8
-import com.xhkjedu.utils.N_Utils;
9
-import com.xhkjedu.vo.ResultVo;
10 8
 import com.xhkjedu.sapi.vo.dock.LcAdminVo;
11 9
 import com.xhkjedu.sapi.vo.dock.LcResultVo;
12 10
 import com.xhkjedu.sapi.vo.dock.LcSchoolVo;
13
-import com.xhkjedu.sapi.vo.system.UserVo;
11
+import com.xhkjedu.utils.N_Utils;
12
+import com.xhkjedu.vo.ResultVo;
13
+import com.xhkjedu.vo.system.UserVo;
14 14
 import lombok.extern.slf4j.Slf4j;
15 15
 import org.springframework.stereotype.Service;
16 16
 

+ 2
- 2
sapi/src/main/java/com/xhkjedu/sapi/service/region/RPaperAnalyzeService.java View File

@@ -261,7 +261,7 @@ public class RPaperAnalyzeService {
261 261
                 Integer usetimes = Integer.parseInt(map.get("costtime").toString());
262 262
                 Integer stunum = Integer.parseInt(map.get("stunum").toString());
263 263
 
264
-                double avgtime = N_Utils.formatAvg(day * stunum,usetimes);
264
+                double avgtime = N_Utils.formatAvg(usetimes, day * stunum);
265 265
                 map.put("avgtime",avgtime);
266 266
             }
267 267
         }
@@ -280,7 +280,7 @@ public class RPaperAnalyzeService {
280 280
                 Integer usetimes = Integer.parseInt(map.get("costtime").toString());
281 281
                 Integer stunum = Integer.parseInt(map.get("stunum").toString());
282 282
 
283
-                double avgtime = N_Utils.formatAvg(day * stunum,usetimes);
283
+                double avgtime = N_Utils.formatAvg(usetimes, day * stunum);
284 284
                 map.put("avgtime",avgtime);
285 285
             }
286 286
         }

+ 28
- 0
sapi/src/main/java/com/xhkjedu/sapi/service/system/SchoolStypeService.java View File

@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
12 12
 
13 13
 import javax.annotation.Resource;
14 14
 import java.util.ArrayList;
15
+import java.util.HashMap;
15 16
 import java.util.List;
16 17
 import java.util.Map;
17 18
 import java.util.stream.Collectors;
@@ -146,4 +147,31 @@ public class SchoolStypeService {
146 147
         }
147 148
         return rtnlst;
148 149
     }
150
+
151
+    /*
152
+     * @Description 获取学校样式(设置登录页面获取数据)
153
+     * @Date 2023/11/21 10:39:18
154
+     * @Author WN
155
+     * @Param [stype]
156
+     * @Return java.util.Map<java.lang.String,java.util.List<com.xhkjedu.sapi.model.system.TSchoolStype>>
157
+     **/
158
+    public Map<String,List<TSchoolStype>> listSchoolStypeAndDefault(TSchoolStype stype) {
159
+        List<TSchoolStype> lst = schoolStypeMapper.findAll2(stype);
160
+
161
+        Map<String,List<TSchoolStype>> rtnMap = new HashMap<>();
162
+        if(N_Utils.isListNotEmpty(lst)){
163
+            //获取学校设置的
164
+            List<TSchoolStype> schoolStypes = lst.stream().filter(s -> stype.getSchoolid().equals(s.getSchoolid())).collect(Collectors.toList());
165
+            //默认地址
166
+            List<TSchoolStype> defaultStypes = lst.stream().filter(s -> "default".equals(s.getSchooldomain())).collect(Collectors.toList());
167
+
168
+            rtnMap.put("school",schoolStypes);
169
+            rtnMap.put("default",defaultStypes);
170
+        }else{
171
+            rtnMap.put("school",new ArrayList<>());
172
+            rtnMap.put("default",new ArrayList<>());
173
+        }
174
+
175
+        return rtnMap;
176
+    }
149 177
 }

+ 2
- 2
sapi/src/main/java/com/xhkjedu/sapi/vo/analyze/SchoolResourceTypeNumVo.java View File

@@ -11,6 +11,6 @@ import lombok.Data;
11 11
 @Data
12 12
 public class SchoolResourceTypeNumVo {
13 13
     private Integer resourcetype;//资源分类1课件 2学案(导学案)3习题 4微课视频(视频库)5教学设计
14
-    private Integer resourcenum;//资源数量
15
-    private double  resourcerate;//占比
14
+    private Integer resourcenum = 0;//资源数量
15
+    private double  resourcerate = 0;//占比
16 16
 }

+ 0
- 116
sapi/src/main/java/com/xhkjedu/sapi/vo/system/UserVo.java View File

@@ -1,116 +0,0 @@
1
-package com.xhkjedu.sapi.vo.system;
2
-
3
-import lombok.Data;
4
-
5
-/**
6
- * @ClassName UserVo
7
- * Description
8
- * Author WN
9
- * Date 2020/5/29 17:16
10
- **/
11
-@Data
12
-public class UserVo {
13
-    //用户表
14
-    private Integer userid;
15
-
16
-    //姓名
17
-    private String username;
18
-
19
-    //登录账号
20
-    private String loginname;
21
-
22
-    //登录密码
23
-    private String loginpwd;
24
-
25
-    //学生学号
26
-    private String studentno;
27
-
28
-    //用户手机号
29
-    private String userphone;
30
-
31
-    //出生日期
32
-    private Integer userbirthday;
33
-
34
-    //身份证号
35
-    private String cardid;
36
-
37
-    //头像地址
38
-    private String headpic;
39
-
40
-    //用户类型999超级管理员0学校管理员1老师2学生
41
-    private Integer usertype;
42
-
43
-    //用户状态1正常2删除
44
-    private Integer userstate;
45
-
46
-    //是否绑定硬件地址0不绑定1绑定
47
-    private Integer bindmac;
48
-
49
-    //硬件地址
50
-    private String mac;
51
-
52
-    //硬件地址绑定的账号
53
-    private String macname;
54
-
55
-    //学校是否绑定硬件地址0不绑定1绑定
56
-    private Integer sbindmac;
57
-
58
-    //操作密码(教师操作密码)
59
-    private String opepassword;
60
-
61
-    //创建人id
62
-    private Integer createid;
63
-
64
-    //创建人姓名
65
-    private String createname;
66
-
67
-    //创建时间
68
-    private Integer createtime;
69
-
70
-    //删除人id
71
-    private Integer deleteid;
72
-
73
-    //删除时间
74
-    private Integer deletetime;
75
-
76
-    //学校id
77
-    private Integer schoolid;
78
-
79
-    private String schoolname;
80
-
81
-    //学校阶段1小学2初中3高中4大学
82
-    private Integer schoollevel;
83
-
84
-    //学校状态1正常10删除
85
-    private Integer schoolstate;
86
-
87
-    //错误率%
88
-    private Integer errorrate;
89
-
90
-    //当前年份
91
-    private Integer year;
92
-
93
-    //性别1男2女
94
-    private Integer usersex;
95
-
96
-    //云平台码
97
-    private String cloudcode;
98
-
99
-    //行政班数量
100
-    private Integer xznum;
101
-
102
-    //是否绑定手机号0不绑定1绑定
103
-    private Integer bindphone;
104
-
105
-    //是否有手机号0没有1有
106
-    private Integer hasphone;
107
-
108
-    //学校域名地址
109
-    private String schooldomain;
110
-
111
-    //有效期
112
-    private String usertime;
113
-    private String token_key;
114
-    private String token_value;
115
-
116
-}

+ 15
- 18
sapi/src/main/resources/application.properties View File

@@ -2,8 +2,8 @@ server.port=8087
2 2
 spring.application.name=sapi
3 3
 #注册到我们本地的eureka注册中心,端口8081
4 4
 eureka.client.service-url.defaultZone=http://xhschool:Xhkjedud07@127.0.0.1:8081/eureka/
5
-#eureka.client.register-with-eureka=false
6
-#eureka.client.fetch-registry=false
5
+eureka.client.register-with-eureka=true
6
+eureka.client.fetch-registry=true
7 7
 #设置eureka输出日志级别
8 8
 logging.level.com.netflix=error
9 9
 spring.datasource.url=jdbc:mysql://dbtest.xhkjedu.com:3306/xhkjedu_school_test?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true&allowMultiQueries=true
@@ -35,21 +35,7 @@ mapper.identity=MYSQL
35 35
 logging.level.com.xhkjedu.sapi.mapper=debug
36 36
 #分页
37 37
 spring.pagehelper.helper-dialect=mysql
38
-#redis配置
39
-spring.redis.host=cachetest.xhkjedu.com
40
-spring.redis.port=6379
41
-spring.redis.password=xhkjedud07
42
-#超时时间:单位ms
43
-spring.redis.timeout=5000
44
-#设置过期时间10min
45
-spring.redis.jedis.pool.max-idle=300
46
-#最大等待时间:单位ms //高版本改为maxWaitMillis
47
-spring.redis.jedis.pool.max-wait=1000000
48
-spring.redis.jedis.pool.max-active=60000
49
-#缓存访问数据有效时长60*60*24*7
50
-redisdatatime=604800
51
-#secretKey必须为24位
52
-secretKey=nanhuakaizhangjianwangni
38
+
53 39
 #消费者mq
54 40
 rabbitmq.researchHandleQueue=xhkjedutest.xhschool.researchHandleQueue_dev
55 41
 #负载一生产者mq
@@ -58,6 +44,10 @@ rabbitmq.resourceDelQueue=xhkjedutest.xhschool.resourceDelQueue_node01_dev
58 44
 #负载二生产者mq
59 45
 rabbitmq.researchTransferQueue2=xhkjedutest.xhschool.researchTransferQueue_node02_dev
60 46
 rabbitmq.resourceDelQueue2=xhkjedutest.xhschool.resourceDelQueue_node02_dev
47
+
48
+#操作日志生产者
49
+rabbitmq.handleLogQueue=xhkjedutest.xhschool.handleLogQueue_dev
50
+
61 51
 spring.rabbitmq.host=49.4.26.249
62 52
 spring.rabbitmq.port=5672
63 53
 spring.rabbitmq.username=xhkjedu
@@ -105,5 +95,12 @@ cron.synctime=0 0 3 ? * SUN
105 95
 cron.syncnum=100
106 96
 #每隔3s清除一下请求地址map
107 97
 cron.deleteUriMap=0/3 * * * * ?
98
+
99
+#开启spring的aop配置,默认true
100
+spring.aop.auto=true
101
+#解析ip归属地数据
102
+ipregiondb=D:\\school\\ip2region.xdb
103
+
108 104
 #版本号
109
-versionname=Test_v3.9.0
105
+buildnum=300
106
+versionname=Test_v3.13.0

+ 88
- 50
sapi/src/main/resources/mapper/analyze/SchoolResourceMapper.xml View File

@@ -3,12 +3,17 @@
3 3
 <mapper namespace="com.xhkjedu.sapi.mapper.analyze.SchoolResourceMapper">
4 4
     <!-- 校本资源总数量 -->
5 5
     <select id="getSchoolResourceNum" resultType="com.xhkjedu.sapi.vo.analyze.SchoolResourceNumVo">
6
-        SELECT COUNT(distinct r.resourceid) resourcenum,SUM(resourcesize) resourcesize,SUM(downcount) downnum
7
-        ,count(DISTINCT rc.resourceid) collectnum
6
+        SELECT COUNT(r.resourceid) resourcenum,SUM(resourcesize) as resourcesize,SUM(downcount) as downnum
7
+        ,sum(r2.collectnum) as collectnum
8
+        from(select distinct r.resourceid,count(distinct rc.rcid)collectnum
8 9
         FROM t_resource r left join t_resource_collect rc on rc.resourceid=r.resourceid
9 10
         left join t_subject s on r.subjectid=s.subjectid
10 11
         left join t_school ts on s.level=ts.schoollevel
11
-        WHERE r.resourcestate=1 and (r.belong in(1,2) or (r.belong=3 and r.schoolid=#{schoolid})) and ts.schoolid=#{schoolid}
12
+        left join t_resource_director rd on r.resourceid=rd.resourceid
13
+        left join t_director d on rd.directorid=d.directorid
14
+        where d.disabled=0 and r.resourcestate=1
15
+        and (r.belong in(1,2) or (r.belong=3 and r.schoolid=#{schoolid})) and ts.schoolid=#{schoolid})r2
16
+        left join t_resource r on r2.resourceid=r.resourceid
12 17
     </select>
13 18
 
14 19
     <!--资源分布-分资源类统计-->
@@ -16,7 +21,9 @@
16 21
         SELECT r.resourcetype,COUNT(distinct r.resourceid)AS resourcenum
17 22
          FROM t_resource r left join t_subject s on r.subjectid=s.subjectid
18 23
         left join t_school ts on s.level=ts.schoollevel
19
-         WHERE r.resourcestate=1 and (r.belong in(1,2) or (r.belong=3 and r.schoolid=#{schoolid})) and ts.schoolid=#{schoolid}
24
+        left join t_resource_director rd on r.resourceid=rd.resourceid
25
+        left join t_director d on rd.directorid=d.directorid
26
+        where d.disabled=0 and r.resourcestate=1 and (r.belong in(1,2) or (r.belong=3 and r.schoolid=#{schoolid})) and ts.schoolid=#{schoolid}
20 27
          GROUP BY r.resourcetype
21 28
     </select>
22 29
 
@@ -25,15 +32,22 @@
25 32
         SELECT r.resourceclass,COUNT(distinct r.resourceid)AS resourcenum
26 33
          FROM t_resource r left join t_subject s on r.subjectid=s.subjectid
27 34
         left join t_school ts on s.level=ts.schoollevel
28
-         WHERE r.resourcestate=1 and (r.belong in(1,2) or (r.belong=3 and r.schoolid=#{schoolid})) and ts.schoolid=#{schoolid}
35
+        left join t_resource_director rd on r.resourceid=rd.resourceid
36
+        left join t_director d on rd.directorid=d.directorid
37
+        where d.disabled=0 and r.resourcestate=1 and (r.belong in(1,2) or (r.belong=3 and r.schoolid=#{schoolid})) and ts.schoolid=#{schoolid}
29 38
          GROUP BY r.resourceclass
30 39
     </select>
31 40
 
41
+    <!--获取所有资源resourcetype值-->
42
+    <select id="listAllResourceType" resultType="java.lang.Integer">
43
+        select resourcetype from t_resource where resourcestate=1 and level!=2 group by resourcetype
44
+    </select>
45
+
32 46
     <resultMap id="sResourceUpload" type="com.xhkjedu.sapi.vo.analyze.SchoolResourceUploadNumVo">
33
-        <result property="uploadtime" column="uploadtime"></result>
47
+        <result property="uploadtime" column="uploadtime"/>
34 48
         <collection property="rtypelist" ofType="com.xhkjedu.sapi.vo.analyze.SchoolResourceTypeNumVo">
35
-            <result property="resourcetype" column="resourcetype"></result>
36
-            <result property="resourcenum" column="resourcenum"></result>
49
+            <result property="resourcetype" column="resourcetype"/>
50
+            <result property="resourcenum" column="resourcenum"/>
37 51
         </collection>
38 52
     </resultMap>
39 53
     <!--资源上传量-->
@@ -41,17 +55,19 @@
41 55
         SELECT FROM_UNIXTIME(r.createtime,'%Y-%m') AS uploadtime,r.resourcetype,COUNT(distinct r.resourceid) AS resourcenum
42 56
         FROM t_resource r left join t_subject s on r.subjectid=s.subjectid
43 57
         left join t_school ts on s.level=ts.schoollevel
44
-        WHERE r.resourcestate=1 and (r.belong in(1,2) or (r.belong=3 and r.schoolid=#{schoolid})) and ts.schoolid=#{schoolid}
45
-        AND r.createtime<![CDATA[ >= ]]>#{starttime} AND r.createtime<![CDATA[ <= ]]>#{endtime}
58
+        left join t_resource_director rd on r.resourceid=rd.resourceid
59
+        left join t_director d on rd.directorid=d.directorid
60
+        where d.disabled=0 and r.resourcestate=1 and (r.belong in(1,2) or (r.belong=3 and r.schoolid=#{schoolid})) and ts.schoolid=#{schoolid}
61
+        AND r.createtime >= #{starttime} AND r.createtime <![CDATA[ <= ]]>#{endtime}
46 62
         GROUP BY uploadtime,r.resourcetype
47 63
     </select>
48 64
 
49 65
     <resultMap id="sResourceRank" type="com.xhkjedu.sapi.vo.analyze.SchoolResourceRankVo">
50
-        <result property="userid" column="userid"></result>
51
-        <result property="username" column="username"></result>
66
+        <result property="userid" column="userid"/>
67
+        <result property="username" column="username"/>
52 68
         <collection property="rtypelist" ofType="com.xhkjedu.sapi.vo.analyze.SchoolResourceTypeNumVo">
53
-            <result property="resourcetype" column="resourcetype"></result>
54
-            <result property="resourcenum" column="resourcenum"></result>
69
+            <result property="resourcetype" column="resourcetype"/>
70
+            <result property="resourcenum" column="resourcenum"/>
55 71
         </collection>
56 72
     </resultMap>
57 73
     <!--资源排行-->
@@ -64,14 +80,16 @@
64 80
             left join t_class_teacher ct on r.createid=ct.teacherid
65 81
             LEFT JOIN t_class c ON ct.classid=c.classid
66 82
         </if>
67
-        WHERE r.resourcestate=1 and (r.belong IN(1,2) OR (r.belong=3 AND r.schoolid=#{schoolid})) and ts.schoolid=#{schoolid} and c.year=ts.year
83
+        left join t_resource_director rd on r.resourceid=rd.resourceid
84
+        left join t_director d on rd.directorid=d.directorid
85
+        where d.disabled=0 and r.resourcestate=1 and (r.belong IN(1,2) OR (r.belong=3 AND r.schoolid=#{schoolid})) and ts.schoolid=#{schoolid} and c.year=ts.year
68 86
         <if test="subjectid!=null and subjectid!='0'.toString() and subjectid!=''">
69 87
             AND r.subjectid=#{subjectid}
70 88
         </if>
71 89
         <if test="gradeid>0">
72 90
             AND c.gradeid=#{gradeid} and c.year=ts.year
73 91
         </if>
74
-        AND r.createtime<![CDATA[ >= ]]>#{starttime} AND r.createtime<![CDATA[ <= ]]>#{endtime}
92
+        AND r.createtime >= #{starttime} AND r.createtime <![CDATA[ <= ]]>#{endtime}
75 93
         GROUP BY r.createid,r.resourcetype
76 94
 
77 95
     </select>
@@ -81,24 +99,28 @@
81 99
          SELECT q.subjectid,s.subjectname,COUNT(DISTINCT q.questionid) AS questionnum
82 100
           FROM t_question q LEFT JOIN t_subject s ON q.subjectid=s.subjectid
83 101
           left join t_school ts on s.level=ts.schoollevel
84
-          WHERE q.qstate=1 AND (q.belong IN(1,2) OR (q.belong=3 AND q.schoolid=#{params.schoolid})) and ts.schoolid=#{params.schoolid}
102
+        left join t_question_director qd on q.questionid=qd.questionid
103
+        left join t_director d on qd.directorid=d.directorid
104
+        where d.disabled=0 and q.qlevel!=3 and q.qstate=1 AND (q.belong IN(1,2) OR (q.belong=3 AND q.schoolid=#{params.schoolid})) and ts.schoolid=#{params.schoolid}
85 105
         <if test="params.type!=null and params.type!=0">
86
-          AND q.createtime<![CDATA[ >= ]]>#{params.starttime} AND q.createtime<![CDATA[ <= ]]>#{params.stoptime}
106
+          AND q.createtime >= #{params.starttime} AND q.createtime <![CDATA[ <= ]]>#{params.stoptime}
87 107
         </if>
88
-          GROUP BY q.subjectid ORDER BY s.subjectorder asc
108
+          GROUP BY q.subjectid ORDER BY s.subjectorder
89 109
     </select>
90 110
     <!-- 结构性试题统计 年级试题数量-->
91 111
     <select id="listSchoolResourceQuestionGrade" resultType="com.xhkjedu.sapi.vo.analyze.SchoolResourceQuestionVo">
92 112
       SELECT c.gradeid,COUNT(DISTINCT q.questionid) AS questionnum
93
-	  FROM t_question q left join t_class_teacher ct on q.createid=ct.teacherid
113
+      FROM t_question q left join t_class_teacher ct on q.createid=ct.teacherid
94 114
       LEFT JOIN t_class c ON ct.classid=c.classid
95 115
       left join t_subject s on q.subjectid=s.subjectid
96 116
       left join t_school ts on s.level=ts.schoollevel
97
-      WHERE q.qstate=1 AND (q.belong IN(1,2) OR (q.belong=3 AND q.schoolid=#{params.schoolid})) and ts.schoolid=#{params.schoolid} and c.year=ts.year
117
+      left join t_question_director qd on q.questionid=qd.questionid
118
+      left join t_director d on qd.directorid=d.directorid
119
+      where d.disabled=0 and q.qlevel!=3 and q.qstate=1 AND (q.belong IN(1,2) OR (q.belong=3 AND q.schoolid=#{params.schoolid})) and ts.schoolid=#{params.schoolid} and c.year=ts.year
98 120
       <if test="params.type!=null and params.type!=0">
99
-          AND q.createtime<![CDATA[ >= ]]>#{params.starttime} AND q.createtime<![CDATA[ <= ]]>#{params.stoptime}
121
+          AND q.createtime >= #{params.starttime} AND q.createtime <![CDATA[ <= ]]>#{params.stoptime}
100 122
       </if>
101
-      GROUP BY c.gradeid ORDER BY c.gradeid ASC
123
+      GROUP BY c.gradeid ORDER BY c.gradeid
102 124
     </select>
103 125
 
104 126
     <!--结构性试题 教师上传排行榜-->
@@ -111,9 +133,11 @@
111 133
         </if>
112 134
         left join t_subject s on q.subjectid=s.subjectid
113 135
         left join t_school ts on s.level=ts.schoollevel
114
-        WHERE q.qstate=1 AND (q.belong IN(1,2) OR (q.belong=3 AND q.schoolid=#{params.schoolid})) and ts.schoolid=#{params.schoolid}
136
+        left join t_question_director qd on q.questionid=qd.questionid
137
+        left join t_director d on qd.directorid=d.directorid
138
+        where d.disabled=0 and q.qlevel!=3 and q.qstate=1 AND (q.belong IN(1,2) OR (q.belong=3 AND q.schoolid=#{params.schoolid})) and ts.schoolid=#{params.schoolid}
115 139
         <if test="params.type!=null and params.type!=0">
116
-            AND q.createtime<![CDATA[ >= ]]>#{params.starttime} AND q.createtime<![CDATA[ <= ]]>#{params.stoptime}
140
+            AND q.createtime >= #{params.starttime} AND q.createtime <![CDATA[ <= ]]>#{params.stoptime}
117 141
         </if>
118 142
         <if test="params.subjectid!=null and params.subjectid!='0'.toString() and params.subjectid!=''">
119 143
             and q.subjectid=#{params.subjectid}
@@ -133,25 +157,29 @@
133 157
         FROM t_question q
134 158
         left join t_subject s on q.subjectid=s.subjectid
135 159
         left join t_school ts on s.level=ts.schoollevel
136
-        WHERE q.qstate=1 AND (q.belong IN(1,2) OR (q.belong=3 AND q.schoolid=#{params.schoolid})) and ts.schoolid=#{params.schoolid}
160
+        left join t_question_director qd on q.questionid=qd.questionid
161
+        left join t_director d on qd.directorid=d.directorid
162
+        where d.disabled=0 and q.qlevel!=3 and q.qstate=1 AND (q.belong IN(1,2) OR (q.belong=3 AND q.schoolid=#{params.schoolid})) and ts.schoolid=#{params.schoolid}
137 163
     </select>
138 164
     <resultMap id="sQuestionUpload" type="com.xhkjedu.sapi.vo.analyze.SchoolQuestionUploadNumVo">
139
-        <result property="uploadtime" column="uploadtime"></result>
165
+        <result property="uploadtime" column="uploadtime"/>
140 166
         <collection property="questions" ofType="com.xhkjedu.sapi.vo.analyze.SchoolQuestionNumVo">
141
-            <result property="gradeid" column="gradeid"></result>
142
-            <result property="subjectname" column="subjectname"></result>
143
-            <result property="questionnum" column="questionnum"></result>
167
+            <result property="gradeid" column="gradeid"/>
168
+            <result property="subjectname" column="subjectname"/>
169
+            <result property="questionnum" column="questionnum"/>
144 170
         </collection>
145 171
     </resultMap>
146 172
     <!--获取按年级试题上传变化列表-->
147 173
     <select id="listSchoolGQuestionUpload" resultMap="sQuestionUpload">
148
-        SELECT FROM_UNIXTIME(q.createtime,'%Y-%m') AS uploadtime,COUNT(q.questionid) AS questionnum,c.gradeid
174
+        SELECT FROM_UNIXTIME(q.createtime,'%Y-%m') AS uploadtime,COUNT(distinct q.questionid) AS questionnum,c.gradeid
149 175
         FROM t_question q LEFT JOIN t_class_teacher ct ON q.createid=ct.teacherid
150 176
         LEFT JOIN t_class c ON ct.classid=c.classid
151 177
         left join t_subject s on q.subjectid=s.subjectid
152 178
         left join t_school ts on s.level=ts.schoollevel
153
-        WHERE q.qstate=1 AND (q.belong IN(1,2) OR (q.belong=3 AND q.schoolid=#{schoolid})) and ts.schoolid=#{schoolid} and c.year=ts.year
154
-        AND q.createtime<![CDATA[ >= ]]>#{starttime} AND q.createtime<![CDATA[ <= ]]>#{endtime}
179
+        left join t_question_director qd on q.questionid=qd.questionid
180
+        left join t_director d on qd.directorid=d.directorid
181
+        where d.disabled=0 and q.qlevel!=3 and q.qstate=1 AND (q.belong IN(1,2) OR (q.belong=3 AND q.schoolid=#{schoolid})) and ts.schoolid=#{schoolid} and c.year=ts.year
182
+        AND q.createtime >= #{starttime} AND q.createtime <![CDATA[ <= ]]>#{endtime}
155 183
         GROUP BY uploadtime,c.gradeid
156 184
     </select>
157 185
     <!--获取按科目试题上传变化列表-->
@@ -160,8 +188,10 @@
160 188
         ,s.subjectname
161 189
         FROM t_question q left join t_subject s on q.subjectid=s.subjectid
162 190
         left join t_school ts on s.level=ts.schoollevel
163
-        WHERE q.qstate=1 AND (q.belong IN(1,2) OR (q.belong=3 AND q.schoolid=#{schoolid})) and ts.schoolid=#{schoolid}
164
-        AND q.createtime<![CDATA[ >= ]]>#{starttime} AND q.createtime<![CDATA[ <= ]]>#{endtime}
191
+        left join t_question_director qd on q.questionid=qd.questionid
192
+        left join t_director d on qd.directorid=d.directorid
193
+        where d.disabled=0 and q.qlevel!=3 and q.qstate=1 AND (q.belong IN(1,2) OR (q.belong=3 AND q.schoolid=#{schoolid})) and ts.schoolid=#{schoolid}
194
+        AND q.createtime >= #{starttime} AND q.createtime <![CDATA[ <= ]]>#{endtime}
165 195
         GROUP BY uploadtime,q.subjectid
166 196
     </select>
167 197
     <!--本月新增情况-->
@@ -171,14 +201,18 @@
171 201
         union select 'resource' type,count(distinct r.resourceid)num
172 202
         from t_resource r left join t_subject s on r.subjectid=s.subjectid
173 203
         left join t_school ts on s.level=ts.schoollevel
174
-        where (r.belong IN(1,2) OR (r.belong=3 AND r.schoolid=#{schoolid})) and r.resourcestate=1 and ts.schoolid=#{schoolid}
204
+        left join t_resource_director rd on r.resourceid=rd.resourceid
205
+        left join t_director d on rd.directorid=d.directorid
206
+        where d.disabled=0 and (r.belong IN(1,2) OR (r.belong=3 AND r.schoolid=#{schoolid})) and r.resourcestate=1 and ts.schoolid=#{schoolid}
175 207
         and DATE_FORMAT(FROM_UNIXTIME(r.createtime),'%Y%m')=DATE_FORMAT(CURDATE(),'%Y%m')
176 208
         union select 'research' type,count(r.researchid)num from t_research r where r.schoolid=#{schoolid}
177 209
         and DATE_FORMAT(FROM_UNIXTIME(r.createtime),'%Y%m')=DATE_FORMAT(CURDATE(),'%Y%m')
178 210
         union select 'question' type,count(distinct q.questionid)num
179 211
         from t_question q left join t_subject s on q.subjectid=s.subjectid
180 212
         left join t_school ts on s.level=ts.schoollevel
181
-        where (q.belong IN(1,2) OR (q.belong=3 AND q.schoolid=#{schoolid})) and q.qstate=1 and ts.schoolid=#{schoolid}
213
+        left join t_question_director qd on q.questionid=qd.questionid
214
+        left join t_director d on qd.directorid=d.directorid
215
+        where d.disabled=0 and q.qlevel!=3 and (q.belong IN(1,2) OR (q.belong=3 AND q.schoolid=#{schoolid})) and q.qstate=1 and ts.schoolid=#{schoolid}
182 216
         and DATE_FORMAT(FROM_UNIXTIME(q.createtime),'%Y%m')=DATE_FORMAT(CURDATE(),'%Y%m')
183 217
     </select>
184 218
 
@@ -189,30 +223,32 @@
189 223
         left join t_class c on ct.classid=c.classid
190 224
         left join t_subject s on r.subjectid=s.subjectid
191 225
         left join t_school ts on s.level=ts.schoollevel
192
-        where r.resourcestate=1 and (r.belong IN(1,2) OR (r.belong=3 AND r.schoolid=#{schoolid})) and ts.schoolid=#{schoolid} and c.year=ts.year
226
+        left join t_resource_director rd on r.resourceid=rd.resourceid
227
+        left join t_director d on rd.directorid=d.directorid
228
+        where d.disabled=0 and r.resourcestate=1 and (r.belong IN(1,2) OR (r.belong=3 AND r.schoolid=#{schoolid})) and ts.schoolid=#{schoolid} and c.year=ts.year
193 229
         group by c.gradeid
194 230
     </select>
195 231
     <!--按科目资源统计列表-->
196 232
     <select id="listSchoolResourceSubject" resultType="com.xhkjedu.sapi.vo.analyze.SchoolResourceSubjectNumVo">
197 233
         select s.subjectname,count(distinct r.resourceid)as resourcenum
198 234
         from t_resource r left join t_resource_director rd on r.resourceid=rd.resourceid
199
-        left join t_subject_book sb on rd.lsbid = sb.lsbid
200 235
         left join t_subject s on r.subjectid = s.subjectid
201 236
         left join t_school ts on s.level=ts.schoollevel
202
-        where r.resourcestate=1 and (r.belong IN(1,2) OR (r.belong=3 AND r.schoolid=#{schoolid})) and ts.schoolid=#{schoolid}
237
+        left join t_director d on rd.directorid=d.directorid
238
+        where d.disabled=0 and r.resourcestate=1 and (r.belong IN(1,2) OR (r.belong=3 AND r.schoolid=#{schoolid})) and ts.schoolid=#{schoolid}
203 239
         group by r.subjectid
204 240
     </select>
205 241
     <!--资源上传详情排行-->
206 242
     <select id="listSchoolResourceRank2" resultType="com.xhkjedu.sapi.vo.analyze.SchoolUserResourceNumVo">
207 243
         SELECT count(distinct r.resourceid)totalnum,u.username
208
-        ,count(distinct case when r.resourcetype=1 then r.resourceid else null end)xtnum
209
-        ,count(distinct case when r.resourcetype=2 then r.resourceid else null end)janum
210
-        ,count(distinct case when r.resourcetype=3 then r.resourceid else null end)kjnum
211
-        ,count(distinct case when r.resourcetype=4 then r.resourceid else null end)jcnum
212
-        ,count(distinct case when r.resourcetype=5 then r.resourceid else null end)spnum
213
-        ,count(distinct case when r.resourcetype=6 then r.resourceid else null end)xanum
214
-        ,count(distinct case when r.resourcetype=7 then r.resourceid else null end)ywbnum
215
-        ,count(distinct case when r.resourcetype=10 then r.resourceid else null end)qtnum
244
+        ,count(distinct if(r.resourcetype=1,r.resourceid,null))xtnum
245
+        ,count(distinct if(r.resourcetype=2,r.resourceid,null))janum
246
+        ,count(distinct if(r.resourcetype=3,r.resourceid,null))kjnum
247
+        ,count(distinct if(r.resourcetype=4,r.resourceid,null))jcnum
248
+        ,count(distinct if(r.resourcetype=5,r.resourceid,null))spnum
249
+        ,count(distinct if(r.resourcetype=6,r.resourceid,null))xanum
250
+        ,count(distinct if(r.resourcetype=7,r.resourceid,null))ywbnum
251
+        ,count(distinct if(r.resourcetype=10,r.resourceid,null))qtnum
216 252
         FROM t_resource r LEFT JOIN t_user u ON r.createid=u.userid
217 253
         left join t_subject s on r.subjectid=s.subjectid
218 254
         left join t_school ts on s.level=ts.schoollevel
@@ -220,9 +256,11 @@
220 256
             LEFT JOIN t_class_teacher ct ON r.createid=ct.teacherid
221 257
             LEFT JOIN t_class c ON ct.classid=c.classid
222 258
         </if>
223
-        WHERE r.resourcestate=1 AND (r.belong IN(1,2) OR (r.belong=3 AND r.schoolid=#{params.schoolid})) and ts.schoolid=#{params.schoolid}
259
+        left join t_resource_director rd on r.resourceid=rd.resourceid
260
+        left join t_director d on rd.directorid=d.directorid
261
+        where d.disabled=0 and r.resourcestate=1 AND (r.belong IN(1,2) OR (r.belong=3 AND r.schoolid=#{params.schoolid})) and ts.schoolid=#{params.schoolid}
224 262
         <if test="params.type!=null and params.type!=0">
225
-            AND r.createtime<![CDATA[ >= ]]>#{params.starttime} AND r.createtime<![CDATA[ <= ]]>#{params.stoptime}
263
+            AND r.createtime >= #{params.starttime} AND r.createtime <![CDATA[ <= ]]>#{params.stoptime}
226 264
         </if>
227 265
         <if test="params.subjectid!=null and params.subjectid!='0'.toString() and params.subjectid!=''">
228 266
             and r.subjectid=#{params.subjectid}

+ 24
- 22
sapi/src/main/resources/mapper/analyze/SchoolRoomMapper.xml View File

@@ -3,11 +3,11 @@
3 3
 <mapper namespace="com.xhkjedu.sapi.mapper.analyze.SchoolRoomMapper">
4 4
     <!--课堂统计-->
5 5
     <resultMap id="schoolroomsbuject" type="com.xhkjedu.sapi.vo.analyze.SchoolRoomSubjectVo">
6
-        <result property="subjectid" column="subjectid"></result>
7
-        <result property="subjectname" column="subjectname"></result>
6
+        <result property="subjectid" column="subjectid"/>
7
+        <result property="subjectname" column="subjectname"/>
8 8
         <collection property="roomlist" ofType="com.xhkjedu.sapi.vo.analyze.SchoolRoomGradeRoomVo">
9
-            <result property="roomid" column="roomid"></result>
10
-            <result property="roomtime" column="roomtime"></result>
9
+            <result property="roomid" column="roomid"/>
10
+            <result property="roomtime" column="roomtime"/>
11 11
         </collection>
12 12
     </resultMap>
13 13
     <select id="listSchoolRoomSubject" resultMap="schoolroomsbuject">
@@ -17,12 +17,13 @@
17 17
          LEFT JOIN t_class c ON r.classid=c.classid
18 18
          LEFT JOIN t_subject s ON sb.subjectid = s.subjectid
19 19
          LEFT JOIN t_user u ON r.createid=u.userid
20
-          WHERE r.roomstate=2 AND r.schoolid=#{sparams.schoolid} and c.gradeid=#{sparams.gradeid} and r.year=#{sparams.year} AND u.userstate=1
20
+        left join t_director d on r.directorid=d.directorid
21
+        where d.disabled=0 and r.roomstate=2 AND r.schoolid=#{sparams.schoolid} and c.gradeid=#{sparams.gradeid} and r.year=#{sparams.year} AND u.userstate=1
21 22
         <if test="sparams.starttime!=null and sparams.starttime!=0">
22
-            AND r.createtime<![CDATA[ >= ]]>#{sparams.starttime}
23
+            AND r.createtime >= #{sparams.starttime}
23 24
         </if>
24 25
         <if test="sparams.stoptime!=null and sparams.stoptime!=0">
25
-            AND r.createtime<![CDATA[ <= ]]>#{sparams.stoptime}
26
+            AND r.createtime <![CDATA[ <= ]]>#{sparams.stoptime}
26 27
         </if>
27 28
           GROUP BY r.roomid ORDER BY s.subjectorder
28 29
     </select>
@@ -30,19 +31,19 @@
30 31
 
31 32
     <!--课堂统计详情-->
32 33
     <resultMap id="schoolroomdetail" type="com.xhkjedu.sapi.vo.analyze.SchoolRoomGradeUserVo">
33
-        <result property="userid" column="userid"></result>
34
-        <result property="username" column="username"></result>
35
-        <result property="headpic" column="headpic"></result>
34
+        <result property="userid" column="userid"/>
35
+        <result property="username" column="username"/>
36
+        <result property="headpic" column="headpic"/>
36 37
         <collection property="udlist" ofType="com.xhkjedu.sapi.vo.analyze.SchoolRoomGradeUserDetailVo">
37
-            <result property="roomid" column="roomid"></result>
38
-            <result property="questionnum" column="questionnum"></result>
39
-            <result property="examnum" column="examnum"></result>
40
-            <result property="asknum" column="asknum"></result>
41
-            <result property="callnum" column="callnum"></result>
42
-            <result property="picnum" column="picnum"></result>
43
-            <result property="totaltime" column="totaltime"></result>
44
-            <result property="classnum" column="classnum"></result>
45
-            <result property="realstunum" column="realstunum"></result>
38
+            <result property="roomid" column="roomid"/>
39
+            <result property="questionnum" column="questionnum"/>
40
+            <result property="examnum" column="examnum"/>
41
+            <result property="asknum" column="asknum"/>
42
+            <result property="callnum" column="callnum"/>
43
+            <result property="picnum" column="picnum"/>
44
+            <result property="totaltime" column="totaltime"/>
45
+            <result property="classnum" column="classnum"/>
46
+            <result property="realstunum" column="realstunum"/>
46 47
         </collection>
47 48
     </resultMap>
48 49
     <select id="listSchoolRoomDetailBySubject" resultMap="schoolroomdetail">
@@ -58,7 +59,8 @@
58 59
           LEFT JOIN t_subject s ON sb.subjectid=s.subjectid
59 60
          LEFT JOIN t_class c ON r.classid=c.classid
60 61
           LEFT JOIN t_user u ON r.createid=u.userid
61
-        WHERE r.roomstate=2 AND r.schoolid=#{sparams.schoolid} AND c.gradeid=#{sparams.gradeid} and r.year=#{sparams.year} AND u.userstate=1
62
+        left join t_director d on r.directorid=d.directorid
63
+        where d.disabled=0 and r.roomstate=2 AND r.schoolid=#{sparams.schoolid} AND c.gradeid=#{sparams.gradeid} and r.year=#{sparams.year} AND u.userstate=1
62 64
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
63 65
             AND s.subjectid=#{sparams.subjectid}
64 66
         </if>
@@ -66,10 +68,10 @@
66 68
             AND u.username like '%${sparams.username}%'
67 69
         </if>
68 70
         <if test="sparams.starttime!=null and sparams.starttime!=0">
69
-            AND r.createtime<![CDATA[ >= ]]>#{sparams.starttime}
71
+            AND r.createtime >= #{sparams.starttime}
70 72
         </if>
71 73
         <if test="sparams.stoptime!=null and sparams.stoptime!=0">
72
-            AND r.createtime<![CDATA[ <= ]]>#{sparams.stoptime}
74
+            AND r.createtime <![CDATA[ <= ]]>#{sparams.stoptime}
73 75
         </if>
74 76
          GROUP BY r.roomid
75 77
     </select>

+ 30
- 26
sapi/src/main/resources/mapper/analyze/SchoolSummaryMapper.xml View File

@@ -3,30 +3,30 @@
3 3
 <mapper namespace="com.xhkjedu.sapi.mapper.analyze.SchoolSummaryMapper">
4 4
     <!--获取用户集合-->
5 5
     <select id="listUser" resultType="com.xhkjedu.sapi.vo.analyze.SchoolSummaryVo">
6
-        select u.userid,u.username,u.loginname,sb.subjectid,s.subjectname
6
+        select u.userid,u.username,u.loginname,tp.subjectid,s.subjectname
7 7
         from t_class_teacher ct left join t_class c on ct.classid=c.classid
8 8
         right join t_teacher_powersb tp on tp.teacherid=ct.teacherid
9
-        left join t_subject_book sb on sb.lsbid=tp.lsbid
10
-        left join t_subject s on s.subjectid=sb.subjectid
9
+        left join t_subject s on s.subjectid=tp.subjectid
11 10
         left join t_user u on ct.teacherid=u.userid
12 11
         where u.schoolid=#{sparams.schoolid} and c.gradeid=#{sparams.gradeid}
13 12
         and c.classstate=1 and c.year=#{sparams.year} and u.userstate=1 and c.classtype in (1,2)
14 13
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
15
-            and sb.subjectid=#{sparams.subjectid}
14
+            and tp.subjectid=#{sparams.subjectid}
16 15
         </if>
17 16
         group by u.userid order by s.subjectorder,u.username
18 17
     </select>
19 18
     <!--获取教师作业统计-->
20 19
     <select id="getPaperAnalyze" resultType="com.xhkjedu.sapi.vo.analyze.SchoolSummaryVo">
21 20
         select p.createid as userid, count(distinct p.paperid)pfabunum,ifnull(round(avg(p.papernum)),0)pquestionnum,
22
-        count(distinct case when pg.starttime&lt;=#{sparams.timestamp} then ps.psid else null end)pstunum,
23
-        count(distinct case when ps.psstate in (1,2) then ps.psid else null end)pcommitnum,
24
-        count(distinct case when ps.psstate in (1,2) and ps.pschecked=1 then ps.psid else null end)pchecknum
21
+        count(distinct if(pg.starttime&lt;=#{sparams.timestamp},ps.psid,null))pstunum,
22
+        count(distinct if(ps.psstate in (1,2),ps.psid,null))pcommitnum,
23
+        count(distinct if(ps.psstate in (1,2) and ps.pschecked=1,ps.psid,null))pchecknum
25 24
         from t_paper p left join t_paper_class pg on p.paperid=pg.paperid
26 25
         left join t_paper_student ps on ps.paperid=pg.paperid and ps.classid=pg.classid
27 26
         left join t_class c on pg.classid=c.classid
28
-        where p.paperstate=22 and p.schoolid=#{sparams.schoolid} and pg.schoolid=#{sparams.schoolid}
29
-        and c.gradeid=#{sparams.gradeid} and p.year=#{sparams.year}
27
+        left join t_director d on p.directorid=d.directorid
28
+        where p.deleted=0 and p.paperstate=22 and p.schoolid=#{sparams.schoolid} and pg.schoolid=#{sparams.schoolid}
29
+        and c.gradeid=#{sparams.gradeid} and p.year=#{sparams.year} and (d.disabled=0 or p.directorid is null)
30 30
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
31 31
             and p.subjectid=#{sparams.subjectid}
32 32
         </if>
@@ -41,16 +41,18 @@
41 41
     <!--获取教师资源统计-->
42 42
     <select id="getResourceAnalyze" resultType="com.xhkjedu.sapi.vo.analyze.SchoolSummaryVo">
43 43
         select r.createid as userid, count(distinct r.resourceid)zytotal
44
-        ,sum(case when r.resourcetype=1 then 1 else 0 end)zyxtnum
45
-        ,sum(case when r.resourcetype=2 then 1 else 0 end)zyjanum
46
-        ,sum(case when r.resourcetype=3 then 1 else 0 end)zykjnum
47
-        ,sum(case when r.resourcetype=4 then 1 else 0 end)zyscnum
48
-        ,sum(case when r.resourcetype=5 then 1 else 0 end)zyspnum
49
-        ,sum(case when r.resourcetype=6 then 1 else 0 end)zyxanum
50
-        ,sum(case when r.resourcetype=7 then 1 else 0 end)zyywbnum
51
-        ,sum(case when r.resourcetype=10 then 1 else 0 end)zyqtnum
44
+        ,count(distinct if(r.resourcetype=1,r.resourceid,null))zyxtnum
45
+        ,count(distinct if(r.resourcetype=2,r.resourceid,null))zyjanum
46
+        ,count(distinct if(r.resourcetype=3,r.resourceid,null))zykjnum
47
+        ,count(distinct if(r.resourcetype=4,r.resourceid,null))zyscnum
48
+        ,count(distinct if(r.resourcetype=5,r.resourceid,null))zyspnum
49
+        ,count(distinct if(r.resourcetype=6,r.resourceid,null))zyxanum
50
+        ,count(distinct if(r.resourcetype=7,r.resourceid,null))zyywbnum
51
+        ,count(distinct if(r.resourcetype=10,r.resourceid,null))zyqtnum
52 52
         from t_resource r
53
-        where r.resourcestate=1 and r.belong!=4 AND r.schoolid=#{sparams.schoolid}
53
+        left join t_resource_director rd on r.resourceid=rd.resourceid
54
+        left join t_director d on rd.directorid=d.directorid
55
+        where d.disabled=0 and r.resourcestate=1 and r.belong!=4 AND r.schoolid=#{sparams.schoolid}
54 56
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
55 57
             and r.subjectid=#{sparams.subjectid}
56 58
         </if>
@@ -65,16 +67,17 @@
65 67
     <!--获取教师课堂统计-->
66 68
     <select id="getRoomAnalyze" resultType="com.xhkjedu.sapi.vo.analyze.SchoolSummaryVo">
67 69
         select r.teacherid as userid, count(distinct r.roomid)kttotal,count(distinct rf.rfid)ktpicnum
68
-        ,count(distinct case when rt.asktype=20 then rt.asktid else null end)ktasknum
69
-        ,count(distinct case when rt.asktype=21 then rt.asktid else null end)ktcallnum
70
-        ,count(distinct case when rt.asktype between 30 and 33 then rt.asktid else null end)ktquestionnum
71
-        ,count(distinct case when rt.asktype=40 then rt.asktid else null end)ktexamnum
70
+        ,count(distinct if(rt.asktype=20,rt.asktid,null))ktasknum
71
+        ,count(distinct if(rt.asktype=21,rt.asktid,null))ktcallnum
72
+        ,count(distinct if(rt.asktype between 30 and 33,rt.asktid,null))ktquestionnum
73
+        ,count(distinct if(rt.asktype=40,rt.asktid,null))ktexamnum
72 74
         ,(r.endtime-r.createtime)kttimes,r.classnum,r.realstunum
73 75
         from t_classroom r left join t_classroom_askteacher rt on rt.roomid=r.roomid
74 76
         left join t_classroom_file rf on rf.roomid=r.roomid
75 77
         left join t_subject_book sb on r.lsbid=sb.lsbid
76 78
         left join t_class c on c.classid=r.classid
77
-        where r.roomstate=2 and r.schoolid=#{sparams.schoolid}
79
+        left join t_director d on r.directorid=d.directorid
80
+        where d.disabled=0 and r.roomstate=2 and r.schoolid=#{sparams.schoolid}
78 81
         and c.gradeid=#{sparams.gradeid} and r.year=#{sparams.year}
79 82
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
80 83
             and sb.subjectid=#{sparams.subjectid}
@@ -91,10 +94,11 @@
91 94
     <select id="getPreviewAnalyze" resultType="com.xhkjedu.sapi.vo.analyze.SchoolSummaryVo">
92 95
         select g.createid as userid, count(distinct g.guideid)yxfbnum,
93 96
         count(distinct ggs.rgsid)yxstunum,
94
-        count(distinct case when ggs.costtime!=0 then ggs.rgsid else null end)yxcomitnum
97
+        count(distinct if(ggs.costtime!=0,ggs.rgsid,null))yxcomitnum
95 98
         from t_guide g left join t_guide_group_student ggs on ggs.guideid=g.guideid
96 99
         left join t_class c on c.classid=ggs.classid
97
-        where g.schoolid=#{sparams.schoolid} and ggs.schoolid=#{sparams.schoolid}
100
+        left join t_director d on g.directorid=d.directorid
101
+        where d.disabled=0 and g.schoolid=#{sparams.schoolid} and ggs.schoolid=#{sparams.schoolid}
98 102
         and c.gradeid=#{sparams.gradeid} and g.year=#{sparams.year}
99 103
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
100 104
             and g.subjectid=#{sparams.subjectid}
@@ -111,7 +115,7 @@
111 115
     <select id="getReciteAnalyze" resultType="com.xhkjedu.sapi.vo.analyze.SchoolSummaryVo">
112 116
         select r.createid as userid, count(distinct r.reciteid)bsfbnum,
113 117
         count(distinct rs.rsid)bsstunum,
114
-        count(distinct case when rs.rsstate!=0 then rs.rsid else null end)bscomitnum
118
+        count(distinct if(rs.rsstate!=0,rs.rsid,null))bscomitnum
115 119
         from t_recite r left join t_recite_group rg on rg.reciteid=r.reciteid
116 120
         left join t_recite_student rs on rs.reciteid=rg.reciteid and rs.classid=rg.classid
117 121
         left join t_class c on c.classid=rg.classid

+ 32
- 28
sapi/src/main/resources/mapper/analyze/SchoolTaskMapper.xml View File

@@ -4,28 +4,29 @@
4 4
     <!--常规作业统计-->
5 5
 
6 6
     <resultMap id="taskwork" type="com.xhkjedu.sapi.vo.analyze.work.SchoolWorkSubjectVo">
7
-        <result property="subjectid" column="subjectid"></result>
8
-        <result property="subjectname" column="subjectname"></result>
9
-        <result property="fabunum" column="fabunum"></result>
10
-        <result property="stunum" column="stunum"></result>
11
-        <result property="commitnum" column="commitnum"></result>
12
-        <result property="checknum" column="checknum"></result>
7
+        <result property="subjectid" column="subjectid"/>
8
+        <result property="subjectname" column="subjectname"/>
9
+        <result property="fabunum" column="fabunum"/>
10
+        <result property="stunum" column="stunum"/>
11
+        <result property="commitnum" column="commitnum"/>
12
+        <result property="checknum" column="checknum"/>
13 13
         <!--<collection property="worklist" ofType="com.xhkjedu.vo.analyze.work.SchoolWorkDetailVo">
14
-            <result property="paperid" column="paperid"></result>
14
+            <result property="paperid" column="paperid"/>
15 15
         </collection>-->
16 16
     </resultMap>
17 17
     <select id="listSchoolTaskWork" resultMap="taskwork">
18 18
       SELECT p.subjectid,s.subjectname,count(distinct p.paperid)fabunum,
19
-        count(distinct case when pg.starttime&lt;=#{sparams.timestamp} then ps1.psid else null end)stunum,
20
-        count(distinct case when ps1.psstate in (1,2) then ps1.psid else null end) commitnum,
21
-        count(distinct case when ps1.psstate in (1,2) and ps1.pschecked=1 then ps1.psid else null end) checknum
19
+        count(distinct if(pg.starttime&lt;=#{sparams.timestamp},ps1.psid,null))stunum,
20
+        count(distinct if(ps1.psstate in (1,2),ps1.psid,null)) commitnum,
21
+        count(distinct if(ps1.psstate in (1,2) and ps1.pschecked=1,ps1.psid,null)) checknum
22 22
         FROM t_paper p LEFT JOIN t_subject s ON p.subjectid=s.subjectid
23 23
         left join t_paper_class pg on p.paperid=pg.paperid
24 24
         LEFT JOIN t_paper_student ps1 ON p.paperid=ps1.paperid and ps1.classid=pg.classid
25 25
         LEFT JOIN t_class c ON pg.classid=c.classid
26 26
         LEFT JOIN T_USER U ON p.createid=u.userid
27
-        WHERE p.paperstate=22 AND p.schoolid=#{sparams.schoolid} AND pg.schoolid=#{sparams.schoolid}
28
-        AND c.gradeid=#{sparams.gradeid} and p.year=#{sparams.year} AND u.userstate=1
27
+        left join t_director d on p.directorid=d.directorid
28
+        where p.deleted=0 and p.paperstate=22 AND p.schoolid=#{sparams.schoolid} AND pg.schoolid=#{sparams.schoolid}
29
+        AND c.gradeid=#{sparams.gradeid} and p.year=#{sparams.year} AND u.userstate=1 and (d.disabled=0 or p.directorid is null)
29 30
         <if test="sparams.starttime!=null and sparams.starttime!=0">
30 31
             AND pg.starttime>=#{sparams.starttime}
31 32
         </if>
@@ -38,14 +39,15 @@
38 39
     <!--常规作业 详情-->
39 40
     <select id="listSchoolTaskWorkDetail" resultType="com.xhkjedu.sapi.vo.analyze.work.SchoolWorkSubjectVo">
40 41
         select p.createid userid,count(distinct p.paperid)fabunum,
41
-        count(distinct case when pg.starttime&lt;=#{sparams.timestamp} then ps1.psid else null end)stunum,
42
-        count(distinct case when ps1.psstate in (1,2) then ps1.psid else null end) commitnum,
43
-        count(distinct case when ps1.psstate in (1,2) and ps1.pschecked=1 then ps1.psid else null end) checknum
42
+        count(distinct if(pg.starttime&lt;=#{sparams.timestamp},ps1.psid,null))stunum,
43
+        count(distinct if(ps1.psstate in (1,2),ps1.psid,null)) commitnum,
44
+        count(distinct if(ps1.psstate in (1,2) and ps1.pschecked=1,ps1.psid,null)) checknum
44 45
         from t_paper p left join t_paper_class pg on p.paperid=pg.paperid
45 46
         left join t_paper_student ps1 on ps1.paperid=pg.paperid and ps1.classid=pg.classid
46 47
         left join t_class c on c.classid=pg.classid
47
-        where p.schoolid=#{sparams.schoolid} and p.paperstate=22 and pg.schoolid=#{sparams.schoolid}
48
-        and c.gradeid=#{sparams.gradeid} and p.year=#{sparams.year}
48
+        left join t_director d on p.directorid=d.directorid
49
+        where p.deleted=0 and p.schoolid=#{sparams.schoolid} and p.paperstate=22 and pg.schoolid=#{sparams.schoolid}
50
+        and c.gradeid=#{sparams.gradeid} and p.year=#{sparams.year} and (d.disabled=0 or p.directorid is null)
49 51
         <if test="sparams.starttime!=null and sparams.starttime!=0">
50 52
             AND pg.starttime>=#{sparams.starttime}
51 53
         </if>
@@ -62,34 +64,36 @@
62 64
     <select id="listSchoolTaskGuide" resultMap="taskwork">
63 65
           SELECT s.subjectid,s.subjectname,count(distinct g.guideid)fabunum,
64 66
          count(distinct ggs.rgsid)stunum,
65
-         count(distinct case when ggs.costtime!=0 then ggs.rgsid else null end) commitnum
67
+         count(distinct if(ggs.costtime!=0,ggs.rgsid,null)) commitnum
66 68
          FROM t_guide g left join t_guide_group_student ggs on ggs.guideid=g.guideid
67 69
          LEFT JOIN t_class c ON ggs.classid=c.classid
68 70
          LEFT JOIN t_subject s ON g.subjectid=s.subjectid
69 71
          LEFT JOIN T_USER U ON g.createid=u.userid
70
-         WHERE g.schoolid=#{sparams.schoolid} AND ggs.schoolid=#{sparams.schoolid}
72
+        left join t_director d on g.directorid=d.directorid
73
+        where d.disabled=0 and g.schoolid=#{sparams.schoolid} AND ggs.schoolid=#{sparams.schoolid}
71 74
         AND c.gradeid=#{sparams.gradeid} and g.year=#{sparams.year} and u.userstate=1
72 75
         <if test="sparams.starttime!=null and sparams.starttime!=0">
73
-            AND g.createtime<![CDATA[ >= ]]>#{sparams.starttime}
76
+            AND g.createtime >= #{sparams.starttime}
74 77
         </if>
75 78
         <if test="sparams.stoptime!=null and sparams.stoptime!=0">
76
-            AND g.createtime<![CDATA[ <= ]]>#{sparams.stoptime}
79
+            AND g.createtime <![CDATA[ <= ]]>#{sparams.stoptime}
77 80
         </if>
78 81
          GROUP BY g.subjectid ORDER BY s.subjectorder
79 82
     </select>
80 83
     <select id="listSchoolTaskGuideDetail" resultType="com.xhkjedu.sapi.vo.analyze.work.SchoolWorkSubjectVo">
81 84
         select g.createid userid,count(distinct g.guideid)fabunum,
82 85
         count(distinct ggs.rgsid)stunum,
83
-        count(distinct case when ggs.costtime!=0 then ggs.rgsid else null end) commitnum
86
+        count(distinct if(ggs.costtime!=0,ggs.rgsid,null)) commitnum
84 87
         from t_guide g left join t_guide_group_student ggs on ggs.guideid=g.guideid
85 88
         left join t_class c on c.classid=ggs.classid
86
-        where g.schoolid=#{sparams.schoolid} and ggs.schoolid=#{sparams.schoolid}
89
+        left join t_director d on g.directorid=d.directorid
90
+        where d.disabled=0 and g.schoolid=#{sparams.schoolid} and ggs.schoolid=#{sparams.schoolid}
87 91
         and c.gradeid=#{sparams.gradeid} and g.year=#{sparams.year}
88 92
         <if test="sparams.starttime!=null and sparams.starttime!=0">
89
-            AND g.createtime<![CDATA[ >= ]]>#{sparams.starttime}
93
+            AND g.createtime >= #{sparams.starttime}
90 94
         </if>
91 95
         <if test="sparams.stoptime!=null and sparams.stoptime!=0">
92
-            AND g.createtime<![CDATA[ <= ]]>#{sparams.stoptime}
96
+            AND g.createtime <![CDATA[ <= ]]>#{sparams.stoptime}
93 97
         </if>
94 98
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
95 99
             and g.subjectid=#{sparams.subjectid}
@@ -101,7 +105,7 @@
101 105
     <select id="listSchoolTaskRecite" resultMap="taskwork">
102 106
           SELECT r.subjectid,s.subjectname,count(distinct r.reciteid)fabunum,
103 107
          count(distinct rs.rsid) stunum,
104
-         count(distinct case when rs.rsstate!=0 then rs.rsid else null end) commitnum
108
+         count(distinct if(rs.rsstate!=0,rs.rsid,null)) commitnum
105 109
          FROM t_recite r left join t_recite_group rg on rg.reciteid=r.reciteid
106 110
           LEFT JOIN t_subject s ON r.subjectid=s.subjectid
107 111
          LEFT JOIN t_recite_student rs ON rg.reciteid=rs.reciteid and rg.classid=rs.classid
@@ -122,7 +126,7 @@
122 126
     <select id="listSchoolTaskReciteDetail" resultType="com.xhkjedu.sapi.vo.analyze.work.SchoolWorkSubjectVo">
123 127
         select r.createid userid,count(distinct r.reciteid)fabunum,
124 128
         count(distinct rs.rsid) stunum,
125
-        count(distinct case when rs.rsstate!=0 then rs.rsid else null end) commitnum
129
+        count(distinct if(rs.rsstate!=0,rs.rsid,null)) commitnum
126 130
         from t_recite r left join t_recite_group rg on rg.reciteid=r.reciteid
127 131
         left join t_recite_student rs on rs.reciteid=rg.reciteid and rs.classid=rg.classid
128 132
         left join t_class c on c.classid=rg.classid
@@ -142,7 +146,7 @@
142 146
 
143 147
     <!--获取用户集合-->
144 148
     <select id="listUser" resultType="com.xhkjedu.sapi.vo.analyze.SchoolParams">
145
-        select u.userid createid,u.username
149
+        select u.userid as createid,u.username
146 150
         from t_class_teacher ct left join t_class c on ct.classid=c.classid
147 151
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
148 152
         right join t_teacher_powersb tp on tp.teacherid=ct.teacherid

+ 38
- 33
sapi/src/main/resources/mapper/classreport/ClassReportMapper.xml View File

@@ -5,16 +5,17 @@
5 5
     <select id="listPreview" resultType="com.xhkjedu.sapi.vo.classreport.ReportClasstypeVo">
6 6
         select c.classid,c.classtype,c.gradeid,g.subjectid,s.year,g.schoolid
7 7
         ,(select count(*) from t_class c1 where c1.gradeid=c.gradeid and c1.year=c.year
8
-        and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=g.schoolid)classnum
9
-        ,count(ggs.rgsid)xsnum
10
-        ,sum(case when ggs.costtime!=0 then 1 else 0 end)tjnum
11
-        ,ifnull(truncate(sum(case when ggs.costtime!=0 then 1 else 0 end)*100/count(ggs.rgsid),2),0)numrate
8
+        and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=g.schoolid) as classnum
9
+        ,count(distinct ggs.rgsid)xsnum
10
+        ,count(distinct if(ggs.costtime!=0,ggs.rgsid,null))tjnum
11
+        ,ifnull(truncate(count(distinct if(ggs.costtime!=0,ggs.rgsid,null))*100/count(distinct ggs.rgsid),2),0)numrate
12 12
         ,from_unixtime(g.createtime,'%Y-%m-%d')begindate,count(distinct g.guideid)fbnum
13 13
         from t_guide g left join t_guide_group gg on g.guideid=gg.guideid
14 14
         left join t_guide_group_student ggs on ggs.guideid=gg.guideid and ggs.classid=gg.classid
15 15
         left join t_class c on gg.classid=c.classid
16 16
         left join t_school s on g.schoolid=s.schoolid and gg.schoolid=s.schoolid
17
-        where s.schoolstate=1 and s.year=c.year and c.classstate=1
17
+        left join t_director d on g.directorid=d.directorid
18
+        where d.disabled=0 and s.schoolstate=1 and s.year=c.year and c.classstate=1
18 19
         <if test="type.reporttype==1">and YEARWEEK(FROM_UNIXTIME(g.createtime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)-#{type.basenum}</if>
19 20
         <if test="type.reporttype==2">and MONTH(FROM_UNIXTIME(g.createtime))=MONTH(now())-#{type.basenum}</if>
20 21
         <if test="type.reporttype==3">and YEARWEEK(FROM_UNIXTIME(g.createtime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)</if>
@@ -48,21 +49,22 @@
48 49
     <select id="listClassroom" resultType="com.xhkjedu.sapi.vo.classreport.ReportClasstypeVo">
49 50
         select c.classid,c.classtype,c.gradeid,sb.subjectid,s.year,r.schoolid
50 51
         ,(select count(*) from t_class c1 where c1.gradeid=c.gradeid and c1.year=c.year
51
-        and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=r.schoolid)classnum
52
+        and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=r.schoolid) as classnum
52 53
         ,r.classnum xsnum
53 54
         ,r.realstunum tjnum
54 55
         ,ifnull(truncate(r.realstunum*100/r.classnum,2),0)numrate
55
-        ,count(distinct case when rt.asktype between 30 and 33 then rt.asktid else null end)twnum
56
-        ,count(distinct case when rt.asktype =40 then rt.asktid else null end)tcnum
57
-        ,count(distinct case when rt.asktype =21 then rt.asktid else null end)dmnum
58
-        ,count(distinct case when rt.asktype =20 then rt.asktid else null end)qdnum
56
+        ,count(distinct if(rt.asktype between 30 and 33,rt.asktid,null))twnum
57
+        ,count(distinct if(rt.asktype=40,rt.asktid,null))tcnum
58
+        ,count(distinct if(rt.asktype=21,rt.asktid,null))dmnum
59
+        ,count(distinct if(rt.asktype=20,rt.asktid,null))qdnum
59 60
         ,from_unixtime(r.createtime,'%Y-%m-%d')begindate,count(distinct r.roomid)fbnum
60 61
         from t_classroom r left join t_class c on r.classid=c.classid
61 62
         left join t_classroom_askteacher rt on r.roomid=rt.roomid
62 63
         left join t_classroom_sign rs on rs.roomid=r.roomid
63 64
         left join t_school s on r.schoolid=s.schoolid
64 65
         left join t_subject_book sb on r.lsbid=sb.lsbid
65
-        where r.roomstate=2 and r.realstunum!=0 and s.schoolstate=1 and s.year=c.year and c.classstate=1
66
+        left join t_director d on r.directorid=d.directorid
67
+        where d.disabled=0 and r.roomstate=2 and r.realstunum!=0 and s.schoolstate=1 and s.year=c.year and c.classstate=1
66 68
         <if test="type.reporttype==1">and YEARWEEK(FROM_UNIXTIME(r.createtime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)-#{type.basenum}</if>
67 69
         <if test="type.reporttype==2">and MONTH(FROM_UNIXTIME(r.createtime))=MONTH(now())-#{type.basenum}</if>
68 70
         <if test="type.reporttype==3">and YEARWEEK(FROM_UNIXTIME(r.createtime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)</if>
@@ -96,22 +98,23 @@
96 98
     <select id="listPaper" resultType="com.xhkjedu.sapi.vo.classreport.ReportClasstypeVo">
97 99
         select c.classid,c.classtype,c.gradeid,p.subjectid,s.year,p.schoolid
98 100
         ,(select count(*) from t_class c1 where c1.gradeid=c.gradeid and c1.year=c.year
99
-        and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=p.schoolid)classnum
100
-        ,count(distinct case when pg.starttime&lt;=#{type.createtime} then ps.psid else null end)xsnum
101
-        ,sum(case when ps.psstate!=0 then 1 else 0 end)tjnum
102
-        ,ifnull(truncate(sum(case when ps.psstate!=0 then 1 else 0 end)*100/
103
-        count(distinct case when pg.starttime&lt;=#{type.createtime} then ps.psid else null end),2),0)numrate
104
-        ,sum(case when ps.pschecked=1 then 1 else 0 end)pgnum
105
-        ,ifnull(truncate(sum(case when ps.pschecked=1 then 1 else 0 end)*100/sum(case when ps.psstate!=0 then 1 else 0 end),2),0)pgrate
106
-        ,sum(case when pg.starttime&lt;=#{type.createtime} then ps.paperscore else 0 end)pscore
101
+        and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=p.schoolid) as classnum
102
+        ,count(distinct if(pg.starttime&lt;=#{type.createtime},ps.psid,null))xsnum
103
+        ,count(distinct if(ps.psstate in(1,2),ps.psid,null))tjnum
104
+        ,ifnull(truncate(count(distinct if(ps.psstate in(1,2),ps.psid,null))*100/
105
+        count(distinct if(pg.starttime&lt;=#{type.createtime},ps.psid,null)),2),0)numrate
106
+        ,count(distinct if(ps.pschecked=1,ps.psid,null))pgnum
107
+        ,ifnull(truncate(count(distinct if(ps.pschecked=1,ps.psid,null))*100/count(distinct if(ps.psstate in(1,2),ps.psid,null)),2),0)pgrate
108
+        ,sum(if(pg.starttime&lt;=#{type.createtime},ps.paperscore,0))pscore
107 109
         ,sum(ps.userscore)uscore
108
-        ,ifnull(truncate(sum(ps.userscore)*100/sum(case when pg.starttime&lt;=#{type.createtime} then ps.paperscore else 0 end),2),0)zqrate
110
+        ,ifnull(truncate(sum(ps.userscore)*100/sum(if(pg.starttime&lt;=#{type.createtime},ps.paperscore,0)),2),0)zqrate
109 111
         ,from_unixtime(pg.starttime,'%Y-%m-%d')begindate,count(distinct p.paperid)fbnum
110 112
         from t_paper p left join t_paper_class pg on p.paperid=pg.paperid
111 113
         left join t_paper_student ps on ps.paperid=p.paperid and ps.classid=pg.classid
112 114
         left join t_class c on pg.classid=c.classid
113 115
         left join t_school s on p.schoolid=s.schoolid and pg.schoolid=s.schoolid
114
-        where p.paperstate=22 and s.schoolstate=1 and s.year=c.year and c.classstate=1
116
+        left join t_director d on p.directorid=d.directorid
117
+        where (d.disabled=0 or p.directorid is null) and p.paperstate=22 and s.schoolstate=1 and s.year=c.year and c.classstate=1
115 118
         <if test="type.reporttype==1">and YEARWEEK(FROM_UNIXTIME(pg.starttime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)-#{type.basenum}</if>
116 119
         <if test="type.reporttype==2">and MONTH(FROM_UNIXTIME(pg.starttime))=MONTH(now())-#{type.basenum}</if>
117 120
         <if test="type.reporttype==3">and YEARWEEK(FROM_UNIXTIME(pg.starttime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)</if>
@@ -146,13 +149,13 @@
146 149
     <select id="listRecite" resultType="com.xhkjedu.sapi.vo.classreport.ReportClasstypeVo">
147 150
         select c.classid,c.classtype,c.gradeid,r.subjectid,s.year,r.schoolid
148 151
         ,(select count(*) from t_class c1 where c1.gradeid=c.gradeid and c1.year=c.year
149
-        and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=r.schoolid)classnum
152
+        and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=r.schoolid) as classnum
150 153
         ,count(rs.rsid)xsnum
151
-        ,sum(case when rs.rsstate!=0 then 1 else 0 end)tjnum
152
-        ,ifnull(truncate(sum(case when rs.rsstate!=0 then 1 else 0 end)*100/count(rs.rsid),2),0)numrate
153
-        ,sum(case when rs.rsstate!=0 then 1 else 0 end)*100 pscore
154
+        ,sum(if(rs.rsstate!=0,1,0))tjnum
155
+        ,ifnull(truncate(sum(if(rs.rsstate!=0,1,0))*100/count(rs.rsid),2),0) as numrate
156
+        ,sum(if(rs.rsstate!=0,1,0))*100 as pscore
154 157
         ,sum(rs.userscore)uscore
155
-        ,ifnull(truncate(sum(rs.userscore)*100/(sum(case when rs.rsstate!=0 then 1 else 0 end)*100),2),0)zqrate
158
+        ,ifnull(truncate(sum(rs.userscore)*100/(sum(if(rs.rsstate!=0,1,0))*100),2),0)zqrate
156 159
         ,from_unixtime(rg.starttime,'%Y-%m-%d')begindate,count(distinct r.reciteid)fbnum
157 160
         from t_recite r left join t_recite_group rg on r.reciteid=rg.reciteid
158 161
         left join t_recite_student rs on rs.reciteid=r.reciteid and rs.classid=rg.classid
@@ -192,7 +195,7 @@
192 195
     <select id="listErrQuestionFd" resultType="com.xhkjedu.sapi.vo.classreport.ReportClasstypeVo">
193 196
         select c.classid,c.classtype,c.gradeid,p.subjectid,s.year,qc.schoolid
194 197
         ,(select count(*) from t_class c1 where c1.gradeid=c.gradeid and c1.year=c.year
195
-        and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=qc.schoolid)classnum
198
+        and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=qc.schoolid) as classnum
196 199
         ,from_unixtime(qe.createtime,'%Y-%m-%d')begindate,count(distinct qe.qcpid)fbnum
197 200
         from t_question_explain qe left join t_question_class qc on qe.qctype=qc.qctype and qc.questionid=qe.questionid
198 201
         left join t_class c on qc.classid=c.classid
@@ -232,9 +235,10 @@
232 235
     <select id="listErrQuestion" resultType="com.xhkjedu.sapi.vo.classreport.ReportClasstypeVo">
233 236
         select c.classid,c.classtype,c.gradeid,p.subjectid,s.year,qc.schoolid
234 237
         ,(select count(*) from t_class c1 where c1.gradeid=c.gradeid and c1.year=c.year
235
-        and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=qc.schoolid)classnum
236
-        ,(select t.qtypename from t_subject_questiontype t where t.qtypeid=qc.qtypeid)typename
237
-        ,qc.qtypeid typeid
238
+        and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=qc.schoolid) as classnum
239
+        ,if(qc.qtypeid is null,(select ps.qtypename from t_paper_scantron ps where ps.pscaid=qc.questionid)
240
+            ,(select t.qtypename from t_subject_questiontype t where t.qtypeid=qc.qtypeid))typename
241
+        ,ifnull(qc.qtypeid,(select ps.psqtypeid from t_paper_scantron ps where ps.pscaid=qc.questionid)) typeid
238 242
         from t_question_class qc left join t_class c on qc.classid=c.classid
239 243
         left join t_school s on qc.schoolid=s.schoolid
240 244
         left join t_paper p on qc.paperid=p.paperid
@@ -284,10 +288,10 @@
284 288
     <select id="listLive" resultType="com.xhkjedu.sapi.vo.classreport.ReportClasstypeVo">
285 289
         select c.classid,c.classtype,c.gradeid,l.subjectid,s.year,l.schoolid
286 290
         ,(select count(*) from t_class c1 where c1.gradeid=c.gradeid and c1.year=c.year
287
-        and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=l.schoolid)classnum
291
+        and c1.classstate=1 and c1.classtype=c.classtype and c1.schoolid=l.schoolid) as classnum
288 292
         ,sum(time_to_sec(timediff(ifnull(ls.endtime,ls.planendtime)
289 293
         ,ifnull(ls.begintime,ls.planbegintime))))/60 minutenum
290
-        ,from_unixtime(ls.createtime,'%Y-%m-%d')begindate,count(distinct ls.sectionid)fbnum
294
+        ,from_unixtime(ls.createtime,'%Y-%m-%d') as begindate,count(distinct ls.sectionid)fbnum
291 295
         from l_course_section ls left join l_course l on l.courseid=ls.courseid
292 296
         left join l_course_class cs on l.courseid=cs.courseid
293 297
         left join t_class c on cs.classid=c.classid
@@ -330,7 +334,8 @@
330 334
         left join t_question_point qp on psq.questionpid=qp.questionid
331 335
         left join t_class c on psq.classid=c.classid
332 336
         left join t_school s on p.schoolid=s.schoolid
333
-        where s.schoolstate=1 and s.year=c.year and c.classstate=1 and psq.checked=1
337
+        left join t_director d on p.directorid=d.directorid
338
+        where (d.disabled=0 or p.directorid is null) and s.schoolstate=1 and s.year=c.year and c.classstate=1 and psq.checked=1
334 339
         <if test="type.reporttype==1">and YEARWEEK(FROM_UNIXTIME(p.createtime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)-#{type.basenum}</if>
335 340
         <if test="type.reporttype==2">and MONTH(FROM_UNIXTIME(p.createtime))=MONTH(now())-#{type.basenum}</if>
336 341
         <if test="type.reporttype==3">and YEARWEEK(FROM_UNIXTIME(p.createtime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)</if>

+ 23
- 2
sapi/src/main/resources/mapper/cloud/CloudSyncMapper.xml View File

@@ -3,7 +3,7 @@
3 3
 <mapper namespace="com.xhkjedu.sapi.mapper.cloud.CloudSyncMapper">
4 4
   <!--列表-->
5 5
   <resultMap id="syncResult" type="java.util.Map">
6
-    <id column="csid" property="csid"></id>
6
+    <id column="csid" property="csid"/>
7 7
     <collection property="details" javaType="java.util.List" select="listDetail" column="csid">
8 8
     </collection>
9 9
   </resultMap>
@@ -14,7 +14,7 @@
14 14
     ,(select v.versionname from t_version v where v.versionid=sb.versionid)versionname
15 15
     ,(case synctable when 't_subject' then '科目' when 't_version' then '版本' when 't_subject_book' then '教材'
16 16
     when 't_director' then '章节' when 't_point' then '知识点' when 't_subject_questiontype' then '题型'
17
-    when 't_resource' then '资源' when 't_question' then '试题' else synctable end)synctable
17
+    when 't_resource' then '资源' when 't_question' then '试题' else synctable end) as synctable
18 18
     from t_cloud_sync_detail d left join t_subject_book sb on d.lsbid=sb.lsbid
19 19
     where csid=#{csid}
20 20
   </select>
@@ -165,4 +165,25 @@
165 165
         ALTER TABLE t_point ADD CONSTRAINT fk_pointpid
166 166
         FOREIGN KEY (pointpid) REFERENCES t_point(pointid) ON DELETE CASCADE ON UPDATE CASCADE;
167 167
     </update>
168
+    <!--获取同步类型-->
169
+    <select id="listModule" resultType="java.util.Map">
170
+        select 't_subject' as moduleid,'科目管理' as modulename
171
+        ,(select createtime from t_cloud_sync_detail where synctable='t_subject'
172
+        order by createtime desc limit 1)createtime
173
+        union select 't_version' as moduleid,'版本管理' as modulename
174
+        ,(select createtime from t_cloud_sync_detail where synctable='t_version'
175
+        order by createtime desc limit 1)createtime
176
+        union select 't_subject_book' as moduleid,'教材管理' as modulename
177
+        ,(select createtime from t_cloud_sync_detail where synctable='t_subject_book'
178
+        order by createtime desc limit 1)createtime
179
+        union select 't_director' as moduleid,'章节管理' as modulename
180
+        ,(select createtime from t_cloud_sync_detail where synctable='t_director'
181
+        order by createtime desc limit 1)createtime
182
+        union select 't_point' as moduleid,'知识点管理' as modulename
183
+        ,(select createtime from t_cloud_sync_detail where synctable='t_point'
184
+        order by createtime desc limit 1)createtime
185
+        union select 't_questionqtype' as moduleid,'题型管理' as modulename
186
+        ,(select createtime from t_cloud_sync_detail where synctable='t_questionqtype'
187
+        order by createtime desc limit 1)createtime
188
+    </select>
168 189
 </mapper>

+ 15
- 15
sapi/src/main/resources/mapper/itemtool/StudentTodoMapper.xml View File

@@ -5,7 +5,7 @@
5 5
     <select id="listTodoNum" resultType="com.xhkjedu.sapi.vo.itemtool.StudentTodoVo">
6 6
         <foreach collection ="todos" item="todo" index= "index" separator ="union">
7 7
             <if test="todo.todotype=='guide'">
8
-                select 'guide' todotype,count(distinct g.guideid)num,#{todo.subjectid} subjectid
8
+                select 'guide' as todotype,count(distinct g.guideid)num,#{todo.subjectid} as subjectid
9 9
                 from t_guide_group_student s left join t_guide g on s.guideid = g.guideid
10 10
                 where s.studentid=#{todo.studentid} and s.costtime=0
11 11
                 <if test="todo.subjectid!=null and todo.subjectid!='0'.toString() and todo.subjectid!=''">
@@ -16,7 +16,7 @@
16 16
                 </if>
17 17
             </if>
18 18
             <if test="todo.todotype=='classroom'">
19
-                select 'classroom' todotype,count(distinct r.roomid)num,#{todo.subjectid} subjectid
19
+                select 'classroom' as todotype,count(distinct r.roomid)num,#{todo.subjectid} as subjectid
20 20
                 from t_class_student s left join t_classroom r on s.classid = r.classid
21 21
                 left join t_subject_book sb on r.lsbid = sb.lsbid
22 22
                 where r.roomstate=1 and s.studentid=#{todo.studentid}
@@ -28,10 +28,10 @@
28 28
                 </if>
29 29
             </if>
30 30
             <if test="todo.todotype=='paper'">
31
-                select 'paper' todotype,count(distinct p.paperid)num,#{todo.subjectid} subjectid
31
+                select 'paper' as todotype,count(distinct p.paperid)num,#{todo.subjectid} as subjectid
32 32
                 from t_paper_student s join t_paper p on p.paperid = s.paperid
33 33
                 left join t_paper_class pg on s.paperid = pg.paperid and s.classid=pg.classid
34
-                where pg.starttime&lt;=#{timestamp} and s.studentid=#{todo.studentid} and s.psstate=0
34
+                where pg.starttime&lt;=#{timestamp} and s.studentid=#{todo.studentid} and s.psstate in(0,3)
35 35
                 <if test="todo.subjectid!=null and todo.subjectid!='0'.toString() and todo.subjectid!=''">
36 36
                     and p.subjectid=#{todo.subjectid}
37 37
                 </if>
@@ -40,7 +40,7 @@
40 40
                 </if>
41 41
             </if>
42 42
             <if test="todo.todotype=='errorque'">
43
-                select 'errorque' todotype,count(*)num,#{todo.subjectid} subjectid
43
+                select 'errorque' as todotype,count(*)num,#{todo.subjectid} as subjectid
44 44
                 from t_question_student s
45 45
                 where s.studentid=#{todo.studentid} and s.delstate=0
46 46
                 <if test="todo.subjectid!=null and todo.subjectid!='0'.toString() and todo.subjectid!=''">
@@ -51,7 +51,7 @@
51 51
                 </if>
52 52
             </if>
53 53
             <if test="todo.todotype=='video'">
54
-                select 'video' todotype,count(distinct r.resourceid)num,#{todo.subjectid} subjectid
54
+                select 'video' as todotype,count(distinct r.resourceid)num,#{todo.subjectid} as subjectid
55 55
                 from t_resource r
56 56
                 where (r.belong in(1,2) or (r.belong in(3,10) and r.schoolid=#{schoolid})) and r.resourcestate=1 and r.level=4
57 57
                 <if test="todo.subjectid!=null and todo.subjectid!='0'.toString() and todo.subjectid!=''">
@@ -62,7 +62,7 @@
62 62
                 </if>
63 63
             </if>
64 64
             <if test="todo.todotype=='notice'">
65
-                select 'notice' todotype,count(distinct n.noticeid)num,#{todo.subjectid} subjectid
65
+                select 'notice' as todotype,count(distinct n.noticeid)num,#{todo.subjectid} as subjectid
66 66
                 from t_notice n left join t_notice_class nc on n.noticeid = nc.noticeid
67 67
                 left join t_class_student s on nc.classid=s.classid
68 68
                 where s.studentid=#{todo.studentid}
@@ -71,16 +71,16 @@
71 71
                 </if>
72 72
             </if>
73 73
             <if test="todo.todotype=='checkpaper'">
74
-                select 'checkpaper' todotype,count(distinct p.paperid)num,#{todo.subjectid} subjectid
74
+                select 'checkpaper' as todotype,count(distinct p.paperid)num,#{todo.subjectid} as subjectid
75 75
                 from t_paper_student ps join t_paper p on p.paperid = ps.paperid
76 76
                 left join t_paper_class pg on ps.paperid = pg.paperid and ps.classid=pg.classid
77
-                where ps.checkid=#{todo.studentid} and ps.psstate!=0 and ps.pschecked!=1
77
+                where ps.checkid=#{todo.studentid} and ps.psstate in(1,2) and ps.pschecked!=1
78 78
                 <if test="todo.showtime!=null and todo.showtime!=0">
79 79
                     and pg.starttime>=#{todo.showtime}
80 80
                 </if>
81 81
             </if>
82 82
             <if test="todo.todotype=='recite'">
83
-                select 'recite' todotype,count(distinct r.reciteid)num,#{todo.subjectid} subjectid
83
+                select 'recite' as todotype,count(distinct r.reciteid)num,#{todo.subjectid} as subjectid
84 84
                 from t_recite_student rs LEFT JOIN t_recite r ON rs.reciteid=r.reciteid
85 85
                 LEFT JOIN t_recite_group rg ON rs.reciteid=rg.reciteid AND rg.classid=rs.classid
86 86
                 where rg.starttime&lt;=#{timestamp} and rs.studentid=#{todo.studentid} and rs.rsstate=0
@@ -92,7 +92,7 @@
92 92
                 </if>
93 93
             </if>
94 94
             <if test="todo.todotype=='read'">
95
-                select 'read' todotype
95
+                select 'read' as todotype
96 96
                 ,count(distinct r.readid)-count(distinct rs.readid)num
97 97
                 ,#{todo.subjectid} subjectid
98 98
                 from t_read r left join t_read_date rd on r.readid=rd.readid
@@ -112,7 +112,7 @@
112 112
                 </if>
113 113
             </if>
114 114
             <if test="todo.todotype=='classroomreview'">
115
-                select 'classroomreview' todotype,count(distinct r.roomid)num,#{todo.subjectid} subjectid
115
+                select 'classroomreview' as todotype,count(distinct r.roomid)num,#{todo.subjectid} as subjectid
116 116
                 from t_classroom_sign rs left join t_classroom r on rs.roomid=r.roomid
117 117
                 left join t_subject_book sb on r.lsbid=sb.lsbid
118 118
                 where rs.userid=#{todo.studentid}
@@ -124,7 +124,7 @@
124 124
                 </if>
125 125
             </if>
126 126
             <if test="todo.todotype=='sellive'">
127
-                select 'sellive' todotype,count(distinct l.courseid)num,#{todo.subjectid} subjectid
127
+                select 'sellive' as todotype,count(distinct l.courseid)num,#{todo.subjectid} as subjectid
128 128
                 from l_course l
129 129
                 where l.schoolid=#{schoolid} and l.coursetype=0 and l.deleted=1 and l.coursestate!=3
130 130
                 and l.limitstamp>=#{timestamp}
@@ -136,7 +136,7 @@
136 136
                 </if>
137 137
             </if>
138 138
             <if test="todo.todotype=='mylive'">
139
-                select 'mylive' todotype,count(distinct l.courseid)num,#{todo.subjectid} subjectid
139
+                select 'mylive' as todotype,count(distinct l.courseid)num,#{todo.subjectid} as subjectid
140 140
                 from l_course l left join t_class_student cs on l.classid=cs.classid
141 141
                 left join l_course_section ls on ls.courseid=l.courseid
142 142
                 where cs.studentid=#{todo.studentid} and l.deleted=1 and ls.sectiondate=CURRENT_DATE()
@@ -148,7 +148,7 @@
148 148
                 </if>
149 149
             </if>
150 150
             <if test="todo.todotype=='exam'">
151
-                select 'exam' todotype,count(distinct eps.epsid)num,#{todo.subjectid} subjectid
151
+                select 'exam' as todotype,count(distinct eps.epsid) as num,#{todo.subjectid} as subjectid
152 152
                 from e_paper_student eps left join e_subject es on eps.esid=es.esid
153 153
                 left join e_base e on eps.examid=e.examid
154 154
                 where e.deleted=1 and e.exammode=1 and eps.studentid=#{todo.studentid} and e.examstate>=1

+ 37
- 28
sapi/src/main/resources/mapper/region/RPaperAnalyzeMapper.xml View File

@@ -7,7 +7,9 @@
7 7
       select count(DISTINCT pg.paperid) from t_paper_class pg left join t_paper p on pg.paperid=p.paperid
8 8
         LEFT JOIN t_school s on p.schoolid=s.schoolid and pg.schoolid=s.schoolid
9 9
         left join t_class c on c.classid=pg.classid
10
-        where s.schoollevel=#{param.level} and s.schoolstate=1 and p.year=#{param.year}
10
+        left join t_director d on p.directorid=d.directorid
11
+        where p.deleted=0 and s.schoollevel=#{param.level} and s.schoolstate=1 and p.year=#{param.year}
12
+        and (d.disabled=0 or p.directorid is null)
11 13
         <if test="param.begintime!=null and param.begintime!=0">
12 14
             and pg.starttime between #{param.begintime} and #{param.endtime}
13 15
         </if>
@@ -17,7 +19,8 @@
17 19
         select count(DISTINCT g.guideid) from t_guide_group gg left join t_guide g on gg.guideid=g.guideid
18 20
         LEFT JOIN t_school s on g.schoolid=s.schoolid and gg.schoolid=s.schoolid
19 21
         left join t_class c on c.classid=gg.classid
20
-        where s.schoollevel=#{param.level} and s.schoolstate=1 and g.year=#{param.year}
22
+        left join t_director d on g.directorid=d.directorid
23
+        where d.disabled=0 and s.schoollevel=#{param.level} and s.schoolstate=1 and g.year=#{param.year}
21 24
         <if test="param.begintime!=null and param.begintime!=0">
22 25
             and g.createtime between #{param.begintime} and #{param.endtime}
23 26
         </if>
@@ -34,7 +37,7 @@
34 37
     </select>
35 38
     <!--作业数量统计——错题视频数量-->
36 39
     <select id="getRegionPaperNumQueexp" resultType="java.lang.Integer">
37
-        select count(distinct qe.qcpid) from t_question_explain qe left join t_question_class qc on qe.questionid=qe.questionid
40
+        select count(distinct qe.qcpid) from t_question_explain qe left join t_question_class qc on qe.questionid=qc.questionid
38 41
         left JOIN t_school s on qc.schoolid=s.schoolid
39 42
         left join t_class c on c.classid=qc.classid
40 43
         where s.schoollevel=#{param.level} and s.schoolstate=1 and qe.year=#{param.year}
@@ -45,32 +48,34 @@
45 48
 
46 49
     <!--作业各类率统计-->
47 50
     <resultMap id="rpaperMap" type="com.xhkjedu.sapi.vo.region.RSchoolVo">
48
-        <result column="schoolid" property="schoolid"></result>
49
-        <result column="schoolname" property="schoolname"></result>
50
-        <result column="shortname" property="shortname"></result>
51
+        <result column="schoolid" property="schoolid"/>
52
+        <result column="schoolname" property="schoolname"/>
53
+        <result column="shortname" property="shortname"/>
51 54
         <collection property="paperlist" ofType="com.xhkjedu.sapi.vo.region.RPaperVo">
52
-            <result column="paperid" property="paperid"></result>
53
-            <result column="resourceid" property="resourceid"></result>
54
-            <result column="stunum" property="stunum"></result>
55
-            <result column="commitnum" property="commitnum"></result>
56
-            <result column="commitasnum" property="commitasnum"></result>
57
-            <result column="checknum" property="checknum"></result>
58
-            <result column="paperscore" property="paperscore"></result>
59
-            <result column="stuscore" property="stuscore"></result>
55
+            <result column="paperid" property="paperid"/>
56
+            <result column="resourceid" property="resourceid"/>
57
+            <result column="stunum" property="stunum"/>
58
+            <result column="commitnum" property="commitnum"/>
59
+            <result column="commitasnum" property="commitasnum"/>
60
+            <result column="checknum" property="checknum"/>
61
+            <result column="paperscore" property="paperscore"/>
62
+            <result column="stuscore" property="stuscore"/>
60 63
         </collection>
61 64
     </resultMap>
62 65
     <!--作业各类率统计——作业-->
63 66
     <select id="listRegionSchoolRatePaper" resultMap="rpaperMap">
64 67
         select s.schoolid,s.schoolname,s.shortname,pg.paperid,
65
-        count(ps.psid)stunum,sum(ps.userscore)stuscore,sum(ps.paperscore)paperscore,
66
-        count(case when ps.psstate!=0 then ps.psid else null end) commitnum,
67
-        count(case when ps.psstate=1 then ps.psid else null end) commitasnum,
68
-        count(case when ps.psstate!=0 and ps.pschecked=1 then ps.psid else null end) checknum
68
+        count(ps.psid)stunum,sum(ps.userscore) as stuscore,sum(ps.paperscore) as paperscore,
69
+        count(distinct if(ps.psstate in(1,2),ps.psid,null)) commitnum,
70
+        count(distinct if(ps.psstate=1,ps.psid,null)) commitasnum,
71
+        count(distinct if(ps.psstate in(1,2) and ps.pschecked=1,ps.psid,null)) checknum
69 72
         from t_paper p left join t_paper_class pg on p.paperid=pg.paperid
70 73
         left join t_paper_student ps on ps.paperid=p.paperid and ps.classid=pg.classid
71 74
         left join t_school s on p.schoolid=s.schoolid and pg.schoolid=s.schoolid
72 75
         left join t_class c on c.classid=pg.classid
73
-        where s.schoollevel=#{param.level} and s.schoolstate=1 and p.year=#{param.year}
76
+        left join t_director d on p.directorid=d.directorid
77
+        where p.deleted=0 and s.schoollevel=#{param.level} and s.schoolstate=1 and p.year=#{param.year}
78
+        and (d.disabled=0 or p.directorid is null)
74 79
         <if test="param.begintime!=null and param.begintime!=0">
75 80
             and pg.starttime between #{param.begintime} and #{param.endtime}
76 81
         </if>
@@ -80,8 +85,8 @@
80 85
     <select id="listRegionSchoolRateRecite" resultMap="rpaperMap">
81 86
         select s.schoolid,s.schoolname,s.shortname,r.reciteid as paperid,
82 87
         count(rs.rsid)stunum,sum(rs.userscore)stuscore,
83
-        count(case when rs.rsstate!=0 then rs.rsid else null end)commitnum,
84
-        count(case when rs.rsstate=1 then rs.rsid else null end)commitasnum
88
+        count(distinct if(rs.rsstate!=0,rs.rsid,null))commitnum,
89
+        count(distinct if(rs.rsstate=1,rs.rsid,null))commitasnum
85 90
         from t_recite r left join t_recite_group rg on r.reciteid=rg.reciteid
86 91
         left join t_recite_student rs on rs.reciteid=r.reciteid and rs.classid=rg.classid
87 92
         left join t_school s on r.schoolid=s.schoolid and rg.schoolid=s.schoolid
@@ -96,13 +101,14 @@
96 101
     <select id="listRegionSchoolRatePreview" resultMap="rpaperMap">
97 102
         select s.schoolid,s.schoolname,s.shortname, g.guideid,
98 103
         count(ggs.rgsid)stunum,
99
-        count(case when ggs.readtime>0 then ggs.rgsid else null end)commitnum
104
+        count(distinct if(ggs.readtime>0,ggs.rgsid,null))commitnum
100 105
         from t_guide g
101 106
         left join t_guide_group gg on gg.guideid=g.guideid
102 107
         left join t_guide_group_student ggs on ggs.guideid=g.guideid and ggs.classid=gg.classid
103 108
         left join t_school s on s.schoolid=g.schoolid and s.schoolid=gg.schoolid
104 109
         left join t_class c on c.classid=gg.classid
105
-        where s.schoollevel=#{param.level} and s.schoolstate=1 and g.year=#{param.year}
110
+        left join t_director d on g.directorid=d.directorid
111
+        where d.disabled=0 and s.schoollevel=#{param.level} and s.schoolstate=1 and g.year=#{param.year}
106 112
         <if test="param.begintime!=null and param.begintime!=0">
107 113
             and g.createtime between #{param.begintime} and #{param.endtime}
108 114
         </if>
@@ -113,12 +119,14 @@
113 119
     <select id="listRegionSchoolUsetimePaper" resultType="java.util.Map">
114 120
         select s.schoolid,s.schoolname,s.shortname,
115 121
         count(ps.psid) as stunum,
116
-        ifnull(SUM(ps.costtime),0) costtime
122
+        ifnull(SUM(ps.costtime),0) as costtime
117 123
         from t_paper p left join t_paper_class pg on p.paperid=pg.paperid
118 124
         left join t_school s on p.schoolid=s.schoolid and pg.schoolid=s.schoolid
119
-        left join t_paper_student ps on pg.paperid=ps.paperid and pg.classid=ps.classid and ps.psstate!=0
125
+        left join t_paper_student ps on pg.paperid=ps.paperid and pg.classid=ps.classid and ps.psstate in(1,2)
120 126
         left join t_class c on c.classid=pg.classid
121
-        where s.schoollevel=#{param.level} and s.schoolstate=1 and p.year=#{param.year}
127
+        left join t_director d on p.directorid=d.directorid
128
+        where p.deleted=0 and s.schoollevel=#{param.level} and s.schoolstate=1 and p.year=#{param.year}
129
+        and (d.disabled=0 or p.directorid is null)
122 130
         <if test="param.begintime!=null and param.begintime!=0">
123 131
             and pg.starttime between #{param.begintime} and #{param.endtime}
124 132
         </if>
@@ -128,12 +136,13 @@
128 136
     <select id="listRegionSchoolUsetimePreview" resultType="java.util.Map">
129 137
         select s.schoolid,s.schoolname,s.shortname,
130 138
         count(distinct gs.rgsid) as stunum,
131
-        sum(gs.costtime) costtime
139
+        sum(gs.costtime) as costtime
132 140
         from t_guide_group_student gs
133 141
         left join t_guide g on gs.guideid=g.guideid
134 142
         left join t_school s on g.schoolid=s.schoolid and gs.schoolid=s.schoolid
135 143
         left join t_class c on c.classid=gs.classid
136
-        where s.schoollevel=#{param.level} and s.schoolstate=1 and gs.readtime>0 and g.year=#{param.year}
144
+        left join t_director d on g.directorid=d.directorid
145
+        where d.disabled=0 and s.schoollevel=#{param.level} and s.schoolstate=1 and gs.readtime>0 and g.year=#{param.year}
137 146
         <if test="param.begintime!=null and param.begintime!=0">
138 147
             and g.createtime between #{param.begintime} and #{param.endtime}
139 148
         </if>

+ 42
- 21
sapi/src/main/resources/mapper/region/RResourceAnalyzeMapper.xml View File

@@ -4,53 +4,74 @@
4 4
 
5 5
     <!--资源统计——资源数量-->
6 6
     <select id="getRResourceNum" resultType="java.util.Map">
7
-        select count(r.resourceid) resourcenum,sum(r.resourcesize)resourcesize,sum(r.downcount) downcount
8
-         from t_resource r where r.resourcestate=1 and r.belong!=4 and (r.level=1 or r.level=4)
7
+        select count(r.resourceid) resourcenum,sum(r.resourcesize) as resourcesize,sum(r.downcount) as downcount
8
+        from (select distinct r.resourceid
9
+        from t_resource r left join t_resource_director rd on r.resourceid=rd.resourceid
10
+        left join t_director d on rd.directorid=d.directorid
11
+        where d.disabled=0 and r.resourcestate=1 and r.belong!=4 and (r.level=1 or r.level=4))r2
12
+        left join t_resource r on r2.resourceid=r.resourceid
9 13
     </select>
10 14
     <select id="getRResourceCollectNum" resultType="java.lang.Integer">
11
-        select count(*) from t_resource_collect rc
12
-        left join t_resource r on rc.resourceid=r.resourceid where r.resourcestate=1 and r.belong!=4 and (r.level=1 or r.level=4)
15
+        select count(distinct rc.rcid) from t_resource_collect rc
16
+        left join t_resource r on rc.resourceid=r.resourceid
17
+        left join t_resource_director rd on r.resourceid=rd.resourceid
18
+        left join t_director d on rd.directorid=d.directorid
19
+        where d.disabled=0 and r.resourcestate=1 and r.belong!=4 and (r.level=1 or r.level=4)
13 20
     </select>
14 21
     <!--资源统计——试题数量-->
15 22
     <select id="getRQuestionNum" resultType="java.lang.Integer">
16
-        select count(*) from t_question where qstate=1 and belong!=4
23
+        select count(distinct q.questionid)
24
+        from t_question q left join t_question_director qd on q.questionid=qd.questionid
25
+        left join t_director d on qd.directorid=d.directorid
26
+        where d.disabled=0 and q.qstate=1 and q.belong!=4 and q.qlevel!=3
17 27
     </select>
18 28
 
19 29
     <!--学段资源占比-->
20 30
     <select id="listRResourceLevelTypeNum" resultType="com.xhkjedu.sapi.vo.region.ResourceTypeVo">
21
-         select s.level,r.resourcetype rtype,count(r.resourceid)rnum
22
-          from t_resource r left join t_subject s on r.subjectid=s.subjectid
23
-          where r.resourcestate=1 and r.belong!=4 and (r.level=1 or r.level=4)
24
-          group by s.level,r.resourcetype order by s.level,r.resourcetype
31
+        select s.level,r.resourcetype rtype,count(distinct r.resourceid)rnum
32
+        from t_resource r left join t_subject s on r.subjectid=s.subjectid
33
+        left join t_resource_director rd on r.resourceid=rd.resourceid
34
+        left join t_director d on rd.directorid=d.directorid
35
+        where d.disabled=0 and r.resourcestate=1 and r.belong!=4 and (r.level=1 or r.level=4)
36
+        group by s.level,r.resourcetype order by s.level,r.resourcetype
25 37
     </select>
26 38
     <!--资源格式统计-->
27 39
     <select id="listRResourceClassNum" resultType="com.xhkjedu.sapi.vo.region.ResourceTypeVo">
28
-         select r.resourceclass rtype,count(r.resourceid)rnum from t_resource r
29
-          where r.resourcestate=1 and r.belong!=4 and (r.level=1 or r.level=4)
30
-          group by r.resourceclass order by r.resourceclass
40
+        select r.resourceclass rtype,count(distinct r.resourceid)rnum
41
+        from t_resource r left join t_resource_director rd on r.resourceid=rd.resourceid
42
+        left join t_director d on rd.directorid=d.directorid
43
+        where d.disabled=0 and r.resourcestate=1 and r.belong!=4 and (r.level=1 or r.level=4)
44
+        group by r.resourceclass order by r.resourceclass
31 45
     </select>
32 46
     <!--试题学段占比-->
33 47
     <select id="listRQuestionLevelNum" resultType="com.xhkjedu.sapi.vo.region.RLevelVo">
34
-        select s.level,count(q.questionid) levelnum
48
+        select s.level,count(distinct q.questionid) levelnum
35 49
         from t_question q left join t_subject s on q.subjectid=s.subjectid
36
-        where q.qstate=1 and q.belong!=4 group by s.level order by s.level
50
+        left join t_question_director qd on q.questionid=qd.questionid
51
+        left join t_director d on qd.directorid=d.directorid
52
+        where d.disabled=0 and q.qstate=1 and q.belong!=4 and q.qlevel!=3
53
+        group by s.level order by s.level
37 54
     </select>
38 55
     <!--试题使用统计-->
39 56
     <select id="listRQuestionUse" resultType="com.xhkjedu.sapi.vo.region.RSchoolVo">
40
-        select count(distinct pqq.questionid) snum,pqq.schoolid,s.schoolname,s.shortname
57
+        select count(distinct pqq.questionpid) as snum,pqq.schoolid,s.schoolname,s.shortname
41 58
         from t_paper_qtype_question pqq left join t_paper p on pqq.paperid=p.paperid
42 59
         left join t_school s on pqq.schoolid=s.schoolid
43 60
         left join t_question q on pqq.questionid=q.questionid
44
-        where p.paperstate=22 and q.qstate=1 and q.belong!=4 and s.schoolstate=1
61
+        left join t_director d on p.directorid=d.directorid
62
+        where (d.disabled=0 or p.directorid is null) and p.paperstate=22 and q.qstate=1 and q.belong!=4 and s.schoolstate=1
45 63
          group by pqq.schoolid order by s.schoolid
46 64
     </select>
47 65
     <!--校本资源统计-->
48 66
     <select id="listRResourceXbType" resultType="com.xhkjedu.sapi.vo.region.RSResourceVo">
49
-         select ifnull(r.resourcetype,0) rtype,count(r.resourceid)rnum,s.schoolid,s.schoolname,s.shortname,s.schoollevel level
50
-          from t_resource r right join t_school s on r.schoolid=s.schoolid
51
-          and r.resourcestate=1 and r.belong=3 and (r.level=1 or r.level=4)
52
-          where s.schoolstate=1
53
-          group by r.schoolid,r.resourcetype order by r.schoolid,r.resourcetype
67
+        select ifnull(r.resourcetype,0) rtype,count(distinct r.resourceid)rnum
68
+        ,s.schoolid,s.schoolname,s.shortname,s.schoollevel as level
69
+        from t_resource r right join t_school s on r.schoolid=s.schoolid
70
+        and r.resourcestate=1 and r.belong=3 and (r.level=1 or r.level=4)
71
+        left join t_resource_director rd on r.resourceid=rd.resourceid
72
+        left join t_director d on rd.directorid=d.directorid
73
+        where d.disabled=0 and s.schoolstate=1
74
+        group by r.schoolid,r.resourcetype order by r.schoolid,r.resourcetype
54 75
     </select>
55 76
 
56 77
 </mapper>

+ 11
- 10
sapi/src/main/resources/mapper/region/RRoomAnalyzeMapper.xml View File

@@ -4,17 +4,17 @@
4 4
     <!--活跃度统计-->
5 5
     <select id="listRoom" resultType="com.xhkjedu.sapi.vo.region.RRoomVo">
6 6
         select r.schoolid,s.schoolname,s.shortname,count(distinct r.roomid)ktnum
7
-        ,count(distinct case when rt.asktype=20 then rt.asktid else null end)qdnum
8
-        ,count(distinct case when rt.asktype=21 then rt.asktid else null end)dmnum
9
-        ,count(distinct case when rt.asktype between 30 and 33 then rt.asktid else null end)twnum
10
-        ,count(distinct case when rt.asktype=40 then rt.asktid else null end)tcnum
7
+        ,count(distinct if(rt.asktype=20,rt.asktid,null))qdnum
8
+        ,count(distinct if(rt.asktype=21,rt.asktid,null))dmnum
9
+        ,count(distinct if(rt.asktype between 30 and 33,rt.asktid,null))twnum
10
+        ,count(distinct if(rt.asktype=40,rt.asktid,null))tcnum
11 11
         ,count(distinct rf.rfid)jtnum
12
-        ,count(distinct case when rt.asktype=20 and rs.asksid is not null then rs.asksid else null end)qdstunum
13
-        ,count(distinct case when rt.asktype between 30 and 33 and rs.asksid is not null then rs.asksid else null end)twstunum
14
-        ,count(distinct case when rt.asktype between 30 and 33 and rs.radiocorrect=1 then rs.asksid else null end)twzqnum
12
+        ,count(distinct if(rt.asktype=20 and rs.asksid is not null,rs.asksid,null))qdstunum
13
+        ,count(distinct if(rt.asktype between 30 and 33 and rs.asksid is not null,rs.asksid,null))twstunum
14
+        ,count(distinct if(rt.asktype between 30 and 33 and rs.radiocorrect=1,rs.asksid,null))twzqnum
15 15
         ,count(distinct pss.pssid)tcstunum
16
-        ,count(distinct case when pss.answered=1 then pss.pssid else null end)tctjnum
17
-        ,count(distinct case when pss.qscore!=0 and pss.qscore=pss.stuscore then pss.pssid else null end)tczqnum
16
+        ,count(distinct if(pss.answered=1,pss.pssid,null))tctjnum
17
+        ,count(distinct if(pss.qscore!=0 and pss.qscore=pss.stuscore,pss.pssid,null))tczqnum
18 18
         ,(r.endtime-r.createtime)totaltime,r.classnum,r.realstunum
19 19
         from t_school s right join t_classroom r on r.schoolid=s.schoolid
20 20
         left join t_class c on c.classid=r.classid
@@ -24,7 +24,8 @@
24 24
         left join t_classroom_paper p on p.paperid=rt.paperid
25 25
         left join t_classroom_paper_student ps on p.paperid=ps.paperid
26 26
         left join t_classroom_paper_student_scantron pss on ps.psid=pss.psid
27
-        where s.schoollevel=#{param.level} and s.schoolstate=1 and r.roomstate=2
27
+        left join t_director d on r.directorid=d.directorid
28
+        where d.disabled=0 and s.schoollevel=#{param.level} and s.schoolstate=1 and r.roomstate=2
28 29
         and r.year=#{param.year} and r.endtime is not null
29 30
         <if test="param.begintime!=null and param.begintime!=0">
30 31
             and r.createtime between #{param.begintime} and #{param.endtime}

+ 53
- 37
sapi/src/main/resources/mapper/region/RegionAnalyzeMapper.xml View File

@@ -9,25 +9,35 @@
9 9
 
10 10
     <!--获取资源、试题总量-->
11 11
     <select id="getResourceQuestionNum" resultType="java.util.Map">
12
-        select (select count(*) from t_resource where resourcestate=1 and (level=1 or level=4) and belong!=4)resourcenum
13
-        ,(select count(*) from t_question where qstate=1 and belong!=4)questionnum
12
+        select (select count(distinct r.resourceid)
13
+        from t_resource r left join t_resource_director rd on r.resourceid=rd.resourceid
14
+        left join t_director d on rd.directorid=d.directorid
15
+        where d.disabled=0 and r.resourcestate=1 and (r.level=1 or r.level=4) and r.belong!=4)resourcenum
16
+        ,(select count(distinct q.questionid)
17
+        from t_question q left join t_question_director qd on q.questionid=qd.questionid
18
+        left join t_director d on qd.directorid=d.directorid
19
+        where d.disabled=0 and q.qstate=1 and q.belong!=4 and q.qlevel!=3)questionnum
14 20
     </select>
15 21
     <!--获取资源类型统计-->
16 22
     <select id="listResourceTypeNum" resultType="com.xhkjedu.sapi.vo.region.ResourceTypeVo">
17
-        select s.level,r.resourcetype rtype,count(r.resourceid)rnum
18
-        ,sum(case when r.belong in(1,2) then 1 else 0 end)ptnum
19
-        ,sum(case when r.belong=3 then 1 else 0 end)xbnum
23
+        select s.level,r.resourcetype rtype,count(distinct r.resourceid)rnum
24
+        ,count(distinct if(r.belong in (1,2),r.resourceid,null))ptnum
25
+        ,count(distinct if(r.belong=3,r.resourceid,null))xbnum
20 26
         from t_resource r left join t_subject s on r.subjectid=s.subjectid
21
-        where r.resourcestate=1 and (r.level=1 or r.level=4) and r.belong!=4
27
+        left join t_resource_director rd on r.resourceid=rd.resourceid
28
+        left join t_director d on rd.directorid=d.directorid
29
+        where d.disabled=0 and r.resourcestate=1 and (r.level=1 or r.level=4) and r.belong!=4
22 30
         group by s.level,r.resourcetype order by s.level
23 31
     </select>
24 32
     <!--获取试题科目统计-->
25 33
     <select id="listQuestionSubjectNum" resultType="com.xhkjedu.sapi.vo.region.RSubjectVo">
26
-        select s.level,s.subjectname,s.subjectid,count(q.questionid)snum
27
-        ,sum(case when q.belong in(1,2) then 1 else 0 end)ptnum
28
-        ,sum(case when q.belong=3 then 1 else 0 end)xbnum
34
+        select s.level,s.subjectname,s.subjectid,count(distinct q.questionid) as snum
35
+        ,count(distinct if(q.belong in(1,2),q.questionid,null))ptnum
36
+        ,count(distinct if(q.belong=3,q.questionid,null))xbnum
29 37
         from t_question q left join t_subject s on q.subjectid=s.subjectid
30
-        where q.qstate=1 and q.belong!=4
38
+        left join t_question_director qd on q.questionid=qd.questionid
39
+        left join t_director d on qd.directorid=d.directorid
40
+        where d.disabled=0 and q.qstate=1 and q.belong!=4 and q.qlevel!=3
31 41
         group by q.subjectid order by s.level
32 42
     </select>
33 43
     <!--获取学校列表-->
@@ -64,30 +74,31 @@
64 74
 
65 75
     <!--教学统计-->
66 76
     <resultMap id="workMap" type="com.xhkjedu.sapi.vo.region.WorkVo">
67
-        <result property="schoolid" column="schoolid"></result>
68
-        <result property="schoolname" column="schoolname"></result>
69
-        <result property="shortname" column="shortname"></result>
77
+        <result property="schoolid" column="schoolid"/>
78
+        <result property="schoolname" column="schoolname"/>
79
+        <result property="shortname" column="shortname"/>
70 80
         <collection property="details" ofType="com.xhkjedu.sapi.vo.region.WorkDetailVo">
71
-            <result property="wid" column="wid"></result>
72
-            <result property="rid" column="rid"></result>
73
-            <result property="stunum" column="stunum"></result>
74
-            <result property="commitnum" column="commitnum"></result>
75
-            <result property="checknum" column="checknum"></result>
81
+            <result property="wid" column="wid"/>
82
+            <result property="rid" column="rid"/>
83
+            <result property="stunum" column="stunum"/>
84
+            <result property="commitnum" column="commitnum"/>
85
+            <result property="checknum" column="checknum"/>
76 86
         </collection>
77 87
     </resultMap>
78 88
     <!--作业提交批阅-->
79 89
     <select id="listPaperCommitMonth" resultMap="workMap">
80 90
         select s.schoolid,s.schoolname,s.shortname, pg.paperid as wid,
81 91
         count(distinct ps.psid)stunum,
82
-        count(distinct case when ps.psstate!=0 then ps.psid else null end)commitnum,
83
-        count(distinct case when ps.psstate!=0 and ps.pschecked=1 then ps.psid else null end)checknum
92
+        count(distinct if(ps.psstate in(1,2),ps.psid,null))commitnum,
93
+        count(distinct if(ps.psstate in(1,2) and ps.pschecked=1,ps.psid,null))checknum
84 94
         from t_paper p
85 95
         right join t_school s on p.schoolid=s.schoolid and p.paperstate=22
86 96
         left join t_paper_class pg on p.paperid = pg.paperid and pg.schoolid=s.schoolid
87 97
         and pg.starttime between #{param.begintime} and #{param.endtime}
88 98
         left join t_paper_student ps on ps.paperid=pg.paperid and ps.classid=pg.classid
89 99
         left join t_class c on c.classid=pg.classid
90
-        where s.schoolstate=1
100
+        left join t_director d on p.directorid=d.directorid
101
+        where p.deleted=0 and s.schoolstate=1 and (d.disabled=0 or p.directorid is null)
91 102
         <if test="param.year!=null and param.year!=0">
92 103
             and c.year=#{param.year}
93 104
         </if>
@@ -100,12 +111,13 @@
100 111
     <select id="listGuideCommitMonth" resultMap="workMap">
101 112
         select s.schoolid,s.schoolname,s.shortname,g.guideid as rid,
102 113
         count(distinct gs.rgsid) stunum,
103
-        count(distinct case when gs.readtime>0 then gs.rgsid else null end) commitnum
114
+        count(distinct if(gs.readtime>0,gs.rgsid,null)) commitnum
104 115
         from t_guide g right join t_school s on g.schoolid=s.schoolid
105 116
         and g.createtime between #{param.begintime} and #{param.endtime}
106 117
         left join t_guide_group_student gs on gs.guideid=g.guideid and gs.schoolid=s.schoolid
107 118
         left join t_class c on c.classid=gs.classid
108
-        where s.schoolstate=1
119
+        left join t_director d on g.directorid=d.directorid
120
+        where d.disabled=0 and s.schoolstate=1
109 121
         <if test="param.year!=null and param.year!=0">
110 122
             and c.year=#{param.year}
111 123
         </if>
@@ -119,7 +131,7 @@
119 131
     <select id="listReciteCommitMonth" resultMap="workMap">
120 132
         select s.schoolid,s.schoolname,s.shortname,rg.reciteid as wid,
121 133
         count(distinct rs.rsid) stunum,
122
-        count(distinct case when rs.rsstate!=0 then rs.rsid else null end) commitnum
134
+        count(distinct if(rs.rsstate!=0,rs.rsid,null)) commitnum
123 135
         from t_recite r right join t_school s on r.schoolid=s.schoolid
124 136
         left join t_recite_group rg on r.reciteid=rg.reciteid and rg.schoolid=s.schoolid
125 137
         and rg.starttime between #{param.begintime} and #{param.endtime}
@@ -140,7 +152,8 @@
140 152
         from t_classroom c left join t_class c2 on c.classid=c2.classid
141 153
         right join t_school s on c.schoolid=s.schoolid and c.roomstate=2
142 154
         and c.createtime between #{param.begintime} and #{param.endtime}
143
-        where s.schoolstate=1
155
+        left join t_director d on c.directorid=d.directorid
156
+        where d.disabled=0 and s.schoolstate=1
144 157
         <if test="param.year!=null and param.year!=0">
145 158
             and c2.year=#{param.year}
146 159
         </if>
@@ -158,7 +171,8 @@
158 171
         left join t_paper_class pg on p.paperid=pg.paperid and s.schoolid=pg.schoolid
159 172
         and pg.starttime between #{param.begintime} and #{param.endtime}
160 173
         left join t_class c on c.classid=pg.classid
161
-        where s.schoolstate=1
174
+        left join t_director d on p.directorid=d.directorid
175
+        where p.deleted=0 and s.schoolstate=1 and (d.disabled=0 or p.directorid is null)
162 176
         <if test="param.year!=null and param.year!=0">
163 177
             and c.year=#{param.year}
164 178
         </if>
@@ -175,7 +189,8 @@
175 189
         right join t_school s on c.schoolid=s.schoolid
176 190
         and c.createtime between #{param.begintime} and #{param.endtime}
177 191
         left join t_class c2 on c.classid=c2.classid
178
-        where s.schoolstate=1
192
+        left join t_director d on c.directorid=d.directorid
193
+        where d.disabled=0 and s.schoolstate=1
179 194
         <if test="param.year!=null and param.year!=0">
180 195
             and c2.year=#{param.year}
181 196
         </if>
@@ -185,27 +200,28 @@
185 200
         group by s.schoolid order by s.schoolid
186 201
     </select>
187 202
     <resultMap id="roomAsk" type="com.xhkjedu.sapi.vo.region.WorkVo">
188
-        <result property="schoolid" column="schoolid"></result>
189
-        <result property="schoolname" column="schoolname"></result>
190
-        <result property="shortname" column="shortname"></result>
203
+        <result property="schoolid" column="schoolid"/>
204
+        <result property="schoolname" column="schoolname"/>
205
+        <result property="shortname" column="shortname"/>
191 206
         <collection property="asks" ofType="com.xhkjedu.sapi.vo.region.WorkTypeVo">
192
-            <result property="asktype" column="asktype"></result>
193
-            <result property="asknum" column="asknum"></result>
207
+            <result property="asktype" column="asktype"/>
208
+            <result property="asknum" column="asknum"/>
194 209
         </collection>
195 210
     </resultMap>
196 211
 
197 212
     <!--课堂使用情况统计——课堂互动-->
198 213
     <select id="listRoomAskNumMonth2" resultType="java.util.Map">
199 214
         select s.schoolname,s.shortname,count(distinct c.roomid)num
200
-        ,sum(case when ca.asktype between 30 and 33 then 1 else 0 end)twnum
201
-        ,sum(case when ca.asktype =40 then 1 else 0 end)tcnum
202
-        ,sum(case when ca.asktype =21 then 1 else 0 end)dmnum
203
-        ,sum(case when ca.asktype =20 then 1 else 0 end)qdnum
215
+        ,count(distinct if(ca.asktype between 30 and 33,ca.asktid,null))twnum
216
+        ,count(distinct if(ca.asktype=40,ca.asktid,null))tcnum
217
+        ,count(distinct if(ca.asktype=21,ca.asktid,null))dmnum
218
+        ,count(distinct if(ca.asktype=20,ca.asktid,null))qdnum
204 219
         from t_classroom c right join t_school s on c.schoolid=s.schoolid
205 220
         and c.createtime between #{param.begintime} and #{param.endtime}
206 221
         left join t_classroom_askteacher ca on ca.roomid=c.roomid
207 222
         left join t_class c2 on c.classid=c2.classid
208
-        where s.schoolstate=1
223
+        left join t_director d on c.directorid=d.directorid
224
+        where d.disabled=0 and s.schoolstate=1
209 225
         <if test="param.year!=null and param.year!=0">
210 226
             and c2.year=#{param.year}
211 227
         </if>

+ 38
- 18
sapi/src/main/resources/mapper/region/RegionResourceMapper.xml View File

@@ -4,57 +4,77 @@
4 4
 
5 5
     <!--资源统计——资源数量-->
6 6
     <select id="getResourceNum" resultType="java.util.Map">
7
-        select count(r.resourceid) resourcenum,sum(r.resourcesize)resourcesize,sum(r.downcount) downcount
8
-         from t_resource r where r.resourcestate=1 and r.belong!=4 and (r.level=1 or r.level=4)
7
+        select count(r.resourceid) resourcenum,sum(r.resourcesize) as resourcesize,sum(r.downcount) as downcount
8
+        from (select distinct r.resourceid
9
+        from t_resource r left join t_resource_director rd on r.resourceid=rd.resourceid
10
+        left join t_director d on rd.directorid=d.directorid
11
+        where d.disabled=0 and r.resourcestate=1 and r.belong!=4 and (r.level=1 or r.level=4))r2
12
+        left join t_resource r on r2.resourceid=r.resourceid
9 13
     </select>
10 14
     <select id="getResourceCollectNum" resultType="java.lang.Integer">
11
-        select count(*) from t_resource_collect rc
12
-        left join t_resource r on rc.resourceid=r.resourceid where r.resourcestate=1 and r.belong!=4 and (r.level=1 or r.level=4)
15
+        select count(distinct rc.rcid) from t_resource_collect rc
16
+        left join t_resource r on rc.resourceid=r.resourceid
17
+        left join t_resource_director rd on r.resourceid=rd.resourceid
18
+        left join t_director d on rd.directorid=d.directorid
19
+        where d.disabled=0 and r.resourcestate=1 and r.belong!=4 and (r.level=1 or r.level=4)
13 20
     </select>
14 21
     <!--资源统计——资源学科统计-->
15 22
     <select id="listResourceSubjectTypenum" resultType="com.xhkjedu.sapi.vo.region.ResourceTypeVo">
16
-        select s.level,r.subjectid,s.subjectname,r.resourcetype rtype,count(r.resourceid)rnum
23
+        select s.level,r.subjectid,s.subjectname,r.resourcetype rtype,count(distinct r.resourceid)rnum
17 24
         from t_resource r left join t_subject s on r.subjectid=s.subjectid
18
-        where r.resourcestate=1 and r.belong!=4 and (r.level=1 or r.level=4)
25
+        left join t_resource_director rd on r.resourceid=rd.resourceid
26
+        left join t_director d on rd.directorid=d.directorid
27
+        where d.disabled=0 and r.resourcestate=1 and r.belong!=4 and (r.level=1 or r.level=4)
19 28
         group by s.level,r.subjectid,r.resourcetype order by s.level,s.subjectorder,r.resourcetype
20 29
     </select>
21 30
     <!--资源统计——校本资源统计-->
22 31
     <select id="listResourceSchool" resultType="com.xhkjedu.sapi.vo.region.ResourceTypeVo">
23
-        select s.level,r.subjectid,s.subjectname,count(r.resourceid)rnum
32
+        select s.level,r.subjectid,s.subjectname,count(distinct r.resourceid)rnum
24 33
         from t_resource r left join t_subject s on r.subjectid=s.subjectid
25
-        where r.resourcestate=1 and r.belong=3 and (r.level=1 or r.level=4)
34
+        left join t_resource_director rd on r.resourceid=rd.resourceid
35
+        left join t_director d on rd.directorid=d.directorid
36
+        where d.disabled=0 and r.resourcestate=1 and r.belong=3 and (r.level=1 or r.level=4)
26 37
         group by s.level,r.subjectid order by s.level,s.subjectorder
27 38
     </select>
28 39
 
29 40
     <!--试题统计-->
30 41
     <select id="listQuestionSubjectnum" resultType="com.xhkjedu.sapi.vo.region.ResourceTypeVo">
31
-       select s.level,s.subjectname,count(q.questionid) rnum
42
+       select s.level,s.subjectname,count(distinct q.questionid) rnum
32 43
         from t_question q left join t_subject s on q.subjectid=s.subjectid
33
-        where q.qstate=1 and q.belong!=4
44
+        left join t_question_director qd on q.questionid=qd.questionid
45
+        left join t_director d on qd.directorid=d.directorid
46
+        where d.disabled=0 and q.qstate=1 and q.belong!=4 and q.qlevel!=3
34 47
         group by s.level,q.subjectid order by s.level,s.subjectorder
35 48
     </select>
36 49
 
37 50
     <!--热门资源统计-->
38 51
     <select id="listResourceHot" resultType="java.util.Map">
39
-      select resourcename,readcount from t_resource where resourcestate=1 and belong!=4 and (level=1 or level=4)
40
-        order by readcount desc limit 40
52
+        select resourcename,readcount
53
+        from t_resource r left join t_resource_director rd on r.resourceid=rd.resourceid
54
+        left join t_director d on rd.directorid=d.directorid
55
+        where d.disabled=0 and resourcestate=1 and r.belong!=4 and (r.level=1 or r.level=4)
56
+        group by r.resourceid order by readcount desc limit 40
41 57
     </select>
42 58
 
43 59
     <!--资源统计——近一个月校本资源贡献统计-->
44 60
     <select id="listResourceForSchool" resultType="com.xhkjedu.sapi.vo.region.RSResourceVo">
45
-        select s.schoolid,s.schoolname,s.shortname,r.resourcetype rtype,count(r.resourceid)rnum
61
+        select s.schoolid,s.schoolname,s.shortname,r.resourcetype rtype,count(distinct r.resourceid)rnum
46 62
         from t_resource r left join t_school s on r.schoolid=s.schoolid
47
-        where r.resourcestate=1 and r.belong=3 and (r.level=1 or r.level=4) and s.schoolstate=1
48
-				and r.createtime between #{begintime} and #{endtime}
63
+        left join t_resource_director rd on r.resourceid=rd.resourceid
64
+        left join t_director d on rd.directorid=d.directorid
65
+        where d.disabled=0 and r.resourcestate=1 and r.belong=3 and (r.level=1 or r.level=4) and s.schoolstate=1
66
+        and r.createtime between #{begintime} and #{endtime}
49 67
         group by s.schoolid,r.resourcetype order by schoolid,r.resourcetype
50 68
     </select>
51 69
 
52 70
     <!--试题统计——近一个月题库贡献统计-->
53 71
     <select id="listQuestionForSchool" resultType="com.xhkjedu.sapi.vo.region.RSchoolVo">
54
-       select q.schoolid,s.schoolname,s.shortname,count(q.questionid) snum
72
+        select q.schoolid,s.schoolname,s.shortname,count(distinct q.questionid) as snum
55 73
         from t_question q left join t_school s on q.schoolid=s.schoolid
56
-        where q.qstate=1 and q.belong=3 and s.schoolstate=1
57
-			and q.createtime between #{begintime} and #{endtime}
74
+        left join t_question_director qd on q.questionid=qd.questionid
75
+        left join t_director d on qd.directorid=d.directorid
76
+        where d.disabled=0 and q.qstate=1 and q.belong=3 and q.qlevel!=3 and s.schoolstate=1
77
+        and q.createtime between #{begintime} and #{endtime}
58 78
         group by s.schoolid order by schoolid
59 79
     </select>
60 80
 

+ 40
- 25
sapi/src/main/resources/mapper/region/SAnalyzeMapper.xml View File

@@ -3,46 +3,55 @@
3 3
 <mapper namespace="com.xhkjedu.sapi.mapper.region.SAnalyzeMapper">
4 4
     <!--获取试题科目统计-->
5 5
     <select id="listQuestionSubjectNum" resultType="com.xhkjedu.sapi.vo.region.ResourceTypeVo">
6
-        select s.subjectname,count(q.questionid)rnum
7
-        ,sum(case when q.belong in(1,2) then 1 else 0 end)ptnum
8
-        ,sum(case when q.belong=3 then 1 else 0 end)xbnum
6
+        select s.subjectname,count(distinct q.questionid)rnum
7
+        ,count(distinct if(q.belong in(1,2),q.questionid,null))ptnum
8
+        ,count(distinct if(q.belong=3,q.questionid,null))xbnum
9 9
         from t_question q left join t_subject s on q.subjectid=s.subjectid
10 10
         left join t_school ts on s.level=ts.schoollevel
11
-        where q.qstate=1 and (q.belong in(1,2) or (q.belong=3 and q.schoolid=#{schoolid})) and ts.schoolid=#{schoolid}
11
+        left join t_question_director qd on q.questionid=qd.questionid
12
+        left join t_director d on qd.directorid=d.directorid
13
+        where d.disabled=0 and q.qstate=1 and q.qlevel!=3
14
+        and (q.belong in(1,2) or (q.belong=3 and q.schoolid=#{schoolid})) and ts.schoolid=#{schoolid}
12 15
         group by q.subjectid order by s.subjectorder
13 16
     </select>
14 17
     <!--获取资源类型统计-->
15 18
     <select id="listResourceTypeNum" resultType="com.xhkjedu.sapi.vo.region.ResourceTypeVo">
16
-        select r.resourcetype rtype,count(r.resourceid)rnum
17
-        ,sum(case when r.belong in(1,2) then 1 else 0 end)ptnum
18
-        ,sum(case when r.belong=3 then 1 else 0 end)xbnum
19
+        select r.resourcetype rtype,count(distinct r.resourceid)rnum
20
+        ,count(distinct if(r.belong in(1,2),r.resourceid,null))ptnum
21
+        ,count(distinct if(r.belong=3,r.resourceid,null))xbnum
19 22
         from t_resource r left join t_subject s on r.subjectid=s.subjectid
20 23
         left join t_school ts on s.level=ts.schoollevel
21
-        where r.resourcestate=1 and (r.level=1 or r.level=4) and (r.belong in(1,2) or (r.belong=3 and r.schoolid=#{schoolid}))
24
+        left join t_resource_director rd on r.resourceid=rd.resourceid
25
+        left join t_director d on rd.directorid=d.directorid
26
+        where d.disabled=0 and r.resourcestate=1 and (r.level=1 or r.level=4) and (r.belong in(1,2) or (r.belong=3 and r.schoolid=#{schoolid}))
22 27
         and ts.schoolid=#{schoolid}
23 28
         group by r.resourcetype
24 29
     </select>
25 30
     <!--获取资源格式统计-->
26 31
     <select id="listResourceClassNum" resultType="com.xhkjedu.sapi.vo.region.ResourceTypeVo">
27
-        select r.resourceclass rtype,count(r.resourceid)rnum
32
+        select r.resourceclass rtype,count(distinct r.resourceid)rnum
28 33
         from t_resource r left join t_subject s on r.subjectid=s.subjectid
29 34
         left join t_school ts on s.level=ts.schoollevel
30
-        where r.resourcestate=1 and (r.level=1 or r.level=4) and (r.belong in(1,2) or (r.belong=3 and r.schoolid=#{schoolid}))
35
+        left join t_resource_director rd on r.resourceid=rd.resourceid
36
+        left join t_director d on rd.directorid=d.directorid
37
+        where d.disabled=0 and r.resourcestate=1 and (r.level=1 or r.level=4) and (r.belong in(1,2) or (r.belong=3 and r.schoolid=#{schoolid}))
31 38
         and ts.schoolid=#{schoolid}
32 39
         group by r.resourceclass
33 40
     </select>
34 41
     <!--获取资源科目统计-->
35 42
     <select id="listResourceSubjectNum" resultType="com.xhkjedu.sapi.vo.region.ResourceTypeVo">
36
-        select s.subjectname,count(r.resourceid)rnum
43
+        select s.subjectname,count(distinct r.resourceid)rnum
37 44
         from t_resource r left join t_subject s on r.subjectid=s.subjectid
38 45
         left join t_school ts on s.level=ts.schoollevel
39
-        where r.resourcestate=1 and (r.level=1 or r.level=4) and (r.belong in(1,2) or (r.belong=3 and r.schoolid=#{schoolid}))
46
+        left join t_resource_director rd on r.resourceid=rd.resourceid
47
+        left join t_director d on rd.directorid=d.directorid
48
+        where d.disabled=0 and r.resourcestate=1 and (r.level=1 or r.level=4) and (r.belong in(1,2) or (r.belong=3 and r.schoolid=#{schoolid}))
40 49
         and ts.schoolid=#{schoolid}
41 50
         group by r.subjectid order by s.subjectorder
42 51
     </select>
43 52
     <!--获取班级、教师、学生总量-->
44 53
     <select id="listClassTeacherStudent" resultType="java.util.Map">
45
-        select c.classid,c.classname,c.gradeid,c.classorder,tu.userid teacherid,cs.studentid,ifnull(u.usersex,0)usersex
54
+        select c.classid,c.classname,c.gradeid,c.classorder,tu.userid as teacherid,cs.studentid,ifnull(u.usersex,0) as usersex
46 55
         from t_class c left join t_class_teacher ct on c.classid=ct.classid
47 56
         left join t_user tu on ct.teacherid=tu.userid and tu.usertype=1 and tu.userstate=1 and tu.schoolid=c.schoolid
48 57
         left join t_class_student cs on c.classid=cs.classid
@@ -51,7 +60,7 @@
51 60
     </select>
52 61
     <!--访问量统计-->
53 62
     <select id="listAccess" resultType="com.xhkjedu.sapi.vo.region.AccessVo">
54
-        select ifnull(l.ultype,0)ultype,from_unixtime(l.logtime,'%m-%d')logtime,count(*)num
63
+        select ifnull(l.ultype,0) as ultype,from_unixtime(l.logtime,'%m-%d') as logtime,count(*)num
55 64
         from t_user_log l
56 65
         where l.schoolid=#{schoolid} and l.logtime between #{begintime} and #{endtime}
57 66
         group by from_unixtime(l.logtime,'%m-%d'),l.ultype
@@ -67,32 +76,37 @@
67 76
     <!--作业提交率-->
68 77
     <select id="listPaperCommitMonth" resultType="com.xhkjedu.sapi.vo.region.SWorkVo">
69 78
         select c.gradeid,s.subjectname,count(distinct pg.paperid)num,s.subjectorder
70
-        ,truncate(count(distinct case when ps.psstate!=0 then ps.psid else null end)*100/count(distinct ps.psid),2)numrate
79
+        ,truncate(count(distinct if(ps.psstate in(1,2),ps.psid,null))*100/count(distinct ps.psid),2)numrate
71 80
         from t_paper_class pg right join t_paper p on pg.paperid=p.paperid
72 81
         left join t_subject s on p.subjectid=s.subjectid
73 82
         left join t_class c on pg.classid=c.classid
74 83
         left join t_paper_student ps on ps.paperid=pg.paperid and ps.classid=pg.classid
75
-        where c.year=#{param.year} and p.schoolid=#{param.schoolid} and pg.pgstate=22 and pg.schoolid=#{param.schoolid}
84
+        left join t_director d on p.directorid=d.directorid
85
+        where p.deleted=0 and c.year=#{param.year} and p.schoolid=#{param.schoolid} and pg.pgstate=22 and pg.schoolid=#{param.schoolid}
86
+        and (d.disabled=0 or p.directorid is null)
76 87
         and pg.starttime between #{param.begintime} and #{param.endtime}
77 88
         group by c.gradeid,p.subjectid
78 89
     </select>
79 90
     <!--预习-->
80 91
     <select id="listGuideCommitMonth" resultType="com.xhkjedu.sapi.vo.region.SWorkVo">
81 92
         select c.gradeid,s.subjectname,count(distinct g.guideid)num,s.subjectorder
82
-        ,truncate(count(distinct case when gs.readtime>0 then gs.rgsid else null end)*100/count(distinct gs.rgsid),2)numrate
93
+        ,truncate(count(distinct if(gs.readtime>0,gs.rgsid,null))*100/count(distinct gs.rgsid),2)numrate
83 94
         from t_guide g left join t_subject s on g.subjectid=s.subjectid
84 95
         left join t_guide_group_student gs on gs.guideid=g.guideid
85 96
         left join t_class c on gs.classid=c.classid
86
-        where c.year=#{param.year} and g.schoolid=#{param.schoolid} and gs.schoolid=#{param.schoolid}
97
+        left join t_director d on g.directorid=d.directorid
98
+        where d.disabled=0 and c.year=#{param.year} and g.schoolid=#{param.schoolid} and gs.schoolid=#{param.schoolid}
87 99
         and g.createtime between #{param.begintime} and #{param.endtime}
88 100
         group by c.gradeid,g.subjectid
89 101
     </select>
90 102
 
91 103
     <!--课堂使用情况统计——使用次数-->
92 104
     <select id="listRoomNumMonth" resultType="com.xhkjedu.sapi.vo.region.SWorkVo">
93
-        select s.classid,s.classname,s.gradeid,count(c.roomid) num from t_classroom c
105
+        select s.classid,s.classname,s.gradeid,count(distinct c.roomid) num
106
+        from t_classroom c
94 107
         left join t_class s on c.classid=s.classid
95
-        where c.schoolid=#{param.schoolid} and s.year=#{param.year}
108
+        left join t_director d on c.directorid=d.directorid
109
+        where d.disabled=0 and c.schoolid=#{param.schoolid} and s.year=#{param.year}
96 110
         and c.createtime between #{param.begintime} and #{param.endtime}
97 111
         group by c.classid order by s.gradeid,s.classorder
98 112
     </select>
@@ -100,13 +114,14 @@
100 114
     <!--课堂使用情况统计——课堂互动-->
101 115
     <select id="listRoomAskNumMonth" resultType="java.util.Map">
102 116
         select s.classid,s.classname,s.gradeid,count(distinct c.roomid)num
103
-        ,sum(case when ca.asktype between 30 and 33 then 1 else 0 end)twnum
104
-        ,sum(case when ca.asktype =40 then 1 else 0 end)tcnum
105
-        ,sum(case when ca.asktype =21 then 1 else 0 end)dmnum
106
-        ,sum(case when ca.asktype =20 then 1 else 0 end)qdnum
117
+        ,count(distinct if(ca.asktype between 30 and 33,ca.asktid,null))twnum
118
+        ,count(distinct if(ca.asktype =40,ca.asktid,null))tcnum
119
+        ,count(distinct if(ca.asktype =21,ca.asktid,null))dmnum
120
+        ,count(distinct if(ca.asktype =20,ca.asktid,null))qdnum
107 121
         from t_classroom c left join t_class s on c.classid=s.classid
108 122
         left join t_classroom_askteacher ca on ca.roomid=c.roomid
109
-        where c.schoolid=#{param.schoolid} and s.year=#{param.year}
123
+        left join t_director d on c.directorid=d.directorid
124
+        where d.disabled=0 and c.schoolid=#{param.schoolid} and s.year=#{param.year}
110 125
         and c.createtime between #{param.begintime} and #{param.endtime}
111 126
         group by c.classid order by s.gradeid,s.classorder
112 127
     </select>

+ 47
- 25
sapi/src/main/resources/mapper/region/SResourceMapper.xml View File

@@ -4,67 +4,85 @@
4 4
 
5 5
     <!--资源统计——资源数量-->
6 6
     <select id="getSchoolResourceNum" resultType="java.util.Map">
7
-        select count(r.resourceid) resourcenum,sum(r.resourcesize)resourcesize,sum(r.downcount) downcount
8
-         from t_resource r left join t_subject s on r.subjectid=s.subjectid
9
-         left join t_school l on s.level=l.schoollevel
10
-          where r.resourcestate=1 and (r.belong &lt; 3 or (r.belong=3 and r.schoolid=#{schoolid}))
11
-          and l.schoolid=#{schoolid}
12
-          and (r.level=1 or r.level=4)
7
+        select count(r.resourceid) as resourcenum,sum(r.resourcesize) as resourcesize,sum(r.downcount) as downcount
8
+        from(select distinct r.resourceid from t_resource r left join t_subject s on r.subjectid=s.subjectid
9
+        left join t_school l on s.level=l.schoollevel
10
+        left join t_resource_director rd on r.resourceid=rd.resourceid
11
+        left join t_director d on rd.directorid=d.directorid
12
+        where d.disabled=0 and r.resourcestate=1 and (r.belong &lt; 3 or (r.belong=3 and r.schoolid=#{schoolid}))
13
+        and l.schoolid=#{schoolid}
14
+        and (r.level=1 or r.level=4))r2 left join t_resource r on r2.resourceid=r.resourceid
13 15
     </select>
16
+    <!--资源统计——收藏数量-->
14 17
     <select id="getSchoolResourceCollectNum" resultType="java.lang.Integer">
15
-        select count(distinct rc.resourceid) from t_resource_collect rc
18
+        select count(distinct rc.rcid) from t_resource_collect rc
16 19
         left join t_resource r on rc.resourceid=r.resourceid
17 20
         left join t_subject s on r.subjectid=s.subjectid
18 21
         left join t_school l on s.level=l.schoollevel
19
-        where r.resourcestate=1
22
+        left join t_resource_director rd on r.resourceid=rd.resourceid
23
+        left join t_director d on rd.directorid=d.directorid
24
+        where d.disabled=0 and r.resourcestate=1
20 25
         and (r.belong &lt; 3 or (r.belong=3 and r.schoolid=#{schoolid})) and (r.level=1 or r.level=4) and l.schoolid=#{schoolid}
21 26
     </select>
27
+    <!--资源统计——校本资源数量-->
22 28
     <select id="getSchoolResourceTotalNum" resultType="java.lang.Integer">
23
-        select count(*) from t_resource
24
-        where resourcestate=1 and belong=3 and schoolid=#{schoolid} and (level=1 or level=4)
29
+        select count(distinct r.resourceid) from t_resource r
30
+        left join t_resource_director rd on r.resourceid=rd.resourceid
31
+        left join t_director d on rd.directorid=d.directorid
32
+        where d.disabled=0 and r.resourcestate=1 and r.belong=3 and r.schoolid=#{schoolid} and (r.level=1 or r.level=4)
25 33
     </select>
26 34
     <!--资源统计——资源分类统计-->
27 35
     <select id="listSchoolResourceSubjectTypenum" resultType="com.xhkjedu.sapi.vo.region.ResourceTypeVo">
28
-        select r.subjectid,s.subjectname,r.resourcetype rtype,count(r.resourceid)rnum
36
+        select r.subjectid,s.subjectname,r.resourcetype rtype,count(distinct r.resourceid)rnum
29 37
         from t_resource r left join t_subject s on r.subjectid=s.subjectid
30 38
         left join t_school l on s.level=l.schoollevel
31
-        where r.resourcestate=1 and (r.belong &lt; 3 or (r.belong=3 and r.schoolid=#{schoolid})) and (r.level=1 or r.level=4)
39
+        left join t_resource_director rd on r.resourceid=rd.resourceid
40
+        left join t_director d on rd.directorid=d.directorid
41
+        where d.disabled=0 and r.resourcestate=1 and (r.belong &lt; 3 or (r.belong=3 and r.schoolid=#{schoolid})) and (r.level=1 or r.level=4)
32 42
         and l.schoolid=#{schoolid}
33 43
         group by r.subjectid,r.resourcetype order by s.subjectorder,r.resourcetype
34 44
     </select>
35 45
     <!--资源统计——资源格式统计-->
36 46
     <select id="listSchoolResourceSubjectClassnum" resultType="com.xhkjedu.sapi.vo.region.ResourceTypeVo">
37
-        select r.resourceclass rtype,count(r.resourceid)rnum
47
+        select r.resourceclass rtype,count(distinct r.resourceid)rnum
38 48
         from t_resource r left join t_subject s on r.subjectid=s.subjectid
39 49
         left join t_school l on s.level=l.schoollevel
40
-        where r.resourcestate=1 and (r.belong &lt; 3 or (r.belong=3 and r.schoolid=#{schoolid})) and (r.level=1 or r.level=4)
50
+        left join t_resource_director rd on r.resourceid=rd.resourceid
51
+        left join t_director d on rd.directorid=d.directorid
52
+        where d.disabled=0 and r.resourcestate=1 and (r.belong &lt; 3 or (r.belong=3 and r.schoolid=#{schoolid})) and (r.level=1 or r.level=4)
41 53
         and l.schoolid=#{schoolid}
42 54
         group by r.resourceclass order by r.resourceclass
43 55
     </select>
44 56
 
45 57
     <!--试题统计——学科数量-->
46 58
     <select id="listSchoolQuestionSubjectnum" resultType="com.xhkjedu.sapi.vo.region.RSubjectVo">
47
-       select s.subjectname,count(q.questionid) snum
59
+        select s.subjectname,count(distinct q.questionid) as snum
48 60
         from t_question q left join t_subject s on q.subjectid=s.subjectid
49 61
         left join t_school l on s.level=l.schoollevel
50
-        where q.qstate=1 and (q.belong &lt; 3 or (q.belong=3 and q.schoolid=#{schoolid}))
62
+        left join t_question_director qd on q.questionid=qd.questionid
63
+        left join t_director d on qd.directorid=d.directorid
64
+        where d.disabled=0 and q.qstate=1 and q.qlevel!=3 and (q.belong &lt; 3 or (q.belong=3 and q.schoolid=#{schoolid}))
51 65
         and l.schoolid=#{schoolid}
52 66
         group by q.subjectid order by s.subjectorder
53 67
     </select>
54 68
     <!--试题统计——校本试题学科数量-->
55 69
     <select id="getSchoolQuestionXbSubjectnum" resultType="com.xhkjedu.sapi.vo.region.RSubjectVo">
56
-        select s.subjectname,count(q.questionid) snum
70
+        select s.subjectname,count(distinct q.questionid) as snum
57 71
         from t_question q left join t_subject s on q.subjectid=s.subjectid
58
-        where q.qstate=1 and q.belong=3 and q.schoolid=#{schoolid}
72
+        left join t_question_director qd on q.questionid=qd.questionid
73
+        left join t_director d on qd.directorid=d.directorid
74
+        where d.disabled=0 and q.qstate=1 and q.belong=3 and q.qlevel!=3 and q.schoolid=#{schoolid}
59 75
         group by q.subjectid order by snum
60 76
     </select>
61 77
 
62 78
 
63 79
     <!--资源统计——校本资源统计-->
64 80
     <select id="listSchoolResourceSchool" resultType="com.xhkjedu.sapi.vo.region.RSubjectVo">
65
-        select r.subjectid,s.subjectname,count(r.resourceid)snum
81
+        select r.subjectid,s.subjectname,count(distinct r.resourceid)snum
66 82
         from t_resource r left join t_subject s on r.subjectid=s.subjectid
67
-        where r.resourcestate=1 and r.belong=3 and r.schoolid=#{schoolid} and (r.level=1 or r.level=4)
83
+        left join t_resource_director rd on r.resourceid=rd.resourceid
84
+        left join t_director d on rd.directorid=d.directorid
85
+        where d.disabled=0 and r.resourcestate=1 and r.belong=3 and r.schoolid=#{schoolid} and (r.level=1 or r.level=4)
68 86
         group by r.subjectid order by s.subjectorder
69 87
     </select>
70 88
 
@@ -74,18 +92,22 @@
74 92
       select resourcename,readcount from t_resource r
75 93
       left join t_subject s on r.subjectid=s.subjectid
76 94
       left join t_school l on s.level=l.schoollevel
77
-      where r.resourcestate=1
95
+      left join t_resource_director rd on r.resourceid=rd.resourceid
96
+      left join t_director d on rd.directorid=d.directorid
97
+      where d.disabled=0 and r.resourcestate=1
78 98
       and (r.belong &lt; 3 or (r.belong=3 and r.schoolid=#{schoolid})) and (r.level=1 or r.level=4)
79 99
       and l.schoolid=#{schoolid}
80
-        order by readcount desc limit 40
100
+      group by r.resourceid order by readcount desc limit 40
81 101
     </select>
82 102
 
83 103
     <!--资源统计——近一个月校本资源贡献统计-->
84 104
     <select id="listSchoolResourceForSchool" resultType="com.xhkjedu.sapi.vo.region.ResourceTypeVo">
85
-        select r.subjectid,s.subjectname,r.resourcetype rtype,count(r.resourceid)rnum
105
+        select r.subjectid,s.subjectname,r.resourcetype rtype,count(distinct r.resourceid)rnum
86 106
         from t_resource r left join t_subject s on r.subjectid=s.subjectid
87
-        where r.resourcestate=1 and r.belong=3 and r.schoolid=#{schoolid} and (r.level=1 or r.level=4)
88
-				and r.createtime between #{begintime} and #{endtime}
107
+        left join t_resource_director rd on r.resourceid=rd.resourceid
108
+        left join t_director d on rd.directorid=d.directorid
109
+        where d.disabled=0 and r.resourcestate=1 and r.belong=3 and r.schoolid=#{schoolid} and (r.level=1 or r.level=4)
110
+        and r.createtime between #{begintime} and #{endtime}
89 111
         group by r.subjectid,r.resourcetype order by s.subjectorder,r.resourcetype
90 112
     </select>
91 113
 

+ 1
- 1
sapi/src/main/resources/mapper/system/SchoolMapper.xml View File

@@ -18,7 +18,7 @@
18 18
         where f.fschoolid=#{schoolid}
19 19
     </select>
20 20
     <select id="findAll" resultType="java.util.Map">
21
-        select s.schoolid,s.schoolname,s.shortname,s.schoollevel,s.errorrate,s.`year`
21
+        select s.schoolid,s.schoolname,s.shortname,s.schoollevel,s.errorrate,s.`year`,s.docklc
22 22
         ,(select u.loginname from t_user u where u.schoolid=s.schoolid and u.usertype=0 and u.userstate=1
23 23
         ORDER BY u.userid LIMIT 1)loginname
24 24
         ,(select count(sf.schoolid) from t_school_friend sf where sf.fschoolid=s.schoolid)joinnum

+ 12
- 2
sapi/src/main/resources/mapper/system/UserMapper.xml View File

@@ -28,9 +28,8 @@
28 28
         </foreach>
29 29
     </update>
30 30
 
31
-
32 31
     <!--获取学校管理员-->
33
-    <select id="getSchoolAdminBySchoolid" resultType="com.xhkjedu.sapi.vo.system.UserVo">
32
+    <select id="getSchoolAdminBySchoolid" resultType="com.xhkjedu.vo.system.UserVo">
34 33
         select userid,username,loginname,loginpwd from t_user where schoolid=#{schoolid}
35 34
         and usertype=0 and userstate=1 order by userid limit 1
36 35
     </select>
@@ -43,4 +42,15 @@
43 42
     <update id="delBindmac">
44 43
         update t_user set bindmac=0,mac=null where schoolid=#{schoolid}
45 44
     </update>
45
+
46
+    <!--获取用户信息-->
47
+    <select id="getUserTypeAndSchool" resultType="com.xhkjedu.sapi.model.system.TUser">
48
+        select usertype,schoolid from t_user where userid=#{userid}
49
+    </select>
50
+
51
+    <!--获取用户信息用于操作日志-->
52
+    <select id="getUserInfoForHandleLog" resultType="com.xhkjedu.vo.system.UserVo">
53
+        select userid,username,loginname,usertype,schoolid from t_user where userid=#{userid}
54
+    </select>
55
+
46 56
 </mapper>

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/SclassApplication.java View File

@@ -1,17 +1,17 @@
1 1
 package com.xhkjedu.sclass;
2 2
 
3
+import com.xhkjedu.sclass.config.ConfigKey;
3 4
 import org.springframework.boot.SpringApplication;
4 5
 import org.springframework.boot.autoconfigure.SpringBootApplication;
5
-import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
6 6
 import tk.mybatis.spring.annotation.MapperScan;
7 7
 
8 8
 @SpringBootApplication(scanBasePackages = "com.xhkjedu")
9 9
 @MapperScan("com.xhkjedu.sclass.mapper")
10
-@EnableEurekaClient
11 10
 public class SclassApplication {
12 11
 
13 12
     public static void main(String[] args) {
14 13
         SpringApplication.run(SclassApplication.class, args);
14
+        System.out.println("构建号:" + ConfigKey.buildnum);
15 15
     }
16 16
 
17 17
 }

+ 208
- 0
sclass/src/main/java/com/xhkjedu/sclass/aop/WebControllerAop.java View File

@@ -0,0 +1,208 @@
1
+package com.xhkjedu.sclass.aop;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.annotation.Action;
5
+import com.xhkjedu.constant.PlatformConstant;
6
+import com.xhkjedu.model.slog.THandleLog;
7
+import com.xhkjedu.sclass.config.ConfigKey;
8
+import com.xhkjedu.sclass.mapper.system.UserMapper;
9
+import com.xhkjedu.sclass.mq.HandleLogSender;
10
+import com.xhkjedu.utils.IpRegionUtil;
11
+import com.xhkjedu.utils.N_Utils;
12
+import com.xhkjedu.vo.ResultVo;
13
+import com.xhkjedu.vo.system.UserVo;
14
+import lombok.extern.slf4j.Slf4j;
15
+import org.aspectj.lang.JoinPoint;
16
+import org.aspectj.lang.annotation.*;
17
+import org.aspectj.lang.reflect.MethodSignature;
18
+import org.springframework.stereotype.Component;
19
+import org.springframework.web.context.request.RequestContextHolder;
20
+import org.springframework.web.context.request.ServletRequestAttributes;
21
+
22
+import javax.annotation.Resource;
23
+import javax.servlet.http.HttpServletRequest;
24
+import java.lang.reflect.Method;
25
+
26
+/*
27
+ * @Description: AOP 操作日志
28
+ * @Author: WN
29
+ * @Date: 2023/11/15 18:52:24
30
+ **/
31
+@Aspect
32
+@Component
33
+@Slf4j
34
+public class WebControllerAop {
35
+    @Resource
36
+    private HandleLogSender handleLogSender;
37
+    @Resource
38
+    private UserMapper userMapper;
39
+
40
+    private THandleLog handleLog;
41
+
42
+    /*
43
+     * @Description 指定切点 匹配 使用@Action修饰所有方法
44
+     * @Date 2023/11/15 18:52:48
45
+     * @Author WN
46
+     * @Return void
47
+     **/
48
+    @Pointcut("execution(public * com.xhkjedu.sclass.controller..*.*(..))")
49
+    public void handleLog() {
50
+    }
51
+
52
+    /*
53
+     * @Description 前置通知,方法调用前被调用
54
+     * @Date 2023/11/15 17:46:51
55
+     * @Param [joinPoint]
56
+     **/
57
+    @Before("handleLog()")
58
+    public void doBefore(JoinPoint joinPoint){
59
+
60
+        //获取方法
61
+        Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
62
+        // 获取AspectAnnotation注解
63
+        Action action = method.getAnnotation(Action.class);
64
+        if (action == null) {
65
+            handleLog = null;
66
+            return;
67
+        }
68
+        // 在此处初始化,避免某些方法不用记录报错
69
+        handleLog = new THandleLog();
70
+
71
+        try {
72
+            // 获取方法名字
73
+            String value = action.value();
74
+            String[] valueStr = value.split("-");
75
+            // 操作名称
76
+            handleLog.setHandlemodel(valueStr[0]);
77
+            handleLog.setHandleaction(valueStr[1]);
78
+
79
+            if(joinPoint.getArgs() != null && joinPoint.getArgs().length > 0){
80
+                Object[] args = joinPoint.getArgs();
81
+                // 设置请求参数
82
+                handleLog.setHandleparas(JSON.toJSONString(args[0]));
83
+            }
84
+
85
+            ServletRequestAttributes ss = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
86
+            if (ss != null) {
87
+                HttpServletRequest request = ss.getRequest();
88
+                Integer userid = request.getIntHeader(PlatformConstant.XH_USER_ID);
89
+                // 用户名
90
+                handleLog.setUserid(request.getIntHeader(PlatformConstant.XH_USER_ID));
91
+                handleLog.setDevicetype(request.getHeader(PlatformConstant.XH_DEVICE));
92
+                handleLog.setVersionnum(request.getHeader(PlatformConstant.XH_VERSION));
93
+                // 请求地址
94
+                handleLog.setHandleurl("/sclass" + request.getRequestURI());
95
+
96
+                //获取请求ip并解析区域
97
+                String ip = N_Utils.getIpAddress(request);
98
+                String region = null;
99
+                if (N_Utils.isNotEmpty(ip)) {
100
+                    IpRegionUtil ipRegionUtil = new IpRegionUtil();
101
+                    region = ipRegionUtil.getIpForAddress(ip, ConfigKey.ipregiondb);
102
+                }
103
+                handleLog.setHandleip(ip);
104
+                handleLog.setHandleaddress(region);
105
+                if(N_Utils.isTrueInteger(userid)){
106
+                    UserVo user = userMapper.getUserInfoForHandleLog(userid);
107
+                    if(user != null){
108
+                        handleLog.setUsertype(user.getUsertype());
109
+                        handleLog.setSchoolid(user.getSchoolid());
110
+                        handleLog.setUsername(user.getUsername());
111
+                        handleLog.setLoginname(user.getLoginname());
112
+                        if(N_Utils.isNotEmpty(handleLog.getDevicetype()) && "p_web".equals(handleLog.getDevicetype())){
113
+                            if(user.getUsertype() == 2){
114
+                                handleLog.setDevicetype(handleLog.getDevicetype()+"_s");
115
+                            }else{
116
+                                handleLog.setDevicetype(handleLog.getDevicetype()+"_t");
117
+                            }
118
+                        }
119
+                    }
120
+                }
121
+            }
122
+        } catch (Exception e) {
123
+            log.error("操作日志doBefore执行异常:" + e.getMessage());
124
+        }
125
+    }
126
+
127
+    /*
128
+     * @Description 处理完请求返回内容 发送mq消息
129
+     * @Date 2023/11/15 17:47:12
130
+     * @Author WN
131
+     * @Param [ret]
132
+     **/
133
+    @AfterReturning(returning = "ret", pointcut = "handleLog()")
134
+    public void doAfterReturning(Object ret){
135
+        if (ret == null) {
136
+            return;
137
+        }
138
+        if (handleLog == null) {
139
+            return;
140
+        }
141
+
142
+        if (ret instanceof ResultVo) {
143
+            ResultVo result = (ResultVo) ret;
144
+            if (result.getCode() == 0) {
145
+                handleLog.setHandlestate(1);
146
+            } else {
147
+                handleLog.setHandlestate(2);
148
+            }
149
+        }
150
+    }
151
+
152
+    /*
153
+     * @Description  后置异常
154
+     * @Date 2023/11/15 17:47:28
155
+     * @Author WN
156
+     * @Param [jp, e] (JoinPoint jp, Exception e)
157
+     **/
158
+    @AfterThrowing(pointcut = "handleLog()", throwing = "e")
159
+    public void throwss(Exception e) {
160
+
161
+        if (handleLog == null) {
162
+            return;
163
+        }
164
+
165
+        handleLog.setHandlestate(2);
166
+    }
167
+
168
+    /*
169
+     * @Description 后置最终通知,final增强,不管是抛出异常或者正常退出都会执行
170
+     * @Date 2023/11/15 17:49:15
171
+     * @Author WN
172
+     * @Param [jp](JoinPoint jp)
173
+     **/
174
+    @After("handleLog()")
175
+    public void after() {
176
+        if (handleLog == null) {
177
+            return;
178
+        }
179
+        sendOut();
180
+    }
181
+
182
+    /*
183
+     * @Description 环绕通知,环绕增强,相当于MethodInterceptor
184
+     * @Date 2023/11/15 17:49:34
185
+     * @Author WN
186
+     * @Param [pjp]
187
+     * @Return java.lang.Object
188
+     **/
189
+    // @Around("handleLog()")
190
+    // public Object arround(ProceedingJoinPoint pjp) {
191
+    //     try {
192
+    //         return pjp.proceed();
193
+    //     } catch (Throwable e) {
194
+    //         e.printStackTrace();
195
+    //     }
196
+    //     return null;
197
+    // }
198
+
199
+    /**
200
+     * 发送消息
201
+     */
202
+    public void sendOut() {
203
+        THandleLog logHandlelogNew = handleLog;
204
+        // log.info("记录操作日志,给rabbitmq发送消息:" + logHandlelogNew.toString());
205
+        handleLogSender.handleLogSend(logHandlelogNew);
206
+    }
207
+
208
+}

+ 28
- 0
sclass/src/main/java/com/xhkjedu/sclass/config/ConfigKey.java View File

@@ -0,0 +1,28 @@
1
+package com.xhkjedu.sclass.config;
2
+
3
+import org.springframework.beans.factory.annotation.Value;
4
+import org.springframework.stereotype.Component;
5
+
6
+/**
7
+ * @author ywx
8
+ * @classname ConfigKey
9
+ * @description 读取配置文件类
10
+ * @date 2020/10/16 9:19
11
+ **/
12
+@Component
13
+public class ConfigKey {
14
+    public static Integer buildnum;//构建号
15
+
16
+    @Value("${buildnum}")
17
+    public void setBuildnum(Integer buildnum){
18
+        this.buildnum = buildnum;
19
+    }
20
+
21
+    public static String ipregiondb;//解析ip地址归属地
22
+
23
+    @Value("${ipregiondb}")
24
+    public void setIpregiondb(String ipregiondb){
25
+        ConfigKey.ipregiondb = ipregiondb;
26
+    }
27
+
28
+}

+ 24
- 0
sclass/src/main/java/com/xhkjedu/sclass/config/RabbitConfig.java View File

@@ -0,0 +1,24 @@
1
+package com.xhkjedu.sclass.config;
2
+
3
+import org.springframework.amqp.core.Queue;
4
+import org.springframework.beans.factory.annotation.Value;
5
+import org.springframework.context.annotation.Bean;
6
+import org.springframework.context.annotation.Configuration;
7
+
8
+/*
9
+ * @Description: mq配置
10
+ * @Author: WN
11
+ * @Date: 2023/11/16 9:28:45
12
+ **/
13
+@Configuration
14
+public class RabbitConfig {
15
+
16
+    //生产者mq-操作日志
17
+    @Value("${rabbitmq.handleLogQueue}")
18
+    private String handleLogQueue;
19
+
20
+    @Bean
21
+    public Queue handleLogQueue() {
22
+        return new Queue(handleLogQueue);
23
+    }
24
+}

+ 24
- 1
sclass/src/main/java/com/xhkjedu/sclass/controller/classroom/ClassroomController.java View File

@@ -3,6 +3,8 @@ package com.xhkjedu.sclass.controller.classroom;
3 3
 import com.alibaba.fastjson.JSON;
4 4
 import com.github.pagehelper.PageHelper;
5 5
 import com.github.pagehelper.PageInfo;
6
+import com.xhkjedu.annotation.Action;
7
+import com.xhkjedu.sclass.mapper.system.UserMapper;
6 8
 import com.xhkjedu.sclass.model.classroom.*;
7 9
 import com.xhkjedu.sclass.model.paperstudent.TPaperStudent;
8 10
 import com.xhkjedu.sclass.model.paperstudent.TPaperStudentScantron;
@@ -17,6 +19,7 @@ import com.xhkjedu.utils.N_Utils;
17 19
 import com.xhkjedu.utils.PageUtil;
18 20
 import com.xhkjedu.vo.PageResult;
19 21
 import com.xhkjedu.vo.ResultVo;
22
+import com.xhkjedu.vo.system.UserVo;
20 23
 import lombok.extern.slf4j.Slf4j;
21 24
 import org.springframework.web.bind.annotation.PostMapping;
22 25
 import org.springframework.web.bind.annotation.RequestBody;
@@ -39,6 +42,8 @@ public class ClassroomController {
39 42
     private ClassroomService classroomService;
40 43
     @Resource
41 44
     private ClassroomPaperService classroomPaperService;
45
+    @Resource
46
+    private UserMapper userMapper;
42 47
 
43 48
     /**
44 49
      * 批量保存课堂数据
@@ -49,6 +54,7 @@ public class ClassroomController {
49 54
      * @Date 2022/6/29 10:31
50 55
      **/
51 56
     @PostMapping("/saveclass")
57
+    @Action("课堂管理-增加")
52 58
     public ResultVo saveClass(@RequestBody List<RoomPVo> rooms) {
53 59
         List<TClassroom> startclassList = new ArrayList<>();//开始课堂集合
54 60
         List<TClassroom> stopclassList = new ArrayList<>();//结束课堂集合
@@ -175,6 +181,7 @@ public class ClassroomController {
175 181
      * @Date 2022/6/30 11:23
176 182
      **/
177 183
     @PostMapping("/save_class")
184
+    @Action("课堂管理-增加")
178 185
     public ResultVo saveOneClass(@RequestBody RoomPVo r) {
179 186
         List<RoomParamVo> params = r.getParams();
180 187
         if(!classroomService.isSave(params, r.getRoomid())) return new ResultVo(0, "无需保存");
@@ -461,8 +468,9 @@ public class ClassroomController {
461 468
         Integer pageSize = room.getPageSize();
462 469
         N_Utils.validation(new Object[]{teacherid, "教师id", 1, page, "显示页码", 1, pageSize, "显示条数", 1});
463 470
         try {
471
+            UserVo userVo = userMapper.getUserInfoForHandleLog(teacherid);
464 472
             PageHelper.startPage(page, pageSize);
465
-            List<Map> list = classroomService.listClassByDirectorId(room);
473
+            List<Map> list = classroomService.listClassByDirectorId(room, userVo);
466 474
             PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
467 475
             return new ResultVo(0, "获取课堂回顾列表成功", pageResult);
468 476
         } catch (Exception e) {
@@ -471,6 +479,21 @@ public class ClassroomController {
471 479
         }
472 480
     }
473 481
 
482
+    /**
483
+     * @Description 删除
484
+     * @Date 2023/11/17 14:26
485
+     * @Author YWX
486
+     * @Param [room]
487
+     * @Return com.xhkjedu.vo.ResultVo
488
+     **/
489
+    @PostMapping("/delete")
490
+    public ResultVo delete(@RequestBody TClassroom room) {
491
+        Long roomid = room.getRoomid();
492
+        N_Utils.validation(new Object[]{roomid, "课堂id", 1});
493
+        classroomService.deleteById(roomid);
494
+        return new ResultVo(0, "删除成功");
495
+    }
496
+
474 497
     /**
475 498
      * 课堂回顾详情
476 499
      *

+ 4
- 0
sclass/src/main/java/com/xhkjedu/sclass/controller/classroom/ClassroomVideoController.java View File

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.sclass.controller.classroom;
2 2
 
3
+import com.xhkjedu.annotation.Action;
3 4
 import com.xhkjedu.sclass.model.classroom.TClassroomVideo;
4 5
 import com.xhkjedu.sclass.service.classroom.ClassroomVideoService;
5 6
 import com.xhkjedu.utils.N_Utils;
@@ -34,6 +35,7 @@ public class ClassroomVideoController {
34 35
     }
35 36
 
36 37
     @PostMapping("/add")
38
+    @Action("课堂视频-增加")
37 39
     public ResultVo add(@RequestBody TClassroomVideo video) {
38 40
         N_Utils.validation(new Object[]{video.getRoomid(), "课堂id", 1});
39 41
         classroomVideoService.save(video);
@@ -41,6 +43,7 @@ public class ClassroomVideoController {
41 43
     }
42 44
 
43 45
     @PostMapping("/delete")
46
+    @Action("课堂视频-删除")
44 47
     public ResultVo delete(@RequestBody TClassroomVideo video) {
45 48
         Integer rvid = video.getRvid();
46 49
         N_Utils.validation(new Object[]{rvid, "课堂视频id", 1});
@@ -49,6 +52,7 @@ public class ClassroomVideoController {
49 52
     }
50 53
 
51 54
     @PostMapping("/update")
55
+    @Action("课堂视频-修改")
52 56
     public ResultVo update(@RequestBody TClassroomVideo video) {
53 57
         N_Utils.validation(new Object[]{video.getRvid(), "课堂视频id", 1});
54 58
         classroomVideoService.update(video);

+ 0
- 35
sclass/src/main/java/com/xhkjedu/sclass/interceptors/HttpServletFilter.java View File

@@ -1,35 +0,0 @@
1
-package com.xhkjedu.sclass.interceptors;
2
-
3
-import org.springframework.stereotype.Component;
4
-
5
-import javax.servlet.Filter;
6
-import javax.servlet.FilterChain;
7
-import javax.servlet.ServletException;
8
-import javax.servlet.ServletRequest;
9
-import javax.servlet.ServletResponse;
10
-import javax.servlet.http.HttpServletRequest;
11
-import java.io.IOException;
12
-
13
-/**
14
- * @author ywx
15
- * @classname HttpServletFilter
16
- * @description 过滤器 以便http post请求body输入流可多次读取
17
- * @date 2020/11/9 11:25
18
- **/
19
-@Component
20
-public class HttpServletFilter implements Filter {
21
-
22
-    @Override
23
-    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
24
-        ServletRequest requestWrapper = null;
25
-        if (request instanceof HttpServletRequest) {
26
-            requestWrapper = new RequestWrapper((HttpServletRequest) request);
27
-        }
28
-        if (requestWrapper == null) {
29
-            chain.doFilter(request, response);
30
-        } else {
31
-            chain.doFilter(requestWrapper, response);
32
-        }
33
-    }
34
-
35
-}

+ 0
- 0
sclass/src/main/java/com/xhkjedu/sclass/interceptors/RequestInterceptor.java View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save