From e2b4312eb005ad7aab41d47ebee42fc4dab8df85 Mon Sep 17 00:00:00 2001
From: Mlxa0324 <mlx950324@163.com>
Date: Thu, 27 Oct 2022 23:36:44 +0800
Subject: [PATCH] =?UTF-8?q?=E8=BA=AB=E4=BB=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../com/ibeetl/admin/core/conf/BeetlConf.java |  3 ++
 .../ibeetl/admin/core/enums/MenuEnums.java    | 22 +++++++-----
 pom.xml                                       | 11 ------
 web/pom.xml                                   |  6 ----
 .../ibeetl/jlw/service/StudentService.java    | 35 +++++++++++++++----
 .../ibeetl/jlw/service/TeacherService.java    | 33 +++++++++++++----
 ...erOpenCourseScheduleSessionController.java | 15 ++++++++
 7 files changed, 87 insertions(+), 38 deletions(-)

diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/conf/BeetlConf.java b/admin-core/src/main/java/com/ibeetl/admin/core/conf/BeetlConf.java
index a024a0bc..b773fb28 100644
--- a/admin-core/src/main/java/com/ibeetl/admin/core/conf/BeetlConf.java
+++ b/admin-core/src/main/java/com/ibeetl/admin/core/conf/BeetlConf.java
@@ -72,6 +72,8 @@ public class BeetlConf {
     MenuFunction menuFunction;
     @Autowired
     CoreUserFunction coreUserFunction;
+    @Autowired
+    IsSignRoleFunction isSignRoleFunction;
 
     @Bean
     public WebSimulate getWebSimulate(GroupTemplate gt, ObjectMapper objectMapper) {
@@ -91,6 +93,7 @@ public class BeetlConf {
                 groupTemplate.registerFunctionPackage("queryCondition", new QueryParser());
                 groupTemplate.registerFunctionPackage("dict", dictDownQueryFunction);
                 groupTemplate.registerFunctionPackage("user", coreUserFunction);
+                groupTemplate.registerFunctionPackage("isSignRole", isSignRoleFunction);
                 groupTemplate.registerFunction("core.orgName", orgFunction);
                 groupTemplate.registerFunction("core.functionName", funFunction);
                 groupTemplate.registerFunction("core.funAccessUrl", funAccessUrlFunction);
diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/enums/MenuEnums.java b/admin-core/src/main/java/com/ibeetl/admin/core/enums/MenuEnums.java
index 663d25a5..ee27ee4f 100644
--- a/admin-core/src/main/java/com/ibeetl/admin/core/enums/MenuEnums.java
+++ b/admin-core/src/main/java/com/ibeetl/admin/core/enums/MenuEnums.java
@@ -9,26 +9,28 @@ import static com.ibeetl.admin.core.service.CorePlatformService.*;
 public enum MenuEnums {
 
     // 岗位类型
-    JT_01("管理岗位", null),
-    JT_02("操作岗位", null),
+    JT_01("管理岗位", null, null),
+    JT_02("操作岗位", null, null),
 
     // 管理岗位子类型
-    JT_S_01("系统管理员", T_ADMIN),
-    JT_S_02("教师管理员", null),
-    JT_S_04("院校管理员", T_COLLEGES_ADMIN),
+    JT_S_01("系统管理员", T_ADMIN, 1),
+    JT_S_02("教师管理员", null, null),
+    JT_S_04("院校管理员", T_COLLEGES_ADMIN, 2),
 
     // 操作岗位子类型
-    JT_S_03("学生", T_STUDENT),
-    JT_S_05("教师", T_TEACHER);
+    JT_S_03("学生", T_STUDENT, 4),
+    JT_S_05("教师", T_TEACHER, 3);
 
     private String name;
     private String attributeName;
+    private Integer roleNum;
 
     private
 
-    MenuEnums(String name, String attributeName) {
+    MenuEnums(String name, String attributeName, Integer roleNum) {
         this.name = name;
         this.attributeName = attributeName;
+        this.roleNum = roleNum;
     }
 
     public String getName() {
@@ -52,4 +54,8 @@ public enum MenuEnums {
         }
         return null;
     }
+
+    public Integer getRoleNum() {
+        return roleNum;
+    }
 }
diff --git a/pom.xml b/pom.xml
index 2f52fb85..73523d15 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,17 +89,6 @@
                 <version>1.2.56</version>
             </dependency>
 
-            <dependency>
-                <groupId>com.auth0</groupId>
-                <artifactId>java-jwt</artifactId>
-                <version>3.4.0</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.slf4j</groupId>
-                        <artifactId>slf4j-api</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
             <dependency>
                 <groupId>com.auth0</groupId>
                 <artifactId>java-jwt</artifactId>
diff --git a/web/pom.xml b/web/pom.xml
index 65c01f4e..6d98eb84 100644
--- a/web/pom.xml
+++ b/web/pom.xml
@@ -34,12 +34,6 @@
 			<version>${pro.version}</version>
 			<scope>test</scope>
 		</dependency>
-		<dependency>
-			<groupId>com.ibeetl</groupId>
-			<artifactId>admin-test</artifactId>
-			<version>1.3.1</version>
-			<scope>test</scope>
-		</dependency>
 		<dependency>
 			<groupId>commons-codec</groupId>
 			<artifactId>commons-codec</artifactId>
diff --git a/web/src/main/java/com/ibeetl/jlw/service/StudentService.java b/web/src/main/java/com/ibeetl/jlw/service/StudentService.java
index b983b98e..9151121c 100644
--- a/web/src/main/java/com/ibeetl/jlw/service/StudentService.java
+++ b/web/src/main/java/com/ibeetl/jlw/service/StudentService.java
@@ -1,6 +1,9 @@
 package com.ibeetl.jlw.service;
 
 
+import cn.hutool.core.lang.Assert;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.ReUtil;
 import cn.jlw.util.ToolUtils;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
@@ -12,6 +15,7 @@ import com.ibeetl.admin.core.util.PlatformException;
 import com.ibeetl.admin.core.util.TimeTool;
 import com.ibeetl.admin.core.web.JsonResult;
 import com.ibeetl.admin.core.web.JsonReturnCode;
+import com.ibeetl.jlw.dao.SchoolClassDao;
 import com.ibeetl.jlw.dao.StudentDao;
 import com.ibeetl.jlw.entity.*;
 import com.ibeetl.jlw.job.CacheLogJob;
@@ -54,6 +58,7 @@ import static com.ibeetl.jlw.web.IpAddressController.ipAddressMap;
 public class StudentService extends CoreBaseService<Student>{
 
     @Autowired private StudentDao studentDao;
+    @Autowired private SchoolClassDao schoolClassDao;
     @Autowired private StudentQuestionLogService studentQuestionLogService;
     @Autowired private StudentQuestionLogInfoService studentQuestionLogInfoService;
     @Autowired private StudentQuestionLogAnswerService studentQuestionLogAnswerService;
@@ -510,15 +515,32 @@ public class StudentService extends CoreBaseService<Student>{
 //                            msg += "第"+ToolUtils.numberToLetter(map.get(columns[3])+1)+"列,第"+(i+1)+"行学号为空<br>";
                             errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[3])+1)+"列,第"+(i+1)+"行学号为空"});
                             continue;
-                        }else if(className.split("_").length != 2){
-//                            msg += "第"+ToolUtils.numberToLetter(map.get(columns[1])+1)+"列,第"+(i+1)+"行班级ID丢失<br>";
-                            errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[1])+1)+"列,第"+(i+1)+"行班级ID丢失"});
-                            continue;
+//                        }else if(className.split("_").length != 2){
+////                            msg += "第"+ToolUtils.numberToLetter(map.get(columns[1])+1)+"列,第"+(i+1)+"行班级ID丢失<br>";
+//                            errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[1])+1)+"列,第"+(i+1)+"行班级ID丢失"});
+//                            continue;
                         }else {
 
+                            String schoolClassId = "";
+                            // 通过名字查询院校信息,如果查询不到就告诉前台需要先去添加院校
+                            SchoolClass schoolClass = schoolClassDao.createLambdaQuery()
+                                    .andEq(SchoolClass::getClassName, className)
+                                    .andEq(SchoolClass::getClassStatus, 1)
+                                    .unique();
+
+                            // 通过名字没查询到院校的时候
+                            if(ObjectUtil.isEmpty(schoolClass)) {
+                                // 正则取院校ID
+                                schoolClassId = ReUtil.get("\\d+", className, 0);
+                                Assert.notBlank(schoolClassId, "未查询到院校,请先添加院校信息!");
+                            }
+
+                            // 这个时候院校ID一定存在
+                            schoolClassId = schoolClass.getClassId().toString();
+
                             Student pojo = new Student();
 
-                            pojo.setClassId(Long.parseLong(className.split("_")[1]));
+                            pojo.setClassId(Long.parseLong(schoolClassId));
                             pojo.setStudentName(studentName);
                             pojo.setStudentSn(studentSn);
                             pojo.setStudentMobile(studentMobile);
@@ -539,7 +561,7 @@ public class StudentService extends CoreBaseService<Student>{
 
                                 {
                                     Student s = new Student();
-                                    s.setClassId(Long.parseLong(className.split("_")[1]));
+                                    s.setClassId(Long.parseLong(schoolClassId));
                                     s.setStudentName(studentName);
                                     if(studentDao.template(s).size()>1){
                                         errMsg.add(new String[]{"第"+(i+1)+"行存在同名同姓的学生,姓名 "+studentName+" 是否删除",pojo.getStudentId().toString()});
@@ -554,7 +576,6 @@ public class StudentService extends CoreBaseService<Student>{
                                 coreUser.setState("S1");
                                 coreUser.setDelFlag(0);
                                 coreUser.setCreateTime(date);
-                                SchoolClass schoolClass = schoolClassService.queryById(pojo.getClassId());
                                 coreUser.setOrgId(schoolClass.getOrgId());
                                 coreUser.setPassword("123qwe");
                                 userConsoleService.saveUser(coreUser);
diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherService.java
index dbb138bb..2690125c 100644
--- a/web/src/main/java/com/ibeetl/jlw/service/TeacherService.java
+++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherService.java
@@ -1,7 +1,9 @@
 package com.ibeetl.jlw.service;
 
 
+import cn.hutool.core.lang.Assert;
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.ReUtil;
 import cn.jlw.util.ToolUtils;
 import com.ibeetl.admin.console.service.UserConsoleService;
 import com.ibeetl.admin.core.dao.CoreUserRoleDao;
@@ -14,6 +16,7 @@ import com.ibeetl.admin.core.util.TimeTool;
 import com.ibeetl.admin.core.web.JsonResult;
 import com.ibeetl.admin.core.web.JsonReturnCode;
 import com.ibeetl.jlw.dao.TeacherDao;
+import com.ibeetl.jlw.dao.UniversitiesCollegesDao;
 import com.ibeetl.jlw.entity.*;
 import com.ibeetl.jlw.job.CacheLogJob;
 import com.ibeetl.jlw.web.query.*;
@@ -64,6 +67,7 @@ public class TeacherService extends CoreBaseService<Teacher> {
     @Autowired private CoreUserRoleDao coreUserRoleDao;
 
     @Autowired private UniversitiesCollegesService universitiesCollegesService;
+    @Autowired private UniversitiesCollegesDao universitiesCollegesDao;
 
     @Autowired private StudentService studentService;
 
@@ -360,13 +364,31 @@ public class TeacherService extends CoreBaseService<Teacher> {
                         }else if(StringUtils.isBlank(teacherJobNumber)){
                             errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[2])+1)+"列,第"+(i+1)+"行工号为空"});
                             continue;
-                        }else if(universitiesCollegesName.split("_").length != 2){
-                            errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[0])+1)+"列,第"+(i+1)+"行院校ID为空"});
-                            continue;
+//                        }else if(universitiesCollegesName.split("_").length != 2){
+//                            errMsg.add(new String[]{"第"+ToolUtils.numberToLetter(map.get(columns[0])+1)+"列,第"+(i+1)+"行院校ID为空"});
+//                            continue;
                         }else {
+
+                            String universitiesCollegesId = "";
+                            // 通过名字查询院校信息,如果查询不到就告诉前台需要先去添加院校
+                            UniversitiesColleges universitiesColleges = universitiesCollegesDao.createLambdaQuery()
+                                    .andEq(UniversitiesColleges::getUniversitiesCollegesName, universitiesCollegesName)
+                                    .andEq(UniversitiesColleges::getUniversitiesCollegesStatus, 1)
+                                    .unique();
+
+                            // 通过名字没查询到院校的时候
+                            if(ObjectUtil.isEmpty(universitiesColleges)) {
+                                // 正则取院校ID
+                                universitiesCollegesId = ReUtil.get("\\d+", universitiesCollegesName, 0);
+                                Assert.notBlank(universitiesCollegesId, "未查询到院校,请先添加院校信息!");
+                            }
+
+                            // 这个时候院校ID一定存在
+                            universitiesCollegesId = universitiesColleges.getUniversitiesCollegesId().toString();
+
                             Teacher pojo = new Teacher();
 
-                            pojo.setUniversitiesCollegesId(Long.parseLong(universitiesCollegesName.split("_")[1]));
+                            pojo.setUniversitiesCollegesId(Long.parseLong(universitiesCollegesId));
                             pojo.setTeacherName(teacherName);
                             pojo.setTeacherJobNumber(teacherJobNumber);
                             pojo.setTeacherMobile(teacherMobile);
@@ -386,7 +408,7 @@ public class TeacherService extends CoreBaseService<Teacher> {
                             }else {
                                 {
                                     Teacher t = new Teacher();
-                                    t.setUniversitiesCollegesId(Long.parseLong(universitiesCollegesName.split("_")[1]));
+                                    t.setUniversitiesCollegesId(Long.parseLong(universitiesCollegesId));
                                     t.setTeacherName(teacherName);
                                     if(teacherDao.template(t).size()>1){
                                         errMsg.add(new String[]{"第"+(i+1)+"行存在同名同姓的教师,姓名 "+teacherName+" 是否删除",pojo.getTeacherId().toString()});
@@ -400,7 +422,6 @@ public class TeacherService extends CoreBaseService<Teacher> {
                                 coreUser.setState("S1");
                                 coreUser.setDelFlag(0);
                                 coreUser.setCreateTime(date);
-                                UniversitiesColleges universitiesColleges = universitiesCollegesService.queryById(pojo.getUniversitiesCollegesId());
                                 coreUser.setOrgId(universitiesColleges.getOrgId());
                                 coreUser.setPassword("123qwe");
 
diff --git a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseScheduleSessionController.java b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseScheduleSessionController.java
index cefcc5be..5d0f4727 100644
--- a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseScheduleSessionController.java
+++ b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseScheduleSessionController.java
@@ -242,4 +242,19 @@ public class TeacherOpenCourseScheduleSessionController{
         return JsonResult.success();
     }
 
+    /**
+     * 教师端-学生端 课表分组查询
+     * 分组后的分页课表信息
+     *
+     * @param condition
+     * @return
+     */
+    @PostMapping(MODEL + "/listGroup.json")
+    @ResponseBody
+    public JsonResult<PageQuery> listGroupJson(TeacherOpenCourseScheduleSessionQuery condition){
+        PageQuery page = condition.getPageQuery();
+        teacherOpenCourseScheduleSessionService.queryByConditionGroup(page);
+        return JsonResult.success(page);
+    }
+
 }