Sfoglia il codice sorgente

系统接口部分内容

tags/正式3.2.0
王宁 2 anni fa
parent
commit
908fa868be
69 ha cambiato i file con 4429 aggiunte e 5 eliminazioni
  1. 19
    3
      sapi/pom.xml
  2. 2
    0
      sapi/src/main/java/com/xhkjedu/sapi/SapiApplication.java
  3. 32
    0
      sapi/src/main/java/com/xhkjedu/sapi/config/ConfigKey.java
  4. 56
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/cloud/CloudController.java
  5. 49
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/cloud/CloudSyncController.java
  6. 56
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/system/AreazoneController.java
  7. 163
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/system/ModuleController.java
  8. 76
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/system/ModuledefaultController.java
  9. 108
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/system/SchoolController.java
  10. 51
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/system/SchoolStypeController.java
  11. 43
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/system/SyserrorController.java
  12. 48
    0
      sapi/src/main/java/com/xhkjedu/sapi/controller/system/UserLogController.java
  13. 21
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/cloud/CloudMapper.java
  14. 21
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/cloud/CloudSyncDetailMapper.java
  15. 73
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/cloud/CloudSyncMapper.java
  16. 19
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/system/AreazoneMapper.java
  17. 58
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/system/ModuleMapper.java
  18. 28
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/system/ModuledefaultMapper.java
  19. 60
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/system/SchoolMapper.java
  20. 17
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/system/SchoolStypeMapper.java
  21. 11
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/system/SyserrorMapper.java
  22. 21
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/system/UserLogMapper.java
  23. 26
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/BaseBean.java
  24. 65
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/cloud/TCloud.java
  25. 53
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/cloud/TCloudSync.java
  26. 60
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/cloud/TCloudSyncDetail.java
  27. 54
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TDirector.java
  28. 53
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TPoint.java
  29. 110
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TQuestion.java
  30. 32
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TQuestionDirector.java
  31. 33
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TQuestionPoint.java
  32. 120
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TResource.java
  33. 37
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TResourceDirector.java
  34. 39
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TSubject.java
  35. 57
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TSubjectBook.java
  36. 42
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TSubjectQuestiontype.java
  37. 36
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TVersion.java
  38. 39
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/system/TAreazone.java
  39. 69
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/system/TModule.java
  40. 56
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/system/TModuledefault.java
  41. 67
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/system/TSchool.java
  42. 37
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/system/TSchoolStype.java
  43. 24
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/system/TSyserror.java
  44. 53
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/system/TUserLog.java
  45. 40
    0
      sapi/src/main/java/com/xhkjedu/sapi/service/cloud/CloudService.java
  46. 268
    0
      sapi/src/main/java/com/xhkjedu/sapi/service/cloud/CloudSyncService.java
  47. 65
    0
      sapi/src/main/java/com/xhkjedu/sapi/service/system/AreazoneService.java
  48. 185
    0
      sapi/src/main/java/com/xhkjedu/sapi/service/system/ModuleService.java
  49. 177
    0
      sapi/src/main/java/com/xhkjedu/sapi/service/system/ModuledefaultService.java
  50. 403
    0
      sapi/src/main/java/com/xhkjedu/sapi/service/system/SchoolService.java
  51. 115
    0
      sapi/src/main/java/com/xhkjedu/sapi/service/system/SchoolStypeService.java
  52. 33
    0
      sapi/src/main/java/com/xhkjedu/sapi/service/system/SyserrorService.java
  53. 28
    0
      sapi/src/main/java/com/xhkjedu/sapi/service/system/UserLogService.java
  54. 36
    1
      sapi/src/main/java/com/xhkjedu/sapi/utils/ApiUtil.java
  55. 164
    0
      sapi/src/main/java/com/xhkjedu/sapi/utils/CopyURL.java
  56. 106
    0
      sapi/src/main/java/com/xhkjedu/sapi/utils/JedisUtil.java
  57. 18
    0
      sapi/src/main/java/com/xhkjedu/sapi/vo/system/AreazoneVo.java
  58. 21
    0
      sapi/src/main/java/com/xhkjedu/sapi/vo/system/ModuleSelVo.java
  59. 12
    1
      sapi/src/main/resources/application.properties
  60. 35
    0
      sapi/src/main/resources/mapper/cloud/CloudMapper.xml
  61. 32
    0
      sapi/src/main/resources/mapper/cloud/CloudSyncDetailMapper.xml
  62. 168
    0
      sapi/src/main/resources/mapper/cloud/CloudSyncMapper.xml
  63. 79
    0
      sapi/src/main/resources/mapper/system/AreazoneMapper.xml
  64. 67
    0
      sapi/src/main/resources/mapper/system/ModuleMapper.xml
  65. 47
    0
      sapi/src/main/resources/mapper/system/ModuledefaultMapper.xml
  66. 70
    0
      sapi/src/main/resources/mapper/system/SchoolMapper.xml
  67. 25
    0
      sapi/src/main/resources/mapper/system/SchoolStypeMapper.xml
  68. 12
    0
      sapi/src/main/resources/mapper/system/SyserrorMapper.xml
  69. 29
    0
      sapi/src/main/resources/mapper/system/UserLogMapper.xml

+ 19
- 3
sapi/pom.xml Vedi File

@@ -46,6 +46,12 @@
46 46
             <scope>test</scope>
47 47
         </dependency>
48 48
 
49
+        <dependency>
50
+            <groupId>com.xhkjedu</groupId>
51
+            <artifactId>scommons</artifactId>
52
+            <version>0.0.1-SNAPSHOT</version>
53
+        </dependency>
54
+
49 55
         <!--mybatis通用mapper依赖-->
50 56
         <dependency>
51 57
             <groupId>tk.mybatis</groupId>
@@ -54,9 +60,19 @@
54 60
         </dependency>
55 61
 
56 62
         <dependency>
57
-            <groupId>com.xhkjedu</groupId>
58
-            <artifactId>scommons</artifactId>
59
-            <version>0.0.1-SNAPSHOT</version>
63
+            <groupId>redis.clients</groupId>
64
+            <artifactId>jedis</artifactId>
65
+            <version>2.9.3</version>
66
+        </dependency>
67
+        <dependency>
68
+            <groupId>org.springframework.boot</groupId>
69
+            <artifactId>spring-boot-starter-data-redis</artifactId>
70
+        </dependency>
71
+
72
+        <dependency>
73
+            <groupId>com.alibaba</groupId>
74
+            <artifactId>fastjson</artifactId>
75
+            <version>1.2.56</version>
60 76
         </dependency>
61 77
 
62 78
     </dependencies>

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

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

+ 32
- 0
sapi/src/main/java/com/xhkjedu/sapi/config/ConfigKey.java Vedi File

@@ -45,4 +45,36 @@ public class ConfigKey {
45 45
     public void setSecretKey(String secretKey) {
46 46
         ConfigKey.secretKey = secretKey;
47 47
     }
48
+
49
+    public static String cloudapi;//云平台接口
50
+    public static String showurl;//文件访问路径
51
+    public static String oldshowurl;//原文件访问路径
52
+    public static String fileapi;//文件服务接口地址
53
+    public static String dbname;//数据库名
54
+
55
+    @Value("${cloudapi}")
56
+    public void setCloudapi(String cloudapi) {
57
+        this.cloudapi = cloudapi;
58
+    }
59
+
60
+    @Value("${file.showurl}")
61
+    public void setShowurl(String showurl) {
62
+        this.showurl = showurl;
63
+    }
64
+
65
+    @Value("${file.oldshowurl}")
66
+    public void setOldshowurl(String oldshowurl) {
67
+        this.oldshowurl = oldshowurl;
68
+    }
69
+
70
+    @Value("${fileapi}")
71
+    public void setFileapi(String fileapi) {
72
+        this.fileapi = fileapi;
73
+    }
74
+
75
+    @Value("${dbname}")
76
+    public void setDbname(String dbname) {
77
+        ConfigKey.dbname = dbname;
78
+    }
79
+
48 80
 }

+ 56
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/cloud/CloudController.java Vedi File

@@ -0,0 +1,56 @@
1
+package com.xhkjedu.sapi.controller.cloud;
2
+
3
+import com.xhkjedu.sapi.model.cloud.TCloud;
4
+import com.xhkjedu.sapi.service.cloud.CloudService;
5
+import com.xhkjedu.utils.N_Utils;
6
+import com.xhkjedu.vo.ResultVo;
7
+import org.springframework.web.bind.annotation.PostMapping;
8
+import org.springframework.web.bind.annotation.RequestBody;
9
+import org.springframework.web.bind.annotation.RequestMapping;
10
+import org.springframework.web.bind.annotation.RestController;
11
+
12
+import javax.annotation.Resource;
13
+import java.util.List;
14
+
15
+/**
16
+ * @author ywx
17
+ * @classname CloudController
18
+ * @description 
19
+ * @date 2021/6/30 14:48
20
+ **/
21
+@RestController
22
+@RequestMapping("cloud")
23
+public class CloudController {
24
+    @Resource
25
+    private CloudService cloudService;
26
+
27
+    @PostMapping("/detail")
28
+    public ResultVo detail() {
29
+        TCloud tCloud = cloudService.findById();
30
+        return new ResultVo(0,"获取平台详情成功",tCloud);
31
+    }
32
+
33
+    //修改主题色
34
+    @PostMapping("/update")
35
+    public ResultVo update(@RequestBody TCloud cloud) {
36
+        N_Utils.validation(new Object[]{cloud.getCloudid(), "平台id", 1
37
+        ,cloud.getTheme(),"主题色",2,cloud.getLoginbg(),"登录背景图片",2
38
+        ,cloud.getLoginname(),"登录页面字体图片",2,cloud.getLoginico(),"区域设置的ico",2});
39
+        cloudService.updateTheme(cloud);
40
+        return new ResultVo(0,"修改成功");
41
+    }
42
+
43
+    //修改区域基础信息
44
+    @PostMapping("/upinfo")
45
+    public ResultVo updateInfo(@RequestBody TCloud cloud) {
46
+        N_Utils.validation(new Object[]{cloud.getCloudid(), "平台id", 1,cloud.getCloudname(),"平台名称",2});
47
+        cloudService.updateInfo(cloud);
48
+        return new ResultVo(0,"修改成功");
49
+    }
50
+
51
+    @PostMapping("/list_level")
52
+    public ResultVo listLevel() {
53
+        List<Integer> list = cloudService.listLevel();
54
+        return new ResultVo(0,"获取区域学段列表成功",list);
55
+    }
56
+}

+ 49
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/cloud/CloudSyncController.java Vedi File

@@ -0,0 +1,49 @@
1
+package com.xhkjedu.sapi.controller.cloud;
2
+
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.sapi.model.cloud.TCloudSync;
6
+import com.xhkjedu.sapi.service.cloud.CloudSyncService;
7
+import com.xhkjedu.utils.N_Utils;
8
+import com.xhkjedu.utils.PageUtil;
9
+import com.xhkjedu.vo.PageResult;
10
+import com.xhkjedu.vo.ResultVo;
11
+import org.springframework.web.bind.annotation.PostMapping;
12
+import org.springframework.web.bind.annotation.RequestBody;
13
+import org.springframework.web.bind.annotation.RequestMapping;
14
+import org.springframework.web.bind.annotation.RestController;
15
+
16
+import javax.annotation.Resource;
17
+import java.util.List;
18
+import java.util.Map;
19
+
20
+/**
21
+* @author ywx
22
+* @classname TCloudSyncController
23
+* @description
24
+* @date 2021/05/06 15:42
25
+**/
26
+@RestController
27
+@RequestMapping("csync")
28
+public class CloudSyncController {
29
+    @Resource
30
+    private CloudSyncService cloudSyncService;
31
+
32
+    @PostMapping("/list")
33
+    public ResultVo list(@RequestBody TCloudSync sync) {
34
+        Integer page = sync.getPage();
35
+        Integer pageSize = sync.getPageSize();
36
+        N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1});
37
+        PageHelper.startPage(page, pageSize);
38
+        List<Map> list = cloudSyncService.findAll(sync);
39
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
40
+        return new ResultVo(0,"获取同步任务列表成功",pageResult);
41
+    }
42
+
43
+    @PostMapping("/sync")
44
+    public ResultVo sync(@RequestBody TCloudSync sync) {
45
+        N_Utils.validation(new Object[]{sync.getCreateid(), "创建人id", 1
46
+                ,sync.getCloudcode(),"平台码",2,sync.getSyncnum(),"一次同步数量",1});
47
+        return cloudSyncService.sync(sync);
48
+    }
49
+}

+ 56
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/system/AreazoneController.java Vedi File

@@ -0,0 +1,56 @@
1
+package com.xhkjedu.sapi.controller.system;
2
+
3
+import com.xhkjedu.sapi.model.system.TAreazone;
4
+import com.xhkjedu.sapi.service.system.AreazoneService;
5
+import com.xhkjedu.vo.ResultVo;
6
+import org.springframework.web.bind.annotation.PostMapping;
7
+import org.springframework.web.bind.annotation.RequestBody;
8
+import org.springframework.web.bind.annotation.RequestMapping;
9
+import org.springframework.web.bind.annotation.RestController;
10
+
11
+import javax.annotation.Resource;
12
+import java.util.List;
13
+import java.util.Map;
14
+
15
+/**
16
+* @author ywx
17
+* @classname TAreazoneController
18
+* @description
19
+* @date 2021/04/08 09:20
20
+**/
21
+@RestController
22
+@RequestMapping("/areazone")
23
+public class AreazoneController {
24
+    @Resource
25
+    private AreazoneService areazoneService;
26
+
27
+    @PostMapping("/add")
28
+    public ResultVo add(@RequestBody TAreazone areazone) {
29
+        areazoneService.save(areazone);
30
+        return new ResultVo(0, "保存成功");
31
+    }
32
+
33
+    @PostMapping("/delete")
34
+    public ResultVo delete(@RequestBody TAreazone areazone) {
35
+        areazoneService.deleteById(areazone.getAreaid());
36
+        return new ResultVo(0,"删除成功");
37
+    }
38
+
39
+    @PostMapping("/update")
40
+    public ResultVo update(@RequestBody TAreazone areazone) {
41
+        areazoneService.update(areazone);
42
+        return new ResultVo(0,"修改成功");
43
+    }
44
+
45
+    @PostMapping("/list")
46
+    public ResultVo list() {
47
+        List<Map> list = areazoneService.listAll();
48
+        return new ResultVo(0,"获取地区列表成功",list);
49
+    }
50
+
51
+    @PostMapping("/list_sel")
52
+    public ResultVo listForSel() {
53
+        List<Map> list = areazoneService.listForSel();
54
+        return new ResultVo(0,"获取地区选择列表成功",list);
55
+    }
56
+}

+ 163
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/system/ModuleController.java Vedi File

@@ -0,0 +1,163 @@
1
+package com.xhkjedu.sapi.controller.system;
2
+
3
+import com.xhkjedu.sapi.model.system.TModule;
4
+import com.xhkjedu.sapi.service.system.ModuleService;
5
+import com.xhkjedu.utils.N_Utils;
6
+import com.xhkjedu.vo.ResultVo;
7
+import com.xhkjedu.sapi.vo.system.ModuleSelVo;
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
+/**
19
+ * @ClassName ModuleController
20
+ * Description TODO
21
+ * Author WN
22
+ * Date 2020/6/11 16:24
23
+ **/
24
+@RequestMapping("module")
25
+@RestController
26
+public class ModuleController {
27
+    @Autowired
28
+    private ModuleService moduleService;
29
+
30
+    /**
31
+     *功能描述 列表
32
+     * @author WN
33
+     * @date 2020/6/11
34
+     * @param  * @param module
35
+     * @return com.xhkjedu.vo.ResultVo
36
+     */
37
+    @PostMapping("/list")
38
+    public ResultVo listModules(@RequestBody TModule module){
39
+        N_Utils.validation(new Object[]{module.getSchoolid(),"学校id",1,module.getModuletype(),"模块归属",1});
40
+        List<TModule> lst = moduleService.listModules(module.getSchoolid(), module.getModuletype(), 1);
41
+        return new ResultVo(0,"获取应用集合成功",lst);
42
+    }
43
+
44
+    @PostMapping("/list2")
45
+    public ResultVo listModules2(@RequestBody TModule module){
46
+        N_Utils.validation(new Object[]{module.getSchoolid(),"学校id",1,module.getModuletype(),"模块归属",1});
47
+        List<TModule> lst = moduleService.listModules(module.getSchoolid(), module.getModuletype(), 1);
48
+        return new ResultVo(0,"获取应用集合成功",lst);
49
+    }
50
+
51
+    @PostMapping("/list_stu")
52
+    public ResultVo listStuModules(@RequestBody TModule module){
53
+        N_Utils.validation(new Object[]{module.getSchoolid(),"学校id",1,module.getModuletype(),"模块归属",1});
54
+        List<TModule> lst = moduleService.listModules(module.getSchoolid(),module.getModuletype(),1);
55
+        return new ResultVo(0,"获取应用集合成功",lst);
56
+    }
57
+
58
+    /**
59
+     *功能描述 所有模块树形结构
60
+     * @author WN
61
+     * @date 2020/6/15
62
+     * @param  * @param module
63
+     * @return com.xhkjedu.vo.ResultVo
64
+     */
65
+    @PostMapping("/treelst")
66
+    public ResultVo listTree(@RequestBody TModule module){
67
+        N_Utils.validation(new Object[]{module.getSchoolid(),"学校id",1,module.getModuletype(),"模块归属",1});
68
+        List<TModule> lst = moduleService.listModulesTree(module.getSchoolid(),module.getModuletype(), 1);
69
+        return new ResultVo(0,"获取应用集合成功",lst);
70
+    }
71
+
72
+
73
+    /**
74
+     *功能描述 保存
75
+     * @author WN
76
+     * @date 2020/6/11
77
+     * @param  * @param module
78
+     * @return com.xhkjedu.vo.ResultVo
79
+     */
80
+    @PostMapping("/add")
81
+    public ResultVo add(@RequestBody TModule module){
82
+        N_Utils.validation(new Object[]{
83
+                module.getModulename(),"应用名称",2,
84
+                module.getMinout(),"应用分类",1,
85
+                module.getMclass(),"应用分组",1,
86
+                module.getModuletype(),"模块归属",1
87
+        });
88
+        int result = moduleService.add(module);
89
+        if (result > 0) {
90
+            return new ResultVo(0, "保存成功");
91
+        }else{
92
+            return new ResultVo(1, "保存失败");
93
+        }
94
+    }
95
+
96
+    /**
97
+     *功能描述 修改
98
+     * @author WN
99
+     * @date 2020/6/11
100
+     * @param  * @param module
101
+     * @return com.xhkjedu.vo.ResultVo
102
+     */
103
+    @PostMapping("/up")
104
+    public ResultVo update(@RequestBody TModule module){
105
+        N_Utils.validation(new Object[]{
106
+                module.getModuleid(),"应用id",1,
107
+                module.getModulename(),"应用名称",2,
108
+                module.getMinout(),"应用分类",1,
109
+                module.getMclass(),"应用分组",1
110
+        });
111
+        int result = moduleService.update(module);
112
+        if (result > 0) return new ResultVo(0,"修改成功");
113
+        else return new ResultVo(1,"修改失败");
114
+    }
115
+
116
+    /**
117
+     *功能描述  删除
118
+     * @author WN
119
+     * @date 2020/6/11
120
+     * @param  * @param module
121
+     * @return com.xhkjedu.vo.ResultVo
122
+     */
123
+    @PostMapping("/del")
124
+    public ResultVo del(@RequestBody TModule module) {
125
+        if (N_Utils.isEmpty(module.getModuleid()))
126
+            return new ResultVo(1,"未选择删除的应用");
127
+        int result = moduleService.del(module.getModuleid());
128
+        if (result > 0) return new ResultVo(0,"删除成功");
129
+        else return new ResultVo(1,"删除失败");
130
+    }
131
+
132
+    /**
133
+     *功能描述  首层模块
134
+     * @author WN
135
+     * @date 2020/6/15
136
+     * @param  * @param module
137
+     * @return com.xhkjedu.vo.ResultVo
138
+     */
139
+    @PostMapping("/listsel")
140
+    public ResultVo listForSel(@RequestBody TModule module){
141
+        N_Utils.validation(new Object[]{module.getSchoolid(),"学校id",1,module.getModuletype(),"模块归属",1});
142
+        List<ModuleSelVo> lst = moduleService.listLevelModule(module.getSchoolid(),module.getModuletype());
143
+        return new ResultVo(0,"获取一级应用成功",lst);
144
+    }
145
+
146
+    @PostMapping("/move_up")
147
+    public ResultVo moveUp(@RequestBody List<TModule> modules){
148
+        if (N_Utils.isListEmpty(modules)) {
149
+            return new ResultVo(1,"要移动的模块信息不能为空");
150
+        }
151
+        moduleService.moveUp(modules);
152
+        return new ResultVo(0,"上移成功");
153
+    }
154
+
155
+    @PostMapping("/listsel2")
156
+    public ResultVo listForSel2(@RequestBody TModule module){
157
+        Integer schoolid = module.getSchoolid();
158
+        Integer moduletype = module.getModuletype();
159
+        N_Utils.validation(new Object[]{schoolid,"学校id",1,moduletype,"模块归属",1});
160
+        List<Map> list = moduleService.listForSel2(schoolid, moduletype);
161
+        return new ResultVo(0,"获取模块选择列表成功", list);
162
+    }
163
+}

+ 76
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/system/ModuledefaultController.java Vedi File

