Kaynağa Gözat

教材基础信息

tags/正式3.2.0
王宁 2 yıl önce
ebeveyn
işleme
60e931162e
56 değiştirilmiş dosya ile 3240 ekleme ve 4 silme
  1. 38
    2
      sstudy/pom.xml
  2. 2
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/SstudyApplication.java
  3. 9
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/base/TkMapper.java
  4. 86
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/config/ConfigKey.java
  5. 34
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/config/CorsConfig.java
  6. 68
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/config/ErrorAdivceController.java
  7. 105
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/controller/subjectbook/DirectorController.java
  8. 122
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/controller/subjectbook/PointController.java
  9. 124
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/controller/subjectbook/SubjectBookController.java
  10. 126
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/controller/subjectbook/SubjectController.java
  11. 118
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/controller/subjectbook/SubjectQuestiontypeController.java
  12. 95
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/controller/subjectbook/VersionController.java
  13. 109
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/interceptors/DecryptRequestBodyAdvice.java
  14. 31
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/interceptors/HttpServletFilter.java
  15. 147
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/interceptors/RequestInterceptor.java
  16. 78
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/interceptors/RequestWrapper.java
  17. 62
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/interceptors/WebMvcConfg.java
  18. 39
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/mapper/subjectbook/DirectorMapper.java
  19. 27
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/mapper/subjectbook/PointMapper.java
  20. 37
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/mapper/subjectbook/SubjectBookMapper.java
  21. 65
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/mapper/subjectbook/SubjectMapper.java
  22. 26
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/mapper/subjectbook/SubjectQuestiontypeMapper.java
  23. 22
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/mapper/subjectbook/VersionMapper.java
  24. 26
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/model/BaseBean.java
  25. 54
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/model/subjectbook/TDirector.java
  26. 53
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/model/subjectbook/TPoint.java
  27. 39
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/model/subjectbook/TSubject.java
  28. 57
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/model/subjectbook/TSubjectBook.java
  29. 42
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/model/subjectbook/TSubjectQuestiontype.java
  30. 36
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/model/subjectbook/TVersion.java
  31. 134
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/service/subjectbook/DirectorService.java
  32. 109
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/service/subjectbook/PointService.java
  33. 161
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/service/subjectbook/SubjectBookService.java
  34. 92
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/service/subjectbook/SubjectQuestiontypeService.java
  35. 116
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/service/subjectbook/SubjectService.java
  36. 76
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/service/subjectbook/VersionService.java
  37. 106
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/utils/JedisUtil.java
  38. 29
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/utils/StudyUtil.java
  39. 30
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/DirectorVo.java
  40. 24
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/LevelSubjectVo.java
  41. 26
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/LsbBookVo.java
  42. 25
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/LsbLevelVo.java
  43. 28
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/LsbSubjectVo.java
  44. 12
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/LsbVo.java
  45. 12
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/PointVo.java
  46. 27
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/SubjectQuestiontypeVo.java
  47. 22
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/SubjectVo.java
  48. 19
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/TeacherClassVo.java
  49. 27
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/TeacherSClassVo.java
  50. 22
    2
      sstudy/src/main/resources/application.properties
  51. 34
    0
      sstudy/src/main/resources/mapper/subjectbook/DirectorMapper.xml
  52. 38
    0
      sstudy/src/main/resources/mapper/subjectbook/PointMapper.xml
  53. 65
    0
      sstudy/src/main/resources/mapper/subjectbook/SubjectBookMapper.xml
  54. 70
    0
      sstudy/src/main/resources/mapper/subjectbook/SubjectMapper.xml
  55. 38
    0
      sstudy/src/main/resources/mapper/subjectbook/SubjectQuestiontypeMapper.xml
  56. 21
    0
      sstudy/src/main/resources/mapper/subjectbook/VersionMapper.xml

+ 38
- 2
sstudy/pom.xml Dosyayı Görüntüle

@@ -22,10 +22,10 @@
22 22
             <groupId>org.springframework.boot</groupId>
23 23
             <artifactId>spring-boot-starter-web</artifactId>
24 24
         </dependency>
25
-        <dependency>
25
+        <!--<dependency>
26 26
             <groupId>org.springframework.cloud</groupId>
27 27
             <artifactId>spring-cloud-starter-config</artifactId>
28
-        </dependency>
28
+        </dependency>-->
29 29
         <dependency>
30 30
             <groupId>org.springframework.cloud</groupId>
31 31
             <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
@@ -35,6 +35,12 @@
35 35
             <groupId>mysql</groupId>
36 36
             <artifactId>mysql-connector-java</artifactId>
37 37
         </dependency>
38
+        <!-- Druid连接池 -->
39
+        <dependency>
40
+            <groupId>com.alibaba</groupId>
41
+            <artifactId>druid</artifactId>
42
+            <version>1.1.12</version>
43
+        </dependency>
38 44
         <dependency>
39 45
             <groupId>org.projectlombok</groupId>
40 46
             <artifactId>lombok</artifactId>
@@ -45,6 +51,36 @@
45 51
             <artifactId>spring-boot-starter-test</artifactId>
46 52
             <scope>test</scope>
47 53
         </dependency>
54
+
55
+        <dependency>
56
+            <groupId>com.xhkjedu</groupId>
57
+            <artifactId>scommons</artifactId>
58
+            <version>0.0.1-SNAPSHOT</version>
59
+        </dependency>
60
+
61
+        <!--mybatis通用mapper依赖-->
62
+        <dependency>
63
+            <groupId>tk.mybatis</groupId>
64
+            <artifactId>mapper-spring-boot-starter</artifactId>
65
+            <version>2.0.2</version>
66
+        </dependency>
67
+
68
+        <dependency>
69
+            <groupId>com.alibaba</groupId>
70
+            <artifactId>fastjson</artifactId>
71
+            <version>1.2.56</version>
72
+        </dependency>
73
+
74
+        <dependency>
75
+            <groupId>redis.clients</groupId>
76
+            <artifactId>jedis</artifactId>
77
+            <version>2.9.3</version>
78
+        </dependency>
79
+        <dependency>
80
+            <groupId>org.springframework.boot</groupId>
81
+            <artifactId>spring-boot-starter-data-redis</artifactId>
82
+        </dependency>
83
+
48 84
     </dependencies>
49 85
     <dependencyManagement>
50 86
         <dependencies>

+ 2
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/SstudyApplication.java Dosyayı Görüntüle

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

+ 9
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/base/TkMapper.java Dosyayı Görüntüle

@@ -0,0 +1,9 @@
1
+package com.xhkjedu.sstudy.base;
2
+
3
+import tk.mybatis.mapper.common.IdsMapper;
4
+import tk.mybatis.mapper.common.Mapper;
5
+import tk.mybatis.mapper.common.MySqlMapper;
6
+
7
+public interface TkMapper<T> extends Mapper<T>, MySqlMapper<T>, IdsMapper<T> {
8
+
9
+}

+ 86
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/config/ConfigKey.java Dosyayı Görüntüle

@@ -0,0 +1,86 @@
1
+package com.xhkjedu.sstudy.config;
2
+
3
+import org.springframework.beans.factory.annotation.Value;
4
+import org.springframework.stereotype.Component;
5
+
6
+import java.io.UnsupportedEncodingException;
7
+
8
+/**
9
+ * @author ywx
10
+ * @classname ConfigKey
11
+ * @description 读取配置文件类
12
+ * @date 2020/10/16 9:19
13
+ **/
14
+@Component
15
+public class ConfigKey {
16
+
17
+    public static Integer nummin;
18
+    public static Integer nummax;
19
+    public static Integer numadd;
20
+
21
+    @Value("${nummin}")
22
+    public void setNummin(Integer nummin) {
23
+        ConfigKey.nummin = nummin;
24
+    }
25
+
26
+    @Value("${nummax}")
27
+    public void setNummax(Integer nummax) {
28
+        ConfigKey.nummax = nummax;
29
+    }
30
+
31
+    @Value("${numadd}")
32
+    public void setNumadd(Integer numadd) {
33
+        ConfigKey.numadd = numadd;
34
+    }
35
+
36
+    public static String cloudapi;//云平台接口
37
+    public static String showurl;//文件访问路径
38
+    public static String oldshowurl;//原文件访问路径
39
+    public static String fileapi;//文件服务接口地址
40
+    public static String dbname;//数据库名
41
+
42
+    @Value("${cloudapi}")
43
+    public void setCloudapi(String cloudapi) {
44
+        this.cloudapi = cloudapi;
45
+    }
46
+
47
+    @Value("${file.showurl}")
48
+    public void setShowurl(String showurl) {
49
+        this.showurl = showurl;
50
+    }
51
+
52
+    @Value("${file.oldshowurl}")
53
+    public void setOldshowurl(String oldshowurl) {
54
+        this.oldshowurl = oldshowurl;
55
+    }
56
+
57
+    @Value("${fileapi}")
58
+    public void setFileapi(String fileapi) {
59
+        this.fileapi = fileapi;
60
+    }
61
+
62
+    @Value("${dbname}")
63
+    public void setDbname(String dbname) {
64
+        ConfigKey.dbname = dbname;
65
+    }
66
+
67
+    public static Integer syncnum;//一次同步数量
68
+
69
+    @Value("${cron.syncnum}")
70
+    public void setSyncnum(Integer syncnum) {
71
+        ConfigKey.syncnum = syncnum;
72
+    }
73
+
74
+    public static Integer redisdatatime;//缓存访问数据有效时长
75
+    public static String secretKey;//secretKey必须为24位
76
+
77
+    @Value("${redisdatatime}")
78
+    public void setRedisdatatime(Integer redisdatatime) {
79
+        ConfigKey.redisdatatime = redisdatatime;
80
+    }
81
+
82
+    @Value("${secretKey}")
83
+    public void setSecretKey(String secretKey) {
84
+        ConfigKey.secretKey = secretKey;
85
+    }
86
+}

+ 34
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/config/CorsConfig.java Dosyayı Görüntüle

@@ -0,0 +1,34 @@
1
+package com.xhkjedu.sstudy.config;
2
+
3
+import org.springframework.context.annotation.Bean;
4
+import org.springframework.context.annotation.Configuration;
5
+import org.springframework.web.cors.CorsConfiguration;
6
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
7
+import org.springframework.web.filter.CorsFilter;
8
+
9
+/**
10
+ * @ClassName CorsConfig
11
+ * Description 请求跨域支持
12
+ * Author WN
13
+ * Date 2020/6/5 16:29
14
+ **/
15
+@Configuration
16
+public class CorsConfig {
17
+    private CorsConfiguration corsConfiguration() {
18
+        CorsConfiguration corsConfiguration = new CorsConfiguration();
19
+        // 1允许任何域名使用
20
+        corsConfiguration.addAllowedOrigin("*");
21
+        // 2允许任何头
22
+        corsConfiguration.addAllowedHeader("*");
23
+        // 3允许任何方法(post、get等)
24
+        corsConfiguration.addAllowedMethod("*");
25
+        return corsConfiguration;
26
+    }
27
+
28
+    @Bean
29
+    public CorsFilter corsFilter() {
30
+        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
31
+        source.registerCorsConfiguration("/**", corsConfiguration());
32
+        return new CorsFilter(source);
33
+    }
34
+}

+ 68
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/config/ErrorAdivceController.java Dosyayı Görüntüle

@@ -0,0 +1,68 @@
1
+package com.xhkjedu.sstudy.config;
2
+import com.alibaba.fastjson.JSON;
3
+import com.xhkjedu.config.MissingParametersException;
4
+import com.xhkjedu.utils.N_Utils;
5
+import com.xhkjedu.vo.ResultVo;
6
+import lombok.extern.slf4j.Slf4j;
7
+import org.springframework.dao.DataIntegrityViolationException;
8
+import org.springframework.web.bind.annotation.ControllerAdvice;
9
+import org.springframework.web.bind.annotation.ExceptionHandler;
10
+import org.springframework.web.bind.annotation.ResponseBody;
11
+
12
+import javax.servlet.http.HttpServletRequest;
13
+
14
+
15
+/**
16
+ * @创建人 :zj
17
+ * @创建时间 2019/11/7
18
+ * @修改人和其它信息
19
+ * @描述 :项目异常处理类:
20
+ * 项目中所有controller层抛出的异常信息都会被拦截。
21
+ * 方便我们查看异常原因,减少开发中大量的try catch。
22
+ * 拦截异常后,打印异常信息,返回前端约定参数对象。
23
+ */
24
+@Slf4j
25
+@ResponseBody
26
+@ControllerAdvice
27
+public class ErrorAdivceController {
28
+    @ExceptionHandler(MissingParametersException.class)
29
+    public ResultVo missingParametersException(MissingParametersException ex) {
30
+        log.error("参数异常:   -------> " + ex.getMessage());
31
+        return new ResultVo(1, ex.getMessage());
32
+    }
33
+
34
+    @ExceptionHandler(DataIntegrityViolationException.class)
35
+    public ResultVo DataIntegrityViolationException(DataIntegrityViolationException ex){
36
+        log.error("数据库异常:   -------> " + ex.getMessage());
37
+        String msg = ex.getMessage();
38
+        if (N_Utils.isNotEmpty(msg) && msg.indexOf("SQLIntegrityConstraintViolationException") != -1){
39
+            return new ResultVo(1,"存在关联信息");
40
+        }
41
+        return new ResultVo(1,"数据库处理异常");
42
+    }
43
+
44
+    @ExceptionHandler(Exception.class)
45
+    public ResultVo exceptionHandler(Exception ex) {
46
+        log.error("程序运行异常:   -------> " + ex.getMessage());
47
+        String msg = ex.getMessage();
48
+        if (N_Utils.isNotEmpty(msg) && msg.indexOf("JSON parse error") != -1){
49
+            return new ResultVo(1,"json格式不对");
50
+        }
51
+        return new ResultVo(1, "程序处理异常");
52
+    }
53
+
54
+    @ExceptionHandler(NullPointerException.class)
55
+    public ResultVo nullPointerException(NullPointerException ex) {
56
+        StackTraceElement element = ex.getStackTrace()[0];
57
+        log.error("参数为空异常:   -------> " + JSON.toJSONString(element));
58
+        return new ResultVo(1, "参数为空异常");
59
+    }
60
+
61
+    @ExceptionHandler(value = IllegalArgumentException.class)
62
+    public ResultVo illegalArgumentExceptionHandler(HttpServletRequest request, IllegalArgumentException ex) {
63
+        log.error("请求参数错误 URL : {},Exception : {}", request.getRequestURL(),ex.getMessage());
64
+        return new ResultVo(1, "请求参数错误");
65
+    }
66
+
67
+
68
+}

+ 105
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/controller/subjectbook/DirectorController.java Dosyayı Görüntüle

