Browse Source

不报错版本

tags/正式3.2.0
雍文秀 2 years ago
parent
commit
f1e3ee6065
99 changed files with 8024 additions and 7 deletions
  1. 49
    4
      suser/pom.xml
  2. 2
    0
      suser/src/main/java/com/xhkjedu/suser/SuserApplication.java
  3. 9
    0
      suser/src/main/java/com/xhkjedu/suser/base/TkMapper.java
  4. 54
    0
      suser/src/main/java/com/xhkjedu/suser/config/ConfigKey.java
  5. 34
    0
      suser/src/main/java/com/xhkjedu/suser/config/CorsConfig.java
  6. 67
    0
      suser/src/main/java/com/xhkjedu/suser/config/ErrorAdivceController.java
  7. 72
    0
      suser/src/main/java/com/xhkjedu/suser/controller/gradeclass/ClassController.java
  8. 193
    0
      suser/src/main/java/com/xhkjedu/suser/controller/gradeclass/ClassStudentController.java
  9. 128
    0
      suser/src/main/java/com/xhkjedu/suser/controller/gradeclass/ClassTeacherController.java
  10. 87
    0
      suser/src/main/java/com/xhkjedu/suser/controller/gradeclass/GradeController.java
  11. 68
    0
      suser/src/main/java/com/xhkjedu/suser/controller/gradeclass/GroupController.java
  12. 49
    0
      suser/src/main/java/com/xhkjedu/suser/controller/gradeclass/GroupStudentController.java
  13. 136
    0
      suser/src/main/java/com/xhkjedu/suser/controller/system/RoleController.java
  14. 130
    0
      suser/src/main/java/com/xhkjedu/suser/controller/system/TeacherRoleController.java
  15. 378
    0
      suser/src/main/java/com/xhkjedu/suser/controller/system/UserController.java
  16. 108
    0
      suser/src/main/java/com/xhkjedu/suser/interceptors/DecryptRequestBodyAdvice.java
  17. 35
    0
      suser/src/main/java/com/xhkjedu/suser/interceptors/HttpServletFilter.java
  18. 66
    0
      suser/src/main/java/com/xhkjedu/suser/interceptors/RequestInterceptor.java
  19. 82
    0
      suser/src/main/java/com/xhkjedu/suser/interceptors/RequestWrapper.java
  20. 62
    0
      suser/src/main/java/com/xhkjedu/suser/interceptors/WebMvcConfg.java
  21. 54
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/ClassMapper.java
  22. 63
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/ClassStudentMapper.java
  23. 90
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/ClassTeacherMapper.java
  24. 36
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/GradeMapper.java
  25. 26
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/GroupMapper.java
  26. 22
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/GroupStudentMapper.java
  27. 36
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/system/RoleMapper.java
  28. 55
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/system/RoleModuleMapper.java
  29. 211
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/system/UserMapper.java
  30. 42
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/system/UserRoleMapper.java
  31. 26
    0
      suser/src/main/java/com/xhkjedu/suser/model/BaseBean.java
  32. 51
    0
      suser/src/main/java/com/xhkjedu/suser/model/assess/TAssessFile.java
  33. 80
    0
      suser/src/main/java/com/xhkjedu/suser/model/assess/TAssessUser.java
  34. 48
    0
      suser/src/main/java/com/xhkjedu/suser/model/gradeclass/TClass.java
  35. 78
    0
      suser/src/main/java/com/xhkjedu/suser/model/gradeclass/TClassStudent.java
  36. 59
    0
      suser/src/main/java/com/xhkjedu/suser/model/gradeclass/TClassTeacher.java
  37. 43
    0
      suser/src/main/java/com/xhkjedu/suser/model/gradeclass/TGrade.java
  38. 52
    0
      suser/src/main/java/com/xhkjedu/suser/model/gradeclass/TGroup.java
  39. 33
    0
      suser/src/main/java/com/xhkjedu/suser/model/gradeclass/TGroupStudent.java
  40. 67
    0
      suser/src/main/java/com/xhkjedu/suser/model/gradeclass/TSchool.java
  41. 35
    0
      suser/src/main/java/com/xhkjedu/suser/model/subjectbook/TTeacherPowersb.java
  42. 36
    0
      suser/src/main/java/com/xhkjedu/suser/model/system/TMsg.java
  43. 42
    0
      suser/src/main/java/com/xhkjedu/suser/model/system/TRole.java
  44. 30
    0
      suser/src/main/java/com/xhkjedu/suser/model/system/TRoleModule.java
  45. 115
    0
      suser/src/main/java/com/xhkjedu/suser/model/system/TUser.java
  46. 53
    0
      suser/src/main/java/com/xhkjedu/suser/model/system/TUserLog.java
  47. 36
    0
      suser/src/main/java/com/xhkjedu/suser/model/system/TUserModule.java
  48. 32
    0
      suser/src/main/java/com/xhkjedu/suser/model/system/TUserRole.java
  49. 201
    0
      suser/src/main/java/com/xhkjedu/suser/service/gradeclass/ClassService.java
  50. 528
    0
      suser/src/main/java/com/xhkjedu/suser/service/gradeclass/ClassStudentService.java
  51. 152
    0
      suser/src/main/java/com/xhkjedu/suser/service/gradeclass/ClassTeacherService.java
  52. 87
    0
      suser/src/main/java/com/xhkjedu/suser/service/gradeclass/GradeService.java
  53. 75
    0
      suser/src/main/java/com/xhkjedu/suser/service/gradeclass/GroupService.java
  54. 77
    0
      suser/src/main/java/com/xhkjedu/suser/service/gradeclass/GroupStudentService.java
  55. 197
    0
      suser/src/main/java/com/xhkjedu/suser/service/system/RoleService.java
  56. 223
    0
      suser/src/main/java/com/xhkjedu/suser/service/system/TeacherRoleService.java
  57. 780
    0
      suser/src/main/java/com/xhkjedu/suser/service/system/UserService.java
  58. 106
    0
      suser/src/main/java/com/xhkjedu/suser/utils/JedisUtil.java
  59. 284
    0
      suser/src/main/java/com/xhkjedu/suser/utils/PoiUtils.java
  60. 92
    0
      suser/src/main/java/com/xhkjedu/suser/utils/SMSSender.java
  61. 46
    0
      suser/src/main/java/com/xhkjedu/suser/utils/UserUtil.java
  62. 19
    0
      suser/src/main/java/com/xhkjedu/suser/vo/assess/AssessParams.java
  63. 15
    0
      suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/CStudentVo.java
  64. 21
    0
      suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/ClassGroupVo.java
  65. 14
    0
      suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/ClassImportVo.java
  66. 57
    0
      suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/ClassStudentVo.java
  67. 21
    0
      suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/ClassTeacherParams.java
  68. 30
    0
      suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/ClassTeacherVo.java
  69. 47
    0
      suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/ClassVo.java
  70. 23
    0
      suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/GradeSubjectVo.java
  71. 20
    0
      suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/GradeVo.java
  72. 27
    0
      suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/GroupStudentVo.java
  73. 26
    0
      suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/GroupVo.java
  74. 18
    0
      suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/ImportStudentVo.java
  75. 46
    0
      suser/src/main/java/com/xhkjedu/suser/vo/paper/AStudentPaperVo.java
  76. 42
    0
      suser/src/main/java/com/xhkjedu/suser/vo/paper/AnalyzeSearchVo.java
  77. 26
    0
      suser/src/main/java/com/xhkjedu/suser/vo/subjectbook/LsbBookVo.java
  78. 22
    0
      suser/src/main/java/com/xhkjedu/suser/vo/subjectbook/SubjectVo.java
  79. 40
    0
      suser/src/main/java/com/xhkjedu/suser/vo/subjectbook/TeacherSubjectbookVo.java
  80. 48
    0
      suser/src/main/java/com/xhkjedu/suser/vo/system/RoleModuleVo.java
  81. 31
    0
      suser/src/main/java/com/xhkjedu/suser/vo/system/RoleVo.java
  82. 42
    0
      suser/src/main/java/com/xhkjedu/suser/vo/system/TeacherRoleParam.java
  83. 26
    0
      suser/src/main/java/com/xhkjedu/suser/vo/system/TeacherRoleVo.java
  84. 36
    0
      suser/src/main/java/com/xhkjedu/suser/vo/system/TeacherVo.java
  85. 33
    0
      suser/src/main/java/com/xhkjedu/suser/vo/system/UserModuleVo.java
  86. 18
    0
      suser/src/main/java/com/xhkjedu/suser/vo/system/UserRoleVo.java
  87. 116
    0
      suser/src/main/java/com/xhkjedu/suser/vo/system/UserVo.java
  88. 34
    0
      suser/src/main/java/com/xhkjedu/suser/vo/system/ZtMsgVo.java
  89. 10
    3
      suser/src/main/resources/application.properties
  90. 98
    0
      suser/src/main/resources/mapper/gradeclass/ClassMapper.xml
  91. 147
    0
      suser/src/main/resources/mapper/gradeclass/ClassStudentMapper.xml
  92. 196
    0
      suser/src/main/resources/mapper/gradeclass/ClassTeacherMapper.xml
  93. 79
    0
      suser/src/main/resources/mapper/gradeclass/GradeMapper.xml
  94. 66
    0
      suser/src/main/resources/mapper/gradeclass/GroupMapper.xml
  95. 24
    0
      suser/src/main/resources/mapper/gradeclass/GroupStudentMapper.xml
  96. 17
    0
      suser/src/main/resources/mapper/system/RoleMapper.xml
  97. 33
    0
      suser/src/main/resources/mapper/system/RoleModuleMapper.xml
  98. 215
    0
      suser/src/main/resources/mapper/system/UserMapper.xml
  99. 33
    0
      suser/src/main/resources/mapper/system/UserRoleMapper..xml

+ 49
- 4
suser/pom.xml View File

@@ -22,10 +22,10 @@
22 22
             <groupId>org.springframework.boot</groupId>
23 23
             <artifactId>spring-boot-starter-web</artifactId>
24 24
         </dependency>
25
-        <dependency>
26
-            <groupId>org.springframework.cloud</groupId>
27
-            <artifactId>spring-cloud-starter-config</artifactId>
28
-        </dependency>
25
+        <!--<dependency>-->
26
+        <!--    <groupId>org.springframework.cloud</groupId>-->
27
+        <!--    <artifactId>spring-cloud-starter-config</artifactId>-->
28
+        <!--</dependency>-->
29 29
 
30 30
         <dependency>
31 31
             <groupId>mysql</groupId>
@@ -41,6 +41,50 @@
41 41
             <artifactId>spring-boot-starter-test</artifactId>
42 42
             <scope>test</scope>
43 43
         </dependency>
44
+        <!--mybatis通用mapper依赖-->
45
+        <!--<dependency>-->
46
+        <!--    <groupId>tk.mybatis</groupId>-->
47
+        <!--    <artifactId>mapper-spring-boot-starter</artifactId>-->
48
+        <!--    <version>2.1.5</version>-->
49
+        <!--</dependency>-->
50
+        <dependency>
51
+            <groupId>com.xhkjedu</groupId>
52
+            <artifactId>scommons</artifactId>
53
+            <version>0.0.1-SNAPSHOT</version>
54
+        </dependency>
55
+        <dependency>
56
+            <groupId>com.alibaba</groupId>
57
+            <artifactId>fastjson</artifactId>
58
+            <version>1.2.56</version>
59
+        </dependency>
60
+        <!-- redis -->
61
+        <dependency>
62
+            <groupId>redis.clients</groupId>
63
+            <artifactId>jedis</artifactId>
64
+            <version>2.9.3</version>
65
+        </dependency>
66
+        <dependency>
67
+            <groupId>org.springframework.boot</groupId>
68
+            <artifactId>spring-boot-starter-data-redis</artifactId>
69
+        </dependency>
70
+        <!--  导入和导出excel时需要的jar包 -->
71
+        <dependency>
72
+            <groupId>org.apache.poi</groupId>
73
+            <artifactId>poi-ooxml</artifactId>
74
+            <version>3.17</version>
75
+        </dependency>
76
+        <dependency>
77
+            <groupId>org.apache.poi</groupId>
78
+            <artifactId>poi</artifactId>
79
+            <version>3.17</version>
80
+        </dependency>
81
+        <!-- https://mvnrepository.com/artifact/tk.mybatis/mapper-spring-boot-starter -->
82
+        <dependency>
83
+            <groupId>tk.mybatis</groupId>
84
+            <artifactId>mapper-spring-boot-starter</artifactId>
85
+            <version>2.0.2</version>
86
+        </dependency>
87
+
44 88
     </dependencies>
45 89
     <dependencyManagement>
46 90
         <dependencies>
@@ -72,6 +116,7 @@
72 116
                 <!--编译跳过测试文件检查的生命周期-->
73 117
                 <groupId>org.apache.maven.plugins</groupId>
74 118
                 <artifactId>maven-surefire-plugin</artifactId>
119
+                <version>2.22.2</version>
75 120
                 <configuration>
76 121
                     <skip>true</skip>
77 122
                 </configuration>

+ 2
- 0
suser/src/main/java/com/xhkjedu/suser/SuserApplication.java View File

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

+ 9
- 0
suser/src/main/java/com/xhkjedu/suser/base/TkMapper.java View File

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

+ 54
- 0
suser/src/main/java/com/xhkjedu/suser/config/ConfigKey.java View File

@@ -0,0 +1,54 @@
1
+package com.xhkjedu.suser.config;
2
+
3
+import org.springframework.beans.factory.annotation.Value;
4
+import org.springframework.stereotype.Component;
5
+
6
+import java.io.UnsupportedEncodingException;
7
+
8
+/**
9
+ * @author ywx
10
+ * @classname ConfigKey
11
+ * @description 读取配置文件类
12
+ * @date 2020/10/16 9:19
13
+ **/
14
+@Component
15
+public class ConfigKey {
16
+    public static String username;
17
+    public static String password;
18
+    public static String url;
19
+    public static String signName;
20
+
21
+    @Value("${zt.username}")
22
+    public void setUsername(String username) {
23
+        ConfigKey.username = username;
24
+    }
25
+
26
+    @Value("${zt.password}")
27
+    public void setPassword(String password) {
28
+        ConfigKey.password = password;
29
+    }
30
+
31
+    @Value("${zt.url}")
32
+    public void setUrl(String url) {
33
+        ConfigKey.url = url;
34
+    }
35
+
36
+    @Value("${signName}")
37
+    private void setSignName(String signName) throws UnsupportedEncodingException {
38
+        //Spring Boot注解读取application.properties或者application-{profile}.properties文件时默认的是ISO_8859_1编码,中文会乱码
39
+        ConfigKey.signName = new String(signName.getBytes("ISO_8859_1"),"UTF-8");;
40
+    }
41
+
42
+    public static Integer redisdatatime;//缓存访问数据有效时长
43
+    public static String secretKey;//secretKey必须为24位
44
+
45
+    @Value("${redisdatatime}")
46
+    public void setRedisdatatime(Integer redisdatatime) {
47
+        ConfigKey.redisdatatime = redisdatatime;
48
+    }
49
+
50
+    @Value("${secretKey}")
51
+    public void setSecretKey(String secretKey) {
52
+        ConfigKey.secretKey = secretKey;
53
+    }
54
+}

+ 34
- 0
suser/src/main/java/com/xhkjedu/suser/config/CorsConfig.java View File

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

+ 67
- 0
suser/src/main/java/com/xhkjedu/suser/config/ErrorAdivceController.java View File

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

+ 72
- 0
suser/src/main/java/com/xhkjedu/suser/controller/gradeclass/ClassController.java View File

@@ -0,0 +1,72 @@
1
+package com.xhkjedu.suser.controller.gradeclass;
2
+
3
+import com.xhkjedu.suser.model.gradeclass.TClass;
4
+import com.xhkjedu.suser.service.gradeclass.ClassService;
5
+import com.xhkjedu.utils.N_Utils;
6
+import com.xhkjedu.vo.ResultVo;
7
+import com.xhkjedu.suser.vo.gradeclass.ClassVo;
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 TClassController
19
+ * @description
20
+ * @date 2020/6/2 14:53
21
+ **/
22
+@RestController
23
+@RequestMapping("/class")
24
+public class ClassController {
25
+    @Resource
26
+    private ClassService classService;
27
+
28
+    @PostMapping("/add")
29
+    public ResultVo add(@RequestBody TClass tClass) {
30
+        N_Utils.validation(new Object[]{tClass.getGradeid(), "年级id", 1});
31
+        TClass c = classService.getByName(tClass);
32
+        if (c != null) {
33
+            return new ResultVo(1, "班级名称不能重复");
34
+        }
35
+        Integer id = classService.save(tClass);
36
+        return new ResultVo(0, "保存成功", id);
37
+    }
38
+
39
+    @PostMapping("/delete")
40
+    public ResultVo delete(@RequestBody TClass tClass) {
41
+        N_Utils.validation(new Object[]{tClass.getClassid(), "班级id", 1});
42
+        return classService.deleteById(tClass.getClassid());
43
+    }
44
+
45
+    @PostMapping("/update")
46
+    public ResultVo update(@RequestBody TClass tClass) {
47
+        N_Utils.validation(new Object[]{tClass.getClassid(), "班级id", 1});
48
+        TClass c = classService.getByName(tClass);
49
+        if (c != null && !c.getClassname().equals(tClass.getClassname())) {
50
+            return new ResultVo(1, "班级名称不能重复");
51
+        }
52
+        classService.update(tClass);
53
+        return new ResultVo(0, "修改成功");
54
+    }
55
+
56
+    @PostMapping("/list")
57
+    public ResultVo list(@RequestBody TClass tClass) {
58
+        Integer schoolid = tClass.getSchoolid();
59
+        Integer year = tClass.getYear();
60
+        N_Utils.validation(new Object[]{schoolid, "学校id", 1, year, "当前年份", 1});
61
+        List<ClassVo> list = classService.findAll(tClass);
62
+        return new ResultVo(0, "获取列表成功", list);
63
+    }
64
+
65
+    @PostMapping("/list_teacher")
66
+    public ResultVo listTeacher(@RequestBody TClass tClass) {
67
+        Integer classid = tClass.getClassid();
68
+        N_Utils.validation(new Object[]{classid, "班级id", 1});
69
+        List<String> list = classService.listTeacher(classid);
70
+        return new ResultVo(0, "获取任教老师列表成功", list);
71
+    }
72
+}

+ 193
- 0
suser/src/main/java/com/xhkjedu/suser/controller/gradeclass/ClassStudentController.java View File

@@ -0,0 +1,193 @@
1
+package com.xhkjedu.suser.controller.gradeclass;
2
+
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.vo.PageResult;
6
+import com.xhkjedu.suser.model.gradeclass.TClassStudent;
7
+import com.xhkjedu.suser.service.gradeclass.ClassStudentService;
8
+import com.xhkjedu.utils.N_Utils;
9
+import com.xhkjedu.utils.PageUtil;
10
+import com.xhkjedu.vo.ResultVo;
11
+import com.xhkjedu.suser.vo.gradeclass.ClassImportVo;
12
+import com.xhkjedu.suser.vo.gradeclass.ClassStudentVo;
13
+import com.xhkjedu.suser.vo.gradeclass.ClassVo;
14
+import org.springframework.web.bind.annotation.PostMapping;
15
+import org.springframework.web.bind.annotation.RequestBody;
16
+import org.springframework.web.bind.annotation.RequestMapping;
17
+import org.springframework.web.bind.annotation.RestController;
18
+import org.springframework.web.multipart.MultipartFile;
19
+
20
+import javax.annotation.Resource;
21
+import java.util.List;
22
+
23
+/**
24
+ * @author ywx
25
+ * @classname TClassStudentController
26
+ * @description 
27
+ * @date 2020/6/2 15:53
28
+ **/
29
+@RestController
30
+@RequestMapping("/class_student")
31
+public class ClassStudentController {
32
+    @Resource
33
+    private ClassStudentService classStudentService;
34
+
35
+    @PostMapping("/batch_add")
36
+    public ResultVo batchAdd(@RequestBody List<TClassStudent> students) {
37
+        try {
38
+            classStudentService.batchAdd(students);
39
+            return new ResultVo(0, "保存成功");
40
+        } catch (Exception e) {
41
+            return new ResultVo(1,e.getMessage());
42
+        }
43
+    }
44
+
45
+    //班级学生批量添加-取消的删除
46
+    @PostMapping("/batch_add2")
47
+    public ResultVo batchAdd2(@RequestBody ClassImportVo vo) {
48
+        try {
49
+            Integer classid = vo.getClassid();
50
+            List<Integer> studentIds = vo.getStudentIds();
51
+            classStudentService.batchAdd2(classid, studentIds);
52
+            return new ResultVo(0, "保存成功");
53
+        } catch (Exception e) {
54
+            return new ResultVo(1,e.getMessage());
55
+        }
56
+    }
57
+
58
+    @PostMapping("/add")
59
+    public ResultVo add(@RequestBody TClassStudent tClassStudent) {
60
+        Integer classid = tClassStudent.getClassid();
61
+        N_Utils.validation(new Object[]{classid,"班级id",1});
62
+        try {
63
+            Integer id = classStudentService.save(tClassStudent);
64
+            return new ResultVo(0, "保存成功",id);
65
+        } catch (Exception e) {
66
+            return new ResultVo(1,e.getMessage());
67
+        }
68
+    }
69
+
70
+    @PostMapping("/delete")
71
+    public ResultVo delete(@RequestBody TClassStudent tClassStudent) {
72
+        Integer classid = tClassStudent.getClassid();
73
+        Integer studentid = tClassStudent.getStudentid();
74
+        N_Utils.validation(new Object[]{studentid,"学生id",1,classid,"班级id",1});
75
+        classStudentService.deleteById(classid, studentid);
76
+        return new ResultVo(0,"移除成功");
77
+    }
78
+
79
+    @PostMapping("/update")
80
+    public ResultVo update(@RequestBody TClassStudent tClassStudent) {
81
+        N_Utils.validation(new Object[]{tClassStudent.getStudentid(),"学生id",1,tClassStudent.getStudentno(),"学号",2});
82
+        return classStudentService.update(tClassStudent);
83
+    }
84
+
85
+    @PostMapping("/list")
86
+    public ResultVo list(@RequestBody TClassStudent tClassStudent) {
87
+        Integer classid = tClassStudent.getClassid();
88
+        N_Utils.validation(new Object[]{classid, "班级id", 1});
89
+        Integer page = tClassStudent.getPage();
90
+        if (N_Utils.isEmptyInteger(page)) {
91
+            List<ClassStudentVo> list = classStudentService.findAll(tClassStudent);
92
+            return new ResultVo(0,"获取列表成功",list);
93
+        } else {
94
+            Integer pageSize = tClassStudent.getPageSize();
95
+            N_Utils.validation(new Object[]{pageSize, "显示条数", 1});
96
+            PageHelper.startPage(page, pageSize);
97
+            List<ClassStudentVo> list = classStudentService.findAll(tClassStudent);
98
+            PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
99
+            return new ResultVo(0, "获取列表成功", pageResult);
100
+        }
101
+    }
102
+
103
+    @PostMapping("/import_user")
104
+    public ResultVo importUser(MultipartFile file,TClassStudent tClassStudent) {
105
+        return classStudentService.importUser(file, tClassStudent);
106
+    }
107
+
108
+    //提高班学生导入
109
+    @PostMapping("/import_user2")
110
+    public ResultVo importUser2(MultipartFile file,TClassStudent tClassStudent) {
111
+        return classStudentService.importUser2(file, tClassStudent);
112
+    }
113
+
114
+    @PostMapping("/move_class")
115
+    public ResultVo moveClass(@RequestBody TClassStudent tClassStudent) {
116
+        Integer oldclassid = tClassStudent.getOldclassid();
117
+        Integer classid = tClassStudent.getClassid();
118
+        Integer studentid = tClassStudent.getStudentid();
119
+        N_Utils.validation(new Object[]{oldclassid,"原班级id",1,classid,"新班级id",1,studentid,"学生id",1});
120
+        try {
121
+            classStudentService.moveClass(oldclassid, classid, studentid);
122
+            return new ResultVo(0,"转班成功");
123
+        } catch (Exception e) {
124
+            return new ResultVo(1,e.getMessage());
125
+        }
126
+    }
127
+
128
+    @PostMapping("/remove_bind")
129
+    public ResultVo moveBind(@RequestBody TClassStudent tClassStudent) {
130
+        Integer studentid = tClassStudent.getStudentid();
131
+        N_Utils.validation(new Object[]{studentid,"学生id",1});
132
+        classStudentService.removeBind(studentid);
133
+        return new ResultVo(0,"解除mac绑定成功");
134
+    }
135
+
136
+    /**
137
+     *功能描述 获取学生所在班级
138
+     * @author WN
139
+     * @date 2020/10/20
140
+     * @param  * @param cs
141
+     * @return com.xhkjedu.vo.ResultVo
142
+     */
143
+    @PostMapping("/stu_class")
144
+    public ResultVo stuClass(@RequestBody ClassStudentVo cs) {
145
+        Integer studentid = cs.getStudentid();
146
+        N_Utils.validation(new Object[]{studentid,"学生id",1});
147
+        List<ClassVo> classlst = classStudentService.listClassByStudentId(studentid);
148
+        return new ResultVo(0,"获取学生所在班级成功",classlst);
149
+    }
150
+
151
+    @PostMapping("/list_no_class_stu")
152
+    public ResultVo listNoClassStu(@RequestBody TClassStudent student) {
153
+        Integer page = student.getPage();
154
+        Integer pageSize = student.getPageSize();
155
+        Integer schoolid = student.getSchoolid();
156
+        N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1,schoolid,"学校id",1});
157
+        PageHelper.startPage(page, pageSize);
158
+        List<ClassStudentVo> list = classStudentService.listNoClassStu(student);
159
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
160
+        return new ResultVo(0,"获取没有班级学生列表成功",pageResult);
161
+    }
162
+
163
+    @PostMapping("/list_grade")
164
+    public ResultVo listGrade(@RequestBody ClassStudentVo student) {
165
+        Integer studentid = student.getStudentid();
166
+        N_Utils.validation(new Object[]{studentid,"学生id",1});
167
+        List<Integer> list = classStudentService.listGrade(studentid);
168
+        return new ResultVo(0,"获取学生所在年级列表成功",list);
169
+    }
170
+
171
+    //获取全校学生列表
172
+    @PostMapping("/all")
173
+    public ResultVo listAllSchool(@RequestBody TClassStudent student) {
174
+        Integer page = student.getPage();
175
+        Integer pageSize = student.getPageSize();
176
+        Integer schoolid = student.getSchoolid();
177
+        Integer classtype = student.getClasstype();
178
+        N_Utils.validation(new Object[]{page, "显示页码", 1, pageSize, "显示条数", 1, schoolid, "学校id", 1, classtype, "班级类型", 1});
179
+        classStudentService.setYear(student);
180
+        PageHelper.startPage(page, pageSize);
181
+        List<ClassStudentVo> list = classStudentService.listAllStudents(student);
182
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
183
+        return new ResultVo(0, "获取全校学生列表成功", pageResult);
184
+    }
185
+
186
+    @PostMapping("/del_tgStu")
187
+    public ResultVo delTgStu(@RequestBody ClassStudentVo student) {
188
+        String loginname = student.getLoginname();
189
+        N_Utils.validation(new Object[]{loginname, "学生ids", 2});
190
+        classStudentService.delTgStu(loginname);
191
+        return new ResultVo(0, "删除学生所有提高班和所在提高班直播课成功");
192
+    }
193
+}

+ 128
- 0
suser/src/main/java/com/xhkjedu/suser/controller/gradeclass/ClassTeacherController.java View File

@@ -0,0 +1,128 @@
1
+package com.xhkjedu.suser.controller.gradeclass;
2
+
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.vo.PageResult;
6
+import com.xhkjedu.suser.model.gradeclass.TClass;
7
+import com.xhkjedu.suser.model.gradeclass.TClassTeacher;
8
+import com.xhkjedu.suser.service.gradeclass.ClassTeacherService;
9
+import com.xhkjedu.utils.N_Utils;
10
+import com.xhkjedu.utils.PageUtil;
11
+import com.xhkjedu.vo.ResultVo;
12
+import com.xhkjedu.suser.vo.gradeclass.ClassTeacherParams;
13
+import com.xhkjedu.suser.vo.gradeclass.ClassTeacherVo;
14
+import com.xhkjedu.suser.vo.gradeclass.ClassVo;
15
+import org.springframework.web.bind.annotation.PostMapping;
16
+import org.springframework.web.bind.annotation.RequestBody;
17
+import org.springframework.web.bind.annotation.RequestMapping;
18
+import org.springframework.web.bind.annotation.RestController;
19
+
20
+import javax.annotation.Resource;
21
+import java.util.List;
22
+import java.util.Map;
23
+
24
+/**
25
+ * @author ywx
26
+ * @classname TClassTeacherController
27
+ * @description 
28
+ * @date 2020/6/2 16:27
29
+ **/
30
+@RestController
31
+@RequestMapping("/class_teacher")
32
+public class ClassTeacherController {
33
+    @Resource
34
+    private ClassTeacherService classTeacherService;
35
+
36
+    @PostMapping("/add")
37
+    public ResultVo add(@RequestBody TClassTeacher tClassTeacher) {
38
+        Integer id = classTeacherService.save(tClassTeacher);
39
+        return new ResultVo(0, "保存成功",id);
40
+    }
41
+
42
+    @PostMapping("/update")
43
+    public ResultVo update(@RequestBody TClassTeacher tClassTeacher) {
44
+        N_Utils.validation(new Object[]{tClassTeacher.getTeacherid(),"教师id",1});
45
+        classTeacherService.update(tClassTeacher);
46
+        return new ResultVo(0,"修改成功");
47
+    }
48
+
49
+    @PostMapping("/detail")
50
+    public ResultVo detail(@RequestBody TClassTeacher tClassTeacher) {
51
+        N_Utils.validation(new Object[]{tClassTeacher.getCtid(),"班级教师id",1});
52
+        TClassTeacher classTeacher = classTeacherService.findById(tClassTeacher.getCtid());
53
+        return new ResultVo(0,"获取详情成功",classTeacher);
54
+    }
55
+
56
+    @PostMapping("/list")
57
+    public ResultVo list(@RequestBody TClassTeacher tClassTeacher) {
58
+        Integer schoolid = tClassTeacher.getSchoolid();
59
+        N_Utils.validation(new Object[]{tClassTeacher.getPage(),"显示页码",1,
60
+                tClassTeacher.getPageSize(),"显示条数",1,schoolid,"学校id",1});
61
+        Integer year = classTeacherService.getYear(schoolid);
62
+        PageHelper.startPage(tClassTeacher.getPage(),tClassTeacher.getPageSize());
63
+        List<ClassTeacherVo> list = classTeacherService.findAll(tClassTeacher, year);
64
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
65
+        return new ResultVo(0,"获取列表成功",pageResult);
66
+    }
67
+
68
+    /**
69
+     *功能描述  获取教师当前年份任教班级
70
+     * @author WN
71
+     * @date 2020/6/13
72
+     * @param  * @param cl
73
+     */
74
+    @PostMapping("/tclist")
75
+    public ResultVo teacherClass(@RequestBody TClass cl) {
76
+        N_Utils.validation(new Object[]{cl.getCreateid(),"教师id",1});
77
+        List<ClassVo> list = classTeacherService.listTeacherClass(cl.getCreateid(),cl.getClasstype());
78
+        return new ResultVo(0,"获取教师任教班级",list);
79
+    }
80
+
81
+    @PostMapping("/tclist2")
82
+    public ResultVo teacherClass2(@RequestBody TClass cl) {
83
+        N_Utils.validation(new Object[]{cl.getCreateid(),"教师id",1});
84
+        List<ClassVo> list = classTeacherService.listTeacherClass2(cl.getCreateid());
85
+        return new ResultVo(0,"获取教师任教班级",list);
86
+    }
87
+
88
+    @PostMapping("/paper_student_list")
89
+    public ResultVo listPaperStudent(@RequestBody Map paper) {
90
+        Integer paperid = (Integer) paper.get("paperid");
91
+        N_Utils.validation(new Object[]{paperid,"作业id",1});
92
+        List<ClassVo> list = classTeacherService.listPaperStudent(paperid);
93
+        return new ResultVo(0,"获取作业学生列表成功",list);
94
+    }
95
+
96
+    @PostMapping("/paper_teacher_list")
97
+    public ResultVo listPaperTeacher(@RequestBody Map paper) {
98
+        Integer paperid = (Integer) paper.get("paperid");
99
+        String subjectid = paper.get("subjectid").toString();
100
+        N_Utils.validation(new Object[]{paperid,"作业id",1,subjectid,"科目id",2});
101
+        List<Map> list = classTeacherService.listPaperTeacher(paperid, subjectid);
102
+        return new ResultVo(0,"获取作业教师列表成功",list);
103
+    }
104
+
105
+    //获取当前年份年级下教师
106
+    @PostMapping("/listteachers")
107
+    public ResultVo listTeachers(@RequestBody TClass cl){
108
+        N_Utils.validation(new Object[]{cl.getSchoolid(),"学校id",1,cl.getGradeid(),"年级",1});
109
+        List<ClassTeacherVo> list = classTeacherService.listTeachersByGradeid(cl.getSchoolid(),cl.getGradeid());
110
+        return new ResultVo(0,"获取教师任教班级",list);
111
+    }
112
+
113
+    /**
114
+     *功能描述  获取年级科目下老师
115
+     * @author WN
116
+     * @date 2021/1/29
117
+     * @param  * @param
118
+     * @return com.xhkjedu.vo.ResultVo
119
+     */
120
+    @PostMapping("/tsc")
121
+    public ResultVo listTeachersBySubjectClass(@RequestBody ClassTeacherParams ctp){
122
+
123
+        N_Utils.validation(new Object[]{ctp.getSchoolid(),"学校id",1,
124
+                ctp.getGradeid(),"年级",1,ctp.getSubjectid(),"科目",1});
125
+        List<ClassTeacherVo> lst = classTeacherService.listTeahcersBySubjectGrade(ctp);
126
+        return  new ResultVo(0,"获取年级科目下教师",lst);
127
+    }
128
+}

+ 87
- 0
suser/src/main/java/com/xhkjedu/suser/controller/gradeclass/GradeController.java View File

@@ -0,0 +1,87 @@
1
+package com.xhkjedu.suser.controller.gradeclass;
2
+
3
+import com.xhkjedu.suser.model.gradeclass.TGrade;
4
+import com.xhkjedu.suser.service.gradeclass.GradeService;
5
+import com.xhkjedu.utils.N_Utils;
6
+import com.xhkjedu.vo.ResultVo;
7
+import com.xhkjedu.suser.vo.gradeclass.GradeVo;
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 TGradeController
19
+ * @description
20
+ * @date 2020/6/2 14:47
21
+ **/
22
+@RestController
23
+@RequestMapping("/grade")
24
+public class GradeController {
25
+    @Resource
26
+    private GradeService gradeService;
27
+
28
+    @PostMapping("/add")
29
+    public ResultVo add(@RequestBody TGrade tGrade) {
30
+        Integer id = gradeService.save(tGrade);
31
+        return new ResultVo(0, "保存成功",id);
32
+    }
33
+
34
+    @PostMapping("/delete")
35
+    public ResultVo delete(@RequestBody TGrade tGrade) {
36
+        N_Utils.validation(new Object[]{tGrade.getGradeid(),"年级id",1});
37
+        gradeService.deleteById(tGrade.getGradeid());
38
+        return new ResultVo(0,"删除成功");
39
+    }
40
+
41
+    @PostMapping("/update")
42
+    public ResultVo update(@RequestBody TGrade tGrade) {
43
+        N_Utils.validation(new Object[]{tGrade.getGradeid(),"年级id",1});
44
+        gradeService.update(tGrade);
45
+        return new ResultVo(0,"修改成功");
46
+    }
47
+
48
+    @PostMapping("/detail")
49
+    public ResultVo detail(@RequestBody TGrade tGrade) {
50
+        N_Utils.validation(new Object[]{tGrade.getGradeid(),"年级id",1});
51
+        TGrade grade = gradeService.findById(tGrade.getGradeid());
52
+        return new ResultVo(0,"获取详情成功",grade);
53
+    }
54
+
55
+    @PostMapping("/list")
56
+    public ResultVo list(@RequestBody TGrade tGrade) {
57
+        Integer schoolid = tGrade.getSchoolid();
58
+        N_Utils.validation(new Object[]{schoolid,"学校id",1});
59
+        List<TGrade> list = gradeService.findAll(schoolid);
60
+        return new ResultVo(0,"获取列表成功",list);
61
+    }
62
+
63
+    @PostMapping("/list_class")
64
+    public ResultVo listClass(@RequestBody TGrade tGrade) {
65
+        Integer schoolid = tGrade.getSchoolid();
66
+        N_Utils.validation(new Object[]{schoolid,"学校id",1});
67
+        List<GradeVo> list = gradeService.listClass(schoolid,tGrade.getClasstype());
68
+        return new ResultVo(0,"获取通知班级列表成功",list);
69
+    }
70
+
71
+    //教师设置班级权限
72
+    @PostMapping("/lct")
73
+    public ResultVo listClassForTeacher(@RequestBody TGrade tGrade) {
74
+        Integer schoolid = tGrade.getSchoolid();
75
+        N_Utils.validation(new Object[]{schoolid,"学校id",1});
76
+        List<GradeVo> list = gradeService.listClassForTeacher(schoolid);
77
+        return new ResultVo(0,"获取通知班级列表成功",list);
78
+    }
79
+
80
+    @PostMapping("/list_teacher")
81
+    public ResultVo listTeacher(@RequestBody TGrade tGrade) {
82
+        Integer schoolid = tGrade.getSchoolid();
83
+        N_Utils.validation(new Object[]{schoolid,"学校id",1});
84
+        List<GradeVo> list = gradeService.listTeacher(schoolid);
85
+        return new ResultVo(0,"获取通知教师列表成功",list);
86
+    }
87
+}

+ 68
- 0
suser/src/main/java/com/xhkjedu/suser/controller/gradeclass/GroupController.java View File