@@ -0,0 +1,76 @@
1
+package com.xhkjedu.sapi.controller.system;
2
+
3
+import com.xhkjedu.sapi.model.system.TModuledefault;
4
+import com.xhkjedu.sapi.service.system.ModuledefaultService;
5
+import com.xhkjedu.utils.N_Utils;
6
+import com.xhkjedu.vo.ResultVo;
7
+import com.xhkjedu.sapi.vo.system.ModuleSelVo;
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 javax.annotation.Resource;
14
+import java.util.List;
15
+
16
+/**
17
+* @author ywx
18
+* @classname TModuledefaultController
19
+* @description
20
+* @date 2020/07/02 10:20
21
+**/
22
+@RestController
23
+@RequestMapping("/moduledefault")
24
+public class ModuledefaultController {
25
+    @Resource
26
+    private ModuledefaultService moduledefaultService;
27
+
28
+    @PostMapping("/add")
29
+    public ResultVo add(@RequestBody TModuledefault tModuledefault) {
30
+        N_Utils.validation(new Object[]{tModuledefault.getModuletype(),"模块归属",1});
31
+        return moduledefaultService.save(tModuledefault);
32
+    }
33
+
34
+    @PostMapping("/delete")
35
+    public ResultVo delete(@RequestBody TModuledefault tModuledefault) {
36
+        N_Utils.validation(new Object[]{tModuledefault.getModuleid(),"模块id",2});
37
+        moduledefaultService.deleteById(tModuledefault.getModuleid());
38
+        return new ResultVo(0,"删除成功");
39
+    }
40
+
41
+    @PostMapping("/update")
42
+    public ResultVo update(@RequestBody TModuledefault tModuledefault) {
43
+        moduledefaultService.update(tModuledefault);
44
+        return new ResultVo(0,"修改成功");
45
+    }
46
+
47
+    @PostMapping("/detail")
48
+    public ResultVo detail(@RequestBody TModuledefault tModuledefault) {
49
+        N_Utils.validation(new Object[]{tModuledefault.getModuleid(),"模块id",2});
50
+        TModuledefault moduledefault = moduledefaultService.findById(tModuledefault.getModuleid());
51
+        return new ResultVo(0,"获取详情成功",moduledefault);
52
+    }
53
+
54
+    @PostMapping("/list")
55
+    public ResultVo list(@RequestBody TModuledefault tModuledefault) {
56
+        Integer moduletype = tModuledefault.getModuletype();
57
+        N_Utils.validation(new Object[]{moduletype,"模块归属",1});
58
+        List<TModuledefault> list = moduledefaultService.listAll(moduletype,tModuledefault.getDisplay());
59
+        return new ResultVo(0,"获取列表成功",list);
60
+    }
61
+
62
+    /**
63
+     *功能描述  首层模块
64
+     * @author WN
65
+     * @date 2020/6/15
66
+     * @param  * @param module
67
+     * @return com.xhkjedu.vo.ResultVo
68
+     */
69
+    @PostMapping("/listsel")
70
+    public ResultVo listForSel(@RequestBody TModuledefault tModuledefault){
71
+        Integer moduletype = tModuledefault.getModuletype();
72
+        N_Utils.validation(new Object[]{moduletype,"模块归属",1});
73
+        List<ModuleSelVo> lst = moduledefaultService.listLevelModule(moduletype);
74
+        return new ResultVo(0,"获取一级应用成功",lst);
75
+    }
76
+}

+ 108
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/system/SchoolController.java Vedi File

@@ -0,0 +1,108 @@
1
+package com.xhkjedu.sapi.controller.system;
2
+
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.sapi.model.system.TSchool;
6
+import com.xhkjedu.sapi.service.system.SchoolService;
7
+import com.xhkjedu.utils.N_Utils;
8
+import com.xhkjedu.utils.PageUtil;
9
+import com.xhkjedu.vo.PageResult;
10
+import com.xhkjedu.vo.ResultVo;
11
+import org.springframework.web.bind.annotation.PostMapping;
12
+import org.springframework.web.bind.annotation.RequestBody;
13
+import org.springframework.web.bind.annotation.RequestMapping;
14
+import org.springframework.web.bind.annotation.RestController;
15
+
16
+import javax.annotation.Resource;
17
+import java.util.List;
18
+import java.util.Map;
19
+
20
+/**
21
+ * @author ywx
22
+ * @classname TSchoolController
23
+ * @description
24
+ * @date 2020/6/2 15:06
25
+ **/
26
+@RestController
27
+@RequestMapping("/school")
28
+public class SchoolController {
29
+    @Resource
30
+    private SchoolService schoolService;
31
+
32
+    @PostMapping("/add")
33
+    public ResultVo add(@RequestBody TSchool tSchool) {
34
+        try {
35
+            String schoolname = tSchool.getSchoolname();
36
+            N_Utils.validation(new Object[]{schoolname,"学校名称",2});
37
+            Integer num = schoolService.countBySchoolName(schoolname);
38
+            if (num != 0) return new ResultVo(1,"该学校名称已存在");
39
+            Integer id = schoolService.save(tSchool);
40
+            return new ResultVo(0, "保存成功",id);
41
+        } catch (Exception e) {
42
+            return new ResultVo(1,e.getMessage());
43
+        }
44
+    }
45
+
46
+    @PostMapping("/delete")
47
+    public ResultVo delete(@RequestBody TSchool tSchool) {
48
+        N_Utils.validation(new Object[]{tSchool.getSchoolid(),"学校id",1});
49
+        schoolService.deleteById(tSchool.getSchoolid());
50
+        return new ResultVo(0,"删除成功");
51
+    }
52
+
53
+    @PostMapping("/update")
54
+    public ResultVo update(@RequestBody TSchool tSchool) {
55
+        N_Utils.validation(new Object[]{tSchool.getSchoolid(),"学校id",1});
56
+        schoolService.update(tSchool);
57
+        return new ResultVo(0,"修改成功");
58
+    }
59
+
60
+    @PostMapping("/list")
61
+    public ResultVo list(@RequestBody TSchool tSchool) {
62
+        Integer page = tSchool.getPage();
63
+        Integer pageSize = tSchool.getPageSize();
64
+        N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1});
65
+        PageHelper.startPage(page, pageSize);
66
+        List<TSchool> list = schoolService.findAll();
67
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
68
+        return new ResultVo(0,"获取列表成功",pageResult);
69
+    }
70
+
71
+    @PostMapping("/upgrade")
72
+    public ResultVo upgrade(@RequestBody TSchool tSchool) {
73
+        Integer schoolid = tSchool.getSchoolid();
74
+        Integer year = schoolService.getYearById(schoolid);
75
+        N_Utils.validation(new Object[]{schoolid,"学校id",1});
76
+        Integer nowYear = N_Utils.getNodeDateTime("year");//当前年份
77
+        if (year >= nowYear) return new ResultVo(1,"当前学年不用升级");
78
+        try {
79
+            schoolService.upgrade(schoolid, year);
80
+            return new ResultVo(0,"学年升级成功");
81
+        } catch (Exception e) {
82
+            return new ResultVo(1,e.getMessage());
83
+        }
84
+    }
85
+
86
+    @PostMapping("/downgrade")
87
+    public ResultVo downgrade(@RequestBody TSchool tSchool) {
88
+        Integer schoolid = tSchool.getSchoolid();
89
+        Integer year = schoolService.getYearById(schoolid);
90
+        N_Utils.validation(new Object[]{schoolid,"学校id",1});
91
+        schoolService.downgrade(schoolid, year);
92
+        return new ResultVo(0,"学年降级成功");
93
+    }
94
+
95
+    @PostMapping("/detail")
96
+    public ResultVo detail(@RequestBody TSchool tSchool) {
97
+        Integer schoolid = tSchool.getSchoolid();
98
+        N_Utils.validation(new Object[]{schoolid,"学校id",1});
99
+        TSchool school = schoolService.finById(schoolid);
100
+        return new ResultVo(0,"获取学校详情成功", school);
101
+    }
102
+
103
+    @PostMapping("/list_sel")
104
+    public ResultVo listForSel() {
105
+        List<Map> list = schoolService.listForSel();
106
+        return new ResultVo(0,"获取学校选择列表成功", list);
107
+    }
108
+}

+ 51
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/system/SchoolStypeController.java Vedi File

@@ -0,0 +1,51 @@
1
+package com.xhkjedu.sapi.controller.system;
2
+
3
+import com.xhkjedu.sapi.model.system.TSchoolStype;
4
+import com.xhkjedu.sapi.service.system.SchoolStypeService;
5
+import com.xhkjedu.utils.N_Utils;
6
+import com.xhkjedu.vo.ResultVo;
7
+import org.springframework.web.bind.annotation.PostMapping;
8
+import org.springframework.web.bind.annotation.RequestBody;
9
+import org.springframework.web.bind.annotation.RequestMapping;
10
+import org.springframework.web.bind.annotation.RestController;
11
+
12
+import javax.annotation.Resource;
13
+import java.util.List;
14
+
15
+/**
16
+* @author ywx
17
+* @classname TSchoolStypeController
18
+* @description
19
+* @date 2021/02/23 09:50
20
+**/
21
+@RestController
22
+@RequestMapping("/stype")
23
+public class SchoolStypeController {
24
+    @Resource
25
+    private SchoolStypeService schoolStypeService;
26
+
27
+    @PostMapping("/add")
28
+    public ResultVo add(@RequestBody List<TSchoolStype> list) {
29
+        return schoolStypeService.batchSave(list);
30
+    }
31
+
32
+    @PostMapping("/list")
33
+    public ResultVo list(@RequestBody TSchoolStype stype) {
34
+        N_Utils.validation(new Object[]{stype.getSchooldomain(),"域名",2});
35
+        List<TSchoolStype> list = schoolStypeService.listAll(stype);
36
+        return new ResultVo(0,"获取学校样式列表成功",list);
37
+    }
38
+
39
+    @PostMapping("/add2")
40
+    public ResultVo add2(@RequestBody List<TSchoolStype> list) {
41
+        if (N_Utils.isListEmpty(list)) return new ResultVo(1,"学校样式不能为空");
42
+        return schoolStypeService.batchSave2(list);
43
+    }
44
+
45
+    @PostMapping("/list2")
46
+    public ResultVo list2(@RequestBody TSchoolStype stype) {
47
+        N_Utils.validation(new Object[]{stype.getSchoolid(),"学校id",1});
48
+        List<TSchoolStype> list = schoolStypeService.listAll2(stype);
49
+        return new ResultVo(0,"获取学校样式列表成功",list);
50
+    }
51
+}

+ 43
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/system/SyserrorController.java Vedi File

@@ -0,0 +1,43 @@
1
+package com.xhkjedu.sapi.controller.system;
2
+
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.sapi.model.system.TSyserror;
6
+import com.xhkjedu.sapi.service.system.SyserrorService;
7
+import com.xhkjedu.utils.PageUtil;
8
+import com.xhkjedu.vo.PageResult;
9
+import com.xhkjedu.vo.ResultVo;
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 javax.annotation.Resource;
16
+import java.util.List;
17
+
18
+/**
19
+* @author ywx
20
+* @classname TSyserrorController
21
+* @description
22
+* @date 2020/10/09 15:13
23
+**/
24
+@RestController
25
+@RequestMapping("/syserror")
26
+public class SyserrorController {
27
+    @Resource
28
+    private SyserrorService syserrorService;
29
+
30
+    @PostMapping("/add")
31
+    public ResultVo add(@RequestBody TSyserror error) {
32
+        Integer id = syserrorService.save(error);
33
+        return new ResultVo(0, "保存成功",id);
34
+    }
35
+
36
+    @PostMapping("/list")
37
+    public ResultVo list(@RequestBody TSyserror error) {
38
+        PageHelper.startPage(error.getPage(), error.getPageSize());
39
+        List<TSyserror> list = syserrorService.listAll(error);
40
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
41
+        return new ResultVo(0,"获取系统错误列表成功",pageResult);
42
+    }
43
+}

+ 48
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/system/UserLogController.java Vedi File

@@ -0,0 +1,48 @@
1
+package com.xhkjedu.sapi.controller.system;
2
+
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.sapi.model.system.TUserLog;
6
+import com.xhkjedu.sapi.service.system.UserLogService;
7
+import com.xhkjedu.utils.N_Utils;
8
+import com.xhkjedu.utils.PageUtil;
9
+import com.xhkjedu.vo.PageResult;
10
+import com.xhkjedu.vo.ResultVo;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.web.bind.annotation.PostMapping;
13
+import org.springframework.web.bind.annotation.RequestBody;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RestController;
16
+
17
+import java.util.List;
18
+
19
+/**
20
+ * @author ywx
21
+ * @classname UserLogController
22
+ * @description 
23
+ * @date 2020/6/17 17:38
24
+ **/
25
+@RestController
26
+@RequestMapping("log")
27
+public class UserLogController {
28
+    @Autowired
29
+    private UserLogService userLogService;
30
+
31
+    /**
32
+     * 登录日志列表
33
+     * @Param [log]
34
+     * @Author ywx
35
+     * @Date 2020/6/17 17:22
36
+     * @return com.xhkjedu.vo.ResultVo
37
+     **/
38
+    @PostMapping("/list_log")
39
+    public ResultVo listLog(@RequestBody TUserLog log){
40
+        Integer page = log.getPage();
41
+        Integer pageSize = log.getPageSize();
42
+        N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1});
43
+        PageHelper.startPage(page, pageSize);
44
+        List<TUserLog> logs = userLogService.listLog(log);
45
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo(logs));
46
+        return new ResultVo(0, "获取登录日志列表成功", pageResult);
47
+    }
48
+}

+ 21
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/cloud/CloudMapper.java Vedi File

@@ -0,0 +1,21 @@
1
+package com.xhkjedu.sapi.mapper.cloud;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.cloud.TCloud;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+public interface CloudMapper extends TkMapper<TCloud> {
10
+    //修改主题
11
+    void updateTheme(@Param("cloud") TCloud cloud);
12
+
13
+    //修改区域基本信息
14
+    void updateInfo(@Param("cloud") TCloud cloud);
15
+
16
+    //获取详情
17
+    TCloud getCloud();
18
+
19
+    //区域学段列表
20
+    List<Integer> listLevel();
21
+}

+ 21
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/cloud/CloudSyncDetailMapper.java Vedi File

@@ -0,0 +1,21 @@
1
+package com.xhkjedu.sapi.mapper.cloud;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.cloud.TCloudSyncDetail;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+public interface CloudSyncDetailMapper extends TkMapper<TCloudSyncDetail> {
10
+    //批量添加
11
+    void batchSave(@Param("list") List<TCloudSyncDetail> details, @Param("csid") Integer csid, @Param("createid") Integer createid);
12
+
13
+    //获取未执行完的同步任务详情列表
14
+    List<TCloudSyncDetail> listByCsId(@Param("csid") Integer csid);
15
+
16
+    //更新已同步数量
17
+    void updateRealNum(@Param("detail") TCloudSyncDetail detail);
18
+
19
+    //获取未执行完成的任务详情数量
20
+    Integer countNoEndByCsId(@Param("csid") Integer csid);
21
+}

+ 73
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/cloud/CloudSyncMapper.java Vedi File

@@ -0,0 +1,73 @@
1
+package com.xhkjedu.sapi.mapper.cloud;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.cloud.TCloudSync;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+import java.util.Map;
9
+
10
+public interface CloudSyncMapper extends TkMapper<TCloudSync> {
11
+    //列表
12
+    List<Map> findAll(@Param("sync") TCloudSync sync);
13
+
14
+    //添加
15
+    void save(@Param("sync") TCloudSync sync);
16
+
17
+    //获取最后一条同步任务
18
+    TCloudSync getLastSync();
19
+
20
+    //更新同步状态
21
+    void updateState(@Param("csid") Integer csid, @Param("syncstate") int syncstate);
22
+
23
+    //同步科目
24
+    void syncSubject(@Param("list") List<Map> list);
25
+
26
+    //同步版本
27
+    void syncVersion(@Param("list") List<Map> list);
28
+
29
+    //同步教材
30
+    void syncSubjectBook(@Param("list") List<Map> list);
31
+
32
+    //同步题型
33
+    void syncSubjectQuestionType(@Param("list") List<Map> list);
34
+
35
+    //同步章节
36
+    void syncDirector(@Param("list") List<Map> list);
37
+
38
+    //同步知识点
39
+    void syncPoint(@Param("list") List<Map> list);
40
+
41
+    //同步试题
42
+    void syncQuestion(@Param("m") Map list);
43
+
44
+    //同步试题章节
45
+    void syncQuestionDirector(@Param("list") List<Map> list);
46
+
47
+    //同步试题知识点
48
+    void syncQuestionPoint(@Param("list") List<Map> list);
49
+
50
+    //同步资源
51
+    void syncResource(@Param("m") Map list);
52
+
53
+    //同步资源章节
54
+    void syncResourceDirector(@Param("list") List<Map> list);
55
+
56
+    //平台基础信息
57
+    TCloudSync getCloudInfo();
58
+
59
+    //外键是否存在
60
+    Integer getFkExisted(@Param("fkname") String fkname, @Param("dbname") String dbname);
61
+
62
+    //删除章节外键
63
+    void delDirectorFk();
64
+
65
+    //添加章节外键
66
+    void addDirectorFk();
67
+
68
+    //删除知识点外键
69
+    void delPointFk();
70
+
71
+    //添加知识点外键
72
+    void addPointFk();
73
+}

+ 19
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/system/AreazoneMapper.java Vedi File

@@ -0,0 +1,19 @@
1
+package com.xhkjedu.sapi.mapper.system;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.system.TAreazone;
5
+
6
+import java.util.List;
7
+import java.util.Map;
8
+
9
+public interface AreazoneMapper extends TkMapper<TAreazone> {
10
+    //获取地区列表
11
+    List<Map> listAll();
12
+
13
+    //获取地区选择列表
14
+    List<Map> listForSel();
15
+
16
+    //修改区域全名称
17
+    void updateAreaAll(Integer areaid, String areaall);
18
+    void updateAreaAll2(Integer areaid, String areaall);
19
+}

+ 58
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/system/ModuleMapper.java Vedi File

@@ -0,0 +1,58 @@
1
+package com.xhkjedu.sapi.mapper.system;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.system.TModule;
5
+import com.xhkjedu.sapi.vo.system.ModuleSelVo;
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 ModuleMapper
14
+ * Description 模块
15
+ * Author WN
16
+ * Date 2020/6/11 16:13
17
+ **/
18
+@Repository
19
+public interface ModuleMapper extends TkMapper<TModule> {
20
+
21
+    /**
22
+     *功能描述 所有模块
23
+     * @author WN
24
+     * @date 2020/6/11
25
+     * @param  * @param schoolid
26
+     * @param display
27
+     * @return java.util.List<com.xhkjedu.model.system.TModule>
28
+     */
29
+    List<TModule> listModules(@Param("schoolid") Integer schoolid, @Param("moduletype") Integer moduletype, @Param("display") Integer display);
30
+
31
+    //获取第一层模块
32
+    List<ModuleSelVo> listLevelModule(@Param("schoolid") Integer schoolid, @Param("moduletype") Integer moduletype);
33
+
34
+
35
+    /**
36
+     * 修改模块排序
37
+     * @Param [module]
38
+     * @Author ywx
39
+     * @Date 2020/8/31 16:24
40
+     * @return void
41
+     **/
42
+    void updateOrder(@Param("module") TModule module);
43
+
44
+    /**
45
+     * 模块上移
46
+     * @Param [modules]
47
+     * @Author ywx
48
+     * @Date 2020/8/31 16:28
49
+     * @return void
50
+     **/
51
+    void moveUp(@Param("list") List<TModule> modules);
52
+
53
+    //模块选择列表
54
+    List<Map> listForSel2(@Param("schoolid") Integer schoolid, @Param("moduletype") Integer moduletype);
55
+
56
+    //删除默认模块关联的学校模块
57
+    void deleteByDefaultId(String defaultid);
58
+}

+ 28
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/system/ModuledefaultMapper.java Vedi File

@@ -0,0 +1,28 @@
1
+package com.xhkjedu.sapi.mapper.system;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.system.TModule;
5
+import com.xhkjedu.sapi.model.system.TModuledefault;
6
+import com.xhkjedu.sapi.vo.system.ModuleSelVo;
7
+import org.apache.ibatis.annotations.Param;
8
+
9
+import java.util.List;
10
+
11
+public interface ModuledefaultMapper extends TkMapper<TModuledefault> {
12
+    //所有模块
13
+    List<TModule> listModules(@Param("moduletype") Integer moduletype, @Param("display") Integer display);
14
+
15
+    //首层模块
16
+    List<ModuleSelVo> listLevelModule(@Param("moduletype") Integer moduletype);
17
+
18
+    //获取学校id集合
19
+    List<Integer> listSchoolId();
20
+
21
+    //模块地址对应模块数量
22
+    Integer countByUrl(String moduleurl, Integer moduletype);
23
+
24
+    //更新学校模块信息
25
+    void updateByDefaultId(String moduleid);
26
+
27
+    String getModuleIdByDefaultId(@Param("moduleid") String moduleid, @Param("schoolid") Integer schoolid, @Param("moduletype") Integer moduletype);
28
+}

+ 60
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/system/SchoolMapper.java Vedi File