@@ -0,0 +1,105 @@
1
+package com.xhkjedu.sstudy.controller.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.model.subjectbook.TDirector;
4
+import com.xhkjedu.sstudy.service.subjectbook.DirectorService;
5
+import com.xhkjedu.utils.N_Utils;
6
+import com.xhkjedu.vo.ResultVo;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.web.bind.annotation.PostMapping;
9
+import org.springframework.web.bind.annotation.RequestBody;
10
+import org.springframework.web.bind.annotation.RequestMapping;
11
+import org.springframework.web.bind.annotation.RestController;
12
+
13
+import java.util.List;
14
+
15
+
16
+/**
17
+ * @ClassName DirectorController
18
+ * Description 章节
19
+ * Author WN
20
+ * Date 2020/6/3 11:58
21
+ **/
22
+@RestController
23
+@RequestMapping("director")
24
+public class DirectorController {
25
+    @Autowired
26
+    private DirectorService directorService;
27
+
28
+    /**
29
+     *功能描述  教材下章节树形结构
30
+     * @author WN
31
+     * @date 2020/6/3
32
+     * @param  * @param director
33
+     * @return com.xhkjedu.vo.ResultVo
34
+     */
35
+    @PostMapping("/list")
36
+    public ResultVo list(@RequestBody TDirector director){
37
+        N_Utils.validation(new Object[]{director.getLsbid(),"教材id",1});
38
+        List<TDirector> lst = directorService.lisTDirectors(director);
39
+        return new ResultVo(0,"获取教材下章节成功",lst);
40
+    }
41
+
42
+    /**
43
+     *功能描述  添加
44
+     * @author WN
45
+     * @date 2020/6/3
46
+     * @param  * @param director
47
+     * @return com.xhkjedu.vo.ResultVo
48
+     */
49
+    @PostMapping("/add")
50
+    public ResultVo add(@RequestBody TDirector director){
51
+        N_Utils.validation(new Object[]{director.getDirectorname(),"章节名称",2,director.getLsbid(),"教材id",1,
52
+        director.getBelong(),"章节归属",1,director.getDirectorlevel(),"归属层级",1});
53
+        if (director.getDirectorlevel() > 4) {
54
+            return new ResultVo(1,"超过层级限制");
55
+        }
56
+        int result = directorService.addDirector(director);
57
+        if (result > 0) {
58
+            return new ResultVo(0, "保存成功");
59
+        }else{
60
+            return new ResultVo(1, "保存失败");
61
+        }
62
+    }
63
+
64
+    /**
65
+     *功能描述  修改章节
66
+     * @author WN
67
+     * @date 2020/6/1
68
+     * @param  * @param director
69
+     * @return com.xhkjedu.vo.ResultVo
70
+     */
71
+    @PostMapping("/update")
72
+    public ResultVo update(@RequestBody TDirector director){
73
+        N_Utils.validation(new Object[]{director.getDirectorid(),"章节id",2,director.getDirectorname(),"章节名称",2});
74
+        int result = directorService.updateDirector(director);
75
+        if (result > 0) return new ResultVo(0,"修改成功");
76
+        else return new ResultVo(1,"修改失败");
77
+    }
78
+
79
+    /**
80
+     *功能描述 删除
81
+     * @author WN
82
+     * @date 2020/6/3
83
+     * @param  * @param director
84
+     * @return com.xhkjedu.vo.ResultVo
85
+     */
86
+    @PostMapping("/del")
87
+    public ResultVo del(@RequestBody TDirector director){
88
+        N_Utils.validation(new Object[]{director.getDirectorid(),"章节id",2});
89
+        String useModule = directorService.findUseModule(director.getDirectorid());
90
+        if (N_Utils.isNotEmpty(useModule)) {
91
+//            return new ResultVo(1,"使用章节模块【"+useModule+"】,禁止删除");
92
+            String[] strs = useModule.split(",");
93
+            for (String str : strs) {
94
+                if (N_Utils.isNotEmpty(str)){
95
+                    useModule = str;
96
+                    break;
97
+                }
98
+            }
99
+            return new ResultVo(1,"此章节下已有"+useModule+",禁止删除");
100
+        }
101
+        int result = directorService.delDirector(director);
102
+        if (result > 0) return new ResultVo(0,"删除成功");
103
+        else return new ResultVo(1,"删除失败");
104
+    }
105
+}

+ 122
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/controller/subjectbook/PointController.java Dosyayı Görüntüle

@@ -0,0 +1,122 @@
1
+package com.xhkjedu.sstudy.controller.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.model.subjectbook.TPoint;
4
+import com.xhkjedu.sstudy.service.subjectbook.PointService;
5
+import com.xhkjedu.utils.N_Utils;
6
+import com.xhkjedu.vo.ResultVo;
7
+import com.xhkjedu.sstudy.vo.subjectbook.PointVo;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.web.bind.annotation.PostMapping;
10
+import org.springframework.web.bind.annotation.RequestBody;
11
+import org.springframework.web.bind.annotation.RequestMapping;
12
+import org.springframework.web.bind.annotation.RestController;
13
+
14
+import java.util.List;
15
+
16
+
17
+/**
18
+ * @ClassName PointController
19
+ * Description 知识点
20
+ * Author WN
21
+ * Date 2020/6/3 11:58
22
+ **/
23
+@RestController
24
+@RequestMapping("point")
25
+public class PointController {
26
+    @Autowired
27
+    private PointService pointService;
28
+
29
+    /**
30
+     *功能描述  科目下知识点列表
31
+     * @author WN
32
+     * @date 2020/6/3
33
+     * @param  * @param point
34
+     * @return com.xhkjedu.vo.ResultVo
35
+     */
36
+    @PostMapping("/list")
37
+    public ResultVo list(@RequestBody TPoint point){
38
+        N_Utils.validation(new Object[]{point.getSubjectid(),"科目id",2});
39
+        List<TPoint> lst = pointService.listPoints(point);
40
+        return new ResultVo(0,"获取科目下知识点成功",lst);
41
+    }
42
+
43
+    /**
44
+     *功能描述  添加
45
+     * @author WN
46
+     * @date 2020/6/3
47
+     * @param  * @param point
48
+     * @return com.xhkjedu.vo.ResultVo
49
+     */
50
+    @PostMapping("/add")
51
+    public ResultVo add(@RequestBody TPoint point){
52
+        N_Utils.validation(new Object[]{point.getPointname(),"知识点名称",2,point.getSubjectid(),"科目",1
53
+        ,point.getPointlevel(),"归属层级",1});
54
+        if (point.getPointlevel() > 5) {
55
+            return new ResultVo(1,"超过层级限制");
56
+        }
57
+        int result = pointService.addPoint(point);
58
+        if (result > 0) {
59
+            return new ResultVo(0, "保存成功");
60
+        }else{
61
+            return new ResultVo(1, "保存失败");
62
+        }
63
+    }
64
+
65
+    /**
66
+     *功能描述  修改知识点
67
+     * @author WN
68
+     * @date 2020/6/1
69
+     * @param  * @param point
70
+     * @return com.xhkjedu.vo.ResultVo
71
+     */
72
+    @PostMapping("/update")
73
+    public ResultVo update(@RequestBody TPoint point){
74
+        N_Utils.validation(new Object[]{point.getPointid(),"知识点id",2,point.getPointname(),"知识点名称",2});
75
+        int result = pointService.updatePoint(point);
76
+        if (result > 0) return new ResultVo(0,"修改成功");
77
+        else return new ResultVo(1,"修改失败");
78
+    }
79
+
80
+    /**
81
+     *功能描述 删除
82
+     * @author WN
83
+     * @date 2020/6/3
84
+     * @param  * @param point
85
+     * @return com.xhkjedu.vo.ResultVo
86
+     */
87
+    @PostMapping("/del")
88
+    public ResultVo del(@RequestBody TPoint point){
89
+        N_Utils.validation(new Object[]{point.getPointid(),"知识点id",2});
90
+        String useModule = pointService.findUseModule(point.getPointid());
91
+        if (N_Utils.isNotEmpty(useModule)) {
92
+//            return new ResultVo(1,"使用知识点模块【"+useModule+"】,禁止删除");
93
+            String[] strs = useModule.split(",");
94
+            for (String str : strs) {
95
+                if (N_Utils.isNotEmpty(str)){
96
+                    useModule = str;
97
+                    break;
98
+                }
99
+            }
100
+            return new ResultVo(1,"此知识点下有"+useModule+",禁止删除");
101
+        }
102
+        int result = pointService.delPoint(point);
103
+        if (result > 0) return new ResultVo(0,"删除成功");
104
+        else return new ResultVo(1,"删除失败");
105
+    }
106
+
107
+    /**
108
+     *功能描述  搜索知识点
109
+     * @author WN
110
+     * @date 2020/6/19
111
+     * @param  * @param point
112
+     * @return com.xhkjedu.vo.ResultVo
113
+     */
114
+    @PostMapping("/search")
115
+    public ResultVo search(@RequestBody TPoint point){
116
+        N_Utils.validation(new Object[]{point.getSubjectid(),"科目id",2});
117
+        List<PointVo> lst = pointService.listPointsForSearch(point);
118
+        return new ResultVo(0,"搜索科目下知识点成功",lst);
119
+    }
120
+
121
+
122
+}

+ 124
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/controller/subjectbook/SubjectBookController.java Dosyayı Görüntüle

@@ -0,0 +1,124 @@
1
+package com.xhkjedu.sstudy.controller.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.model.subjectbook.TSubjectBook;
4
+import com.xhkjedu.sstudy.service.subjectbook.SubjectBookService;
5
+import com.xhkjedu.utils.N_Utils;
6
+import com.xhkjedu.vo.ResultVo;
7
+import com.xhkjedu.sstudy.vo.subjectbook.LsbSubjectVo;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.web.bind.annotation.PostMapping;
10
+import org.springframework.web.bind.annotation.RequestBody;
11
+import org.springframework.web.bind.annotation.RequestMapping;
12
+import org.springframework.web.bind.annotation.RestController;
13
+
14
+import java.util.List;
15
+import java.util.Map;
16
+
17
+/**
18
+ * @ClassName SubjectBookController
19
+ * Description 教材
20
+ * Author WN
21
+ * Date 2020/6/2 18:10
22
+ **/
23
+@RestController
24
+@RequestMapping("lsb")
25
+public class SubjectBookController {
26
+    @Autowired
27
+    private SubjectBookService subjectBookService;
28
+
29
+    /**
30
+     *功能描述 添加教材
31
+     * @author WN
32
+     * @date 2020/6/2
33
+     * @param  * @param subjectBook
34
+     * @return com.xhkjedu.vo.ResultVo
35
+     */
36
+    @PostMapping("/add")
37
+    public ResultVo add(@RequestBody TSubjectBook subjectBook){
38
+        N_Utils.validation(new Object[]{subjectBook.getLevel(),"阶段",1,subjectBook.getSubjectid(),"科目",1,subjectBook.getVersionid(),"版本",1});
39
+        int result = subjectBookService.addSubjectBook(subjectBook);
40
+        if (result > 0) {
41
+            return new ResultVo(0, "保存成功");
42
+        }else{
43
+            return new ResultVo(1, "保存失败");
44
+        }
45
+    }
46
+
47
+   /**
48
+    *功能描述 教材
49
+    * @author WN
50
+    * @date 2020/6/2
51
+    * @param  * @param subjectBook
52
+    * @return com.xhkjedu.vo.ResultVo
53
+    */
54
+    @PostMapping("/update")
55
+    public ResultVo update(@RequestBody TSubjectBook subjectBook){
56
+        N_Utils.validation(new Object[]{subjectBook.getLsbid(),"教材id",1});
57
+        return subjectBookService.updateSubjectBook(subjectBook);
58
+    }
59
+
60
+    /**
61
+     *功能描述 教材--删除
62
+     * @author WN
63
+     * @date 2020/6/17
64
+     * @param  * @param subjectBook
65
+     * @return com.xhkjedu.vo.ResultVo
66
+     */
67
+    @PostMapping("/del")
68
+    public ResultVo del(@RequestBody TSubjectBook subjectBook){
69
+        N_Utils.validation(new Object[]{subjectBook.getLsbid(),"教材id",1});
70
+        String useModule = subjectBookService.findUseModule(subjectBook.getLsbid());
71
+        if (N_Utils.isNotEmpty(useModule)) {
72
+//            return new ResultVo(1,"使用教材模块【"+useModule+"】,禁止删除");
73
+            String[] strs = useModule.split(",");
74
+            for (String str : strs) {
75
+                if (N_Utils.isNotEmpty(str)){
76
+                    useModule = str;
77
+                    break;
78
+                }
79
+            }
80
+            return new ResultVo(1,"此教材下已有"+useModule+",禁止删除");
81
+        }
82
+        int result = subjectBookService.delSubjectBook(subjectBook);
83
+        if (result > 0) return new ResultVo(0,"删除成功");
84
+        else return new ResultVo(1,"删除失败");
85
+    }
86
+
87
+    /**
88
+     *功能描述  教材--树形结构
89
+     * @author WN
90
+     * @date 2020/6/3
91
+     * @param  * @param subjectBook
92
+     * @return com.xhkjedu.vo.ResultVo
93
+     */
94
+    @PostMapping("/tree")
95
+    public ResultVo listSubjectBooks(@RequestBody TSubjectBook subjectBook){
96
+        N_Utils.validation(new Object[]{
97
+                subjectBook.getLevel(),"阶段",1,
98
+        });
99
+        List<LsbSubjectVo> lst = subjectBookService.listSubjectBooksForTree(subjectBook);
100
+        return new ResultVo(0,"获取教材树形结构成功",lst);
101
+    }
102
+
103
+    /**
104
+     *功能描述  获取教材集合
105
+     * @author WN
106
+     * @date 2020/6/7
107
+     * @param  * @param subjectBook
108
+     * @return com.xhkjedu.vo.ResultVo
109
+     */
110
+    @PostMapping("/list")
111
+    public ResultVo list(@RequestBody TSubjectBook subjectBook){
112
+        N_Utils.validation(new Object[]{
113
+                subjectBook.getLevel(),"阶段",1
114
+        });
115
+        List<TSubjectBook> lst = subjectBookService.listSubjectBooks(subjectBook);
116
+        return new ResultVo(0,"获取所有教材集合",lst);
117
+    }
118
+
119
+    @PostMapping("/list_sel")
120
+    public ResultVo listForSel() {
121
+        List<Map> list = subjectBookService.listForSel();
122
+        return new ResultVo(0,"获取教材选择列表成功",list);
123
+    }
124
+}

+ 126
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/controller/subjectbook/SubjectController.java Dosyayı Görüntüle