@@ -0,0 +1,68 @@
1
+package com.xhkjedu.suser.controller.gradeclass;
2
+
3
+import com.xhkjedu.suser.model.gradeclass.TGroup;
4
+import com.xhkjedu.suser.service.gradeclass.GroupService;
5
+import com.xhkjedu.utils.N_Utils;
6
+import com.xhkjedu.vo.ResultVo;
7
+import com.xhkjedu.suser.vo.gradeclass.ClassGroupVo;
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 TGroupController
19
+ * @description
20
+ * @date 2020/6/2 14:58
21
+ **/
22
+@RestController
23
+@RequestMapping("/group")
24
+public class GroupController {
25
+    @Resource
26
+    private GroupService groupService;
27
+
28
+    @PostMapping("/add")
29
+    public ResultVo add(@RequestBody TGroup tGroup) {
30
+        if (N_Utils.isListEmpty(tGroup.getStudents())){
31
+            return new ResultVo(1,"分组学生不能为空");
32
+        }
33
+        Integer id = groupService.save(tGroup);
34
+        return new ResultVo(0, "保存成功",id);
35
+    }
36
+
37
+    @PostMapping("/delete")
38
+    public ResultVo delete(@RequestBody TGroup tGroup) {
39
+        Integer grouptype = tGroup.getGrouptype();
40
+        N_Utils.validation(new Object[]{tGroup.getGroupid(),"班级分组id",1,grouptype,"班级分组类型",1});
41
+        if (grouptype == 1){
42
+            return new ResultVo(1,"全体分组禁止删除");
43
+        }
44
+        groupService.deleteById(tGroup.getGroupid());
45
+        return new ResultVo(0,"删除成功");
46
+    }
47
+
48
+    @PostMapping("/update")
49
+    public ResultVo update(@RequestBody TGroup tGroup) {
50
+        N_Utils.validation(new Object[]{tGroup.getGroupid(),"班级分组id",1});
51
+        groupService.update(tGroup);
52
+        return new ResultVo(0,"修改成功");
53
+    }
54
+
55
+    @PostMapping("/list")
56
+    public ResultVo list(@RequestBody TGroup tGroup) {
57
+        N_Utils.validation(new Object[]{tGroup.getClassid(),"班级id",1});
58
+        List<TGroup> list = groupService.findAll(tGroup.getClassid(), tGroup.getCreateid());
59
+        return new ResultVo(0,"获取列表成功",list);
60
+    }
61
+
62
+    @PostMapping("/teacher_list")
63
+    public ResultVo teacherList(@RequestBody TGroup tGroup) {
64
+        N_Utils.validation(new Object[]{tGroup.getCreateid(),"教师id",1});
65
+        List<ClassGroupVo> list = groupService.teacherList(tGroup.getCreateid());
66
+        return new ResultVo(0,"获取列表成功",list);
67
+    }
68
+}

+ 49
- 0
suser/src/main/java/com/xhkjedu/suser/controller/gradeclass/GroupStudentController.java View File

@@ -0,0 +1,49 @@
1
+package com.xhkjedu.suser.controller.gradeclass;
2
+
3
+import com.xhkjedu.suser.model.gradeclass.TGroup;
4
+import com.xhkjedu.suser.model.gradeclass.TGroupStudent;
5
+import com.xhkjedu.suser.service.gradeclass.GroupStudentService;
6
+import com.xhkjedu.utils.N_Utils;
7
+import com.xhkjedu.vo.ResultVo;
8
+import com.xhkjedu.suser.vo.gradeclass.GroupStudentVo;
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 javax.annotation.Resource;
15
+import java.util.List;
16
+
17
+/**
18
+ * @author ywx
19
+ * @classname TGroupStudentController
20
+ * @description 
21
+ * @date 2020/6/2 16:49
22
+ **/
23
+@RestController
24
+@RequestMapping("/group_student")
25
+public class GroupStudentController {
26
+    @Resource
27
+    private GroupStudentService groupStudentService;
28
+
29
+    @PostMapping("/add")
30
+    public ResultVo add(@RequestBody TGroup group) {
31
+        groupStudentService.batchSave(group);
32
+        return new ResultVo(0, "保存成功");
33
+    }
34
+
35
+    @PostMapping("/delete")
36
+    public ResultVo delete(@RequestBody TGroupStudent group) {
37
+        N_Utils.validation(new Object[]{group.getGroupid(),"分组id",1});
38
+        groupStudentService.deleteById(group);
39
+        return new ResultVo(0,"删除成功");
40
+    }
41
+
42
+    @PostMapping("/list")
43
+    public ResultVo list(@RequestBody TGroupStudent tGroupStudent) {
44
+        Integer groupid = tGroupStudent.getGroupid();
45
+        N_Utils.validation(new Object[]{groupid,"分组id",1});
46
+        List<GroupStudentVo> list = groupStudentService.findAll(groupid);
47
+        return new ResultVo(0,"获取列表成功",list);
48
+    }
49
+}

+ 136
- 0
suser/src/main/java/com/xhkjedu/suser/controller/system/RoleController.java View File

@@ -0,0 +1,136 @@
1
+package com.xhkjedu.suser.controller.system;
2
+
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.suser.model.system.TRole;
6
+import com.xhkjedu.suser.model.system.TUserRole;
7
+import com.xhkjedu.suser.service.system.RoleService;
8
+import com.xhkjedu.suser.vo.system.RoleModuleVo;
9
+import com.xhkjedu.suser.vo.system.RoleVo;
10
+import com.xhkjedu.utils.N_Utils;
11
+import com.xhkjedu.utils.PageUtil;
12
+import com.xhkjedu.vo.PageResult;
13
+import com.xhkjedu.vo.ResultVo;
14
+import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.web.bind.annotation.PostMapping;
16
+import org.springframework.web.bind.annotation.RequestBody;
17
+import org.springframework.web.bind.annotation.RequestMapping;
18
+import org.springframework.web.bind.annotation.RestController;
19
+
20
+import java.util.List;
21
+
22
+/**
23
+ * @ClassName RoleController
24
+ * Description TODO
25
+ * Author WN
26
+ * Date 2020/6/13 17:46
27
+ **/
28
+@RestController
29
+@RequestMapping("role")
30
+public class RoleController {
31
+    @Autowired
32
+    private RoleService roleService;
33
+
34
+    //列表
35
+    @PostMapping("/list")
36
+    public ResultVo list(@RequestBody TRole role){
37
+        N_Utils.validation(new Object[]{
38
+                role.getSchoolid(),"学校id",1,
39
+                role.getPage(),"显示页数",1,
40
+                role.getPageSize(),"显示条数",1
41
+        });
42
+        PageHelper.startPage(role.getPage(),role.getPageSize());
43
+        List<TRole> roles = roleService.listAllRoles(role.getSchoolid());
44
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(roles));
45
+        return new ResultVo(0,"获取角色分页列表成功",pageResult);
46
+    }
47
+
48
+    //保存
49
+    @PostMapping("/save")
50
+    public ResultVo save(@RequestBody TRole role){
51
+        N_Utils.validation(new Object[]{
52
+                role.getRolename(),"角色名称",2,
53
+                role.getSchoolid(),"学校id",1
54
+        });
55
+        try {
56
+            Integer result = roleService.save(role);
57
+            if(result>0){
58
+                return new ResultVo(0,"保存成功");
59
+            }else{
60
+                return new ResultVo(1,"保存失败");
61
+            }
62
+        } catch (Exception e) {
63
+            return new ResultVo(1,"保存失败");
64
+        }
65
+    }
66
+
67
+    //修改
68
+    @PostMapping("/up")
69
+    public ResultVo up(@RequestBody TRole role){
70
+        N_Utils.validation(new Object[]{
71
+                role.getRoleid(),"角色id",1,
72
+                role.getRolename(),"角色名称",2
73
+        });
74
+        try {
75
+            Integer result = roleService.update(role);
76
+            if(result>0){
77
+                return new ResultVo(0,"修改成功");
78
+            }else{
79
+                return new ResultVo(1,"修改失败");
80
+            }
81
+        } catch (Exception e) {
82
+            return new ResultVo(1,"修改失败");
83
+        }
84
+    }
85
+
86
+    //删除
87
+    @PostMapping("/del")
88
+    public ResultVo del(@RequestBody TRole role){
89
+        N_Utils.validation(new Object[]{
90
+                role.getRoleid(),"角色id",1
91
+        });
92
+        Integer result = roleService.del(role.getRoleid());
93
+        if(result>0){
94
+            return new ResultVo(0,"删除成功");
95
+        }else{
96
+            return new ResultVo(1,"删除失败");
97
+        }
98
+    }
99
+
100
+    //角色详情
101
+    @PostMapping("/detail")
102
+    public ResultVo detail(@RequestBody TRole role){
103
+        N_Utils.validation(new Object[]{
104
+                role.getRoleid(),"角色id",1
105
+        });
106
+        RoleVo roleVo = roleService.getRoleDetail(role.getRoleid());
107
+        return new ResultVo(0,"获取角色详情成功",roleVo);
108
+    }
109
+
110
+    //获取用户角色权限
111
+    @PostMapping("/rmlst")
112
+    public ResultVo roleModule(@RequestBody TUserRole userRole){
113
+        N_Utils.validation(new Object[]{
114
+                userRole.getUserid(),"用户id",1
115
+        });
116
+        List<RoleModuleVo> lst = roleService.listModulesByUserid(userRole.getUserid());
117
+        return new ResultVo(0,"获取用户权限成功",lst);
118
+    }
119
+
120
+    /**
121
+     *功能描述 获取所有角色列表
122
+     * @author WN
123
+     * @date 2020/6/17
124
+     * @param  * @param role
125
+     * @return com.xhkjedu.vo.ResultVo
126
+     */
127
+    @PostMapping("/listall")
128
+    public ResultVo listAll(@RequestBody TRole role){
129
+        N_Utils.validation(new Object[]{
130
+                role.getSchoolid(),"学校id",1
131
+        });
132
+        List<TRole> roles = roleService.listAllRoles(role.getSchoolid());
133
+        return new ResultVo(0,"获取所有角色列表成功",roles);
134
+    }
135
+
136
+}

+ 130
- 0
suser/src/main/java/com/xhkjedu/suser/controller/system/TeacherRoleController.java View File

@@ -0,0 +1,130 @@
1
+package com.xhkjedu.suser.controller.system;
2
+
3
+import com.xhkjedu.suser.service.system.TeacherRoleService;
4
+import com.xhkjedu.utils.N_Utils;
5
+import com.xhkjedu.vo.ResultVo;
6
+import com.xhkjedu.suser.vo.gradeclass.GradeVo;
7
+import com.xhkjedu.suser.vo.subjectbook.LsbBookVo;
8
+import com.xhkjedu.suser.vo.subjectbook.SubjectVo;
9
+import com.xhkjedu.suser.vo.system.TeacherRoleParam;
10
+import com.xhkjedu.suser.vo.system.TeacherRoleVo;
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
+ * @ClassName TeacherRoleController
21
+ * Description 教师设置权限
22
+ * Author WN
23
+ * Date 2020/6/18 9:43
24
+ **/
25
+@RestController
26
+@RequestMapping("/trole")
27
+public class TeacherRoleController {
28
+
29
+    @Autowired
30
+    private TeacherRoleService teacherRoleService;
31
+
32
+    /**
33
+     *功能描述  保存教师权限
34
+     * @author WN
35
+     * @date 2020/6/18
36
+     * @param  * @param trole
37
+     * @return com.xhkjedu.vo.ResultVo
38
+     */
39
+    @PostMapping("/save")
40
+    public ResultVo saveTeacherRole(@RequestBody TeacherRoleParam trole){
41
+        N_Utils.validation(new Object[]{
42
+                trole.getTeacherid(),"用户id",1
43
+        });
44
+        try {
45
+            teacherRoleService.save(trole);
46
+        } catch (Exception e) {
47
+            return new ResultVo(1,"保存失败");
48
+        }
49
+        return new ResultVo(0,"保存成功");
50
+    }
51
+
52
+    /**
53
+     *功能描述 修改时获取已有权限
54
+     * @author WN
55
+     * @date 2020/6/18
56
+     * @param  * @param trole
57
+     * @return com.xhkjedu.vo.ResultVo
58
+     */
59
+    @PostMapping("/toup")
60
+    public ResultVo toUpdate(@RequestBody TeacherRoleParam trole){
61
+        N_Utils.validation(new Object[]{
62
+                trole.getTeacherid(),"用户id",1
63
+        });
64
+        TeacherRoleVo trvo = teacherRoleService.getTeacherRoles(trole);
65
+        return new ResultVo(0,"获取教师权限成功",trvo);
66
+    }
67
+
68
+    /**
69
+     * 教师权限教材列表
70
+     * @Param [trole]
71
+     * @Author ywx
72
+     * @Date 2020/7/1 10:42
73
+     * @return com.xhkjedu.vo.ResultVo
74
+     **/
75
+    @PostMapping("/list_book")
76
+    public ResultVo listBook(@RequestBody TeacherRoleParam trole){
77
+        Integer teacherid = trole.getTeacherid();
78
+        N_Utils.validation(new Object[]{teacherid,"教师id",1});
79
+        TeacherRoleVo trvo = teacherRoleService.listBook(teacherid);
80
+        return new ResultVo(0,"获取教师权限教材列表成功",trvo);
81
+    }
82
+
83
+    /**
84
+     * 教师权限科目
85
+     * @Param [trole]
86
+     * @Author ywx
87
+     * @Date 2020/7/24 9:27
88
+     * @return com.xhkjedu.vo.ResultVo
89
+     **/
90
+    @PostMapping("/list_subject")
91
+    public ResultVo listSubject(@RequestBody TeacherRoleParam trole){
92
+        Integer teacherid = trole.getTeacherid();
93
+        N_Utils.validation(new Object[]{teacherid,"教师id",1});
94
+        List<SubjectVo> subject = teacherRoleService.listSubject(teacherid);
95
+        return new ResultVo(0,"获取教师权限科目列表成功",subject);
96
+    }
97
+
98
+    /**
99
+     *功能描述 教师权限科目下教材
100
+     * @author WN
101
+     * @date 2020/8/11
102
+     * @param  * @param trole
103
+     * @return com.xhkjedu.vo.ResultVo
104
+     */
105
+    @PostMapping("/list_sbook")
106
+    public ResultVo listSubjectBook(@RequestBody TeacherRoleParam trole){
107
+        Integer teacherid = trole.getTeacherid();
108
+        String subjectid = trole.getSubjectid();
109
+        N_Utils.validation(new Object[]{teacherid,"教师id",1,subjectid,"科目id",2});
110
+        List<LsbBookVo> subject = teacherRoleService.listBookBySubjectid(teacherid,subjectid);
111
+        return new ResultVo(0,"获取科目下权限教材列表成功",subject);
112
+    }
113
+
114
+    @PostMapping("/list_class")
115
+    public ResultVo listClass(@RequestBody TeacherRoleParam trole){
116
+        Integer teacherid = trole.getTeacherid();
117
+        N_Utils.validation(new Object[]{teacherid,"教师id",1});
118
+        List<GradeVo> list = teacherRoleService.listGradeClassesByUserid(trole);
119
+        return new ResultVo(0,"获取教师权限班级列表成功",list);
120
+    }
121
+
122
+    @PostMapping("/list_class2")
123
+    public ResultVo listClass2(@RequestBody TeacherRoleParam trole){
124
+        Integer teacherid = trole.getTeacherid();
125
+        N_Utils.validation(new Object[]{teacherid,"教师id",1});
126
+        List<GradeVo> list = teacherRoleService.listGradeClassesByUserid2(trole);
127
+        return new ResultVo(0,"获取教师权限班级列表成功",list);
128
+    }
129
+
130
+}

+ 378
- 0
suser/src/main/java/com/xhkjedu/suser/controller/system/UserController.java View File

@@ -0,0 +1,378 @@
1
+package com.xhkjedu.suser.controller.system;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.suser.model.system.TUser;
5
+import com.xhkjedu.suser.service.system.UserService;
6
+import com.xhkjedu.suser.utils.UserUtil;
7
+import com.xhkjedu.utils.N_Utils;
8
+import com.xhkjedu.vo.ResultVo;
9
+import com.xhkjedu.suser.vo.assess.AssessParams;
10
+import com.xhkjedu.suser.vo.system.TeacherVo;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.beans.factory.annotation.Value;
13
+import org.springframework.util.LinkedMultiValueMap;
14
+import org.springframework.util.MultiValueMap;
15
+import org.springframework.web.bind.annotation.PostMapping;
16
+import org.springframework.web.bind.annotation.RequestBody;
17
+import org.springframework.web.bind.annotation.RequestMapping;
18
+import org.springframework.web.bind.annotation.RestController;
19
+import org.springframework.web.multipart.MultipartFile;
20
+
21
+import javax.servlet.http.HttpServletRequest;
22
+import java.util.List;
23
+import java.util.Map;
24
+
25
+/**
26
+ * @ClassName UserController
27
+ * Description
28
+ * Author WN
29
+ * Date 2020/5/29 16:29
30
+ **/
31
+@RestController
32
+@RequestMapping("user")
33
+public class UserController {
34
+    @Autowired
35
+    private UserService userService;
36
+    @Value("${ssourl}")
37
+    private String ssourl;
38
+
39
+    /**
40
+     *功能描述 登录接口--非学生
41
+     * @author WN
42
+     * @date 2020/6/1
43
+     * @param  * @param user
44
+     * @return com.xhkjedu.vo.ResultVo
45
+     */
46
+    @PostMapping("/login")
47
+    public ResultVo login(@RequestBody TUser user,HttpServletRequest request){
48
+//        if (N_Utils.isEmpty(user.getUltype())) return new ResultVo(1,"请更新新版本");
49
+        N_Utils.validation(new Object[]{user.getLoginname(),"登录名",2,user.getLoginpwd(),"登录密码",2});
50
+        if (user.getLoginname().length() > 18) return new ResultVo(1, "账号长度超过18个字符");
51
+        Integer usertype = user.getUsertype();
52
+        if (usertype != null && usertype == 2) {//学生登录
53
+            return userService.loginStudent(user, request);
54
+        } else {//教师、管理员登录
55
+            return userService.getUserByLoginnameAndPwd(user,request);
56
+        }
57
+    }
58
+
59
+    //教师登录
60
+    @PostMapping("/login_teacher")
61
+    public ResultVo loginTeacher(@RequestBody TUser user,HttpServletRequest request){
62
+//        if (N_Utils.isEmpty(user.getUltype())) return new ResultVo(1,"请更新新版本");
63
+        N_Utils.validation(new Object[]{user.getLoginname(),"登录名",2,user.getLoginpwd(),"登录密码",2});
64
+        if (user.getLoginname().length() > 18) return new ResultVo(1, "账号长度超过18个字符");
65
+        return userService.loginTeacher(user,request);
66
+    }
67
+
68
+    /**
69
+     *功能描述  登录--学生登录
70
+     * @author WN
71
+     * @date 2020/6/1
72
+     * @param  * @param user
73
+     * @return com.xhkjedu.vo.ResultVo
74
+     */
75
+    @PostMapping("/loginstu")
76
+    public ResultVo loginStudent(@RequestBody TUser user,HttpServletRequest request){
77
+        N_Utils.validation(new Object[]{user.getLoginname(),"登录名",2,user.getLoginpwd(),"登录密码",2});
78
+        if (user.getLoginname().length() > 18) return new ResultVo(1, "账号长度超过18个字符");
79
+        return userService.loginStudent(user,request);
80
+    }
81
+
82
+    /**
83
+     * 添加用户信息
84
+     * @Param [user]
85
+     * @Author ywx
86
+     * @Date 2020/6/2 9:44
87
+     * @return com.xhkjedu.vo.ResultVo
88
+     **/
89
+    @PostMapping("/add")
90
+    public ResultVo add(@RequestBody TUser user){
91
+        return userService.save(user);
92
+    }
93
+
94
+    /**
95
+     * 修改用户信息
96
+     * @Param [user]
97
+     * @Author ywx
98
+     * @Date 2020/6/2 9:51
99
+     * @return com.xhkjedu.vo.ResultVo
100
+     **/
101
+    @PostMapping("/update")
102
+    public ResultVo update(@RequestBody TUser user){
103
+        N_Utils.validation(new Object[]{user.getUserid(),"用户id",1});
104
+        return userService.update(user);
105
+    }
106
+
107
+    /**
108
+     * 删除用户
109
+     * @Param [user]
110
+     * @Author ywx
111
+     * @Date 2020/6/2 9:59
112
+     * @return com.xhkjedu.vo.ResultVo
113
+     **/
114
+    @PostMapping("/delete")
115
+    public ResultVo delete(@RequestBody TUser user){
116
+        N_Utils.validation(new Object[]{user.getUserid(),"用户id",1,user.getDeleteid(),"删除人id",1});
117
+        return userService.deleteById(user);
118
+    }
119
+
120
+    /**
121
+     * 获取用户列表
122
+     * @Param [user]
123
+     * @Author ywx
124
+     * @Date 2020/6/2 10:06
125
+     * @return com.xhkjedu.vo.ResultVo
126
+     **/
127
+    @PostMapping("/list")
128
+    public ResultVo list(@RequestBody TUser user){
129
+        N_Utils.validation(new Object[]{user.getPage(),"显示页码",1,user.getPageSize(),"显示条数",1,user.getSchoolid(),"学校id",1});
130
+        return userService.findAll(user);
131
+    }
132
+
133
+    /**
134
+     * 获取用户详情
135
+     * @Param [user]
136
+     * @Author ywx
137
+     * @Date 2020/6/2 10:23
138
+     * @return com.xhkjedu.vo.ResultVo
139
+     **/
140
+    @PostMapping("/detail")
141
+    public ResultVo detail(@RequestBody TUser user){
142
+        Integer userid = user.getUserid();
143
+        N_Utils.validation(new Object[]{userid,"用户id",1});
144
+        return userService.findById(userid);
145
+    }
146
+
147
+    /**
148
+     * 修改用户密码
149
+     * @Param [user]
150
+     * @Author ywx
151
+     * @Date 2020/6/2 10:30
152
+     * @return com.xhkjedu.vo.ResultVo
153
+     **/
154
+    @PostMapping("/update_pwd")
155
+    public ResultVo updatePwd(@RequestBody TUser user){
156
+        N_Utils.validation(new Object[]{user.getUserid(),"用户id",1,user.getOldpwd(),"原密码",2,user.getLoginpwd(),"新密码",2});
157
+        return userService.updatePwd(user);
158
+    }
159
+
160
+    /**
161
+     * 修改用户头像
162
+     * @Param [user]
163
+     * @Author ywx
164
+     * @Date 2020/6/2 10:37
165
+     * @return com.xhkjedu.vo.ResultVo
166
+     **/
167
+    @PostMapping("/update_headpic")
168
+    public ResultVo updateHeadPic(@RequestBody TUser user){
169
+        N_Utils.validation(new Object[]{user.getUserid(),"用户id",1});
170
+        return userService.updateHeadPic(user);
171
+    }
172
+
173
+    /**
174
+     * 检查登录账号是否存在
175
+     * @Param [user]
176
+     * @Author ywx
177
+     * @Date 2020/6/2 10:43
178
+     * @return com.xhkjedu.vo.ResultVo
179
+     **/
180
+    @PostMapping("/check_loginname")
181
+    public ResultVo checkLoginName(@RequestBody TUser user){
182
+        String loginname = user.getLoginname();
183
+        N_Utils.validation(new Object[]{loginname,"登录名",2});
184
+        return userService.checkLoginName(loginname);
185
+    }
186
+
187
+    /**
188
+     * 导入教师
189
+     * @Param [file, user]
190
+     * @Author ywx
191
+     * @Date 2020/6/5 8:42
192
+     * @return com.xhkjedu.vo.ResultVo
193
+     **/
194
+    @PostMapping("/import_teacher")
195
+    public ResultVo importTeacher(MultipartFile file, TUser user) {
196
+        return userService.importTeacher(file, user);
197
+    }
198
+
199
+    /**
200
+     *功能描述  设置操作密码
201
+     * @author WN
202
+     * @date 2020/6/17
203
+     * @param  * @param user
204
+     * @return com.xhkjedu.vo.ResultVo
205
+     */
206
+    @PostMapping("/update_opepass")
207
+    public ResultVo updateOpepass(@RequestBody TUser user){
208
+        N_Utils.validation(new Object[]{
209
+                user.getUserid(),"用户id",1,
210
+                user.getOpepassword(),"操作密码",2
211
+        });
212
+        userService.updateOpepasswordByUserId(user);
213
+        return new ResultVo(0,"设置操作密码成功");
214
+    }
215
+
216
+    /**
217
+     *功能描述  验证操作密码是否正确
218
+     * @author WN
219
+     * @date 2020/6/17
220
+     * @param  * @param user
221
+     * @return com.xhkjedu.vo.ResultVo
222
+     */
223
+    @PostMapping("/validate_opepass")
224
+    public ResultVo validateOpepass(@RequestBody TUser user){
225
+        N_Utils.validation(new Object[]{
226
+                user.getUserid(),"用户id",1,
227
+                user.getOpepassword(),"操作密码",2
228
+        });
229
+        Integer result = userService.getUserIdByOpepassword(user);
230
+        if(result==1){
231
+            return new ResultVo(0,"操作密码验证成功");
232
+        }else{
233
+            return new ResultVo(1,"操作密码输入有误");
234
+        }
235
+
236
+    }
237
+
238
+    /**
239
+     * 教师基本信息
240
+     * @Param [user]
241
+     * @Author ywx
242
+     * @Date 2020/6/29 16:23
243
+     * @return com.xhkjedu.vo.ResultVo
244
+     **/
245
+    @PostMapping("/teacher_info")
246
+    public ResultVo teacherInfo(@RequestBody TUser user){
247
+        Integer userid = user.getUserid();
248
+        N_Utils.validation(new Object[]{userid,"用户id",1});
249
+        TeacherVo teacherVo = userService.getTeacherInfo(userid, user.getClasstype());
250
+        return new ResultVo(0,"获取教师基本信息成功",teacherVo);
251
+    }
252
+
253
+    /**
254
+     * 重置密码
255
+     * @Param [user]
256
+     * @Author ywx
257
+     * @Date 2020/7/30 14:25
258
+     * @return com.xhkjedu.vo.ResultVo
259
+     **/
260
+    @PostMapping("/reset_pwd")
261
+    public ResultVo resetPwd(@RequestBody TUser user){
262
+        N_Utils.validation(new Object[]{user.getUserid(),"用户id",1,user.getLoginpwd(),"密码",2});
263
+        return userService.resetPwd(user);
264
+    }
265
+
266
+    /**
267
+     * 生成修改码
268
+     * @Param [user]
269
+     * @Author ywx
270
+     * @Date 2020/10/13 15:08
271
+     * @return com.xhkjedu.vo.ResultVo
272
+     **/
273
+    @PostMapping("/update_code")
274
+    public ResultVo updateCode(@RequestBody TUser user) {
275
+        String userphone = user.getUserphone();
276
+        N_Utils.validation(new Object[]{userphone,"手机号",2});
277
+        return userService.updateCode(userphone);
278
+    }
279
+
280
+    /**
281
+     * 通过短信修改密码
282
+     * @Param [user]
283
+     * @Author ywx
284
+     * @Date 2020/10/13 15:12
285
+     * @return com.xhkjedu.vo.ResultVo
286
+     **/
287
+    @PostMapping("/update_pwd_byCode")
288
+    public ResultVo updatePwdByCode(@RequestBody TUser user) {
289
+        String userphone = user.getUserphone();
290
+        String loginpwd = user.getLoginpwd();
291
+        Integer msgcode = user.getMsgcode();
292
+        N_Utils.validation(new Object[]{userphone,"手机号",2,loginpwd,"密码",2,msgcode,"验证码",1});
293
+        return userService.updatePwdByCode(user);
294
+    }
295
+
296
+    /**
297
+     * 生成登录确认码
298
+     * @Param [user]
299
+     * @Author ywx
300
+     * @Date 2020/10/13 15:18
301
+     * @return com.xhkjedu.vo.ResultVo
302
+     **/
303
+    @PostMapping("/login_code")
304
+    public ResultVo loginCode(@RequestBody TUser user) {
305
+        String userphone = user.getUserphone();
306
+        N_Utils.validation(new Object[]{userphone,"手机号",2});
307
+        return userService.loginCode(userphone);
308
+    }
309
+
310
+    /**
311
+     * 验证码登录
312
+     * @Param [user]
313
+     * @Author ywx
314
+     * @Date 2020/10/13 15:35
315
+     * @return com.xhkjedu.vo.ResultVo
316
+     **/
317
+    @PostMapping("/login_byCode")
318
+    public ResultVo loginByCode(@RequestBody TUser user,HttpServletRequest request) {
319
+        if (N_Utils.isEmpty(user.getUltype())) return new ResultVo(1,"请更新新版本");
320
+        String userphone = user.getUserphone();
321
+        Integer msgcode = user.getMsgcode();
322
+        N_Utils.validation(new Object[]{userphone,"手机号",2,msgcode,"验证码",1});
323
+        return userService.loginByCode(user, request);
324
+    }
325
+
326
+    /**
327
+     * 批量修改用户密码
328
+     * @Param [user]
329
+     * @Author ywx
330
+     * @Date 2020/10/30 16:04
331
+     * @return com.xhkjedu.vo.ResultVo
332
+     **/
333
+    @PostMapping("/batch_update_pwd")
334
+    public ResultVo batchUpdatePwd(@RequestBody TUser user){
335
+        N_Utils.validation(new Object[]{user.getSchoolid(),"学校id",1,user.getLoginpwd(),"新密码",2});
336
+        if (N_Utils.isListEmpty(user.getUsertypes())) return new ResultVo(1,"用户类型集合不能为空");
337
+        return userService.batchUpdatePwd(user);
338
+    }
339
+
340
+    //校验登录状态成功
341
+    @PostMapping("/check_login")
342
+    public ResultVo checkLogin(@RequestBody TUser user){
343
+        Integer userid = user.getUserid();
344
+        String loginpwd = user.getLoginpwd();
345
+        N_Utils.validation(new Object[]{userid,"用户id",1,loginpwd,"登录密码",2});
346
+        return userService.checkLogin(userid, loginpwd);
347
+    }
348
+
349
+    @PostMapping("/list_sel")
350
+    public ResultVo listForSel(@RequestBody AssessParams user) {
351
+        Integer schoolid = user.getSchoolid();
352
+        N_Utils.validation(new Object[]{schoolid, "学校id", 1, user.getGradeid(), "年级id", 1
353
+                , user.getClassid(), "班级id", 1, user.getSubjectid(), "科目id", 2});
354
+        List<Map> list = userService.listForSel(user);
355
+        return new ResultVo(0, "获取用户选择列表成功", list);
356
+    }
357
+
358
+    /**
359
+     * 用户名登录
360
+     * @Param [user, request]
361
+     * @Author ywx
362
+     * @Date 2021/11/18 9:52
363
+     * @return com.xhkjedu.vo.ResultVo
364
+     **/
365
+    @PostMapping("/login_byName")
366
+    public ResultVo loginByName(@RequestBody TUser user,HttpServletRequest request) {
367
+        String loginname = user.getLoginname();
368
+        N_Utils.validation(new Object[]{loginname,"token",2});
369
+        MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
370
+        param.add("token",loginname);
371
+        String str = UserUtil.sendFormData(ssourl, param);
372
+        ResultVo result = JSON.parseObject(str, ResultVo.class);
373
+        if (result.getCode() != 0) return result;
374
+        Map map = JSON.parseObject(result.getObj().toString(),Map.class);
375
+        user.setLoginname(map.get("loginname").toString());
376
+        return userService.loginByName(user, request);
377
+    }
378
+}

+ 108
- 0
suser/src/main/java/com/xhkjedu/suser/interceptors/DecryptRequestBodyAdvice.java View File

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

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

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

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

@@ -0,0 +1,66 @@
1
+package com.xhkjedu.suser.interceptors;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.suser.utils.JedisUtil;
5
+import com.xhkjedu.utils.N_Utils;
6
+import com.xhkjedu.vo.ResultVo;
7
+import lombok.extern.slf4j.Slf4j;
8
+import org.springframework.context.annotation.Configuration;
9
+import org.springframework.web.servlet.HandlerInterceptor;
10
+import org.springframework.web.servlet.ModelAndView;
11
+
12
+import javax.servlet.http.HttpServletRequest;
13
+import javax.servlet.http.HttpServletResponse;
14
+
15
+@Configuration
16
+@Slf4j
17
+public class RequestInterceptor extends JedisUtil implements HandlerInterceptor {
18
+    @Override
19
+    public void afterCompletion(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, Exception arg3)
20
+            throws Exception {
21
+        // 请求结束时间
22
+        Long endTime = System.currentTimeMillis();
23
+        // 从HttpServletRequest获取开始时间
24
+        Long startTime = (Long) arg0.getAttribute("_startTime");
25
+        double time = ((endTime - startTime) * 1.000) / 1000;
26
+        // 打印接口信息及耗时
27
+        if (time > 1) {
28
+            log.error(" {};耗时:{}s", arg0.getRequestURI(), time);
29
+        }
30
+    }
31
+
32
+    @Override
33
+    public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, ModelAndView arg3)
34
+            throws Exception {
35
+
36
+    }
37
+
38
+    /**
39
+     * 在调用controller具体方法前拦截
40
+     */
41
+    @Override
42
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
43
+//        log.info("请求的uri:" + request.getRequestURI());
44
+        response.setHeader("Access-Control-Allow-Origin", "*");
45
+        response.setContentType("application/json;charset=UTF-8");
46
+
47
+        // 记录请求开始时间
48
+        request.setAttribute("_startTime", System.currentTimeMillis());
49
+        String requestURI = request.getRequestURI();
50
+        String key = request.getHeader("Token-Key");
51
+        String token = request.getHeader("Token-Value");
52
+        if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
53
+                && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
54
+            String redis_token = get(key);//系统缓存中保存的token
55
+            if (!token.equals(redis_token)) {
56
+                ResultVo result = new ResultVo();
57
+                result.setCode(2);
58
+                result.setMsg("登录失效");
59
+
60
+                response.getWriter().print(JSON.toJSONString(result));
61
+                return false;
62
+            }
63
+        }
64
+        return true;
65
+    }
66
+}

+ 82
- 0
suser/src/main/java/com/xhkjedu/suser/interceptors/RequestWrapper.java View File

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

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

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

+ 54
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/ClassMapper.java View File

@@ -0,0 +1,54 @@
1
+package com.xhkjedu.suser.mapper.gradeclass;
2
+
3
+import com.xhkjedu.suser.base.TkMapper;
4
+import com.xhkjedu.suser.model.gradeclass.TClass;
5
+import com.xhkjedu.suser.vo.gradeclass.ClassVo;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+
10
+public interface ClassMapper extends TkMapper<TClass> {
11
+    //获取学校班级列表
12
+    List<ClassVo> findAll(@Param("tClass") TClass tClass);
13
+
14
+    //更新学生数量
15
+    void updateNum(@Param("classid") Integer classid);
16
+
17
+    //更新班级、分组学生数量
18
+    void updateNum2(@Param("classid") Integer classid);
19
+
20
+    //要升级的班级列表
21
+    List<TClass> listClassBySchoolId(@Param("schoolid") Integer schoolid,@Param("year") Integer year);
22
+    //升级时要毕业的班级列表
23
+    List<TClass> listClassBiyeBySchoolId(@Param("schoolid") Integer schoolid,@Param("year") Integer year,@Param("classstate") Integer classstate);
24
+
25
+    //要升级的班级id字符串
26
+    String listClassIdBySchoolId(@Param("schoolid") Integer schoolid,@Param("year") Integer year);
27
+
28
+    //基本信息
29
+    ClassVo getById(Integer classid);
30
+
31
+    //年级下班级id集合
32
+    List<Integer> listClassidsByGradeid(@Param("gradeid") Integer gradeid,@Param("schoolid") Integer schoolid);
33
+
34
+    //根据班级名称获取班级信息
35
+    TClass getByName(@Param("tClass") TClass tClass);
36
+
37
+    //获取任教老师列表
38
+    List<String> listTeacher(@Param("classid") Integer classid);
39
+
40
+    //修改班级状态
41
+    void updateClassState(@Param("classstate") Integer classstate, @Param("classids") String classids);
42
+
43
+    //修改单个班级状态
44
+    Integer updateClassstateByClassid(@Param("classid") Integer classid, @Param("classstate") Integer classstate);
45
+
46
+    //修改的那个班级类型
47
+    Integer updateClasstype(@Param("classid") Integer classid, @Param("classtype") Integer classtype);
48
+
49
+    //获取班级当前年份
50
+    Integer getYearById(Integer classid);
51
+
52
+    //根据班级名称获取班级id
53
+    Integer getClassIdByName(String classname, Integer schoolid, Integer gradeid, Integer year);
54
+}

+ 63
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/ClassStudentMapper.java View File

@@ -0,0 +1,63 @@
1
+package com.xhkjedu.suser.mapper.gradeclass;
2
+
3
+import com.xhkjedu.suser.base.TkMapper;
4
+import com.xhkjedu.suser.model.gradeclass.TClassStudent;
5
+import com.xhkjedu.suser.vo.gradeclass.ClassStudentVo;
6
+import com.xhkjedu.suser.vo.gradeclass.ClassVo;
7
+import com.xhkjedu.suser.vo.gradeclass.ImportStudentVo;
8
+import com.xhkjedu.suser.vo.paper.AStudentPaperVo;
9
+import com.xhkjedu.suser.vo.paper.AnalyzeSearchVo;
10
+import org.apache.ibatis.annotations.Param;
11
+
12
+import java.util.List;
13
+
14
+public interface ClassStudentMapper extends TkMapper<TClassStudent> {
15
+    //班级学生列表
16
+    List<ClassStudentVo> findAll(@Param("student") TClassStudent student);
17
+
18
+    //删除班级、分组对应学生
19
+    void deleteById(@Param("classid") Integer classid,@Param("studentid") Integer studentid);
20
+
21
+    //班级学生数量
22
+    ImportStudentVo getNumById(@Param("classid") Integer classid, @Param("studentid") Integer studentid, @Param("year") Integer year);
23
+
24
+    //获取学生行政班id
25
+    Integer getClassIdByStuId(@Param("studentid") Integer studentid);
26
+
27
+    //获取要升级的学生列表
28
+    List<TClassStudent> listStudentByClassIds(@Param("classIds") String classIds);
29
+
30
+    /**
31
+     * 根据班级id和学生id获取班级学生信息
32
+     * @Param [classid, studentid]
33
+     * @Author ywx
34
+     * @Date 2020/6/19 10:08
35
+     * @return com.xhkjedu.model.gradeclass.TClassStudent
36
+     **/
37
+    TClassStudent getByClassIdStudentId(@Param("classid") Integer classid,@Param("studentid") Integer studentid);
38
+
39
+    List<ClassVo> listClassByStudentId(Integer year,Integer studentid);
40
+
41
+    List<ClassStudentVo> listNoClassStu(@Param("student") TClassStudent student);
42
+
43
+    //获取学生所在年级列表
44
+    List<Integer> listGrade(@Param("studentid") Integer studentid,@Param("year") Integer year);
45
+
46
+    //获取全校学生
47
+    List<ClassStudentVo> listAllStudents(@Param("student") TClassStudent student);
48
+
49
+    //获取班级学生id列表
50
+    List<Integer> listStudentIdByClassId(@Param("classid") Integer classid);
51
+
52
+    //添加
53
+    void save(@Param("student") TClassStudent student);
54
+
55
+    //学生所在行政班
56
+    ClassVo getClassByStuId(@Param("studentid") Integer studentid);
57
+
58
+    //作业/预习统计--学生列表
59
+    List<AStudentPaperVo> listStu(@Param("paper") AnalyzeSearchVo paper);
60
+
61
+    //获取学生所有提高班
62
+    List<Integer> listTgClassid(Integer studentid);
63
+}

+ 90
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/ClassTeacherMapper.java View File