@@ -0,0 +1,60 @@
1
+package com.xhkjedu.sapi.mapper.system;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.system.TSchool;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+import java.util.Map;
9
+
10
+public interface SchoolMapper extends TkMapper<TSchool> {
11
+    //删除
12
+    Integer deleteById(@Param("schoolid") Integer schoolid);
13
+
14
+    //列表
15
+    List<TSchool> findAll();
16
+
17
+    /**
18
+     * 学年升级
19
+     * @Param [schoolid]
20
+     * @Author ywx
21
+     * @Date 2020/6/12 13:54
22
+     * @return java.lang.Integer
23
+     **/
24
+    Integer upgrade(@Param("schoolid") Integer schoolid);
25
+
26
+    /**
27
+     * 学年降级
28
+     * @Param [schoolid, year]
29
+     * @Author ywx
30
+     * @Date 2020/6/16 13:51
31
+     * @return java.lang.Integer
32
+     **/
33
+    Integer downgrade(@Param("schoolid") Integer schoolid, @Param("year") Integer year);
34
+
35
+    //学校选择列表
36
+    List<Map> listForSel();
37
+
38
+    TSchool getSchoolDetailById(@Param("schoolid") Integer schoolid);//获取区域码
39
+
40
+    //更改学校是否绑定状态
41
+    Integer updateSchoolDock(@Param("schoolid") Integer schoolid, @Param("docklc") Integer docklc);
42
+
43
+    //根据学校名称查找学校数量
44
+    Integer countBySchoolName(String schoolname);
45
+
46
+    //获取学校当前年份
47
+    Integer getYearById(Integer schoolid);
48
+
49
+    //获取用户当前年份
50
+    Integer getYearByUserId(Integer userid);
51
+
52
+    //获取学校账号数量
53
+    Integer getUserNumById(Integer schoolid);
54
+
55
+    //修改
56
+    Integer updateById(@Param("school") TSchool school);
57
+
58
+    //根据域名获取学校id
59
+    Integer getSchoolIdByDomain(String schooldomain, Integer schoolid);
60
+}

+ 17
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/system/SchoolStypeMapper.java Vedi File

@@ -0,0 +1,17 @@
1
+package com.xhkjedu.sapi.mapper.system;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.system.TSchoolStype;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+public interface SchoolStypeMapper extends TkMapper<TSchoolStype> {
10
+    //通过域名获取学校样式列表
11
+    List<TSchoolStype> findAll(@Param("stype") TSchoolStype stype);
12
+    //通过学校id获取学校样式列表
13
+    List<TSchoolStype> findAll2(@Param("stype") TSchoolStype stype);
14
+
15
+    //批量添加
16
+    void batchSave(@Param("list") List<TSchoolStype> list);
17
+}

+ 11
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/system/SyserrorMapper.java Vedi File

@@ -0,0 +1,11 @@
1
+package com.xhkjedu.sapi.mapper.system;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.system.TSyserror;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+public interface SyserrorMapper extends TkMapper<TSyserror> {
10
+    List<TSyserror> listAll(@Param("error") TSyserror error);
11
+}

+ 21
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/system/UserLogMapper.java Vedi File

@@ -0,0 +1,21 @@
1
+package com.xhkjedu.sapi.mapper.system;
2
+
3
+import com.xhkjedu.sapi.model.system.TUserLog;
4
+import org.apache.ibatis.annotations.Param;
5
+import org.springframework.stereotype.Repository;
6
+import tk.mybatis.mapper.additional.insert.InsertListMapper;
7
+import tk.mybatis.mapper.common.Mapper;
8
+
9
+import java.util.List;
10
+
11
+@Repository
12
+public interface UserLogMapper extends Mapper<TUserLog>, InsertListMapper<TUserLog> {
13
+    /**
14
+     * 登录日志列表
15
+     * @Param [log]
16
+     * @Author ywx
17
+     * @Date 2020/6/17 17:21
18
+     * @return java.util.List<com.xhkjedu.model.system.TUserLog>
19
+     **/
20
+    List<TUserLog> listLog(@Param("log") TUserLog log);
21
+}

+ 26
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/BaseBean.java Vedi File

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

+ 65
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/cloud/TCloud.java Vedi File

@@ -0,0 +1,65 @@
1
+package com.xhkjedu.sapi.model.cloud;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_cloud")
10
+@Data
11
+public class TCloud extends BaseBean {
12
+    @Id
13
+    //云平台管理表
14
+    private Integer cloudid;
15
+
16
+    //云平台名称
17
+    private String cloudname;
18
+
19
+    private String cloudshort;//简称
20
+
21
+    //云平台码
22
+    private String cloudcode;
23
+
24
+    //联系人
25
+    private String account;
26
+
27
+    //联系人手机号
28
+    private String phone;
29
+
30
+    //备注
31
+    private String comm;
32
+
33
+    //是否绑定手机号0不绑定1绑定
34
+    private Integer bindphone;
35
+
36
+    //是否有学生网页端0没有1有
37
+    private Integer stuweb;
38
+
39
+    //主题色
40
+    private String theme;
41
+
42
+    //登录背景图片
43
+    private String loginbg;
44
+
45
+    //登录页面字体图片
46
+    private String loginname;
47
+
48
+    //区域设置的ico
49
+    private String loginico;
50
+
51
+    //技术支持
52
+    private String tesupport;
53
+
54
+    //备案号
55
+    private String recordno;
56
+
57
+    //创建人id
58
+    private Integer createid;
59
+
60
+    //创建时间
61
+    private Integer createtime;
62
+
63
+    //区地区显示json
64
+    private String cloudmap;
65
+}

+ 53
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/cloud/TCloudSync.java Vedi File

@@ -0,0 +1,53 @@
1
+package com.xhkjedu.sapi.model.cloud;
2
+
3
+import com.xhkjedu.sapi.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.List;
10
+
11
+@Table(name = "t_cloud_sync")
12
+@Data
13
+public class TCloudSync extends BaseBean {
14
+    @Id
15
+    //同步任务表
16
+    private Integer csid;
17
+
18
+    //同步起始
19
+    private Integer begintime;
20
+
21
+    //同步结束
22
+    private Integer endtime;
23
+
24
+    //实际同步开始时间
25
+    private Integer starttime;
26
+
27
+    //实际同步结束时间
28
+    private Integer stoptime;
29
+
30
+    //同步任务0不需要同步1需要同步
31
+    private Integer synctask;
32
+
33
+    //同步状态0进行中1成功2失败
34
+    private Integer syncstate;
35
+
36
+    //创建人id
37
+    private Integer createid;
38
+
39
+    //创建时间
40
+    private Integer createtime;
41
+
42
+    @Transient
43
+    //云平台码
44
+    private String cloudcode;
45
+
46
+    @Transient
47
+    //一次同步数量
48
+    private Integer syncnum;
49
+
50
+    @Transient
51
+    //详情列表
52
+    private List<TCloudSyncDetail> syncdetails;
53
+}

+ 60
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/cloud/TCloudSyncDetail.java Vedi File

@@ -0,0 +1,60 @@
1
+package com.xhkjedu.sapi.model.cloud;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_cloud_sync_detail")
10
+@Data
11
+public class TCloudSyncDetail extends BaseBean {
12
+    @Id
13
+    //同步任务详情表
14
+    private Integer csdid;
15
+
16
+    //同步任务表
17
+    private Integer csid;
18
+
19
+    //同步表名
20
+    private String synctable;
21
+
22
+    //需要同步条数
23
+    private Integer plannum;
24
+
25
+    //起始id
26
+    private String beginid;
27
+
28
+    //结束id
29
+    private String endid;
30
+
31
+    //一次同步数量
32
+    private Integer syncnum;
33
+
34
+    //已同步数量
35
+    private Integer realnum;
36
+
37
+    //正在处理的最大id
38
+    private String handleid;
39
+
40
+    //同步开始时间
41
+    private Integer begintime;
42
+
43
+    //同步结束时间
44
+    private Integer endtime;
45
+
46
+    //实际开始时间
47
+    private Integer starttime;
48
+
49
+    //实际结束时间
50
+    private Integer stoptime;
51
+
52
+    //教材id
53
+    private String lsbid;
54
+
55
+    //创建人id
56
+    private Integer createid;
57
+
58
+    //创建时间
59
+    private Integer createtime;
60
+}

+ 54
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TDirector.java Vedi File

@@ -0,0 +1,54 @@
1
+package com.xhkjedu.sapi.model.subjectbook;
2
+
3
+import com.xhkjedu.sapi.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
sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TPoint.java Vedi File

@@ -0,0 +1,53 @@
1
+package com.xhkjedu.sapi.model.subjectbook;
2
+
3
+import com.xhkjedu.sapi.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
+}

+ 110
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TQuestion.java Vedi File

@@ -0,0 +1,110 @@
1
+package com.xhkjedu.sapi.model.subjectbook;
2
+
3
+import com.xhkjedu.sapi.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.List;
10
+
11
+@Table(name = "t_question")
12
+@Data
13
+public class TQuestion extends BaseBean {
14
+    //试题表
15
+    @Id
16
+    private String questionid;
17
+
18
+    //试题分值
19
+    private Double score;
20
+
21
+    //试题难易度
22
+    private Integer complexity;
23
+
24
+    //处理题型1单选题2多选题3主观题4判断对错5判断✔6判断TF7完形填空8阅读理解
25
+    private Integer ctype;
26
+
27
+    //试题题型id
28
+    private String qtypeid;
29
+
30
+    //试题题型名称
31
+    private String qtypename;
32
+
33
+    @Transient
34
+    //教材关联id
35
+    private String lsbid;
36
+
37
+    @Transient
38
+    //章节id
39
+    private String directorid;
40
+
41
+    //科目id
42
+    private String subjectid;
43
+
44
+    //组题次数
45
+    private Integer count;
46
+
47
+    //资源归属1平台1区平台3学校4个人(搜索时5我的收藏 6我的上传)
48
+    private Integer belong;
49
+
50
+    //试题类型0母题1子题
51
+    private Integer qlevel;
52
+
53
+    //试题状态0默认1正常(上架)2下架10已删除
54
+    private Integer qstate;
55
+
56
+    //来源
57
+    private String source;
58
+
59
+    //年份
60
+    private Integer year;
61
+
62
+    //归属省份
63
+    private String region;
64
+
65
+    //资源归属地学校名称
66
+    private String schoolname;
67
+
68
+    //同步时间戳
69
+    private Integer timeunix;
70
+
71
+    //创建人id
72
+    private Integer createid;
73
+
74
+    //创建时间
75
+    private Integer createtime;
76
+
77
+    //学校id
78
+    private Integer schoolid;
79
+
80
+    //试题题干
81
+    private String qstem;
82
+
83
+    //题干纯文本
84
+    private String qstemtxt;
85
+
86
+    //试题选项
87
+    private String qoption;
88
+
89
+    //试题答案
90
+    private String qanswer;
91
+
92
+    //试题分析
93
+    private String qanalyze;
94
+
95
+    //上传试卷id
96
+    @Transient
97
+    private Integer upid;
98
+
99
+    //试题关联知识点
100
+    @Transient
101
+    private List<TQuestionPoint> questionPoints;
102
+
103
+    //试题关联章节
104
+    @Transient
105
+    private List<TQuestionDirector> directors;
106
+
107
+    //知识点id
108
+    @Transient
109
+    private String pointid;
110
+}

+ 32
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TQuestionDirector.java Vedi File

@@ -0,0 +1,32 @@
1
+package com.xhkjedu.sapi.model.subjectbook;
2
+
3
+import lombok.Data;
4
+
5
+import javax.persistence.Id;
6
+import javax.persistence.Table;
7
+
8
+@Table(name = "t_question_director")
9
+@Data
10
+public class TQuestionDirector {
11
+    @Id
12
+    //试题关联章节表
13
+    private String qdid;
14
+
15
+    //试题id
16
+    private String questionid;
17
+
18
+    //教材id
19
+    private String lsbid;
20
+
21
+    //章节id
22
+    private String directorid;
23
+
24
+    //创建人id
25
+    private Integer createid;
26
+
27
+    //创建时间
28
+    private Integer createtime;
29
+
30
+    //同步时间戳
31
+    private Integer timeunix;
32
+}

+ 33
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TQuestionPoint.java Vedi File

@@ -0,0 +1,33 @@
1
+package com.xhkjedu.sapi.model.subjectbook;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_question_point")
10
+@Data
11
+public class TQuestionPoint extends BaseBean {
12
+    //试题关联知识点表
13
+    @Id
14
+    private String qpid;
15
+
16
+    //试题id
17
+    private String questionid;
18
+
19
+    //知识点id
20
+    private String pointid;
21
+
22
+    //创建人id
23
+    private Integer createid;
24
+
25
+    //创建时间
26
+    private Integer createtime;
27
+
28
+    //学校id
29
+    private Integer schoolid;
30
+
31
+    //同步时间戳
32
+    private Integer timeunix;
33
+}

+ 120
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TResource.java Vedi File

@@ -0,0 +1,120 @@
1
+package com.xhkjedu.sapi.model.subjectbook;
2
+
3
+import com.xhkjedu.sapi.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.List;
10
+
11
+@Table(name = "t_resource")
12
+@Data
13
+public class TResource extends BaseBean {
14
+    //资源表
15
+    @Id
16
+    private String resourceid;
17
+
18
+    //资源名称
19
+    private String resourcename;
20
+
21
+    @Transient
22
+    //教材关系表id
23
+    private String lsbid;
24
+
25
+    @Transient
26
+    //章节id
27
+    private String directorid;
28
+
29
+    //阅读次数
30
+    private Integer readcount;
31
+
32
+    //下载次数
33
+    private Integer downcount;
34
+
35
+    //资源分类1word,2ppt,3pdf,4图片,5视频,6音频,7压缩包,10其他
36
+    private Integer resourceclass;
37
+
38
+    //资源类型1习题2教案3课件4素材5视频6学案7压缩包10其他
39
+    private Integer resourcetype;
40
+
41
+    //资源级别1校本2个人(备课)3导学案4视频库
42
+    private Integer level;
43
+
44
+    //资源归属1平台1区平台3学校4个人(搜索时5我的收藏 6我的上传)
45
+    private Integer belong;
46
+
47
+    //资源等级:1普通2精品3特供4第三方
48
+    private Integer resourcegrade;
49
+
50
+    //来源
51
+    private String source;
52
+
53
+    //资源所属年份
54
+    private Integer year;
55
+
56
+    //地区
57
+    private String region;
58
+
59
+    //学校
60
+    private String schoolname;
61
+
62
+    //同步时间戳
63
+    private Integer timeunix;
64
+
65
+    //是否转换0未转换1已转换2转换失败3加密
66
+    private Integer converted;
67
+
68
+    //转换失败原因
69
+    private String convertmsg;
70
+
71
+    //转换后的pdf文件地址
72
+    private String pdfurl;
73
+
74
+    //资源地址
75
+    private String resourceurl;
76
+
77
+    //封面图地址
78
+    private String resourcecover;
79
+
80
+    //资源状态1正常10删除
81
+    private Integer resourcestate;
82
+
83
+    //文件后缀
84
+    private String suffix;
85
+
86
+    //mp4文件编码:mpeg4网页端不能播放,h264网页端能播放
87
+    private String mp4code;
88
+
89
+    //文件大小
90
+    private Integer resourcesize;
91
+
92
+    //视频时长(秒)
93
+    private Integer duration;
94
+
95
+    //创建人id
96
+    private Integer createid;
97
+
98
+    //创建时间
99
+    private Integer createtime;
100
+
101
+    //学校id
102
+    private Integer schoolid;
103
+
104
+    //备注
105
+    private String comm;
106
+
107
+    //班级id
108
+    @Transient
109
+    private Integer classid;
110
+
111
+    //科目id
112
+    private String subjectid;
113
+
114
+    @Transient
115
+    //状态0全部1未查看1已查看
116
+    private Integer costtime;
117
+
118
+    @Transient
119
+    private List<TResourceDirector> directors;//资源教材章节
120
+}

+ 37
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TResourceDirector.java Vedi File

@@ -0,0 +1,37 @@
1
+package com.xhkjedu.sapi.model.subjectbook;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+/**
10
+ * @ClassName TResourceDirector
11
+ * Description TODO 资源教材章节关联表
12
+ * Author WN
13
+ * Date 2021/1/4 16:38
14
+ **/
15
+@Table(name = "t_resource_director")
16
+@Data
17
+public class TResourceDirector extends BaseBean {
18
+    @Id
19
+    private String rdid;//资源教材章节表id
20
+
21
+    private String resourceid;//资源id
22
+
23
+    private String lsbid;//教材id
24
+
25
+    //章节id
26
+    private String directorid;
27
+
28
+    //创建人id
29
+    private Integer createid;
30
+
31
+    //创建时间
32
+    private Integer createtime;
33
+
34
+    //同步时间戳
35
+    private Integer timeunix;
36
+
37
+}

+ 39
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TSubject.java Vedi File

@@ -0,0 +1,39 @@
1
+package com.xhkjedu.sapi.model.subjectbook;
2
+
3
+import com.xhkjedu.sapi.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
sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TSubjectBook.java Vedi File

@@ -0,0 +1,57 @@
1
+package com.xhkjedu.sapi.model.subjectbook;
2
+
3
+import com.xhkjedu.sapi.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
sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TSubjectQuestiontype.java Vedi File

@@ -0,0 +1,42 @@
1
+package com.xhkjedu.sapi.model.subjectbook;
2
+
3
+import com.xhkjedu.sapi.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
sapi/src/main/java/com/xhkjedu/sapi/model/subjectbook/TVersion.java Vedi File

@@ -0,0 +1,36 @@
1
+package com.xhkjedu.sapi.model.subjectbook;
2
+
3
+import com.xhkjedu.sapi.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
+}

+ 39
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/system/TAreazone.java Vedi File

@@ -0,0 +1,39 @@
1
+package com.xhkjedu.sapi.model.system;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_areazone")
10
+@Data
11
+public class TAreazone extends BaseBean {
12
+    @Id
13
+    //地区表主键id
14
+    private Integer areaid;
15
+
16
+    //地区名称
17
+    private String areaname;
18
+
19
+    //区域全名称
20
+    private String areaall;
21
+
22
+    //归属地区
23
+    private Integer areapid;
24
+
25
+    //地区编码
26
+    private String areacode;
27
+
28
+    //层级1省份层2市层3区、县层
29
+    private Integer level;
30
+
31
+    //对应领创地区id
32
+    private Integer lcregion;
33
+
34
+    //创建人
35
+    private Integer createid;
36
+
37
+    //创建时间
38
+    private Integer createtime;
39
+}

+ 69
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/system/TModule.java Vedi File

@@ -0,0 +1,69 @@
1
+package com.xhkjedu.sapi.model.system;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import java.util.ArrayList;
9
+import java.util.List;
10
+
11
+@Table(name = "t_module")
12
+@Data
13
+public class TModule extends BaseBean {
14
+    //模块表
15
+    @Id
16
+    private String moduleid;
17
+
18
+    //模块名称
19
+    private String modulename;
20
+
21
+    //模块简称
22
+    private String mabbrevname;
23
+
24
+    //模块地址
25
+    private String moduleurl;
26
+
27
+    //图标地址
28
+    private String moduleico;
29
+
30
+    //所属父模块id
31
+    private String modulepid;
32
+
33
+    private Integer moduletype;//模块归属1教师网页2学生网页3学生平板
34
+
35
+    //排序
36
+    private Integer morder;
37
+
38
+    //模块备注
39
+    private String comm;
40
+
41
+    //内外部应用1内容应用2外部应用
42
+    private Integer minout;
43
+
44
+    //模块分组或应用1分组2应用
45
+    private Integer mclass;
46
+
47
+    //级别1一级2二级
48
+    private Integer level;
49
+
50
+    //是否是默认分类0不是1是
51
+    private Integer mdefault;
52
+
53
+    //是否显示:1显示10不显示
54
+    private Integer display;
55
+
56
+    //默认模块表id
57
+    private String defaultid;
58
+
59
+    //创建人id
60
+    private Integer createid;
61
+
62
+    //创建时间
63
+    private Integer createtime;
64
+
65
+    //学校id
66
+    private Integer schoolid;
67
+
68
+    List<TModule> modulechilds = new ArrayList<>();
69
+}

+ 56
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/system/TModuledefault.java Vedi File

@@ -0,0 +1,56 @@
1
+package com.xhkjedu.sapi.model.system;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_moduledefault")
10
+@Data
11
+public class TModuledefault extends BaseBean {
12
+    @Id
13
+    //默认功能模块表
14
+    private String moduleid;
15
+
16
+    //模块名称
17
+    private String modulename;
18
+
19
+    //模块简称
20
+    private String mabbrevname;
21
+
22
+    //模块地址
23
+    private String moduleurl;
24
+
25
+    //图标地址
26
+    private String moduleico;
27
+
28
+    //所属父模块
29
+    private String modulepid;
30
+
31
+    private Integer moduletype;//模块归属1教师网页2学生网页3学生平板
32
+
33
+    //排序
34
+    private Integer morder;
35
+
36
+    //内外部应用1内部应用2外部应用
37
+    private Integer minout;
38
+
39
+    //模块分组或应用1分组2应用
40
+    private Integer mclass;
41
+
42
+    //级别1一级2二级
43
+    private Integer level;
44
+
45
+    //是否是默认分类0不是1是
46
+    private Integer mdefault;
47
+
48
+    //是否显示:1显示10不显示
49
+    private Integer display;
50
+
51
+    //模块备注
52
+    private String comm;
53
+
54
+    //创建时间
55
+    private Integer createtime;
56
+}

+ 67
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/system/TSchool.java Vedi File