@@ -0,0 +1,126 @@
1
+package com.xhkjedu.sstudy.controller.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.model.subjectbook.TSubject;
4
+import com.xhkjedu.sstudy.service.subjectbook.SubjectService;
5
+import com.xhkjedu.utils.N_Utils;
6
+import com.xhkjedu.sstudy.vo.subjectbook.SubjectVo;
7
+import com.xhkjedu.vo.ResultVo;
8
+import lombok.extern.slf4j.Slf4j;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.web.bind.annotation.PostMapping;
11
+import org.springframework.web.bind.annotation.RequestBody;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RestController;
14
+
15
+import java.util.List;
16
+
17
+/**
18
+ * @ClassName SubjectController
19
+ * Description TODO
20
+ * Author WN
21
+ * Date 2020/6/1 12:03
22
+ **/
23
+@Slf4j
24
+@RestController
25
+@RequestMapping("/subject")
26
+public class SubjectController {
27
+    @Autowired
28
+    private SubjectService subjectService;
29
+
30
+    /**
31
+     *功能描述  获取阶段下所有科目信息
32
+     * @author WN
33
+     * @date 2020/6/1
34
+     * @param  * @param subject
35
+     * @return com.xhkjedu.vo.ResultVo
36
+     */
37
+    @PostMapping("/list")
38
+    public ResultVo listSubjects(@RequestBody TSubject subject){
39
+        List<TSubject> lst = subjectService.listSubjects(subject);
40
+        return new ResultVo(0,"查询科目集合成功",lst);
41
+    }
42
+
43
+    @PostMapping("/teacher_list")
44
+    public ResultVo listTeacherSubjects(@RequestBody TSubject subject){
45
+        Integer teacherid = subject.getCreateid();
46
+        N_Utils.validation(new Object[]{teacherid,"教师id",1});
47
+        List<TSubject> lst = subjectService.listTeacherSubjects(teacherid);
48
+        return new ResultVo(0,"查询教师科目集合成功",lst);
49
+    }
50
+
51
+    /**
52
+     *功能描述 用户选择学科
53
+     * @author WN
54
+     * @date 2020/6/2
55
+     * @param  * @param subject
56
+     * @return com.xhkjedu.vo.ResultVo
57
+     */
58
+    @PostMapping("/listsel")
59
+    public ResultVo listSubjectsForSel(@RequestBody TSubject subject){
60
+        List<SubjectVo> lst = subjectService.listSubjectsForSel(subject);
61
+        return new ResultVo(0,"查询科目集合成功",lst);
62
+    }
63
+
64
+    /**
65
+     *功能描述  添加科目
66
+     * @author WN
67
+     * @date 2020/6/1
68
+     * @param  * @param subject
69
+     * @return com.xhkjedu.vo.ResultVo
70
+     */
71
+    @PostMapping("/add")
72
+    public ResultVo add(@RequestBody TSubject subject){
73
+        N_Utils.validation(new Object[]{subject.getSubjectname(),"科目名称",2,subject.getLevel(),"阶段",1});
74
+        int result = subjectService.addSubject(subject);
75
+        if (result > 0) {
76
+            return new ResultVo(0, "保存成功");
77
+        }else{
78
+            return new ResultVo(1, "保存失败");
79
+        }
80
+    }
81
+
82
+    /**
83
+     *功能描述  修改科目
84
+     * @author WN
85
+     * @date 2020/6/1
86
+     * @param  * @param subject
87
+     * @return com.xhkjedu.vo.ResultVo
88
+     */
89
+    @PostMapping("/update")
90
+    public ResultVo update(@RequestBody TSubject subject){
91
+        N_Utils.validation(new Object[]{subject.getSubjectid(),"科目id",2,subject.getSubjectname(),"科目名称",2});
92
+        int result = subjectService.updateSubject(subject);
93
+        if (result > 0) return new ResultVo(0,"修改成功");
94
+        else return new ResultVo(1,"修改失败");
95
+    }
96
+
97
+    /**
98
+     *功能描述 删除科目
99
+     * @author WN
100
+     * @date 2020/6/1
101
+     * @param  * @param subject
102
+     * @return com.xhkjedu.vo.ResultVo
103
+     */
104
+    @PostMapping("/del")
105
+    public ResultVo del(@RequestBody TSubject subject) {
106
+        if (N_Utils.isEmpty(subject.getSubjectid()))
107
+            return new ResultVo(1,"未选择删除的科目");
108
+        String useModule = subjectService.findUseModule(subject.getSubjectid());
109
+        if (N_Utils.isNotEmpty(useModule)) {
110
+//            return new ResultVo(1,"使用科目模块【"+useModule+"】,禁止删除");
111
+            String[] strs = useModule.split(",");
112
+            for (String str : strs) {
113
+                if (N_Utils.isNotEmpty(str)){
114
+                    useModule = str;
115
+                    break;
116
+                }
117
+            }
118
+            return new ResultVo(1,"此科目下已有"+useModule+",禁止删除");
119
+        }
120
+        int result = subjectService.delSubject(subject);
121
+        if (result > 0) return new ResultVo(0,"删除成功");
122
+        else return new ResultVo(1,"删除失败");
123
+    }
124
+
125
+
126
+}

+ 118
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/controller/subjectbook/SubjectQuestiontypeController.java Dosyayı Görüntüle

@@ -0,0 +1,118 @@
1
+package com.xhkjedu.sstudy.controller.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.model.subjectbook.TSubjectQuestiontype;
4
+import com.xhkjedu.sstudy.service.subjectbook.SubjectQuestiontypeService;
5
+import com.xhkjedu.utils.N_Utils;
6
+import com.xhkjedu.vo.ResultVo;
7
+import com.xhkjedu.sstudy.vo.subjectbook.SubjectQuestiontypeVo;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.web.bind.annotation.PostMapping;
10
+import org.springframework.web.bind.annotation.RequestBody;
11
+import org.springframework.web.bind.annotation.RequestMapping;
12
+import org.springframework.web.bind.annotation.RestController;
13
+
14
+import java.util.List;
15
+
16
+/**
17
+ * @ClassName SubjectQuestiontypeController
18
+ * Description 题型
19
+ * Author WN
20
+ * Date 2020/6/2 14:19
21
+ **/
22
+@RestController
23
+@RequestMapping("qtype")
24
+public class SubjectQuestiontypeController {
25
+    @Autowired
26
+    private SubjectQuestiontypeService subjectQuestiontypeService;
27
+
28
+    /**
29
+     *功能描述 科目下题型列表
30
+     * @author WN
31
+     * @date 2020/6/2
32
+     * @param  * @param qtype
33
+     * @return com.xhkjedu.vo.ResultVo
34
+     */
35
+    @PostMapping("/list")
36
+    public ResultVo listSubjects(@RequestBody TSubjectQuestiontype qtype){
37
+        N_Utils.validation(new Object[]{qtype.getSubjectid(),"科目",1});
38
+        List<TSubjectQuestiontype> lst = subjectQuestiontypeService.listQuestiontypes(qtype);
39
+        return new ResultVo(0,"查询题型集合成功",lst);
40
+    }
41
+
42
+
43
+    /**
44
+     *功能描述  科目下题型列表用于选择数据
45
+     * @author WN
46
+     * @date 2020/6/2
47
+     * @param  * @param subject
48
+     * @return com.xhkjedu.vo.ResultVo
49
+     */
50
+    @PostMapping("/listsel")
51
+    public ResultVo listSubjectsForSel(@RequestBody TSubjectQuestiontype qtype){
52
+        N_Utils.validation(new Object[]{qtype.getSubjectid(),"科目",1});
53
+        List<SubjectQuestiontypeVo> lst = subjectQuestiontypeService.listQuestiontypesForSel(qtype);
54
+        return new ResultVo(0,"查询科目集合成功",lst);
55
+    }
56
+
57
+    /**
58
+     *功能描述 添加题型
59
+     * @author WN
60
+     * @date 2020/6/2
61
+     * @param  * @param subject
62
+     * @return com.xhkjedu.vo.ResultVo
63
+     */
64
+    @PostMapping("/add")
65
+    public ResultVo add(@RequestBody TSubjectQuestiontype qtype){
66
+        N_Utils.validation(new Object[]{qtype.getSubjectid(),"科目",1,qtype.getQtypename(),"题型名称",2});
67
+
68
+        int result = subjectQuestiontypeService.addQuestiontype(qtype);
69
+        if (result > 0) {
70
+            return new ResultVo(0, "保存成功");
71
+        }else{
72
+            return new ResultVo(1, "保存失败");
73
+        }
74
+    }
75
+
76
+   /**
77
+    *功能描述  修改题型
78
+    * @author WN
79
+    * @date 2020/6/2
80
+    * @param  * @param qtype
81
+    * @return com.xhkjedu.vo.ResultVo
82
+    */
83
+    @PostMapping("/update")
84
+    public ResultVo update(@RequestBody TSubjectQuestiontype qtype){
85
+        N_Utils.validation(new Object[]{qtype.getQtypeid(),"题型id",2,qtype.getQtypename(),"题型名称",2});
86
+        int result = subjectQuestiontypeService.updateQuestiontype(qtype);
87
+        if (result > 0) return new ResultVo(0,"修改成功");
88
+        else return new ResultVo(1,"修改失败");
89
+    }
90
+
91
+    /**
92
+     *功能描述  删除题型
93
+     * @author WN
94
+     * @date 2020/6/2
95
+     * @param  * @param qtype
96
+     * @return com.xhkjedu.vo.ResultVo
97
+     */
98
+    @PostMapping("/del")
99
+    public ResultVo del(@RequestBody TSubjectQuestiontype qtype){
100
+        if (N_Utils.isEmpty(qtype.getQtypeid()))
101
+            return new ResultVo(1,"未选择删除的题型");
102
+        String useModule = subjectQuestiontypeService.findUseModule(qtype.getQtypeid());
103
+        if (N_Utils.isNotEmpty(useModule)) {
104
+//            return new ResultVo(1,"使用题型模块【"+useModule+"】,禁止删除");
105
+            String[] strs = useModule.split(",");
106
+            for (String str : strs) {
107
+                if (N_Utils.isNotEmpty(str)){
108
+                    useModule = str;
109
+                    break;
110
+                }
111
+            }
112
+            return new ResultVo(1,"此题型下已有"+useModule+",禁止删除");
113
+        }
114
+        int result = subjectQuestiontypeService.delQuestiontype(qtype);
115
+        if (result > 0) return new ResultVo(0,"删除成功");
116
+        else return new ResultVo(1,"删除失败");
117
+    }
118
+}

+ 95
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/controller/subjectbook/VersionController.java Dosyayı Görüntüle

@@ -0,0 +1,95 @@
1
+package com.xhkjedu.sstudy.controller.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.model.subjectbook.TVersion;
4
+import com.xhkjedu.sstudy.service.subjectbook.VersionService;
5
+import com.xhkjedu.utils.N_Utils;
6
+import com.xhkjedu.vo.ResultVo;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.web.bind.annotation.PostMapping;
9
+import org.springframework.web.bind.annotation.RequestBody;
10
+import org.springframework.web.bind.annotation.RequestMapping;
11
+import org.springframework.web.bind.annotation.RestController;
12
+
13
+import java.util.List;
14
+
15
+/**
16
+ * @ClassName VersionController
17
+ * Description TODO  教材版本
18
+ * Author WN
19
+ * Date 2020/6/1 12:03
20
+ **/
21
+@RestController
22
+@RequestMapping("/version")
23
+public class VersionController {
24
+    @Autowired
25
+    private VersionService versionService;
26
+
27
+    /**
28
+     *功能描述 列表
29
+     * @author WN
30
+     * @date 2020/6/2
31
+     * @param  * @param version
32
+     * @return com.xhkjedu.vo.ResultVo
33
+     */
34
+    @PostMapping("/list")
35
+    public ResultVo listBooks(@RequestBody TVersion version){
36
+        List<TVersion> lst = versionService.listVersions(version);
37
+        return new ResultVo(0,"查询教材版本集合成功",lst);
38
+    }
39
+
40
+   /**
41
+    *功能描述  添加
42
+    * @author WN
43
+    * @date 2020/6/2
44
+    * @param  * @param version
45
+    * @return com.xhkjedu.vo.ResultVo
46
+    */
47
+    @PostMapping("/add")
48
+    public ResultVo add(@RequestBody TVersion version){
49
+        N_Utils.validation(new Object[]{version.getVersionname(),"教材版本名称",2});
50
+        int result = versionService.addVersion(version);
51
+        if (result > 0) {
52
+            return new ResultVo(0, "保存成功");
53
+        }else{
54
+            return new ResultVo(1, "保存失败");
55
+        }
56
+    }
57
+
58
+    /**
59
+     *功能描述  修改教材版本
60
+     * @author WN
61
+     * @date 2020/6/2
62
+     * @param  * @param version
63
+     * @return com.xhkjedu.vo.ResultVo
64
+     */
65
+    @PostMapping("/update")
66
+    public ResultVo update(@RequestBody TVersion version){
67
+        N_Utils.validation(new Object[]{version.getVersionid(),"教材版本id",2,version.getVersionname(),"教材版本名称",2});
68
+        int result = versionService.updateVersion(version);
69
+        if (result > 0) return new ResultVo(0,"修改成功");
70
+        else return new ResultVo(1,"修改失败");
71
+    }
72
+
73
+    /**
74
+     *功能描述 删除教材版本
75
+     * @author WN
76
+     * @date 2020/6/2
77
+     * @param  * @param version
78
+     * @return com.xhkjedu.vo.ResultVo
79
+     */
80
+    @PostMapping("/del")
81
+    public ResultVo del(@RequestBody TVersion version) {
82
+        if (N_Utils.isEmpty(version.getVersionid()))
83
+            return new ResultVo(1,"未选择删除的教材版本");
84
+        String useModule = versionService.findUseModule(version.getVersionid());
85
+        if (N_Utils.isNotEmpty(useModule)) {
86
+//            return new ResultVo(1,"使用版本模块【"+useModule+"】,禁止删除");
87
+            return new ResultVo(1,"此版本下已有教材,禁止删除");
88
+        }
89
+        int result = versionService.delVersion(version);
90
+        if (result > 0) return new ResultVo(0,"删除成功");
91
+        else return new ResultVo(1,"删除失败");
92
+    }
93
+
94
+
95
+}

+ 109
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/interceptors/DecryptRequestBodyAdvice.java Dosyayı Görüntüle

@@ -0,0 +1,109 @@
1
+package com.xhkjedu.sstudy.interceptors;
2
+
3
+
4
+import com.xhkjedu.utils.AES;
5
+import com.xhkjedu.utils.N_Utils;
6
+import lombok.extern.slf4j.Slf4j;
7
+import org.springframework.core.MethodParameter;
8
+import org.springframework.http.HttpHeaders;
9
+import org.springframework.http.HttpInputMessage;
10
+import org.springframework.http.converter.HttpMessageConverter;
11
+import org.springframework.util.StreamUtils;
12
+import org.springframework.web.bind.annotation.ControllerAdvice;
13
+import org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice;
14
+
15
+import javax.crypto.BadPaddingException;
16
+import javax.crypto.IllegalBlockSizeException;
17
+import javax.crypto.NoSuchPaddingException;
18
+import java.io.ByteArrayInputStream;
19
+import java.io.IOException;
20
+import java.io.InputStream;
21
+import java.io.UnsupportedEncodingException;
22
+import java.lang.reflect.Type;
23
+import java.security.InvalidKeyException;
24
+import java.security.NoSuchAlgorithmException;
25
+import java.util.List;
26
+
27
+/**
28
+ * @ClassName DecryptRequestBodyAdvice
29
+ * Description TODO AES解密
30
+ * Author WN
31
+ * Date 2021/5/12 11:34
32
+ **/
33
+@Slf4j
34
+@ControllerAdvice
35
+public class DecryptRequestBodyAdvice implements RequestBodyAdvice {
36
+
37
+    private static String AES_KEY = "XINGHUOLIAOYUAN7";
38
+
39
+    /** 此处如果返回false , 则不执行当前Advice的业务 */
40
+    @Override
41
+    public boolean supports(MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass) {
42
+//       log.info("----support----");
43
+        return true;
44
+    }
45
+
46
+    /**
47
+     * @title 读取参数前执行
48
+     * @description 在此做些编码 / 解密 / 封装参数为对象的操作
49
+     **/
50
+    @Override
51
+    public HttpInputMessage beforeBodyRead(HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass) throws IOException {
52
+//        log.info("----beforeBodyRead----");
53
+
54
+        //AES解密,false不需要解密
55
+        List<String> decrypts = httpInputMessage.getHeaders().get("st");
56
+        String decrypt = N_Utils.isListNotEmpty(decrypts)?decrypts.get(0):"false";
57
+        if (!decrypt.equals("true")) {
58
+            return httpInputMessage;
59
+        }
60
+        // 读取加密的请求体
61
+        byte[] body = StreamUtils.copyToByteArray(httpInputMessage.getBody());
62
+        String str = new String(body,"utf-8");
63
+
64
+        try {
65
+            // 使用AES解密
66
+            body = AES.decryptForByte(str, AES_KEY);
67
+        } catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException |
68
+                BadPaddingException | UnsupportedEncodingException e) {
69
+            e.printStackTrace();
70
+            throw new RuntimeException(e);
71
+        } catch (Exception e){
72
+            e.printStackTrace();
73
+            throw new RuntimeException(e);
74
+        }
75
+
76
+        // 使用解密后的数据,构造新的读取流
77
+        InputStream rawInputStream = new ByteArrayInputStream(body);
78
+        return new HttpInputMessage() {
79
+            @Override
80
+            public HttpHeaders getHeaders() {
81
+                return httpInputMessage.getHeaders();
82
+            }
83
+
84
+            @Override
85
+            public InputStream getBody() throws IOException {
86
+                return rawInputStream;
87
+            }
88
+        };
89
+    }
90
+
91
+    /**
92
+     * @title 读取参数后执行
93
+     * @author Xingbz
94
+     */
95
+    @Override
96
+    public Object afterBodyRead(Object o, HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass) {
97
+//        log.info("afterBodyRead:----");
98
+        return o;
99
+    }
100
+
101
+    /**
102
+     * @title 无请求时的处理
103
+     */
104
+    @Override
105
+    public Object handleEmptyBody(Object o, HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass) {
106
+//        log.info("handleEmptyBody:----");
107
+        return o;
108
+    }
109
+}