@@ -0,0 +1,90 @@
1
+package com.xhkjedu.suser.mapper.gradeclass;
2
+
3
+import com.xhkjedu.suser.base.TkMapper;
4
+import com.xhkjedu.suser.model.gradeclass.TClassTeacher;
5
+import com.xhkjedu.suser.vo.gradeclass.ClassTeacherParams;
6
+import com.xhkjedu.suser.vo.gradeclass.ClassTeacherVo;
7
+import com.xhkjedu.suser.vo.gradeclass.ClassVo;
8
+import com.xhkjedu.suser.vo.gradeclass.GradeVo;
9
+import com.xhkjedu.suser.vo.system.TeacherRoleParam;
10
+import org.apache.ibatis.annotations.Param;
11
+import org.springframework.stereotype.Repository;
12
+
13
+import java.util.List;
14
+import java.util.Map;
15
+
16
+@Repository
17
+public interface ClassTeacherMapper extends TkMapper<TClassTeacher> {
18
+    //学校教师列表
19
+    List<ClassTeacherVo> findAll(@Param("teacher") TClassTeacher teacher);
20
+
21
+    /**
22
+     *功能描述  当前年份教师任教班级
23
+     * @author WN
24
+     * @date 2020/6/13
25
+     * @param  * @param teacherid
26
+     * @param year
27
+     * @return java.util.List<com.xhkjedu.suser.vo.gradeclass.ClassVo>
28
+     */
29
+    List<ClassVo> listTeacherClass(@Param("teacherid") Integer teacherid,@Param("year") Integer year,@Param("classtype") Integer classtype);
30
+
31
+    //当前年份教师任教班级
32
+    List<ClassVo> listTeacherClass2(@Param("teacherid") Integer teacherid,@Param("year") Integer year);
33
+
34
+    /**
35
+     * 要升级的教师列表
36
+     * @Param [classIds]
37
+     * @Author ywx
38
+     * @Date 2020/6/16 14:04
39
+     * @return java.util.List<com.xhkjedu.model.gradeclass.TClassTeacher>
40
+     **/
41
+    List<TClassTeacher> listTeacherByClassIds(@Param("classIds") String classIds);
42
+
43
+    //删除教师任教班级
44
+    void deleteByUserid(Integer userid,Integer year);
45
+
46
+    //教师任教班级id集合
47
+    List<ClassVo> listClassesByUserid(Integer userid, Integer year, Integer classtype);
48
+
49
+    //教师任教班级年级层级
50
+    List<GradeVo> listGradeClassesByUserid(@Param("role") TeacherRoleParam role);
51
+
52
+    /**
53
+     * 获取作业学生列表
54
+     * @Param [paperid]
55
+     * @Author ywx
56
+     * @Date 2020/7/10 15:51
57
+     * @return java.util.List<com.xhkjedu.suser.vo.gradeclass.ClassVo>
58
+     **/
59
+    List<ClassVo> listPaperStudent(Integer paperid);
60
+
61
+    //获取作业教师列表
62
+    List<Map> listPaperTeacher(@Param("paperid") Integer paperid,@Param("subjectid") String subjectid);
63
+
64
+    /**
65
+     *功能描述 年级下教师集合
66
+     * @author WN
67
+     * @date 2021/1/23
68
+     * @param  * @param schoolid
69
+     * @param gradeid
70
+     * @return java.util.List<com.xhkjedu.model.gradeclass.TClassTeacher>
71
+     */
72
+    List<ClassTeacherVo> listTeachersByGradeid(Integer schoolid,Integer gradeid,Integer year);
73
+
74
+    /**
75
+     *功能描述 获取年级科目下教师集合
76
+     * @author WN
77
+     * @date 2021/1/29
78
+     * @param  * @param ctp
79
+     * @return java.util.List<com.xhkjedu.suser.vo.gradeclass.ClassTeacherVo>
80
+     */
81
+    List<ClassTeacherVo> listTeahcersBySubjectGrade(@Param("ctp") ClassTeacherParams ctp);
82
+
83
+    List<GradeVo> listGradeClassesByUserid2(@Param("role") TeacherRoleParam role);
84
+
85
+    //删除班级下所有教师
86
+    void deleteByClassId(Integer classid);
87
+
88
+    //获取教师任教行政和提高班id
89
+    String getClassIds(Integer teacherid);
90
+}

+ 36
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/GradeMapper.java View File

@@ -0,0 +1,36 @@
1
+package com.xhkjedu.suser.mapper.gradeclass;
2
+
3
+import com.xhkjedu.suser.base.TkMapper;
4
+import com.xhkjedu.suser.model.gradeclass.TGrade;
5
+import com.xhkjedu.suser.vo.gradeclass.GradeVo;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+
10
+public interface GradeMapper extends TkMapper<TGrade> {
11
+    //学校年级列表
12
+    List<TGrade> findAll(@Param("schoolid") Integer schoolid,@Param("year") Integer year);
13
+
14
+    //详情
15
+    TGrade findById(@Param("gradeid") Integer gradeid);
16
+
17
+    /**
18
+     * 获取通知班级列表
19
+     * @Param [schoolid, year]
20
+     * @Author ywx
21
+     * @Date 2020/6/13 15:41
22
+     * @return java.util.List<com.xhkjedu.suser.vo.gradeclass.GradeVo>
23
+     **/
24
+    List<GradeVo> listClass(@Param("schoolid") Integer schoolid, @Param("year") Integer year,@Param("classtype") Integer classtype);
25
+
26
+    /**
27
+     * 获取通知教师列表
28
+     * @Param [schoolid, year]
29
+     * @Author ywx
30
+     * @Date 2020/6/13 15:43
31
+     * @return java.util.List<com.xhkjedu.suser.vo.gradeclass.GradeVo>
32
+     **/
33
+    List<GradeVo> listTeacher(@Param("schoolid") Integer schoolid, @Param("year") Integer year);
34
+
35
+    List<GradeVo> listClassForTeacher(Integer schoolid, Integer year);
36
+}

+ 26
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/GroupMapper.java View File

@@ -0,0 +1,26 @@
1
+package com.xhkjedu.suser.mapper.gradeclass;
2
+
3
+import com.xhkjedu.suser.base.TkMapper;
4
+import com.xhkjedu.suser.model.gradeclass.TGroup;
5
+import com.xhkjedu.suser.vo.gradeclass.ClassGroupVo;
6
+import org.apache.ibatis.annotations.Param;
7
+import org.springframework.stereotype.Repository;
8
+
9
+import java.util.List;
10
+
11
+@Repository
12
+public interface GroupMapper extends TkMapper<TGroup> {
13
+    //更新分组人数
14
+    void updateNum(@Param("groupid") Integer groupid);
15
+
16
+    //获取列表
17
+    List<TGroup> findAll(@Param("classid") Integer classid,@Param("createid") Integer createid);
18
+
19
+    //教师分组列表
20
+    List<ClassGroupVo> teacherList(@Param("teacherid") Integer teacherid,@Param("year") Integer year);
21
+
22
+    List<Integer> listStudentidsByGroupids(@Param("groupids") String groupids);
23
+
24
+    //要升级的全体分组列表
25
+    List<TGroup> listStudentByClassIds(@Param("classIds") String classIds);
26
+}

+ 22
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/GroupStudentMapper.java View File

@@ -0,0 +1,22 @@
1
+package com.xhkjedu.suser.mapper.gradeclass;
2
+
3
+import com.xhkjedu.suser.base.TkMapper;
4
+import com.xhkjedu.suser.model.gradeclass.TGroupStudent;
5
+import com.xhkjedu.suser.vo.gradeclass.GroupStudentVo;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+
10
+public interface GroupStudentMapper extends TkMapper<TGroupStudent> {
11
+    //列表
12
+    List<GroupStudentVo> findAll(Integer groupid);
13
+
14
+    //获取要升级的学生列表
15
+    List<TGroupStudent> listStudentByGroupIds(@Param("groupIds") String groupIds);
16
+
17
+    //删除分组学生
18
+    Integer deleteByGroupId(Integer groupid);
19
+
20
+    //添加
21
+    void save(@Param("student") TGroupStudent student);
22
+}

+ 36
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/system/RoleMapper.java View File

@@ -0,0 +1,36 @@
1
+package com.xhkjedu.suser.mapper.system;
2
+
3
+import com.xhkjedu.suser.base.TkMapper;
4
+import com.xhkjedu.suser.model.system.TRole;
5
+import com.xhkjedu.suser.vo.system.RoleVo;
6
+import org.apache.ibatis.annotations.Param;
7
+import org.springframework.stereotype.Repository;
8
+
9
+import java.util.List;
10
+
11
+/**
12
+ * @ClassName RoleMapper
13
+ * Description TODO
14
+ * Author WN
15
+ * Date 2020/6/13 17:40
16
+ **/
17
+@Repository
18
+public interface RoleMapper extends TkMapper<TRole> {
19
+    /**
20
+     *功能描述  获取所有角色
21
+     * @author WN
22
+     * @date 2020/6/15
23
+     * @param  * @param schoolid
24
+     * @return java.util.List<com.xhkjedu.model.system.TRole>
25
+     */
26
+    List<TRole> listAllRoles (@Param("schoolid")Integer schoolid);
27
+
28
+    /**
29
+     *功能描述 获取角色详情,包含用户
30
+     * @author WN
31
+     * @date 2020/6/15
32
+     * @param  * @param roleid
33
+     * @return RoleVo
34
+     */
35
+    RoleVo getRoleDetail(@Param("roleid")Integer roleid);
36
+}

+ 55
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/system/RoleModuleMapper.java View File

@@ -0,0 +1,55 @@
1
+package com.xhkjedu.suser.mapper.system;
2
+
3
+import com.xhkjedu.suser.base.TkMapper;
4
+import com.xhkjedu.suser.model.system.TRoleModule;
5
+import com.xhkjedu.suser.vo.system.RoleModuleVo;
6
+import org.apache.ibatis.annotations.Param;
7
+import org.springframework.stereotype.Repository;
8
+
9
+import java.util.List;
10
+
11
+/**
12
+ * @ClassName RoleModuleMapper
13
+ * Description 角色模块
14
+ * Author WN
15
+ * Date 2020/6/15 9:32
16
+ **/
17
+@Repository
18
+public interface RoleModuleMapper extends TkMapper<TRoleModule> {
19
+
20
+    /**
21
+     *功能描述  获取角色下素有权限
22
+     * @author WN
23
+     * @date 2020/6/15
24
+     * @param  * @param roleid
25
+     * @return java.util.List<com.xhkjedu.suser.vo.system.RoleModuleVo>
26
+     */
27
+    List<RoleModuleVo> listRoleModules(@Param("roleid")Integer roleid);
28
+
29
+    /**
30
+     *功能描述  批量角色模块信息
31
+     * @author WN
32
+     * @date 2020/6/15
33
+     * @param  * @param list
34
+     * @return void
35
+     */
36
+    void saveBathRoleModule(@Param("list")List<TRoleModule> list);
37
+
38
+    /**
39
+     *功能描述 根据角色id删除角色模块关联信息
40
+     * @author WN
41
+     * @date 2020/6/15
42
+     * @param  * @param roleid
43
+     * @return void
44
+     */
45
+    void deleteByRoleid(@Param("roleid")Integer roleid);
46
+
47
+    /**
48
+     *功能描述 根据用户id获取用户拥有角色所关联的所有模块
49
+     * @author WN
50
+     * @date 2020/6/15
51
+     * @param  * @param userid
52
+     * @return java.util.List<com.xhkjedu.suser.vo.system.RoleModuleVo>
53
+     */
54
+    List<RoleModuleVo> listModulesByUserid(@Param("userid")Integer userid);
55
+}

+ 211
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/system/UserMapper.java View File

@@ -0,0 +1,211 @@
1
+package com.xhkjedu.suser.mapper.system;
2
+
3
+import com.xhkjedu.suser.base.TkMapper;
4
+import com.xhkjedu.suser.model.gradeclass.TClassStudent;
5
+import com.xhkjedu.suser.model.system.TUser;
6
+import com.xhkjedu.suser.model.system.TUserLog;
7
+import com.xhkjedu.suser.vo.assess.AssessParams;
8
+import com.xhkjedu.suser.vo.system.TeacherVo;
9
+import com.xhkjedu.suser.vo.system.UserVo;
10
+import org.apache.ibatis.annotations.Param;
11
+import org.springframework.stereotype.Repository;
12
+
13
+import java.util.List;
14
+import java.util.Map;
15
+
16
+/**
17
+ * @ClassName UserMapper
18
+ * Description
19
+ * Author WN
20
+ * Date 2020/5/29 17:00
21
+ **/
22
+@Repository
23
+public interface UserMapper extends TkMapper<TUser> {
24
+
25
+    /**
26
+     *功能描述  根据帐号密码获取用户
27
+     * @author WN
28
+     * @date 2020/5/29
29
+     * @param  * @param loginname
30
+     * @return com.xhkjedu.model.system.TUser
31
+     */
32
+    UserVo getUserByLoginname(String loginname);
33
+
34
+    /**
35
+     * 删除用户
36
+     * @Param [user]
37
+     * @Author ywx
38
+     * @Date 2020/6/2 9:59
39
+     * @return java.lang.Integer
40
+     **/
41
+    Integer deleteById(@Param("user") TUser user);
42
+
43
+    /**
44
+     * 获取用户列表
45
+     * @Param [user]
46
+     * @Author ywx
47
+     * @Date 2020/6/2 10:07
48
+     * @return java.util.List<com.xhkjedu.suser.vo.system.UserVo>
49
+     **/
50
+    List<UserVo> findAll(@Param("user") TUser user);
51
+
52
+    /**
53
+     * 获取用户详情
54
+     * @Param [userid]
55
+     * @Author ywx
56
+     * @Date 2020/6/2 10:23
57
+     * @return com.xhkjedu.suser.vo.system.UserVo
58
+     **/
59
+    UserVo findById(@Param("userid") Integer userid);
60
+
61
+    /**
62
+     * 修改用户密码
63
+     * @Param [user]
64
+     * @Author ywx
65
+     * @Date 2020/6/2 10:30
66
+     * @return java.lang.Integer
67
+     **/
68
+    Integer updatePwd(@Param("user") TUser user);
69
+
70
+    /**
71
+     * 修改用户头像
72
+     * @Param [user]
73
+     * @Author ywx
74
+     * @Date 2020/6/2 10:36
75
+     * @return java.lang.Integer
76
+     **/
77
+    Integer updateHeadPic(@Param("user") TUser user);
78
+
79
+    /**
80
+     * 检查登录账号是否存在
81
+     * @Param [loginname]
82
+     * @Author ywx
83
+     * @Date 2020/6/2 10:44
84
+     * @return java.lang.Integer
85
+     **/
86
+    Integer checkLoginName(@Param("loginname") String loginname);
87
+
88
+    /**
89
+     * 根据登录账号获取用户详情
90
+     * @Param [loginname]
91
+     * @Author ywx
92
+     * @Date 2020/6/3 9:33
93
+     * @return com.xhkjedu.model.system.TUser
94
+     **/
95
+    TUser getObjByLoginName(@Param("loginname") String loginname);
96
+
97
+    /**
98
+     * 修改用户状态
99
+     * @Param [userid, userstate]
100
+     * @Author ywx
101
+     * @Date 2020/6/4 9:08
102
+     * @return void
103
+     **/
104
+    void updateState(@Param("userid") Integer userid,@Param("userstate") int userstate);
105
+
106
+    /**
107
+     *功能描述 设置操作密码
108
+     * @author WN
109
+     * @date 2020/6/17
110
+     * @param  * @param userid
111
+     * @param opepassword
112
+     * @return void
113
+     */
114
+    void updateOpepasswordByUserId(@Param("userid") Integer userid,@Param("opepassword") String opepassword);
115
+
116
+    /**
117
+     *功能描述 验证用户操作密码是否正确
118
+     * @author WN
119
+     * @date 2020/6/17
120
+     * @param  * @param userid
121
+     * @param opepassword
122
+     * @return java.lang.Integer
123
+     */
124
+    Integer getUserIdByOpepassword(@Param("userid") Integer userid,@Param("opepassword") String opepassword);
125
+
126
+    /**
127
+     * 教师基本信息
128
+     * @Param [userid]
129
+     * @Author ywx
130
+     * @Date 2020/6/29 16:24
131
+     * @return com.xhkjedu.suser.vo.system.TeacherVo
132
+     **/
133
+    TeacherVo getTeacherInfo(Integer userid, Integer classtype);
134
+
135
+    /**
136
+     * 更新学生硬件绑定信息
137
+     * @Param [user]
138
+     * @Author ywx
139
+     * @Date 2020/9/18 11:38
140
+     * @return void
141
+     **/
142
+    void updateBindMac(@Param("user") UserVo user);
143
+
144
+    /**
145
+     * 根据登录账号和硬件地址获取用户信息
146
+     * @Param [loginname, mac]
147
+     * @Author ywx
148
+     * @Date 2020/9/21 16:17
149
+     * @return com.xhkjedu.suser.vo.system.UserVo
150
+     **/
151
+    UserVo getUserByLoginnameMac(String loginname, String mac);
152
+
153
+    /**
154
+     * 删除学生绑定信息
155
+     * @Param [schoolid]
156
+     * @Author ywx
157
+     * @Date 2020/9/24 11:42
158
+     * @return void
159
+     **/
160
+    void delBindmac(Integer schoolid);
161
+
162
+    /**
163
+     * 通过短信修改密码
164
+     * @Param [user]
165
+     * @Author ywx
166
+     * @Date 2020/10/13 15:17
167
+     * @return void
168
+     **/
169
+    void updatePwdByCode(@Param("user") TUser user);
170
+
171
+    /**
172
+     * 批量修改用户密码
173
+     * @Param [user]
174
+     * @Author ywx
175
+     * @Date 2020/10/30 16:04
176
+     * @return void
177
+     **/
178
+    void batchUpdatePwd(@Param("user") TUser user);
179
+
180
+    String getUserNameById(@Param("userid")Integer userid);
181
+
182
+    //批量修改学生状态
183
+    void batchUpdateState(@Param("users")List<TClassStudent> users,@Param("userstate")Integer userstate);
184
+
185
+    //获取学校管理员
186
+    UserVo getSchoolAdminBySchoolid(@Param("schoolid")Integer schoolid);
187
+
188
+    //校验手机号
189
+    boolean checkUserPhone(Integer userid);
190
+
191
+    //根据登录名获取学生id和行政和提高班班级id
192
+    TUser getObjByLoginName2(@Param("loginname") String loginname);
193
+
194
+    //获取学校账号数量
195
+    Integer getUserNumBySchoolId(Integer schoolid);
196
+
197
+    //用户选择列表
198
+    List<Map> listForSel(@Param("user") AssessParams user, @Param("year") Integer year);
199
+
200
+    //根据班级id用户名获取学生id和数量
201
+    Map getUserIdByName(Integer schoolid, Integer classid, String username);
202
+
203
+    //根据班级科目id用户名获取教师id和数量
204
+    Map getUserIdByName2(Integer schoolid, Integer classid, String username, String subjectid);
205
+
206
+    //根据用户id获取用户类型
207
+    Integer getUsertypeById(Integer userid);
208
+
209
+    //添加登录日志
210
+    void saveUserLog(@Param("log") TUserLog userLog);
211
+}

+ 42
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/system/UserRoleMapper.java View File

@@ -0,0 +1,42 @@
1
+package com.xhkjedu.suser.mapper.system;
2
+
3
+import com.xhkjedu.suser.base.TkMapper;
4
+import com.xhkjedu.suser.model.system.TUserRole;
5
+import com.xhkjedu.suser.vo.system.UserRoleVo;
6
+import org.apache.ibatis.annotations.Param;
7
+import org.springframework.stereotype.Repository;
8
+
9
+import java.util.List;
10
+
11
+/**
12
+ * @ClassName UserRoleMapper
13
+ * Description 用户角色
14
+ * Author WN
15
+ * Date 2020/6/15 11:04
16
+ **/
17
+@Repository
18
+public interface UserRoleMapper extends TkMapper<TUserRole> {
19
+
20
+    //根据用户id删除用户角色信息
21
+    void deleteByUserid(Integer userid);
22
+
23
+    //用户角色id集合
24
+    List<UserRoleVo> listRolesByUserid(@Param("userid") Integer userid);
25
+
26
+    //角色下用户
27
+    List<TUserRole> listUsersByRoleid(Integer roleid);
28
+
29
+    /**
30
+     * @author ywx
31
+     * @description 获取有常用模块的用户id集合
32
+     * @date 2020/7/9 20:55
33
+     **/
34
+    List<Integer> listUserId(@Param("roleid") Integer roleid);
35
+
36
+    /**
37
+     * @author ywx
38
+     * @description 根据用户id删除没有权限的常用模块
39
+     * @date 2020/7/9 20:55
40
+     **/
41
+    Integer deleteNoRoleByUserId(@Param("userid") Integer userid);
42
+}

+ 26
- 0
suser/src/main/java/com/xhkjedu/suser/model/BaseBean.java View File

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

+ 51
- 0
suser/src/main/java/com/xhkjedu/suser/model/assess/TAssessFile.java View File

@@ -0,0 +1,51 @@
1
+package com.xhkjedu.suser.model.assess;
2
+
3
+import com.xhkjedu.suser.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_assess_file")
10
+@Data
11
+public class TAssessFile extends BaseBean {
12
+    @Id
13
+    //评价用户附件id
14
+    private Integer afid;
15
+
16
+    //评价用户id
17
+    private Integer auid;
18
+
19
+    //附件名称
20
+    private String filename;
21
+
22
+    //附件分类1word,2ppt,3pdf,4图片,5视频,6音频,7压缩包,10其他
23
+    private Integer fileclass;
24
+
25
+    //附件地址
26
+    private String fileurl;
27
+
28
+    //封面图地址
29
+    private String filecover;
30
+
31
+    //是否转换0未转换1已转换2转换失败3加密
32
+    private Integer converted;
33
+
34
+    //转换后的pdf文件地址
35
+    private String pdfurl;
36
+
37
+    //文件后缀
38
+    private String suffix;
39
+
40
+    //文件大小
41
+    private Integer filesize;
42
+
43
+    //视频时长(秒)
44
+    private Integer duration;
45
+
46
+    //创建时间
47
+    private Integer createtime;
48
+
49
+    //转换失败原因
50
+    private String convertmsg;
51
+}

+ 80
- 0
suser/src/main/java/com/xhkjedu/suser/model/assess/TAssessUser.java View File

@@ -0,0 +1,80 @@
1
+package com.xhkjedu.suser.model.assess;
2
+
3
+import com.xhkjedu.suser.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_assess_user")
12
+@Data
13
+public class TAssessUser extends BaseBean {
14
+    @Id
15
+    //评价用户id
16
+    private Integer auid;
17
+
18
+    //用户id
19
+    private Integer userid;
20
+
21
+    //评价id
22
+    private Integer assessid;
23
+
24
+    //评价模板id
25
+    private Integer templateid;
26
+
27
+    //评价指标id
28
+    private Integer quotaid;
29
+
30
+    //用户类型1老师2学生
31
+    private Integer usertype;
32
+
33
+    //评价类型1表扬2批评
34
+    private Integer autype;
35
+
36
+    //学生类型:Y优秀生、L良好生、K学困生、T特殊生
37
+    private String stutype;
38
+
39
+    //年级id
40
+    private Integer gradeid;
41
+
42
+    //班级id
43
+    private Integer classid;
44
+
45
+    //科目id
46
+    private String subjectid;
47
+
48
+    //节次
49
+    private Integer snum;
50
+
51
+    //表现次数
52
+    private Integer aunum;
53
+
54
+    //表现日期
55
+    private Integer autime;
56
+
57
+    //表现备注
58
+    private String comm;
59
+
60
+    //创建人id
61
+    private Integer createid;
62
+
63
+    //创建时间
64
+    private Integer createtime;
65
+
66
+    //学校id
67
+    private Integer schoolid;
68
+
69
+    @Transient
70
+    //评价用户附件
71
+    private List<TAssessFile> files;
72
+
73
+    @Transient
74
+    //开始时间
75
+    private Integer starttime;
76
+
77
+    @Transient
78
+    //截至时间
79
+    private Integer stoptime;
80
+}

+ 48
- 0
suser/src/main/java/com/xhkjedu/suser/model/gradeclass/TClass.java View File

@@ -0,0 +1,48 @@
1
+package com.xhkjedu.suser.model.gradeclass;
2
+
3
+import com.xhkjedu.suser.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_class")
10
+@Data
11
+public class TClass extends BaseBean {
12
+    //班级表
13
+    @Id
14
+    private Integer classid;
15
+
16
+    //班级名称
17
+    private String classname;
18
+
19
+    //所属年级
20
+    private Integer gradeid;
21
+
22
+    //学生数量
23
+    private Integer classnum;
24
+
25
+    //班级状态1正常3毕业
26
+    private Integer classstate;
27
+
28
+    //班级排序
29
+    private Integer classorder;
30
+
31
+    //入学年(届)
32
+    private Integer schoolyear;
33
+
34
+    //当前年份
35
+    private Integer year;
36
+
37
+    //创建人id
38
+    private Integer createid;
39
+
40
+    //创建时间
41
+    private Integer createtime;
42
+
43
+    //学校id
44
+    private Integer schoolid;
45
+
46
+    //班级类型1行政班2提高班3直播班99已直播班级
47
+    private Integer classtype;
48
+}

+ 78
- 0
suser/src/main/java/com/xhkjedu/suser/model/gradeclass/TClassStudent.java View File

@@ -0,0 +1,78 @@
1
+package com.xhkjedu.suser.model.gradeclass;
2
+
3
+import com.xhkjedu.suser.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_class_student")
11
+@Data
12
+public class TClassStudent extends BaseBean {
13
+    //班级关联学生id
14
+    @Id
15
+    private Integer csid;
16
+
17
+    //班级id
18
+    private Integer classid;
19
+
20
+    //学生id
21
+    private Integer studentid;
22
+
23
+    //创建人
24
+    private Integer createid;
25
+
26
+    //创建时间
27
+    private Integer createtime;
28
+
29
+    //学校id
30
+    private Integer schoolid;
31
+
32
+    //学号
33
+    @Transient
34
+    private String studentno;
35
+
36
+    //学生姓名
37
+    @Transient
38
+    private String studentname;
39
+
40
+    //性别1男2女
41
+    @Transient
42
+    private Integer usersex;
43
+
44
+    //全体分组id
45
+    @Transient
46
+    private Integer groupid;
47
+
48
+    //原班级id
49
+    @Transient
50
+    private Integer oldclassid;
51
+
52
+    //排序字段:学生姓名studentname 学号studentno 创建时间createtime
53
+    @Transient
54
+    private String fieldname;
55
+
56
+    //排序规则:正序asc 倒序desc
57
+    @Transient
58
+    private String fieldorder;
59
+
60
+    @Transient
61
+    //用户状态1正常2删除
62
+    private Integer userstate;
63
+
64
+    @Transient
65
+    //用户手机号
66
+    private String userphone;
67
+
68
+    @Transient
69
+    private Integer classtype;//班级类型1行政班2提高班3直播班99已直播班
70
+
71
+    @Transient
72
+    //当前年份
73
+    private Integer year;
74
+
75
+    @Transient
76
+    //有效期
77
+    private String usertime;
78
+}

+ 59
- 0
suser/src/main/java/com/xhkjedu/suser/model/gradeclass/TClassTeacher.java View File

@@ -0,0 +1,59 @@
1
+package com.xhkjedu.suser.model.gradeclass;
2
+
3
+import com.xhkjedu.suser.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_class_teacher")
11
+@Data
12
+public class TClassTeacher extends BaseBean {
13
+    //班级教师表
14
+    @Id
15
+    private Integer ctid;
16
+
17
+    //班级id
18
+    private Integer classid;
19
+
20
+    //教师id
21
+    private Integer teacherid;
22
+
23
+    //创建人id
24
+    private Integer createid;
25
+
26
+    //创建时间
27
+    private Integer createtime;
28
+
29
+    //学校id
30
+    private Integer schoolid;
31
+
32
+    //教师姓名
33
+    @Transient
34
+    private String teachername;
35
+
36
+    //手机号
37
+    @Transient
38
+    private String userphone;
39
+
40
+    //排序字段:姓名teachername 登录账号loginname 创建时间createtime
41
+    @Transient
42
+    private String fieldname;
43
+
44
+    //排序规则:正序asc 倒序desc
45
+    @Transient
46
+    private String fieldorder;
47
+
48
+    @Transient
49
+    //所属年级
50
+    private Integer gradeid;
51
+
52
+    @Transient
53
+    //科目id
54
+    private String subjectid;
55
+
56
+    @Transient
57
+    //当前年份
58
+    private Integer year;
59
+}

+ 43
- 0
suser/src/main/java/com/xhkjedu/suser/model/gradeclass/TGrade.java View File

@@ -0,0 +1,43 @@
1
+package com.xhkjedu.suser.model.gradeclass;
2
+
3
+import com.xhkjedu.suser.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_grade")
11
+@Data
12
+public class TGrade extends BaseBean {
13
+    //年级表
14
+    @Id
15
+    private Integer gradeid;
16
+
17
+    //年级名称
18
+    private String gradename;
19
+
20
+    //年级处理顺序
21
+    private Integer gradeorder;
22
+
23
+    //所属学段1小学2初中3高中4大学
24
+    private Integer level;
25
+
26
+    //入学年(届)
27
+    private Integer schoolyear;
28
+
29
+    //当前年份
30
+    private Integer year;
31
+
32
+    //创建人id
33
+    private Integer createid;
34
+
35
+    //创建时间
36
+    private Integer createtime;
37
+
38
+    //学校id
39
+    private Integer schoolid;
40
+
41
+    @Transient
42
+    private Integer classtype;//班级类型1行政班2提高班3直播班99已直播班
43
+}

+ 52
- 0
suser/src/main/java/com/xhkjedu/suser/model/gradeclass/TGroup.java View File

@@ -0,0 +1,52 @@
1
+package com.xhkjedu.suser.model.gradeclass;
2
+
3
+import com.xhkjedu.suser.model.BaseBean;
4
+import com.xhkjedu.suser.vo.gradeclass.GroupStudentVo;
5
+import lombok.Data;
6
+
7
+import javax.persistence.Id;
8
+import javax.persistence.Table;
9
+import javax.persistence.Transient;
10
+import java.util.ArrayList;
11
+import java.util.List;
12
+
13
+@Table(name = "t_group")
14
+@Data
15
+public class TGroup extends BaseBean {
16
+    //班级分组id
17
+    @Id
18
+    private Integer groupid;
19
+
20
+    //分组名称
21
+    private String groupname;
22
+
23
+    //班级id
24
+    private Integer classid;
25
+
26
+    //班级分组类型1全体2一般分组
27
+    private Integer grouptype;
28
+
29
+    //分组人数
30
+    private Integer groupnum;
31
+
32
+    //创建人id
33
+    private Integer createid;
34
+
35
+    //创建时间
36
+    private Integer createtime;
37
+
38
+    //学校id
39
+    private Integer schoolid;
40
+
41
+    //当前年份
42
+    @Transient
43
+    private Integer year;
44
+
45
+    //资源id
46
+    @Transient
47
+    private String resourceid;
48
+
49
+    //分组下学生
50
+    @Transient
51
+    private List<GroupStudentVo> students = new ArrayList<>();
52
+}

+ 33
- 0
suser/src/main/java/com/xhkjedu/suser/model/gradeclass/TGroupStudent.java View File

@@ -0,0 +1,33 @@
1
+package com.xhkjedu.suser.model.gradeclass;
2
+
3
+import com.xhkjedu.suser.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_group_student")
10
+@Data
11
+public class TGroupStudent extends BaseBean {
12
+    //分组学生表
13
+    @Id
14
+    private Integer gsid;
15
+
16
+    //班级id
17
+    private Integer classid;
18
+
19
+    //分组id
20
+    private Integer groupid;
21
+
22
+    //学生id
23
+    private Integer studentid;
24
+
25
+    //创建人id
26
+    private Integer createid;
27
+
28
+    //创建时间
29
+    private Integer createtime;
30
+
31
+    //学校id
32
+    private Integer schoolid;
33
+}

+ 67
- 0
suser/src/main/java/com/xhkjedu/suser/model/gradeclass/TSchool.java View File

@@ -0,0 +1,67 @@
1
+package com.xhkjedu.suser.model.gradeclass;
2
+
3
+import com.xhkjedu.suser.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
+}

+ 35
- 0
suser/src/main/java/com/xhkjedu/suser/model/subjectbook/TTeacherPowersb.java View File

@@ -0,0 +1,35 @@
1
+package com.xhkjedu.suser.model.subjectbook;
2
+
3
+import com.xhkjedu.suser.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+/**
10
+ * @ClassName TTeacherPowersb
11
+ * Description 教师教材权限表
12
+ * Author WN
13
+ * Date 2020/7/1 19:02
14
+ **/
15
+@Table(name = "t_teacher_powersb")
16
+@Data
17
+public class TTeacherPowersb extends BaseBean {
18
+    @Id
19
+    private Integer tbid;
20
+
21
+    //教师id
22
+    private Integer teacherid;
23
+
24
+    //教材关联关系表id
25
+    private String lsbid;
26
+
27
+    //创建人id
28
+    private Integer createid;
29
+
30
+    //创建时间
31
+    private Integer createtime;
32
+
33
+    //学校id
34
+    private Integer schoolid;
35
+}

+ 36
- 0
suser/src/main/java/com/xhkjedu/suser/model/system/TMsg.java View File

@@ -0,0 +1,36 @@
1
+package com.xhkjedu.suser.model.system;
2
+
3
+import com.xhkjedu.suser.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_msg")
11
+@Data
12
+public class TMsg extends BaseBean {
13
+    @Id
14
+    //短信id
15
+    private Integer msgid;
16
+
17
+    //短信内容
18
+    private String msgtxt;
19
+
20
+    //验证码
21
+    private Integer msgcode;
22
+
23
+    //手机号
24
+    private String userphone;
25
+
26
+    //创建时间
27
+    private Integer createtime;
28
+
29
+    @Transient
30
+    //开始时间
31
+    private Integer starttime;
32
+
33
+    @Transient
34
+    //结束时间
35
+    private Integer stoptime;
36
+}

+ 42
- 0
suser/src/main/java/com/xhkjedu/suser/model/system/TRole.java View File

@@ -0,0 +1,42 @@
1
+package com.xhkjedu.suser.model.system;
2
+
3
+import com.xhkjedu.suser.model.BaseBean;
4
+import com.xhkjedu.suser.vo.system.RoleModuleVo;
5
+import lombok.Data;
6
+
7
+import javax.persistence.Id;
8
+import javax.persistence.Table;
9
+import javax.persistence.Transient;
10
+import java.util.ArrayList;
11
+import java.util.List;
12
+
13
+@Table(name = "t_role")
14
+@Data
15
+public class TRole extends BaseBean {
16
+    //角色表
17
+    @Id
18
+    private Integer roleid;
19
+
20
+    //角色名称
21
+    private String rolename;
22
+
23
+    //角色备注
24
+    private String comm;
25
+
26
+    //创建人id
27
+    private Integer createid;
28
+
29
+    //创建时间
30
+    private Integer createtime;
31
+
32
+    //学校id
33
+    private Integer schoolid;
34
+
35
+    //用户数量
36
+    @Transient
37
+    private Integer usernum;
38
+
39
+    //选择模块
40
+    @Transient
41
+    private List<RoleModuleVo> modules = new ArrayList<>();
42
+}

+ 30
- 0
suser/src/main/java/com/xhkjedu/suser/model/system/TRoleModule.java View File

@@ -0,0 +1,30 @@
1
+package com.xhkjedu.suser.model.system;
2
+
3
+import com.xhkjedu.suser.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_role_module")
10
+@Data
11
+public class TRoleModule extends BaseBean {
12
+    //角色模块表
13
+    @Id
14
+    private Integer rmid;
15
+
16
+    //角色id
17
+    private Integer roleid;
18
+
19
+    //模块表id
20
+    private String moduleid;
21
+
22
+    //创建人id
23
+    private Integer createid;
24
+
25
+    //创建时间
26
+    private Integer createtime;
27
+
28
+    //学校id
29
+    private Integer schoolid;
30
+}

+ 115
- 0
suser/src/main/java/com/xhkjedu/suser/model/system/TUser.java View File

@@ -0,0 +1,115 @@
1
+package com.xhkjedu.suser.model.system;
2
+
3
+import com.xhkjedu.suser.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
+/**
12
+ *功能描述  用户表
13
+ * @author WN
14
+ * @date 2020/5/29
15
+ * @return
16
+ */
17
+@Table(name = "t_user")
18
+@Data
19
+public class TUser extends BaseBean {
20
+    //用户表
21
+    @Id
22
+    private Integer userid;
23
+
24
+    //姓名
25
+    private String username;
26
+
27
+    //登录账号
28
+    private String loginname;
29
+
30
+    //学生学号
31
+    private String studentno;
32
+
33
+    //登录密码
34
+    private String loginpwd;
35
+
36
+    //用户手机号
37
+    private String userphone;
38
+
39
+    //出生日期
40
+    private Integer userbirthday;
41
+
42
+    //身份证号
43
+    private String cardid;
44
+
45
+    //头像地址
46
+    private String headpic;
47
+
48
+    //用户类型999超级管理员0学校管理员1老师2学生
49
+    private Integer usertype;
50
+
51
+    //用户状态1正常2删除3已毕业
52
+    private Integer userstate;
53
+
54
+    //是否绑定硬件地址0不绑定1绑定
55
+    private Integer bindmac;
56
+
57
+    //硬件地址
58
+    private String mac;
59
+
60
+    //操作密码(教师操作密码)
61
+    private String opepassword;
62
+
63
+    //有效期
64
+    private String usertime;
65
+
66
+    //创建人id
67
+    private Integer createid;
68
+
69
+    //创建时间
70
+    private Integer createtime;
71
+
72
+    //删除人id
73
+    private Integer deleteid;
74
+
75
+    //删除时间
76
+    private Integer deletetime;
77
+
78
+    //学校id
79
+    private Integer schoolid;
80
+
81
+    //性别1男2女
82
+    private Integer usersex;
83
+
84
+    @Transient
85
+    //原登录密码
86
+    private String oldpwd;
87
+
88
+    @Transient
89
+    //验证码
90
+    private Integer msgcode;
91
+
92
+    @Transient
93
+    //登录ip
94
+    private String logip;
95
+
96
+    @Transient
97
+    //登录地址
98
+    private String logaddress;
99
+
100
+    @Transient
101
+    //登录终端设备
102
+    private String ultype;
103
+
104
+    @Transient
105
+    //版本号
106
+    private String versionnum;
107
+
108
+    @Transient
109
+    //班级类型1行政班2提高班3直播班99已直播班级
110
+    private Integer classtype;
111
+
112
+    @Transient
113
+    //用户类型集合
114
+    private List<Integer> usertypes;
115
+}

+ 53
- 0
suser/src/main/java/com/xhkjedu/suser/model/system/TUserLog.java View File

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

+ 36
- 0
suser/src/main/java/com/xhkjedu/suser/model/system/TUserModule.java View File

@@ -0,0 +1,36 @@
1
+package com.xhkjedu.suser.model.system;
2
+
3
+import com.xhkjedu.suser.model.BaseBean;
4
+import com.xhkjedu.suser.model.BaseBean;
5
+import lombok.Data;
6
+
7
+import javax.persistence.Id;
8
+import javax.persistence.Table;
9
+import java.util.ArrayList;
10
+import java.util.List;
11
+
12
+@Table(name = "t_user_module")
13
+@Data
14
+public class TUserModule extends BaseBean {
15
+    //用户常用模块表
16
+    @Id
17
+    private Integer umid;
18
+
19
+    //用户id
20
+    private Integer userid;
21
+
22
+    //模块id
23
+    private String moduleid;
24
+
25
+    //排序
26
+    private Integer umorder;
27
+
28
+    //创建时间
29
+    private Integer createtime;
30
+
31
+    //学校id
32
+    private Integer schoolid;
33
+
34
+    //批量保存用户常用模块
35
+    private List<String> moduleids = new ArrayList<>();
36
+}