@@ -0,0 +1,67 @@
1
+package com.xhkjedu.sapi.model.system;
2
+
3
+import com.xhkjedu.sapi.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_school")
11
+@Data
12
+public class TSchool extends BaseBean {
13
+    //学校表
14
+    @Id
15
+    private Integer schoolid;
16
+
17
+    //学校名称
18
+    private String schoolname;
19
+
20
+    //学校简称
21
+    private String shortname;
22
+
23
+    //学校状态1正常10删除
24
+    private Integer schoolstate;
25
+
26
+    //学校阶段1小学2初中3高中4大学
27
+    private Integer schoollevel;
28
+
29
+    //是否绑定硬件地址0不绑定1绑定
30
+    private Integer bindmac;
31
+
32
+    //当前年份
33
+    private Integer year;
34
+
35
+    //错误率%
36
+    private Integer errorrate;
37
+
38
+    //学校域名地址
39
+    private String schooldomain;
40
+
41
+    //直播授权数量
42
+    private Integer livenum;
43
+
44
+    //直播授权有效期
45
+    private Integer livetime;
46
+
47
+    //坐标数组
48
+    private String coordinate;
49
+
50
+    private Integer docklc;//是否对接领创0不对接1未对接2对接完成
51
+
52
+    private Integer usernum;//账号数量
53
+
54
+    //创建人
55
+    private Integer createid;
56
+
57
+    //创建时间
58
+    private Integer createtime;
59
+
60
+
61
+    @Transient
62
+    //管理员登录账号
63
+    private String loginname;
64
+
65
+    @Transient
66
+    private String cloudcode;//区域码
67
+}

+ 37
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/system/TSchoolStype.java Vedi File

@@ -0,0 +1,37 @@
1
+package com.xhkjedu.sapi.model.system;
2
+
3
+import lombok.Data;
4
+
5
+import javax.persistence.Id;
6
+import javax.persistence.Table;
7
+import javax.persistence.Transient;
8
+
9
+@Table(name = "t_school_stype")
10
+@Data
11
+public class TSchoolStype {
12
+    @Id
13
+    //学校样式表
14
+    private Integer stid;
15
+
16
+    //学校域名
17
+    private String schooldomain;
18
+
19
+    //图片分类:theme主色调loginname登录页名称loginbg登录也背景mainname主页面名称mainlogo主页面logo
20
+    private String schooltype;
21
+
22
+    //图片地址
23
+    private String stypeaddr;
24
+
25
+    //创建人id
26
+    private Integer createid;
27
+
28
+    //创建时间
29
+    private Integer createtime;
30
+
31
+    //学校id
32
+    private Integer schoolid;
33
+
34
+    @Transient
35
+    //学校名称
36
+    private String schoolname;
37
+}

+ 24
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/system/TSyserror.java Vedi File

@@ -0,0 +1,24 @@
1
+package com.xhkjedu.sapi.model.system;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_syserror")
10
+@Data
11
+public class TSyserror extends BaseBean {
12
+    @Id
13
+    //系统错误主键id
14
+    private Integer errid;
15
+
16
+    //设备web android pc
17
+    private String device;
18
+
19
+    //创建时间
20
+    private Integer createtime;
21
+
22
+    //错误信息
23
+    private String errmsg;
24
+}

+ 53
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/system/TUserLog.java Vedi File

@@ -0,0 +1,53 @@
1
+package com.xhkjedu.sapi.model.system;
2
+
3
+import com.xhkjedu.sapi.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_user_log")
11
+@Data
12
+public class TUserLog extends BaseBean {
13
+    //登录日志主键id
14
+    @Id
15
+    private Integer ulid;
16
+
17
+    //用户id
18
+    private Integer userid;
19
+
20
+    //姓名
21
+    private String username;
22
+
23
+    //登录名
24
+    private String loginname;
25
+
26
+    //登录状态1成功2失败
27
+    private Integer loginstate;
28
+
29
+    //登录时间
30
+    private Integer logtime;
31
+
32
+    //登录ip
33
+    private String logip;
34
+
35
+    //登录地址
36
+    private String logaddress;
37
+
38
+    //登录终端设备
39
+    private String ultype;
40
+
41
+    //版本号
42
+    private String versionnum;
43
+
44
+    //备注
45
+    private String logtxt;
46
+
47
+    //学校id
48
+    private Integer schoolid;
49
+
50
+    @Transient
51
+    //截止时间
52
+    private Integer endtime;
53
+}

+ 40
- 0
sapi/src/main/java/com/xhkjedu/sapi/service/cloud/CloudService.java Vedi File

@@ -0,0 +1,40 @@
1
+package com.xhkjedu.sapi.service.cloud;
2
+
3
+import com.xhkjedu.sapi.mapper.cloud.CloudMapper;
4
+import com.xhkjedu.sapi.model.cloud.TCloud;
5
+import org.springframework.stereotype.Service;
6
+
7
+import javax.annotation.Resource;
8
+import java.util.List;
9
+
10
+/**
11
+ * @author ywx
12
+ * @classname CloudService
13
+ * @description
14
+ * @date 2021/6/30 14:49
15
+ **/
16
+@Service
17
+public class CloudService {
18
+    @Resource
19
+    private CloudMapper cloudMapper;
20
+
21
+    //详情
22
+    public TCloud findById(){
23
+        return cloudMapper.getCloud();
24
+    }
25
+
26
+    //修改主题
27
+    public void updateTheme(TCloud cloud) {
28
+        cloudMapper.updateTheme(cloud);
29
+    }
30
+
31
+    //修改基础信息
32
+    public void updateInfo(TCloud cloud){
33
+        cloudMapper.updateInfo(cloud);
34
+    }
35
+
36
+    //区域学段列表
37
+    public List<Integer> listLevel() {
38
+        return cloudMapper.listLevel();
39
+    }
40
+}

+ 268
- 0
sapi/src/main/java/com/xhkjedu/sapi/service/cloud/CloudSyncService.java Vedi File

@@ -0,0 +1,268 @@
1
+package com.xhkjedu.sapi.service.cloud;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.sapi.config.ConfigKey;
5
+import com.xhkjedu.sapi.mapper.cloud.CloudSyncDetailMapper;
6
+import com.xhkjedu.sapi.mapper.cloud.CloudSyncMapper;
7
+import com.xhkjedu.sapi.model.cloud.TCloudSync;
8
+import com.xhkjedu.sapi.model.cloud.TCloudSyncDetail;
9
+import com.xhkjedu.sapi.utils.ApiUtil;
10
+import com.xhkjedu.sapi.utils.CopyURL;
11
+import com.xhkjedu.utils.N_Utils;
12
+import com.xhkjedu.vo.ResultVo;
13
+import lombok.extern.slf4j.Slf4j;
14
+import org.springframework.stereotype.Service;
15
+import org.springframework.util.LinkedMultiValueMap;
16
+import org.springframework.util.MultiValueMap;
17
+
18
+import javax.annotation.Resource;
19
+import java.util.ArrayList;
20
+import java.util.List;
21
+import java.util.Map;
22
+
23
+/**
24
+ * @author ywx
25
+ * @classname CloudSyncService
26
+ * @description 
27
+ * @date 2021/5/6 15:48
28
+ **/
29
+@Service
30
+@Slf4j
31
+public class CloudSyncService {
32
+    @Resource
33
+    private CloudSyncMapper cloudSyncMapper;
34
+    @Resource
35
+    private CloudSyncDetailMapper cloudSyncDetailMapper;
36
+
37
+    //列表
38
+    public List<Map> findAll(TCloudSync sync) {
39
+        return cloudSyncMapper.findAll(sync);
40
+    }
41
+
42
+    //添加
43
+    public void save(TCloudSync model) {
44
+        model.setCreatetime(N_Utils.getSecondTimestamp());
45
+        cloudSyncMapper.insertSelective(model);
46
+    }
47
+
48
+    //同步基础信息、试题、资源
49
+    public synchronized ResultVo sync(TCloudSync sync) {
50
+        TCloudSync lastSync = cloudSyncMapper.getLastSync();
51
+        Integer csid;
52
+        List<TCloudSyncDetail> details = null;
53
+        if (lastSync == null || lastSync.getSyncstate() == 1 || lastSync.getSynctask() == 0) {
54
+            String cloudcode = sync.getCloudcode();
55
+            Integer begintime = lastSync==null?null:lastSync.getEndtime();
56
+            String param = "{\"cloudcode\": \""+cloudcode+"\",\"begintime\":"+begintime+"}";
57
+            //同步任务
58
+            ResultVo vo = getResultVo("csync/g",param);
59
+            if (vo.getCode() != 0) return vo;
60
+            TCloudSync cloudSync = JSON.parseObject(JSON.toJSONString(vo.getObj()),TCloudSync.class);
61
+            csid = cloudSync.getCsid();
62
+            cloudSync.setCreateid(sync.getCreateid());
63
+            if (cloudSync.getSynctask() == 1) {
64
+                cloudSync.setStarttime(N_Utils.getSecondTimestamp());
65
+            }
66
+            cloudSyncMapper.save(cloudSync);
67
+
68
+            //同步任务详情
69
+            details = cloudSync.getSyncdetails();
70
+            if (N_Utils.isListNotEmpty(details)) {
71
+                cloudSyncDetailMapper.batchSave(details,csid,sync.getCreateid());
72
+            }
73
+        } else {
74
+            csid = lastSync.getCsid();
75
+            if (lastSync.getSynctask() == 1) {
76
+                details = cloudSyncDetailMapper.listByCsId(csid);
77
+            }
78
+        }
79
+
80
+        ResultVo vo = syncDetail(details, csid, sync.getSyncnum());
81
+        if (vo != null) return vo;
82
+
83
+        return new ResultVo(0,"同步成功");
84
+    }
85
+
86
+    //调用云平台接口
87
+    private ResultVo getResultVo(String url, String param) {
88
+        String result = N_Utils.sendJsonPost(ConfigKey.cloudapi + url, param);
89
+        ResultVo vo = JSON.parseObject(result, ResultVo.class);
90
+        return vo;
91
+    }
92
+
93
+    //同步任务详情
94
+    private ResultVo syncDetail(List<TCloudSyncDetail> details, Integer csid, Integer syncnum) {
95
+        if (N_Utils.isListEmpty(details)) return null;
96
+        for (TCloudSyncDetail detail : details) {
97
+            detail.setSyncnum(syncnum);
98
+            Integer realnum = detail.getRealnum();
99
+            ResultVo vo = getResultVo("csync/s",JSON.toJSONString(detail));//获取同步数据
100
+            if (vo.getCode() != 0) return vo;
101
+            String endid = detail.getEndid();
102
+            List<Map> list = (List<Map>) vo.getObj();
103
+            realnum += list.size();
104
+            String synctable = detail.getSynctable();
105
+            if (synctable.equals("t_director")) {
106
+                Integer fkExisted = cloudSyncMapper.getFkExisted("fk_directorpid", ConfigKey.dbname);
107
+                if (!N_Utils.isEmptyInteger(fkExisted)) {
108
+                    cloudSyncMapper.delDirectorFk();//删除章节外键
109
+                }
110
+            } else if (synctable.equals("t_point")) {
111
+                Integer fkExisted = cloudSyncMapper.getFkExisted("fk_pointpid", ConfigKey.dbname);
112
+                if (!N_Utils.isEmptyInteger(fkExisted)) {
113
+                    cloudSyncMapper.delPointFk();//删除知识点外键
114
+                }
115
+            }
116
+            String handleid = syncList(detail, list);
117
+            while (handleid != null && !endid.equals(handleid)) {
118
+                detail.setHandleid(handleid);
119
+                detail.setRealnum(realnum);
120
+                vo = getResultVo("csync/s",JSON.toJSONString(detail));//获取同步数据
121
+                if (vo.getCode() != 0) return vo;
122
+                list = (List<Map>) vo.getObj();
123
+                realnum += list.size();
124
+                handleid = syncList(detail,list);
125
+            }
126
+            if (synctable.equals("t_director")) {
127
+                cloudSyncMapper.addDirectorFk();//添加章节外键
128
+            } else if (synctable.equals("t_point")) {
129
+                cloudSyncMapper.addPointFk();//添加知识点外键
130
+            }
131
+        }
132
+
133
+        Integer num = cloudSyncDetailMapper.countNoEndByCsId(csid);//获取未执行完成的任务详情数量
134
+        if (num == 0) cloudSyncMapper.updateState(csid, 1);
135
+        return null;
136
+    }
137
+
138
+    //同步任务详情数据
139
+    private String syncList(TCloudSyncDetail detail, List<Map> list) {
140
+        String synctable = detail.getSynctable();
141
+        String handleid = null;
142
+        int syncnum = list.size();
143
+        List<String> files = new ArrayList<>();
144
+        try {
145
+            if (synctable.equals("t_subject")) {//同步科目
146
+                handleid = (String) list.get(list.size()-1).get("subjectid");
147
+                cloudSyncMapper.syncSubject(list);
148
+            } else if (synctable.equals("t_version")) {//同步版本
149
+                handleid = (String) list.get(list.size()-1).get("versionid");
150
+                cloudSyncMapper.syncVersion(list);
151
+            } else if (synctable.equals("t_subject_book")) {//同步教材
152
+                handleid = (String) list.get(list.size()-1).get("lsbid");
153
+                for (Map sb : list) {
154
+                    String coverpath = (String) sb.get("coverpath");
155
+                    files.add(coverpath);//教材封面图
156
+                }
157
+                cloudSyncMapper.syncSubjectBook(list);
158
+            } else if (synctable.equals("t_subject_questiontype")) {//同步题型
159
+                handleid = (String) list.get(list.size()-1).get("qtypeid");
160
+                cloudSyncMapper.syncSubjectQuestionType(list);
161
+            } else if (synctable.equals("t_director")) {//同步章节
162
+                handleid = (String) list.get(list.size()-1).get("directorid");
163
+                cloudSyncMapper.syncDirector(list);
164
+            } else if (synctable.equals("t_point")) {//同步知识点
165
+                handleid = (String) list.get(list.size()-1).get("pointid");
166
+                cloudSyncMapper.syncPoint(list);
167
+            } else if (synctable.equals("t_question")) {//同步试题
168
+                handleid = (String) list.get(list.size()-1).get("questionid");
169
+                for (Map question : list) {
170
+                    Integer ctype = (Integer) question.get("ctype");
171
+                    String qstem = (String) question.get("qstem");
172
+                    String questionid = (String) question.get("questionid");
173
+                    question.put("qstate",1);
174
+                    try {
175
+                        files.addAll(CopyURL.getImgSrc2(qstem));//题干图片
176
+                        question.put("qstem",qstem.replaceAll(ConfigKey.oldshowurl,ConfigKey.showurl));
177
+                        if (ctype == 1 || ctype == 2) {//单选题、多选题
178
+                            String qoption = (String) question.get("qoption");
179
+                            files.addAll(CopyURL.getImgSrc2(qoption));//选项图片
180
+                            question.put("qoption",qoption.replaceAll(ConfigKey.oldshowurl,ConfigKey.showurl));
181
+                        }
182
+                        if (ctype == 3) {//主观题
183
+                            String qanswer = (String) question.get("qanswer");
184
+                            files.addAll(CopyURL.getImgSrc2(qanswer));//答案图片
185
+                            question.put("qanswer",qanswer.replaceAll(ConfigKey.oldshowurl,ConfigKey.showurl));
186
+                        }
187
+                        String qanalyze = (String) question.get("qanalyze");
188
+                        files.addAll(CopyURL.getImgSrc2(qanalyze));//解析图片
189
+                        question.put("qanalyze",qanalyze.replaceAll(ConfigKey.oldshowurl,ConfigKey.showurl));
190
+                        cloudSyncMapper.syncQuestion(question);
191
+                        try {
192
+                            List<Map> points = (List<Map>) question.get("pointlist");
193
+                            if (N_Utils.isListNotEmpty(points)) cloudSyncMapper.syncQuestionPoint(points);
194
+                        } catch (Exception e) {
195
+                            log.error("同步【t_question_point "+questionid+"】失败",e.getMessage());
196
+                        }
197
+                        try {
198
+                            List<Map> directors = (List<Map>) question.get("dirlist");
199
+                            if (N_Utils.isListNotEmpty(directors)) cloudSyncMapper.syncQuestionDirector(directors);
200
+                        } catch (Exception e) {
201
+                            log.error("同步【t_question_director "+questionid+"】失败",e.getMessage());
202
+                        }
203
+                    } catch (Exception e) {
204
+                        syncnum--;
205
+                        log.error("同步【"+synctable+" "+questionid+"】失败",e.getMessage());
206
+                    }
207
+                }
208
+            } else if (synctable.equals("t_resource")) {//同步资源
209
+                handleid = (String) list.get(list.size()-1).get("resourceid");
210
+                for (Map resource : list) {
211
+                    String resourceid = (String) resource.get("resourceid");
212
+                    String resourceurl = (String) resource.get("resourceurl");
213
+                    String pdfurl = (String) resource.get("pdfurl");
214
+                    String resourcecover = (String) resource.get("resourcecover");
215
+                    resource.put("resourcestate",1);
216
+                    try {
217
+                        if (N_Utils.isNotEmpty(resourceurl)) {//资源文件
218
+                            files.add(resourceurl);
219
+                        }
220
+                        if (N_Utils.isNotEmpty(pdfurl)) {//pdf文件
221
+                            files.add(pdfurl);
222
+                        }
223
+                        if (N_Utils.isNotEmpty(resourcecover)) {//视频封面图
224
+                            files.add(resourcecover);
225
+                        }
226
+                        cloudSyncMapper.syncResource(resource);
227
+                        try {
228
+                            List<Map> directors = (List<Map>) resource.get("dirlist");
229
+                            if (N_Utils.isListNotEmpty(directors)) cloudSyncMapper.syncResourceDirector(directors);
230
+                        } catch (Exception e) {
231
+                            log.error("同步【t_resource_director "+resourceid+"】失败",e.getMessage());
232
+                        }
233
+                    } catch (Exception e) {
234
+                        syncnum--;
235
+                        log.error("同步【"+synctable+" "+resourceid+"】失败",e.getMessage());
236
+                    }
237
+                }
238
+            }
239
+
240
+        } catch (Exception e) {
241
+            syncnum--;
242
+            log.error("同步【"+synctable+"】失败",e.getMessage());
243
+        }
244
+
245
+        if (N_Utils.isListNotEmpty(files)) {//复制文件
246
+            MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
247
+            map.add("filepaths",JSON.toJSONString(files));
248
+            String apiUrl = ConfigKey.fileapi + "dn/down_files";
249
+            ApiUtil.sendFormData(apiUrl,map);
250
+        }
251
+
252
+        //更新已同步数量
253
+        if (N_Utils.isEmpty(detail.getHandleid())) {
254
+            detail.setStarttime(N_Utils.getSecondTimestamp());
255
+        }
256
+        if (detail.getEndid().equals(handleid)) {
257
+            detail.setStoptime(N_Utils.getSecondTimestamp());
258
+        }
259
+        detail.setRealnum(syncnum);
260
+        detail.setHandleid(handleid);
261
+        cloudSyncDetailMapper.updateRealNum(detail);
262
+        return handleid;
263
+    }
264
+
265
+    public TCloudSync getCloudInfo() {
266
+        return cloudSyncMapper.getCloudInfo();
267
+    }
268
+}

+ 65
- 0
sapi/src/main/java/com/xhkjedu/sapi/service/system/AreazoneService.java Vedi File

@@ -0,0 +1,65 @@
1
+package com.xhkjedu.sapi.service.system;
2
+
3
+import com.xhkjedu.sapi.mapper.system.AreazoneMapper;
4
+import com.xhkjedu.sapi.model.system.TAreazone;
5
+import com.xhkjedu.utils.N_Utils;
6
+import org.springframework.stereotype.Service;
7
+
8
+import javax.annotation.Resource;
9
+import java.util.List;
10
+import java.util.Map;
11
+
12
+/**
13
+ * @author ywx
14
+ * @classname AreazoneService
15
+ * @description 
16
+ * @date 2021/4/8 9:28
17
+ **/
18
+@Service
19
+public class AreazoneService {
20
+    @Resource
21
+    private AreazoneMapper areazoneMapper;
22
+
23
+    //添加
24
+    public void save(TAreazone model) {
25
+        model.setCreatetime(N_Utils.getSecondTimestamp());
26
+        areazoneMapper.insertSelective(model);
27
+    }
28
+
29
+    //删除
30
+    public Integer deleteById(Integer id) {
31
+        return areazoneMapper.deleteByPrimaryKey(id);
32
+    }
33
+
34
+    //修改
35
+    public Integer update(TAreazone model) {
36
+        TAreazone areazone = findById(model.getAreaid());
37
+        if (!areazone.getAreaname().equals(model.getAreaname())) {//省份、市地区名称修改
38
+            Integer level = model.getLevel();
39
+            Integer areaid = model.getAreaid();
40
+            String areaall = model.getAreaall();
41
+            if (level == 1) {//省份地区名称修改
42
+                areazoneMapper.updateAreaAll(areaid, areaall);//修改市地区全名称
43
+                areazoneMapper.updateAreaAll2(areaid, areaall);//修改区、县地区全名称
44
+            } else if (level == 2) {//市地区名称修改
45
+                areazoneMapper.updateAreaAll(areaid, areaall);//修改区、县地区全名称
46
+            }
47
+        }
48
+        return areazoneMapper.updateByPrimaryKeySelective(model);
49
+    }
50
+
51
+    //获取详情
52
+    public TAreazone findById(Integer id) {
53
+        return areazoneMapper.selectByPrimaryKey(id);
54
+    }
55
+
56
+    //获取地区列表
57
+    public List <Map> listAll() {
58
+        return areazoneMapper.listAll();
59
+    }
60
+
61
+    //获取地区选择列表
62
+    public List<Map> listForSel() {
63
+        return areazoneMapper.listForSel();
64
+    }
65
+}

+ 185
- 0
sapi/src/main/java/com/xhkjedu/sapi/service/system/ModuleService.java Vedi File