+ 31
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/interceptors/HttpServletFilter.java Dosyayı Görüntüle

@@ -0,0 +1,31 @@
1
+package com.xhkjedu.sstudy.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
+}

+ 147
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/interceptors/RequestInterceptor.java Dosyayı Görüntüle

@@ -0,0 +1,147 @@
1
+package com.xhkjedu.sstudy.interceptors;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.config.MissingParametersException;
5
+import com.xhkjedu.sstudy.utils.JedisUtil;
6
+import com.xhkjedu.utils.N_Utils;
7
+import com.xhkjedu.vo.ResultVo;
8
+import lombok.extern.slf4j.Slf4j;
9
+import org.springframework.context.annotation.Configuration;
10
+import org.springframework.web.servlet.HandlerInterceptor;
11
+import org.springframework.web.servlet.ModelAndView;
12
+
13
+import javax.servlet.http.HttpServletRequest;
14
+import javax.servlet.http.HttpServletResponse;
15
+import java.util.Map;
16
+import java.util.concurrent.ConcurrentHashMap;
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 (!token.equals(redis_token)) {
60
+                ResultVo result = new ResultVo();
61
+                result.setCode(2);
62
+                result.setMsg("登录失效");
63
+
64
+                response.getWriter().print(JSON.toJSONString(result));
65
+                return false;
66
+            }
67
+        }
68
+
69
+        if (interceptorApi(requestURI)) {//需要拦截的请求
70
+            String encoding = request.getCharacterEncoding();
71
+            int contentLength = request.getContentLength();
72
+            byte buffer[] = new byte[request.getContentLength()];
73
+            request.getInputStream();
74
+            for (int i = 0;i < contentLength;) {
75
+
76
+                int readLen = request.getInputStream().read(buffer, i, contentLength - i);
77
+                if (readLen == -1) {
78
+                    break;
79
+                }
80
+                i += readLen;
81
+            }
82
+            if (encoding == null) {
83
+                encoding = "UTF-8";
84
+            }
85
+            String params = new String(buffer, encoding);
86
+            Map<String, String> uriMap =new ConcurrentHashMap<>();
87
+            String params2 = uriMap.get(requestURI);
88
+            if (N_Utils.isNotEmpty(params2) && params2.equals(params)) {
89
+                log.error("地址:{},参数:{}",requestURI,params);
90
+                throw new MissingParametersException("提交过快,请稍后重试");
91
+            } else {
92
+                uriMap.put(requestURI, params);
93
+            }
94
+        }
95
+       /* if("dev".equals(ConfigKey.env)){//开发环境接口不拦截
96
+            return true;
97
+        }*/
98
+        return true;
99
+    }
100
+
101
+    /**
102
+     * 需要拦截的请求
103
+     * @Param [uri]
104
+     * @Author ywx
105
+     * @Date 2020/5/20 14:14
106
+     * @return java.lang.Boolean
107
+     **/
108
+    private Boolean interceptorApi(String uri) {
109
+        boolean rtn = false;
110
+        String[] url = new String[]{
111
+                "/ps/start_paper",//题库作业--开始做作业
112
+                "/ps/sstart_paper",//图片作业--开始做作业
113
+                "/psw/sstart_paper",//图片作业--开始做作业
114
+                "/psw/start_paper",//题库作业--开始做作业
115
+                "/croom/saveclass",//课堂--保存数据
116
+                "/resource/add",//资源--添加
117
+                "/recite/save",//背诵--添加
118
+                "/read/savers",//阅读--保存阅读记录
119
+                "/ps/submit_question",//作业--提交单题
120
+                "/ps/submit_paper",//作业--提交
121
+                "/ps/ssubmit_question",//图片作业--提交单题
122
+                "/ps/ssubmit_paper",//图片作业--提交
123
+                "/ps/scorrect",//答题卡--批改
124
+                "/ps/correc",//试题库--批改
125
+                "/paper/saves",//答题卡--保存
126
+                "/paper/saveq",//试题库--保存
127
+                "/pg/save",//作业--发布
128
+                "/question/add",//试题--添加
129
+                "/basket/add",//试题篮--添加
130
+                "/recites/up",//背诵--学生保存
131
+                "/question_class/end_correct",//试题--批阅完成
132
+                "/research/save",//教研管理--添加
133
+                "/researchu/up",//教研教师--保存评价
134
+                "/notice/add",//通知--添加
135
+        };
136
+
137
+        for (int i = 0; i < url.length; i++) {
138
+            if (uri.equals(url[i])) {
139
+                rtn = true;
140
+                break;
141
+            }
142
+        }
143
+
144
+        return rtn;
145
+    }
146
+
147
+}

+ 78
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/interceptors/RequestWrapper.java Dosyayı Görüntüle

@@ -0,0 +1,78 @@
1
+package com.xhkjedu.sstudy.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
+}

+ 62
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/interceptors/WebMvcConfg.java Dosyayı Görüntüle

@@ -0,0 +1,62 @@
1
+package com.xhkjedu.sstudy.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
+                .allowedOrigins("*")
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
+}

+ 39
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/subjectbook/DirectorMapper.java Dosyayı Görüntüle

@@ -0,0 +1,39 @@
1
+package com.xhkjedu.sstudy.mapper.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.base.TkMapper;
4
+import com.xhkjedu.sstudy.model.subjectbook.TDirector;
5
+import org.apache.ibatis.annotations.Param;
6
+import org.springframework.stereotype.Repository;
7
+
8
+import java.util.List;
9
+
10
+/**
11
+ * @ClassName DirectorMapper
12
+ * Description TODO
13
+ * Author WN
14
+ * Date 2020/6/3 15:44
15
+ **/
16
+@Repository
17
+public interface DirectorMapper extends TkMapper<TDirector> {
18
+
19
+    /**
20
+     *功能描述  教材下章节集合
21
+     * @author WN
22
+     * @date 2020/6/3
23
+     * @param director
24
+     * @return java.util.List<com.xhkjedu.model.subjectbook.TDirector>
25
+     */
26
+    List<TDirector> listDirectors(@Param("director") TDirector director);
27
+
28
+    /**
29
+     * 教师收藏教材下的章节数量
30
+     * @Param [teacherid, lsbid]
31
+     * @Author ywx
32
+     * @Date 2020/7/8 14:48
33
+     * @return java.lang.Integer
34
+     **/
35
+    Integer countByTeacherIdLsbId(@Param("teacherid") Integer teacherid, @Param("lsbid") String lsbid);
36
+
37
+    //查找使用章节的模块
38
+    String findUseModule(String directorid);
39
+}

+ 27
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/subjectbook/PointMapper.java Dosyayı Görüntüle

@@ -0,0 +1,27 @@
1
+package com.xhkjedu.sstudy.mapper.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.base.TkMapper;
4
+import com.xhkjedu.sstudy.model.subjectbook.TPoint;
5
+import com.xhkjedu.sstudy.vo.subjectbook.PointVo;
6
+import org.apache.ibatis.annotations.Param;
7
+import org.springframework.stereotype.Repository;
8
+
9
+import java.util.List;
10
+
11
+/**
12
+ * @ClassName PointMapper
13
+ * Description TODO
14
+ * Author WN
15
+ * Date 2020/6/3 11:53
16
+ **/
17
+@Repository
18
+public interface PointMapper extends TkMapper<TPoint> {
19
+    //获取所有知识点
20
+    List<TPoint> listPoints(@Param("point") TPoint point);
21
+
22
+    //搜索知识点
23
+    List<PointVo> listPointsForSearch(@Param("point") TPoint point);
24
+
25
+    //查找使用知识点的模块
26
+    String findUseModule(String pointid);
27
+}

+ 37
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/subjectbook/SubjectBookMapper.java Dosyayı Görüntüle

@@ -0,0 +1,37 @@
1
+package com.xhkjedu.sstudy.mapper.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.base.TkMapper;
4
+import com.xhkjedu.sstudy.model.subjectbook.TSubjectBook;
5
+import org.apache.ibatis.annotations.Param;
6
+import org.springframework.stereotype.Repository;
7
+
8
+import java.util.List;
9
+import java.util.Map;
10
+
11
+/**
12
+ * @ClassName SubjectBookMapper
13
+ * Description TODO
14
+ * Author WN
15
+ * Date 2020/6/2 17:56
16
+ **/
17
+@Repository
18
+public interface SubjectBookMapper extends TkMapper<TSubjectBook> {
19
+
20
+    /**
21
+     *功能描述 获取数据库表中所有教材关联信息
22
+     * @author WN
23
+     * @date 2020/6/3
24
+     * @param  * @param schoolid
25
+     * @return java.util.List<com.xhkjedu.model.subjectbook.TSubjectBook>
26
+     */
27
+    List<TSubjectBook> listSubjectBooks(@Param("book") TSubjectBook book);
28
+
29
+    //查找使用教材的模块
30
+    String findUseModule(String lsbid);
31
+
32
+    //教材选择列表
33
+    List<Map> listForSel();
34
+
35
+    //查询教材名称是否存在
36
+    Integer checkExisted(@Param("book") TSubjectBook book);
37
+}

+ 65
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/subjectbook/SubjectMapper.java Dosyayı Görüntüle

@@ -0,0 +1,65 @@
1
+package com.xhkjedu.sstudy.mapper.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.base.TkMapper;
4
+import com.xhkjedu.sstudy.model.subjectbook.TSubject;
5
+import com.xhkjedu.sstudy.vo.subjectbook.SubjectVo;
6
+import org.apache.ibatis.annotations.Param;
7
+import org.springframework.stereotype.Repository;
8
+
9
+import java.util.List;
10
+import java.util.Map;
11
+
12
+/**
13
+ * @ClassName SubjectMapper
14
+ * Description 科目
15
+ * Author WN
16
+ * Date 2020/6/1 11:43
17
+ **/
18
+@Repository
19
+public interface SubjectMapper extends TkMapper<TSubject> {
20
+
21
+    /**
22
+     *功能描述  获取阶段下所有科目
23
+     * @author WN
24
+     * @date 2020/6/1
25
+     * @param  * @param level
26
+     * @return java.util.List<com.xhkjedu.model.subjectbook.TSubject>
27
+     */
28
+    List<TSubject> listSubjects(@Param("subject") TSubject subject);
29
+
30
+    /**
31
+     *功能描述 获取阶段下所有科目--为选择框使用
32
+     * @author WN
33
+     * @date 2020/6/1
34
+     * @param  * @param schoolid
35
+     * @return java.util.List<com.xhkjedu.vo.subjectbook.SubjectVo>
36
+     */
37
+    List<SubjectVo> listSubjectsForSel(@Param("subject") TSubject subject);
38
+
39
+    /**
40
+     * 根据学段id获取科目id集合
41
+     * @Param [level]
42
+     * @Author ywx
43
+     * @Date 2020/6/8 9:59
44
+     * @return java.lang.String
45
+     **/
46
+    String getSubjectIds(@Param("level") Integer level);
47
+
48
+    /**
49
+     * 教师科目集合
50
+     * @Param [teacherid]
51
+     * @Author ywx
52
+     * @Date 2020/6/28 9:32
53
+     * @return java.util.List<com.xhkjedu.model.subjectbook.TSubject>
54
+     **/
55
+    List<TSubject> listTeacherSubjects(Integer teacherid);
56
+
57
+    //查找使用科目的模块
58
+    String findUseModule(String subjectid);
59
+
60
+    //获取科目名称
61
+    String getNameById(String subjectid);
62
+
63
+    //获取科目id名称列表
64
+    List<Map> listSubject(Integer schoolid, Integer level);
65
+}

+ 26
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/subjectbook/SubjectQuestiontypeMapper.java Dosyayı Görüntüle

@@ -0,0 +1,26 @@
1
+package com.xhkjedu.sstudy.mapper.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.base.TkMapper;
4
+import com.xhkjedu.sstudy.model.subjectbook.TSubjectQuestiontype;
5
+import com.xhkjedu.sstudy.vo.subjectbook.SubjectQuestiontypeVo;
6
+import org.apache.ibatis.annotations.Param;
7
+import org.springframework.stereotype.Repository;
8
+
9
+import java.util.List;
10
+
11
+/**
12
+ * @ClassName SubjectQuestiontype
13
+ * Description 科目题型
14
+ * Author WN
15
+ * Date 2020/6/2 10:52
16
+ **/
17
+@Repository
18
+public interface SubjectQuestiontypeMapper extends TkMapper<TSubjectQuestiontype> {
19
+
20
+    List<TSubjectQuestiontype> listQuestiontypes(@Param("type") TSubjectQuestiontype type);
21
+
22
+    List<SubjectQuestiontypeVo> listQuestiontypesForSel(@Param("type") TSubjectQuestiontype type);
23
+
24
+    //查找使用题型的模块
25
+    String findUseModule(String qtypeid);
26
+}

+ 22
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/subjectbook/VersionMapper.java Dosyayı Görüntüle

@@ -0,0 +1,22 @@
1
+package com.xhkjedu.sstudy.mapper.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.base.TkMapper;
4
+import com.xhkjedu.sstudy.model.subjectbook.TVersion;
5
+import org.apache.ibatis.annotations.Param;
6
+import org.springframework.stereotype.Repository;
7
+
8
+import java.util.List;
9
+
10
+/**
11
+ * @ClassName VersionMapper
12
+ * Description TODO 教材版本
13
+ * Author WN
14
+ * Date 2021/3/10 15:06
15
+ **/
16
+@Repository
17
+public interface VersionMapper extends TkMapper<TVersion> {
18
+    List<TVersion> listVersions(@Param("version") TVersion version);
19
+
20
+    //查找使用版本的模块
21
+    String findUseModule(String versionid);
22
+}

+ 26
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/model/BaseBean.java Dosyayı Görüntüle