+ 32
- 0
suser/src/main/java/com/xhkjedu/suser/model/system/TUserRole.java View File

@@ -0,0 +1,32 @@
1
+package com.xhkjedu.suser.model.system;
2
+
3
+import com.xhkjedu.suser.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_role")
11
+@Data
12
+public class TUserRole extends BaseBean {
13
+    //用户角色表
14
+    @Id
15
+    private Integer urid;
16
+
17
+    //用户id
18
+    private Integer userid;
19
+
20
+    //角色id
21
+    private Integer roleid;
22
+
23
+    //创建人id
24
+    private Integer createid;
25
+
26
+    //创建时间
27
+    private Integer createtime;
28
+
29
+    //用户姓名
30
+    @Transient
31
+    private String username;
32
+}

+ 201
- 0
suser/src/main/java/com/xhkjedu/suser/service/gradeclass/ClassService.java View File

@@ -0,0 +1,201 @@
1
+package com.xhkjedu.suser.service.gradeclass;
2
+
3
+import com.xhkjedu.suser.mapper.gradeclass.ClassMapper;
4
+import com.xhkjedu.suser.mapper.gradeclass.ClassStudentMapper;
5
+import com.xhkjedu.suser.mapper.gradeclass.GroupStudentMapper;
6
+//import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
7
+import com.xhkjedu.suser.model.gradeclass.TClass;
8
+import com.xhkjedu.suser.model.gradeclass.TClassStudent;
9
+import com.xhkjedu.suser.model.gradeclass.TGroup;
10
+import com.xhkjedu.suser.model.gradeclass.TGroupStudent;
11
+import com.xhkjedu.suser.model.gradeclass.TSchool;
12
+import com.xhkjedu.utils.N_Utils;
13
+import com.xhkjedu.vo.ResultVo;
14
+import com.xhkjedu.suser.vo.gradeclass.ClassVo;
15
+import org.springframework.beans.BeanUtils;
16
+import org.springframework.stereotype.Service;
17
+
18
+import javax.annotation.Resource;
19
+import java.util.ArrayList;
20
+import java.util.List;
21
+
22
+/**
23
+ * @author ywx
24
+ * @classname TClassService
25
+ * @description 
26
+ * @date 2020/6/2 14:57
27
+ **/
28
+@Service
29
+public class ClassService {
30
+    @Resource
31
+    private ClassMapper classMapper;
32
+    @Resource
33
+    private GroupService groupService;
34
+    @Resource
35
+    private ClassStudentMapper classStudentMapper;
36
+    @Resource
37
+    private GroupStudentMapper groupStudentMapper;
38
+    //@Resource
39
+    //private SchoolMapper schoolMapper;
40
+
41
+    //添加
42
+    public Integer save(TClass model) {
43
+        model.setCreatetime(N_Utils.getSecondTimestamp());
44
+        model.setClassnum(0);
45
+        model.setClassstate(1);
46
+        //TSchool school = schoolMapper.selectByPrimaryKey(model.getSchoolid());
47
+        //model.setYear(school.getYear());//当前年份必须和学校年份一致
48
+        classMapper.insertUseGeneratedKeys(model);
49
+        //创建全体分组
50
+        TGroup group = new TGroup();
51
+        group.setGroupname("全班学生");
52
+        group.setClassid(model.getId());
53
+        group.setGrouptype(1);
54
+        group.setCreateid(model.getCreateid());
55
+        group.setSchoolid(model.getSchoolid());
56
+        groupService.save(group);
57
+        return model.getId();
58
+    }
59
+
60
+    //删除
61
+    public ResultVo deleteById(Integer classid) {
62
+        //2021-06-07删除时执行逻辑删除,不再判断是否有学生
63
+        /*ImportStudentVo student = classStudentMapper.getNumById(classid,0);
64
+        if (student.getClassnum() !=0){
65
+            return new ResultVo(1,"班级已关联学生,暂无法删除");
66
+        }*/
67
+        classMapper.updateClassstateByClassid(classid,10);//删除班级逻辑删除
68
+        return new ResultVo(0,"删除成功");
69
+    }
70
+
71
+    //删除
72
+    public ResultVo deleteById2(Integer classid) {
73
+        classMapper.deleteByPrimaryKey(classid);
74
+        return new ResultVo(0,"删除成功");
75
+    }
76
+
77
+    //修改
78
+    public Integer update(TClass model) {
79
+        model.setYear(null);//当前年份不能修改
80
+        return classMapper.updateByPrimaryKeySelective(model);
81
+    }
82
+
83
+    //获取列表
84
+    public List <ClassVo> findAll(TClass tClass) {
85
+        return classMapper.findAll(tClass);
86
+    }
87
+
88
+    //更新学生数量
89
+    public void updateNum(Integer classid) {
90
+        classMapper.updateNum(classid);
91
+    }
92
+
93
+    //更新班级、分组学生数量
94
+    public void updateNum2(Integer classid) {
95
+        classMapper.updateNum2(classid);
96
+    }
97
+
98
+    //基本信息
99
+    public ClassVo getById(Integer classid) {
100
+        return classMapper.getById(classid);
101
+    }
102
+
103
+    //学生选课
104
+    public void saveSelection(Integer classid, Integer studentid, Integer teacherid, Integer schoolid) {
105
+        TClassStudent student = classStudentMapper.getByClassIdStudentId(classid, studentid);
106
+        if (student == null) {
107
+            //班级学生
108
+            TClassStudent cs = new TClassStudent();
109
+            cs.setClassid(classid);
110
+            cs.setStudentid(studentid);
111
+            cs.setCreateid(teacherid);
112
+            cs.setSchoolid(schoolid);
113
+            cs.setCreatetime(N_Utils.getSecondTimestamp());
114
+            classStudentMapper.save(cs);
115
+
116
+            //分组学生
117
+            ClassVo classVo = getById(classid);
118
+            Integer groupid = classVo.getGroupid();
119
+            TGroupStudent gs = new TGroupStudent();
120
+            gs.setClassid(classid);
121
+            gs.setGroupid(groupid);
122
+            gs.setStudentid(studentid);
123
+            gs.setCreateid(teacherid);
124
+            gs.setSchoolid(schoolid);
125
+            gs.setCreatetime(N_Utils.getSecondTimestamp());
126
+            groupStudentMapper.save(gs);
127
+        }
128
+
129
+        //更新班级、分组学生数量
130
+        updateNum2(classid);
131
+    }
132
+
133
+    //学生取消选课
134
+    public void cancelSelection(Integer classid, Integer studentid) {
135
+        classStudentMapper.deleteById(classid, studentid);
136
+        //更新班级、分组学生数量
137
+        updateNum2(classid);
138
+    }
139
+
140
+    //批量添加报名学生
141
+    public void batchSaveStu(Integer createid, Integer schoolid, Integer classid, List<Integer> studentids) {
142
+        List<TClassStudent> classStudents = new ArrayList<>();
143
+        List<TGroupStudent> groupStudents = new ArrayList<>();
144
+        //班级学生
145
+        TClassStudent cs = new TClassStudent();
146
+        cs.setClassid(classid);
147
+        cs.setCreateid(createid);
148
+        cs.setSchoolid(schoolid);
149
+        cs.setCreatetime(N_Utils.getSecondTimestamp());
150
+        //分组学生
151
+        ClassVo classVo = getById(classid);
152
+        Integer groupid = classVo.getGroupid();
153
+        TGroupStudent gs = new TGroupStudent();
154
+        gs.setClassid(classid);
155
+        gs.setGroupid(groupid);
156
+        gs.setCreateid(createid);
157
+        gs.setSchoolid(schoolid);
158
+        gs.setCreatetime(N_Utils.getSecondTimestamp());
159
+        for (Integer studentid : studentids) {
160
+            TClassStudent classStudent = new TClassStudent();
161
+            BeanUtils.copyProperties(cs, classStudent);
162
+            classStudent.setStudentid(studentid);
163
+            classStudents.add(classStudent);
164
+
165
+            TGroupStudent groupStudent = new TGroupStudent();
166
+            BeanUtils.copyProperties(gs, groupStudent);
167
+            groupStudent.setStudentid(studentid);
168
+            groupStudents.add(groupStudent);
169
+        }
170
+        classStudentMapper.insertList(classStudents);
171
+        groupStudentMapper.insertList(groupStudents);
172
+        updateNum2(classid);
173
+    }
174
+
175
+    public TClassStudent getByClassIdStudentId(Integer classid,Integer studentid){
176
+        return classStudentMapper.getByClassIdStudentId(classid,studentid);
177
+    }
178
+
179
+    public List<Integer> listClassidsByGradeid(Integer gradeid,Integer schoolid){
180
+        return classMapper.listClassidsByGradeid(gradeid,schoolid);
181
+    }
182
+
183
+    //根据班级名称获取班级信息
184
+    public TClass getByName(TClass tClass) {
185
+        return classMapper.getByName(tClass);
186
+    }
187
+
188
+    //获取任教老师列表
189
+    public List<String> listTeacher(Integer classid) {
190
+        return classMapper.listTeacher(classid);
191
+    }
192
+
193
+    //修改班级类型
194
+    public Integer updateClasstype(Integer classid, Integer classtype){
195
+        return classMapper.updateClasstype(classid, classtype);
196
+    }
197
+
198
+    public Integer updateClassstateByClassid(Integer classid,Integer classstate){
199
+        return classMapper.updateClassstateByClassid(classid, classstate);
200
+    }
201
+}

+ 528
- 0
suser/src/main/java/com/xhkjedu/suser/service/gradeclass/ClassStudentService.java View File

@@ -0,0 +1,528 @@
1
+package com.xhkjedu.suser.service.gradeclass;
2
+
3
+import com.xhkjedu.config.MissingParametersException;
4
+import com.xhkjedu.suser.mapper.gradeclass.ClassMapper;
5
+import com.xhkjedu.suser.mapper.gradeclass.ClassStudentMapper;
6
+//import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
7
+//import com.xhkjedu.suser.mapper.liveplay.CourseMapper;
8
+//import com.xhkjedu.suser.model.liveplay.LCourse;
9
+import com.xhkjedu.suser.model.gradeclass.TClassStudent;
10
+import com.xhkjedu.suser.model.gradeclass.TGroupStudent;
11
+import com.xhkjedu.suser.model.system.TUser;
12
+import com.xhkjedu.suser.service.system.UserService;
13
+import com.xhkjedu.utils.N_Utils;
14
+import com.xhkjedu.suser.utils.PoiUtils;
15
+import com.xhkjedu.vo.ResultVo;
16
+import com.xhkjedu.suser.vo.gradeclass.ClassStudentVo;
17
+import com.xhkjedu.suser.vo.gradeclass.ClassVo;
18
+import com.xhkjedu.suser.vo.gradeclass.ImportStudentVo;
19
+import lombok.extern.slf4j.Slf4j;
20
+import org.springframework.stereotype.Service;
21
+import org.springframework.transaction.annotation.Transactional;
22
+import org.springframework.util.CollectionUtils;
23
+import org.springframework.web.multipart.MultipartFile;
24
+
25
+import javax.annotation.Resource;
26
+import java.util.ArrayList;
27
+import java.util.List;
28
+import java.util.Map;
29
+
30
+/**
31
+ * @author ywx
32
+ * @classname TClassStudentService
33
+ * @description 
34
+ * @date 2020/6/2 15:53
35
+ **/
36
+@Service
37
+@Slf4j
38
+public class ClassStudentService {
39
+    @Resource
40
+    private ClassStudentMapper classStudentMapper;
41
+    @Resource
42
+    private UserService userService;
43
+    @Resource
44
+    private GroupStudentService groupStudentService;
45
+    @Resource
46
+    private ClassMapper classMapper;
47
+    //@Resource
48
+    //private SchoolMapper schoolMapper;
49
+    //@Resource
50
+    //private CourseMapper courseMapper;
51
+
52
+    //批量添加
53
+    public void batchAdd(List<TClassStudent> students) throws Exception {
54
+        for (TClassStudent student : students) {
55
+            save(student);
56
+        }
57
+    }
58
+
59
+    //班级学生批量添加-取消的删除
60
+    public void batchAdd2(Integer classid, List<Integer> newStuIds) throws Exception {
61
+        List<Integer> studentIds = classStudentMapper.listStudentIdByClassId(classid);//班级原有学生
62
+        for (Integer studentid : newStuIds) {
63
+            if (!N_Utils.numInList(studentid,studentIds)) {//新添加的学生
64
+                save2(classid, studentid);
65
+            }
66
+        }
67
+        for (Integer studentId : studentIds) {
68
+            if (!N_Utils.numInList(studentId,newStuIds)) {//删除的学生
69
+                deleteById(classid, studentId);
70
+            }
71
+        }
72
+    }
73
+
74
+    //添加
75
+    @Transactional(rollbackFor = Exception.class)
76
+    public Integer save(TClassStudent model) throws Exception {
77
+        model.setCreatetime(N_Utils.getSecondTimestamp());
78
+        if (!N_Utils.isEmpty(model.getStudentno())) {
79
+            TUser user = userService.getObjByLoginName(model.getStudentno());
80
+            if (user == null) {//学生信息在用户表不存在,添加学生信息
81
+                user = new TUser();
82
+                user.setUsertype(2);
83
+                user.setUsername(model.getStudentname());
84
+                user.setLoginname(model.getStudentno());
85
+                user.setLoginpwd("123456");
86
+                user.setUsersex(model.getUsersex());
87
+                user.setStudentno(model.getStudentno());
88
+                user.setCreateid(model.getCreateid());
89
+                user.setSchoolid(model.getSchoolid());
90
+                user.setUsertime(model.getUsertime());
91
+                ResultVo vo = userService.save(user);
92
+                if (vo.getCode() != 0) throw new MissingParametersException(vo.getMsg());
93
+                user.setUserid((Integer) vo.getObj());
94
+            } else if (user.getUsertype()!=2) {
95
+                throw new Exception("禁止添加非学生账号");
96
+            } else if (!model.getSchoolid().equals(user.getSchoolid())) {
97
+                throw new Exception("禁止添加非本校学生账号");
98
+            }
99
+
100
+            model.setStudentid(user.getUserid());
101
+        }
102
+
103
+        //全体分组
104
+        ClassVo classVo = classMapper.getById(model.getClassid());
105
+        ImportStudentVo student = getNumById(model.getClassid(), model.getStudentid(), classVo.getYear());
106
+        if (classVo.getClasstype() == 1 && student.getXznum() != 0){
107
+            throw new MissingParametersException("该学生已在行政班");
108
+        }
109
+        Integer num = student.getClassnum();//班级学生数量
110
+        if (num == 0) {//学生不在该班级
111
+            model.setCreateid(classVo.getCreateid());
112
+            model.setSchoolid(classVo.getSchoolid());
113
+            classStudentMapper.insertUseGeneratedKeys(model);//添加班级学生
114
+            classMapper.updateNum(model.getClassid());//更新学生数量
115
+
116
+            //分组学生
117
+            Integer groupid = classVo.getGroupid();
118
+            TGroupStudent g = new TGroupStudent();
119
+            g.setClassid(model.getClassid());
120
+            g.setGroupid(groupid);
121
+            g.setStudentid(model.getStudentid());
122
+            g.setCreateid(model.getCreateid());
123
+            g.setSchoolid(model.getSchoolid());
124
+            groupStudentService.save(g);
125
+
126
+            //一般分组
127
+            if (!N_Utils.isEmptyInteger(model.getGroupid())) {
128
+                TGroupStudent groupStudent = new TGroupStudent();
129
+                groupStudent.setClassid(model.getClassid());
130
+                groupStudent.setGroupid(model.getGroupid());
131
+                groupStudent.setStudentid(model.getStudentid());
132
+                groupStudent.setCreateid(model.getCreateid());
133
+                groupStudent.setSchoolid(model.getSchoolid());
134
+                groupStudentService.save(groupStudent);
135
+            }
136
+        }
137
+
138
+        //2021年4月28日,张道剑建议,南华凯、张剑、王宁 共同确认不再复制预习导学信息
139
+//        guideGroupStudentMapper.copyGuideResource(model.getStudentid(), model.getClassid());//复制学生预习导学信息
140
+
141
+        //把这个学生加到此行政班、提高班相关的所有直播班中
142
+        if (classVo.getClasstype() == 1 || classVo.getClasstype() == 2) {
143
+            saveCourseStu(model.getClassid(), model.getStudentid());
144
+        }
145
+        return model.getId();
146
+    }
147
+
148
+    //把这个学生加到此行政班相关的所有直播班中
149
+    public void saveCourseStu(Integer classid, Integer studentid) {
150
+        //List<LCourse> courses = courseMapper.listXzCourse(classid);
151
+        //for (LCourse course : courses) {
152
+        //    Integer courseid = course.getCourseid();
153
+        //    saveSelection(course.getClassid(), studentid, course.getCreateid(), course.getSchoolid());
154
+        //    courseMapper.updateStuNum(courseid);
155
+        //}
156
+    }
157
+
158
+    //学生选课
159
+    public void saveSelection(Integer classid, Integer studentid, Integer teacherid, Integer schoolid) {
160
+        TClassStudent student = classStudentMapper.getByClassIdStudentId(classid, studentid);
161
+        if (student == null) {
162
+            //班级学生
163
+            TClassStudent cs = new TClassStudent();
164
+            cs.setClassid(classid);
165
+            cs.setStudentid(studentid);
166
+            cs.setCreateid(teacherid);
167
+            cs.setSchoolid(schoolid);
168
+            cs.setCreatetime(N_Utils.getSecondTimestamp());
169
+            classStudentMapper.save(cs);
170
+
171
+            //分组学生
172
+            ClassVo classVo = classMapper.getById(classid);
173
+            Integer groupid = classVo.getGroupid();
174
+            TGroupStudent gs = new TGroupStudent();
175
+            gs.setClassid(classid);
176
+            gs.setGroupid(groupid);
177
+            gs.setStudentid(studentid);
178
+            gs.setCreateid(teacherid);
179
+            gs.setSchoolid(schoolid);
180
+            gs.setCreatetime(N_Utils.getSecondTimestamp());
181
+            groupStudentService.save(gs);
182
+        }
183
+
184
+        //更新班级学生数量
185
+        classMapper.updateNum(classid);
186
+    }
187
+
188
+    //学生取消选课
189
+    public void cancelSelection(Integer classid, Integer studentid) {
190
+        classStudentMapper.deleteById(classid, studentid);
191
+        //更新班级、分组学生数量
192
+        classMapper.updateNum2(classid);
193
+    }
194
+
195
+    //删除
196
+    @Transactional(rollbackFor = Exception.class)
197
+    public void deleteById(Integer classid, Integer studentid) {
198
+        classStudentMapper.deleteById(classid, studentid);//删除班级、分组对应学生
199
+        classMapper.updateNum2(classid);//更新班级、分组学生数量
200
+        //把这个学生从此行政班、提高班关联的所有直播班移除
201
+        ClassVo classVo = classMapper.getById(classid);
202
+        if (classVo.getClasstype() == 1 || classVo.getClasstype() == 2) {
203
+            //List<LCourse> courses = courseMapper.listXzCourse(classid);
204
+            //for (LCourse course : courses) {
205
+            //    cancelSelection(course.getClassid(), studentid);
206
+            //}
207
+        }
208
+    }
209
+
210
+    //修改
211
+    public ResultVo update(TClassStudent model) {
212
+        TUser u = userService.getObjByLoginName(model.getStudentno());
213
+        if (u != null && !model.getStudentid().equals(u.getUserid())){
214
+            return new ResultVo(1,"该账号已被【"+u.getUsername()+"】占用");
215
+        }
216
+        //修改学生信息
217
+        TUser user = new TUser();
218
+        user.setUserid(model.getStudentid());
219
+        user.setUsersex(model.getUsersex());
220
+        user.setUsername(model.getStudentname());
221
+        user.setStudentno(model.getStudentno());
222
+        user.setLoginname(model.getStudentno());
223
+        user.setUserphone(model.getUserphone());
224
+        user.setUsertime(model.getUsertime());
225
+        userService.update(user);
226
+        return new ResultVo(0,"修改成功");
227
+    }
228
+
229
+    //获取列表
230
+    public List <ClassStudentVo> findAll(TClassStudent student) {
231
+        setOrderField(student);
232
+        return classStudentMapper.findAll(student);
233
+    }
234
+
235
+    //班级学生导入
236
+    @Transactional(rollbackFor = Exception.class)
237
+    public ResultVo importUser(MultipartFile file, TClassStudent tClassStudent) {
238
+        Integer classid = tClassStudent.getClassid();
239
+        Integer schoolid = tClassStudent.getSchoolid();
240
+        Integer createid = tClassStudent.getCreateid();
241
+        //全体分组
242
+        ClassVo classVo = classMapper.getById(classid);
243
+        Integer groupid = classVo.getGroupid();
244
+        N_Utils.validation(new Object[]{classid,"班级id",1,schoolid,"学校id",1,createid,"创建人id",1,groupid,"分组id",1});
245
+        try {
246
+            Map<String,Object> map = PoiUtils.readExcelUser(file, 2);
247
+            List<TUser> students = (List<TUser>)map.get("users");
248
+            map.remove("users");//导入成功的学生信息不返回给前端
249
+            /*if (!CollectionUtils.isEmpty((List<TUser>)map.get("excelExisted"))) {
250
+                map.put("code",1);
251
+                return new ResultVo(0, "导入失败", map);
252
+            }*/
253
+
254
+            List<TUser> users = new ArrayList<>();
255
+            List<TClassStudent> classStudents = new ArrayList<>();
256
+            List<TGroupStudent> groupStudents = new ArrayList<>();
257
+            // 以下学生信息已存在
258
+            List<TUser> usersExisted = new ArrayList<>();
259
+            for (TUser user : students) {
260
+                TUser u = userService.getObjByLoginName(user.getLoginname());
261
+                if (null == u){
262
+                    user.setSchoolid(schoolid);
263
+                    user.setCreateid(createid);
264
+                    user.setCreatetime(N_Utils.getSecondTimestamp());
265
+                    user.setUserstate(1);
266
+                    users.add(user);
267
+                } else {
268
+                    Integer studentid = u.getUserid();
269
+                    Integer oldclassid = classStudentMapper.getClassIdByStuId(studentid);//获取学生行政班id
270
+                    if (2 != u.getUsertype() || schoolid != u.getSchoolid()){//非本校学生信息
271
+                        usersExisted.add(u);
272
+                    } else if (!classid.equals(oldclassid) && 2 == u.getUsertype() && schoolid == u.getSchoolid()){
273
+                        if (1 != u.getUserstate()){
274
+                            userService.updateState(u.getUserid(), 1);
275
+                        }
276
+                        if (oldclassid == null) {//学生不在行政班
277
+                            setStudents(classid, schoolid, createid, groupid, classStudents, groupStudents, studentid);
278
+                        } else {
279
+                            moveClass(oldclassid, classid, studentid);//学生在其他行政班转班
280
+                        }
281
+                    } else {//本班学生信息
282
+                        usersExisted.add(u);
283
+                    }
284
+                }
285
+            }
286
+
287
+            //保存用户信息
288
+            if (!CollectionUtils.isEmpty(users)) {
289
+                userService.batchSave(users);
290
+                for (TUser user : users) {
291
+                    Integer studentid = user.getId();
292
+                    setStudents(classid, schoolid, createid, groupid, classStudents, groupStudents, studentid);
293
+                }
294
+            }
295
+
296
+            //保存学生关联信息
297
+            if (!CollectionUtils.isEmpty(classStudents)) {
298
+                batchSave(classStudents);
299
+                groupStudentService.batchSave(groupStudents);
300
+                classMapper.updateNum2(classid);//更新班级、分组学生数量
301
+                for (TClassStudent classStudent : classStudents) {
302
+                    saveCourseStu(classid, classStudent.getStudentid());
303
+                }
304
+            }
305
+            map.put("usersExisted",usersExisted);
306
+            if (N_Utils.isListNotEmpty(usersExisted)){
307
+                map.put("code",1);
308
+            } else {
309
+                map.put("code",0);
310
+            }
311
+            return new ResultVo(0, "导入成功", map);
312
+        } catch (Exception e) {
313
+            log.error("导入失败 : " + e.getMessage());
314
+            return new ResultVo(1, "导入失败 : " + e.getMessage());
315
+        }
316
+    }
317
+
318
+    //提高班学生导入
319
+    public ResultVo importUser2(MultipartFile file, TClassStudent tClassStudent) {
320
+        Integer classid = tClassStudent.getClassid();
321
+        Integer schoolid = tClassStudent.getSchoolid();
322
+        Integer createid = tClassStudent.getCreateid();
323
+        //全体分组
324
+        ClassVo classVo = classMapper.getById(classid);
325
+        Integer groupid = classVo.getGroupid();
326
+        N_Utils.validation(new Object[]{classid,"班级id",1,schoolid,"学校id",1,createid,"创建人id",1,groupid,"分组id",1});
327
+        try {
328
+            Map<String,Object> map = PoiUtils.readExcelUser(file, 2);
329
+            List<TUser> students = (List<TUser>)map.get("users");
330
+            map.remove("users");//导入成功的学生信息不返回给前端
331
+
332
+            List<TClassStudent> classStudents = new ArrayList<>();
333
+            List<TGroupStudent> groupStudents = new ArrayList<>();
334
+            // 以下学生信息不存在
335
+            List<TUser> usersNotExisted = new ArrayList<>();
336
+            for (TUser user : students) {
337
+                TUser u = userService.getObjByLoginName(user.getLoginname());
338
+                if (null == u){
339
+                    user.setSchoolid(schoolid);
340
+                    user.setCreateid(createid);
341
+                    user.setCreatetime(N_Utils.getSecondTimestamp());
342
+                    user.setUserstate(1);
343
+                    usersNotExisted.add(user);
344
+                } else {
345
+                    Integer studentid = u.getUserid();
346
+                    ImportStudentVo student = getNumById(classid, studentid, classVo.getYear());
347
+                    Integer classnum = student.getClassnum();//本班级学生数量
348
+                    if (2 != u.getUsertype() || schoolid != u.getSchoolid() || 0==student.getXznum()){
349
+                        usersNotExisted.add(u);
350
+                    } else if (0 == classnum && 2 == u.getUsertype() && schoolid == u.getSchoolid()){
351
+                        if (1 != u.getUserstate()){
352
+                            userService.updateState(u.getUserid(), 1);
353
+                        }
354
+                        setStudents(classid, schoolid, createid, groupid, classStudents, groupStudents, studentid);
355
+                    }
356
+                }
357
+            }
358
+
359
+            //保存学生关联信息
360
+            if (!CollectionUtils.isEmpty(classStudents)) {
361
+                batchSave(classStudents);
362
+                groupStudentService.batchSave(groupStudents);
363
+                classMapper.updateNum2(classid);//更新班级、分组学生数量
364
+            }
365
+            map.put("usersNotExisted",usersNotExisted);
366
+            if (N_Utils.isListNotEmpty(usersNotExisted)){
367
+                map.put("code",1);
368
+            } else {
369
+                map.put("code",0);
370
+            }
371
+            return new ResultVo(0, "导入成功", map);
372
+        } catch (Exception e) {
373
+            log.error("导入失败 : " + e.getMessage());
374
+            return new ResultVo(1, "导入失败 : " + e.getMessage());
375
+        }
376
+    }
377
+
378
+    private void setStudents(Integer classid, Integer schoolid, Integer createid, Integer groupid, List<TClassStudent> classStudents, List<TGroupStudent> groupStudents, Integer studentid) {
379
+        TClassStudent cs = new TClassStudent();
380
+        cs.setClassid(classid);
381
+        cs.setStudentid(studentid);
382
+        cs.setCreateid(createid);
383
+        cs.setCreatetime(N_Utils.getSecondTimestamp());
384
+        cs.setSchoolid(schoolid);
385
+        classStudents.add(cs);
386
+
387
+        TGroupStudent gs = new TGroupStudent();
388
+        gs.setGroupid(groupid);
389
+        gs.setClassid(classid);
390
+        gs.setStudentid(studentid);
391
+        gs.setCreateid(createid);
392
+        gs.setCreatetime(N_Utils.getSecondTimestamp());
393
+        gs.setSchoolid(schoolid);
394
+        groupStudents.add(gs);
395
+    }
396
+
397
+    private void batchSave(List<TClassStudent> classStudents) {
398
+        classStudentMapper.insertList(classStudents);
399
+        //2021年4月28日,张道剑建议,南华凯、张剑、王宁 共同确认不再复制预习导学信息
400
+        /*for (TClassStudent s : classStudents) {
401
+            guideGroupStudentMapper.copyGuideResource(s.getStudentid(), s.getClassid());//复制学生预习导学信息
402
+        }*/
403
+    }
404
+
405
+    //班级学生数量
406
+    private ImportStudentVo getNumById(Integer classid, Integer studentid, Integer year) {
407
+        return classStudentMapper.getNumById(classid, studentid, year);
408
+    }
409
+
410
+    /**
411
+     * 转班
412
+     * @Param [oldclassid, classid, groupid, studentid]
413
+     * @Author ywx
414
+     * @Date 2020/6/19 10:11
415
+     * @return void
416
+     **/
417
+    @Transactional(rollbackFor = Exception.class)
418
+    public void moveClass(Integer oldclassid, Integer classid, Integer studentid) throws Exception {
419
+        deleteById(oldclassid, studentid);//删除原班级、分组对应学生;更新原班级、分组学生数量
420
+        save2(classid, studentid);//添加班级学生
421
+        saveCourseStu(classid, studentid);
422
+    }
423
+
424
+    //添加班级学生
425
+    private void save2(Integer classid, Integer studentid) {
426
+        //全体分组
427
+        ClassVo classVo = classMapper.getById(classid);
428
+        //班级学生
429
+        TClassStudent cs = new TClassStudent();
430
+        cs.setClassid(classid);
431
+        cs.setStudentid(studentid);
432
+        Integer createid = classVo.getCreateid();
433
+        cs.setCreateid(createid);
434
+        cs.setCreatetime(N_Utils.getSecondTimestamp());
435
+        Integer schoolid = classVo.getSchoolid();
436
+        cs.setSchoolid(schoolid);
437
+        classStudentMapper.insertUseGeneratedKeys(cs);//添加班级学生
438
+        classMapper.updateNum(classid);//更新学生数量
439
+
440
+        //分组学生
441
+        Integer groupid = classVo.getGroupid();
442
+        TGroupStudent g = new TGroupStudent();
443
+        g.setClassid(classid);
444
+        g.setGroupid(groupid);
445
+        g.setStudentid(studentid);
446
+        g.setCreateid(createid);
447
+        g.setSchoolid(schoolid);
448
+        groupStudentService.save(g);
449
+    }
450
+
451
+    /**
452
+     * 解除mac绑定
453
+     * @Param [studentid]
454
+     * @Author ywx
455
+     * @Date 2020/9/18 11:56
456
+     * @return void
457
+     **/
458
+    public void removeBind(Integer studentid) {
459
+        userService.removeBind(studentid);
460
+    }
461
+
462
+    /**
463
+     *功能描述 获取学生所在班级
464
+     * @author WN
465
+     * @date 2020/10/20
466
+     * @param  * @param year
467
+     * @param studentid
468
+     * @return java.util.List<com.xhkjedu.suser.vo.gradeclass.ClassVo>
469
+     */
470
+    public List<ClassVo> listClassByStudentId(Integer studentid){
471
+        //Integer year = schoolMapper.getYearByUserId(studentid);
472
+        Integer year=2021;
473
+        return classStudentMapper.listClassByStudentId(year,studentid);
474
+    }
475
+
476
+    public List<ClassStudentVo> listNoClassStu(TClassStudent student) {
477
+        setOrderField(student);
478
+        setYear(student);
479
+        return classStudentMapper.listNoClassStu(student);
480
+    }
481
+
482
+    private void setOrderField(TClassStudent student) {
483
+        String fieldname = student.getFieldname();
484
+        if (N_Utils.isEmpty(fieldname) || fieldname.equals("createtime")) {
485
+            fieldname = "cs.createtime";//按创建时间排序导入的学生分页显示会有重复
486
+            if (N_Utils.isEmpty(student.getFieldorder())) {
487
+                student.setFieldorder("desc");
488
+            }
489
+        } else if (fieldname.equals("studentname")) {
490
+            fieldname = "convert(u.username using gbk)";
491
+        } else if (fieldname.equals("studentno")) {
492
+            fieldname = "u.studentno";
493
+        }
494
+        student.setFieldname(fieldname);
495
+    }
496
+
497
+    //获取学生所在年级列表
498
+    public List<Integer> listGrade(Integer studentid) {
499
+        //Integer year = schoolMapper.getYearByUserId(studentid);
500
+        Integer year=2021;
501
+        return classStudentMapper.listGrade(studentid, year);
502
+    }
503
+
504
+    //获取全校学生列表
505
+    public List<ClassStudentVo> listAllStudents(TClassStudent student) {
506
+        return classStudentMapper.listAllStudents(student);
507
+    }
508
+
509
+    //设置年份
510
+    public void setYear(TClassStudent student) {
511
+        //Integer year = schoolMapper.getYearById(student.getSchoolid());
512
+        Integer year=2021;
513
+        student.setYear(year);
514
+    }
515
+
516
+    //删除学生所有提高班和所在提高班直播课
517
+    public ResultVo delTgStu(String loginname) {
518
+        String[] userIds = loginname.split(",");
519
+        for (String userid : userIds) {
520
+            Integer studentid = N_Utils.str2Int(userid);
521
+            List<Integer> classids = classStudentMapper.listTgClassid(studentid);//获取学生所有提高班
522
+            for (Integer classid : classids) {
523
+                deleteById(classid, studentid);
524
+            }
525
+        }
526
+        return new ResultVo(0, "取消选课成功");
527
+    }
528
+}

+ 152
- 0
suser/src/main/java/com/xhkjedu/suser/service/gradeclass/ClassTeacherService.java View File

@@ -0,0 +1,152 @@
1
+package com.xhkjedu.suser.service.gradeclass;
2
+
3
+import com.xhkjedu.config.MissingParametersException;
4
+import com.xhkjedu.suser.mapper.gradeclass.ClassTeacherMapper;
5
+//import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
6
+import com.xhkjedu.suser.model.gradeclass.TClassTeacher;
7
+import com.xhkjedu.suser.model.system.TUser;
8
+import com.xhkjedu.suser.service.system.UserService;
9
+import com.xhkjedu.utils.N_Utils;
10
+import com.xhkjedu.vo.ResultVo;
11
+import com.xhkjedu.suser.vo.gradeclass.ClassTeacherParams;
12
+import com.xhkjedu.suser.vo.gradeclass.ClassTeacherVo;
13
+import com.xhkjedu.suser.vo.gradeclass.ClassVo;
14
+import org.springframework.stereotype.Service;
15
+
16
+import javax.annotation.Resource;
17
+import java.util.List;
18
+import java.util.Map;
19
+
20
+/**
21
+ * @author ywx
22
+ * @classname TClassTeacherService
23
+ * @description 
24
+ * @date 2020/6/2 16:45
25
+ **/
26
+@Service
27
+public class ClassTeacherService {
28
+    @Resource
29
+    private ClassTeacherMapper classTeacherMapper;
30
+    @Resource
31
+    private UserService userService;
32
+    //@Resource
33
+    //private SchoolMapper schoolMapper;
34
+
35
+    //添加
36
+    public Integer save(TClassTeacher model) {
37
+        String userphone = model.getUserphone();
38
+        TUser user = userService.getObjByLoginName(userphone);
39
+        if (user == null) {//教师信息在用户表不存在,添加教师信息
40
+            user = new TUser();
41
+            user.setUsertype(1);
42
+            user.setUsername(model.getTeachername());
43
+            user.setLoginname(userphone);
44
+            user.setLoginpwd("123456");
45
+            user.setUserphone(userphone);
46
+            user.setCreateid(model.getCreateid());
47
+            user.setSchoolid(model.getSchoolid());
48
+            ResultVo vo = userService.save(user);
49
+            if (vo.getCode() != 0) throw new MissingParametersException(vo.getMsg());
50
+            user.setUserid((Integer) vo.getObj());
51
+        }
52
+        model.setTeacherid(user.getUserid());
53
+        model.setCreatetime(N_Utils.getSecondTimestamp());
54
+        classTeacherMapper.insertUseGeneratedKeys(model);//添加班级教师
55
+        return model.getId();
56
+    }
57
+
58
+    //修改
59
+    public void update(TClassTeacher model) {
60
+        //修改教师信息
61
+        TUser user = new TUser();
62
+        user.setUserid(model.getTeacherid());
63
+        user.setUsername(model.getTeachername());
64
+        String userphone = model.getUserphone();
65
+        user.setUserphone(userphone);
66
+        userService.update(user);
67
+    }
68
+
69
+    //获取详情
70
+    public TClassTeacher findById(Integer teacherid) {
71
+        return classTeacherMapper.selectByPrimaryKey(teacherid);
72
+    }
73
+
74
+    //获取列表
75
+    public List <ClassTeacherVo> findAll(TClassTeacher teacher, Integer year) {
76
+        teacher.setYear(year);
77
+        String fieldname = teacher.getFieldname();
78
+        if (N_Utils.isEmpty(fieldname) || fieldname.equals("createtime")){
79
+            fieldname = "u.createtime";
80
+            if (N_Utils.isEmpty(teacher.getFieldorder())) {
81
+                teacher.setFieldorder("desc");
82
+            }
83
+        } else if (fieldname.equals("teachername")){
84
+            fieldname = "convert(u.username using gbk)";
85
+        } else if (fieldname.equals("loginname")){
86
+            fieldname = "u.loginname";
87
+        }
88
+        teacher.setFieldname(fieldname);
89
+        return classTeacherMapper.findAll(teacher);
90
+    }
91
+
92
+    public Integer getYear(Integer schoolid) {
93
+        //return schoolMapper.getYearById(schoolid);
94
+        return 2021;
95
+    }
96
+
97
+    //当前年份教师任教班级
98
+    public List<ClassVo> listTeacherClass(Integer teacher,Integer classtype){
99
+        //Integer year = schoolMapper.getYearByUserId(teacher);
100
+        Integer year=2021;
101
+        return classTeacherMapper.listTeacherClass(teacher,year,classtype);
102
+    }
103
+    //当前年份教师任教班级
104
+    public List<ClassVo> listTeacherClass2(Integer teacher){
105
+        //Integer year = schoolMapper.getYearByUserId(teacher);
106
+        Integer year=2021;
107
+        return classTeacherMapper.listTeacherClass2(teacher,year);
108
+    }
109
+
110
+    /**
111
+     * 获取作业学生列表
112
+     * @Param [paperid]
113
+     * @Author ywx
114
+     * @Date 2020/7/10 15:51
115
+     * @return java.util.List<com.xhkjedu.suser.vo.gradeclass.ClassVo>
116
+     **/
117
+    public List<ClassVo> listPaperStudent(Integer paperid) {
118
+        return classTeacherMapper.listPaperStudent(paperid);
119
+    }
120
+
121
+    //获取作业教师列表
122
+    public List<Map> listPaperTeacher(Integer paperid, String subjectid) {
123
+        return classTeacherMapper.listPaperTeacher(paperid, subjectid);
124
+    }
125
+
126
+    /**
127
+     *功能描述 年级下所有教师
128
+     * @author WN
129
+     * @date 2021/1/23
130
+     * @param  * @param schoolid
131
+     * @param gradeid
132
+     * @return java.util.List<com.xhkjedu.model.gradeclass.TClassTeacher>
133
+     */
134
+    public List<ClassTeacherVo> listTeachersByGradeid(Integer schoolid,Integer gradeid){
135
+        //Integer year = schoolMapper.getYearById(schoolid);
136
+        Integer year=2021;
137
+        return classTeacherMapper.listTeachersByGradeid(schoolid,gradeid,year);
138
+    }
139
+
140
+    /**
141
+     *功能描述  获取年级科目下教师集合
142
+     * @author WN
143
+     * @date 2021/1/29
144
+     * @param  * @param ctp
145
+     * @return java.util.List<com.xhkjedu.suser.vo.gradeclass.ClassTeacherVo>
146
+     */
147
+    public List<ClassTeacherVo> listTeahcersBySubjectGrade(ClassTeacherParams ctp) {
148
+        //Integer year = schoolMapper.getYearById(ctp.getSchoolid());
149
+        //ctp.setYear(year);
150
+        return classTeacherMapper.listTeahcersBySubjectGrade(ctp);
151
+    }
152
+}