@@ -0,0 +1,185 @@
1
+package com.xhkjedu.sapi.service.system;
2
+
3
+import com.xhkjedu.sapi.mapper.system.ModuleMapper;
4
+import com.xhkjedu.sapi.model.system.TModule;
5
+import com.xhkjedu.sapi.utils.ApiUtil;
6
+import com.xhkjedu.utils.N_Utils;
7
+import com.xhkjedu.sapi.vo.system.ModuleSelVo;
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
+import java.util.Map;
14
+
15
+/**
16
+ * @ClassName ModuleService
17
+ * Description TODO
18
+ * Author WN
19
+ * Date 2020/6/11 16:16
20
+ **/
21
+@Service
22
+public class ModuleService {
23
+    @Autowired
24
+    private ModuleMapper moduleMapper;
25
+
26
+    /**
27
+     *功能描述 添加
28
+     * @author WN
29
+     * @date 2020/6/11
30
+     * @param  * @param module
31
+     * @return java.lang.Integer
32
+     */
33
+    public Integer add(TModule module){
34
+        String id = ApiUtil.getId();
35
+        module.setModuleid(id);
36
+        module.setCreatetime(N_Utils.getSecondTimestamp());
37
+        return moduleMapper.insertSelective(module);
38
+    }
39
+
40
+    /**
41
+     * 添加并返回主键
42
+     * @Param [module]
43
+     * @Author ywx
44
+     * @Date 2020/7/2 11:20
45
+     * @return java.lang.Integer
46
+     **/
47
+    public String addAndReturnKey(TModule module){
48
+        String id = ApiUtil.getId();
49
+        module.setModuleid(id);
50
+        module.setCreatetime(N_Utils.getSecondTimestamp());
51
+        moduleMapper.insertSelective(module);
52
+        return id;
53
+    }
54
+
55
+    /**
56
+     *功能描述 修改
57
+     * @author WN
58
+     * @date 2020/6/11
59
+     * @param  * @param module
60
+     * @return java.lang.Integer
61
+     */
62
+    public Integer update(TModule module){
63
+        return moduleMapper.updateByPrimaryKeySelective(module);
64
+    }
65
+
66
+    /**
67
+     *功能描述  删除
68
+     * @author WN
69
+     * @date 2020/6/11
70
+     * @param  * @param moduleid
71
+     * @return java.lang.Integer
72
+     */
73
+    public Integer del(String moduleid){
74
+        return moduleMapper.deleteByPrimaryKey(moduleid);
75
+    }
76
+
77
+
78
+    /**
79
+     *功能描述 所有模块
80
+     * @author WN
81
+     * @date 2020/6/11
82
+     * @param  * @param schoolid
83
+     * @param display
84
+     * @return java.util.List<com.xhkjedu.model.system.TModule>
85
+     */
86
+    public List<TModule> listModules(Integer schoolid, Integer moduletype, Integer display){
87
+//        return moduleMapper.listModules(schoolid);
88
+        List<TModule> modules = new ArrayList<>();
89
+        List<TModule> lst = listModulesTree(schoolid,moduletype, display);
90
+        lst.forEach(m->{
91
+            List<TModule> twomodules = m.getModulechilds();
92
+            m.setModulechilds(null);
93
+            modules.add(m);
94
+            twomodules.forEach(m2->{
95
+                List<TModule> threemodules = m2.getModulechilds();
96
+                m2.setModulechilds(null);
97
+                modules.add(m2);
98
+                threemodules.forEach(m3->{
99
+                    modules.add(m3);
100
+                });
101
+            });
102
+        });
103
+        return modules;
104
+    }
105
+
106
+    //获取第一层模块
107
+    public List<ModuleSelVo> listLevelModule(Integer schoolid,Integer moduletype){
108
+        return moduleMapper.listLevelModule(schoolid,moduletype);
109
+    }
110
+
111
+    /**
112
+     *功能描述  所有模块树形结构
113
+     * @author WN
114
+     * @date 2020/6/15
115
+     * @param  * @param schoolid
116
+     * @param display
117
+     * @return java.util.List<com.xhkjedu.model.system.TModule>
118
+     */
119
+    public List<TModule> listModulesTree(Integer schoolid, Integer moduletype, Integer display){
120
+        List<TModule> lst = moduleMapper.listModules(schoolid,moduletype, display);
121
+
122
+        List<TModule> rtnlst = new ArrayList<>();
123
+
124
+        for(TModule m : lst){
125
+            if(m.getLevel()==1){
126
+                rtnlst.add(m);
127
+            }
128
+        }
129
+
130
+        for(TModule m : rtnlst){
131
+            List<TModule> childs = m.getModulechilds();
132
+            for(TModule mc: lst){
133
+                if(m.getModuleid().equals(mc.getModulepid())){
134
+                    if(!isExistModule(childs,m.getModuleid())){
135
+                        childs.add(mc);
136
+                    }
137
+                }
138
+            }
139
+        }
140
+
141
+        return rtnlst;
142
+    }
143
+
144
+    //判断集合中是否存在模块
145
+    private boolean isExistModule(List<TModule> lst,String moduleid){
146
+        for(TModule m: lst){
147
+            if(m.getModuleid().equals(moduleid)){
148
+                return true;
149
+            }
150
+        }
151
+        return false;
152
+    }
153
+
154
+    /**
155
+     * 模块上移
156
+     * @Param [modules]
157
+     * @Author ywx
158
+     * @Date 2020/8/31 16:24
159
+     * @return void
160
+     **/
161
+    public void moveUp(List<TModule> modules) {
162
+        for (int i = 0; i < modules.size(); i++) {
163
+            TModule module = modules.get(i);
164
+            if (module.getModulepid() == null){
165
+                return;
166
+            }
167
+            if (i == 0) {
168
+                if (module.getMorder() == 1){
169
+                    return;
170
+                }
171
+                moduleMapper.updateOrder(module);
172
+                Integer morder = modules.get(1).getMorder();
173
+                module.setMorder(morder);
174
+            } else {
175
+                module.setMorder(module.getMorder()+1);
176
+            }
177
+        }
178
+        moduleMapper.moveUp(modules);
179
+    }
180
+
181
+    //模块选择列表
182
+    public List<Map> listForSel2(Integer schoolid, Integer moduletype) {
183
+        return moduleMapper.listForSel2(schoolid, moduletype);
184
+    }
185
+}

+ 177
- 0
sapi/src/main/java/com/xhkjedu/sapi/service/system/ModuledefaultService.java Vedi File

@@ -0,0 +1,177 @@
1
+package com.xhkjedu.sapi.service.system;
2
+
3
+import com.xhkjedu.sapi.mapper.system.ModuleMapper;
4
+import com.xhkjedu.sapi.mapper.system.ModuledefaultMapper;
5
+import com.xhkjedu.sapi.model.system.TModule;
6
+import com.xhkjedu.sapi.model.system.TModuledefault;
7
+import com.xhkjedu.sapi.utils.ApiUtil;
8
+import com.xhkjedu.utils.N_Utils;
9
+import com.xhkjedu.vo.ResultVo;
10
+import com.xhkjedu.sapi.vo.system.ModuleSelVo;
11
+import org.springframework.beans.BeanUtils;
12
+import org.springframework.stereotype.Service;
13
+import org.springframework.transaction.annotation.Transactional;
14
+
15
+import javax.annotation.Resource;
16
+import java.util.ArrayList;
17
+import java.util.List;
18
+
19
+/**
20
+ * @author ywx
21
+ * @classname ModuledefaultService
22
+ * @description 
23
+ * @date 2020/7/2 10:36
24
+ **/
25
+@Service
26
+public class ModuledefaultService {
27
+    @Resource
28
+    private ModuledefaultMapper moduledefaultMapper;
29
+    @Resource
30
+    private ModuleMapper moduleMapper;
31
+
32
+    //添加
33
+    @Transactional(rollbackFor = Exception.class)
34
+    public ResultVo save(TModuledefault model) {
35
+        if (model.getLevel() != 1) {
36
+            if (N_Utils.isNotEmpty(model.getModuleurl())) {
37
+                Integer num = moduledefaultMapper.countByUrl(model.getModuleurl(), model.getModuletype());
38
+                if (num != 0) {
39
+                    return new ResultVo(1, "该模块地址已存在,禁止添加");
40
+                }
41
+            }
42
+        }
43
+
44
+        String id = ApiUtil.getId();
45
+        model.setModuleid(id);
46
+        model.setCreatetime(N_Utils.getSecondTimestamp());
47
+        moduledefaultMapper.insertSelective(model);
48
+
49
+        //获取学校id集合
50
+        List<Integer> schoolids = moduledefaultMapper.listSchoolId();
51
+        for (Integer schoolid : schoolids) {
52
+            TModule m = new TModule();
53
+            BeanUtils.copyProperties(model,m);
54
+            m.setModuleid(ApiUtil.getId());
55
+            m.setDefaultid(id);
56
+            m.setSchoolid(schoolid);
57
+            String modulepid = model.getModulepid();
58
+            if (N_Utils.isNotEmpty(modulepid)) {
59
+                TModuledefault mp = findById(modulepid);
60
+                String moduleid = moduledefaultMapper.getModuleIdByDefaultId(modulepid, schoolid, mp.getModuletype());
61
+                m.setModulepid(moduleid);
62
+            }
63
+            moduleMapper.insertSelective(m);
64
+        }
65
+
66
+        return new ResultVo(0, "保存成功",id);
67
+    }
68
+
69
+    //删除
70
+    @Transactional(rollbackFor = Exception.class)
71
+    public Integer deleteById(String id) {
72
+        moduleMapper.deleteByDefaultId(id);
73
+        return moduledefaultMapper.deleteByPrimaryKey(id);
74
+    }
75
+
76
+    //修改
77
+    @Transactional(rollbackFor = Exception.class)
78
+    public void update(TModuledefault model) {
79
+        moduledefaultMapper.updateByPrimaryKeySelective(model);//更新默认模块信息
80
+        moduledefaultMapper.updateByDefaultId(model.getModuleid());//更新学校模块信息
81
+    }
82
+
83
+    //获取详情
84
+    public TModuledefault findById(String id) {
85
+        return moduledefaultMapper.selectByPrimaryKey(id);
86
+    }
87
+
88
+    //获取列表
89
+    public List <TModuledefault> listAll(Integer moduletype, Integer display) {
90
+        List<TModuledefault> modules = new ArrayList<>();
91
+        List<TModule> lst = listModulesTree(moduletype,display);
92
+        lst.forEach(m->{
93
+            List<TModule> twomodules = m.getModulechilds();
94
+            m.setModulechilds(null);
95
+            TModuledefault d = copyProperties(m);
96
+            modules.add(d);
97
+            twomodules.forEach(m2->{
98
+                List<TModule> threemodules = m2.getModulechilds();
99
+                m2.setModulechilds(null);
100
+                TModuledefault d2 = copyProperties(m2);
101
+                modules.add(d2);
102
+                threemodules.forEach(m3->{
103
+                    TModuledefault d3 = copyProperties(m3);
104
+                    modules.add(d3);
105
+                });
106
+            });
107
+        });
108
+        return modules;
109
+    }
110
+
111
+    /**
112
+     * 复制模块信息
113
+     * @Param [m]
114
+     * @Author ywx
115
+     * @Date 2020/7/2 15:16
116
+     * @return com.xhkjedu.model.system.TModuledefault
117
+     **/
118
+    private TModuledefault copyProperties(TModule m) {
119
+        TModuledefault moduledefault = new TModuledefault();
120
+        moduledefault.setModuleid(m.getModuleid());
121
+        moduledefault.setModulename(m.getModulename());
122
+        moduledefault.setMabbrevname(m.getMabbrevname());
123
+        moduledefault.setModuleurl(m.getModuleurl());
124
+        moduledefault.setModuleico(m.getModuleico());
125
+        moduledefault.setModulepid(m.getModulepid());
126
+        moduledefault.setMorder(m.getMorder());
127
+        moduledefault.setMinout(m.getMinout());
128
+        moduledefault.setMclass(m.getMclass());
129
+        moduledefault.setLevel(m.getLevel());
130
+        moduledefault.setComm(m.getComm());
131
+        moduledefault.setCreatetime(m.getCreatetime());
132
+        moduledefault.setMdefault(m.getMdefault());
133
+        moduledefault.setModuletype(m.getModuletype());
134
+        moduledefault.setDisplay(m.getDisplay());
135
+        return moduledefault;
136
+    }
137
+
138
+    public List<TModule> listModulesTree(Integer moduletype, Integer display){
139
+        List<TModule> lst = moduledefaultMapper.listModules(moduletype,display);
140
+
141
+        List<TModule> rtnlst = new ArrayList<>();
142
+
143
+        for(TModule m : lst){
144
+            if(m.getLevel()==1){
145
+                rtnlst.add(m);
146
+            }
147
+        }
148
+
149
+        for(TModule m : rtnlst){
150
+            List<TModule> childs = m.getModulechilds();
151
+            for(TModule mc: lst){
152
+                if(m.getModuleid().equals(mc.getModulepid())){
153
+                    if(!isExistModule(childs,m.getModuleid())){
154
+                        childs.add(mc);
155
+                    }
156
+                }
157
+            }
158
+        }
159
+
160
+        return rtnlst;
161
+    }
162
+
163
+    //判断集合中是否存在模块
164
+    private boolean isExistModule(List<TModule> lst,String moduleid){
165
+        for(TModule m: lst){
166
+            if(m.getModuleid().equals(moduleid)){
167
+                return true;
168
+            }
169
+        }
170
+        return false;
171
+    }
172
+
173
+    //首层模块
174
+    public List<ModuleSelVo> listLevelModule(Integer moduletype) {
175
+        return moduledefaultMapper.listLevelModule(moduletype);
176
+    }
177
+}

+ 403
- 0
sapi/src/main/java/com/xhkjedu/sapi/service/system/SchoolService.java Vedi File