@@ -0,0 +1,26 @@
1
+package com.xhkjedu.sstudy.model;
2
+
3
+import lombok.Data;
4
+
5
+import javax.persistence.Transient;
6
+
7
+/**
8
+ * @author lgq
9
+ * @date 2019/11/8 9:29
10
+ * @description: 添加时返回主键绑定id
11
+ */
12
+@Data
13
+public class BaseBean {
14
+    //添加时返回主键
15
+    @Transient
16
+    private Integer id;
17
+    //创建人姓名
18
+    @Transient
19
+    private String createname;
20
+    //分页显示页码
21
+    @Transient
22
+    private Integer page;
23
+    //分页显示条数
24
+    @Transient
25
+    private Integer pageSize;
26
+}

+ 54
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/model/subjectbook/TDirector.java Dosyayı Görüntüle

@@ -0,0 +1,54 @@
1
+package com.xhkjedu.sstudy.model.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+import java.util.ArrayList;
10
+import java.util.List;
11
+
12
+@Table(name = "t_director")
13
+@Data
14
+public class TDirector extends BaseBean {
15
+    //章节表
16
+    @Id
17
+    private String directorid;
18
+
19
+    //章节名称
20
+    private String directorname;
21
+
22
+    //所属章节id
23
+    private String directorpid;
24
+
25
+    //章节排序
26
+    private Integer directororder;
27
+
28
+    //是否是叶子节点0不是1是
29
+    private Integer leaf;
30
+
31
+    //所属科目册别关联关系id
32
+    private String lsbid;
33
+
34
+    //章节归属层级
35
+    private Integer directorlevel;
36
+
37
+    //创建人
38
+    private Integer createid;
39
+
40
+    //创建时间
41
+    private Integer createtime;
42
+
43
+    //归属1平台3学校4个人
44
+    private Integer belong;
45
+
46
+    //学校id
47
+    private Integer schoolid;
48
+
49
+    //同步时间戳
50
+    private Integer timeunix;
51
+
52
+    @Transient
53
+    private List<TDirector> children = new ArrayList<>();
54
+}

+ 53
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/model/subjectbook/TPoint.java Dosyayı Görüntüle

@@ -0,0 +1,53 @@
1
+package com.xhkjedu.sstudy.model.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+import java.util.ArrayList;
10
+import java.util.List;
11
+
12
+@Table(name = "t_point")
13
+@Data
14
+public class TPoint extends BaseBean {
15
+    //知识点表
16
+    @Id
17
+    private String pointid;
18
+
19
+    //知识点名称
20
+    private String pointname;
21
+
22
+    //知识点排序
23
+    private Integer pointorder;
24
+
25
+    //所属知识点id
26
+    private String pointpid;
27
+
28
+    //科目id
29
+    private String subjectid;
30
+
31
+    //知识点所属层级
32
+    private Integer pointlevel;
33
+
34
+    //创建人
35
+    private Integer createid;
36
+
37
+    //创建时间
38
+    private Integer createtime;
39
+
40
+    //归属1平台3学校
41
+    private Integer belong;
42
+
43
+    //学校id
44
+    private Integer schoolid;
45
+
46
+    //同步时间戳
47
+    private Integer timeunix;
48
+
49
+    @Transient
50
+    private String createformat;
51
+
52
+    private List<TPoint> children = new ArrayList<>();
53
+}

+ 39
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/model/subjectbook/TSubject.java Dosyayı Görüntüle

@@ -0,0 +1,39 @@
1
+package com.xhkjedu.sstudy.model.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_subject")
10
+@Data
11
+public class TSubject extends BaseBean {
12
+    //科目表主键id
13
+    @Id
14
+    private String subjectid;
15
+
16
+    //科目名称
17
+    private String subjectname;
18
+
19
+    //所属学段1小学2初中3高中4大学
20
+    private Integer level;
21
+
22
+    //科目排序
23
+    private Integer subjectorder;
24
+
25
+    //创建人id
26
+    private Integer createid;
27
+
28
+    //创建时间
29
+    private Integer createtime;
30
+
31
+    //归属1平台3学校
32
+    private Integer belong;
33
+
34
+    //学校id
35
+    private Integer schoolid;
36
+
37
+    //同步时间戳
38
+    private Integer timeunix;
39
+}

+ 57
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/model/subjectbook/TSubjectBook.java Dosyayı Görüntüle

@@ -0,0 +1,57 @@
1
+package com.xhkjedu.sstudy.model.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+
10
+@Table(name = "t_subject_book")
11
+@Data
12
+public class TSubjectBook extends BaseBean {
13
+    //科目教材表
14
+    @Id
15
+    private String lsbid;
16
+
17
+    //所属学段1小学2初中3高中4大学
18
+    private Integer level;
19
+
20
+    //科目id
21
+    private String subjectid;
22
+
23
+    @Transient
24
+    //科目名称
25
+    private String subjectname;
26
+
27
+    //教材名称
28
+    private String lsbname;
29
+
30
+    //教材排序
31
+    private Integer lsborder;
32
+
33
+    //封面图地址
34
+    private String coverpath;
35
+
36
+    //创建时间
37
+    private Integer createid;
38
+
39
+    //创建时间
40
+    private Integer createtime;
41
+
42
+    //版本id
43
+    private String versionid;
44
+
45
+    //归属1平台3学校
46
+    private Integer belong;
47
+
48
+    //同步时间戳
49
+    private Integer timeunix;
50
+
51
+    @Transient
52
+    //版本名称
53
+    private String versionname;
54
+
55
+    //学校id
56
+    private Integer schoolid;
57
+}

+ 42
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/model/subjectbook/TSubjectQuestiontype.java Dosyayı Görüntüle

@@ -0,0 +1,42 @@
1
+package com.xhkjedu.sstudy.model.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_subject_questiontype")
10
+@Data
11
+public class TSubjectQuestiontype extends BaseBean {
12
+    //题型id
13
+    @Id
14
+    private String qtypeid;
15
+
16
+    //题型名称
17
+    private String qtypename;
18
+
19
+    //题型排序
20
+    private Integer qtypeorder;
21
+
22
+    //科目id
23
+    private String subjectid;
24
+
25
+    //处理题型1单选题2多选题3主观题4判断对错5判断✔6判断TF7完形填空8阅读理解
26
+    private Integer ctype;
27
+
28
+    //创建人id
29
+    private Integer createid;
30
+
31
+    //创建时间
32
+    private Integer createtime;
33
+
34
+    //归属1平台3学校
35
+    private Integer belong;
36
+
37
+    //学校id
38
+    private Integer schoolid;
39
+
40
+    //同步时间戳
41
+    private Integer timeunix;
42
+}

+ 36
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/model/subjectbook/TVersion.java Dosyayı Görüntüle

@@ -0,0 +1,36 @@
1
+package com.xhkjedu.sstudy.model.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_version")
10
+@Data
11
+public class TVersion extends BaseBean {
12
+    @Id
13
+    //版本id
14
+    private String versionid;
15
+
16
+    //版本名称
17
+    private String versionname;
18
+
19
+    //版本排序
20
+    private Integer versionorder;
21
+
22
+    //创建人
23
+    private Integer createid;
24
+
25
+    //创建时间
26
+    private Integer createtime;
27
+
28
+    //归属1平台3学校
29
+    private Integer belong;
30
+
31
+    //学校id
32
+    private Integer schoolid;
33
+
34
+    //同步时间戳
35
+    private Integer timeunix;
36
+}

+ 134
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/service/subjectbook/DirectorService.java Dosyayı Görüntüle

@@ -0,0 +1,134 @@
1
+package com.xhkjedu.sstudy.service.subjectbook;
2
+
3
+
4
+import com.xhkjedu.sstudy.mapper.subjectbook.DirectorMapper;
5
+import com.xhkjedu.sstudy.model.subjectbook.TDirector;
6
+import com.xhkjedu.sstudy.utils.StudyUtil;
7
+import com.xhkjedu.utils.N_Utils;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.stereotype.Service;
10
+
11
+import java.util.ArrayList;
12
+import java.util.List;
13
+
14
+/**
15
+ * @ClassName DirectorService
16
+ * Description TODO
17
+ * Author WN
18
+ * Date 2020/6/3 15:59
19
+ **/
20
+@Service
21
+public class DirectorService {
22
+    @Autowired
23
+    private DirectorMapper directorMapper;
24
+
25
+    /**
26
+     *功能描述 新增
27
+     * @author WN
28
+     * @date 2020/6/3
29
+     * @param  * @param director
30
+     * @return java.lang.Integer
31
+     */
32
+    public Integer addDirector(TDirector director){
33
+        String id = StudyUtil.getId();
34
+        director.setDirectorid(id);
35
+        if ("".equals(director.getDirectorpid())) {
36
+            director.setDirectorpid(null);
37
+        }
38
+        director.setCreatetime(N_Utils.getSecondTimestamp());
39
+        return directorMapper.insertSelective(director);
40
+    }
41
+
42
+    /**
43
+     * 添加并返回主键
44
+     * @Param [director]
45
+     * @Author ywx
46
+     * @Date 2020/7/6 15:00
47
+     * @return java.lang.Integer
48
+     **/
49
+    public String addAndReturnKey(TDirector director){
50
+        String id = StudyUtil.getId();
51
+        director.setDirectorid(id);
52
+        director.setCreatetime(N_Utils.getSecondTimestamp());
53
+        directorMapper.insertSelective(director);
54
+        return id;
55
+    }
56
+
57
+    /**
58
+     *功能描述 修改
59
+     * @author WN
60
+     * @date 2020/6/3
61
+     * @param  * @param director
62
+     * @return java.lang.Integer
63
+     */
64
+    public Integer updateDirector(TDirector director){
65
+        director.setCreatetime(N_Utils.getSecondTimestamp());
66
+        return directorMapper.updateByPrimaryKeySelective(director);
67
+    }
68
+
69
+    /**
70
+     *功能描述  删除
71
+     * @author WN
72
+     * @date 2020/6/3
73
+     * @param  * @param director
74
+     * @return java.lang.Integer
75
+     */
76
+    public Integer delDirector(TDirector director){
77
+        return directorMapper.deleteByPrimaryKey(director.getDirectorid());
78
+    }
79
+
80
+    /**
81
+     *功能描述  章节树形结构
82
+     * @author WN
83
+     * @date 2020/6/3
84
+     * @param  * @param director
85
+     * @return java.util.List<com.xhkjedu.model.subjectbook.TDirector>
86
+     */
87
+    public List<TDirector> lisTDirectors(TDirector director){
88
+        List<TDirector> lst = directorMapper.listDirectors(director);
89
+
90
+        List<TDirector> directors = new ArrayList<>();
91
+        for (TDirector d:lst){
92
+            if(d.getDirectorpid() == null){
93
+                List<TDirector> childDirectors = listChildedirector(d,lst);
94
+                d.setChildren(childDirectors);
95
+                directors.add(d);
96
+            }
97
+        }
98
+
99
+        return directors;
100
+    }
101
+
102
+    //获取子章节
103
+    private List<TDirector> listChildedirector(TDirector director,List<TDirector> directors){
104
+        List<TDirector> rtndirectors = new ArrayList<>();
105
+        for(TDirector d : directors){
106
+            if(director.getDirectorid().equals(d.getDirectorpid())){
107
+                List<TDirector> childDirectors = listChildedirector(d,directors);
108
+                d.setChildren(childDirectors);
109
+                rtndirectors.add(d);
110
+            }
111
+        }
112
+        return rtndirectors;
113
+    }
114
+
115
+    /**
116
+     * 教师收藏教材下的章节数量
117
+     * @Param [teacherid, lsbid]
118
+     * @Author ywx
119
+     * @Date 2020/7/8 14:49
120
+     * @return java.lang.Integer
121
+     **/
122
+    public Integer countByTeacherIdLsbId(Integer teacherid, String lsbid) {
123
+        return directorMapper.countByTeacherIdLsbId(teacherid, lsbid);
124
+    }
125
+
126
+    //查找使用章节的模块
127
+    public String findUseModule(String directorid) {
128
+        String useModule = directorMapper.findUseModule(directorid);
129
+        if (useModule.startsWith(",")) {
130
+            useModule = useModule.substring(1);
131
+        }
132
+        return useModule;
133
+    }
134
+}

+ 109
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/service/subjectbook/PointService.java Dosyayı Görüntüle

@@ -0,0 +1,109 @@
1
+package com.xhkjedu.sstudy.service.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.mapper.subjectbook.PointMapper;
4
+import com.xhkjedu.sstudy.model.subjectbook.TPoint;
5
+import com.xhkjedu.sstudy.utils.StudyUtil;
6
+import com.xhkjedu.utils.N_Utils;
7
+import com.xhkjedu.sstudy.vo.subjectbook.PointVo;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.stereotype.Service;
10
+
11
+import java.util.ArrayList;
12
+import java.util.List;
13
+
14
+/**
15
+ * @ClassName PointService
16
+ * Description TODO
17
+ * Author WN
18
+ * Date 2020/6/3 11:56
19
+ **/
20
+@Service
21
+public class PointService {
22
+    @Autowired
23
+    private PointMapper pointMapper;
24
+
25
+    /**
26
+     *功能描述 新增
27
+     * @author WN
28
+     * @date 2020/6/3
29
+     * @param  * @param point
30
+     * @return java.lang.Integer
31
+     */
32
+    public Integer addPoint(TPoint point){
33
+        String id = StudyUtil.getId();
34
+        point.setPointid(id);
35
+        if ("".equals(point.getPointpid())) {
36
+            point.setPointpid(null);
37
+        }
38
+        point.setCreatetime(N_Utils.getSecondTimestamp());
39
+        return pointMapper.insertSelective(point);
40
+    }
41
+
42
+    /**
43
+     *功能描述 修改
44
+     * @author WN
45
+     * @date 2020/6/3
46
+     * @param  * @param point
47
+     * @return java.lang.Integer
48
+     */
49
+    public Integer updatePoint(TPoint point){
50
+        point.setCreatetime(N_Utils.getSecondTimestamp());
51
+        return pointMapper.updateByPrimaryKeySelective(point);
52
+    }
53
+
54
+    /**
55
+     *功能描述  删除
56
+     * @author WN
57
+     * @date 2020/6/3
58
+     * @param  * @param point
59
+     * @return java.lang.Integer
60
+     */
61
+    public Integer delPoint(TPoint point){
62
+        return pointMapper.deleteByPrimaryKey(point.getPointid());
63
+    }
64
+
65
+    //获取科目下知识点数
66
+    public List<TPoint> listPoints(TPoint point){
67
+        List<TPoint> lst = pointMapper.listPoints(point);
68
+
69
+        List<TPoint> points = new ArrayList<>();
70
+        for (TPoint p:lst){
71
+            if(p.getPointpid() == null){
72
+                List<TPoint> childPoints = listChildePoint(p,lst);
73
+                p.setChildren(childPoints);
74
+                points.add(p);
75
+
76
+            }
77
+        }
78
+
79
+        return points;
80
+    }
81
+
82
+    //获取子知识点
83
+    private List<TPoint> listChildePoint(TPoint point,List<TPoint> points){
84
+        List<TPoint> rtnPoints = new ArrayList<>();
85
+        for(TPoint p : points){
86
+            if(point.getPointid().equals(p.getPointpid())){
87
+                List<TPoint> childPoints = listChildePoint(p,points);
88
+                p.setChildren(childPoints);
89
+                rtnPoints.add(p);
90
+            }
91
+        }
92
+        return rtnPoints;
93
+    }
94
+
95
+    //搜索知识点
96
+    public List<PointVo> listPointsForSearch(TPoint point){
97
+        return pointMapper.listPointsForSearch(point);
98
+    }
99
+
100
+    //查找使用知识点的模块
101
+    public String findUseModule(String pointid) {
102
+        String useModule = pointMapper.findUseModule(pointid);
103
+        if (useModule.startsWith(",")) {
104
+            useModule = useModule.substring(1);
105
+        }
106
+        return useModule;
107
+    }
108
+}
109
+