+ 87
- 0
suser/src/main/java/com/xhkjedu/suser/service/gradeclass/GradeService.java View File

@@ -0,0 +1,87 @@
1
+package com.xhkjedu.suser.service.gradeclass;
2
+
3
+import com.xhkjedu.suser.mapper.gradeclass.GradeMapper;
4
+//import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
5
+import com.xhkjedu.suser.model.gradeclass.TGrade;
6
+import com.xhkjedu.utils.N_Utils;
7
+import com.xhkjedu.suser.vo.gradeclass.GradeVo;
8
+import org.springframework.stereotype.Service;
9
+
10
+import javax.annotation.Resource;
11
+import java.util.List;
12
+
13
+/**
14
+ * @author ywx
15
+ * @classname TGradeService
16
+ * @description 
17
+ * @date 2020/6/2 14:53
18
+ **/
19
+@Service
20
+public class GradeService {
21
+    @Resource
22
+    private GradeMapper gradeMapper;
23
+    //@Resource
24
+    //private SchoolMapper schoolMapper;
25
+
26
+    //添加
27
+    public Integer save(TGrade model) {
28
+        model.setCreatetime(N_Utils.getSecondTimestamp());
29
+        gradeMapper.insertUseGeneratedKeys(model);
30
+        return model.getId();
31
+    }
32
+
33
+    //删除
34
+    public Integer deleteById(Integer gradeid) {
35
+        return gradeMapper.deleteByPrimaryKey(gradeid);
36
+    }
37
+
38
+    //修改
39
+    public Integer update(TGrade model) {
40
+        return gradeMapper.updateByPrimaryKeySelective(model);
41
+    }
42
+
43
+    //获取详情
44
+    public TGrade findById(Integer gradeid) {
45
+        return gradeMapper.findById(gradeid);
46
+    }
47
+
48
+    //获取列表
49
+    public List <TGrade> findAll(Integer schoolid) {
50
+        //Integer year = schoolMapper.getYearById(schoolid);
51
+        Integer year = 2021;
52
+        return gradeMapper.findAll(schoolid, year);
53
+    }
54
+
55
+    /**
56
+     * 获取通知班级列表
57
+     * @Param [schoolid, year]
58
+     * @Author ywx
59
+     * @Date 2020/6/13 15:41
60
+     * @return java.util.List<com.xhkjedu.suser.vo.gradeclass.GradeVo>
61
+     **/
62
+    public List<GradeVo> listClass(Integer schoolid,Integer classtype) {
63
+        //Integer year = schoolMapper.getYearById(schoolid);
64
+        Integer year = 2021;
65
+        return gradeMapper.listClass(schoolid, year,classtype);
66
+    }
67
+
68
+    /**
69
+     * 获取通知教师列表
70
+     * @Param [schoolid, year]
71
+     * @Author ywx
72
+     * @Date 2020/6/13 15:42
73
+     * @return java.util.List<com.xhkjedu.suser.vo.gradeclass.GradeVo>
74
+     **/
75
+    public List<GradeVo> listTeacher(Integer schoolid) {
76
+        //Integer year = schoolMapper.getYearById(schoolid);
77
+        Integer year = 2021;
78
+        return gradeMapper.listTeacher(schoolid, year);
79
+    }
80
+
81
+    //获取行政班和提高班
82
+    public List<GradeVo> listClassForTeacher(Integer schoolid) {
83
+        //Integer year = schoolMapper.getYearById(schoolid);
84
+        Integer year = 2021;
85
+        return gradeMapper.listClassForTeacher(schoolid,year);
86
+    }
87
+}

+ 75
- 0
suser/src/main/java/com/xhkjedu/suser/service/gradeclass/GroupService.java View File

@@ -0,0 +1,75 @@
1
+package com.xhkjedu.suser.service.gradeclass;
2
+
3
+import com.xhkjedu.suser.mapper.gradeclass.GroupMapper;
4
+//import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
5
+import com.xhkjedu.suser.model.gradeclass.TGroup;
6
+import com.xhkjedu.utils.N_Utils;
7
+import com.xhkjedu.suser.vo.gradeclass.ClassGroupVo;
8
+import org.springframework.stereotype.Service;
9
+
10
+import javax.annotation.Resource;
11
+import java.util.List;
12
+
13
+/**
14
+ * @author ywx
15
+ * @classname GroupService
16
+ * @description 
17
+ * @date 2020/6/2 17:26
18
+ **/
19
+@Service
20
+public class GroupService {
21
+    @Resource
22
+    private GroupMapper groupMapper;
23
+    @Resource
24
+    private GroupStudentService groupStudentService;
25
+    //@Resource
26
+    //private SchoolMapper schoolMapper;
27
+
28
+    //添加
29
+    public Integer save(TGroup model) {
30
+        model.setGroupnum(0);
31
+        model.setCreatetime(N_Utils.getSecondTimestamp());
32
+        groupMapper.insertUseGeneratedKeys(model);
33
+        if (N_Utils.isListNotEmpty(model.getStudents())){
34
+            model.setGroupid(model.getId());
35
+            groupStudentService.batchSave(model);//批量添加分组学生
36
+        }
37
+        return model.getId();
38
+    }
39
+
40
+    //删除
41
+    public Integer deleteById(Integer groupid) {
42
+        return groupMapper.deleteByPrimaryKey(groupid);
43
+    }
44
+
45
+    //修改
46
+    public Integer update(TGroup model) {
47
+        if (N_Utils.isListEmpty(model.getStudents())){//如果分组学生为空直接删除分组
48
+            return deleteById(model.getGroupid());
49
+        }
50
+        groupStudentService.deleteByGroupId(model.getGroupid());//先删除分组学生
51
+        if (N_Utils.isListNotEmpty(model.getStudents())){
52
+            groupStudentService.batchSave(model);//在批量添加分组学生
53
+        }
54
+        updateNum(model.getGroupid());//更新分组人数
55
+        model.setGroupnum(null);
56
+        return groupMapper.updateByPrimaryKeySelective(model);
57
+    }
58
+
59
+    //获取列表
60
+    public List <TGroup> findAll(Integer classid, Integer createid) {
61
+        return groupMapper.findAll(classid, createid);
62
+    }
63
+
64
+    //更新分组人数
65
+    public void updateNum(Integer groupid) {
66
+        groupMapper.updateNum(groupid);
67
+    }
68
+
69
+    //教师分组列表
70
+    public List<ClassGroupVo> teacherList(Integer teacherid) {
71
+        //Integer year = schoolMapper.getYearByUserId(teacherid);
72
+        Integer year=2022;
73
+        return groupMapper.teacherList(teacherid, year);
74
+    }
75
+}

+ 77
- 0
suser/src/main/java/com/xhkjedu/suser/service/gradeclass/GroupStudentService.java View File

@@ -0,0 +1,77 @@
1
+package com.xhkjedu.suser.service.gradeclass;
2
+
3
+import com.xhkjedu.suser.mapper.gradeclass.GroupMapper;
4
+import com.xhkjedu.suser.mapper.gradeclass.GroupStudentMapper;
5
+import com.xhkjedu.suser.model.gradeclass.TGroup;
6
+import com.xhkjedu.suser.model.gradeclass.TGroupStudent;
7
+import com.xhkjedu.utils.N_Utils;
8
+import com.xhkjedu.suser.vo.gradeclass.GroupStudentVo;
9
+import org.springframework.stereotype.Service;
10
+
11
+import javax.annotation.Resource;
12
+import java.util.ArrayList;
13
+import java.util.List;
14
+
15
+/**
16
+ * @author ywx
17
+ * @classname TGroupStudentService
18
+ * @description 
19
+ * @date 2020/6/2 16:57
20
+ **/
21
+@Service
22
+public class GroupStudentService {
23
+    @Resource
24
+    private GroupStudentMapper groupStudentMapper;
25
+    @Resource
26
+    private GroupMapper groupMapper;
27
+
28
+    //添加
29
+    public Integer save(TGroupStudent model) {
30
+        model.setCreatetime(N_Utils.getSecondTimestamp());
31
+        groupStudentMapper.insertUseGeneratedKeys(model);
32
+        groupMapper.updateNum(model.getGroupid());//更新分组人数
33
+        return model.getId();
34
+    }
35
+
36
+    //批量添加
37
+    public void batchSave(TGroup group) {
38
+        Integer classid = group.getClassid();
39
+        Integer groupid = group.getGroupid();
40
+        Integer createid = group.getCreateid();
41
+        Integer schoolid = group.getSchoolid();
42
+        List<GroupStudentVo> students = group.getStudents();
43
+        List<TGroupStudent> groupStudents = new ArrayList<>();
44
+        for (GroupStudentVo student : students) {
45
+            TGroupStudent gs = new TGroupStudent();
46
+            gs.setClassid(classid);
47
+            gs.setGroupid(groupid);
48
+            gs.setStudentid(student.getStudentid());
49
+            gs.setCreateid(createid);
50
+            gs.setSchoolid(schoolid);
51
+            gs.setCreatetime(N_Utils.getSecondTimestamp());
52
+            groupStudents.add(gs);
53
+        }
54
+        groupStudentMapper.insertList(groupStudents);
55
+        groupMapper.updateNum(groupid);//更新分组人数
56
+    }
57
+
58
+    //删除
59
+    public void deleteById(TGroupStudent group) {
60
+        groupStudentMapper.deleteByPrimaryKey(group.getGsid());
61
+        groupMapper.updateNum(group.getGroupid());//更新分组人数
62
+    }
63
+
64
+    //获取列表
65
+    public List <GroupStudentVo> findAll(Integer groupid) {
66
+        return groupStudentMapper.findAll(groupid);
67
+    }
68
+
69
+    //批量添加
70
+    public void batchSave(List<TGroupStudent> groupStudents) {
71
+        groupStudentMapper.insertList(groupStudents);
72
+    }
73
+
74
+    public void deleteByGroupId(Integer groupid) {
75
+        groupStudentMapper.deleteByGroupId(groupid);
76
+    }
77
+}

+ 197
- 0
suser/src/main/java/com/xhkjedu/suser/service/system/RoleService.java View File

@@ -0,0 +1,197 @@
1
+package com.xhkjedu.suser.service.system;
2
+
3
+import com.xhkjedu.suser.mapper.system.RoleMapper;
4
+import com.xhkjedu.suser.mapper.system.RoleModuleMapper;
5
+import com.xhkjedu.suser.mapper.system.UserRoleMapper;
6
+import com.xhkjedu.suser.model.system.TRole;
7
+import com.xhkjedu.suser.model.system.TRoleModule;
8
+import com.xhkjedu.suser.model.system.TUserRole;
9
+import com.xhkjedu.utils.N_Utils;
10
+import com.xhkjedu.suser.vo.system.RoleModuleVo;
11
+import com.xhkjedu.suser.vo.system.RoleVo;
12
+import lombok.extern.slf4j.Slf4j;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.stereotype.Service;
15
+import org.springframework.transaction.annotation.Transactional;
16
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
17
+
18
+import java.util.ArrayList;
19
+import java.util.List;
20
+
21
+/**
22
+ * @ClassName RoleService
23
+ * Description TODO
24
+ * Author WN
25
+ * Date 2020/6/13 17:41
26
+ **/
27
+@Service
28
+@Slf4j
29
+public class RoleService {
30
+    @Autowired
31
+    private RoleMapper roleMapper;
32
+    @Autowired
33
+    private RoleModuleMapper roleModuleMapper;
34
+    @Autowired
35
+    private UserRoleMapper userRoleMapper;
36
+
37
+    //保存
38
+    @Transactional(rollbackFor = Exception.class)
39
+    public Integer save(TRole role) throws Exception {
40
+        try {
41
+            role.setCreatetime(N_Utils.getSecondTimestamp());
42
+            //保存角色信息
43
+            roleMapper.insertUseGeneratedKeys(role);
44
+            role.setRoleid(role.getId());
45
+
46
+            //处理角色模块信息
47
+            List<RoleModuleVo> rms = role.getModules();
48
+            if(rms!=null && rms.size()>0){
49
+                saveRoleModules(rms,role);
50
+            }
51
+
52
+            return role.getId();
53
+        } catch (Exception e) {
54
+            log.error("角色保存失败:"+e.getMessage());
55
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
56
+            throw new Exception("角色保存失败");
57
+        }
58
+    }
59
+
60
+    private void saveRoleModules(List<RoleModuleVo> rms,TRole role){
61
+        List<TRoleModule> lst = new ArrayList<>();
62
+        for(RoleModuleVo rm:rms){
63
+            TRoleModule trm = new TRoleModule();
64
+            trm.setRoleid(role.getRoleid());
65
+            trm.setModuleid(rm.getModuleid());
66
+            trm.setCreateid(role.getCreateid());
67
+            trm.setCreatetime(N_Utils.getSecondTimestamp());
68
+            trm.setSchoolid(role.getSchoolid());
69
+
70
+            lst.add(trm);
71
+
72
+            for(RoleModuleVo child : rm.getModulechilds()){
73
+                TRoleModule trm2 = new TRoleModule();
74
+                trm2.setRoleid(role.getRoleid());
75
+                trm2.setModuleid(child.getModuleid());
76
+                trm2.setCreateid(role.getCreateid());
77
+                trm2.setCreatetime(N_Utils.getSecondTimestamp());
78
+                trm2.setSchoolid(role.getSchoolid());
79
+
80
+                lst.add(trm2);
81
+            }
82
+        }
83
+
84
+        //批量保存角色模块信系
85
+        roleModuleMapper.saveBathRoleModule(lst);
86
+    }
87
+
88
+    //修改
89
+    @Transactional(rollbackFor = Exception.class)
90
+    public Integer update(TRole role) throws Exception {
91
+        try {
92
+            //先删除角色模块关联信息
93
+            roleModuleMapper.deleteByRoleid(role.getRoleid());
94
+            if(role.getModules()!=null && role.getModules().size()>0){
95
+                //重新保存模块关联信息
96
+                saveRoleModules(role.getModules(),role);
97
+            }
98
+            deleteNoRoleUserModule(role.getRoleid());//删除没有权限的用户常用模块
99
+            return roleMapper.updateByPrimaryKeySelective(role);
100
+        } catch (Exception e) {
101
+            log.error("教师修改失败:"+e.getMessage());
102
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
103
+            throw new Exception("角色修改失败");
104
+        }
105
+    }
106
+
107
+    /**
108
+     * @author ywx
109
+     * @description 删除没有权限的用户常用模块
110
+     * @date 2020/7/9 21:00
111
+     **/
112
+    private void deleteNoRoleUserModule(Integer roleid) {
113
+        List<Integer> userids = userRoleMapper.listUserId(roleid);//获取有常用模块的用户id集合
114
+        for (Integer userid : userids) {
115
+            userRoleMapper.deleteNoRoleByUserId(userid);//根据用户id删除没有权限的常用模块
116
+        }
117
+    }
118
+
119
+    //删除
120
+    public Integer del(Integer roleid){
121
+        Integer result = roleMapper.deleteByPrimaryKey(roleid);
122
+        deleteNoRoleUserModule(roleid);//删除没有权限的用户常用模块
123
+        return result;
124
+    }
125
+
126
+    //所有角色
127
+    public List<TRole> listAllRoles(Integer schoolid){
128
+        return roleMapper.listAllRoles(schoolid);
129
+    }
130
+
131
+    /**
132
+     *功能描述 角色详情包含角色下用户
133
+     * @author WN
134
+     * @date 2020/6/15
135
+     * @param  * @param roleid
136
+     */
137
+    public RoleVo getRoleDetail(Integer roleid){
138
+        RoleVo roleVo = roleMapper.getRoleDetail(roleid);
139
+        //获取角色下用户
140
+        List<TUserRole> users = userRoleMapper.listUsersByRoleid(roleid);
141
+        roleVo.setUsers(users);
142
+
143
+        //获取角色下模块信息
144
+        List<RoleModuleVo> modules = roleModuleMapper.listRoleModules(roleid);
145
+        if(modules!=null && modules.size()>0){
146
+            roleVo.setModules(listRoleModuleForTree(modules));
147
+        }
148
+
149
+        return roleVo;
150
+    }
151
+
152
+    //处理返回值为层级结果
153
+    private List<RoleModuleVo> listRoleModuleForTree(List<RoleModuleVo> modules){
154
+        List<RoleModuleVo> lst = new ArrayList<>();
155
+        for(RoleModuleVo m : modules){
156
+            if(m.getLevel()==1){
157
+                lst.add(m);
158
+            }
159
+        }
160
+
161
+        for(RoleModuleVo m : lst){
162
+            List<RoleModuleVo> childs = m.getModulechilds();
163
+            for(RoleModuleVo mc: modules){
164
+                if(m.getModuleid().equals(mc.getModulepid())){
165
+                    if(!isExistModule(childs,m.getModuleid())){
166
+                        childs.add(mc);
167
+                    }
168
+                }
169
+            }
170
+        }
171
+        return lst;
172
+    }
173
+
174
+    //判断集合中是否存在模块
175
+    private boolean isExistModule(List<RoleModuleVo> lst, String moduleid){
176
+        for(RoleModuleVo m: lst){
177
+            if(m.getModuleid().equals(moduleid)){
178
+                return true;
179
+            }
180
+        }
181
+        return false;
182
+    }
183
+
184
+    /**
185
+     *功能描述 用户有权限的所有模块
186
+     * @author WN
187
+     * @date 2020/6/15
188
+     * @param  * @param userid
189
+     * @return java.util.List<com.xhkjedu.suser.vo.system.RoleModuleVo>
190
+     */
191
+    public List<RoleModuleVo> listModulesByUserid(Integer userid){
192
+
193
+        List<RoleModuleVo> modules = roleModuleMapper.listModulesByUserid(userid);
194
+
195
+        return listRoleModuleForTree(modules);
196
+    }
197
+}

+ 223
- 0
suser/src/main/java/com/xhkjedu/suser/service/system/TeacherRoleService.java View File

@@ -0,0 +1,223 @@
1
+package com.xhkjedu.suser.service.system;
2
+
3
+import com.xhkjedu.suser.mapper.gradeclass.ClassTeacherMapper;
4
+//import com.xhkjedu.suser.mapper.subjectbook.TeacherPowersbMapper;
5
+//import com.xhkjedu.suser.mapper.subjectbook.TeacherSubjectbookMapper;
6
+import com.xhkjedu.suser.mapper.system.UserRoleMapper;
7
+import com.xhkjedu.suser.model.gradeclass.TClassTeacher;
8
+import com.xhkjedu.suser.model.subjectbook.TTeacherPowersb;
9
+import com.xhkjedu.suser.model.system.TUserRole;
10
+import com.xhkjedu.suser.vo.system.TeacherRoleVo;
11
+import com.xhkjedu.utils.N_Utils;
12
+import com.xhkjedu.suser.vo.gradeclass.ClassVo;
13
+import com.xhkjedu.suser.vo.gradeclass.GradeVo;
14
+import com.xhkjedu.suser.vo.subjectbook.LsbBookVo;
15
+import com.xhkjedu.suser.vo.subjectbook.SubjectVo;
16
+import com.xhkjedu.suser.vo.subjectbook.TeacherSubjectbookVo;
17
+import com.xhkjedu.suser.vo.system.TeacherRoleParam;
18
+import com.xhkjedu.suser.vo.system.UserRoleVo;
19
+import lombok.extern.slf4j.Slf4j;
20
+import org.springframework.beans.factory.annotation.Autowired;
21
+import org.springframework.stereotype.Service;
22
+import org.springframework.transaction.annotation.Transactional;
23
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
24
+import org.springframework.util.CollectionUtils;
25
+
26
+import javax.annotation.Resource;
27
+import java.util.ArrayList;
28
+import java.util.List;
29
+
30
+/**
31
+ * @ClassName TeacherRoleService
32
+ * Description TODO
33
+ * Author WN
34
+ * Date 2020/6/18 9:44
35
+ **/
36
+@Service
37
+@Slf4j
38
+public class TeacherRoleService {
39
+    @Autowired
40
+    private ClassTeacherMapper classTeacherMapper;
41
+
42
+    @Autowired
43
+    private UserRoleMapper userRoleMapper;
44
+
45
+    /*@Autowired
46
+    private TeacherPowersbMapper teacherPowersbMapper;
47
+
48
+    @Resource
49
+    private TeacherSubjectbookMapper teacherSubjectbookMapper;
50
+
51
+    @Autowired
52
+    private UserModuleMapper userModuleMapper;
53
+    @Resource
54
+    private SchoolMapper schoolMapper;*/
55
+
56
+    /**
57
+     *功能描述  保存教师设置权限
58
+     * @author WN
59
+     * @date 2020/6/18
60
+     * @param  * @param trole
61
+     * @return void
62
+     */
63
+    @Transactional(rollbackFor = Exception.class)
64
+    public void save(TeacherRoleParam trole) throws Exception {
65
+        try {
66
+            //Integer year = schoolMapper.getYearByUserId(trole.getTeacherid());
67
+            //trole.setYear(year);
68
+            int timestamp = N_Utils.getSecondTimestamp();
69
+            //处理用户角色
70
+            // 先删除
71
+            userRoleMapper.deleteByUserid(trole.getTeacherid());
72
+            if(!CollectionUtils.isEmpty(trole.getRolelist())){
73
+                List<TUserRole> rolelst = new ArrayList<>();
74
+                for(Integer roleid : trole.getRolelist()){
75
+                    TUserRole ur = new TUserRole();
76
+                    ur.setUserid(trole.getTeacherid());
77
+                    ur.setRoleid(roleid);
78
+                    ur.setCreatetime(timestamp);
79
+                    ur.setCreateid(trole.getCreateid());
80
+
81
+                    rolelst.add(ur);
82
+                }
83
+
84
+                //批量保存用户角色信息
85
+                userRoleMapper.insertList(rolelst);
86
+            }
87
+
88
+            //根据用户id删除没有权限的常用模块
89
+            //userModuleMapper.deleteNoRoleByUserId(trole.getTeacherid());
90
+            //
91
+            ////处理用户教材
92
+            //List<String> lsbids = teacherSubjectbookMapper.listLsbsByUserid(trole.getTeacherid());
93
+            //List<String> lsbId = N_Utils.listNotInList3(lsbids, trole.getLsblist());
94
+            //if (N_Utils.isListNotEmpty(lsbId)){//删除教师收藏教材
95
+            //    teacherSubjectbookMapper.deleteByLsbIdTeacherId(lsbId, trole.getTeacherid());
96
+            //}
97
+            ////先删除
98
+            //teacherPowersbMapper.deleteByUserid(trole.getTeacherid());
99
+            if(!CollectionUtils.isEmpty(trole.getLsblist())){
100
+                List<TTeacherPowersb> tpowerlist = new ArrayList<>();
101
+                for(String lsbid : trole.getLsblist()){
102
+                    TTeacherPowersb tp = new TTeacherPowersb();
103
+                    tp.setTeacherid(trole.getTeacherid());
104
+                    tp.setLsbid(lsbid);
105
+                    tp.setCreateid(trole.getCreateid());
106
+                    tp.setCreatetime(timestamp);
107
+                    tp.setSchoolid(trole.getSchoolid());
108
+
109
+                    tpowerlist.add(tp);
110
+                }
111
+
112
+                //teacherPowersbMapper.insertList(tpowerlist);
113
+            }
114
+
115
+            //处理用户班级
116
+            //先删除任教班级
117
+            classTeacherMapper.deleteByUserid(trole.getTeacherid(),trole.getYear());
118
+            if(!CollectionUtils.isEmpty(trole.getClasslist())){
119
+                List<TClassTeacher> ctlst = new ArrayList<>();
120
+                for(Integer classid : trole.getClasslist()){
121
+                    TClassTeacher ct = new TClassTeacher();
122
+                    ct.setTeacherid(trole.getTeacherid());
123
+                    ct.setClassid(classid);
124
+                    ct.setCreateid(trole.getCreateid());
125
+                    ct.setSchoolid(trole.getSchoolid());
126
+                    ct.setCreatetime(timestamp);
127
+
128
+                    ctlst.add(ct);
129
+                }
130
+
131
+                classTeacherMapper.insertList(ctlst);
132
+            }
133
+        } catch (Exception e) {
134
+            log.error("教师设置权限失败:"+e.getMessage());
135
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
136
+            throw new Exception("教师设置权限失败");
137
+        }
138
+
139
+    }
140
+
141
+    //获取用户权限--角色、班级、教材 集合
142
+    public TeacherRoleVo getTeacherRoles(TeacherRoleParam trparam){
143
+        //Integer year = schoolMapper.getYearByUserId(trparam.getTeacherid());
144
+        //trparam.setYear(year);
145
+        TeacherRoleVo trvo = new TeacherRoleVo();
146
+        //获取已设置角色集合
147
+        List<UserRoleVo> roleids = userRoleMapper.listRolesByUserid(trparam.getTeacherid());
148
+        List<ClassVo> classids = classTeacherMapper.listClassesByUserid(trparam.getTeacherid(),trparam.getYear(),trparam.getClasstype());
149
+        //List<TeacherSubjectbookVo> lsbids = teacherPowersbMapper.listLsbsByUserid(trparam.getTeacherid());
150
+
151
+        trvo.setRolelist(roleids);
152
+        trvo.setClasslist(classids);
153
+        //trvo.setLsblist(lsbids);
154
+
155
+        return trvo;
156
+    }
157
+
158
+    /**
159
+     * 教师权限教材列表
160
+     * @Param [teacherid]
161
+     * @Author ywx
162
+     * @Date 2020/7/1 10:42
163
+     * @return com.xhkjedu.suser.vo.system.TeacherRoleVo
164
+     **/
165
+    public TeacherRoleVo listBook(Integer teacherid) {
166
+        TeacherRoleVo trvo = new TeacherRoleVo();
167
+        //获取已设置角色集合
168
+        //List<TeacherSubjectbookVo> lsbids = teacherPowersbMapper.listLsbsByUserid(teacherid);
169
+        //trvo.setLsblist(lsbids);
170
+        return trvo;
171
+    }
172
+
173
+    /**
174
+     * 教师权限科目
175
+     * @Param [teacherid]
176
+     * @Author ywx
177
+     * @Date 2020/7/24 9:26
178
+     * @return java.util.List<com.xhkjedu.suser.vo.subjectbook.SubjectVo>
179
+     **/
180
+    public List<SubjectVo> listSubject(Integer teacherid) {
181
+        //return teacherPowersbMapper.listSubject(teacherid);
182
+        return null;
183
+    }
184
+
185
+    /**
186
+     *功能描述 教师权限科目下,权限教材
187
+     * @author WN
188
+     * @date 2020/8/11
189
+     * @param  * @param teacherid
190
+     * @param subjectid
191
+     * @return java.util.List<com.xhkjedu.suser.vo.subjectbook.LsbBookVo>
192
+     */
193
+    public List<LsbBookVo> listBookBySubjectid(Integer teacherid,String subjectid){
194
+        //return teacherPowersbMapper.listBookBySubjectid(teacherid,subjectid);
195
+        return null;
196
+    }
197
+
198
+    /**
199
+     * 教师权限班级
200
+     * @Param [teacherid, year]
201
+     * @Author ywx
202
+     * @Date 2020/7/29 9:56
203
+     * @return java.util.List<com.xhkjedu.suser.vo.gradeclass.ClassVo>
204
+     **/
205
+    public List<GradeVo> listGradeClassesByUserid(TeacherRoleParam role) {
206
+        //Integer year = schoolMapper.getYearByUserId(role.getTeacherid());
207
+        //role.setYear(year);
208
+        return classTeacherMapper.listGradeClassesByUserid(role);
209
+    }
210
+
211
+    /**
212
+     * 教师权限班级
213
+     * @Param [role]
214
+     * @Author ywx
215
+     * @Date 2021/6/15 17:41
216
+     * @return java.util.List<com.xhkjedu.suser.vo.gradeclass.GradeVo>
217
+     **/
218
+    public List<GradeVo> listGradeClassesByUserid2(TeacherRoleParam role) {
219
+        //Integer year = schoolMapper.getYearByUserId(role.getTeacherid());
220
+        //role.setYear(year);
221
+        return classTeacherMapper.listGradeClassesByUserid2(role);
222
+    }
223
+}

+ 780
- 0
suser/src/main/java/com/xhkjedu/suser/service/system/UserService.java View File

