소스 검색

添加群批量销毁,创建,后台老师管理(新增根据教师分部和流动范围查询(只改了这一个,其他的还没改))

zouxuan 5 년 전
부모
커밋
730e21ea99

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherDao.java

@@ -179,4 +179,6 @@ public interface TeacherDao extends BaseDAO<Integer, Teacher> {
      * @return
      */
     Map<String,Integer> queryOrganTeacherNum(@Param("organId") String organId);
+
+    List<Teacher> findByFlowOrganRange(Map<String, Object> params);
 }

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Teacher.java

@@ -43,6 +43,10 @@ public class Teacher extends SysUser {
 	@ApiModelProperty(value = "所属分部名称", required = false)
 	private String organName;
 
+	/** 所属分部名称 */
+	@ApiModelProperty(value = "教师所属分部编号", required = false)
+	private Integer teacherOrganId;
+
 	/** 工作单位 */
 	@ApiModelProperty(value = "工作单位", required = false)
 	private String workUnit;
@@ -94,6 +98,14 @@ public class Teacher extends SysUser {
 
 	private List<School> teacherSchools;
 
+	public Integer getTeacherOrganId() {
+		return teacherOrganId;
+	}
+
+	public void setTeacherOrganId(Integer teacherOrganId) {
+		this.teacherOrganId = teacherOrganId;
+	}
+
 	public String getSplitSubjectName() {
 		return splitSubjectName;
 	}

+ 13 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/TeacherQueryInfo.java

@@ -3,6 +3,8 @@ package com.ym.mec.biz.dal.page;
 import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.util.List;
+
 public class TeacherQueryInfo extends QueryInfo {
 
     @ApiModelProperty(value = "科目编号")
@@ -11,6 +13,9 @@ public class TeacherQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "机构编号")
     private String organId;
 
+    @ApiModelProperty(value = "教师编号")
+    private List<Integer> teacherId;
+
     @ApiModelProperty(value = "教师工作性质")
     private String jobNature;
 
@@ -20,6 +25,14 @@ public class TeacherQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "账号状态")
     private String lockFlag;
 
+    public List<Integer> getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(List<Integer> teacherId) {
+        this.teacherId = teacherId;
+    }
+
     public Integer getSubjectId() {
         return subjectId;
     }

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentManageService.java

@@ -106,4 +106,11 @@ public interface StudentManageService {
      * @param sysUser
      */
     void updateUser(SysUser sysUser);
+
+    /**
+     * 获取vip课班级列表
+     * @param queryInfo
+     * @return
+     */
+    PageInfo<StudentManageVipGroupDto> findStudentVipGroupClass(QueryInfo queryInfo);
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -242,4 +242,9 @@ public class StudentManageServiceImpl implements StudentManageService {
         studentRegistration.setCurrentGrade(sysUser.getCurrentGrade());
         studentRegistrationDao.updateCurrentClass(studentRegistration);
     }
+
+    @Override
+    public PageInfo<StudentManageVipGroupDto> findStudentVipGroupClass(QueryInfo queryInfo) {
+        return null;
+    }
 }

+ 19 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherServiceImpl.java

@@ -27,10 +27,11 @@ import org.springframework.transaction.annotation.Transactional;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 @Service
 public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  implements TeacherService {
-	
+
 	@Autowired
 	private TeacherDao teacherDao;
 	@Autowired
@@ -323,6 +324,20 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 
 	@Override
 	public PageInfo<Teacher> queryPageDetail(TeacherQueryInfo queryInfo) {
+		if(StringUtils.isNotEmpty(queryInfo.getOrganId())){
+			Set<String> list = new HashSet<>(Arrays.asList(queryInfo.getOrganId().split(",")));
+			list.stream().forEach(e->list.contains(e));
+			Map<String, Object> params = new HashMap<>();
+			MapUtil.populateMap(params, queryInfo);
+			List<Teacher> teacherList = teacherDao.findByFlowOrganRange(params);
+			List<Teacher> teachers = teacherList.stream().
+					filter(teacher -> !Collections.disjoint(new ArrayList<>(Arrays.asList(teacher.getFlowOrganRange().split(","))),list)).collect(Collectors.toList());
+			List<Integer> collect = teachers.stream().map(e -> e.getId()).collect(Collectors.toList());
+			if(collect != null && collect.size() > 0){
+				queryInfo.setTeacherId(collect);
+			}
+		}
+
 		PageInfo<Teacher> pageInfo = queryPage(queryInfo);
 		List<Teacher> rows = pageInfo.getRows();
 		if(rows != null && rows.size() > 0){
@@ -333,11 +348,11 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 			//获取试听课数量
 			Map<Integer,Integer> demoNumMap = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(demoGroupDao.countTeacherDemoGroupNum(teacherIds))),HashMap.class);
 
-//			Set<Integer> organIds = rows.stream().map(e -> e.getOrganId()).collect(Collectors.toSet());
-//			Map<Integer,String> organNames = MapUtil.convertMybatisMap(organizationDao.findOrganNameMap(StringUtils.join(organIds,",")));
+			Set<Integer> organIds = rows.stream().map(e -> e.getTeacherOrganId()).collect(Collectors.toSet());
+			Map<Integer,String> organNames = MapUtil.convertMybatisMap(organizationDao.findOrganNameMap(StringUtils.join(organIds,",")));
 			rows.forEach(e->{
 //				e.setSubjectName(subjectDao.findBySubIds(e.getSubjectId()));
-//				e.setOrganName(organNames.get(e.getOrganId()));
+				e.setOrganName(organNames.get(e.getTeacherOrganId()));
 				if(StringUtils.isNotEmpty(e.getSplitSubjectName())){
 					e.setSubjectName(Arrays.asList(e.getSplitSubjectName().split(",")));
 				}

+ 23 - 13
mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -9,6 +9,7 @@
     <resultMap type="com.ym.mec.biz.dal.entity.Teacher" id="Teacher">
         <result column="id_" property="id"/>
         <result column="organ_id_" property="organId"/>
+        <result column="teacher_organ_id_" property="teacherOrganId"/>
         <result column="organ_name_" property="organName"/>
         <result column="job_type_" property="jobType"/>
         <result column="job_nature_" property="jobNature"/>
@@ -208,7 +209,7 @@
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="Teacher" parameterType="map">
-        SELECT t.id_,su.real_name_,su.lock_flag_,t.subject_id_,su.phone_,su.organ_id_,
+        SELECT t.id_,su.real_name_,su.lock_flag_,t.subject_id_,su.phone_,t.organ_id_ teacher_organ_id_,t.organ_id_,
         t.job_nature_,t.is_probation_period_,GROUP_CONCAT(s.name_) subject_name_,su.del_flag_
         FROM teacher t LEFT JOIN sys_user su ON t.id_ = su.id_
         LEFT JOIN `subject` s ON FIND_IN_SET(s.id_,t.subject_id_)
@@ -230,21 +231,15 @@
         <if test="lockFlag != null">
             AND su.lock_flag_ = #{lockFlag}
         </if>
-        <if test="subjectId != null">
-            AND FIND_IN_SET(#{subjectId},t.subject_id_)
-        </if>
-        <if test="organId != null">
-            AND FIND_IN_SET(t.organ_id_,#{organId})
+        <if test="teacherId != null">
+            AND t.id_ IN
+            <foreach collection="teacherId" separator="," open="(" close=")" item="item">
+                #{item}
+            </foreach>
         </if>
         <if test="search != null">
             AND (su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
         </if>
-        <if test="jobNature != null">
-            AND t.job_nature_ = #{jobNature}
-        </if>
-        <if test="isProbationPeriod != null">
-            AND t.is_probation_period_ = #{isProbationPeriod}
-        </if>
     </sql>
 
     <!-- 根据证件号查询老师 -->
@@ -528,7 +523,7 @@
     </sql>
 
     <select id="queryOrganTeacherNum" resultType="map">
-        select count(*) total,sum(case when job_nature_ = 'PART_TIME' then 1 else 0 end) part_time_num_,sum(case when
+        select count(*) total,sum(case when job_nature_ = 'PART_TIME' then 1 else 0 end) part_time_num_,sum(case whfen
         job_nature_ = 'FULL_TIME' then 1 else 0 end) full_time_num_ from teacher
         <where>
             <if test="organId != null">
@@ -536,4 +531,19 @@
             </if>
         </where>
     </select>
+    <select id="findByFlowOrganRange" resultMap="Teacher">
+        SELECT id_,CONCAT(IF(flow_organ_range_ IS NULL OR flow_organ_range_ = '',0,flow_organ_range_),",",
+        IF(organ_id_ IS NULL OR organ_id_ = '',0,organ_id_)) flow_organ_range_ FROM teacher t
+        <where>
+            <if test="subjectId != null">
+                AND FIND_IN_SET(#{subjectId},t.subject_id_)
+            </if>
+            <if test="jobNature != null">
+                AND t.job_nature_ = #{jobNature}
+            </if>
+            <if test="isProbationPeriod != null">
+                AND t.is_probation_period_ = #{isProbationPeriod}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 18 - 0
mec-client-api/src/main/java/com/ym/mec/im/ImFeignService.java

@@ -11,6 +11,8 @@ import com.ym.mec.common.entity.ImResult;
 import com.ym.mec.common.entity.ImUserModel;
 import com.ym.mec.im.fallback.ImFeignServiceFallback;
 
+import java.util.List;
+
 @FeignClient(name = "im-server", configuration = FeignConfiguration.class, fallback = ImFeignServiceFallback.class)
 public interface ImFeignService {
 
@@ -39,6 +41,14 @@ public interface ImFeignService {
 	Object groupCreate(@RequestBody ImGroupModel groupModel);
 
 	/**
+	 * 批量创建群组
+	 * @param groupModels
+	 * @return
+	 */
+	@PostMapping(value = "group/batchCreate")
+	void groupBatchCreate(@RequestBody List<ImGroupModel> groupModels);
+
+	/**
 	 * 加入群组
 	 * @param groupModel
 	 * @return
@@ -61,4 +71,12 @@ public interface ImFeignService {
 	 */
 	@PostMapping(value = "group/dismiss")
 	Object groupDismiss(@RequestBody ImGroupModel groupModel);
+
+	/**
+	 * 批量解散群组
+	 * @param groupModels
+	 * @return
+	 */
+	@PostMapping(value = "group/batchDismiss")
+	Object groupBatchDismiss(@RequestBody List<ImGroupModel> groupModels);
 }

+ 12 - 0
mec-client-api/src/main/java/com/ym/mec/im/fallback/ImFeignServiceFallback.java

@@ -7,6 +7,8 @@ import com.ym.mec.common.entity.ImResult;
 import com.ym.mec.common.entity.ImUserModel;
 import com.ym.mec.im.ImFeignService;
 
+import java.util.List;
+
 @Component
 public class ImFeignServiceFallback implements ImFeignService {
     @Override
@@ -27,6 +29,11 @@ public class ImFeignServiceFallback implements ImFeignService {
     }
 
     @Override
+    public void groupBatchCreate(List<ImGroupModel> groupModels) {
+
+    }
+
+    @Override
     public Object groupJoin(ImGroupModel groupModel) {
         return null;
     }
@@ -40,4 +47,9 @@ public class ImFeignServiceFallback implements ImFeignService {
     public Object groupDismiss(ImGroupModel groupModel) {
         return null;
     }
+
+    @Override
+    public Object groupBatchDismiss(List<ImGroupModel> groupModels) {
+        return null;
+    }
 }

+ 7 - 2
mec-im/src/main/java/com/ym/controller/GroupController.java

@@ -59,8 +59,8 @@ public class GroupController{
     }
 
     @RequestMapping(value = "/batchCreate", method = RequestMethod.POST)
-    public Object batchCreate() throws Exception {
-        return groupService.batchCreate();
+    public void batchCreate(@RequestBody List<GroupModel> groupModels){
+        groupService.batchCreate(groupModels);
     }
 
     @RequestMapping(value = "/get", method = RequestMethod.POST)
@@ -89,4 +89,9 @@ public class GroupController{
         groupModel.setMembers(groupMember);
         return groupService.groupDismiss(groupModel);
     }
+
+    @RequestMapping(value = "/batchDismiss", method = RequestMethod.POST)
+    public void batchDismiss(@RequestBody List<GroupModel> groupModels){
+        groupService.groupBatchDismiss(groupModels);
+    }
 }

+ 7 - 1
mec-im/src/main/java/com/ym/service/GroupService.java

@@ -61,5 +61,11 @@ public interface GroupService {
      * 初始化群数据
      * @return
      */
-    Result batchCreate();
+    void batchCreate(List<GroupModel> groupModels);
+
+    /**
+     * 批量解散
+     * @param groupModels
+     */
+    void groupBatchDismiss(List<GroupModel> groupModels);
 }

+ 28 - 20
mec-im/src/main/java/com/ym/service/Impl/GroupServiceImpl.java

@@ -1,8 +1,5 @@
 package com.ym.service.Impl;
 
-import com.alibaba.fastjson.JSONObject;
-import com.ym.mec.biz.dal.dao.ClassGroupDao;
-import com.ym.mec.common.entity.ImGroupModel;
 import com.ym.service.GroupService;
 import io.rong.RongCloud;
 import io.rong.methods.conversation.Conversation;
@@ -12,10 +9,10 @@ import io.rong.methods.group.mute.MuteMembers;
 import io.rong.methods.group.mute.whitelist.User;
 import io.rong.models.Result;
 import io.rong.models.conversation.ConversationModel;
+import io.rong.models.group.GroupMember;
 import io.rong.models.group.GroupModel;
 import io.rong.models.group.UserGroup;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
@@ -30,9 +27,6 @@ public class GroupServiceImpl implements GroupService {
     @Value("${cn.rongcloud.im.secret}")
     private String appSecret;
 
-    @Autowired
-    private ClassGroupDao classGroupDao;
-
     private Group getGroup(){
         RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret);
         return new Group(appKey,appSecret,rongCloud);
@@ -152,18 +146,32 @@ public class GroupServiceImpl implements GroupService {
     }
 
     @Override
-    public Result batchCreate() {
-        List<ImGroupModel> studentGroup = classGroupDao.queryStudentGroup();
-        List<ImGroupModel> teacherGroup = classGroupDao.queryTeacherGroup();
-        studentGroup.addAll(teacherGroup);
-        List<GroupModel> groupModels1 = JSONObject.parseArray(JSONObject.toJSONString(studentGroup), GroupModel.class);
-        groupModels1.forEach(e->{
-            try {
-                getGroup().join(e);
-            } catch (Exception e1) {
-                e1.printStackTrace();
-            }
-        });
-        return null;
+    public void batchCreate(List<GroupModel> groupModels) {
+        if(groupModels != null && groupModels.size() > 0){
+            Group group = getGroup();
+            groupModels.forEach(e->{
+                try {
+                    group.create(e);
+                } catch (Exception e1) {
+                    e1.printStackTrace();
+                }
+            });
+        }
+    }
+
+    @Override
+    public void groupBatchDismiss(List<GroupModel> groupModels) {
+        if(groupModels != null && groupModels.size() > 0){
+            Group group = getGroup();
+            GroupMember[] groupMember = {new GroupMember("1",null,null)};
+            groupModels.forEach(e->{
+                try {
+                    e.setMembers(groupMember);
+                    group.dismiss(e);
+                } catch (Exception e1) {
+                    e1.printStackTrace();
+                }
+            });
+        }
     }
 }

+ 9 - 1
mec-web/src/main/java/com/ym/mec/web/controller/StudentManageController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -129,13 +130,20 @@ public class StudentManageController extends BaseController {
         return succeed(studentManageService.findStudentAttendances(queryInfo));
     }
 
-    @ApiOperation(value = "获取学生vip课")
+    @ApiOperation(value = "获取学生vip课")
     @GetMapping("/findStudentVipGroups")
     @PreAuthorize("@pcs.hasPermissions('studentManage/findStudentVipGroups')")
     public Object findStudentVipGroups(StudentManageCourseQueryInfo queryInfo){
         return succeed(studentManageService.findStudentVipGroups(queryInfo));
     }
 
+    @ApiOperation(value = "获取学生vip班级列表")
+    @GetMapping("/findStudentVipGroupClass")
+    @PreAuthorize("@pcs.hasPermissions('studentManage/findStudentVipGroupClass')")
+    public Object findStudentVipGroupClass(QueryInfo queryInfo){
+        return succeed(studentManageService.findStudentVipGroupClass(queryInfo));
+    }
+
     @ApiOperation(value = "获取用户默认账户基本信息")
     @GetMapping("/getUserCashAccountBaseInfo")
     @PreAuthorize("@pcs.hasPermissions('studentManage/getUserCashAccountBaseInfo')")