+ 161
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/service/subjectbook/SubjectBookService.java Dosyayı Görüntüle

@@ -0,0 +1,161 @@
1
+package com.xhkjedu.sstudy.service.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.mapper.subjectbook.SubjectBookMapper;
4
+import com.xhkjedu.sstudy.model.subjectbook.TSubjectBook;
5
+import com.xhkjedu.sstudy.utils.StudyUtil;
6
+import com.xhkjedu.utils.N_Utils;
7
+import com.xhkjedu.vo.ResultVo;
8
+import com.xhkjedu.sstudy.vo.subjectbook.LsbBookVo;
9
+import com.xhkjedu.sstudy.vo.subjectbook.LsbSubjectVo;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.stereotype.Service;
12
+
13
+import java.util.ArrayList;
14
+import java.util.List;
15
+import java.util.Map;
16
+
17
+/**
18
+ * @ClassName SubjectBookService
19
+ * Description 教材表
20
+ * Author WN
21
+ * Date 2020/6/2 17:59
22
+ **/
23
+@Service
24
+public class SubjectBookService {
25
+    @Autowired
26
+    private SubjectBookMapper subjectBookMapper;
27
+
28
+    /**
29
+     *功能描述 添加教材
30
+     * @author WN
31
+     * @date 2020/6/2
32
+     * @param  * @param subjectBook
33
+     * @return java.lang.Integer
34
+     */
35
+    public Integer addSubjectBook(TSubjectBook subjectBook){
36
+        String id = StudyUtil.getId();
37
+        subjectBook.setLsbid(id);
38
+        subjectBook.setCreatetime(N_Utils.getSecondTimestamp());
39
+        return subjectBookMapper.insertSelective(subjectBook);
40
+    }
41
+
42
+    /**
43
+     *功能描述 修改教材
44
+     * @author WN
45
+     * @date 2020/6/2
46
+     * @param  * @param subjectBook
47
+     * @return java.lang.Integer
48
+     */
49
+    public ResultVo updateSubjectBook(TSubjectBook subjectBook){
50
+        TSubjectBook book = subjectBookMapper.selectByPrimaryKey(subjectBook.getLsbid());
51
+        String lsbname = subjectBook.getLsbname();
52
+        if (N_Utils.isNotEmpty(lsbname) && !lsbname.equals(book.getLsbname())) {
53
+            book.setLsbname(lsbname);
54
+            Integer num = subjectBookMapper.checkExisted(book);
55
+            if (num != 0) return new ResultVo(1,"教材不能重复");
56
+        }
57
+        subjectBook.setCreatetime(N_Utils.getSecondTimestamp());
58
+        subjectBookMapper.updateByPrimaryKeySelective(subjectBook);
59
+        return new ResultVo(0,"修改成功");
60
+    }
61
+
62
+    /**
63
+     *功能描述 删除教材
64
+     * @author WN
65
+     * @date 2020/6/17
66
+     * @param  * @param subjectBook
67
+     * @return java.lang.Integer
68
+     */
69
+    public Integer delSubjectBook(TSubjectBook subjectBook){
70
+        return subjectBookMapper.deleteByPrimaryKey(subjectBook.getLsbid());
71
+    }
72
+
73
+    /**
74
+     *功能描述  获取教材集合
75
+     * @author WN
76
+     * @date 2020/6/7
77
+     * @param  * @param subjectBook
78
+     * @return java.util.List<com.xhkjedu.model.subjectbook.TSubjectBook>
79
+     */
80
+    public List<TSubjectBook> listSubjectBooks(TSubjectBook subjectBook) {
81
+        List<TSubjectBook> sbooks = subjectBookMapper.listSubjectBooks(subjectBook);
82
+        return sbooks;
83
+    }
84
+
85
+    /**
86
+     *功能描述 所有教材--树形结构
87
+     * @author WN
88
+     * @date 2020/6/3
89
+     * @param  * @param subjectBook
90
+     * @return java.util.List<com.xhkjedu.vo.subjectbook.LsbLevelVo>
91
+     */
92
+    public List<LsbSubjectVo> listSubjectBooksForTree(TSubjectBook subjectBook){
93
+        List<TSubjectBook> sbooks = subjectBookMapper.listSubjectBooks(subjectBook);
94
+
95
+        List<LsbSubjectVo> lst = new ArrayList<>();
96
+        for(TSubjectBook sb : sbooks){
97
+            if(!isExistSubject(lst,sb.getSubjectid())){
98
+                LsbSubjectVo s = new LsbSubjectVo();
99
+                s.setLsbid(sb.getLsbid());
100
+                s.setSubjectid(sb.getSubjectid());
101
+                s.setSubjectname(sb.getSubjectname());
102
+                lst.add(s);
103
+
104
+                LsbBookVo b = new LsbBookVo();
105
+                b.setLsbid(sb.getLsbid());
106
+                b.setLsbname(sb.getLsbname());
107
+                b.setVersionid(sb.getVersionid());
108
+                b.setVersionname(sb.getVersionname());
109
+
110
+                s.getBooks().add(b);
111
+            }else{
112
+                LsbSubjectVo s = lst.get(lst.size()-1);
113
+                if(!isExistBook(s.getBooks(),sb.getLsbid())){
114
+                    LsbBookVo b = new LsbBookVo();
115
+                    b.setLsbid(sb.getLsbid());
116
+                    b.setLsbname(sb.getLsbname());
117
+                    b.setVersionid(sb.getVersionid());
118
+                    b.setVersionname(sb.getVersionname());
119
+
120
+                    s.getBooks().add(b);
121
+                }
122
+            }
123
+        }
124
+
125
+        return lst;
126
+
127
+    }
128
+    //判断是否存在科目
129
+    private boolean isExistSubject(List<LsbSubjectVo> subjects,String subjectid){
130
+        for(int i=0;i<subjects.size();i++){
131
+            if(subjects.get(i).getSubjectid().equals(subjectid)){
132
+                return true;
133
+            }
134
+        }
135
+        return false;
136
+    }
137
+
138
+    //判断结合中是否存在册别
139
+    private boolean isExistBook(List<LsbBookVo> books, String lsbid){
140
+        for(int i=0;i<books.size();i++){
141
+            if(books.get(i).getLsbid().equals(lsbid)){
142
+                return true;
143
+            }
144
+        }
145
+        return false;
146
+    }
147
+
148
+    //查找使用教材的模块
149
+    public String findUseModule(String lsbid) {
150
+        String useModule = subjectBookMapper.findUseModule(lsbid);
151
+        if (useModule.startsWith(",")) {
152
+            useModule = useModule.substring(1);
153
+        }
154
+        return useModule;
155
+    }
156
+
157
+    //教材选择列表
158
+    public List<Map> listForSel() {
159
+        return subjectBookMapper.listForSel();
160
+    }
161
+}

+ 92
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/service/subjectbook/SubjectQuestiontypeService.java Dosyayı Görüntüle

@@ -0,0 +1,92 @@
1
+package com.xhkjedu.sstudy.service.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.mapper.subjectbook.SubjectQuestiontypeMapper;
4
+import com.xhkjedu.sstudy.model.subjectbook.TSubjectQuestiontype;
5
+import com.xhkjedu.sstudy.utils.StudyUtil;
6
+import com.xhkjedu.utils.N_Utils;
7
+import com.xhkjedu.sstudy.vo.subjectbook.SubjectQuestiontypeVo;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.stereotype.Service;
10
+
11
+import java.util.List;
12
+
13
+/**
14
+ * @ClassName SubjectQuestiontypeService
15
+ * Description TODO
16
+ * Author WN
17
+ * Date 2020/6/2 11:57
18
+ **/
19
+@Service
20
+public class SubjectQuestiontypeService {
21
+    @Autowired
22
+    private SubjectQuestiontypeMapper subjectQuestiontypeMapper;
23
+
24
+    /**
25
+     *功能描述 获取科目下所有题型
26
+     * @author WN
27
+     * @date 2020/6/2
28
+     * @param  * @param sqtype
29
+     * @return java.util.List<com.xhkjedu.model.subjectbook.TSubjectQuestiontype>
30
+     */
31
+    public List<TSubjectQuestiontype> listQuestiontypes(TSubjectQuestiontype sqtype){
32
+        return subjectQuestiontypeMapper.listQuestiontypes(sqtype);
33
+    }
34
+
35
+    /**
36
+     *功能描述 获取科目下所有题型用于选择数据
37
+     * @author WN
38
+     * @date 2020/6/2
39
+     * @param  * @param sqtype
40
+     * @return java.util.List<com.xhkjedu.vo.subjectbook.SubjectQuestiontypeVo>
41
+     */
42
+    public List<SubjectQuestiontypeVo> listQuestiontypesForSel(TSubjectQuestiontype sqtype){
43
+        return subjectQuestiontypeMapper.listQuestiontypesForSel(sqtype);
44
+    }
45
+
46
+    /**
47
+     *功能描述 添加题型
48
+     * @author WN
49
+     * @date 2020/6/2
50
+     * @param  * @param sqtype
51
+     * @return java.lang.Integer
52
+     */
53
+    public Integer addQuestiontype(TSubjectQuestiontype sqtype){
54
+        String id = StudyUtil.getId();
55
+        sqtype.setQtypeid(id);
56
+        sqtype.setCreatetime(N_Utils.getSecondTimestamp());
57
+        return subjectQuestiontypeMapper.insertSelective(sqtype);
58
+    }
59
+
60
+   /**
61
+    *功能描述 修改题型
62
+    * @author WN
63
+    * @date 2020/6/2
64
+    * @param  * @param sqtype
65
+    * @return java.lang.Integer
66
+    */
67
+    public Integer updateQuestiontype(TSubjectQuestiontype sqtype){
68
+        sqtype.setCreatetime(N_Utils.getSecondTimestamp());
69
+        return subjectQuestiontypeMapper.updateByPrimaryKeySelective(sqtype);
70
+    }
71
+
72
+    /**
73
+     *功能描述 修改题型
74
+     * @author WN
75
+     * @date 2020/6/2
76
+     * @param  * @param sqtype
77
+     * @return java.lang.Integer
78
+     */
79
+    public Integer delQuestiontype(TSubjectQuestiontype sqtype){
80
+        int result = subjectQuestiontypeMapper.deleteByPrimaryKey(sqtype.getQtypeid());
81
+        return result;
82
+    }
83
+
84
+    //查找使用题型的模块
85
+    public String findUseModule(String qtypeid) {
86
+        String useModule = subjectQuestiontypeMapper.findUseModule(qtypeid);
87
+        if (useModule.startsWith(",")) {
88
+            useModule = useModule.substring(1);
89
+        }
90
+        return useModule;
91
+    }
92
+}

+ 116
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/service/subjectbook/SubjectService.java Dosyayı Görüntüle

@@ -0,0 +1,116 @@
1
+package com.xhkjedu.sstudy.service.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.mapper.subjectbook.SubjectMapper;
4
+import com.xhkjedu.sstudy.model.subjectbook.TSubject;
5
+import com.xhkjedu.sstudy.utils.StudyUtil;
6
+import com.xhkjedu.utils.N_Utils;
7
+import com.xhkjedu.sstudy.vo.subjectbook.SubjectVo;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.stereotype.Service;
10
+
11
+import java.util.List;
12
+
13
+
14
+/**
15
+ * @ClassName SubjectService
16
+ * Description
17
+ * Author WN
18
+ * Date 2020/6/1 11:44
19
+ **/
20
+@Service
21
+public class SubjectService {
22
+    @Autowired
23
+    private SubjectMapper subjectMapper;
24
+
25
+
26
+    /**
27
+     *功能描述  获取阶段下科目
28
+     * @author WN
29
+     * @date 2020/6/1
30
+     * @param  * @param subject
31
+     * @return java.util.List<com.xhkjedu.model.subjectbook.TSubject>
32
+     */
33
+    public List<TSubject> listSubjects(TSubject subject){
34
+        return subjectMapper.listSubjects(subject);
35
+    }
36
+
37
+    /**
38
+     *功能描述 获取阶段下科目--选择框
39
+     * @author WN
40
+     * @date 2020/6/1
41
+     * @param  * @param subject
42
+     * @return java.util.List<com.xhkjedu.vo.subjectbook.SubjectVo>
43
+     */
44
+    public List<SubjectVo> listSubjectsForSel(TSubject subject){
45
+        return subjectMapper.listSubjectsForSel(subject);
46
+    }
47
+
48
+    /**
49
+     *功能描述  保存科目
50
+     * @author WN
51
+     * @date 2020/6/1
52
+     * @param  * @param subject
53
+     * @return java.lang.Integer
54
+     */
55
+    public Integer addSubject(TSubject subject){
56
+        String id = StudyUtil.getId();
57
+        subject.setSubjectid(id);
58
+        subject.setCreatetime(N_Utils.getSecondTimestamp());
59
+        return subjectMapper.insertSelective(subject);
60
+    }
61
+
62
+    /**
63
+     *功能描述 修改科目
64
+     * @author WN
65
+     * @date 2020/6/1
66
+     * @param  * @param subject
67
+     * @return java.lang.Integer
68
+     */
69
+    public Integer updateSubject(TSubject subject){
70
+        subject.setCreatetime(N_Utils.getSecondTimestamp());
71
+        return subjectMapper.updateByPrimaryKeySelective(subject);
72
+    }
73
+
74
+    /**
75
+     *功能描述 删除科目
76
+     * @author WN
77
+     * @date 2020/6/1
78
+     * @param  * @param subject
79
+     * @return java.lang.Integer
80
+     */
81
+    public Integer delSubject(TSubject subject){
82
+        int result = subjectMapper.deleteByPrimaryKey(subject.getSubjectid());
83
+        return result;
84
+    }
85
+
86
+    /**
87
+     * 根据学段id获取科目id集合
88
+     * @Param [level]
89
+     * @Author ywx
90
+     * @Date 2020/6/8 9:59
91
+     * @return java.lang.String
92
+     **/
93
+    public String getSubjectIds(Integer level) {
94
+        return subjectMapper.getSubjectIds(level);
95
+    }
96
+
97
+    /**
98
+     * 教师科目集合
99
+     * @Param [teacherid]
100
+     * @Author ywx
101
+     * @Date 2020/6/28 9:33
102
+     * @return java.util.List<com.xhkjedu.model.subjectbook.TSubject>
103
+     **/
104
+    public List<TSubject> listTeacherSubjects(Integer teacherid) {
105
+        return subjectMapper.listTeacherSubjects(teacherid);
106
+    }
107
+
108
+    //查找使用科目的模块
109
+    public String findUseModule(String subjectid) {
110
+        String useModule = subjectMapper.findUseModule(subjectid);
111
+        if (useModule.startsWith(",")) {
112
+            useModule = useModule.substring(1);
113
+        }
114
+        return useModule;
115
+    }
116
+}

+ 76
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/service/subjectbook/VersionService.java Dosyayı Görüntüle