@@ -0,0 +1,403 @@
1
+package com.xhkjedu.sapi.service.system;
2
+
3
+import com.xhkjedu.sapi.mapper.system.SchoolMapper;
4
+import com.xhkjedu.sapi.model.system.TSchool;
5
+import com.xhkjedu.utils.MD5;
6
+import com.xhkjedu.utils.N_Utils;
7
+import lombok.extern.slf4j.Slf4j;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.dao.DuplicateKeyException;
10
+import org.springframework.stereotype.Service;
11
+import org.springframework.transaction.annotation.Transactional;
12
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
13
+
14
+import javax.annotation.Resource;
15
+import java.util.ArrayList;
16
+import java.util.List;
17
+import java.util.Map;
18
+
19
+/**
20
+ * @author ywx
21
+ * @classname TSchoolService
22
+ * @description 
23
+ * @date 2020/6/2 15:07
24
+ **/
25
+@Service
26
+@Slf4j
27
+public class SchoolService {
28
+    @Resource
29
+    private SchoolMapper schoolMapper;
30
+    @Resource
31
+    private ModuledefaultService moduledefaultService;
32
+    @Resource
33
+    private ModuleService moduleService;
34
+   /* @Resource
35
+    private ClassMapper classMapper;
36
+    @Resource
37
+    private ClassStudentMapper classStudentMapper;
38
+    @Resource
39
+    private ClassTeacherMapper classTeacherMapper;
40
+    @Resource
41
+    private GroupMapper groupMapper;
42
+    @Resource
43
+    private GroupStudentMapper groupStudentMapper;
44
+    @Resource
45
+    private UserMapper userMapper;
46
+    @Autowired
47
+    private RoleMapper roleMapper;
48
+    @Autowired
49
+    private RoleModuleMapper roleModuleMapper;
50
+    @Autowired
51
+    private UserRoleMapper userRoleMapper;*/
52
+
53
+    //添加
54
+    @Transactional(rollbackFor = Exception.class)
55
+    public Integer save(TSchool model) throws Exception {
56
+        //添加学校信息
57
+        model.setSchoolstate(1);
58
+        model.setCreatetime(N_Utils.getSecondTimestamp());
59
+        Integer schoolid = null;
60
+        try {
61
+            schoolMapper.insertUseGeneratedKeys(model);
62
+            schoolid = model.getId();
63
+
64
+           /* //添加管理员信息
65
+            Integer userid = saveUser(model, schoolid);
66
+
67
+            //添加角色信息
68
+            Integer roleid = saveRole(schoolid, userid);
69
+
70
+            //添加用户角色
71
+            saveUserRole(userid, roleid);
72
+
73
+            //添加模块信息
74
+            List<TRoleModule> roleModules = new ArrayList<>();
75
+            List <TModule> modules = moduledefaultService.listModulesTree(null, null);//给学校网页复制模块
76
+            for (TModule module : modules) {
77
+                saveModuleSetRoleModule(schoolid, userid, roleid, roleModules, module);
78
+            }
79
+
80
+            //添加角色模块
81
+            roleModuleMapper.insertList(roleModules);*/
82
+        } catch (DuplicateKeyException e) {
83
+            log.error("添加学校失败",e.getMessage());
84
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
85
+            throw new Exception("该管理员账号已存在");
86
+        } catch (Exception e) {
87
+            log.error("添加学校失败",e.getMessage());
88
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
89
+            throw new Exception("添加学校失败");
90
+        }
91
+
92
+        return schoolid;
93
+    }
94
+
95
+    /**
96
+     * 添加用户角色
97
+     * @Param [userid, roleid]
98
+     * @Author ywx
99
+     * @Date 2020/7/2 11:52
100
+     * @return java.lang.Integer
101
+     **/
102
+   /* private Integer saveUserRole(Integer userid, Integer roleid) {
103
+        TUserRole userRole = new TUserRole();
104
+        userRole.setUserid(userid);
105
+        userRole.setRoleid(roleid);
106
+        userRole.setCreateid(userid);
107
+        userRole.setCreatetime(N_Utils.getSecondTimestamp());
108
+        userRoleMapper.insertUseGeneratedKeys(userRole);
109
+        return userRole.getId();
110
+    }*/
111
+
112
+    /**
113
+     * 添加角色信息
114
+     * @Param [schoolid, userid]
115
+     * @Author ywx
116
+     * @Date 2020/7/2 11:51
117
+     * @return java.lang.Integer
118
+     **/
119
+   /* private Integer saveRole(Integer schoolid, Integer userid) {
120
+        TRole role = new TRole();
121
+        role.setRolename("管理员");
122
+        role.setComm("拥有高权限");
123
+        role.setCreateid(userid);
124
+        role.setCreatetime(N_Utils.getSecondTimestamp());
125
+        role.setSchoolid(schoolid);
126
+        roleMapper.insertUseGeneratedKeys(role);
127
+        return role.getId();
128
+    }*/
129
+
130
+    /**
131
+     * 添加管理员信息
132
+     * @Param [model, schoolid]
133
+     * @Author ywx
134
+     * @Date 2020/7/2 11:49
135
+     * @return java.lang.Integer
136
+     **/
137
+   /* private Integer saveUser(TSchool model, Integer schoolid) {
138
+        TUser user = new TUser();
139
+        user.setLoginname(model.getLoginname());
140
+        user.setUsername("管理员");
141
+        user.setUsersex(1);
142
+        MD5 m = new MD5();
143
+        String loginpwd = m.getMD5ofStr(m.getMD5ofStr(m.getMD5ofStr("123456")));
144
+        user.setLoginpwd(loginpwd);
145
+        user.setUsertype(0);
146
+        user.setUserstate(1);
147
+        user.setCreateid(model.getCreateid());
148
+        user.setCreatetime(N_Utils.getSecondTimestamp());
149
+        user.setSchoolid(schoolid);
150
+        userMapper.insertUseGeneratedKeys(user);
151
+        return user.getId();
152
+    }*/
153
+
154
+    /**
155
+     * 保存子模块信息并设置角色模块信息
156
+     * @Param [schoolid, userid, roleid, roleModules, module]
157
+     * @Author ywx
158
+     * @Date 2020/7/2 11:47
159
+     * @return void
160
+     **/
161
+   /* private void saveModuleSetRoleModule(Integer schoolid, Integer userid, Integer roleid, List<TRoleModule> roleModules, TModule module) {
162
+        module.setCreateid(userid);
163
+        module.setCreatetime(N_Utils.getSecondTimestamp());
164
+        module.setSchoolid(schoolid);
165
+        module.setDefaultid(module.getModuleid());
166
+        String moduleid = moduleService.addAndReturnKey(module);
167
+        module.setModuleid(moduleid);
168
+        saveModuleChild(schoolid, userid, module, roleModules, roleid);
169
+
170
+        if (module.getModuletype() == 1) {
171
+            //角色模块信息
172
+            TRoleModule roleModule = new TRoleModule();
173
+            roleModule.setRoleid(roleid);
174
+            roleModule.setModuleid(moduleid);
175
+            roleModule.setCreateid(userid);
176
+            roleModule.setCreatetime(N_Utils.getSecondTimestamp());
177
+            roleModule.setSchoolid(schoolid);
178
+            roleModules.add(roleModule);
179
+        }
180
+    }*/
181
+
182
+    /**
183
+     * 保存子模块信息
184
+     * @Param [schoolid, userid, module, roleModules, roleid]
185
+     * @Author ywx
186
+     * @Date 2020/7/2 11:46
187
+     * @return void
188
+     **/
189
+   /* private void saveModuleChild(Integer schoolid, Integer userid, TModule module, List<TRoleModule> roleModules, Integer roleid) {
190
+        String moduleid = module.getModuleid();
191
+        List<TModule> modulechilds = module.getModulechilds();
192
+        if (N_Utils.isListNotEmpty(modulechilds)) {
193
+            for (TModule modulechild : modulechilds) {
194
+                modulechild.setModulepid(moduleid);
195
+                saveModuleSetRoleModule(schoolid, userid, roleid, roleModules, modulechild);
196
+            }
197
+        }
198
+    }*/
199
+
200
+    //删除
201
+    public Integer deleteById(Integer schoolid) {
202
+        //删除系统学校
203
+        return schoolMapper.deleteById(schoolid);
204
+    }
205
+
206
+    //修改
207
+    @Transactional(rollbackFor = Exception.class)
208
+    public Integer update(TSchool model) {
209
+        Integer bindmac = model.getBindmac();
210
+        TSchool school = finById(model.getSchoolid());
211
+        /*if (bindmac != null && !bindmac.equals(school.getBindmac())) {
212
+            userMapper.delBindmac(model.getSchoolid());//删除学生绑定信息
213
+        }*/
214
+        return schoolMapper.updateById(model);
215
+    }
216
+
217
+    //获取列表
218
+    public List <TSchool> findAll() {
219
+        return schoolMapper.findAll();
220
+    }
221
+
222
+    /**
223
+     * 学年升级
224
+     * @Param [schoolid, year]
225
+     * @Author ywx
226
+     * @Date 2020/6/12 13:50
227
+     * @return void
228
+     **/
229
+    @Transactional(rollbackFor = Exception.class)
230
+    public void upgrade(Integer schoolid, Integer year) throws Exception {
231
+        try {
232
+           /* List<TClass> classes = classMapper.listClassBySchoolId(schoolid, year);//要升级的班级列表
233
+            if (N_Utils.isListNotEmpty(classes)){
234
+                String classIds = classMapper.listClassIdBySchoolId(schoolid, year);
235
+                List<TClassStudent> cStudents = classStudentMapper.listStudentByClassIds(classIds);//要升级的学生列表
236
+                List<TClassTeacher> cTeachers = classTeacherMapper.listTeacherByClassIds(classIds);//要升级的教师列表
237
+
238
+                List<TGroup> groups = groupMapper.listStudentByClassIds(classIds);//要升级的全体分组列表
239
+                StringBuilder sb = new StringBuilder();
240
+                groups.forEach(g->{sb.append(g.getGroupid()).append(",");});
241
+                String groupIds = sb.toString().substring(0,sb.toString().length()-1);
242
+                List<TGroupStudent> gStudents = groupStudentMapper.listStudentByGroupIds(groupIds);//要升级的学生列表
243
+
244
+                List<TClassStudent> classStudents = new ArrayList<>();//升级后的班级学生
245
+                List<TClassTeacher> classTeachers = new ArrayList<>();//升级后的班级教师
246
+                List<TGroupStudent> groupStudents = new ArrayList<>();//升级后的分组学生
247
+                for (TClass c : classes) {
248
+                    //复制班级信息
249
+                    c.setYear(c.getYear()+1);
250
+                    c.setGradeid(c.getGradeid()+1);
251
+                    c.setClassstate(1);
252
+                    c.setCreatetime(N_Utils.getSecondTimestamp());
253
+                    classMapper.insertUseGeneratedKeys(c);
254
+                    Integer oldClassId = c.getClassid();
255
+                    Integer classid = c.getId();
256
+
257
+                    //复制班级学生信息
258
+                    boolean rtn = false;
259
+                    for (TClassStudent s : cStudents) {
260
+                        if (oldClassId.equals(s.getClassid())){
261
+                            s.setClassid(classid);
262
+                            s.setCreatetime(N_Utils.getSecondTimestamp());
263
+                            classStudents.add(s);
264
+                            rtn = true;
265
+                        } else if (!oldClassId.equals(s.getClassid()) && rtn){
266
+                            break;
267
+                        }
268
+                    }
269
+
270
+                    //复制班级教师信息
271
+                    rtn = false;
272
+                    for (TClassTeacher t : cTeachers) {
273
+                        if (oldClassId.equals(t.getClassid())){
274
+                            t.setClassid(classid);
275
+                            t.setCreatetime(N_Utils.getSecondTimestamp());
276
+                            classTeachers.add(t);
277
+                            rtn = true;
278
+                        } else if (!oldClassId.equals(t.getClassid()) && rtn){
279
+                            break;
280
+                        }
281
+                    }
282
+
283
+                    for (TGroup g : groups) {
284
+                        if (oldClassId.equals(g.getClassid())){
285
+                            //复制班级分组信息
286
+                            g.setClassid(classid);
287
+                            g.setCreatetime(N_Utils.getSecondTimestamp());
288
+                            groupMapper.insertUseGeneratedKeys(g);
289
+                            Integer oldGroupId = g.getGroupid();
290
+                            Integer groupid = g.getId();
291
+
292
+                            //复制分组学生信息
293
+                            rtn = false;
294
+                            for (TGroupStudent s : gStudents) {
295
+                                if (oldGroupId.equals(s.getGroupid())){
296
+                                    s.setClassid(classid);
297
+                                    s.setGroupid(groupid);
298
+                                    s.setCreatetime(N_Utils.getSecondTimestamp());
299
+                                    groupStudents.add(s);
300
+                                    rtn = true;
301
+                                } else if (!oldGroupId.equals(s.getGroupid()) && rtn){
302
+                                    break;
303
+                                }
304
+                            }
305
+                            break;
306
+                        }
307
+                    }
308
+                }
309
+                classStudentMapper.insertList(classStudents);//保存升级后的班级学生信息
310
+                classTeacherMapper.insertList(classTeachers);//保存升级后的班级教师信息
311
+                groupStudentMapper.insertList(groupStudents);//保存升级后的分组学生信息
312
+            }
313
+
314
+            //不需要升级,需要标识毕业的班级,学生
315
+            List<TClass> biyeclass = classMapper.listClassBiyeBySchoolId(schoolid,year,1);
316
+
317
+
318
+            if(N_Utils.isListNotEmpty(biyeclass)){
319
+                String byclassIds = "";
320
+                for(int i=0;i<biyeclass.size();i++){
321
+                    TClass c = biyeclass.get(i);
322
+                    if(i>0){
323
+                        byclassIds = byclassIds + "," + c.getClassid();
324
+                    }else{
325
+                        byclassIds = c.getClassid().toString();
326
+                    }
327
+                }
328
+
329
+                List<TClassStudent> bystudents = classStudentMapper.listStudentByClassIds(byclassIds);//要毕业的学生列表
330
+
331
+                if (N_Utils.isNotEmpty(byclassIds)) {
332
+                    classMapper.updateClassState(3, byclassIds);//修改班级状态
333
+                }
334
+                if (N_Utils.isListNotEmpty(bystudents)) {
335
+                    userMapper.batchUpdateState(bystudents, 3);   //修改学生状态为已毕业状态
336
+                }
337
+            }*/
338
+
339
+            schoolMapper.upgrade(schoolid);//学校年份升级
340
+        }catch (Exception e){
341
+            log.error("学年升级失败:" + e.getMessage());
342
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
343
+            throw new Exception("学年升级失败");
344
+        }
345
+    }
346
+
347
+    /**
348
+     * 学年降级
349
+     * @Param [schoolid, year]
350
+     * @Author ywx
351
+     * @Date 2020/6/16 13:51
352
+     * @return void
353
+     **/
354
+    public void downgrade(Integer schoolid, Integer year) {
355
+
356
+        schoolMapper.downgrade(schoolid, year);
357
+        //之前已毕业的班级进行恢复
358
+        /*List<TClass> biyeclass = classMapper.listClassBiyeBySchoolId(schoolid,year,3);
359
+
360
+        if(N_Utils.isListNotEmpty(biyeclass)){
361
+            String byclassIds = "";
362
+            for(int i=0;i<biyeclass.size();i++){
363
+                TClass c = biyeclass.get(i);
364
+                if(i>0){
365
+                    byclassIds = "," + c.getClassid();
366
+                }else{
367
+                    byclassIds = c.getClassid().toString();
368
+                }
369
+            }
370
+
371
+            List<TClassStudent> bystudents = classStudentMapper.listStudentByClassIds(byclassIds);//要毕业的学生列表
372
+
373
+            classMapper.updateClassState(1,byclassIds);//修改班级状态
374
+            userMapper.batchUpdateState(bystudents,1);   //修改学生状态
375
+        }*/
376
+    }
377
+
378
+    /**
379
+     * 获取学校详情
380
+     * @Param [schoolid]
381
+     * @Author ywx
382
+     * @Date 2020/9/21 16:12
383
+     * @return com.xhkjedu.model.gradeclass.TSchool
384
+     **/
385
+    public TSchool finById(Integer schoolid) {
386
+        return schoolMapper.selectByPrimaryKey(schoolid);
387
+    }
388
+
389
+    //学校选择列表
390
+    public List<Map> listForSel() {
391
+        return schoolMapper.listForSel();
392
+    }
393
+
394
+    //根据学校名称查找学校数量
395
+    public Integer countBySchoolName(String schoolname) {
396
+        return schoolMapper.countBySchoolName(schoolname);
397
+    }
398
+
399
+    //获取学校当前年份
400
+    public Integer getYearById(Integer schoolid) {
401
+        return schoolMapper.getYearById(schoolid);
402
+    }
403
+}

+ 115
- 0
sapi/src/main/java/com/xhkjedu/sapi/service/system/SchoolStypeService.java Vedi File

@@ -0,0 +1,115 @@
1
+package com.xhkjedu.sapi.service.system;
2
+
3
+import com.xhkjedu.sapi.mapper.cloud.CloudMapper;
4
+import com.xhkjedu.sapi.mapper.system.SchoolMapper;
5
+import com.xhkjedu.sapi.mapper.system.SchoolStypeMapper;
6
+import com.xhkjedu.sapi.model.cloud.TCloud;
7
+import com.xhkjedu.sapi.model.system.TSchool;
8
+import com.xhkjedu.sapi.model.system.TSchoolStype;
9
+import com.xhkjedu.utils.N_Utils;
10
+import com.xhkjedu.vo.ResultVo;
11
+import org.springframework.stereotype.Service;
12
+
13
+import javax.annotation.Resource;
14
+import java.util.ArrayList;
15
+import java.util.List;
16
+import java.util.stream.Collectors;
17
+
18
+/**
19
+ * @author ywx
20
+ * @classname TSchoolStypeService
21
+ * @description
22
+ * @date 2021/2/23 9:51
23
+ **/
24
+@Service
25
+public class SchoolStypeService {
26
+    @Resource
27
+    private SchoolStypeMapper schoolStypeMapper;
28
+    @Resource
29
+    private SchoolMapper schoolMapper;
30
+    @Resource
31
+    private CloudMapper cloudMapper;
32
+
33
+    //添加
34
+    public ResultVo batchSave(List<TSchoolStype> list) {
35
+        TSchoolStype stype = list.get(0);
36
+        Integer schoolid = stype.getSchoolid();
37
+        String schooldomain = stype.getSchooldomain();
38
+        N_Utils.validation(new Object[]{schoolid, "学校id", 1});
39
+        TSchool school = new TSchool();
40
+        school.setSchoolid(schoolid);
41
+        if (schooldomain == null) schooldomain = "";
42
+        school.setSchooldomain(schooldomain);
43
+        schoolMapper.updateByPrimaryKeySelective(school);
44
+        list.forEach(model -> {
45
+            model.setCreatetime(N_Utils.getSecondTimestamp());
46
+        });
47
+        schoolStypeMapper.batchSave(list);
48
+        return new ResultVo(0, "保存成功");
49
+    }
50
+
51
+    //获取列表
52
+    public List <TSchoolStype> listAll(TSchoolStype stype) {
53
+        List<TSchoolStype> list = schoolStypeMapper.findAll(stype);
54
+        if (list == null) {
55
+            list = new ArrayList<>();
56
+        }
57
+        TCloud cloud = cloudMapper.getCloud();
58
+        String schooldomain = stype.getSchooldomain();
59
+        //登录页面字体图片
60
+        int size = list.stream().filter(t -> t.getSchooltype().equals("loginname")).collect(Collectors.toList()).size();
61
+        if (size == 0) {
62
+            TSchoolStype type = new TSchoolStype();
63
+            type.setSchooldomain(schooldomain);
64
+            type.setSchooltype("loginname");
65
+            type.setStypeaddr(cloud.getLoginname());
66
+            list.add(type);
67
+        }
68
+
69
+        //登录背景图片
70
+        size = list.stream().filter(t -> t.getSchooltype().equals("loginbg")).collect(Collectors.toList()).size();
71
+        if (size == 0) {
72
+            TSchoolStype type = new TSchoolStype();
73
+            type.setSchooldomain(schooldomain);
74
+            type.setSchooltype("loginbg");
75
+            type.setStypeaddr(cloud.getLoginbg());
76
+            list.add(type);
77
+        }
78
+
79
+        //技术支持
80
+        size = list.stream().filter(t -> t.getSchooltype().equals("tesupport")).collect(Collectors.toList()).size();
81
+        if (size == 0) {
82
+            TSchoolStype type = new TSchoolStype();
83
+            type.setSchooldomain(schooldomain);
84
+            type.setSchooltype("tesupport");
85
+            type.setStypeaddr(cloud.getTesupport());
86
+            list.add(type);
87
+        }
88
+
89
+        //备案号
90
+        size = list.stream().filter(t -> t.getSchooltype().equals("recordno")).collect(Collectors.toList()).size();
91
+        if (size == 0) {
92
+            TSchoolStype type = new TSchoolStype();
93
+            type.setSchooldomain(schooldomain);
94
+            type.setSchooltype("recordno");
95
+            type.setStypeaddr(cloud.getRecordno());
96
+            list.add(type);
97
+        }
98
+        return list;
99
+    }
100
+
101
+    //添加
102
+    public ResultVo batchSave2(List<TSchoolStype> list) {
103
+        TSchoolStype stype = list.get(0);
104
+        Integer schoolid = stype.getSchoolid();
105
+        N_Utils.validation(new Object[]{schoolid,"学校id",1});
106
+        list.forEach(model->{model.setCreatetime(N_Utils.getSecondTimestamp());});
107
+        schoolStypeMapper.batchSave(list);
108
+        return new ResultVo(0, "保存成功");
109
+    }
110
+
111
+    //根据学校id获取列表
112
+    public List <TSchoolStype> listAll2(TSchoolStype stype) {
113
+        return schoolStypeMapper.findAll2(stype);
114
+    }
115
+}

+ 33
- 0
sapi/src/main/java/com/xhkjedu/sapi/service/system/SyserrorService.java Vedi File

@@ -0,0 +1,33 @@
1
+package com.xhkjedu.sapi.service.system;
2
+
3
+import com.xhkjedu.sapi.mapper.system.SyserrorMapper;
4
+import com.xhkjedu.sapi.model.system.TSyserror;
5
+import com.xhkjedu.utils.N_Utils;
6
+import org.springframework.stereotype.Service;
7
+
8
+import javax.annotation.Resource;
9
+import java.util.List;
10
+
11
+/**
12
+ * @author ywx
13
+ * @classname SyserrorService
14
+ * @description 
15
+ * @date 2020/10/9 15:17
16
+ **/
17
+@Service
18
+public class SyserrorService {
19
+    @Resource
20
+    private SyserrorMapper syserrorMapper;
21
+
22
+    //添加
23
+    public Integer save(TSyserror model) {
24
+        model.setCreatetime(N_Utils.getSecondTimestamp());
25
+        syserrorMapper.insertUseGeneratedKeys(model);
26
+        return model.getId();
27
+    }
28
+
29
+    //获取列表
30
+    public List <TSyserror> listAll(TSyserror error) {
31
+        return syserrorMapper.listAll(error);
32
+    }
33
+}

+ 28
- 0
sapi/src/main/java/com/xhkjedu/sapi/service/system/UserLogService.java Vedi File

@@ -0,0 +1,28 @@
1
+package com.xhkjedu.sapi.service.system;
2
+
3
+import com.xhkjedu.sapi.mapper.system.UserLogMapper;
4
+import com.xhkjedu.sapi.model.system.TUserLog;
5
+import com.xhkjedu.utils.N_Utils;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.stereotype.Service;
8
+
9
+import java.net.UnknownHostException;
10
+import java.util.List;
11
+
12
+@Service
13
+public class UserLogService {
14
+
15
+    @Autowired
16
+    private UserLogMapper userLogMapper;
17
+
18
+    /**
19
+     * 登录日志列表
20
+     * @Param [log]
21
+     * @Author ywx
22
+     * @Date 2020/6/17 17:22
23
+     * @return java.util.List<com.xhkjedu.model.system.TUserLog>
24
+     **/
25
+    public List<TUserLog> listLog(TUserLog log) {
26
+        return userLogMapper.listLog(log);
27
+    }
28
+}

+ 36
- 1
sapi/src/main/java/com/xhkjedu/sapi/utils/ApiUtil.java Vedi File

@@ -1,6 +1,17 @@
1 1
 package com.xhkjedu.sapi.utils;
2 2
 
3 3
 import com.xhkjedu.sapi.config.ConfigKey;
4
+import lombok.extern.slf4j.Slf4j;
5
+import org.springframework.http.HttpEntity;
6
+import org.springframework.http.HttpHeaders;
7
+import org.springframework.http.MediaType;
8
+import org.springframework.http.ResponseEntity;
9
+import org.springframework.util.MultiValueMap;
10
+import org.springframework.web.client.RestClientException;
11
+import org.springframework.web.client.RestTemplate;
12
+
13
+import java.util.ArrayList;
14
+import java.util.List;
4 15
 
5 16
 import static com.xhkjedu.utils.N_Utils.getSecondTimestamp;
6 17
 
@@ -10,7 +21,7 @@ import static com.xhkjedu.utils.N_Utils.getSecondTimestamp;
10 21
  * Author WN
11 22
  * Date 2022/2/21 11:08
12 23
  **/
13
-
24
+@Slf4j
14 25
 public class ApiUtil {
15 26
     public static Integer id = 0;
16 27
 
@@ -27,4 +38,28 @@ public class ApiUtil {
27 38
         long num = Long.parseLong(_num);
28 39
         return Long.toString(num,36).toUpperCase();
29 40
     }
41
+
42
+    /**
43
+     * 发送form-data请求返回json结果
44
+     * @Param [apiUrl, param]
45
+     * @Author ywx
46
+     * @Date 2021/5/14 17:41
47
+     * @return java.lang.String
48
+     **/
49
+    public static String sendFormData(String apiUrl, MultiValueMap<String, String> param) {
50
+        try {
51
+            HttpHeaders headers = new HttpHeaders();
52
+            headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
53
+            List<MediaType> acceptableMediaTypes = new ArrayList<>();
54
+            acceptableMediaTypes.add(MediaType.APPLICATION_FORM_URLENCODED);
55
+            acceptableMediaTypes.add(MediaType.APPLICATION_PROBLEM_JSON_UTF8);
56
+            HttpEntity<MultiValueMap<String, String>> requestParams = new HttpEntity<>(param, headers);
57
+            ResponseEntity<String> response = new RestTemplate().postForEntity(apiUrl, requestParams, String.class);
58
+            String result = response.getBody();
59
+            return result;
60
+        } catch (RestClientException e) {
61
+            log.error("发送form-data请求失败",e.getMessage());
62
+            return null;
63
+        }
64
+    }
30 65
 }

+ 164
- 0
sapi/src/main/java/com/xhkjedu/sapi/utils/CopyURL.java Vedi File