@@ -0,0 +1,780 @@
1
+package com.xhkjedu.suser.service.system;
2
+
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.suser.config.ConfigKey;
6
+//import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
7
+import com.xhkjedu.suser.mapper.system.UserMapper;
8
+import com.xhkjedu.vo.PageResult;
9
+import com.xhkjedu.suser.model.system.TMsg;
10
+import com.xhkjedu.suser.model.system.TUser;
11
+import com.xhkjedu.suser.model.system.TUserLog;
12
+import com.xhkjedu.utils.DESUtils;
13
+import com.xhkjedu.utils.DatesUtil;
14
+import com.xhkjedu.suser.utils.JedisUtil;
15
+import com.xhkjedu.utils.MD5;
16
+import com.xhkjedu.utils.N_Utils;
17
+import com.xhkjedu.utils.PageUtil;
18
+import com.xhkjedu.suser.utils.PoiUtils;
19
+import com.xhkjedu.suser.utils.SMSSender;
20
+import com.xhkjedu.vo.ResultVo;
21
+import com.xhkjedu.suser.vo.assess.AssessParams;
22
+import com.xhkjedu.suser.vo.system.TeacherVo;
23
+import com.xhkjedu.suser.vo.system.UserVo;
24
+import com.xhkjedu.suser.vo.system.ZtMsgVo;
25
+import lombok.extern.slf4j.Slf4j;
26
+import org.springframework.beans.factory.annotation.Autowired;
27
+import org.springframework.stereotype.Service;
28
+import org.springframework.util.CollectionUtils;
29
+import org.springframework.web.multipart.MultipartFile;
30
+
31
+import javax.annotation.Resource;
32
+import javax.servlet.http.HttpServletRequest;
33
+import java.net.UnknownHostException;
34
+import java.util.ArrayList;
35
+import java.util.HashMap;
36
+import java.util.List;
37
+import java.util.Map;
38
+import java.util.UUID;
39
+
40
+/**
41
+ * @ClassName UserService
42
+ * Description
43
+ * Author WN
44
+ * Date 2020/5/29 16:31
45
+ **/
46
+@Service
47
+@Slf4j
48
+public class UserService extends JedisUtil {
49
+
50
+    @Autowired
51
+    private UserMapper userMapper;
52
+    /*@Autowired
53
+    private UserLogService userLogService;
54
+    @Resource
55
+    private MsgService msgService;
56
+    @Resource
57
+    private SchoolMapper schoolMapper;*/
58
+
59
+    /**
60
+     *功能描述  根据登录名和密码获取用户信息
61
+     * @author WN
62
+     * @date 2020/6/1
63
+     * @param  * @param user
64
+     * @return com.xhkjedu.vo.ResultVo
65
+     */
66
+    public ResultVo getUserByLoginnameAndPwd(TUser user,HttpServletRequest request){
67
+        ResultVo resultVo = null;
68
+        String loginpwd = user.getLoginpwd();
69
+        setLoginPwd(user);
70
+        UserVo userVo = userMapper.getUserByLoginname(user.getLoginname());
71
+
72
+        if(userVo!=null && userVo.getUserid()>0){
73
+            //String schooldomain = userVo.getSchooldomain();
74
+            //if (checkDomain(request, schooldomain, userVo.getSchoolid())) return new ResultVo(1, "该账号不存在");
75
+            user.setUserid(userVo.getUserid());
76
+            user.setUsername(userVo.getUsername());
77
+            user.setSchoolid(userVo.getSchoolid());
78
+            if (!userVo.getLoginpwd().equals(user.getLoginpwd())) {
79
+                resultVo = new ResultVo(1, "密码错误");
80
+            } else {
81
+                if (userVo.getUsertype() == 999) {
82
+                    resultVo = new ResultVo(0, "登录成功", userVo);
83
+                } else if (userVo.getUsertype() == 2) {
84
+                    resultVo = new ResultVo(1, "禁止学生登录");
85
+                } else if(userVo.getSchoolstate()!=1){
86
+                    resultVo = new ResultVo(1,"用户所在学校暂无权限");
87
+                }else{
88
+                    if(userVo.getUserstate()!=1){
89
+                        resultVo = new ResultVo(1,"该账户无权访问,请联系老师");
90
+                    }else{
91
+                        resultVo = new ResultVo(0,"登录成功",userVo);
92
+                    }
93
+                }
94
+            }
95
+        }else{
96
+            resultVo = new ResultVo(1,"该账号不存在");
97
+        }
98
+
99
+        return getLogResultVo(user, resultVo, loginpwd, request);
100
+    }
101
+
102
+    //校验域名
103
+    private boolean checkDomain(HttpServletRequest request, String schooldomain, Integer schoolid) {
104
+        String clientlogin = request.getHeader("clientlogin");//有值不校验
105
+        if (N_Utils.isNotEmpty(clientlogin)) return false;
106
+        //origin:pc端获取到的是file://、android和手机端获取的为空、开发环境获取的是localhost
107
+        String url = request.getHeader("origin");
108
+        if (N_Utils.isEmpty(schooldomain) || N_Utils.isEmpty(url)
109
+                || url.equals("file://") || url.contains("localhost")) {
110
+            return false;
111
+        }
112
+        String domain = url.replace("https://", "").replace("http://", "");
113
+        //Integer sid = schoolMapper.getSchoolIdByDomain(domain, schoolid);
114
+        //if (!schoolid.equals(sid)) {
115
+        //    return true;
116
+        //}
117
+        return false;
118
+    }
119
+
120
+    //教师登录
121
+    public ResultVo loginTeacher(TUser user,HttpServletRequest request){
122
+        ResultVo resultVo = null;
123
+        String loginpwd = user.getLoginpwd();
124
+        setLoginPwd(user);
125
+        UserVo userVo = userMapper.getUserByLoginname(user.getLoginname());
126
+
127
+        if(userVo!=null && userVo.getUserid()>0) {
128
+            //String schooldomain = userVo.getSchooldomain();
129
+            //if (checkDomain(request, schooldomain, userVo.getSchoolid())) return new ResultVo(1, "该账号不存在");
130
+            user.setUserid(userVo.getUserid());
131
+            user.setUsername(userVo.getUsername());
132
+            user.setSchoolid(userVo.getSchoolid());
133
+            if (!userVo.getLoginpwd().equals(user.getLoginpwd())) {
134
+                resultVo = new ResultVo(1, "密码错误");
135
+            } else {
136
+                if (userVo.getUsertype() != 1) {
137
+                    resultVo = new ResultVo(1, "禁止非教师账号登录");
138
+                } else if (userVo.getSchoolstate() != 1) {
139
+                    resultVo = new ResultVo(1, "用户所在学校暂无权限");
140
+                }else{
141
+                    if(userVo.getUserstate()!=1){
142
+                        resultVo = new ResultVo(1,"该账户无权访问,请联系老师");
143
+                    }else{
144
+                        resultVo = new ResultVo(0,"登录成功",userVo);
145
+                    }
146
+                }
147
+            }
148
+        }else{
149
+            resultVo = new ResultVo(1,"该账号不存在");
150
+        }
151
+
152
+        return getLogResultVo(user, resultVo, loginpwd, request);
153
+    }
154
+
155
+    /**
156
+     * 学生登录
157
+     * @Param [user]
158
+     * @Author ywx
159
+     * @Date 2020/6/2 11:14
160
+     * @return com.xhkjedu.vo.ResultVo
161
+     **/
162
+    public ResultVo loginStudent(TUser user, HttpServletRequest request){
163
+        ResultVo resultVo = null;
164
+        String loginpwd = user.getLoginpwd();
165
+        setLoginPwd(user);
166
+        String mac = user.getMac();
167
+        UserVo userVo = userMapper.getUserByLoginnameMac(user.getLoginname(),mac);
168
+
169
+        if(userVo!=null && userVo.getUserid()>0) {
170
+            //String schooldomain = userVo.getSchooldomain();
171
+            //if (checkDomain(request, schooldomain, userVo.getSchoolid())) return new ResultVo(1, "该账号不存在");
172
+            Integer sbindmac = userVo.getSbindmac();
173
+            user.setUserid(userVo.getUserid());
174
+            user.setUsername(userVo.getUsername());
175
+            user.setSchoolid(userVo.getSchoolid());
176
+            if (!userVo.getLoginpwd().equals(user.getLoginpwd())) {
177
+                resultVo = new ResultVo(1, "密码错误");
178
+            } else {
179
+                if (userVo.getUsertype() != 2) {
180
+                    resultVo = new ResultVo(1, "登录失败,仅允许学生登录");
181
+                } else if (userVo.getXznum() == 0) {
182
+                    resultVo = new ResultVo(1,"该账号未分配班级");
183
+                } else if (sbindmac == 1 && N_Utils.isNotEmpty(mac)) {
184
+                    if (N_Utils.isNotEmpty(userVo.getMac()) && !mac.equals(userVo.getMac())) {
185
+                        resultVo = new ResultVo(1, "登录失败,该账号已与其他设备关联");
186
+                    } else {
187
+                        //20211221添加注释,sql语句修改了,不绑定的情况下会出现一个mac可以绑定多个帐号,绑定情况下没问题
188
+                        if (N_Utils.isNotEmpty(userVo.getMacname()) && !userVo.getMacname().equals(user.getLoginname())) {
189
+                            resultVo = new ResultVo(1, "登录失败,该设备已与其他账号关联");
190
+                        } else {
191
+                            resultVo = new ResultVo(0, "登录成功", userVo);
192
+                        }
193
+                    }
194
+                } else {
195
+                    resultVo = new ResultVo(0, "登录成功", userVo);
196
+                }
197
+                //更新学生硬件绑定信息
198
+                userVo.setMac(mac);
199
+                userVo.setBindmac(sbindmac);
200
+                userMapper.updateBindMac(userVo);
201
+            }
202
+        }else{
203
+            resultVo = new ResultVo(1,"该账号不存在");
204
+        }
205
+
206
+        return getLogResultVo(user, resultVo, loginpwd, request);
207
+    }
208
+
209
+    /**
210
+     * 登录日志
211
+     * @Param [loginname, device, user, result]
212
+     * @Author ywx
213
+     * @Date 2020/6/2 11:08
214
+     * @return com.xhkjedu.vo.ResultVo
215
+     **/
216
+    private ResultVo getLogResultVo(TUser user, ResultVo result, String loginpwd, HttpServletRequest request) {
217
+        String loginname = user.getLoginname();
218
+        TUserLog userLog = new TUserLog();
219
+        userLog.setLoginname(loginname);
220
+        if (result.getCode() == 0) {
221
+            UserVo userVo = (UserVo) result.getObj();
222
+            String usertime = userVo.getUsertime();
223
+            if (N_Utils.isNotEmpty(usertime)) {
224
+                String dayBegin = DatesUtil.getDayBegin();
225
+                if (usertime.compareTo(dayBegin) < 0) {
226
+                    result.setCode(1);
227
+                    result.setMsg("账号已过有效期,请联系管理员");
228
+                    return result;
229
+                }
230
+            }
231
+
232
+            //redis
233
+            String ticketKey = UUID.randomUUID().toString().replace("-", "");
234
+            String token = DESUtils.encrypt(ticketKey, ConfigKey.secretKey);//加密
235
+            String key = userVo.getCloudcode()+"_"+userVo.getUserid()+"_"+user.getUltype();
236
+            Boolean redis_rtn = set(key, token, ConfigKey.redisdatatime);
237
+            if(!redis_rtn){
238
+                result.setCode(1);
239
+                result.setMsg("加入缓存出错!");
240
+                return result;
241
+            } else {
242
+                userLog.setLoginstate(1);
243
+                userLog.setLogtxt("登录成功");
244
+                userVo.setToken_key(key);
245
+                userVo.setToken_value(token);
246
+                result.setObj(userVo);
247
+            }
248
+        } else {
249
+            userLog.setLoginstate(2);
250
+            userLog.setLogtxt(result.getMsg()+",密码:"+loginpwd);
251
+        }
252
+        try {
253
+            userLog.setUserid(user.getUserid());
254
+            userLog.setUsername(user.getUsername());
255
+            userLog.setSchoolid(user.getSchoolid());
256
+            userLog.setLogip(user.getLogip());
257
+            userLog.setLogaddress(user.getLogaddress());
258
+            userLog.setUltype(user.getUltype());
259
+            userLog.setVersionnum(user.getVersionnum());
260
+            userLog.setLogtime(N_Utils.getSecondTimestamp());
261
+            userMapper.saveUserLog(userLog);
262
+        } catch (Exception e) {
263
+            log.error("添加登录日志失败:" + e.getMessage());
264
+            result = new ResultVo(1, "保存失败");
265
+        }
266
+        return result;
267
+    }
268
+
269
+    /**
270
+     * 添加用户信息
271
+     * @Param [user]
272
+     * @Author ywx
273
+     * @Date 2020/6/2 9:45
274
+     * @return com.xhkjedu.vo.ResultVo
275
+     **/
276
+    public ResultVo save(TUser user) {
277
+        Integer schoolid = user.getSchoolid();
278
+        /*Integer usernum = schoolMapper.getUserNumById(schoolid);
279
+        if (usernum != null) {
280
+            Integer usernum2 = userMapper.getUserNumBySchoolId(schoolid);
281
+            usernum2 = usernum2 + 1;//学校账号数量+本次添加的人
282
+            if (usernum.compareTo(usernum2) == -1) {
283
+                return new ResultVo(1,"账号数量已超限,请联系管理员");
284
+            }
285
+        }*/
286
+        user.setUserstate(1);
287
+        user.setCreatetime(N_Utils.getSecondTimestamp());
288
+        setLoginPwd(user);
289
+//        userMapper.insertSelective(user);
290
+        userMapper.insertUseGeneratedKeys(user);
291
+        return new ResultVo(0, "保存成功",user.getId());
292
+    }
293
+
294
+    /**
295
+     * 修改用户信息
296
+     * @Param [user]
297
+     * @Author ywx
298
+     * @Date 2020/6/2 9:51
299
+     * @return com.xhkjedu.vo.ResultVo
300
+     **/
301
+    public ResultVo update(TUser user) {
302
+        if (N_Utils.isNotEmpty(user.getLoginpwd())) {
303
+            setLoginPwd(user);
304
+        }
305
+        String loginname = user.getLoginname();
306
+        if (N_Utils.isNotEmpty(loginname)) {
307
+            TUser user1 = getObjByLoginName(loginname);
308
+            //登录账号改变并且和别的账号冲突
309
+            if (user1!=null && !user1.getUserid().equals(user.getUserid())) {
310
+                return new ResultVo(1,"此用户已存在,请更换!");
311
+            }
312
+        }
313
+        user.setCreatetime(N_Utils.getSecondTimestamp());
314
+        userMapper.updateByPrimaryKeySelective(user);
315
+        return new ResultVo(0,"修改成功");
316
+    }
317
+
318
+    private void setLoginPwd(TUser user) {
319
+        MD5 m = new MD5();
320
+        String loginpwd = m.getMD5ofStr(m.getMD5ofStr(m.getMD5ofStr(user.getLoginpwd())));
321
+        user.setLoginpwd(loginpwd);
322
+    }
323
+
324
+    /**
325
+     * 删除用户
326
+     * @Param [user]
327
+     * @Author ywx
328
+     * @Date 2020/6/2 9:59
329
+     * @return com.xhkjedu.vo.ResultVo
330
+     **/
331
+    public ResultVo deleteById(TUser user) {
332
+        user.setDeletetime(N_Utils.getSecondTimestamp());
333
+        userMapper.deleteById(user);
334
+        return new ResultVo(0,"删除成功");
335
+    }
336
+
337
+    /**
338
+     * 获取用户列表
339
+     * @Param [user]
340
+     * @Author ywx
341
+     * @Date 2020/6/2 10:06
342
+     * @return com.xhkjedu.vo.ResultVo
343
+     **/
344
+    public ResultVo findAll(TUser user) {
345
+        PageHelper.startPage(user.getPage(), user.getPageSize());
346
+        List<UserVo> list = userMapper.findAll(user);
347
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
348
+        return new ResultVo(0,"获取列表成功", pageResult);
349
+    }
350
+
351
+    /**
352
+     * 获取用户详情
353
+     * @Param [userid]
354
+     * @Author ywx
355
+     * @Date 2020/6/2 10:23
356
+     * @return com.xhkjedu.vo.ResultVo
357
+     **/
358
+    public ResultVo findById(Integer userid) {
359
+        UserVo userVo = userMapper.findById(userid);
360
+        return new ResultVo(0,"获取详情成功", userVo);
361
+    }
362
+
363
+    /**
364
+     * 修改用户密码
365
+     * @Param [user]
366
+     * @Author ywx
367
+     * @Date 2020/6/2 10:30
368
+     * @return com.xhkjedu.vo.ResultVo
369
+     **/
370
+    public ResultVo updatePwd(TUser user) {
371
+        UserVo userVo = userMapper.findById(user.getUserid());
372
+
373
+        String oldpwd = this.md5pwd(user.getOldpwd());
374
+        if(userVo.getLoginpwd().equals(oldpwd)){
375
+            setLoginPwd(user);
376
+            userMapper.updatePwd(user);
377
+            return new ResultVo(0,"修改成功");
378
+        }else{
379
+            return new ResultVo(1,"原密码错误");
380
+        }
381
+
382
+    }
383
+
384
+    /**
385
+     * 修改用户头像
386
+     * @Param [user]
387
+     * @Author ywx
388
+     * @Date 2020/6/2 10:37
389
+     * @return com.xhkjedu.vo.ResultVo
390
+     **/
391
+    public ResultVo updateHeadPic(TUser user) {
392
+        userMapper.updateHeadPic(user);
393
+        return new ResultVo(0,"修改成功");
394
+    }
395
+
396
+    /**
397
+     * 检查登录账号是否存在
398
+     * @Param [loginname]
399
+     * @Author ywx
400
+     * @Date 2020/6/2 10:44
401
+     * @return com.xhkjedu.vo.ResultVo
402
+     **/
403
+    public ResultVo checkLoginName(String loginname) {
404
+        Integer num = userMapper.checkLoginName(loginname);
405
+        if (num != 0){
406
+            return new ResultVo(1,"此用户已存在,请更换!");
407
+        } else {
408
+            return new ResultVo(0, "检查登录账号是否存在成功");
409
+        }
410
+    }
411
+
412
+    public Integer getNumByLoginName(String loginname) {
413
+        Integer num = userMapper.checkLoginName(loginname);
414
+        return num;
415
+    }
416
+
417
+    /**
418
+     * 根据登录账号获取用户详情
419
+     * @Param [loginname]
420
+     * @Author ywx
421
+     * @Date 2020/6/3 9:33
422
+     * @return com.xhkjedu.model.system.TUser
423
+     **/
424
+    public TUser getObjByLoginName(String loginname) {
425
+        return userMapper.getObjByLoginName(loginname);
426
+    }
427
+
428
+    /**
429
+     * 批量添加
430
+     * @Param [users]
431
+     * @Author ywx
432
+     * @Date 2020/6/3 18:27
433
+     * @return void
434
+     **/
435
+    public void batchSave(List<TUser> users) throws Exception {
436
+        Integer schoolid = users.get(0).getSchoolid();
437
+        //Integer usernum = schoolMapper.getUserNumById(schoolid);
438
+        //if (usernum != null) {
439
+        //    Integer usernum2 = userMapper.getUserNumBySchoolId(schoolid);
440
+        //    usernum2 = usernum2 + users.size();//学校账号数量+本次添加的人
441
+        //    if (usernum.compareTo(usernum2) == -1) {
442
+        //        throw new Exception("账号数量已超限,请联系管理员");
443
+        //    }
444
+        //}
445
+        userMapper.insertList(users);
446
+    }
447
+
448
+    /**
449
+     * 修改用户状态
450
+     * @Param [userid, userstate]
451
+     * @Author ywx
452
+     * @Date 2020/6/4 9:08
453
+     * @return void
454
+     **/
455
+    public void updateState(Integer userid, int userstate) {
456
+        userMapper.updateState(userid, userstate);
457
+    }
458
+
459
+    /**
460
+     * 导入教师
461
+     * @Param [file, tUser]
462
+     * @Author ywx
463
+     * @Date 2020/6/5 8:47
464
+     * @return com.xhkjedu.vo.ResultVo
465
+     **/
466
+    public ResultVo importTeacher(MultipartFile file, TUser tUser) {
467
+        Integer schoolid = tUser.getSchoolid();
468
+        Integer createid = tUser.getCreateid();
469
+        N_Utils.validation(new Object[]{schoolid,"学校id",1,createid,"创建人id",1});
470
+        try {
471
+            Map<String,Object> map = PoiUtils.readExcelUser(file, 1);
472
+            List<TUser> teachers = (List<TUser>)map.get("users");
473
+            map.remove("users");//导入成功的教师信息不返回给前端
474
+            /*if (!CollectionUtils.isEmpty((List<TUser>)map.get("excelExisted"))) {
475
+                map.put("code",1);
476
+                return new ResultVo(0, "导入失败", map);
477
+            }*/
478
+
479
+            List<TUser> users = new ArrayList<>();
480
+            // 以下教师信息已存在
481
+            List<TUser> usersExisted = new ArrayList<>();
482
+            for (TUser user : teachers) {
483
+                TUser u = getObjByLoginName(user.getLoginname());
484
+                if (null == u){
485
+                    user.setSchoolid(schoolid);
486
+                    user.setCreateid(createid);
487
+                    user.setCreatetime(N_Utils.getSecondTimestamp());
488
+                    user.setUserstate(1);
489
+                    users.add(user);
490
+                } else {
491
+                    if (1 != u.getUsertype() || schoolid != u.getSchoolid()){
492
+                        usersExisted.add(u);
493
+                    } else {
494
+                        usersExisted.add(u);
495
+                    }
496
+                }
497
+            }
498
+
499
+            //保存用户信息
500
+            if (!CollectionUtils.isEmpty(users)) {
501
+                batchSave(users);
502
+            }
503
+            map.put("usersExisted",usersExisted);
504
+            if (N_Utils.isListNotEmpty(usersExisted)){
505
+                map.put("code",1);
506
+            } else {
507
+                map.put("code",0);
508
+            }
509
+            return new ResultVo(0, "导入成功", map);
510
+        } catch (Exception e) {
511
+            log.error("导入失败 : " + e.getMessage());
512
+            return new ResultVo(1, "导入失败 : " + e.getMessage());
513
+        }
514
+    }
515
+
516
+    private String md5pwd(String pwd){
517
+        MD5 m = new MD5();
518
+        String loginpwd = m.getMD5ofStr(m.getMD5ofStr(m.getMD5ofStr(pwd)));
519
+        return loginpwd;
520
+    }
521
+
522
+    /**
523
+     *功能描述 修改操作密码
524
+     * @author WN
525
+     * @date 2020/6/17
526
+     * @param  * @param user
527
+     * @return void
528
+     */
529
+    public void updateOpepasswordByUserId(TUser user){
530
+        String pwd = md5pwd(user.getOpepassword());
531
+        userMapper.updateOpepasswordByUserId(user.getUserid(),pwd);
532
+    }
533
+
534
+    /**
535
+     *功能描述 验证用户操作密码
536
+     * @author WN
537
+     * @date 2020/6/17
538
+     * @param  * @param user
539
+     * @return java.lang.Integer
540
+     */
541
+    public Integer getUserIdByOpepassword(TUser user){
542
+        String pwd = md5pwd(user.getOpepassword());
543
+        return userMapper.getUserIdByOpepassword(user.getUserid(),pwd);
544
+    }
545
+
546
+    /**
547
+     * 教师基本信息
548
+     * @Param [userid]
549
+     * @Author ywx
550
+     * @Date 2020/6/29 16:23
551
+     * @return com.xhkjedu.suser.vo.system.TeacherVo
552
+     **/
553
+    public TeacherVo getTeacherInfo(Integer userid, Integer classtype) {
554
+        return userMapper.getTeacherInfo(userid, classtype);
555
+    }
556
+
557
+    /**
558
+     * 重置密码
559
+     * @Param [user]
560
+     * @Author ywx
561
+     * @Date 2020/7/30 14:25
562
+     * @return com.xhkjedu.vo.ResultVo
563
+     **/
564
+    public ResultVo resetPwd(TUser user) {
565
+        setLoginPwd(user);
566
+        userMapper.updatePwd(user);
567
+        return new ResultVo(0,"重置密码成功");
568
+    }
569
+
570
+    /**
571
+     * 解除mac绑定
572
+     * @Param [studentid]
573
+     * @Author ywx
574
+     * @Date 2020/9/18 11:56
575
+     * @return void
576
+     **/
577
+    public void removeBind(Integer studentid) {
578
+        UserVo user = new UserVo();
579
+        user.setUserid(studentid);
580
+        user.setBindmac(0);
581
+        user.setMac(null);
582
+        userMapper.updateBindMac(user);
583
+    }
584
+
585
+    /**
586
+     * 生成修改码
587
+     * @Param [userphone]
588
+     * @Author ywx
589
+     * @Date 2020/10/13 15:08
590
+     * @return com.xhkjedu.vo.ResultVo
591
+     **/
592
+    public ResultVo updateCode(String userphone) {
593
+        String templateCode = "xgmm";
594
+        if (generateCode(userphone, templateCode)) return new ResultVo(1, "请输入验证码或者在5分钟之后重新点击");
595
+        return new ResultVo(0,"生成修改码成功");
596
+    }
597
+
598
+    /**
599
+     * 生成验证码
600
+     * @Param [userphone, templateCode]
601
+     * @Author ywx
602
+     * @Date 2020/5/8 10:04
603
+     * @return boolean
604
+     **/
605
+    private boolean generateCode(String userphone, String templateCode) {
606
+        //Integer msgNum = msgService.getMsgNumByUserPhone(userphone);//5分钟内发送短信次数
607
+        //if (msgNum != 0) return true;
608
+
609
+        Integer messageCode = N_Utils.messageCode();
610
+        String msgtxt = "";
611
+        if ("yhzc".equals(templateCode)){//用户注册验证码
612
+            msgtxt += "验证码"+messageCode+",您正在注册成为新用户,感谢您的支持!";
613
+        } else if ("xgmm".equals(templateCode)){//修改密码验证码
614
+            msgtxt += "验证码"+messageCode+",您正在尝试修改登录密码,请妥善保管账户信息。";
615
+        } else if ("dlqr".equals(templateCode)){//登录确认验证码
616
+            msgtxt += "验证码"+messageCode+",您正在登录,若非本人操作,请勿泄露。";
617
+        }
618
+        ZtMsgVo m = new ZtMsgVo();
619
+        m.setMobile(userphone);
620
+        m.setContent(msgtxt);
621
+        SMSSender.sendSms(m);
622
+//        SendSmsUtil.sendMsg(userphone, templateCode, messageCode);
623
+
624
+        //添加短信信息
625
+        //TMsg msg = new TMsg();
626
+        //msg.setUserphone(userphone);
627
+        //msg.setMsgcode(messageCode);
628
+        //msg.setMsgtxt(msgtxt);
629
+        //msgService.save(msg);
630
+        return false;
631
+    }
632
+
633
+    /**
634
+     * 通过短信修改密码
635
+     * @Param [user]
636
+     * @Author ywx
637
+     * @Date 2020/10/13 15:17
638
+     * @return com.xhkjedu.vo.ResultVo
639
+     **/
640
+    public ResultVo updatePwdByCode(TUser user) {
641
+        setLoginPwd(user);
642
+        ResultVo x = getCodeResultVo(user.getUserphone(), user.getMsgcode());
643
+        if (x != null) return x;
644
+        userMapper.updatePwdByCode(user);
645
+        return new ResultVo(0,"修改成功");
646
+    }
647
+
648
+    /**
649
+     * 判断验证码是否有效
650
+     * @Param [userphone, messageCode]
651
+     * @Author ywx
652
+     * @Date 2020/5/8 10:21
653
+     * @return com.xhkjedu.model.baseinfo.ResultVo
654
+     **/
655
+    private ResultVo getCodeResultVo(String userphone, Integer messageCode) {
656
+        //TMsg msg = msgService.findByUserPhoneAndCode(userphone,messageCode);//根据手机号和验证码获取短信信息
657
+        //if (msg == null) return new ResultVo(1,"验证码有误");
658
+        //int secondTimestamp = N_Utils.getSecondTimestamp() - 300;//验证码有效时间为5分钟
659
+        //if (msg.getCreatetime()<secondTimestamp) return new ResultVo(1,"验证码失效");
660
+        return null;
661
+    }
662
+
663
+    /**
664
+     * 生成登录确认码
665
+     * @Param [userphone]
666
+     * @Author ywx
667
+     * @Date 2020/10/13 15:19
668
+     * @return com.xhkjedu.vo.ResultVo
669
+     **/
670
+    public ResultVo loginCode(String userphone) {
671
+        N_Utils.validation(new Object[]{userphone,"手机号",2});
672
+        String templateCode = "dlqr";
673
+        if (generateCode(userphone, templateCode)) return new ResultVo(1, "请输入验证码或者在5分钟之后重新点击");
674
+        return new ResultVo(0,"生成登录确认码成功");
675
+    }
676
+
677
+    /**
678
+     * 验证码登录
679
+     * @Param [user]
680
+     * @Author ywx
681
+     * @Date 2020/10/13 15:36
682
+     * @return com.xhkjedu.vo.ResultVo
683
+     **/
684
+    public ResultVo loginByCode(TUser user,HttpServletRequest request) {
685
+        ResultVo resultVo = getCodeResultVo(user.getUserphone(), user.getMsgcode());
686
+        if (resultVo != null) return resultVo;
687
+        UserVo userVo = userMapper.getUserByLoginname(user.getUserphone());
688
+
689
+        if(userVo!=null && userVo.getUserid()>0){
690
+            user.setUserid(userVo.getUserid());
691
+            user.setUsername(userVo.getUsername());
692
+            user.setSchoolid(userVo.getSchoolid());
693
+            if(userVo.getUsertype()==999){
694
+                resultVo = new ResultVo(0,"登录成功",userVo);
695
+            } else if(userVo.getUsertype()==2){
696
+                resultVo = new ResultVo(1,"禁止学生登录");
697
+            } else if(userVo.getSchoolstate()!=1){
698
+                resultVo = new ResultVo(1,"用户所在学校暂无权限");
699
+            }else{
700
+                if(userVo.getUserstate()!=1){
701
+                    resultVo = new ResultVo(1,"该账户无权访问,请联系老师");
702
+                }else{
703
+                    resultVo = new ResultVo(0,"登录成功",userVo);
704
+                }
705
+            }
706
+        }else{
707
+            resultVo = new ResultVo(1,"该账号不存在");
708
+        }
709
+
710
+        return getLogResultVo(user, resultVo, user.getMsgcode()+"", request);
711
+    }
712
+
713
+    public ResultVo batchUpdatePwd(TUser user) {
714
+        setLoginPwd(user);
715
+        userMapper.batchUpdatePwd(user);
716
+        return new ResultVo(0,"修改成功");
717
+    }
718
+
719
+    public ResultVo checkLogin(Integer userid, String loginpwd) {
720
+        Map map = new HashMap();
721
+        boolean needLogin = false;
722
+        boolean needPhone = false;
723
+        TUser user = userMapper.selectByPrimaryKey(userid);
724
+        String usertime = user.getUsertime();
725
+        String dayBegin = DatesUtil.getDayBegin();
726
+        String msg = "用户信息正常";
727
+        if (!loginpwd.equals(user.getLoginpwd())) {
728
+            needLogin = true;
729
+            msg = "密码已修改,请重新登录";
730
+        }
731
+        if (!needLogin && N_Utils.isNotEmpty(usertime) && usertime.compareTo(dayBegin) < 0) {
732
+            needLogin = true;
733
+            msg = "账号已过有效期,请联系管理员";
734
+        }
735
+        if (user.getUsertype() == 2) {
736
+            needPhone = userMapper.checkUserPhone(userid);
737
+            if (!needLogin && needPhone) msg = "未绑定手机号";
738
+        }
739
+        map.put("needLogin", needLogin);
740
+        map.put("needPhone", needPhone);
741
+        return new ResultVo(0, msg, map);
742
+    }
743
+
744
+    //用户选择列表
745
+    public List<Map> listForSel(AssessParams user) {
746
+        //Integer year = schoolMapper.getYearById(user.getSchoolid());
747
+        Integer year=2021;
748
+        return userMapper.listForSel(user, year);
749
+    }
750
+
751
+    //用户名登录
752
+    public ResultVo loginByName(TUser user, HttpServletRequest request) {
753
+        ResultVo resultVo = null;
754
+        UserVo userVo = userMapper.getUserByLoginname(user.getLoginname());
755
+
756
+        if(userVo!=null && userVo.getUserid()>0){
757
+            user.setUserid(userVo.getUserid());
758
+            user.setUsername(userVo.getUsername());
759
+            user.setSchoolid(userVo.getSchoolid());
760
+            user.setUltype("p_web_t");
761
+            if(userVo.getUsertype()==999){
762
+                resultVo = new ResultVo(0,"登录成功",userVo);
763
+            } else if(userVo.getUsertype()==2){
764
+                resultVo = new ResultVo(1,"禁止学生登录");
765
+            } else if(userVo.getSchoolstate()!=1){
766
+                resultVo = new ResultVo(1,"用户所在学校暂无权限");
767
+            }else{
768
+                if(userVo.getUserstate()!=1){
769
+                    resultVo = new ResultVo(1,"该账户无权访问,请联系老师");
770
+                }else{
771
+                    resultVo = new ResultVo(0,"登录成功",userVo);
772
+                }
773
+            }
774
+        }else{
775
+            resultVo = new ResultVo(1,"该账号不存在");
776
+        }
777
+
778
+        return getLogResultVo(user, resultVo, "", request);
779
+    }
780
+}

+ 106
- 0
suser/src/main/java/com/xhkjedu/suser/utils/JedisUtil.java View File

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

+ 284
- 0
suser/src/main/java/com/xhkjedu/suser/utils/PoiUtils.java View File

@@ -0,0 +1,284 @@
1
+package com.xhkjedu.suser.utils;
2
+
3
+import com.xhkjedu.suser.model.system.TUser;
4
+import com.xhkjedu.utils.MD5;
5
+import com.xhkjedu.utils.N_Utils;
6
+import lombok.extern.slf4j.Slf4j;
7
+import org.apache.poi.hssf.usermodel.HSSFCell;
8
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
9
+import org.apache.poi.ss.usermodel.Cell;
10
+import org.apache.poi.ss.usermodel.Row;
11
+import org.apache.poi.ss.usermodel.Sheet;
12
+import org.apache.poi.ss.usermodel.Workbook;
13
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
14
+import org.springframework.stereotype.Component;
15
+import org.springframework.web.multipart.MultipartFile;
16
+
17
+import java.io.InputStream;
18
+import java.text.DecimalFormat;
19
+import java.text.SimpleDateFormat;
20
+import java.util.ArrayList;
21
+import java.util.HashMap;
22
+import java.util.List;
23
+import java.util.Map;
24
+
25
+/**
26
+ * @author ywx
27
+ * @classname PoiUtils
28
+ * @description
29
+ * @date 2020/6/3 16:33
30
+ **/
31
+@Component
32
+@Slf4j
33
+public class PoiUtils {
34
+    //2003- 版本的excel
35
+    private final static String excel2003L = ".xls";
36
+    //2007+ 版本的excel
37
+    private final static String excel2007U = ".xlsx";
38
+
39
+    /**
40
+     * 导入班级学生
41
+     *
42
+     * @return java.lang.String
43
+     * @Param [file]
44
+     * @Author ywx
45
+     * @Date 2020/6/3 16:43
46
+     **/
47
+    public static Map<String, Object> readExcelUser(MultipartFile file, Integer usertype) throws Exception {
48
+        Map<String, Object> resultMap = new HashMap<>();
49
+        try {
50
+            // 数据校验
51
+            isExcelEmpty(file);
52
+            InputStream in = file.getInputStream();
53
+            String fileName = file.getOriginalFilename();
54
+            Workbook work = getWorkbook(in, fileName);
55
+            Sheet sheet;// 分表数据
56
+            Row row;// 行数据
57
+            sheet = work.getSheetAt(0);//只取第一个sheet
58
+            if (sheet == null) {
59
+                throw new Exception("Excel第一个分表内容为空!");
60
+            }
61
+
62
+            int rows = sheet.getLastRowNum(); // 获取最后一个实际行的下标,比行数小1
63
+            int firstRowNum = sheet.getFirstRowNum(); // 获取第一个实际行的下标,(firstRowNum=0)
64
+
65
+            // 导入用户信息
66
+            List<TUser> users = new ArrayList<>();
67
+            // excel已存在学生信息
68
+//            List<TUser> excelExisted = new ArrayList<>();
69
+            Map<String,String> nameMap = new HashMap<>();
70
+
71
+            /*
72
+             * 遍历当前sheet中的所有行
73
+             * 排除第一行  第一行为标题头 不纳入遍历
74
+             */
75
+            for (int x = firstRowNum+1; x <= rows; x++) {
76
+                // 获取行
77
+                row = sheet.getRow(x);
78
+                if (row == null ){//若此行为空,则跳出循环继续下一行
79
+                    continue;
80
+                } else if (isEmptyCell(row.getCell(0)) && isEmptyCell(row.getCell(1))){
81
+                    continue;
82
+                }
83
+                TUser user = new TUser();// 每一行一个学生信息
84
+                user.setUsertype(usertype);
85
+                int firstCellNum = row.getFirstCellNum();// 每一行的第一列,(firstCellNum=0)
86
+                if (firstCellNum == 1) throw new Exception("第" + (x + 1) + "行姓名不能为空");
87
+                int lastCellNum = row.getLastCellNum();// 每一行的最后一列,获取列数,比最后一列列标大1
88
+                //遍历所有的列
89
+                for (int y = firstCellNum; y < lastCellNum; y++) {
90
+                    Cell cell = row.getCell(y);
91
+                    if (y == 0){   // 姓名
92
+                        setUserName(cell, x, user);
93
+                    } else if(y == 1){// 登录名
94
+                        if (isEmptyCell(cell) ){
95
+                            throw new Exception("第"+(x+1)+"行登录账号不能为空");
96
+                        } else{
97
+                            String loginname = getCellValue(cell);
98
+                            user.setLoginname(loginname);//登录名默认为学号
99
+                            if (2 == usertype) {//导入学生登录账号默认为学号
100
+                                user.setStudentno(loginname);
101
+                            }
102
+                            MD5 md5 = new MD5();
103
+                            user.setLoginpwd(md5.getMD5ofStr(md5.getMD5ofStr(md5.getMD5ofStr("123456"))));
104
+                        }
105
+                    } else if(y == 2){//性别
106
+                        if (isEmptyCell(cell) ){
107
+                            user.setUsersex(0);
108
+                        } else {
109
+                            String usersex = getCellValue(cell);
110
+                            if (usersex.equals("女")){
111
+                                user.setUsersex(2);
112
+                            } else {
113
+                                user.setUsersex(1);
114
+                            }
115
+                        }
116
+                    } else if(y == 3){//手机号
117
+                        setUserPhone(cell, x, user);
118
+                    } else if(y == 4){//出生日期
119
+                        if (!isEmptyCell(cell) ){
120
+                            String birthDay = getCellValue(cell);
121
+                            user.setUserbirthday(N_Utils.getDataToTimestamp(birthDay,"yyyy-MM-dd"));
122
+                        }
123
+                    } else if(y == 5){//身份证号
124
+                        if (isEmptyCell(cell) ){
125
+                            user.setCardid("");
126
+                        } else {
127
+                            user.setCardid(getCellValue(cell));
128
+                        }
129
+                    }
130
+                }
131
+
132
+                String loginname = user.getLoginname();
133
+                if (N_Utils.isNotEmpty(nameMap.get(loginname))) {
134
+//                    excelExisted.add(user);
135
+                } else {
136
+                    nameMap.put(loginname,loginname);
137
+                    users.add(user);
138
+                }
139
+            }
140
+
141
+            resultMap.put("code" , 0);
142
+            resultMap.put("users" , users);
143
+//            resultMap.put("excelExisted" , excelExisted);
144
+        }catch (Exception e){
145
+            resultMap.put("code" , 1);
146
+            resultMap.put("msg" , e.getMessage());
147
+            throw new Exception(e.getMessage());
148
+        }
149
+        return resultMap;
150
+    }
151
+
152
+    private static void setUserName(Cell cell, int x, TUser user) throws Exception {
153
+        if (isEmptyCell(cell)) {
154
+            throw new Exception("第" + (x + 1) + "行姓名不能为空");
155
+        } else {
156
+            user.setUsername(getCellValue(cell));
157
+        }
158
+    }
159
+
160
+    private static void setUserPhone(Cell cell, int x, TUser user) throws Exception {
161
+        if (isEmptyCell(cell)) {
162
+            user.setUserphone("");
163
+        } else {
164
+            String phone = getCellValue(cell);
165
+            if (!N_Utils.isPhone(phone)) {
166
+                throw new Exception("第" + (x + 1) + "行手机号不合法");
167
+            }
168
+            user.setUserphone(phone);
169
+        }
170
+    }
171
+
172
+    /**
173
+     * 根据文件后缀,自适应上传文件的版本
174
+     * @Param [inStr, fileName]
175
+     * @Author ywx
176
+     * @Date 2020/6/3 16:42
177
+     * @return org.apache.poi.ss.usermodel.Workbook
178
+     **/
179
+    public static Workbook getWorkbook(InputStream inStr, String fileName) throws Exception{
180
+        Workbook wb;
181
+        String fileType = fileName.substring(fileName.lastIndexOf("."));
182
+        if(excel2003L.equals(fileType)){
183
+            wb = new HSSFWorkbook(inStr);  //2003-
184
+        }else if(excel2007U.equals(fileType)){
185
+            wb = new XSSFWorkbook(inStr);  //2007+
186
+        }else{
187
+            throw new Exception("Excel格式解析有误!");
188
+        }
189
+        return wb;
190
+    }
191
+
192
+    /**
193
+     * 判断单元格是否是空值
194
+     * @Param [cell]
195
+     * @Author ywx
196
+     * @Date 2020/6/3 16:37
197
+     * @return java.lang.Boolean
198
+     **/
199
+    public static Boolean isEmptyCell(Cell cell){
200
+        if(cell != null){
201
+            Boolean rtn = true;
202
+            if(N_Utils.isNotEmpty(PoiUtils.getCellValue(cell))){
203
+                rtn = false;
204
+            }
205
+            return rtn;
206
+        } else {
207
+            return true;
208
+        }
209
+    }
210
+
211
+    /**
212
+     * 对表格中数值进行格式化
213
+     * @Param [cell]
214
+     * @Author ywx
215
+     * @Date 2020/6/3 16:41
216
+     * @return java.lang.Object
217
+     **/
218
+    public static String getCellValue(Cell cell){
219
+        String value = null;
220
+        DecimalFormat df = new DecimalFormat("0");  //格式化number String字符
221
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");  //日期格式化
222
+        DecimalFormat df2 = new DecimalFormat("0");  //格式化数字
223
+
224
+        switch (cell.getCellType()) {
225
+            case Cell.CELL_TYPE_STRING:
226
+                value = cell.getRichStringCellValue().getString();
227
+                break;
228
+            case Cell.CELL_TYPE_NUMERIC:
229
+                String cellStyle = cell.getCellStyle().getDataFormatString();
230
+                if("General".equals(cellStyle)){
231
+                    value = df.format(cell.getNumericCellValue());
232
+                }else if("m/d/yy".equals(cellStyle)){
233
+                    value = sdf.format(cell.getDateCellValue());
234
+                }else{
235
+                    value = df2.format(cell.getNumericCellValue());
236
+                }
237
+                break;
238
+            case Cell.CELL_TYPE_BOOLEAN:
239
+                boolean rtn = cell.getBooleanCellValue();
240
+                if (rtn){
241
+                    value = "1";//真
242
+                } else {
243
+                    value = "0";//假
244
+                }
245
+                break;
246
+            case Cell.CELL_TYPE_BLANK:
247
+                value = "";
248
+                break;
249
+            case HSSFCell.CELL_TYPE_FORMULA://读取excel公式的值
250
+                try {
251
+                    value = String.valueOf(cell.getNumericCellValue());
252
+                } catch (IllegalStateException e) {
253
+                    value = String.valueOf(cell.getRichStringCellValue());
254
+                }
255
+                break;
256
+            default:
257
+                break;
258
+        }
259
+        return N_Utils.strTrim(value);
260
+    }
261
+
262
+    /**
263
+     * 检验Excel内容是否为空
264
+     * @Param [file]
265
+     * @Author ywx
266
+     * @Date 2020/6/3 16:36
267
+     * @return void
268
+     **/
269
+    public static void isExcelEmpty(MultipartFile file) throws Exception {
270
+        if (null == file || file.isEmpty()) {
271
+            throw new Exception("文件不存在!");
272
+        }
273
+        InputStream in = file.getInputStream();
274
+        String fileName = file.getOriginalFilename();
275
+        Workbook work = getWorkbook(in, fileName);
276
+        if (null == work) {
277
+            throw new Exception("Excel内容为空!");
278
+        }
279
+        Integer sheet_size = work.getNumberOfSheets();
280
+        if (sheet_size == 0) {
281
+            throw new Exception("Excel内容为空!");
282
+        }
283
+    }
284
+}

+ 92
- 0
suser/src/main/java/com/xhkjedu/suser/utils/SMSSender.java View File

@@ -0,0 +1,92 @@
1
+package com.xhkjedu.suser.utils;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.suser.config.ConfigKey;
5
+import com.xhkjedu.utils.MD5;
6
+import com.xhkjedu.utils.N_Utils;
7
+import com.xhkjedu.suser.vo.system.ZtMsgVo;
8
+import lombok.extern.slf4j.Slf4j;
9
+
10
+import java.io.BufferedReader;
11
+import java.io.IOException;
12
+import java.io.InputStreamReader;
13
+import java.io.OutputStreamWriter;
14
+import java.net.URL;
15
+import java.net.URLConnection;
16
+
17
+@Slf4j
18
+public class SMSSender {
19
+    /**
20
+     * 发送短信
21
+     * @return java.lang.String
22
+     * @Param [msg]
23
+     * @Author ywx
24
+     * @Date 2020/12/11 16:15
25
+     **/
26
+    public static String sendSms(ZtMsgVo msg) {
27
+        msg.setUsername(ConfigKey.username);
28
+        Integer timestamp = N_Utils.getSecondTimestamp();
29
+        String tKey = timestamp.toString();
30
+        msg.setTKey(tKey);
31
+        MD5 m = new MD5();
32
+        String password = m.getMD5ofStr2(m.getMD5ofStr2(ConfigKey.password) + tKey);
33
+        msg.setPassword(password);
34
+        msg.setContent(ConfigKey.signName + msg.getContent());
35
+        String param = JSON.toJSONString(msg);
36
+        return sendPost(ConfigKey.url + "v2/sendSms", param);
37
+    }
38
+
39
+    /**
40
+     * 向指定 URL 发送POST方法的请求
41
+     * @param url   发送请求的 URL
42
+     * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
43
+     * @return 所代表远程资源的响应结果
44
+     */
45
+    public static String sendPost(String url, String param) {
46
+        OutputStreamWriter out = null;
47
+        BufferedReader in = null;
48
+        String result = "";
49
+        try {
50
+            URL realUrl = new URL(url);
51
+            // 打开和URL之间的连接
52
+            URLConnection conn = realUrl.openConnection();
53
+            // 设置通用的请求属性
54
+            conn.setRequestProperty("accept", "application/json");
55
+            conn.setRequestProperty("connection", "Keep-Alive");
56
+            conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
57
+            // 发送POST请求必须设置如下两行
58
+            conn.setDoOutput(true);
59
+            conn.setDoInput(true);
60
+            //设置请求编码格式
61
+            conn.setRequestProperty("Accept-Charset", "UTF-8");
62
+            conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
63
+            // 文件流编码设置
64
+            out = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
65
+            out.write(param);
66
+            // flush输出流的缓冲
67
+            out.flush();
68
+            // 定义BufferedReader输入流来读取URL的响应
69
+            in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
70
+            String line;
71
+            while ((line = in.readLine()) != null) {
72
+                result += line;
73
+            }
74
+        } catch (Exception e) {
75
+            log.error("发送 POST 请求出现异常!" + e.getMessage());
76
+        }
77
+        // 使用finally块来关闭输出流、输入流
78
+        finally {
79
+            try {
80
+                if (out != null) {
81
+                    out.close();
82
+                }
83
+                if (in != null) {
84
+                    in.close();
85
+                }
86
+            } catch (IOException ex) {
87
+                log.error("关闭输入输出流异常", ex.getMessage());
88
+            }
89
+        }
90
+        return result;
91
+    }
92
+}

+ 46
- 0
suser/src/main/java/com/xhkjedu/suser/utils/UserUtil.java View File

