zouxuan 5 năm trước cách đây
mục cha
commit
025579567d

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupDao.java

@@ -683,4 +683,11 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
      * @return
      */
     Set<Integer> queryClassGroupIds(@Param("vipGroupIds") Set<Long> vipGroupIds);
+
+    /**
+     * 根据群编号,修改群名称
+     * @param groupId
+     * @param groupName
+     */
+    void updateGroupName(@Param("groupId") Integer groupId, @Param("groupName") String groupName);
 }

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ImGroupNoticeDao.java

@@ -0,0 +1,9 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.ImGroupNotice;
+import com.ym.mec.common.dal.BaseDAO;
+
+public interface ImGroupNoticeDao extends BaseDAO<Long, ImGroupNotice> {
+
+	
+}

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

@@ -40,6 +40,10 @@ public class ClassGroup {
 	@ApiModelProperty(value = "班级名称", required = true)
 	private String name;
 
+	/** 群名称 */
+	@ApiModelProperty(value = "群名称", required = true)
+	private String groupName;
+
 	/** 子班级名称列表 */
 	@ApiModelProperty(value = "子班班级名称")
 	private String classNames;
@@ -75,6 +79,14 @@ public class ClassGroup {
 	@ApiModelProperty(value = "班级图标",required = false)
 	private String img;
 
+	public String getGroupName() {
+		return groupName;
+	}
+
+	public void setGroupName(String groupName) {
+		this.groupName = groupName;
+	}
+
 	public String getTeachMode() {
 		return teachMode;
 	}

+ 103 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ImGroupNotice.java

@@ -0,0 +1,103 @@
+package com.ym.mec.biz.dal.entity;
+
+import com.ym.mec.biz.dal.enums.YesOrNoEnum;
+import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 对应数据库表(im_group_notice):
+ */
+public class ImGroupNotice {
+	private Long id;
+
+	private Long imGroupId;
+
+	private String title;
+
+	private String content;
+
+	private YesOrNoEnum isTop;
+
+	private YesOrNoEnum isSentToNewMember;
+
+	private Date createTime;
+
+	private Date updateTime;
+
+	private YesOrNoEnum delFlag;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getImGroupId() {
+		return imGroupId;
+	}
+
+	public void setImGroupId(Long imGroupId) {
+		this.imGroupId = imGroupId;
+	}
+
+	public String getTitle() {
+		return title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	public String getContent() {
+		return content;
+	}
+
+	public void setContent(String content) {
+		this.content = content;
+	}
+
+	public YesOrNoEnum getIsTop() {
+		return isTop;
+	}
+
+	public void setIsTop(YesOrNoEnum isTop) {
+		this.isTop = isTop;
+	}
+
+	public YesOrNoEnum getIsSentToNewMember() {
+		return isSentToNewMember;
+	}
+
+	public void setIsSentToNewMember(YesOrNoEnum isSentToNewMember) {
+		this.isSentToNewMember = isSentToNewMember;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
+	public YesOrNoEnum getDelFlag() {
+		return delFlag;
+	}
+
+	public void setDelFlag(YesOrNoEnum delFlag) {
+		this.delFlag = delFlag;
+	}
+}

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupService.java

@@ -413,4 +413,10 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
      */
     Map<String,Object> getUserInfoWithUserId(Integer groupId, Integer userId);
 
+    /**
+     * 根据群编号,修改群名称
+     * @param groupId
+     * @param groupName
+     */
+    void updateGroupName(Integer groupId, String groupName);
 }

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

@@ -0,0 +1,7 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.ImGroupNotice;
+import com.ym.mec.common.service.BaseService;
+
+public interface ImGroupNoticeService extends BaseService<Long, ImGroupNotice> {
+}

+ 6 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -2589,6 +2589,11 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         return map;
     }
 
+    @Override
+    public void updateGroupName(Integer groupId, String groupName) {
+        classGroupDao.updateGroupName(groupId,groupName);
+    }
+
 
     @Override
     public ClassGroup findGroupById(Integer groupId) {
@@ -2597,7 +2602,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             if(classGroup.getGroupType() == GroupType.MUSIC){
                 MusicGroup musicGroup = musicGroupDao.get(classGroup.getMusicGroupId());
                 if(musicGroup != null){
-                    classGroup.setName(musicGroup.getName() + " " + classGroup.getName());
+                    classGroup.setName(musicGroup.getName() + " " + (StringUtils.isEmpty(classGroup.getGroupName())?classGroup.getName():classGroup.getGroupName()));
                 }
             }
         }

+ 21 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImGroupNoticeServiceImpl.java

@@ -0,0 +1,21 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.biz.dal.dao.ImGroupNoticeDao;
+import com.ym.mec.biz.dal.entity.ImGroupNotice;
+import com.ym.mec.biz.service.ImGroupNoticeService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ImGroupNoticeServiceImpl extends BaseServiceImpl<Long, ImGroupNotice>  implements ImGroupNoticeService {
+
+	@Autowired
+	private ImGroupNoticeDao imGroupNoticeDao;
+
+	@Override
+	public BaseDAO<Long, ImGroupNotice> getDAO() {
+		return imGroupNoticeDao;
+	}
+}

+ 5 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentAttendanceServiceImpl.java

@@ -535,14 +535,17 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 									byStatusAndCourseScheduleId.setUpdateTime(date);
 									studentAttendanceDao.update(byStatusAndCourseScheduleId);
 								}else {
+                                    byStatusAndCourseScheduleId = new StudentAttendance();
 									byStatusAndCourseScheduleId.setSignOutTime(endDateTime);
 									byStatusAndCourseScheduleId.setStatus(statusEnum);
 									byStatusAndCourseScheduleId.setSignInTime(startDateTime);
 									byStatusAndCourseScheduleId.setUpdateTime(date);
 									byStatusAndCourseScheduleId.setUserId(userId);
 									byStatusAndCourseScheduleId.setTeacherId(courseSchedule.getActualTeacherId());
-									byStatusAndCourseScheduleId.setClassGroupId(classGroup.getId());
-									byStatusAndCourseScheduleId.setCourseScheduleId(courseScheduleId.longValue());
+									byStatusAndCourseScheduleId.setClassGroupId(e.getClassGroupId());
+									byStatusAndCourseScheduleId.setCourseScheduleId(e.getId());
+                                    byStatusAndCourseScheduleId.setMusicGroupId(e.getMusicGroupId());
+                                    byStatusAndCourseScheduleId.setGroupType(e.getGroupType());
 									byStatusAndCourseScheduleId.setCurrentClassTimes(classGroup.getCurrentClassTimes() + 1);
 									studentAttendanceDao.insert(byStatusAndCourseScheduleId);
 								}

+ 12 - 4
mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml

@@ -12,6 +12,7 @@
         <result column="subject_id_list_" property="subjectIdList"/>
         <result column="subject_name_" property="subjectName"/>
         <result column="name_" property="name"/>
+        <result column="group_name_" property="groupName"/>
         <result column="student_num_" property="studentNum"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
@@ -268,7 +269,8 @@
         <result column="group_name_" property="groupName"/>
     </resultMap>
     <select id="queryUserMusicGroups" resultMap="imGroupModel">
-        SELECT cg.id_,cg.name_,cg.student_num_,cg.img_,mg.name_ group_name_
+        SELECT cg.id_,CASE WHEN cg.group_name_ IS NULL OR cg.group_name_ = '' THEN cg.name_ ELSE cg.group_name_ END name_,
+        cg.student_num_,cg.img_,mg.name_ group_name_
         FROM class_group_student_mapper cgsm
         LEFT JOIN class_group cg ON cgsm.class_group_id_ = cg.id_
         LEFT JOIN music_group mg ON mg.id_ = cg.music_group_id_
@@ -285,7 +287,8 @@
     </select>
 
     <select id="queryUserVipGroups" resultMap="imGroupModel">
-        SELECT cg.id_,cg.name_,cg.student_num_,cg.img_
+        SELECT cg.id_,CASE WHEN cg.group_name_ IS NULL OR cg.group_name_ = '' THEN cg.name_ ELSE cg.group_name_ END name_,
+        cg.student_num_,cg.img_
         FROM class_group_student_mapper cgsm
         LEFT JOIN class_group cg ON cgsm.class_group_id_ = cg.id_
         LEFT JOIN vip_group vg ON vg.id_ = cg.music_group_id_
@@ -301,7 +304,8 @@
         GROUP BY cg.id_
     </select>
     <select id="queryUserCommGroups" resultMap="imGroupModel">
-        SELECT cg.id_,cg.name_,cg.student_num_,cg.img_
+        SELECT cg.id_,CASE WHEN cg.group_name_ IS NULL OR cg.group_name_ = '' THEN cg.name_ ELSE cg.group_name_ END name_,
+        cg.student_num_,cg.img_
         FROM class_group_student_mapper cgsm
         LEFT JOIN class_group cg ON cgsm.class_group_id_ = cg.id_
         LEFT JOIN courses_group vg ON vg.id_ = cg.music_group_id_
@@ -395,7 +399,8 @@
     </select>
 
     <select id="queryTeacherGroups" resultMap="imGroupModel">
-        SELECT cg.id_,cg.name_,cg.student_num_,cg.img_,mg.name_ group_name_
+        SELECT cg.id_,CASE WHEN cg.group_name_ IS NULL OR cg.group_name_ = '' THEN cg.name_ ELSE cg.group_name_ END name_,
+        cg.student_num_,cg.img_,mg.name_ group_name_
         FROM class_group_teacher_mapper cgtm
         LEFT JOIN class_group cg ON cgtm.class_group_id_ = cg.id_
         LEFT JOIN music_group mg ON mg.id_ = cg.music_group_id_ AND cg.group_type_ = 'MUSIC'
@@ -1079,6 +1084,9 @@
             WHERE id_ = #{classGroup.id}
         </foreach>
     </update>
+    <update id="updateGroupName">
+        UPDATE class_group SET group_name_ = #{groupName} WHERE id_ = #{groupId}
+    </update>
 
     <resultMap id="SuperClassGroupInfo" type="com.ym.mec.biz.dal.dto.SuperClassGroupDto" extends="ClassGroup">
 

+ 85 - 0
mec-biz/src/main/resources/config/mybatis/ImGroupNoticeMapper.xml

@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!--
+这个文件是自动生成的。
+不要修改此文件。所有改动将在下次重新自动生成时丢失。
+-->
+<mapper namespace="com.ym.mec.biz.dal.dao.ImGroupNoticeDao">
+
+    <resultMap type="com.ym.mec.biz.dal.entity.ImGroupNotice" id="ImGroupNotice">
+        <result column="id_" property="id"/>
+        <result column="im_group_id_" property="imGroupId"/>
+        <result column="title_" property="title"/>
+        <result column="content_" property="content"/>
+        <result column="is_top_" property="isTop" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="is_sent_to_new_member_" property="isSentToNewMember" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="del_flag_" property="delFlag" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="create_time_" property="createTime"/>
+        <result column="update_time_" property="updateTime"/>
+    </resultMap>
+
+    <!-- 根据主键查询一条记录 -->
+    <select id="get" resultMap="ImGroupNotice">
+		SELECT * FROM im_group_notice WHERE id_ = #{id}
+	</select>
+
+    <!-- 全查询 -->
+    <select id="findAll" resultMap="ImGroupNotice">
+		SELECT * FROM im_group_notice ORDER BY id_
+	</select>
+
+    <!-- 向数据库增加一条记录 -->
+    <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ImGroupNotice" useGeneratedKeys="true" keyColumn="id"
+            keyProperty="id">
+        INSERT INTO im_group_notice (im_group_id_,title_,content_,is_top_,is_sent_to_new_member_,
+        del_flag_,create_time_,update_time_)
+        VALUES(#{imGroupId},#{title},#{content},#{isTop, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+        #{isSentToNewMember, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+        #{delFlag, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now())
+    </insert>
+
+    <!-- 根据主键查询一条记录 -->
+    <update id="update" parameterType="com.ym.mec.biz.dal.entity.ImGroupNotice">
+        UPDATE im_group_notice
+        <set>
+            <if test="delFlag != null">
+                del_flag_ = #{delFlag, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            </if>
+            <if test="title != null">
+                title_ = #{title},
+            </if>
+            <if test="content != null">
+                content_ = content,
+            </if>
+            <if test="isTop != null">
+                is_top_ = #{isTop, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            </if>
+            <if test="isSentToNewMember != null">
+                is_sent_to_new_member_ = #{isSentToNewMember, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            </if>
+            <if test="updateTime != null">
+                update_time_ = NOW()
+            </if>
+        </set>
+        WHERE id_ = #{id}
+    </update>
+
+    <!-- 根据主键删除一条记录 -->
+    <update id="delete">
+		UPDATE im_group_notice SET del_flag_ = 1 WHERE id_ = #{id}
+	</update>
+
+    <!-- 分页查询 -->
+    <select id="queryPage" resultMap="ImGroupNotice" parameterType="map">
+        SELECT * FROM im_group_notice
+        WHERE del_flag_ != 1
+        ORDER BY update_time_ DESC
+        <include refid="global.limit"/>
+    </select>
+
+    <!-- 查询当前表的总记录数 -->
+    <select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM im_group_notice
+		WHERE del_flag_ != 1
+	</select>
+</mapper>

+ 11 - 0
mec-web/src/main/java/com/ym/mec/web/controller/education/ImController.java

@@ -8,6 +8,7 @@ import com.ym.mec.biz.service.TeacherService;
 import com.ym.mec.common.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -60,6 +61,16 @@ public class ImController extends BaseController {
         return succeed(classGroupService.findGroupById(groupId));
     }
 
+    @ApiOperation(value = "根据群编号,修改群名称")
+    @GetMapping("/updateGroupName")
+    public Object updateGroupName(Integer groupId,String groupName){
+        if(null == groupId || StringUtils.isEmpty(groupName)){
+            return failed("参数校验错误");
+        }
+        classGroupService.updateGroupName(groupId,groupName);
+        return succeed();
+    }
+
     @ApiOperation(value = "根据群编号,获取群组所有成员基本信息")
     @GetMapping("/findGroupUsers")
     @PreAuthorize("@pcs.hasPermissions('im/findGroupUsers','system')")

+ 61 - 0
mec-web/src/main/java/com/ym/mec/web/controller/education/ImGroupNoticeController.java

@@ -0,0 +1,61 @@
+package com.ym.mec.web.controller.education;
+
+import com.ym.mec.biz.dal.entity.ImGroupNotice;
+import com.ym.mec.biz.service.ImGroupNoticeService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Date;
+
+/**
+ * @Author Joburgess
+ * @Date 2019/9/18
+ */
+@RequestMapping("imGroupNotice")
+@Api(tags = "即时通讯群公告")
+@RestController
+public class ImGroupNoticeController extends BaseController {
+
+    @Autowired
+    private ImGroupNoticeService imGroupNoticeService;
+
+    @ApiOperation(value = "新增")
+    @PostMapping("/add")
+    @PreAuthorize("@pcs.hasPermissions('imGroupNotice/add','system')")
+    public Object add(ImGroupNotice imGroupNotice ) {
+        return succeed(imGroupNoticeService.insert(imGroupNotice));
+    }
+
+    @ApiOperation(value = "修改")
+    @PostMapping("/update")
+    @PreAuthorize("@pcs.hasPermissions('imGroupNotice/update','system')")
+    public Object update(ImGroupNotice imGroupNotice ) {
+        imGroupNotice.setUpdateTime(new Date());
+        imGroupNoticeService.update(imGroupNotice);
+        return succeed();
+    }
+
+    @ApiOperation(value = "删除")
+    @PostMapping("/del")
+    @PreAuthorize("@pcs.hasPermissions('imGroupNotice/del','system')")
+    public Object del(Long id) {
+        imGroupNoticeService.delete(id);
+        return succeed();
+    }
+
+    @ApiOperation(value = "分页查询作业列表")
+    @GetMapping(value = "/queryPage")
+    @PreAuthorize("@pcs.hasPermissions('imGroupNotice/queryPage','system')")
+    public Object queryPage(QueryInfo queryInfo){
+        return succeed(imGroupNoticeService.queryPage(queryInfo));
+    }
+
+}