@@ -0,0 +1,164 @@
1
+package com.xhkjedu.sapi.utils;
2
+
3
+import com.xhkjedu.sapi.config.ConfigKey;
4
+import lombok.extern.slf4j.Slf4j;
5
+
6
+import java.util.ArrayList;
7
+import java.util.List;
8
+import java.util.regex.Matcher;
9
+import java.util.regex.Pattern;
10
+
11
+/**
12
+ * @author ywx
13
+ * @className CopyURL
14
+ * @description
15
+ * @date 2020/8/5 9:52
16
+ **/
17
+@Slf4j
18
+public class CopyURL {
19
+
20
+    /**
21
+     * 把试题中的网络图片复制到本地
22
+     * @Param [qstem]
23
+     * @Author ywx
24
+     * @Date 2020/8/5 11:20
25
+     * @return java.lang.String
26
+     **/
27
+    /*public static String copyImg(String qstem, String questionid) {
28
+        List<String> imgs = getImgSrc(qstem);
29
+        for (String img : imgs) {
30
+            String imgPath = copy(img, questionid);
31
+            qstem = qstem.replace(img, imgPath);
32
+        }
33
+        return qstem;
34
+    };*/
35
+    
36
+    /**
37
+     * 获取字符串中的img标签中的src地址
38
+     * @Param [str]
39
+     * @Author ywx
40
+     * @Date 2020/8/5 10:11
41
+     * @return java.util.List<java.lang.String>
42
+     **/
43
+    /*public static List<String> getImgSrc(String str) {
44
+        if( str == null ){
45
+            return null;
46
+        }
47
+
48
+        String img = "";
49
+        Pattern p_image;
50
+        Matcher m_image;
51
+        List<String> pics = new ArrayList<>();
52
+
53
+        String regEx_img = "<img.*src\\s*=\\s*(.*?)[^>]*?>";
54
+        p_image = Pattern.compile(regEx_img, Pattern.CASE_INSENSITIVE);
55
+        m_image = p_image.matcher(str);
56
+        while (m_image.find()) {
57
+            img = img + "," + m_image.group();
58
+            img = img.replaceAll("\"","").replaceAll("\\\\","");
59
+            Matcher m = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)").matcher(img);
60
+            while (m.find()) {
61
+                String imgUrl = m.group(1);
62
+                if (!imgUrl.contains("data:image/")) {//排除base64图片
63
+                    pics.add(imgUrl);
64
+                }
65
+            }
66
+        }
67
+        return pics;
68
+    }*/
69
+
70
+    //获取试题图片相对地址
71
+    public static List<String> getImgSrc2(String str) {
72
+        if( str == null ){
73
+            return null;
74
+        }
75
+
76
+        String img = "";
77
+        Pattern p_image;
78
+        Matcher m_image;
79
+        List<String> pics = new ArrayList<>();
80
+
81
+        String regEx_img = "<img.*src\\s*=\\s*(.*?)[^>]*?>";
82
+        p_image = Pattern.compile(regEx_img, Pattern.CASE_INSENSITIVE);
83
+        m_image = p_image.matcher(str);
84
+        while (m_image.find()) {
85
+            img = img + "," + m_image.group();
86
+            img = img.replaceAll("\"","").replaceAll("\\\\","");
87
+            Matcher m = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)").matcher(img);
88
+            while (m.find()) {
89
+                String imgUrl = m.group(1);
90
+                if (!imgUrl.contains("data:image/") && imgUrl.contains(ConfigKey.oldshowurl)) {//排除base64图片
91
+                    pics.add(imgUrl.replaceAll(ConfigKey.oldshowurl,""));
92
+                }
93
+            }
94
+        }
95
+        return pics;
96
+    }
97
+    
98
+    //保存网络图片到本地
99
+    /*public static String copy(String imgUrl, String questionid) {
100
+        String imgPath = imgUrl.replaceAll(ConfigKey.oldshowurl,"");
101
+        String filepath = ConfigKey.uploadfolder + imgPath;
102
+        String showpath = ConfigKey.showurl + imgPath;
103
+        try {
104
+            createFile(filepath, imgUrl);
105
+        } catch (IOException e) {
106
+            log.error("保存网络图片失败【"+questionid+"】",e.getMessage());
107
+        }
108
+        return showpath.replaceAll("\\\\", "/");
109
+    }
110
+
111
+    //保存网络文件到本地
112
+    public static void copyFile(String fileUrl, String id) {
113
+        String filepath = ConfigKey.uploadfolder + fileUrl;
114
+        final ExecutorService exec = Executors.newFixedThreadPool(1);
115
+        try {
116
+            Callable<String> call = new Callable<String>() {
117
+                @Override
118
+                public String call() throws IOException {
119
+                    createFile(filepath, ConfigKey.oldshowurl + fileUrl);
120
+                    return "执行完成!";
121
+                }
122
+            };
123
+            Future<String> future = exec.submit(call);
124
+            future.get(ConfigKey.timeout, TimeUnit.MINUTES); //任务处理超时时间
125
+        } catch (Exception e) {
126
+            log.error("保存网络文件失败【"+id+"】",e.getMessage());
127
+        }
128
+        // 关闭线程池
129
+        exec.shutdown();
130
+    }
131
+
132
+    *//**
133
+     * 复制网络文件到本地
134
+     * @Param [filepath, urlpath]
135
+     * @Author ywx
136
+     * @Date 2021/5/7 13:42
137
+     * @return void
138
+     **//*
139
+    private static void createFile(String filepath, String urlpath) throws IOException {
140
+        File outFile = new File(filepath);
141
+        if (outFile.exists()) return;//存在则不复制
142
+        File directory = new File(outFile.getParent());
143
+        directory.setWritable(true, false);
144
+        if (!directory.exists()) {
145
+            directory.mkdirs();
146
+        }
147
+        OutputStream os = new FileOutputStream(outFile);
148
+        URL url = new URL(urlpath);
149
+        InputStream is = url.openStream();
150
+        byte[] buff = new byte[1024];
151
+        while (true) {
152
+            int readed = is.read(buff);
153
+            if (readed == -1) {
154
+                break;
155
+            }
156
+            byte[] temp = new byte[readed];
157
+            System.arraycopy(buff, 0, temp, 0, readed);
158
+            os.write(temp);
159
+        }
160
+        is.close();
161
+        os.close();
162
+    }*/
163
+
164
+}

+ 106
- 0
sapi/src/main/java/com/xhkjedu/sapi/utils/JedisUtil.java Vedi File

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

+ 18
- 0
sapi/src/main/java/com/xhkjedu/sapi/vo/system/AreazoneVo.java Vedi File

@@ -0,0 +1,18 @@
1
+package com.xhkjedu.sapi.vo.system;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class AreazoneVo {
7
+    //地区名称
8
+    private String areaname;
9
+
10
+    //区域全名称
11
+    private String areaall;
12
+
13
+    //地区编码
14
+    private String areacode;
15
+
16
+    //对应领创地区id
17
+    private Integer lcregion;
18
+}

+ 21
- 0
sapi/src/main/java/com/xhkjedu/sapi/vo/system/ModuleSelVo.java Vedi File

@@ -0,0 +1,21 @@
1
+package com.xhkjedu.sapi.vo.system;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @ClassName ModuleSelVo
7
+ * Description 选择模块
8
+ * Author WN
9
+ * Date 2020/6/15 15:29
10
+ **/
11
+@Data
12
+public class ModuleSelVo {
13
+
14
+    private String moduleid;
15
+
16
+    //模块名称
17
+    private String modulename;
18
+
19
+    //模块层级
20
+    private Integer level;
21
+}

+ 12
- 1
sapi/src/main/resources/application.properties Vedi File

@@ -29,7 +29,7 @@ spring.datasource.hikari.connection-test-query=SELECT 1
29 29
 # 所有Entity别名类所在包
30 30
 mybatis.type-aliases-package=com.xhkjedu.sapi.model,com.xhkjedu.sapi.vo
31 31
 mybatis.mapper-Locations=classpath*:mapper/**/*.xml
32
-#mapper.mappers=com.xhkjedu.sapi.base.TkMapper
32
+mapper.mappers=com.xhkjedu.sapi.base.TkMapper
33 33
 mapper.identity=MYSQL
34 34
 #打印日志的两种方式第一种可以指定包名,第二种都可以打印
35 35
 logging.level.com.xhkjedu.mapper=debug
@@ -57,3 +57,14 @@ secretKey=nanhuakaizhangjianwangni
57 57
 nummin=10000
58 58
 nummax=50000
59 59
 numadd=100000000
60
+
61
+#云平台接口地址
62
+cloudapi=http://scapitest.xhkjedu.com/
63
+#云平台文件访问路径
64
+file.oldshowurl=http://scstatictest.xhkjedu.com/static/
65
+#区平台文件服务接口地址
66
+fileapi=https://schoolfiletest.xhkjedu.com/
67
+#区平台文件访问路径
68
+file.showurl=http://schoolstatictest.xhkjedu.com/static/
69
+#数据库名
70
+dbname=xhkjedu_school_test

+ 35
- 0
sapi/src/main/resources/mapper/cloud/CloudMapper.xml Vedi File

@@ -0,0 +1,35 @@
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.sapi.mapper.cloud.CloudMapper">
4
+    <!--修改主题-->
5
+    <update id="updateTheme">
6
+        update t_cloud set theme=#{cloud.theme},loginbg=#{cloud.loginbg},loginname=#{cloud.loginname},loginico=#{cloud.loginico}
7
+        ,tesupport=#{cloud.tesupport},recordno=#{cloud.recordno}
8
+        where cloudid=#{cloud.cloudid}
9
+    </update>
10
+    <!--修改基础信息-->
11
+    <update id="updateInfo">
12
+      update t_cloud
13
+      <trim prefix="set" suffixOverrides=",">
14
+          <if test="cloud.cloudname!=null and cloud.cloudname!=''">cloudname=#{cloud.cloudname},</if>
15
+          <if test="cloud.cloudshort!=null and cloud.cloudshort!=''">cloudshort=#{cloud.cloudshort},</if>
16
+          <if test="cloud.account!=null and cloud.account!=''">account=#{cloud.account},</if>
17
+          <if test="cloud.phone!=null and cloud.phone!=''">phone=#{cloud.phone},</if>
18
+          <if test="cloud.cloudmap!=null and cloud.cloudmap!=''">cloudmap=#{cloud.cloudmap},</if>
19
+          <if test="cloud.comm!=null and cloud.comm!=''">comm=#{cloud.comm},</if>
20
+          <if test="cloud.bindphone!=null">bindphone=#{cloud.bindphone},</if>
21
+          <if test="cloud.stuweb!=null">stuweb=#{cloud.stuweb},</if>
22
+          <if test="cloud.tesupport!=null">tesupport=#{cloud.tesupport},</if>
23
+          <if test="cloud.recordno!=null">recordno=#{cloud.recordno},</if>
24
+      </trim>
25
+        WHERE cloudid=#{cloud.cloudid}
26
+    </update>
27
+    <!--获取详情-->
28
+    <select id="getCloud" resultType="com.xhkjedu.sapi.model.cloud.TCloud">
29
+        select * from t_cloud limit 1
30
+    </select>
31
+    <!--区域学段列表-->
32
+    <select id="listLevel" resultType="java.lang.Integer">
33
+        select schoollevel from t_school where schoolstate=1 group by schoollevel order by schoollevel
34
+    </select>
35
+</mapper>

+ 32
- 0
sapi/src/main/resources/mapper/cloud/CloudSyncDetailMapper.xml Vedi File