@@ -0,0 +1,46 @@
1
+package com.xhkjedu.suser.utils;
2
+
3
+import lombok.extern.slf4j.Slf4j;
4
+import org.springframework.http.HttpEntity;
5
+import org.springframework.http.HttpHeaders;
6
+import org.springframework.http.MediaType;
7
+import org.springframework.http.ResponseEntity;
8
+import org.springframework.util.MultiValueMap;
9
+import org.springframework.web.client.RestClientException;
10
+import org.springframework.web.client.RestTemplate;
11
+
12
+import java.util.ArrayList;
13
+import java.util.List;
14
+
15
+/**
16
+ * @author ywx
17
+ * @className suserUtil
18
+ * @description
19
+ * @date 2022/2/21 15:27
20
+ **/
21
+@Slf4j
22
+public class UserUtil {
23
+    /**
24
+     * 发送form-data请求返回json结果
25
+     * @Param [apiUrl, param]
26
+     * @Author ywx
27
+     * @Date 2021/5/14 17:41
28
+     * @return java.lang.String
29
+     **/
30
+    public static String sendFormData(String apiUrl, MultiValueMap<String, String> param) {
31
+        try {
32
+            HttpHeaders headers = new HttpHeaders();
33
+            headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
34
+            List<MediaType> acceptableMediaTypes = new ArrayList<>();
35
+            acceptableMediaTypes.add(MediaType.APPLICATION_FORM_URLENCODED);
36
+            acceptableMediaTypes.add(MediaType.APPLICATION_PROBLEM_JSON_UTF8);
37
+            HttpEntity<MultiValueMap<String, String>> requestParams = new HttpEntity<>(param, headers);
38
+            ResponseEntity<String> response = new RestTemplate().postForEntity(apiUrl, requestParams, String.class);
39
+            String result = response.getBody();
40
+            return result;
41
+        } catch (RestClientException e) {
42
+            log.error("发送form-data请求失败",e.getMessage());
43
+            return null;
44
+        }
45
+    }
46
+}

+ 19
- 0
suser/src/main/java/com/xhkjedu/suser/vo/assess/AssessParams.java View File

@@ -0,0 +1,19 @@
1
+package com.xhkjedu.suser.vo.assess;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @author ywx
7
+ * @classname AssessParams
8
+ * @description
9
+ * @date 2021/12/6 13:21
10
+ **/
11
+@Data
12
+public class AssessParams {
13
+    private Integer schoolid;//学校id
14
+    private Integer gradeid;//年级id
15
+    private Integer classid;//班级id
16
+    private String subjectid;//科目id
17
+    private String username;//姓名
18
+    private Integer usertype;//用户类型1老师2学生
19
+}

+ 15
- 0
suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/CStudentVo.java View File

@@ -0,0 +1,15 @@
1
+package com.xhkjedu.suser.vo.gradeclass;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class CStudentVo {
7
+    //学生id
8
+    private Integer studentid;
9
+
10
+    //学生姓名
11
+    private String studentname;
12
+
13
+    //头像
14
+    private String headpic;
15
+}

+ 21
- 0
suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/ClassGroupVo.java View File

@@ -0,0 +1,21 @@
1
+package com.xhkjedu.suser.vo.gradeclass;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+@Data
8
+public class ClassGroupVo {
9
+    //班级id
10
+    private Integer classid;
11
+
12
+    //班级名称
13
+    private String classname;
14
+
15
+    private Integer gradeid;//年级id
16
+
17
+    private Integer classnum;//班级人数
18
+
19
+    //班级分组id
20
+    private List<GroupVo> groups;
21
+}

+ 14
- 0
suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/ClassImportVo.java View File

@@ -0,0 +1,14 @@
1
+package com.xhkjedu.suser.vo.gradeclass;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+@Data
8
+public class ClassImportVo {
9
+    //班级id
10
+    private Integer classid;
11
+
12
+    //学生id列表
13
+    private List<Integer> studentIds;
14
+}

+ 57
- 0
suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/ClassStudentVo.java View File

@@ -0,0 +1,57 @@
1
+package com.xhkjedu.suser.vo.gradeclass;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class ClassStudentVo {
7
+    //班级关联学生id
8
+    private Integer csid;
9
+
10
+    //学号
11
+    private String studentno;
12
+
13
+    //学生姓名
14
+    private String studentname;
15
+
16
+    //性别1男2女
17
+    private Integer usersex;
18
+
19
+    //班级id
20
+    private Integer classid;
21
+
22
+    //学生id
23
+    private Integer studentid;
24
+
25
+    //登录账号
26
+    private String loginname;
27
+
28
+    //创建时间
29
+    private Integer createtime;
30
+
31
+    //是否绑定硬件地址0不绑定1绑定
32
+    private Integer bindmac;
33
+
34
+    //硬件地址
35
+    private String mac;
36
+
37
+    //头像地址
38
+    private String headpic;
39
+
40
+    private Integer year;//当前年份
41
+
42
+    //用户状态1正常2删除
43
+    private Integer userstate;
44
+
45
+    //班级名称
46
+    private String classname;
47
+
48
+    //所属年级
49
+    private Integer gradeid;
50
+
51
+    //手机号
52
+    private String userphone;
53
+
54
+    //有效期
55
+    private String usertime;
56
+
57
+}

+ 21
- 0
suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/ClassTeacherParams.java View File

@@ -0,0 +1,21 @@
1
+package com.xhkjedu.suser.vo.gradeclass;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @ClassName ClassTeacherParams
7
+ * Description TODO 参数
8
+ * Author WN
9
+ * Date 2021/1/29 17:26
10
+ **/
11
+@Data
12
+public class ClassTeacherParams {
13
+
14
+    private Integer schoolid;//学校id
15
+
16
+    private String subjectid;//科目id
17
+
18
+    private Integer gradeid;//年级id
19
+
20
+    private Integer year;//当前年费
21
+}

+ 30
- 0
suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/ClassTeacherVo.java View File

@@ -0,0 +1,30 @@
1
+package com.xhkjedu.suser.vo.gradeclass;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class ClassTeacherVo {
7
+    //教师id
8
+    private Integer teacherid;
9
+
10
+    //教师姓名
11
+    private String teachername;
12
+
13
+    //教师性别
14
+    private Integer usersex;
15
+
16
+    //手机号
17
+    private String userphone;
18
+
19
+    //登录账号
20
+    private String loginname;
21
+
22
+    //用户类型0学校管理员1老师
23
+    private Integer usertype;
24
+
25
+    //创建时间
26
+    private Integer createtime;
27
+
28
+    //有效期
29
+    private String usertime;
30
+}

+ 47
- 0
suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/ClassVo.java View File

@@ -0,0 +1,47 @@
1
+package com.xhkjedu.suser.vo.gradeclass;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+@Data
8
+public class ClassVo {
9
+    //班级id
10
+    private Integer classid;
11
+
12
+    //班级名称
13
+    private String classname;
14
+
15
+    //所属年级
16
+    private Integer gradeid;
17
+
18
+    //全体分组id
19
+    private Integer groupid;
20
+
21
+    //学生数量
22
+    private Integer classnum;
23
+
24
+    //班级排序
25
+    private Integer classorder;
26
+
27
+    //入学年(届)
28
+    private Integer schoolyear;
29
+
30
+    //班级类型1行政班2提高班3直播班99已直播班级
31
+    private Integer classtype;
32
+
33
+    //当前年份
34
+    private Integer year;
35
+
36
+    //创建人
37
+    private Integer createid;
38
+
39
+    //学校id
40
+    private Integer schoolid;
41
+
42
+    //作业是否完成批阅0未完成1已完成
43
+    private Integer checked;
44
+
45
+    //学生列表
46
+    private List<CStudentVo> students;
47
+}

+ 23
- 0
suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/GradeSubjectVo.java View File

@@ -0,0 +1,23 @@
1
+package com.xhkjedu.suser.vo.gradeclass;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+/**
8
+ * @author ywx
9
+ * @classname GradeSubjectVo
10
+ * @description
11
+ * @date 2020/6/13 15:35
12
+ **/
13
+@Data
14
+public class GradeSubjectVo {
15
+    //科目id
16
+    private String subjectid;
17
+
18
+    //科目名称
19
+    private String subjectname;
20
+
21
+    //教师集合
22
+    private List<ClassTeacherVo> teachers;
23
+}

+ 20
- 0
suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/GradeVo.java View File

@@ -0,0 +1,20 @@
1
+package com.xhkjedu.suser.vo.gradeclass;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+@Data
8
+public class GradeVo {
9
+    //年级表
10
+    private Integer gradeid;
11
+
12
+    //年级名称
13
+    private String gradename;
14
+
15
+    //班级集合
16
+    private List<ClassVo> classes;
17
+
18
+    //科目集合
19
+    private List<GradeSubjectVo> subjects;
20
+}

+ 27
- 0
suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/GroupStudentVo.java View File

@@ -0,0 +1,27 @@
1
+package com.xhkjedu.suser.vo.gradeclass;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class GroupStudentVo {
7
+    //分组学生id
8
+    private Integer gsid;
9
+
10
+    //分组id
11
+    private Integer groupid;
12
+
13
+    //学生id
14
+    private Integer studentid;
15
+
16
+    //学号
17
+    private String studentno;
18
+
19
+    //学生姓名
20
+    private String studentname;
21
+
22
+    //性别1男2女
23
+    private Integer usersex;
24
+
25
+    //头像地址
26
+    private String headpic;
27
+}

+ 26
- 0
suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/GroupVo.java View File

@@ -0,0 +1,26 @@
1
+package com.xhkjedu.suser.vo.gradeclass;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+@Data
8
+public class GroupVo {
9
+    //班级分组id
10
+    private Integer groupid;
11
+
12
+    //分组名称
13
+    private String groupname;
14
+
15
+    //班级id
16
+    private Integer classid;
17
+
18
+    //班级分组类型1全体2一般分组
19
+    private Integer grouptype;
20
+
21
+    //是否选中0未选中1已选中
22
+    private Integer selected;
23
+
24
+    //学生列表
25
+    private List<CStudentVo> students;
26
+}

+ 18
- 0
suser/src/main/java/com/xhkjedu/suser/vo/gradeclass/ImportStudentVo.java View File

@@ -0,0 +1,18 @@
1
+package com.xhkjedu.suser.vo.gradeclass;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class ImportStudentVo {
7
+    //班级学生总数量
8
+    private Integer totalnum;
9
+
10
+    //本班级学生数量
11
+    private Integer classnum;
12
+
13
+    //行政班数量
14
+    private Integer xznum;
15
+
16
+    //行政班id
17
+    private Integer classid;
18
+}

+ 46
- 0
suser/src/main/java/com/xhkjedu/suser/vo/paper/AStudentPaperVo.java View File

@@ -0,0 +1,46 @@
1
+package com.xhkjedu.suser.vo.paper;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class AStudentPaperVo {
7
+    //试题数量
8
+    private Integer studentid;
9
+
10
+    //学生姓名
11
+    private String studentname;
12
+
13
+    //学生账号
14
+    private String loginname;
15
+
16
+    //年级id
17
+    private Integer gradeid;
18
+
19
+    //班级名称
20
+    private String classname;
21
+
22
+    //状态0未提交1已提交2超时提交
23
+    private Integer psstate;
24
+
25
+    //试卷总分
26
+    private Double paperscore;
27
+
28
+    //用户得分
29
+    private Double userscore;
30
+
31
+    //学生姓名
32
+    private String subjectid;
33
+
34
+    //科目名称
35
+    private String subjectname;
36
+
37
+    //收到作业次数
38
+    private Integer sdnum;
39
+    //作业提交次数
40
+    private Integer commitnum;
41
+    //提交率
42
+    private double commitrate;
43
+    //得分率
44
+    private double scorerate;
45
+
46
+}

+ 42
- 0
suser/src/main/java/com/xhkjedu/suser/vo/paper/AnalyzeSearchVo.java View File

@@ -0,0 +1,42 @@
1
+package com.xhkjedu.suser.vo.paper;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class AnalyzeSearchVo {
7
+    //分页显示页码
8
+    private Integer page;
9
+
10
+    //分页显示条数
11
+    private Integer pageSize;
12
+
13
+    //年级id
14
+    private Integer gradeid;
15
+
16
+    //科目id
17
+    private String subjectid;
18
+
19
+    //班级id
20
+    private Integer classid;
21
+
22
+    //开始时间
23
+    private Integer starttime;
24
+
25
+    //结束时间
26
+    private Integer stoptime;
27
+
28
+    //学校id
29
+    private Integer schoolid;
30
+
31
+    //教师id
32
+    private Integer teacherid;
33
+
34
+    //学生id
35
+    private Integer studentid;
36
+
37
+    private Integer year;//当前年份
38
+
39
+    private Integer usertype;//用户类型999超级管理员0学校管理员1老师2学生
40
+
41
+    private String classids;//班级ids
42
+}

+ 26
- 0
suser/src/main/java/com/xhkjedu/suser/vo/subjectbook/LsbBookVo.java View File

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

+ 22
- 0
suser/src/main/java/com/xhkjedu/suser/vo/subjectbook/SubjectVo.java View File

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

+ 40
- 0
suser/src/main/java/com/xhkjedu/suser/vo/subjectbook/TeacherSubjectbookVo.java View File

@@ -0,0 +1,40 @@
1
+package com.xhkjedu.suser.vo.subjectbook;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @author ywx
7
+ * @classname TeacherSubjectbookVo
8
+ * @description 
9
+ * @date 2020/6/5 15:52
10
+ **/
11
+@Data
12
+public class TeacherSubjectbookVo {
13
+
14
+    //教师教材关系id
15
+    private Integer tbid;
16
+
17
+    //教材关联关系表id
18
+    private String lsbid;
19
+
20
+    //是否选中:0未选中1已选中
21
+    private Integer selected;
22
+
23
+    //科目id
24
+    private String subjectid;
25
+
26
+    //科目名称
27
+    private String subjectname;
28
+
29
+    //教材名称
30
+    private String lsbname;
31
+
32
+    private String coverpath;//封面图地址
33
+
34
+    //版本id
35
+    private String versionid;
36
+
37
+    //版本名称
38
+    private String versionname;
39
+
40
+}

+ 48
- 0
suser/src/main/java/com/xhkjedu/suser/vo/system/RoleModuleVo.java View File

@@ -0,0 +1,48 @@
1
+package com.xhkjedu.suser.vo.system;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.ArrayList;
6
+import java.util.List;
7
+
8
+/**
9
+ * @ClassName RoleModuleVo
10
+ * Description 角色模块表
11
+ * Author WN
12
+ * Date 2020/6/15 14:18
13
+ **/
14
+@Data
15
+public class RoleModuleVo {
16
+
17
+    private String moduleid;
18
+
19
+    //模块名称
20
+    private String modulename;
21
+
22
+    //模块简称
23
+    private String mabbrevname;
24
+
25
+    //模块地址
26
+    private String moduleurl;
27
+
28
+    //图标地址
29
+    private String moduleico;
30
+
31
+    //所属父模块id
32
+    private String modulepid;
33
+
34
+    private Integer moduletype;//模块归属1教师网页2学生网页3学生平板
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
+    //子模块
46
+    List<RoleModuleVo> modulechilds = new ArrayList<>();
47
+
48
+}

+ 31
- 0
suser/src/main/java/com/xhkjedu/suser/vo/system/RoleVo.java View File

@@ -0,0 +1,31 @@
1
+package com.xhkjedu.suser.vo.system;
2
+
3
+import com.xhkjedu.suser.model.system.TUserRole;
4
+import lombok.Data;
5
+
6
+import java.util.ArrayList;
7
+import java.util.List;
8
+
9
+/**
10
+ * @ClassName RoleVo
11
+ * Description TODO
12
+ * Author WN
13
+ * Date 2020/6/15 11:19
14
+ **/
15
+@Data
16
+public class RoleVo {
17
+    //角色id
18
+    private Integer roleid;
19
+
20
+    //角色名称
21
+    private String rolename;
22
+
23
+    //角色备注
24
+    private String comm;
25
+
26
+    //角色关联用户
27
+    private List<TUserRole> users = new ArrayList<>();
28
+
29
+    //角色下模块信息
30
+    private List<RoleModuleVo> modules = new ArrayList<>();
31
+}

+ 42
- 0
suser/src/main/java/com/xhkjedu/suser/vo/system/TeacherRoleParam.java View File

@@ -0,0 +1,42 @@
1
+package com.xhkjedu.suser.vo.system;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.ArrayList;
6
+import java.util.List;
7
+
8
+/**
9
+ * @ClassName TeacherRoleParam
10
+ * Description 教师设置权限时传输参数
11
+ * Author WN
12
+ * Date 2020/6/18 9:50
13
+ **/
14
+@Data
15
+public class TeacherRoleParam {
16
+
17
+    private Integer teacherid;//老师id
18
+
19
+    //角色
20
+    private List<Integer> rolelist = new ArrayList<>();
21
+
22
+    //教材
23
+    private List<String> lsblist = new ArrayList<>();
24
+
25
+    //班级
26
+    private List<Integer> classlist = new ArrayList<>();
27
+
28
+    private Integer createid;//创建人id
29
+
30
+    private Integer schoolid;//学校id
31
+
32
+    private Integer year;//当前年份
33
+
34
+    private String subjectid;//科目id
35
+
36
+    //班级类型1行政班2提高班3直播班
37
+    private Integer classtype;
38
+
39
+    //年级id
40
+    private Integer gradeid;
41
+}
42
+

+ 26
- 0
suser/src/main/java/com/xhkjedu/suser/vo/system/TeacherRoleVo.java View File

@@ -0,0 +1,26 @@
1
+package com.xhkjedu.suser.vo.system;
2
+
3
+import com.xhkjedu.suser.vo.gradeclass.ClassVo;
4
+import com.xhkjedu.suser.vo.subjectbook.TeacherSubjectbookVo;
5
+import lombok.Data;
6
+
7
+import java.util.ArrayList;
8
+import java.util.List;
9
+
10
+/**
11
+ * @ClassName TeacherRoleVo
12
+ * Description 教师权限查看
13
+ * Author WN
14
+ * Date 2020/6/18 9:53
15
+ **/
16
+@Data
17
+public class TeacherRoleVo {
18
+    //角色
19
+    private List<UserRoleVo> rolelist = new ArrayList<>();
20
+
21
+    //教材
22
+    private List<TeacherSubjectbookVo> lsblist = new ArrayList<>();
23
+
24
+    //班级
25
+    private List<ClassVo> classlist = new ArrayList<>();
26
+}

+ 36
- 0
suser/src/main/java/com/xhkjedu/suser/vo/system/TeacherVo.java View File

@@ -0,0 +1,36 @@
1
+package com.xhkjedu.suser.vo.system;
2
+
3
+import com.xhkjedu.suser.vo.gradeclass.ClassVo;
4
+import lombok.Data;
5
+
6
+import java.util.ArrayList;
7
+import java.util.List;
8
+
9
+/**
10
+ * @author ywx
11
+ * @classname TeacherVo
12
+ * @description 教师基本信息
13
+ * @date 2020/6/29 16:16
14
+ **/
15
+@Data
16
+public class TeacherVo {
17
+    private Integer userid;
18
+    //姓名
19
+    private String username;
20
+
21
+    //头像地址
22
+    private String headpic;
23
+
24
+    //班级名称
25
+    private String classname;
26
+
27
+    //科目名称
28
+    private String subjectname;
29
+
30
+    //有效期
31
+    private String usertime;
32
+
33
+    //教师任教班级
34
+    private List<ClassVo> classlist = new ArrayList<>();
35
+
36
+}

+ 33
- 0
suser/src/main/java/com/xhkjedu/suser/vo/system/UserModuleVo.java View File

@@ -0,0 +1,33 @@
1
+package com.xhkjedu.suser.vo.system;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @ClassName RoleModuleVo
7
+ * Description 角色模块表
8
+ * Author WN
9
+ * Date 2020/6/15 14:18
10
+ **/
11
+@Data
12
+public class UserModuleVo {
13
+    //用户常用应用
14
+    private Integer umid;
15
+
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
+    //内外部应用1内容应用2外部应用
31
+    private Integer minout;
32
+
33
+}

+ 18
- 0
suser/src/main/java/com/xhkjedu/suser/vo/system/UserRoleVo.java View File

@@ -0,0 +1,18 @@
1
+package com.xhkjedu.suser.vo.system;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @ClassName UserRoleVo
7
+ * Description 用户角色
8
+ * Author WN
9
+ * Date 2020/6/18 16:34
10
+ **/
11
+@Data
12
+public class UserRoleVo {
13
+    //角色id
14
+    private Integer roleid;
15
+
16
+    //角色名称
17
+    private String rolename;
18
+}

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

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

+ 34
- 0
suser/src/main/java/com/xhkjedu/suser/vo/system/ZtMsgVo.java View File

@@ -0,0 +1,34 @@
1
+package com.xhkjedu.suser.vo.system;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * @author ywx
7
+ * @classname ZtMsgVo
8
+ * @description 
9
+ * @date 2020/12/11 15:57
10
+ **/
11
+@Data
12
+public class ZtMsgVo {
13
+    //用户表
14
+    private Integer userid;
15
+
16
+    //用户名
17
+    private String username;
18
+
19
+    //密码
20
+    private String password;
21
+
22
+    //时间戳
23
+    private String tKey;
24
+
25
+    //手机号
26
+    private String mobile;
27
+
28
+    //短信内容
29
+    private String content;
30
+
31
+    private String time="";
32
+
33
+    private String ext="9999";
34
+}

+ 10
- 3
suser/src/main/resources/application.properties View File

@@ -26,12 +26,12 @@ spring.datasource.hikari.connection-timeout=20000
26 26
 spring.datasource.hikari.connection-test-query=SELECT 1
27 27
 
28 28
 # 所有Entity别名类所在包
29
-mybatis.type-aliases-package=com.xhkjedu.model,com.xhkjedu.vo
29
+mybatis.type-aliases-package=com.xhkjedu.suser.model,com.xhkjedu.suser.vo
30 30
 mybatis.mapper-Locations=classpath*:mapper/**/*.xml
31
-mapper.mappers=com.xhkjedu.base.TkMapper
31
+mapper.mappers=com.xhkjedu.suser.base.TkMapper
32 32
 mapper.identity=MYSQL
33 33
 #打印日志的两种方式第一种可以指定包名,第二种都可以打印
34
-logging.level.com.xhkjedu.mapper=debug
34
+logging.level.com.xhkjedu.suser.mapper=debug
35 35
 #mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
36 36
 #分页
37 37
 spring.pagehelper.helper-dialect=mysql
@@ -51,3 +51,10 @@ spring.redis.jedis.pool.max-active=60000
51 51
 redisdatatime=604800
52 52
 #secretKey必须为24位
53 53
 secretKey=nanhuakaizhangjianwangni
54
+#助通科技短信配置
55
+zt.username=xinghuo666
56
+zt.password=jUTEBk6e
57
+zt.url=http://api.mix2.zthysms.com/
58
+signName=【河南星火燎原】
59
+#郑州管城大数据SSO认证鉴权接口
60
+ssourl=http://gcdsj.zzgcjy.cn/portal/sso/api/agent

+ 98
- 0
suser/src/main/resources/mapper/gradeclass/ClassMapper.xml View File