@@ -0,0 +1,76 @@
1
+package com.xhkjedu.sstudy.service.subjectbook;
2
+
3
+import com.xhkjedu.sstudy.mapper.subjectbook.VersionMapper;
4
+import com.xhkjedu.sstudy.model.subjectbook.TVersion;
5
+import com.xhkjedu.sstudy.utils.StudyUtil;
6
+import com.xhkjedu.utils.N_Utils;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.stereotype.Service;
9
+
10
+import java.util.List;
11
+
12
+
13
+/**
14
+ * @ClassName SubjectService
15
+ * Description TODO 教材版本
16
+ * Author WN
17
+ * Date 2020/6/1 11:44
18
+ **/
19
+@Service
20
+public class VersionService {
21
+    @Autowired
22
+    private VersionMapper versionMapper;
23
+
24
+   /**
25
+    *功能描述 版本--列表
26
+    * @author WN
27
+    * @date 2020/6/2
28
+    * @param version
29
+    */
30
+    public List<TVersion> listVersions(TVersion version){
31
+        return versionMapper.listVersions(version);
32
+    }
33
+
34
+   /**
35
+    *功能描述 版本--添加
36
+    * @author WN
37
+    * @date 2020/6/2
38
+    * @param  * @param version
39
+    * @return java.lang.Integer
40
+    */
41
+    public Integer addVersion(TVersion version){
42
+        String id = StudyUtil.getId();
43
+        version.setVersionid(id);
44
+        version.setCreatetime(N_Utils.getSecondTimestamp());
45
+        return versionMapper.insertSelective(version);
46
+    }
47
+
48
+    /**
49
+     *功能描述 版本--修改
50
+     * @author WN
51
+     * @date 2020/6/2
52
+     * @param  * @param version
53
+     * @return java.lang.Integer
54
+     */
55
+    public Integer updateVersion(TVersion version){
56
+        version.setCreatetime(N_Utils.getSecondTimestamp());
57
+        return versionMapper.updateByPrimaryKeySelective(version);
58
+    }
59
+
60
+   /**
61
+    *功能描述  版本--删除
62
+    * @author WN
63
+    * @date 2020/6/2
64
+    * @param  * @param version
65
+    * @return java.lang.Integer
66
+    */
67
+    public Integer delVersion(TVersion version){
68
+        return versionMapper.deleteByPrimaryKey(version.getVersionid());
69
+    }
70
+
71
+    //查找使用版本的模块
72
+    public String findUseModule(String versionid) {
73
+        return versionMapper.findUseModule(versionid);
74
+    }
75
+
76
+}

+ 106
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/utils/JedisUtil.java Dosyayı Görüntüle

@@ -0,0 +1,106 @@
1
+package com.xhkjedu.sstudy.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
+		return get(key, NOT_EXPIRE);
77
+	}
78
+
79
+	public Object getObject(String key,Class<?> clazz) {
80
+		String value = get(key);
81
+		return fromJson(value,clazz);
82
+	}
83
+
84
+	public boolean delete(String key) {
85
+		return stringRedisTemplate.delete(key);
86
+	}
87
+
88
+	/**
89
+	 * Object转成JSON数据
90
+	 */
91
+	private String toJson(Object object){
92
+		if(object instanceof Integer || object instanceof Long || object instanceof Float ||
93
+				object instanceof Double || object instanceof Boolean || object instanceof String){
94
+			return String.valueOf(object);
95
+		}
96
+		return JSON.toJSONString(object);
97
+	}
98
+
99
+	/**
100
+	 * JSON数据,转成Object
101
+	 */
102
+	private <T> T fromJson(String json, Class<T> clazz){
103
+		return JSON.parseObject(json, clazz);
104
+	}
105
+
106
+}

+ 29
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/utils/StudyUtil.java Dosyayı Görüntüle

@@ -0,0 +1,29 @@
1
+package com.xhkjedu.sstudy.utils;
2
+
3
+import com.xhkjedu.sstudy.config.ConfigKey;
4
+import lombok.extern.slf4j.Slf4j;
5
+
6
+import static com.xhkjedu.utils.N_Utils.getSecondTimestamp;
7
+
8
+/**
9
+ * @ClassName StudyUtil
10
+ * Description study模块用到的工具类
11
+ * Author WN
12
+ * Date 2022/2/21 10:01
13
+ **/
14
+@Slf4j
15
+public class StudyUtil {
16
+    public static Integer id = 0;
17
+    public static String getId(){
18
+        Integer nummin = ConfigKey.nummin;
19
+        Integer nummax = ConfigKey.nummax;
20
+        if (id == 0 || id.equals(nummax)) {
21
+            id = nummin;
22
+        } else {
23
+            id ++;
24
+        }
25
+        String _num = (getSecondTimestamp() + ConfigKey.numadd) +"" + id;
26
+        long num = Long.parseLong(_num);
27
+        return Long.toString(num,36).toUpperCase();
28
+    }
29
+}

+ 30
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/DirectorVo.java Dosyayı Görüntüle

@@ -0,0 +1,30 @@
1
+package com.xhkjedu.sstudy.vo.subjectbook;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class DirectorVo {
7
+    //章节id
8
+    private String directorid;
9
+
10
+    //章节名称
11
+    private String directorname;
12
+
13
+    //所属学段1小学2初中3高中4大学
14
+    private Integer level;
15
+
16
+    //科目id
17
+    private String subjectid;
18
+
19
+    //科目名称
20
+    private String subjectname;
21
+
22
+    //版本名称
23
+    private String versionname;
24
+
25
+    //教材名称
26
+    private String lsbname;
27
+
28
+    //教材id
29
+    private String lsbid;
30
+}

+ 24
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/LevelSubjectVo.java Dosyayı Görüntüle

@@ -0,0 +1,24 @@
1
+package com.xhkjedu.sstudy.vo.subjectbook;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.ArrayList;
6
+import java.util.List;
7
+
8
+/**
9
+ * @ClassName LevelSubjectVo
10
+ * Description 学段科目
11
+ * Author WN
12
+ * Date 2020/6/2 16:54
13
+ **/
14
+@Data
15
+public class LevelSubjectVo {
16
+    //学段
17
+    private Integer level;
18
+
19
+    //学段名称
20
+    private String levelname;
21
+
22
+    //学段下科目
23
+    private List<SubjectVo> subjects = new ArrayList<>();
24
+}

+ 26
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/LsbBookVo.java Dosyayı Görüntüle

@@ -0,0 +1,26 @@
1
+package com.xhkjedu.sstudy.vo.subjectbook;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @ClassName LsbBookVo
7
+ * Description 教材--册别
8
+ * Author WN
9
+ * Date 2020/6/3 10:17
10
+ **/
11
+@Data
12
+public class LsbBookVo {
13
+
14
+    //教材id
15
+    private String lsbid;
16
+
17
+    //教材名称
18
+    private String lsbname;
19
+
20
+    //版本id
21
+    private String versionid;
22
+
23
+    //版本名称
24
+    private String versionname;
25
+
26
+}

+ 25
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/LsbLevelVo.java Dosyayı Görüntüle

@@ -0,0 +1,25 @@
1
+package com.xhkjedu.sstudy.vo.subjectbook;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.ArrayList;
6
+import java.util.List;
7
+
8
+/**
9
+ * @ClassName LsbLevelVo
10
+ * Description 教材--阶段
11
+ * Author WN
12
+ * Date 2020/6/3 10:16
13
+ **/
14
+@Data
15
+public class LsbLevelVo {
16
+    //阶段
17
+    private Integer Level;
18
+
19
+    //阶段名称
20
+    private String levelname;
21
+
22
+    //阶段下科目
23
+    private List<LsbSubjectVo> subjects = new ArrayList<>();
24
+
25
+}

+ 28
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/LsbSubjectVo.java Dosyayı Görüntüle

@@ -0,0 +1,28 @@
1
+package com.xhkjedu.sstudy.vo.subjectbook;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.ArrayList;
6
+import java.util.List;
7
+
8
+/**
9
+ * @ClassName LsbSubjectVo
10
+ * Description 教材--科目
11
+ * Author WN
12
+ * Date 2020/6/3 10:19
13
+ **/
14
+@Data
15
+public class LsbSubjectVo {
16
+
17
+    //教材id
18
+    private String lsbid;
19
+
20
+    //科目id
21
+    private String subjectid;
22
+
23
+    //科目名称
24
+    private String subjectname;
25
+
26
+    //册别
27
+    private List<LsbBookVo> books = new ArrayList<>();
28
+}

+ 12
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/LsbVo.java Dosyayı Görüntüle

@@ -0,0 +1,12 @@
1
+package com.xhkjedu.sstudy.vo.subjectbook;
2
+
3
+/**
4
+ * @ClassName LsbVo
5
+ * Description TODO
6
+ * Author WN
7
+ * Date 2020/6/18 16:39
8
+ **/
9
+public class LsbVo {
10
+    private String lsbid;//教材id
11
+    private String lsbname;//教材名称
12
+}

+ 12
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/PointVo.java Dosyayı Görüntüle

@@ -0,0 +1,12 @@
1
+package com.xhkjedu.sstudy.vo.subjectbook;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class PointVo {
7
+    //知识点id
8
+    private String pointid;
9
+
10
+    //知识点名称
11
+    private String pointname;
12
+}

+ 27
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/SubjectQuestiontypeVo.java Dosyayı Görüntüle

@@ -0,0 +1,27 @@
1
+package com.xhkjedu.sstudy.vo.subjectbook;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @ClassName SubjectQuestiontypeVo
7
+ * Description 科目题型
8
+ * Author WN
9
+ * Date 2020/6/2 11:48
10
+ **/
11
+@Data
12
+public class SubjectQuestiontypeVo {
13
+    //题型id
14
+    private String qtypeid;
15
+
16
+    //题型名称
17
+    private String qtypename;
18
+
19
+    //题型排序
20
+    private Integer qtypeorder;
21
+
22
+    //处理题型1单选题2多选题3主观题4判断对错5判断✔6判断TF7完形填空8阅读理解
23
+    private Integer ctype;
24
+
25
+    //归属1平台3学校
26
+    private Integer belong;
27
+}

+ 22
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/SubjectVo.java Dosyayı Görüntüle

@@ -0,0 +1,22 @@
1
+package com.xhkjedu.sstudy.vo.subjectbook;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @ClassName SubjectVo
7
+ * Description
8
+ * Author WN
9
+ * Date 2020/6/1 17:58
10
+ **/
11
+@Data
12
+public class SubjectVo {
13
+    //科目id
14
+    private String subjectid;
15
+
16
+    //科目名称
17
+    private String subjectname;
18
+
19
+    //归属1平台3学校
20
+    private Integer belong;
21
+
22
+}

+ 19
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/TeacherClassVo.java Dosyayı Görüntüle

@@ -0,0 +1,19 @@
1
+package com.xhkjedu.sstudy.vo.subjectbook;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @author ywx
7
+ * @classname TeacherClassVo
8
+ * @description
9
+ * @date 2021/1/29 16:49
10
+ **/
11
+@Data
12
+public class TeacherClassVo {
13
+    //班级id
14
+    private Integer classid;
15
+
16
+    //班级名称
17
+    private String classname;
18
+
19
+}

+ 27
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/subjectbook/TeacherSClassVo.java Dosyayı Görüntüle

@@ -0,0 +1,27 @@
1
+package com.xhkjedu.sstudy.vo.subjectbook;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+/**
8
+ * @author ywx
9
+ * @classname TeacherSClassVo
10
+ * @description
11
+ * @date 2021/1/29 16:43
12
+ **/
13
+@Data
14
+public class TeacherSClassVo {
15
+    //科目id
16
+    private String subjectid;
17
+
18
+    //年级id
19
+    private Integer gradeid;
20
+
21
+    //教材列表
22
+    private List<LsbBookVo> books;
23
+
24
+    //班级列表
25
+    private List<TeacherClassVo> classes;
26
+
27
+}

+ 22
- 2
sstudy/src/main/resources/application.properties Dosyayı Görüntüle

@@ -3,7 +3,7 @@ server.port=8087
3 3
 
4 4
 spring.application.name=sstudy
5 5
 #注册到我们本地的eureka注册中心,端口8081
6
-eureka.client.service-url.defaultZone=http://localhost:8081/eureka/
6
+#eureka.client.service-url.defaultZone=http://localhost:8081/eureka/
7 7
 
8 8
 spring.datasource.url=jdbc:mysql://dbtest.xhkjedu.com:13306/xhkjedu_school_test?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true&allowMultiQueries=true
9 9
 spring.datasource.username=root
@@ -29,13 +29,14 @@ spring.datasource.hikari.connection-test-query=SELECT 1
29 29
 # 所有Entity别名类所在包
30 30
 mybatis.type-aliases-package=com.xhkjedu.model,com.xhkjedu.vo
31 31
 mybatis.mapper-Locations=classpath*:mapper/**/*.xml
32
-mapper.mappers=com.xhkjedu.base.TkMapper
32
+mapper.mappers=com.xhkjedu.sstudy.base.TkMapper
33 33
 mapper.identity=MYSQL
34 34
 #打印日志的两种方式第一种可以指定包名,第二种都可以打印
35 35
 logging.level.com.xhkjedu.mapper=debug
36 36
 #mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
37 37
 #分页
38 38
 spring.pagehelper.helper-dialect=mysql
39
+spring.datasource.initialize=false
39 40
 
40 41
 #redis配置
41 42
 spring.redis.host=cachetest.xhkjedu.com
@@ -52,3 +53,22 @@ spring.redis.jedis.pool.max-active=60000
52 53
 redisdatatime=604800
53 54
 #secretKey必须为24位
54 55
 secretKey=nanhuakaizhangjianwangni
56
+
57
+#生成id的数值区间
58
+nummin=10000
59
+nummax=50000
60
+numadd=100000000
61
+
62
+#云平台接口地址
63
+cloudapi=http://scapitest.xhkjedu.com/
64
+#云平台文件访问路径
65
+file.oldshowurl=http://scstatictest.xhkjedu.com/static/
66
+#区平台文件服务接口地址
67
+fileapi=https://schoolfiletest.xhkjedu.com/
68
+#区平台文件访问路径
69
+file.showurl=http://schoolstatictest.xhkjedu.com/static/
70
+#数据库名
71
+dbname=xhkjedu_school_test
72
+
73
+#一次同步数量
74
+cron.syncnum=100

+ 34
- 0
sstudy/src/main/resources/mapper/subjectbook/DirectorMapper.xml Dosyayı Görüntüle