@@ -0,0 +1,32 @@
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.sapi.mapper.cloud.CloudSyncDetailMapper">
4
+  <!--批量添加-->
5
+  <insert id="batchSave">
6
+    insert into t_cloud_sync_detail (csdid,csid,synctable,plannum,beginid,endid
7
+    ,syncnum,handleid,createid,createtime,begintime,endtime,lsbid)
8
+    values
9
+    <foreach collection ="list" item="d" index= "index" separator =",">
10
+      (#{d.csdid},#{csid},#{d.synctable},#{d.plannum},#{d.beginid},#{d.endid}
11
+      ,#{d.syncnum},#{d.handleid},#{createid},#{d.createtime},#{d.begintime},#{d.endtime},#{d.lsbid})
12
+    </foreach>
13
+  </insert>
14
+  <!--获取未执行完的同步任务详情列表-->
15
+  <select id="listByCsId" resultType="com.xhkjedu.sapi.model.cloud.TCloudSyncDetail">
16
+    select csdid,csid,synctable,beginid,endid,handleid,syncnum,realnum,lsbid
17
+    from t_cloud_sync_detail where csid=#{csid} and endid!=IFNULL(handleid,0)
18
+  </select>
19
+  <!--更新已同步数量-->
20
+  <update id="updateRealNum">
21
+    update t_cloud_sync_detail set handleid=#{detail.handleid}
22
+    <if test="detail.realnum!=null">,realnum=realnum+#{detail.realnum}</if>
23
+    <if test="detail.starttime!=null">,starttime=#{detail.starttime},syncnum=#{detail.syncnum}</if>
24
+    <if test="detail.stoptime!=null">,stoptime=#{detail.stoptime}</if>
25
+    where csid=#{detail.csid} and synctable=#{detail.synctable}
26
+    <if test="detail.lsbid!=null">and lsbid=#{detail.lsbid}</if>
27
+  </update>
28
+  <!--获取未执行完成的任务详情数量-->
29
+  <select id="countNoEndByCsId" resultType="java.lang.Integer">
30
+    select count(*) from t_cloud_sync_detail where csid=#{csid} and endid!=IFNULL(handleid,0)
31
+  </select>
32
+</mapper>

+ 168
- 0
sapi/src/main/resources/mapper/cloud/CloudSyncMapper.xml Vedi File

@@ -0,0 +1,168 @@
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.mapper.sapi.cloud.CloudSyncMapper">
4
+  <!--列表-->
5
+  <resultMap id="syncResult" type="java.util.Map">
6
+    <id column="csid" property="csid"></id>
7
+    <collection property="details" javaType="java.util.List" select="listDetail" column="csid">
8
+    </collection>
9
+  </resultMap>
10
+  <select id="listDetail" resultType="java.util.Map">
11
+    select csdid,csid,plannum,beginid,endid,syncnum,realnum,handleid,starttime,stoptime
12
+    ,begintime,endtime,d.createid,d.createtime,sb.lsbname
13
+    ,(select s.subjectname from t_subject s where s.subjectid=sb.subjectid)subjectname
14
+    ,(select v.versionname from t_version v where v.versionid=sb.versionid)versionname
15
+    ,(case synctable when 't_subject' then '科目' when 't_version' then '版本' when 't_subject_book' then '教材'
16
+    when 't_director' then '章节' when 't_point' then '知识点' when 't_subject_questiontype' then '题型'
17
+    when 't_resource' then '资源' when 't_question' then '试题' else synctable end)synctable
18
+    from t_cloud_sync_detail d left join t_subject_book sb on d.lsbid=sb.lsbid
19
+    where csid=#{csid}
20
+  </select>
21
+  <select id="findAll" resultMap="syncResult">
22
+    select csid,begintime,endtime,starttime,stoptime,synctask,syncstate,createid,createtime
23
+    from t_cloud_sync order by csid desc
24
+  </select>
25
+  <!--添加-->
26
+  <insert id="save">
27
+    insert into t_cloud_sync(csid,begintime,endtime,starttime,stoptime,synctask,syncstate,createid,createtime)
28
+    values (#{sync.csid},#{sync.begintime},#{sync.endtime},#{sync.starttime},#{sync.stoptime}
29
+    ,#{sync.synctask},#{sync.syncstate},#{sync.createid},#{sync.createtime})
30
+  </insert>
31
+  <!--获取最后一条同步任务-->
32
+  <select id="getLastSync" resultType="com.xhkjedu.sapi.model.cloud.TCloudSync">
33
+    select csid, begintime, endtime, starttime, stoptime, synctask, syncstate, createid, createtime
34
+    from t_cloud_sync order by csid desc limit 1
35
+  </select>
36
+  <!--更新同步状态-->
37
+  <update id="updateState">
38
+    update t_cloud_sync set syncstate=#{syncstate},stoptime=UNIX_TIMESTAMP(now()) where csid=#{csid}
39
+  </update>
40
+  <select id="getCloudInfo" resultType="com.xhkjedu.sapi.model.cloud.TCloudSync">
41
+      select (select userid from t_user where usertype=999)createid
42
+      ,(select cloudcode from t_cloud limit 1)cloudcode
43
+  </select>
44
+    <!--同步科目-->
45
+  <insert id="syncSubject" parameterType="com.xhkjedu.sapi.model.subjectbook.TSubject">
46
+    <foreach collection ="list" item="m" index= "index" separator =";">
47
+      INSERT INTO t_subject (subjectid,subjectname,level,subjectorder,createtime,timeunix,belong)
48
+      VALUES (#{m.subjectid},#{m.subjectname},#{m.level},#{m.subjectorder},#{m.handletime},UNIX_TIMESTAMP(now()),1)
49
+      ON DUPLICATE KEY UPDATE subjectname=#{m.subjectname},subjectorder=#{m.subjectorder}
50
+    </foreach>
51
+  </insert>
52
+  <!--同步版本-->
53
+  <insert id="syncVersion" parameterType="com.xhkjedu.sapi.model.subjectbook.TVersion">
54
+    <foreach collection ="list" item="m" index= "index" separator =";">
55
+      INSERT INTO t_version (versionid,versionname,versionorder,createtime,timeunix,belong)
56
+      VALUES (#{m.versionid},#{m.versionname},#{m.versionorder},#{m.handletime},UNIX_TIMESTAMP(now()),1)
57
+      ON DUPLICATE KEY UPDATE versionname=#{m.versionname},versionorder=#{m.versionorder}
58
+    </foreach>
59
+  </insert>
60
+  <!--同步教材-->
61
+  <insert id="syncSubjectBook" parameterType="com.xhkjedu.sapi.model.subjectbook.TSubjectBook">
62
+    <foreach collection ="list" item="m" index= "index" separator =";">
63
+      INSERT INTO t_subject_book (lsbid,level,subjectid,versionid,lsbname,lsborder,coverpath,createtime,timeunix,belong)
64
+      VALUES (#{m.lsbid},#{m.level},#{m.subjectid},#{m.versionid},#{m.lsbname},#{m.lsborder},#{m.coverpath}
65
+      ,#{m.handletime},UNIX_TIMESTAMP(now()),1)
66
+      ON DUPLICATE KEY UPDATE lsbname=#{m.lsbname},lsborder=#{m.lsborder},coverpath=#{m.coverpath}
67
+    </foreach>
68
+  </insert>
69
+  <!--同步题型-->
70
+  <insert id="syncSubjectQuestionType" parameterType="com.xhkjedu.sapi.model.subjectbook.TSubjectQuestiontype">
71
+    <foreach collection ="list" item="m" index= "index" separator =";">
72
+      INSERT INTO t_subject_questiontype (qtypeid,qtypename,qtypeorder,subjectid,ctype,createtime,timeunix,belong)
73
+      VALUES (#{m.qtypeid},#{m.qtypename},#{m.qtypeorder},#{m.subjectid},#{m.ctype}
74
+      ,#{m.handletime},UNIX_TIMESTAMP(now()),1)
75
+      ON DUPLICATE KEY UPDATE qtypename=#{m.qtypename},qtypeorder=#{m.qtypeorder},ctype=#{m.ctype}
76
+    </foreach>
77
+  </insert>
78
+  <!--同步章节-->
79
+  <insert id="syncDirector" parameterType="com.xhkjedu.sapi.model.subjectbook.TDirector">
80
+    <foreach collection ="list" item="m" index= "index" separator =";">
81
+      INSERT INTO t_director (directorid,directorname,directorpid,directororder,leaf
82
+      ,lsbid,directorlevel,directorall,createtime,timeunix,belong)
83
+      VALUES (#{m.directorid},#{m.directorname},#{m.directorpid},#{m.directororder},#{m.leaf}
84
+      ,#{m.lsbid},#{m.directorlevel},#{m.directorall},#{m.handletime},UNIX_TIMESTAMP(now()),1)
85
+      ON DUPLICATE KEY UPDATE directorname=#{m.directorname},directororder=#{m.directororder}
86
+      ,leaf=#{m.leaf},directorall=#{m.directorall}
87
+    </foreach>
88
+  </insert>
89
+  <!--同步知识点-->
90
+  <insert id="syncPoint" parameterType="com.xhkjedu.sapi.model.subjectbook.TPoint">
91
+    <foreach collection ="list" item="m" index= "index" separator =";">
92
+      INSERT INTO t_point (pointid,pointname,pointorder,pointpid,subjectid
93
+      ,pointlevel,createtime,timeunix,belong)
94
+      VALUES (#{m.pointid},#{m.pointname},#{m.pointorder},#{m.pointpid},#{m.subjectid}
95
+      ,#{m.pointlevel},#{m.handletime},UNIX_TIMESTAMP(now()),1)
96
+      ON DUPLICATE KEY UPDATE pointname=#{m.pointname},pointorder=#{m.pointorder}
97
+    </foreach>
98
+  </insert>
99
+  <!--同步试题-->
100
+  <insert id="syncQuestion" parameterType="com.xhkjedu.sapi.model.subjectbook.TQuestion">
101
+      INSERT INTO t_question (questionid,qstem,qstemtxt,qoption,qanswer,qanalyze,score
102
+      ,complexity,ctype,qtypeid,qtypename,subjectid,qlevel,qstate,createtime,timeunix
103
+      ,source,year,region,schoolname,belong)
104
+      VALUES (#{m.questionid},#{m.qstem},#{m.qstemtxt},#{m.qoption},#{m.qanswer},#{m.qanalyze},#{m.score},#{m.complexity}
105
+      ,#{m.ctype},#{m.qtypeid},#{m.qtypename},#{m.subjectid},#{m.qlevel},#{m.qstate}
106
+      ,#{m.handletime},UNIX_TIMESTAMP(now()),#{m.source},#{m.year},#{m.region},#{m.schoolname},1)
107
+      ON DUPLICATE KEY UPDATE qstem=#{m.qstem},qstemtxt=#{m.qstemtxt},qoption=#{m.qoption}
108
+      ,qanswer=#{m.qanswer},qanalyze=#{m.qanalyze},score=#{m.score},complexity=#{m.complexity},qstate=#{m.qstate}
109
+      ,source=#{m.source},year=#{m.year},region=#{m.region},schoolname=#{m.schoolname}
110
+  </insert>
111
+  <!--同步试题章节-->
112
+  <insert id="syncQuestionDirector" parameterType="com.xhkjedu.sapi.model.subjectbook.TQuestionDirector">
113
+      <foreach collection ="list" item="m" index= "index" separator =";">
114
+      INSERT INTO t_question_director (qdid,questionid,lsbid,directorid,createtime,timeunix)
115
+      VALUES (#{m.qdid},#{m.questionid},#{m.lsbid},#{m.directorid},#{m.handletime},UNIX_TIMESTAMP(now()))
116
+      ON DUPLICATE KEY UPDATE questionid=#{m.questionid},lsbid=#{m.lsbid},directorid=#{m.directorid}
117
+      </foreach>
118
+  </insert>
119
+  <!--同步试题知识点-->
120
+  <insert id="syncQuestionPoint" parameterType="com.xhkjedu.sapi.model.subjectbook.TQuestionPoint">
121
+      <foreach collection ="list" item="m" index= "index" separator =";">
122
+      INSERT INTO t_question_point (qpid,questionid,pointid,createtime,timeunix)
123
+      VALUES (#{m.qpid},#{m.questionid},#{m.pointid},#{m.handletime},UNIX_TIMESTAMP(now()))
124
+      ON DUPLICATE KEY UPDATE questionid=#{m.questionid},pointid=#{m.pointid}
125
+      </foreach>
126
+  </insert>
127
+  <!--同步资源-->
128
+  <insert id="syncResource" parameterType="com.xhkjedu.sapi.model.subjectbook.TResource">
129
+      INSERT INTO t_resource (resourceid,resourcename,subjectid,resourceclass,resourcetype,level
130
+      ,resourceurl,resourcecover,converted,pdfurl,resourcestate,suffix,mp4code,resourcesize,duration,comm
131
+      ,createtime,timeunix,resourcegrade,source,year,region,schoolname,belong)
132
+      VALUES (#{m.resourceid},#{m.resourcename},#{m.subjectid},#{m.resourceclass},#{m.resourcetype},#{m.level}
133
+      ,#{m.resourceurl},#{m.resourcecover},#{m.converted},#{m.pdfurl},#{m.resourcestate},#{m.suffix}
134
+      ,#{m.mp4code},#{m.resourcesize},#{m.duration},#{m.comm},#{m.handletime},UNIX_TIMESTAMP(now())
135
+      ,#{m.resourcegrade},#{m.source},#{m.year},#{m.region},#{m.schoolname},1)
136
+      ON DUPLICATE KEY UPDATE resourcename=#{m.resourcename},resourcestate=#{m.resourcestate},comm=#{m.comm}
137
+  </insert>
138
+  <!--同步资源章节-->
139
+  <insert id="syncResourceDirector" parameterType="com.xhkjedu.sapi.model.subjectbook.TResourceDirector">
140
+      <foreach collection ="list" item="m" index= "index" separator =";">
141
+      INSERT INTO t_resource_director (rdid,resourceid,lsbid,directorid,createtime,timeunix)
142
+      VALUES (#{m.rdid},#{m.resourceid},#{m.lsbid},#{m.directorid},#{m.handletime},UNIX_TIMESTAMP(now()))
143
+      ON DUPLICATE KEY UPDATE resourceid=#{m.resourceid},lsbid=#{m.lsbid},directorid=#{m.directorid}
144
+      </foreach>
145
+  </insert>
146
+    <!--外键是否存在-->
147
+    <select id="getFkExisted" resultType="java.lang.Integer">
148
+        SELECT 1 FROM information_schema.KEY_COLUMN_USAGE WHERE CONSTRAINT_NAME=#{fkname} and CONSTRAINT_SCHEMA=#{dbname}
149
+    </select>
150
+    <!--删除章节外键-->
151
+    <update id="delDirectorFk">
152
+        ALTER TABLE t_director DROP FOREIGN KEY fk_directorpid;
153
+    </update>
154
+    <!--添加章节外键-->
155
+    <update id="addDirectorFk">
156
+        ALTER TABLE t_director ADD CONSTRAINT fk_directorpid
157
+        FOREIGN KEY (directorpid) REFERENCES t_director(directorid) ON DELETE CASCADE ON UPDATE CASCADE;
158
+    </update>
159
+    <!--删除知识点外键-->
160
+    <update id="delPointFk">
161
+        ALTER TABLE t_point DROP FOREIGN KEY fk_pointpid;
162
+    </update>
163
+    <!--添加知识点外键-->
164
+    <update id="addPointFk">
165
+        ALTER TABLE t_point ADD CONSTRAINT fk_pointpid
166
+        FOREIGN KEY (pointpid) REFERENCES t_point(pointid) ON DELETE CASCADE ON UPDATE CASCADE;
167
+    </update>
168
+</mapper>

+ 79
- 0
sapi/src/main/resources/mapper/system/AreazoneMapper.xml Vedi File

@@ -0,0 +1,79 @@
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.sapi.mapper.system.AreazoneMapper">
4
+  <!--获取地区列表-->
5
+  <resultMap id="areazoneResult" type="java.util.Map">
6
+    <result property="areaid" column="areaid"></result>
7
+    <result property="areaname" column="areaname"></result>
8
+    <result property="areapid" column="areapid"></result>
9
+    <result property="areacode" column="areacode"></result>
10
+    <result property="level" column="level"></result>
11
+    <result property="createtime" column="createtime"></result>
12
+    <result property="createname" column="createname"></result>
13
+    <collection property="cities" javaType="java.util.List" select="listCity1" column="areaid">
14
+    </collection>
15
+  </resultMap>
16
+  <resultMap id="areazoneResult2" type="java.util.Map">
17
+    <result property="areaid" column="areaid"></result>
18
+    <result property="areaname" column="areaname"></result>
19
+    <result property="areapid" column="areapid"></result>
20
+    <result property="areacode" column="areacode"></result>
21
+    <result property="level" column="level"></result>
22
+    <result property="createtime" column="createtime"></result>
23
+    <result property="createname" column="createname"></result>
24
+    <collection property="zones" javaType="java.util.List" select="listZone1" column="areaid">
25
+    </collection>
26
+  </resultMap>
27
+  <select id="listCity1" resultMap="areazoneResult2">
28
+    select a.areaid, a.areaname, a.areapid, a.areacode, a.level, a.createid, a.createtime,a.lcregion,a.areaall,u.username createname
29
+    from t_areazone a left join t_user u on a.createid=u.userid
30
+    where a.areapid=#{areaid} order by a.areacode
31
+  </select>
32
+  <select id="listZone1" resultType="java.util.Map">
33
+    select a.areaid, a.areaname, a.areapid, a.areacode, a.level, a.createid, a.createtime,a.lcregion,a.areaall,u.username createname
34
+    from t_areazone a left join t_user u on a.createid=u.userid
35
+    where a.areapid=#{areaid} order by a.areacode
36
+  </select>
37
+  <select id="listAll" resultMap="areazoneResult">
38
+    select a.areaid, a.areaname, a.areapid, a.areacode, a.level, a.createid, a.createtime,a.lcregion,a.areaall,u.username createname
39
+    from t_areazone a left join t_user u on a.createid=u.userid
40
+    where a.level=1 order by a.areacode
41
+  </select>
42
+  <!--获取地区选择列表-->
43
+  <resultMap id="areaResult" type="java.util.Map">
44
+    <result property="areaname" column="areaname"></result>
45
+    <result property="areacode" column="areacode"></result>
46
+    <collection property="cities" ofType="com.xhkjedu.sapi.vo.system.AreazoneVo" javaType="java.util.List" select="listCity" column="areaid">
47
+    </collection>
48
+  </resultMap>
49
+  <resultMap id="areaResult2" type="java.util.Map">
50
+    <result property="areaname" column="areaname"></result>
51
+    <result property="areacode" column="areacode"></result>
52
+    <result property="lcregion" column="lcregion"></result>
53
+    <collection property="zones" ofType="com.xhkjedu.sapi.vo.system.AreazoneVo" javaType="java.util.List" select="listZone" column="areaid">
54
+    </collection>
55
+  </resultMap>
56
+  <select id="listCity" resultMap="areaResult2">
57
+    select areaid,areaname,areacode,lcregion,areaall
58
+    from t_areazone where areapid=#{areaid} order by areacode
59
+  </select>
60
+  <select id="listZone" resultType="com.xhkjedu.sapi.vo.system.AreazoneVo">
61
+    select areaid,areaname,areacode,lcregion,areaall
62
+    from t_areazone where areapid=#{areaid} order by areacode
63
+  </select>
64
+  <select id="listForSel" resultMap="areaResult">
65
+    select areaid,areaname,areacode,lcregion,areaall
66
+    from t_areazone where level=1 order by areacode
67
+  </select>
68
+
69
+  <!--修改区域全名称-->
70
+  <update id="updateAreaAll">
71
+    update t_areazone a1 set a1.areaall=concat(#{areaall},a1.areaname)
72
+    where a1.areapid=#{areaid}
73
+  </update>
74
+  <update id="updateAreaAll2">
75
+    update t_areazone a1 left join t_areazone a2 on a1.areapid=a2.areaid
76
+    set a1.areaall=concat(#{areaall},a2.areaname,a1.areaname)
77
+    where a2.areapid=#{areaid}
78
+  </update>
79
+</mapper>

+ 67
- 0
sapi/src/main/resources/mapper/system/ModuleMapper.xml Vedi File

@@ -0,0 +1,67 @@
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.sapi.mapper.system.ModuleMapper">
4
+
5
+    <!-- 获取所有应用 -->
6
+    <select id="listModules" resultType="com.xhkjedu.sapi.model.system.TModule">
7
+        SELECT m.moduleid,m.modulename,m.moduleurl,m.moduleico,m.modulepid,m.morder,m.minout,m.comm,
8
+        m.mclass,m.level,m.createid,m.createtime,m.schoolid,u.username AS createname,m.mabbrevname
9
+        ,m.defaultid,m.mdefault,m.moduletype,m.display
10
+        FROM t_module m LEFT JOIN t_user u ON m.createid=u.userid
11
+        WHERE m.schoolid=#{schoolid}
12
+        <choose>
13
+            <when test="moduletype==2 or moduletype==3">and m.moduletype in(#{moduletype},4)</when>
14
+            <when test="moduletype==5">and m.moduletype between 2 and 4</when>
15
+            <otherwise>and m.moduletype=#{moduletype}</otherwise>
16
+        </choose>
17
+        <if test="display!=null">and m.display=#{display}</if>
18
+        ORDER BY m.morder
19
+    </select>
20
+
21
+    <!-- 获取供第一层模块 -->
22
+    <select id="listLevelModule" resultType="com.xhkjedu.sapi.vo.system.ModuleSelVo">
23
+        SELECT moduleid,modulename,LEVEL FROM t_module
24
+        WHERE schoolid=#{schoolid} and LEVEL=1 and display=1
25
+        <choose>
26
+            <when test="moduletype==2 or moduletype==3">and moduletype in(#{moduletype},4)</when>
27
+            <when test="moduletype==5">and moduletype between 2 and 4</when>
28
+            <otherwise>and moduletype=#{moduletype}</otherwise>
29
+        </choose>
30
+    </select>
31
+
32
+    <update id="updateOrder">
33
+        update t_module set morder=morder+1
34
+        where modulepid=#{module.modulepid} and morder>=#{module.morder} and moduleid!=#{module.moduleid}
35
+    </update>
36
+    <!--模块上移-->
37
+    <update id="moveUp">
38
+        UPDATE t_module
39
+        <trim prefix="set" suffixOverrides=",">
40
+            <trim prefix="morder = CASE " suffix="END,">
41
+                <foreach collection="list" index="index" item="item">
42
+                    when moduleid=#{item.moduleid} then #{item.morder}
43
+                </foreach>
44
+            </trim>
45
+        </trim>
46
+        where
47
+        <foreach collection="list" item="item" index="index" separator="or">
48
+            moduleid=#{item.moduleid}
49
+        </foreach>
50
+    </update>
51
+
52
+    <!--模块选择列表-->
53
+    <select id="listForSel2" resultType="java.util.Map">
54
+        SELECT m.moduleid,m.modulename,m.mabbrevname,m.moduletype
55
+        FROM t_module m WHERE m.schoolid=#{schoolid} and m.level!=1
56
+        <choose>
57
+            <when test="moduletype==2 or moduletype==3">and m.moduletype in(#{moduletype},4)</when>
58
+            <when test="moduletype==5">and m.moduletype between 2 and 4</when>
59
+            <otherwise>and m.moduletype=#{moduletype}</otherwise>
60
+        </choose>
61
+        and m.display=1 ORDER BY m.morder
62
+    </select>
63
+    <!--删除默认模块关联的学校模块-->
64
+    <delete id="deleteByDefaultId">
65
+        delete from t_module where defaultid=#{defaultid}
66
+    </delete>
67
+</mapper>

+ 47
- 0
sapi/src/main/resources/mapper/system/ModuledefaultMapper.xml Vedi File

@@ -0,0 +1,47 @@
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.sapi.mapper.system.ModuledefaultMapper">
4
+    <!-- 获取所有模块 -->
5
+    <select id="listModules" resultType="com.xhkjedu.sapi.model.system.TModule">
6
+        SELECT m.moduleid,m.modulename,m.moduleurl,m.moduleico,m.modulepid
7
+        ,m.morder,m.minout,m.comm,m.mclass,m.level,m.mabbrevname,m.mdefault,m.moduletype,m.display
8
+        FROM t_moduledefault m
9
+        <choose>
10
+            <when test="moduletype==null"></when>
11
+            <when test="moduletype==2 or moduletype==3">where m.moduletype in(#{moduletype},4)</when>
12
+            <when test="moduletype==5">where m.moduletype between 2 and 4</when>
13
+            <otherwise>where m.moduletype=#{moduletype}</otherwise>
14
+        </choose>
15
+        <if test="display!=null">and m.display=#{display}</if>
16
+        ORDER BY m.morder
17
+    </select>
18
+    <!-- 获取供第一层模块 -->
19
+    <select id="listLevelModule" resultType="com.xhkjedu.sapi.vo.system.ModuleSelVo">
20
+        SELECT moduleid,modulename,LEVEL FROM t_moduledefault WHERE LEVEL=1 and display=1
21
+        <choose>
22
+            <when test="moduletype==2 or moduletype==3">and moduletype in(#{moduletype},4)</when>
23
+            <when test="moduletype==5">and moduletype between 2 and 4</when>
24
+            <otherwise>and moduletype=#{moduletype}</otherwise>
25
+        </choose>
26
+    </select>
27
+    <!--获取学校id集合-->
28
+    <select id="listSchoolId" resultType="java.lang.Integer">
29
+        select schoolid from t_school where schoolstate=1
30
+    </select>
31
+    <!--模块地址对应模块数量-->
32
+    <select id="countByUrl" resultType="java.lang.Integer">
33
+        select count(*) from t_moduledefault where moduleurl=#{moduleurl} and moduletype=#{moduletype}
34
+    </select>
35
+    <!--更新学校模块信息-->
36
+    <update id="updateByDefaultId">
37
+        update t_module m left join t_moduledefault d on m.defaultid=d.moduleid
38
+        set m.modulename=d.modulename,m.mabbrevname=d.mabbrevname,m.moduleurl=d.moduleurl,m.moduleico=d.moduleico
39
+        ,m.morder=d.morder,m.minout=d.minout,m.mclass=d.mclass,m.mdefault=d.mdefault,m.comm=d.comm,m.display=d.display
40
+        where m.defaultid=#{moduleid}
41
+    </update>
42
+    <!--获取系统模块id-->
43
+    <select id="getModuleIdByDefaultId" resultType="java.lang.String">
44
+        select moduleid from t_module where level=1 and schoolid=#{schoolid} and moduletype=#{moduletype} and
45
+        defaultid=#{moduleid} limit 1
46
+    </select>
47
+</mapper>

+ 70
- 0
sapi/src/main/resources/mapper/system/SchoolMapper.xml Vedi File

@@ -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.sapi.mapper.system.SchoolMapper">
4
+    <!--删除-->
5
+    <update id="deleteById">
6
+        update t_school set schoolstate=10 where schoolid=#{schoolid}
7
+    </update>
8
+    <select id="findAll" resultType="com.xhkjedu.sapi.model.system.TSchool">
9
+        select s.*,tu.username createname
10
+        ,(select u.loginname from t_user u where u.schoolid=s.schoolid and u.usertype=0 and u.userstate=1
11
+        ORDER BY u.userid ASC LIMIT 1)loginname
12
+        from t_school s left join t_user tu on s.createid = tu.userid
13
+        where s.schoolstate=1 order by s.createtime desc
14
+    </select>
15
+    <!--学年升级-->
16
+    <update id="upgrade">
17
+        update t_school set year=year+1 where schoolid=#{schoolid};
18
+    </update>
19
+    <!--学年降级-->
20
+    <update id="downgrade">
21
+        delete gs.*,g.*,cs.*,ct.*,c.*
22
+        from t_class c left join t_class_student cs on cs.classid=c.classid
23
+        left join t_class_teacher ct on ct.classid=c.classid
24
+        left join t_group g on c.classid=g.classid
25
+        left join t_group_student gs on gs.groupid=g.groupid
26
+        where c.schoolid=#{schoolid} and c.year=#{year};
27
+        update t_school set year=year-1 where schoolid=#{schoolid}
28
+    </update>
29
+    <!--学校选择列表-->
30
+    <select id="listForSel" resultType="java.util.Map">
31
+        select schoolid,schoolname from t_school where schoolstate=1
32
+    </select>
33
+
34
+    <!--获取区域码-->
35
+    <select id="getSchoolDetailById" resultType="com.xhkjedu.sapi.model.system.TSchool">
36
+      select * ,(select cloudcode from t_cloud limit 1) cloudcode
37
+      from t_school where schoolid=#{schoolid}
38
+    </select>
39
+    <update id="updateSchoolDock">
40
+        update t_school set docklc=#{docklc} where schoolid=#{schoolid}
41
+    </update>
42
+    <!--根据学校名称查找学校数量-->
43
+    <select id="countBySchoolName" resultType="java.lang.Integer">
44
+        select count(*) from t_school where schoolstate=1 and schoolname=#{schoolname}
45
+    </select>
46
+    <!--获取学校当前年份-->
47
+    <select id="getYearById" resultType="java.lang.Integer">
48
+        select year from t_school where schoolid=#{schoolid}
49
+    </select>
50
+    <!--获取用户当前年份-->
51
+    <select id="getYearByUserId" resultType="java.lang.Integer">
52
+        select s.year from t_user u left join t_school s on u.schoolid=s.schoolid
53
+        where u.userid=#{userid}
54
+    </select>
55
+    <!--获取学校账号数量-->
56
+    <select id="getUserNumById" resultType="java.lang.Integer">
57
+        select usernum from t_school where schoolid=#{schoolid}
58
+    </select>
59
+    <!--修改-->
60
+    <update id="updateById">
61
+        update t_school set schoolname=#{school.schoolname},shortname=#{school.shortname},errorrate=#{school.errorrate}
62
+        ,bindmac=#{school.bindmac},docklc=#{school.docklc},usernum=#{school.usernum},livenum=#{school.livenum}
63
+        ,livetime=#{school.livetime},coordinate=#{school.coordinate}
64
+        where schoolid=#{school.schoolid}
65
+    </update>
66
+    <!--根据域名获取学校id-->
67
+    <select id="getSchoolIdByDomain" resultType="java.lang.Integer">
68
+        select schoolid from t_school where schoolid=#{schoolid} and schooldomain=#{schooldomain}
69
+    </select>
70
+</mapper>

+ 25
- 0
sapi/src/main/resources/mapper/system/SchoolStypeMapper.xml Vedi File

@@ -0,0 +1,25 @@
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.sapi.mapper.system.SchoolStypeMapper">
4
+    <!--通过域名获取学校样式列表-->
5
+    <select id="findAll" resultType="com.xhkjedu.sapi.model.system.TSchoolStype">
6
+        select stid, s.schooldomain, st.schoolid, schooltype, stypeaddr, createid, createtime
7
+        ,s.schoolname
8
+        from (select schoolid,schoolname,schooldomain from t_school where schooldomain=#{stype.schooldomain}
9
+        limit 1)s left join t_school_stype st on s.schoolid=st.schoolid
10
+    </select>
11
+    <!--通过学校id获取学校样式列表-->
12
+    <select id="findAll2" resultType="com.xhkjedu.sapi.model.system.TSchoolStype">
13
+        select st.stid, s.schooldomain, st.schoolid, st.schooltype, st.stypeaddr, st.createid, st.createtime
14
+        ,s.schoolname
15
+        from t_school s left join t_school_stype st on s.schoolid=st.schoolid where s.schoolid=#{stype.schoolid}
16
+    </select>
17
+    <!--批量添加-->
18
+    <insert id="batchSave" parameterType="com.xhkjedu.sapi.model.system.TSchoolStype">
19
+        <foreach collection ="list" item="s" index= "index" separator =";">
20
+            INSERT INTO t_school_stype (schooldomain, schoolid, schooltype, stypeaddr, createid, createtime)
21
+            VALUES (#{s.schooldomain},#{s.schoolid},#{s.schooltype},#{s.stypeaddr},#{s.createid},#{s.createtime})
22
+            ON DUPLICATE KEY UPDATE schooldomain=#{s.schooldomain},stypeaddr=#{s.stypeaddr},createid=#{s.createid}
23
+        </foreach>
24
+    </insert>
25
+</mapper>

+ 12
- 0
sapi/src/main/resources/mapper/system/SyserrorMapper.xml Vedi File

@@ -0,0 +1,12 @@
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.sapi.mapper.system.SyserrorMapper">
4
+    <select id="listAll" resultType="com.xhkjedu.sapi.model.system.TSyserror">
5
+        select errid,device,errmsg,createtime from t_syserror
6
+        <where>
7
+            <if test="error.device!=null and error.device!=''"> and device=#{error.device}</if>
8
+            <if test="error.errmsg!=null and error.errmsg!=''"> and errmsg like '%${error.errmsg}%'</if>
9
+        </where>
10
+        order by createtime desc
11
+    </select>
12
+</mapper>

+ 29
- 0
sapi/src/main/resources/mapper/system/UserLogMapper.xml Vedi File

@@ -0,0 +1,29 @@
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.sapi.mapper.system.UserLogMapper">
4
+    <!-- 登录日志列表 -->
5
+    <select id="listLog" resultType="com.xhkjedu.sapi.model.system.TUserLog" >
6
+        select * from t_user_log
7
+        <where>
8
+            <if test="log.schoolid!=null">
9
+                and schoolid=#{log.schoolid}
10
+            </if>
11
+            <if test="log.loginname!=null and log.loginname!=''">
12
+                and (loginname like '%${log.loginname}%' or username like '%${log.loginname}%')
13
+            </if>
14
+            <if test="log.logtime!=null and log.logtime!=0">
15
+                and UNIX_TIMESTAMP(FROM_UNIXTIME(logtime, '%Y%m%d'))>=#{log.logtime}
16
+            </if>
17
+            <if test="log.endtime!=null and log.endtime!=0">
18
+                and UNIX_TIMESTAMP(FROM_UNIXTIME(logtime, '%Y%m%d')) &lt;= #{log.endtime}
19
+            </if>
20
+            <if test="log.ultype!=null and log.ultype!=''">
21
+                and ultype=#{log.ultype}
22
+            </if>
23
+            <if test="log.versionnum!=null and log.versionnum!=''">
24
+                and versionnum=#{log.versionnum}
25
+            </if>
26
+        </where>
27
+        order by ulid desc
28
+    </select>
29
+</mapper>

Loading…
Annulla
Salva