@@ -0,0 +1,98 @@
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.suser.mapper.gradeclass.ClassMapper">
4
+    <!--班级学生列表-->
5
+    <select id="findAll" resultType="com.xhkjedu.suser.vo.gradeclass.ClassVo">
6
+        select c.classid,c.classname,c.gradeid,c.classnum,tg.groupid,c.classorder,c.schoolyear,c.classtype
7
+        from t_class c left join t_group tg on c.classid = tg.classid
8
+        where tg.grouptype=1
9
+        and c.schoolid=#{tClass.schoolid} and c.year=#{tClass.year}
10
+        <if test="tClass.classname!=null and tClass.classname!=''">
11
+            and c.classname like '%${tClass.classname}%'
12
+        </if>
13
+        <if test="tClass.classstate!=null and tClass.classstate!=0">
14
+            and c.classstate=#{tClass.classstate}
15
+        </if>
16
+        <if test="tClass.classtype!=null and tClass.classtype!=0">
17
+            <if test="tClass.classtype!=11">and c.classtype=#{tClass.classtype}</if>
18
+            <if test="tClass.classtype==11">and c.classtype in(1,2)</if>
19
+        </if>
20
+        <if test="tClass.gradeid!=null and tClass.gradeid!=0">
21
+            and c.gradeid=#{tClass.gradeid}
22
+        </if>
23
+        order by c.gradeid,c.classtype,c.classorder
24
+    </select>
25
+    <!--更新学生数量-->
26
+    <update id="updateNum">
27
+        update t_class c set c.classnum=
28
+        (select count(*) from t_class_student cs where cs.classid=#{classid})
29
+        where c.classid=#{classid}
30
+    </update>
31
+    <!--更新班级、分组学生数量-->
32
+    <update id="updateNum2">
33
+        update t_class c left join t_group g on g.classid=c.classid
34
+        ,(SELECT COUNT(*)num FROM t_class_student cs where cs.classid=#{classid})a
35
+        set c.classnum=a.num,g.groupnum=(SELECT COUNT(*) FROM t_group_student gs WHERE gs.groupid=g.groupid)
36
+        where c.classid=#{classid}
37
+    </update>
38
+    <!--要升级的班级列表-->
39
+    <select id="listClassBySchoolId" resultType="com.xhkjedu.suser.model.gradeclass.TClass">
40
+        select * from t_class where schoolid=#{schoolid} and year=#{year} and classtype in(1,2) and classstate=1 and gradeid in(1,2,3,4,5,7,8,10,11)
41
+    </select>
42
+    <!--升级时要毕业的班级列表-->
43
+    <select id="listClassBiyeBySchoolId" resultType="com.xhkjedu.suser.model.gradeclass.TClass">
44
+        select * from t_class where schoolid=#{schoolid} and year=#{year} and classtype in(1,2) and classstate=#{classstate} and gradeid in(6,9,12)
45
+    </select>
46
+    <!--要升级的班级id字符串-->
47
+    <select id="listClassIdBySchoolId" resultType="java.lang.String">
48
+        select group_concat(classid) from t_class where schoolid=#{schoolid} and year=#{year} and classtype in(1,2) and classstate=1 and gradeid in(1,2,3,4,5,7,8,10,11)
49
+    </select>
50
+    <!--基本信息-->
51
+    <select id="getById" resultType="com.xhkjedu.suser.vo.gradeclass.ClassVo">
52
+        select c.classid,c.classname,c.gradeid,c.classnum,tg.groupid,c.classtype,c.createid,c.schoolid,c.year
53
+        from t_class c left join t_group tg on c.classid = tg.classid
54
+        where c.classid=#{classid} and tg.grouptype=1 limit 1
55
+    </select>
56
+
57
+    <!--获取年级下行政班班级id集合-->
58
+    <select id="listClassidsByGradeid" resultType="java.lang.Integer">
59
+        select c.classid from t_class c
60
+        LEFT JOIN t_school s on c.schoolid=s.schoolid and c.year=s.year
61
+        where c.gradeid=#{gradeid} and c.schoolid=#{schoolid} and c.classtype=1 and c.classstate=1
62
+    </select>
63
+    <!--根据班级名称获取班级信息-->
64
+    <select id="getByName" resultType="com.xhkjedu.suser.model.gradeclass.TClass">
65
+        select c.classid, c.classname, c.gradeid, c.classnum, c.classstate, c.classorder, c.schoolyear, c.year, c.classtype
66
+        , c.createid, c.createtime, c.schoolid
67
+        from t_class c where c.schoolid=#{tClass.schoolid} and c.classname=#{tClass.classname}
68
+        and c.year=#{tClass.year} and c.gradeid=#{tClass.gradeid} and c.classstate=1 and c.classtype=#{tClass.classtype} limit 1
69
+    </select>
70
+    <!--获取任教老师列表-->
71
+    <select id="listTeacher" resultType="java.lang.String">
72
+        select u.username from t_class_teacher ct left join t_user u on ct.teacherid=u.userid
73
+        where ct.classid=#{classid} and u.userstate=1
74
+    </select>
75
+
76
+    <!--修改班级状态-->
77
+    <update id="updateClassState">
78
+       update t_class set classstate=#{classstate} where classid in (${classids})
79
+    </update>
80
+    <!--修改单个班级状态-->
81
+    <update id="updateClassstateByClassid">
82
+       update t_class set classstate=#{classstate} where classid=#{classid}
83
+    </update>
84
+
85
+    <!--修改班级类型-->
86
+    <update id="updateClasstype">
87
+        update t_class set classtype=#{classtype} where classid=#{classid}
88
+    </update>
89
+    <!--获取班级当前年份-->
90
+    <select id="getYearById" resultType="java.lang.Integer">
91
+        select year from t_class where classid=#{classid}
92
+    </select>
93
+    <!--根据班级名称获取班级id-->
94
+    <select id="getClassIdByName" resultType="java.lang.Integer">
95
+        select c.classid from t_class c where c.schoolid=#{schoolid} and c.gradeid=#{gradeid} and c.classtype=1 and
96
+        c.classstate=1 and c.classname=#{classname} and c.year=#{year}
97
+    </select>
98
+</mapper>

+ 147
- 0
suser/src/main/resources/mapper/gradeclass/ClassStudentMapper.xml View File

@@ -0,0 +1,147 @@
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.suser.mapper.gradeclass.ClassStudentMapper">
4
+    <!--班级学生列表-->
5
+    <select id="findAll" resultType="com.xhkjedu.suser.vo.gradeclass.ClassStudentVo">
6
+        select cs.csid,cs.classid,u.username studentname,u.studentno,u.usersex,u.userid studentid,u.loginname,cs.createtime
7
+        ,u.bindmac,u.mac,u.headpic,u.userphone,u.usertime
8
+        from t_class_student cs left join t_user u on cs.studentid = u.userid
9
+        left join t_class c on cs.classid=c.classid
10
+        where cs.classid=#{student.classid}
11
+        <if test="student.studentname!=null and student.studentname!=''">
12
+            and (u.username like '%${student.studentname}%' or u.studentno like '%${student.studentname}%'
13
+            or u.loginname like '%${student.studentname}%' or u.userphone like '%${student.studentname}%')
14
+        </if>
15
+        <if test="student.fieldname!=null and student.fieldname!=''">
16
+          order by ${student.fieldname} ${student.fieldorder},cs.csid desc
17
+        </if>
18
+    </select>
19
+    <!--删除班级、分组对应学生-->
20
+    <delete id="deleteById">
21
+        delete cs.*,gs.*
22
+        from t_class_student cs left join t_group g on g.classid=cs.classid
23
+        left join t_group_student gs on g.groupid = gs.groupid AND gs.studentid=cs.studentid
24
+        where cs.classid=#{classid} and cs.studentid=#{studentid}
25
+    </delete>
26
+    <!--班级学生数量-->
27
+    <select id="getNumById" resultType="com.xhkjedu.suser.vo.gradeclass.ImportStudentVo">
28
+        <choose>
29
+            <when test="studentid!=0">
30
+                select count(distinct cs.classid)totalnum
31
+                ,count(distinct case when c.classid=#{classid} then c.classid else null end)classnum
32
+                ,count(distinct case when c.classid!=#{classid} and c.classtype=1 and c.classstate=1 then c.classid else
33
+                null end)xznum
34
+                from t_class_student cs left join t_class c on cs.classid=c.classid
35
+                where cs.studentid=#{studentid} and c.year=#{year}
36
+            </when>
37
+            <otherwise>
38
+                select count(*)classnum from t_class_student cs where cs.classid=#{classid}
39
+            </otherwise>
40
+        </choose>
41
+    </select>
42
+    <!--获取学生行政班id-->
43
+    <select id="getClassIdByStuId" resultType="java.lang.Integer">
44
+        select c.classid
45
+        from t_class_student cs left join t_class c on cs.classid=c.classid
46
+        where cs.studentid=#{studentid} and c.classtype=1 and c.classstate=1 limit 1
47
+    </select>
48
+    <!--获取要升级的学生列表-->
49
+    <select id="listStudentByClassIds" resultType="com.xhkjedu.suser.model.gradeclass.TClassStudent">
50
+        select * from t_class_student where classid in(${classIds}) order by classid;
51
+    </select>
52
+    <!--根据班级id和学生id获取班级学生信息-->
53
+    <select id="getByClassIdStudentId" resultType="com.xhkjedu.suser.model.gradeclass.TClassStudent">
54
+        select * from t_class_student where classid=#{classid} and studentid=#{studentid} limit 1
55
+    </select>
56
+
57
+    <!-- 获取学生所在班级 -->
58
+    <select id="listClassByStudentId" resultType="com.xhkjedu.suser.vo.gradeclass.ClassVo">
59
+        SELECT c.classid,c.classname,c.gradeid,c.classnum,c.classtype FROM t_class c
60
+        LEFT JOIN t_class_student cs ON c.classid=cs.classid
61
+        WHERE c.year=#{year} and c.classstate=1 AND cs.studentid=#{studentid} and (c.classtype=1 or c.classtype=2)
62
+        GROUP BY c.classid ORDER BY c.classtype,c.classorder
63
+
64
+    </select>
65
+
66
+    <select id="listNoClassStu" resultType="com.xhkjedu.suser.vo.gradeclass.ClassStudentVo">
67
+        select u.username studentname,u.studentno,u.usersex,u.userid studentid,u.loginname,u.createtime,
68
+        u.bindmac,u.mac,u.userstate,u.userphone,u.usertime
69
+        from t_user u left join
70
+        (select cs1.studentid,cs1.createtime,c.classtype from t_class_student cs1
71
+        left join t_class c on cs1.classid=c.classid where c.schoolid=#{student.schoolid} and c.year=#{student.year}
72
+        and c.classtype=1 and c.classstate=1) cs on u.userid=cs.studentid
73
+        where u.schoolid=#{student.schoolid} and u.usertype=2 and cs.studentid is null
74
+        <if test="student.userstate!=null and student.userstate!=0">
75
+            and u.userstate=#{student.userstate}
76
+        </if>
77
+        <if test="student.studentname!=null and student.studentname!=''">
78
+            and (u.username like '%${student.studentname}%' or u.studentno like '%${student.studentname}%')
79
+        </if>
80
+        <if test="student.fieldname!=null and student.fieldname!=''">
81
+            order by ${student.fieldname} ${student.fieldorder},u.userid desc
82
+        </if>
83
+    </select>
84
+    <!-- <if test="student.fieldname!=null and student.fieldname!=''">
85
+           order by ${student.fieldname} ${student.fieldorder}
86
+       </if>-->
87
+    <!--获取学生所在年级列表-->
88
+    <select id="listGrade" resultType="java.lang.Integer">
89
+        SELECT DISTINCT c.gradeid FROM t_class_student cs LEFT JOIN t_class c ON cs.classid=c.classid
90
+        WHERE cs.studentid=#{studentid} AND c.year=#{year} and c.classtype=1 and c.classstate=1
91
+    </select>
92
+
93
+    <!--获取全校学生-->
94
+    <select id="listAllStudents" resultType="com.xhkjedu.suser.vo.gradeclass.ClassStudentVo">
95
+        select u.username studentname,u.studentno,u.userphone,
96
+        u.usersex,u.userid studentid,u.loginname,cs.createtime,
97
+        u.bindmac,u.mac,u.headpic,u.usertime,c.gradeid,c.classname,c.classid
98
+        from t_user u left join t_class_student cs on u.userid=cs.studentid
99
+        left join t_class c on cs.classid=c.classid
100
+        where u.schoolid=#{student.schoolid} and u.usertype=2 and u.userstate=1
101
+        and c.classstate=1 and c.year=#{student.year} and c.classtype=#{student.classtype}
102
+        <if test="student.studentname!=null and student.studentname!=''">
103
+            and (u.username like '%${student.studentname}%' or u.studentno like '%${student.studentname}%')
104
+        </if>
105
+        group by u.userid
106
+        <if test="student.classtype==1">
107
+            ,c.classid
108
+        </if>
109
+        order by u.studentno
110
+    </select>
111
+    <!--获取班级学生id列表-->
112
+    <select id="listStudentIdByClassId" resultType="java.lang.Integer">
113
+        select studentid from t_class_student where classid=#{classid}
114
+    </select>
115
+    <!--添加-->
116
+    <insert id="save">
117
+        insert ignore into t_class_student (classid,studentid,createid,createtime,schoolid)
118
+        values (#{student.classid},#{student.studentid},#{student.createid},#{student.createtime},#{student.schoolid})
119
+    </insert>
120
+    <!--学生所在行政班-->
121
+    <select id="getClassByStuId" resultType="com.xhkjedu.suser.vo.gradeclass.ClassVo">
122
+        select c.gradeid,c.classname from t_class_student cs left join t_class c on cs.classid=c.classid
123
+        left join t_school s on c.schoolid=s.schoolid
124
+        where cs.studentid=#{studentid} and c.year=s.year and c.classtype=1 and c.classstate=1 limit 1
125
+    </select>
126
+    <!--学生列表-->
127
+    <select id="listStu" resultType="com.xhkjedu.suser.vo.paper.AStudentPaperVo">
128
+        select cs.studentid,u.username studentname,u.loginname,c.gradeid,c.classname
129
+        from t_class_student cs left join t_class c on cs.classid=c.classid
130
+        left join t_user u on cs.studentid=u.userid
131
+        where c.schoolid=#{paper.schoolid} and c.gradeid=#{paper.gradeid} and c.year=#{paper.year}
132
+        and c.classtype=1 and u.userstate=1
133
+        <if test="paper.classid!=0">
134
+            and cs.classid=#{paper.classid}
135
+        </if>
136
+        <if test="paper.classids!=null and paper.classids!=''">
137
+            and cs.classid in (${paper.classids})
138
+        </if>
139
+        group by cs.studentid
140
+    </select>
141
+    <!--获取学生所有提高班-->
142
+    <select id="listTgClassid" resultType="java.lang.Integer">
143
+        SELECT c.classid FROM t_class_student cs LEFT JOIN t_class c ON cs.classid=c.classid
144
+        LEFT JOIN t_school s ON c.schoolid=s.schoolid
145
+        WHERE cs.studentid=#{studentid} AND c.year=s.year AND c.classtype=2
146
+    </select>
147
+</mapper>

+ 196
- 0
suser/src/main/resources/mapper/gradeclass/ClassTeacherMapper.xml View File

@@ -0,0 +1,196 @@
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.suser.mapper.gradeclass.ClassTeacherMapper">
4
+    <!--班级教师列表-->
5
+    <select id="findAll" resultType="com.xhkjedu.suser.vo.gradeclass.ClassTeacherVo">
6
+        select u.userid teacherid,u.username teachername,u.usersex,u.userphone,u.loginname,u.usertype,u.createtime,u.usertime
7
+        from t_user u
8
+        <if test="teacher.gradeid!=null and teacher.gradeid!=0">
9
+            left join t_class_teacher ct on ct.teacherid=u.userid
10
+            left join t_class c on c.classid=ct.classid
11
+        </if>
12
+        <if test="teacher.subjectid!=null and teacher.subjectid!='0'.toString() and teacher.subjectid!=''">
13
+            left join t_teacher_powersb tp on tp.teacherid=u.userid
14
+            left join t_subject_book sb on sb.lsbid=tp.lsbid
15
+        </if>
16
+        where u.schoolid=#{teacher.schoolid} and u.usertype in(0,1) and u.userstate=1
17
+        <if test="teacher.teachername!=null and teacher.teachername!=''">
18
+            and (u.username like '%${teacher.teachername}%' or u.loginname like '%${teacher.teachername}%')
19
+        </if>
20
+        <if test="teacher.gradeid!=null and teacher.gradeid!=0">
21
+            and c.gradeid=#{teacher.gradeid} and c.year=#{teacher.year}
22
+        </if>
23
+        <if test="teacher.subjectid!=null and teacher.subjectid!='0'.toString() and teacher.subjectid!=''">
24
+            and sb.subjectid=#{teacher.subjectid}
25
+        </if>
26
+        group by u.userid
27
+        order by ${teacher.fieldname} ${teacher.fieldorder},u.userid desc
28
+    </select>
29
+
30
+    <!--获取当前年份下教师任教班级-->
31
+    <select id="listTeacherClass" resultType="com.xhkjedu.suser.vo.gradeclass.ClassVo">
32
+        SELECT ct.classid,c.classname,c.gradeid,c.classnum
33
+        FROM t_class_teacher ct LEFT JOIN t_class c ON ct.classid=c.classid
34
+        WHERE ct.teacherid=#{teacherid} AND c.year=#{year} and c.classstate=1
35
+        <if test="classtype!=null and classtype!=0">
36
+            <if test="classtype!=11">and c.classtype=#{classtype}</if>
37
+            <if test="classtype==11">and c.classtype in(1,2)</if>
38
+        </if>
39
+        <if test="classtype==null or classtype==0">
40
+            and c.classtype!=99
41
+        </if>
42
+        order by c.gradeid,c.classtype,c.classorder
43
+    </select>
44
+    <select id="listTeacherClass2" resultType="com.xhkjedu.suser.vo.gradeclass.ClassVo">
45
+        SELECT ct.classid,c.classname,c.gradeid,c.classnum,c.classtype
46
+        FROM t_class_teacher ct LEFT JOIN t_class c ON ct.classid=c.classid
47
+        WHERE ct.teacherid=#{teacherid} AND c.year=#{year} and c.classstate=1
48
+        and c.classtype in(1,2)
49
+        order by c.gradeid,c.classtype,c.classorder
50
+    </select>
51
+    <!--要升级的教师列表-->
52
+    <select id="listTeacherByClassIds" resultType="com.xhkjedu.suser.model.gradeclass.TClassTeacher">
53
+        select * from t_class_teacher where classid in(${classIds}) order by classid;
54
+    </select>
55
+    <!--前年份教师任教分组学生-->
56
+    <resultMap id="teacherClass" type="java.util.Map">
57
+        <result property="classid" column="classid"></result>
58
+        <result property="classname" column="classname"></result>
59
+        <result property="gradeid" column="gradeid"></result>
60
+        <result property="classnum" column="classnum"></result>
61
+        <collection property="students" ofType="java.util.Map" javaType="java.util.List">
62
+            <result property="studentid" column="studentid"></result>
63
+            <result property="studentname" column="studentname"></result>
64
+            <result property="headpic" column="headpic"></result>
65
+        </collection>
66
+    </resultMap>
67
+    <!--获取作业学生列表-->
68
+    <select id="listPaperStudent" resultMap="teacherClass">
69
+        select pg.classid,c.classname,c.gradeid,c.classnum,cs.studentid,u.username studentname,u.headpic
70
+        from t_paper_group pg left join t_class c on pg.classid=c.classid
71
+        left join t_class_student cs on c.classid = cs.classid
72
+        left join t_user u on cs.studentid=u.userid
73
+        where pg.paperid=#{paperid} order by c.gradeid,c.classtype,c.classorder,convert(u.username using gbk)
74
+    </select>
75
+    <!--获取作业教师列表-->
76
+    <resultMap id="paperTeacher" type="java.util.Map">
77
+        <result property="classid" column="classid"></result>
78
+        <result property="classname" column="classname"></result>
79
+        <result property="gradeid" column="gradeid"></result>
80
+        <collection property="teachers" ofType="java.util.Map" javaType="java.util.List">
81
+            <result property="teacherid" column="teacherid"></result>
82
+            <result property="teachername" column="teachername"></result>
83
+        </collection>
84
+    </resultMap>
85
+    <select id="listPaperTeacher" resultMap="paperTeacher">
86
+        select pg.classid,c.classname,c.gradeid,ct.teacherid,u.username teachername
87
+        from t_paper_group pg left join t_class c on pg.classid=c.classid
88
+        left join t_class_teacher ct on c.classid=ct.classid
89
+        right join t_teacher_powersb tp on tp.teacherid=ct.teacherid
90
+        right join t_subject_book sb on sb.lsbid=tp.lsbid and sb.subjectid=#{subjectid}
91
+        right join t_user u on ct.teacherid=u.userid and u.userstate=1
92
+        where pg.paperid=#{paperid} order by c.gradeid,c.classtype,c.classorder,convert(u.username using gbk)
93
+    </select>
94
+    <!-- 删除教师任教的行政和提高班 -->
95
+    <delete id="deleteByUserid">
96
+        DELETE ct FROM t_class_teacher ct
97
+        LEFT JOIN t_class c ON ct.classid=c.classid
98
+        WHERE ct.teacherid=#{userid} AND c.year=#{year} and c.classtype in(1,2)
99
+    </delete>
100
+
101
+    <!-- 获取用户当年任教班级id -->
102
+    <select id="listClassesByUserid" resultType="com.xhkjedu.suser.vo.gradeclass.ClassVo">
103
+        SELECT ct.classid,c.classname,c.gradeid,c.classtype FROM t_class_teacher ct LEFT JOIN t_class c ON ct.classid=c.classid
104
+         WHERE ct.teacherid=#{userid} AND c.year=#{year} and c.classstate=1
105
+        <if test="classtype!=null and classtype!=0">
106
+            <if test="classtype!=11">and c.classtype=#{classtype}</if>
107
+            <if test="classtype==11">and c.classtype in(1,2)</if>
108
+        </if>
109
+        <if test="classtype==null or classtype==0">
110
+            and c.classtype!=99
111
+        </if>
112
+         order by c.gradeid,c.classtype,c.classorder
113
+    </select>
114
+
115
+    <resultMap id="gradeClass" type="com.xhkjedu.suser.vo.gradeclass.GradeVo">
116
+        <result property="gradeid" column="gradeid"></result>
117
+        <result property="gradename" column="gradename"></result>
118
+        <collection property="classes" ofType="com.xhkjedu.suser.vo.gradeclass.ClassVo">
119
+            <result property="gradeid" column="gradeid"></result>
120
+            <result property="classid" column="classid"></result>
121
+            <result property="classname" column="classname"></result>
122
+            <result property="classnum" column="classnum"></result>
123
+            <result property="classtype" column="classtype"></result>
124
+        </collection>
125
+    </resultMap>
126
+
127
+    <!--1月30日修改获取班级-->
128
+    <!--<if test="role.classtype!=null and role.classtype!=0">
129
+            and c.classtype=#{role.classtype}
130
+        </if>-->
131
+    <select id="listGradeClassesByUserid" resultMap="gradeClass">
132
+        select c.gradeid,c.classid,c.classname,c.classnum,c.classtype
133
+        ,(case c.gradeid when 1 then '一年级' when 2 then '二年级' when 3 then '三年级' when 4 then '四年级'
134
+         when 5 then '五年级' when 6 then '六年级' when 7 then '七年级' when 8 then '八年级' when 9 then '九年级'
135
+         when 10 then '高一' when 11 then '高二' when 12 then '高三' else '' end)gradename
136
+        from t_class_teacher ct left join  t_class c on ct.classid=c.classid
137
+        where ct.teacherid=#{role.teacherid} and c.year=#{role.year} and c.classstate=1
138
+        <if test="role.classtype!=null and role.classtype!=0">
139
+            <if test="role.classtype!=11">and c.classtype=#{role.classtype}</if>
140
+            <if test="role.classtype==11">and c.classtype in(1,2)</if>
141
+        </if>
142
+        <if test="role.classtype==null or role.classtype==0">
143
+            and c.classtype!=99
144
+        </if>
145
+        <if test="role.gradeid!=null and role.gradeid!=0">
146
+            and c.gradeid=#{role.gradeid}
147
+        </if>
148
+        order by c.gradeid,c.classtype,c.classorder
149
+    </select>
150
+    <select id="listGradeClassesByUserid2" resultMap="gradeClass">
151
+        select c.gradeid,c.classid,c.classname,c.classnum,c.classtype
152
+        ,(case c.gradeid when 1 then '一年级' when 2 then '二年级' when 3 then '三年级' when 4 then '四年级'
153
+         when 5 then '五年级' when 6 then '六年级' when 7 then '七年级' when 8 then '八年级' when 9 then '九年级'
154
+         when 10 then '高一' when 11 then '高二' when 12 then '高三' else '' end)gradename
155
+        from t_class_teacher ct left join  t_class c on ct.classid=c.classid
156
+        where ct.teacherid=#{role.teacherid} and c.year=#{role.year} and c.classstate=1
157
+        and c.classtype in(1,2)
158
+        order by c.gradeid,c.classtype,c.classorder
159
+    </select>
160
+    <!--获取教师任教行政和提高班id-->
161
+    <select id="getClassIds" resultType="java.lang.String">
162
+        select group_concat(distinct c.classid)
163
+        from t_class_teacher ct left join  t_class c on ct.classid=c.classid
164
+        left join t_school s on ct.schoolid=s.schoolid
165
+        where ct.teacherid=#{teacherid} and c.year=s.year and c.classstate=1
166
+        and c.classtype in(1,2)
167
+    </select>
168
+
169
+    <!--获取学校年级下教师-->
170
+    <select id="listTeachersByGradeid" resultType="com.xhkjedu.suser.vo.gradeclass.ClassTeacherVo">
171
+        select ct.teacherid,u.username as teachername from t_class_teacher ct
172
+        left join t_class c on ct.classid=c.classid
173
+        left join t_user u on ct.teacherid=u.userid
174
+        where c.schoolid=#{schoolid} and c.gradeid=#{gradeid} and c.year=#{year} and c.classstate=1 and u.usertype=1 and u.userstate=1
175
+        group by ct.teacherid
176
+    </select>
177
+
178
+    <!--获取科目年级下教师-->
179
+    <select id="listTeahcersBySubjectGrade" resultType="com.xhkjedu.suser.vo.gradeclass.ClassTeacherVo">
180
+     select ct.teacherid,u.username as teachername from t_class_teacher ct
181
+     left join t_class c on ct.classid=c.classid
182
+     left join t_user u on ct.teacherid=u.userid
183
+    LEFT JOIN t_teacher_powersb tp on tp.teacherid=ct.teacherid
184
+    LEFT JOIN t_subject_book sb on tp.lsbid=sb.lsbid
185
+    where c.schoolid=#{ctp.schoolid} and c.gradeid=#{ctp.gradeid} and c.year=#{ctp.year} and c.classstate=1
186
+    and sb.subjectid=#{ctp.subjectid} and u.usertype=1 and u.userstate=1
187
+    group by ct.teacherid
188
+    </select>
189
+    <!--删除班级下所有教师-->
190
+    <delete id="deleteByClassId">
191
+        delete from t_class_teacher where classid=#{classid}
192
+    </delete>
193
+
194
+
195
+
196
+</mapper>

+ 79
- 0
suser/src/main/resources/mapper/gradeclass/GradeMapper.xml View 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.suser.mapper.gradeclass.GradeMapper">
4
+    <!--学校年级列表-->
5
+    <select id="findAll" resultType="com.xhkjedu.suser.model.gradeclass.TGrade">
6
+        select g.* from t_grade g
7
+        where g.schoolid=#{schoolid} and g.year=#{year}
8
+        order by g.gradeorder
9
+    </select>
10
+    <!--详情-->
11
+    <select id="findById" resultType="com.xhkjedu.suser.model.gradeclass.TGrade">
12
+        select g.*,u.username createname
13
+        from t_grade g left join t_user u on g.createid=u.userid
14
+        where g.gradeid=#{gradeid} limit 1
15
+    </select>
16
+
17
+    <resultMap id="gradeResult" type="com.xhkjedu.suser.vo.gradeclass.GradeVo">
18
+        <result property="gradeid" column="gradeid"></result>
19
+        <result property="gradename" column="gradename"></result>
20
+        <collection property="classes" ofType="com.xhkjedu.suser.vo.gradeclass.ClassVo">
21
+            <result property="gradeid" column="gradeid2"></result>
22
+            <result property="classid" column="classid"></result>
23
+            <result property="classname" column="classname"></result>
24
+            <result property="classnum" column="classnum"></result>
25
+            <result property="classtype" column="classtype"></result>
26
+            <result property="classorder" column="classorder"></result>
27
+            <result property="year" column="year"></result>
28
+            <result property="schoolyear" column="schoolyear"></result>
29
+        </collection>
30
+        <collection property="subjects" ofType="com.xhkjedu.suser.vo.gradeclass.GradeSubjectVo">
31
+            <result property="subjectid" column="subjectid"></result>
32
+            <result property="subjectname" column="subjectname"></result>
33
+            <collection property="teachers" ofType="com.xhkjedu.suser.vo.gradeclass.ClassTeacherVo">
34
+                <result property="teacherid" column="teacherid"></result>
35
+                <result property="teachername" column="teachername"></result>
36
+            </collection>
37
+        </collection>
38
+    </resultMap>
39
+    <!--获取通知班级列表-->
40
+    <select id="listClass" resultMap="gradeResult">
41
+        select c.gradeid,c.gradeid gradeid2,c.classid,c.classname,c.classnum,c.classtype,c.classorder,c.year,c.schoolyear
42
+        ,(case c.gradeid when 1 then '一年级' when 2 then '二年级' when 3 then '三年级' when 4 then '四年级'
43
+         when 5 then '五年级' when 6 then '六年级' when 7 then '七年级' when 8 then '八年级' when 9 then '九年级'
44
+         when 10 then '高一' when 11 then '高二' when 12 then '高三' else '' end)gradename
45
+        from t_class c where c.schoolid=#{schoolid} and c.year=#{year} and c.classstate=1
46
+        <if test="classtype!=null and classtype!=0">
47
+            and c.classtype=#{classtype}
48
+        </if>
49
+        <if test="classtype==null or classtype==0">
50
+            and c.classtype<![CDATA[ < ]]>5
51
+        </if>
52
+         order by c.gradeid,c.classtype,c.classorder,c.classid desc
53
+    </select>
54
+
55
+    <!--教师设置权限班级-->
56
+    <select id="listClassForTeacher" resultMap="gradeResult">
57
+        select c.gradeid,c.gradeid gradeid2,c.classid,c.classname,c.classnum,c.classtype,c.classorder,c.year,c.schoolyear
58
+        ,(case c.gradeid when 1 then '一年级' when 2 then '二年级' when 3 then '三年级' when 4 then '四年级'
59
+        when 5 then '五年级' when 6 then '六年级' when 7 then '七年级' when 8 then '八年级' when 9 then '九年级'
60
+        when 10 then '高一' when 11 then '高二' when 12 then '高三' else '' end)gradename
61
+        from t_class c where c.schoolid=#{schoolid} and c.year=#{year} and c.classstate=1 and c.classtype between 1 and 2
62
+        order by c.gradeid,c.classtype,c.classorder,c.classid desc
63
+    </select>
64
+
65
+    <!--获取通知教师列表-->
66
+    <select id="listTeacher" resultMap="gradeResult">
67
+        select c.gradeid,s.subjectid,s.subjectname,u.userid teacherid,u.username teachername
68
+        ,(case c.gradeid when 1 then '一年级' when 2 then '二年级' when 3 then '三年级' when 4 then '四年级'
69
+         when 5 then '五年级' when 6 then '六年级' when 7 then '七年级' when 8 then '八年级' when 9 then '九年级'
70
+         when 10 then '高一' when 11 then '高二' when 12 then '高三' else '' end)gradename
71
+        from t_class c left join t_teacher_powersb ts on c.schoolid=ts.schoolid
72
+        left join t_subject_book sb on ts.lsbid=sb.lsbid
73
+        left join t_subject s on sb.subjectid=s.subjectid
74
+        left join t_class_teacher ct on c.classid=ct.classid and ts.teacherid=ct.teacherid
75
+        left join t_user u on ct.teacherid=u.userid
76
+        where c.schoolid=#{schoolid} and c.year=#{year} and c.classstate=1 and u.usertype=1 and u.userstate=1
77
+        order by c.gradeid,c.classtype,c.classorder,s.subjectorder,convert(u.username using gbk)
78
+    </select>
79
+</mapper>

+ 66
- 0
suser/src/main/resources/mapper/gradeclass/GroupMapper.xml View File

@@ -0,0 +1,66 @@
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.suser.mapper.gradeclass.GroupMapper">
4
+    <!--班级分组列表-->
5
+    <select id="findAll" resultType="com.xhkjedu.suser.model.gradeclass.TGroup">
6
+        select g.*,u.username createname from t_group g left join t_user u on g.createid=u.userid
7
+        where g.classid=#{classid}
8
+        <if test="createid!=null">
9
+            and (g.createid=#{createid} or g.grouptype=1)
10
+        </if>
11
+        order by g.grouptype,g.groupid desc
12
+    </select>
13
+    <!--更新分组人数-->
14
+    <update id="updateNum">
15
+        update t_group g set g.groupnum=
16
+        (select count(*) from t_group_student gs where gs.groupid=#{groupid})
17
+        where g.groupid=#{groupid}
18
+    </update>
19
+    <resultMap id="teacherGroup" type="com.xhkjedu.suser.vo.gradeclass.ClassGroupVo">
20
+        <result property="classid" column="classid"></result>
21
+        <result property="classname" column="classname"></result>
22
+        <result property="gradeid" column="gradeid"></result>
23
+        <result property="classnum" column="classnum"></result>
24
+        <collection property="groups" ofType="com.xhkjedu.suser.vo.gradeclass.GroupVo">
25
+            <result property="classid" column="classid"></result>
26
+            <result property="groupid" column="groupid"></result>
27
+            <result property="groupname" column="groupname"></result>
28
+            <result property="grouptype" column="grouptype"></result>
29
+            <result property="selected" column="selected"></result>
30
+            <collection property="students" ofType="com.xhkjedu.suser.vo.gradeclass.CStudentVo"
31
+                        javaType="java.util.List" select="listStudent" column="{groupid=groupid}">
32
+            </collection>
33
+        </collection>
34
+    </resultMap>
35
+    <resultMap id="studentResult" type="com.xhkjedu.suser.vo.gradeclass.CStudentVo">
36
+        <result property="studentid" column="studentid"></result>
37
+        <result property="studentname" column="studentname"></result>
38
+    </resultMap>
39
+    <select id="listStudent" resultMap="studentResult">
40
+        select gs.studentid,u.username studentname,u.headpic
41
+        from t_group_student gs left join t_user u on gs.studentid=u.userid
42
+        where gs.groupid=#{groupid} order by convert(u.username using gbk)
43
+    </select>
44
+    <!--教师分组列表-->
45
+    <select id="teacherList" resultMap="teacherGroup">
46
+        select c.classid,c.classname,c.classnum,c.gradeid,g.groupid,g.groupname,g.grouptype from t_group g
47
+        left join t_class_teacher ct on ct.classid=g.classid
48
+        left join t_class c on ct.classid = c.classid
49
+        where ct.teacherid=#{teacherid} and c.year=#{year} and c.classstate=1
50
+        and c.classtype<![CDATA[ < ]]>5 and (g.createid=#{teacherid} or g.grouptype=1)
51
+        order by c.gradeid,c.classtype,c.classorder,g.grouptype asc, g.groupid desc
52
+    </select>
53
+
54
+    <!--分组以及分组下所有学生id-->
55
+    <select id="listStudentidsByGroupids" resultType="java.lang.Integer">
56
+        SELECT DISTINCT studentid FROM t_group_student  WHERE groupid IN (${groupids})
57
+    </select>
58
+    <!--获取班级的全体分组-->
59
+    <select id="findByClassId" resultType="com.xhkjedu.suser.model.gradeclass.TGroup">
60
+        select g.* from t_group g where g.classid=#{classid} and g.grouptype=1
61
+    </select>
62
+    <!--要升级的全体分组列表-->
63
+    <select id="listStudentByClassIds" resultType="com.xhkjedu.suser.model.gradeclass.TGroup">
64
+        select g.* from t_group g where g.classid in(${classIds}) and g.grouptype=1 order by classid
65
+    </select>
66
+</mapper>

+ 24
- 0
suser/src/main/resources/mapper/gradeclass/GroupStudentMapper.xml View File

@@ -0,0 +1,24 @@
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.suser.mapper.gradeclass.GroupStudentMapper">
4
+    <!--分组学生列表-->
5
+    <select id="findAll" resultType="com.xhkjedu.suser.vo.gradeclass.GroupStudentVo">
6
+        select gs.gsid,gs.groupid,tu.studentno,tu.username studentname,tu.usersex,gs.studentid,tu.headpic
7
+        from t_group_student gs left join t_user tu on gs.studentid = tu.userid
8
+        where gs.groupid=#{groupid}
9
+        order by convert(tu.username using gbk)
10
+    </select>
11
+    <!--获取要升级的学生列表-->
12
+    <select id="listStudentByGroupIds" resultType="com.xhkjedu.suser.model.gradeclass.TGroupStudent">
13
+        select * from t_group_student where groupid in(${groupIds}) order by groupid;
14
+    </select>
15
+    <!--删除分组学生-->
16
+    <delete id="deleteByGroupId">
17
+        delete from t_group_student where groupid=#{groupid}
18
+    </delete>
19
+    <!--添加-->
20
+    <insert id="save">
21
+        insert ignore into t_group_student (classid,groupid,studentid,createid,createtime,schoolid)
22
+        values (#{student.classid},#{student.groupid},#{student.studentid},#{student.createid},#{student.createtime},#{student.schoolid})
23
+    </insert>
24
+</mapper>

+ 17
- 0
suser/src/main/resources/mapper/system/RoleMapper.xml View File

@@ -0,0 +1,17 @@
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.suser.mapper.system.RoleMapper">
4
+    <!-- 获取所有角色 -->
5
+    <select id="listAllRoles" resultType="com.xhkjedu.suser.model.system.TRole">
6
+        SELECT r.roleid,r.rolename,r.comm,r.createid,r.createtime,u.username AS createname,
7
+        (SELECT COUNT(*) FROM t_user_role ur WHERE ur.roleid=r.roleid) AS usernum
8
+        FROM t_role r LEFT JOIN t_user u ON r.createid = u.userid
9
+        WHERE r.schoolid=#{schoolid} ORDER BY createtime desc
10
+    </select>
11
+
12
+    <!-- 获取角色下用户 -->
13
+    <select id="getRoleDetail" resultType="com.xhkjedu.suser.vo.system.RoleVo">
14
+        SELECT r.roleid,r.rolename,r.comm from t_role r
15
+        WHERE r.roleid=#{roleid} limit 1
16
+    </select>
17
+</mapper>

+ 33
- 0
suser/src/main/resources/mapper/system/RoleModuleMapper.xml View File

@@ -0,0 +1,33 @@
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.suser.mapper.system.RoleModuleMapper">
4
+
5
+    <!-- 角色下所有模块 -->
6
+    <select id="listRoleModules" resultType="com.xhkjedu.suser.vo.system.RoleModuleVo">
7
+        SELECT rm.moduleid,m.modulename,m.moduleurl,m.moduleico,m.modulepid,m.minout,m.mclass,m.level
8
+        FROM t_role_module rm LEFT JOIN t_module m ON rm.moduleid=m.moduleid
9
+        WHERE rm.roleid=#{roleid} and m.display=1 ORDER BY m.morder
10
+    </select>
11
+
12
+    <!-- 批量保存角色模块信息 -->
13
+    <insert id="saveBathRoleModule">
14
+        INSERT INTO t_role_module (roleid,moduleid,createid,createtime,schoolid) VALUES
15
+        <foreach collection ="list" item="rm" index= "index" separator =",">
16
+            (#{rm.roleid},#{rm.moduleid},#{rm.createid},#{rm.createtime},#{rm.schoolid})
17
+        </foreach>
18
+    </insert>
19
+
20
+    <!-- 根据角色删除模块信息 -->
21
+    <delete id="deleteByRoleid" parameterType="java.lang.Integer">
22
+        delete from t_role_module where roleid=#{roleid}
23
+    </delete>
24
+
25
+    <!--获取用户拥有的所有模块-->
26
+    <select id="listModulesByUserid" resultType="com.xhkjedu.suser.vo.system.RoleModuleVo">
27
+        SELECT DISTINCT rm.moduleid,m.modulename,m.moduleurl,m.moduleico,m.modulepid,m.morder,m.minout,
28
+        m.mclass,m.level,m.mabbrevname
29
+        FROM t_role_module rm LEFT JOIN t_module m ON rm.moduleid=m.moduleid
30
+        LEFT JOIN t_user_role ur ON rm.roleid=ur.roleid
31
+        WHERE userid=#{userid} and m.display=1 ORDER BY m.level,m.morder,m.moduleid
32
+    </select>
33
+</mapper>

+ 215
- 0
suser/src/main/resources/mapper/system/UserMapper.xml View File

@@ -0,0 +1,215 @@
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.suser.mapper.system.UserMapper">
4
+
5
+    <!-- 登录 -->
6
+    <select id="getUserByLoginname" resultType="com.xhkjedu.suser.vo.system.UserVo">
7
+        select u.userid,u.username,u.loginname,u.loginpwd,u.userphone,u.userbirthday,u.cardid,u.headpic,u.usertype,
8
+        u.userstate,u.opepassword,u.createid,u.createtime,u.deleteid,u.deletetime,u.schoolid,u.bindmac,u.mac,u.usertime
9
+        ,s.year,s.schoolname,s.schoollevel,s.schoolstate,s.bindmac sbindmac,s.errorrate,s.schooldomain
10
+        ,(select cloudcode from t_cloud limit 1)cloudcode
11
+        from t_user u left join t_school s on u.schoolid = s.schoolid
12
+        where u.loginname=#{loginname} limit 1
13
+    </select>
14
+    <!--学生andorid登录,20211221添加GROUP_CONCAT,因为不绑定的情况下一个mac可以多个帐号登录-->
15
+    <select id="getUserByLoginnameMac" resultType="com.xhkjedu.suser.vo.system.UserVo">
16
+        select u.userid,u.username,u.loginname,u.loginpwd,u.userbirthday,u.cardid,u.headpic,u.usertype,
17
+        u.userstate,u.opepassword,u.createid,u.createtime,u.deleteid,u.deletetime,u.schoolid,u.bindmac,u.mac,u.usertime
18
+        ,s.year,s.schoolname,s.schoollevel,s.schoolstate,s.bindmac sbindmac,s.errorrate,s.schooldomain
19
+        ,(case when u.userphone is null or u.userphone='' then 0 else 1 end)hasphone
20
+        ,(select GROUP_CONCAT(u1.loginname) from t_user u1 where u1.mac=#{mac} and u1.schoolid=u.schoolid)macname
21
+        ,c.cloudcode,c.bindphone
22
+        ,(select count(cs.csid) from t_class_student cs left join t_class c on cs.classid=c.classid
23
+        where cs.studentid=u.userid and c.classstate=1 and c.year=s.year and c.classtype=1)xznum
24
+        from t_user u,t_school s,t_cloud c
25
+        where u.loginname=#{loginname} and u.schoolid = s.schoolid limit 1
26
+    </select>
27
+    <!--校验手机号-->
28
+    <select id="checkUserPhone" resultType="java.lang.Boolean">
29
+        select (case when c.bindphone=1 and (u.userphone is null or u.userphone='') then true else false end)
30
+        from t_user u,t_cloud c where u.userid=#{userid}
31
+    </select>
32
+    <!--删除用户-->
33
+    <update id="deleteById">
34
+        update t_user set userstate=2,deleteid=#{user.deleteid},deletetime=#{user.deletetime}
35
+        where userid=#{user.userid}
36
+    </update>
37
+    <!--获取用户列表-->
38
+    <select id="findAll" resultType="com.xhkjedu.suser.vo.system.UserVo">
39
+        select u.*,u2.username createname from t_user u
40
+        left join t_user u2 on u2.userid=u.createid
41
+        where u.schoolid=#{user.schoolid}
42
+        <if test="user.loginname!=null and user.loginname!=''">
43
+            and u.loginname like '%${user.loginname}%'
44
+            or u.username like '%${user.loginname}%'
45
+        </if>
46
+        order by u.createtime desc
47
+    </select>
48
+    <!--获取用户详情-->
49
+    <select id="findById" resultType="com.xhkjedu.suser.vo.system.UserVo">
50
+        select u.*,u2.username createname,s.year,s.schoolname,s.schoollevel,s.schoolstate,s.bindmac sbindmac,s.errorrate
51
+        ,(select cloudcode from t_cloud limit 1)cloudcode
52
+        from t_user u
53
+        left join t_user u2 on u2.userid=u.createid
54
+        left join t_school s on u.schoolid = s.schoolid
55
+        where u.userid=#{userid} limit 1
56
+    </select>
57
+    <!--修改用户密码-->
58
+    <update id="updatePwd">
59
+        update t_user set loginpwd=#{user.loginpwd} where userid=#{user.userid}
60
+    </update>
61
+    <!--修改用户头像-->
62
+    <update id="updateHeadPic">
63
+        update t_user set headpic=#{user.headpic} where userid=#{user.userid}
64
+    </update>
65
+    <!--检查登录账号是否存在-->
66
+    <select id="checkLoginName" resultType="java.lang.Integer">
67
+        select count(*) from t_user u where u.loginname=#{loginname}
68
+    </select>
69
+    <!--根据登录账号获取用户详情-->
70
+    <select id="getObjByLoginName" resultType="com.xhkjedu.suser.model.system.TUser">
71
+        select u.* from t_user u where u.loginname=#{loginname} limit 1
72
+    </select>
73
+    <!--根据登录名获取学生id和行政和提高班班级id-->
74
+    <select id="getObjByLoginName2" resultType="com.xhkjedu.suser.model.system.TUser">
75
+        select u.userid,u.usertype,u.userstate,u.schoolid,group_concat(distinct c.classid) ultype
76
+        from t_user u left join t_class_student cs on u.userid=cs.studentid
77
+        left join t_class c on cs.classid=c.classid and c.classtype in(1,2) and c.classstate=1
78
+        where u.loginname=#{loginname} limit 1
79
+    </select>
80
+    <!--修改用户状态-->
81
+    <update id="updateState">
82
+        update t_user set userstate=#{userstate} where userid=#{userid}
83
+    </update>
84
+
85
+    <!-- 用户设置操作密码 -->
86
+    <update id="updateOpepasswordByUserId">
87
+        update t_user set opepassword=#{opepassword} where userid=#{userid}
88
+    </update>
89
+    <!-- 验证用户操作密码 -->
90
+    <select id="getUserIdByOpepassword" resultType="java.lang.Integer">
91
+        select count(*) from t_user where userid=#{userid} and opepassword=#{opepassword}
92
+    </select>
93
+
94
+    <resultMap id="teacherInfoMap" type="com.xhkjedu.suser.vo.system.TeacherVo">
95
+        <result property="userid" column="userid"></result>
96
+        <result property="username" column="username"></result>
97
+        <result property="headpic" column="headpic"></result>
98
+        <result property="subjectname" column="subjectname"></result>
99
+        <collection property="classlist" ofType="com.xhkjedu.suser.vo.gradeclass.ClassVo"
100
+                    javaType="java.util.List" select="listTeacherClass" column="{userid=userid,classtype=classtype}">
101
+        </collection>
102
+    </resultMap>
103
+
104
+    <resultMap id="teacherClass" type="com.xhkjedu.suser.vo.gradeclass.ClassVo">
105
+        <result property="classid" column="classid"></result>
106
+        <result property="classname" column="classname"></result>
107
+        <result property="gradeid" column="gradeid"></result>
108
+    </resultMap>
109
+    <!--教师任教班级-->
110
+    <select id="listTeacherClass" resultMap="teacherClass">
111
+        select c.classid,c.classname,c.gradeid from t_class c
112
+        left join t_class_teacher ct on c.classid=ct.classid
113
+        where ct.teacherid=#{userid} and c.classstate=1
114
+        <if test="classtype!=null and classtype!=0">
115
+            <if test="classtype!=11">and c.classtype=#{classtype}</if>
116
+            <if test="classtype==11">and c.classtype in(1,2)</if>
117
+        </if>
118
+        <if test="classtype==null or classtype==0">
119
+            and c.classtype!=99
120
+        </if>
121
+        order by c.gradeid,c.classtype,c.classorder
122
+    </select>
123
+
124
+    <!--教师基本信息-->
125
+    <select id="getTeacherInfo" resultMap="teacherInfoMap">
126
+        select u.userid,u.username,u.headpic,group_concat(distinct s.subjectname order by s.subjectorder)subjectname
127
+        ,#{classtype} classtype,u.usertime
128
+        from t_user u
129
+        left join t_teacher_powersb ts on u.userid = ts.teacherid
130
+        left join t_subject_book sb on ts.lsbid=sb.lsbid
131
+        left join t_subject s on sb.subjectid=s.subjectid
132
+        where u.userid=#{userid}
133
+    </select>
134
+    <!--更新学生硬件绑定信息-->
135
+    <update id="updateBindMac">
136
+        update t_user set bindmac=#{user.bindmac},mac=#{user.mac} where userid=#{user.userid}
137
+    </update>
138
+    <!--删除学生绑定信息-->
139
+    <update id="delBindmac">
140
+        update t_user set bindmac=0,mac=null where schoolid=#{schoolid}
141
+    </update>
142
+    <!--通过短信修改密码-->
143
+    <update id="updatePwdByCode">
144
+        update t_user set loginpwd=#{user.loginpwd} where userphone=#{user.userphone}
145
+    </update>
146
+    <!--批量修改用户密码-->
147
+    <update id="batchUpdatePwd">
148
+        update t_user set loginpwd=#{user.loginpwd} where schoolid=#{user.schoolid}
149
+        and usertype in (
150
+        <foreach collection="user.usertypes" item="usertype" index="index" separator=",">
151
+            ${usertype}
152
+        </foreach>
153
+        )
154
+    </update>
155
+
156
+    <!--根据用户id获取用户姓名-->
157
+    <select id="getUserNameById" resultType="java.lang.String">
158
+        select username from t_user where userid=#{userid}
159
+    </select>
160
+
161
+    <!--批量修改用户状态-->
162
+    <update id="batchUpdateState">
163
+        update t_user set userstate=#{userstate} where
164
+        <foreach collection="users" item="user" index="index" separator="or">
165
+            userid=${user.studentid}
166
+        </foreach>
167
+    </update>
168
+
169
+    <!--获取学校管理员-->
170
+    <select id="getSchoolAdminBySchoolid" resultType="com.xhkjedu.suser.vo.system.UserVo">
171
+        select userid,username,loginname,loginpwd from t_user where schoolid=#{schoolid}
172
+        and usertype=0 and userstate=1 order by userid limit 1
173
+    </select>
174
+
175
+    <!--获取学校账号数量-->
176
+    <select id="getUserNumBySchoolId" resultType="java.lang.Integer">
177
+        select count(*) from t_user where schoolid=#{schoolid} and userstate=1
178
+    </select>
179
+    <!--用户选择列表-->
180
+    <select id="listForSel" resultType="java.util.Map">
181
+        select u.userid,u.username,u.loginname
182
+        from t_user u left join t_class_teacher ct on ct.teacherid=u.userid
183
+        left join t_class c on c.classid=ct.classid
184
+        left join t_teacher_powersb tp on tp.teacherid=u.userid
185
+        left join t_subject_book sb on sb.lsbid=tp.lsbid
186
+        where u.schoolid=#{user.schoolid} and u.userstate=1 and u.usertype=1
187
+        and c.gradeid=#{user.gradeid} and c.year=#{year} and c.classid=#{user.classid}
188
+        and sb.subjectid=#{user.subjectid}
189
+        <if test="user.username!=null and user.username!=''">
190
+            and u.username like '%${user.username}%'
191
+        </if>
192
+        group by u.userid
193
+        order by convert(u.username using gbk)
194
+    </select>
195
+    <!--根据班级id用户名获取学生id和数量-->
196
+    <select id="getUserIdByName" resultType="java.util.Map">
197
+        select u.userid,count(distinct u.userid)num
198
+        from t_user u left join t_class_student cs on u.userid=cs.studentid
199
+        where u.schoolid=#{schoolid} and u.userstate=1 and u.username=#{username} and cs.classid=#{classid}
200
+    </select>
201
+    <!--根据班级科目id用户名获取教师id和数量-->
202
+    <select id="getUserIdByName2" resultType="java.util.Map">
203
+        select u.userid,count(distinct u.userid)num
204
+        from t_user u left join t_class_teacher ct on u.userid=ct.teacherid
205
+        left join t_teacher_powersb tp on tp.teacherid=u.userid
206
+        left join t_subject_book sb on sb.lsbid=tp.lsbid
207
+        where u.schoolid=#{schoolid} and u.userstate=1 and u.username=#{username}
208
+        and ct.classid=#{classid} and sb.subjectid=#{subjectid}
209
+    </select>
210
+
211
+    <!--根据用户id获取用户类型-->
212
+    <select id="getUsertypeById" resultType="java.lang.Integer">
213
+        select usertype from t_user where userid=#{userid}
214
+    </select>
215
+</mapper>

+ 33
- 0
suser/src/main/resources/mapper/system/UserRoleMapper..xml View File

@@ -0,0 +1,33 @@
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.suser.mapper.system.UserRoleMapper">
4
+    <delete id="deleteByUserid">
5
+        delete from t_user_role where userid=#{userid}
6
+    </delete>
7
+
8
+    <!-- 根据用户id获取关联角色 -->
9
+    <select id="listRolesByUserid" resultType="com.xhkjedu.suser.vo.system.UserRoleVo">
10
+        SELECT ur.roleid,r.rolename
11
+        FROM t_user_role ur LEFT JOIN t_role r ON ur.roleid=r.roleid
12
+        WHERE ur.userid=#{userid}
13
+    </select>
14
+
15
+    <!-- 获取角色下用户 -->
16
+    <select id="listUsersByRoleid" resultType="com.xhkjedu.suser.model.system.TUserRole">
17
+        SELECT ur.userid,u.username FROM t_user_role ur
18
+        LEFT JOIN t_user u ON ur.userid=u.userid WHERE ur.roleid=#{roleid}
19
+    </select>
20
+
21
+    <!--获取有常用模块的用户id集合-->
22
+    <select id="listUserId" resultType="java.lang.Integer">
23
+        SELECT um.userid FROM t_user_module um LEFT JOIN t_role_module rm ON um.moduleid=rm.moduleid
24
+        WHERE rm.roleid=#{roleid} GROUP BY um.userid
25
+    </select>
26
+    <!--根据用户id删除没有权限的常用模块-->
27
+    <delete id="deleteNoRoleByUserId">
28
+        DELETE FROM t_user_module WHERE userid=#{userid} AND moduleid
29
+        NOT IN(SELECT rm.moduleid FROM t_user u LEFT JOIN t_user_role ur ON u.userid=ur.userid
30
+        LEFT JOIN t_role_module rm ON ur.roleid=rm.roleid
31
+        WHERE u.userid=#{userid} GROUP BY rm.moduleid)
32
+    </delete>
33
+</mapper>

Loading…
Cancel
Save