@@ -0,0 +1,34 @@
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.sstudy.mapper.subjectbook.DirectorMapper">
4
+
5
+    <!-- 根据科目获取章节-->
6
+    <select id="listDirectors" resultType="com.xhkjedu.sstudy.model.subjectbook.TDirector">
7
+       SELECT d.directorid,d.directorname,d.directorpid,d.directororder,d.leaf,d.lsbid,d.belong,
8
+        d.directorlevel,d.createid,d.createtime,u.username AS createname
9
+        FROM t_director d LEFT JOIN t_user u ON d.createid=u.userid
10
+        WHERE d.lsbid=#{director.lsbid}
11
+        <if test="director.belong!=null and director.belong==1">
12
+            and d.belong=1
13
+        </if>
14
+        <if test="director.belong!=null and director.belong==3">
15
+            and (d.belong=1 or (d.belong=3 and d.schoolid=#{director.schoolid}))
16
+        </if>
17
+        <if test="director.belong!=null and director.belong==4">
18
+            and d.belong=4 and d.createid=#{director.createid}
19
+        </if>
20
+        ORDER BY d.directororder ASC,d.createtime asc
21
+    </select>
22
+    <!--教师收藏教材下的章节数量-->
23
+    <select id="countByTeacherIdLsbId" resultType="java.lang.Integer">
24
+        select count(*) from t_director where createid=#{teacherid} and lsbid=#{lsbid} and belong=4
25
+    </select>
26
+    <!--查找使用章节的模块-->
27
+    <select id="findUseModule" resultType="java.lang.String">
28
+        SELECT CONCAT(
29
+        (select (case when count(*)>0 then '子章节' else '' end) from t_director where directorpid=#{directorid})
30
+        ,(select (case when count(*)>0 then ',试题' else '' end) from t_question_director where directorid=#{directorid})
31
+        ,(select (case when count(*)>0 then ',资源' else '' end) from t_resource_director where directorid=#{directorid})
32
+        )
33
+    </select>
34
+</mapper>

+ 38
- 0
sstudy/src/main/resources/mapper/subjectbook/PointMapper.xml Dosyayı Görüntüle

@@ -0,0 +1,38 @@
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.sstudy.mapper.subjectbook.PointMapper">
4
+
5
+    <!-- 根据科目获取知识点 -->
6
+    <select id="listPoints" resultType="com.xhkjedu.sstudy.model.subjectbook.TPoint">
7
+        SELECT p.pointid,p.pointname,p.pointorder,p.pointpid,p.subjectid,p.pointlevel,p.createid,
8
+        p.createtime,u.username AS createname,p.belong
9
+        FROM t_point p LEFT JOIN t_user u ON p.createid=u.userid
10
+        WHERE p.subjectid=#{point.subjectid} and (p.belong=1
11
+        <if test="point.schoolid!=null">
12
+            or p.schoolid=#{point.schoolid}
13
+        </if>)
14
+        ORDER BY p.pointorder asc,p.createtime asc
15
+    </select>
16
+
17
+    <!-- 根据知识点名称搜索知识点,用户选择 -->
18
+    <select id="listPointsForSearch" resultType="com.xhkjedu.sstudy.vo.subjectbook.PointVo">
19
+        select p.pointid,p.pointname from t_point p left join t_point p1 on p1.pointpid=p.pointid
20
+        where p.subjectid=#{point.subjectid} and p1.pointid is null
21
+        and (p.belong=1
22
+        <if test="point.schoolid!=null">
23
+            or p.schoolid=#{point.schoolid}
24
+        </if>)
25
+         <if test="point.pointname!='' and point.pointname!=null">
26
+             and p.pointname like '%${point.pointname}%'
27
+         </if>
28
+    </select>
29
+
30
+    <!--查找使用知识点的模块-->
31
+    <select id="findUseModule" resultType="java.lang.String">
32
+        SELECT CONCAT(
33
+        (select (case when count(*)>0 then '子知识点' else '' end) from t_point where pointpid=#{pointid})
34
+        ,(select (case when count(*)>0 then ',试题' else '' end) from t_question_point where pointid=#{pointid})
35
+        )
36
+    </select>
37
+
38
+</mapper>

+ 65
- 0
sstudy/src/main/resources/mapper/subjectbook/SubjectBookMapper.xml Dosyayı Görüntüle

@@ -0,0 +1,65 @@
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.sstudy.mapper.subjectbook.SubjectBookMapper">
4
+
5
+    <select id="listSubjectBooks" resultType="com.xhkjedu.sstudy.model.subjectbook.TSubjectBook">
6
+        SELECT sb.lsbid,sb.level,sb.subjectid,sb.coverpath,s.subjectname,sb.lsbname,sb.createtime
7
+        ,sb.versionid,v.versionname,sb.lsborder,sb.belong
8
+        ,(select u.username from t_user u where u.userid=sb.createid)createname
9
+        FROM t_subject_book sb LEFT JOIN t_subject s ON sb.subjectid=s.subjectid
10
+        LEFT JOIN t_version v ON sb.versionid=v.versionid
11
+        WHERE sb.level=#{book.level} and (sb.belong=1
12
+        <if test="book.schoolid!=null">
13
+            or sb.schoolid=#{book.schoolid}
14
+        </if>
15
+        )
16
+        <if test="book.subjectid!=null and book.subjectid!='0'.toString() and book.subjectid!=''">
17
+            and sb.subjectid=#{book.subjectid}
18
+        </if>
19
+        <if test="book.versionid!=null and book.versionid!='0'.toString() and book.versionid!=''">
20
+            and sb.versionid=#{book.versionid}
21
+        </if>
22
+        ORDER BY s.subjectorder ASC,v.versionorder,sb.lsborder
23
+    </select>
24
+
25
+    <!--查找使用教材的模块-->
26
+    <select id="findUseModule" resultType="java.lang.String">
27
+        SELECT CONCAT(
28
+        (select (case when count(*)>0 then '章节' else '' end) from t_director where lsbid=#{lsbid})
29
+        ,(select (case when count(*)>0 then ',试题' else '' end) from t_question_director where lsbid=#{lsbid})
30
+        ,(select (case when count(*)>0 then ',资源' else '' end) from t_resource_director where lsbid=#{lsbid})
31
+        ,(select (case when count(*)>0 then ',作业' else '' end) from t_paper where lsbid=#{lsbid})
32
+        ,(select (case when count(*)>0 then ',课堂' else '' end) from t_classroom where lsbid=#{lsbid})
33
+        ,(select (case when count(*)>0 then ',课堂考试' else '' end) from t_classroom_paper where lsbid=#{lsbid})
34
+        )
35
+    </select>
36
+
37
+    <!--教材选择列表-->
38
+    <resultMap id="lsbResult" type="java.util.Map">
39
+        <result property="level" column="level"></result>
40
+        <collection property="subjects" ofType="java.util.Map" javaType="java.util.List">
41
+            <result property="subjectid" column="subjectid"></result>
42
+            <result property="subjectname" column="subjectname"></result>
43
+            <collection property="versions" ofType="java.util.Map" javaType="java.util.List">
44
+                <result property="versionid" column="versionid"></result>
45
+                <result property="versionname" column="versionname"></result>
46
+                <collection property="lsbs" ofType="java.util.Map" javaType="java.util.List">
47
+                    <result property="lsbid" column="lsbid"></result>
48
+                    <result property="lsbname" column="lsbname"></result>
49
+                    <result property="coverpath" column="coverpath"></result>
50
+                </collection>
51
+            </collection>
52
+        </collection>
53
+    </resultMap>
54
+    <select id="listForSel" resultMap="lsbResult">
55
+        select sb.level,sb.subjectid,s.subjectname,sb.versionid,v.versionname,sb.lsbname,sb.lsbid,sb.coverpath
56
+        from t_subject_book sb left join t_subject s on sb.subjectid=s.subjectid
57
+        left join t_version v on sb.versionid=v.versionid
58
+        order by sb.level,s.subjectorder asc,v.versionorder asc,sb.lsborder
59
+    </select>
60
+    <!--查询教材名称是否存在-->
61
+    <select id="checkExisted" resultType="java.lang.Integer">
62
+        select count(*) from t_subject_book where level=#{book.level} and subjectid=#{book.subjectid}
63
+        and versionid=#{book.versionid} and lsbname=#{book.lsbname}
64
+    </select>
65
+</mapper>

+ 70
- 0
sstudy/src/main/resources/mapper/subjectbook/SubjectMapper.xml Dosyayı Görüntüle

@@ -0,0 +1,70 @@
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.sstudy.mapper.subjectbook.SubjectMapper">
4
+
5
+    <!-- 根据阶段获取科目 -->
6
+    <select id="listSubjects" resultType="com.xhkjedu.sstudy.model.subjectbook.TSubject">
7
+        SELECT s.subjectid,s.subjectname,s.level,s.subjectorder,s.createid,s.createtime,
8
+        u.username AS createname,s.belong
9
+        FROM t_subject s LEFT JOIN t_user u ON s.createid=u.userid
10
+        WHERE s.level=#{subject.level} and (s.belong=1
11
+        <if test="subject.schoolid!=null">
12
+            or s.schoolid=#{subject.schoolid}
13
+        </if>
14
+        )
15
+        order by s.subjectorder asc
16
+    </select>
17
+
18
+    <!-- 根据阶段获取科目用于选择学科 -->
19
+    <select id="listSubjectsForSel" resultType="com.xhkjedu.sstudy.vo.subjectbook.SubjectVo">
20
+        SELECT subjectid,subjectname,belong from t_subject
21
+        WHERE level=#{subject.level} and (belong=1
22
+        <if test="subject.schoolid!=null">
23
+            or schoolid=#{subject.schoolid}
24
+        </if>
25
+        ) order by subjectorder asc
26
+    </select>
27
+    <!--获取科目名称-->
28
+    <select id="getNameById" resultType="java.lang.String">
29
+        select subjectname from t_subject where subjectid=#{subjectid}
30
+    </select>
31
+
32
+    <!--根据学段id获取科目id集合-->
33
+    <select id="getSubjectIds" resultType="java.lang.String">
34
+        select group_concat(subjectid) from t_subject where level=#{level}
35
+    </select>
36
+    <!--教师科目集合-->
37
+    <select id="listTeacherSubjects" resultType="com.xhkjedu.sstudy.model.subjectbook.TSubject">
38
+        select sb.subjectid,s.subjectname,sb.belong
39
+        from t_teacher_powersb ts left join t_subject_book sb on ts.lsbid=sb.lsbid
40
+        left join t_subject s on sb.subjectid=s.subjectid
41
+        where ts.teacherid=#{teacherid} and (sb.belong=1 or sb.schoolid=ts.schoolid)
42
+        group by sb.subjectid order by s.subjectorder
43
+    </select>
44
+
45
+    <!--查找使用科目的模块-->
46
+    <select id="findUseModule" resultType="java.lang.String">
47
+        SELECT CONCAT(
48
+        (select (case when count(*)>0 then '教材' else '' end) from t_subject_book where subjectid=#{subjectid})
49
+        ,(select (case when count(*)>0 then ',知识点' else '' end) from t_point where subjectid=#{subjectid})
50
+        ,(select (case when count(*)>0 then ',题型' else '' end) from t_subject_questiontype where subjectid=#{subjectid})
51
+        ,(select (case when count(*)>0 then ',试题' else '' end) from t_question where subjectid=#{subjectid})
52
+        ,(select (case when count(*)>0 then ',资源' else '' end) from t_resource where subjectid=#{subjectid})
53
+        ,(select (case when count(*)>0 then ',作业' else '' end) from t_paper where subjectid=#{subjectid})
54
+        ,(select (case when count(*)>0 then ',背诵' else '' end) from t_recite where subjectid=#{subjectid})
55
+        ,(select (case when count(*)>0 then ',学生错题' else '' end) from t_question_student where subjectid=#{subjectid})
56
+        ,(select (case when count(*)>0 then ',直播' else '' end) from l_course where subjectid=#{subjectid})
57
+        ,(select (case when count(*)>0 then ',课堂考试' else '' end) from t_classroom_paper where subjectid=#{subjectid})
58
+        )
59
+    </select>
60
+    <!--获取科目id名称列表-->
61
+    <resultMap id="subjectResult" type="java.util.Map">
62
+        <result column="subjectname" property="key"></result>
63
+        <result column="subjectid" property="value"></result>
64
+    </resultMap>
65
+    <select id="listSubject" resultMap="subjectResult">
66
+        SELECT s.subjectname,s.subjectid
67
+        FROM t_subject s WHERE s.level=#{level} and (s.belong=1 or s.schoolid=#{schoolid})
68
+        order by s.subjectorder asc
69
+    </select>
70
+</mapper>

+ 38
- 0
sstudy/src/main/resources/mapper/subjectbook/SubjectQuestiontypeMapper.xml Dosyayı Görüntüle

@@ -0,0 +1,38 @@
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.sstudy.mapper.subjectbook.SubjectQuestiontypeMapper">
4
+
5
+    <!-- 根据科目下题型列表 -->
6
+    <select id="listQuestiontypes" resultType="com.xhkjedu.sstudy.model.subjectbook.TSubjectQuestiontype">
7
+        SELECT s.qtypeid,s.qtypename,s.subjectid,s.qtypeorder,s.ctype,s.createid,s.createtime,
8
+        u.username AS createname,s.belong
9
+        FROM t_subject_questiontype s LEFT JOIN t_user u ON s.createid=u.userid
10
+        WHERE s.subjectid=#{type.subjectid} and (s.belong=1
11
+        <if test="type.schoolid!=null">
12
+            or s.schoolid=#{type.schoolid}
13
+        </if>)
14
+        order by s.qtypeorder asc
15
+    </select>
16
+
17
+    <!-- 根据科目下题型列表用于选择题型 -->
18
+    <select id="listQuestiontypesForSel" resultType="com.xhkjedu.sstudy.vo.subjectbook.SubjectQuestiontypeVo">
19
+        SELECT qtypeid,qtypename,qtypeorder,ctype,belong from t_subject_questiontype
20
+        WHERE subjectid=#{type.subjectid} and (belong=1
21
+        <if test="type.schoolid!=null">
22
+            or schoolid=#{type.schoolid}
23
+        </if>)
24
+        order by qtypeorder asc
25
+    </select>
26
+
27
+    <!--查找使用题型的模块-->
28
+    <select id="findUseModule" resultType="java.lang.String">
29
+        SELECT CONCAT((select (case when count(*)>0 then '试题' else '' end) from t_question where qtypeid=#{qtypeid})
30
+        ,(select (case when count(*)>0 then ',班级错题' else '' end) from t_question_class where qtypeid=#{qtypeid})
31
+        ,(select (case when count(*)>0 then ',试题收藏' else '' end) from t_question_collect where qtypeid=#{qtypeid})
32
+        ,(select (case when count(*)>0 then ',学生错题' else '' end) from t_question_student where qtypeid=#{qtypeid})
33
+        ,(select (case when count(*)>0 then ',题库作业' else '' end) from t_paper_qtype where qtypeid=#{qtypeid})
34
+        ,(select (case when count(*)>0 then ',附件作业' else '' end) from t_paper_scantron where qtypeid=#{qtypeid})
35
+        )
36
+    </select>
37
+
38
+</mapper>

+ 21
- 0
sstudy/src/main/resources/mapper/subjectbook/VersionMapper.xml Dosyayı Görüntüle

@@ -0,0 +1,21 @@
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.sstudy.mapper.subjectbook.VersionMapper">
4
+
5
+    <!-- 根据阶段获取册别 -->
6
+    <select id="listVersions" resultType="com.xhkjedu.sstudy.model.subjectbook.TVersion">
7
+        select v.versionid,v.versionname,v.versionorder,v.createid,v.createtime,v.belong,u.username createname
8
+        from t_version v left join t_user u on u.userid=v.createid
9
+        where (v.belong=1
10
+        <if test="version.schoolid!=null">
11
+            or v.schoolid=#{version.schoolid}
12
+        </if>)
13
+        order by v.versionorder asc
14
+    </select>
15
+
16
+    <!--查找使用版本的模块-->
17
+    <select id="findUseModule" resultType="java.lang.String">
18
+        select (case when count(*)>0 then ',教材' else '' end) from t_subject_book where versionid=#{versionid}
19
+    </select>
20
+
21
+</mapper>

Loading…
İptal
Kaydet