Bläddra i källkod

Merge remote-tracking branch 'origin/master'

周箭河 4 år sedan
förälder
incheckning
12f1f9cef1

+ 11 - 0
cms/src/main/java/com/ym/mec/cms/controller/queryinfo/NewsInformationQueryInfo.java

@@ -27,6 +27,9 @@ public class NewsInformationQueryInfo extends QueryInfo {
 	@ApiModelProperty(value = "租客编号", required = false)
 	private Integer tenantId;
 	
+	@ApiModelProperty(value = "声部编号", required = false)
+	private Integer subjectId;
+	
 	private String clientName;
 	
 	private Date date;
@@ -94,4 +97,12 @@ public class NewsInformationQueryInfo extends QueryInfo {
 	public void setClientName(String clientName) {
 		this.clientName = clientName;
 	}
+
+	public Integer getSubjectId() {
+		return subjectId;
+	}
+
+	public void setSubjectId(Integer subjectId) {
+		this.subjectId = subjectId;
+	}
 }

+ 20 - 0
cms/src/main/java/com/ym/mec/cms/dal/entity/SysNewsInformation.java

@@ -72,6 +72,10 @@ public class SysNewsInformation {
 	private String attribute1;
 	
 	private String attribute2;
+	
+	private String subjectIdList;
+	
+	private String subjectName;
 
 	public String getLinkUrl() {
 		return linkUrl;
@@ -233,6 +237,22 @@ public class SysNewsInformation {
 		this.offlineTime = offlineTime;
 	}
 
+	public String getSubjectIdList() {
+		return subjectIdList;
+	}
+
+	public void setSubjectIdList(String subjectIdList) {
+		this.subjectIdList = subjectIdList;
+	}
+
+	public String getSubjectName() {
+		return subjectName;
+	}
+
+	public void setSubjectName(String subjectName) {
+		this.subjectName = subjectName;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 48 - 33
cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml

@@ -27,36 +27,41 @@
 		<result column="tenant_id_" property="tenantId" />
 		<result column="attribute1_" property="attribute1" />
 		<result column="attribute2_" property="attribute2" />
+		<result column="subject_id_list_" property="subjectIdList" />
+		<result column="subject_name_" property="subjectName" />
 	</resultMap>
 	
 	<sql id="queryCondition">
 		<where>
-			del_flag_=0 
+			sni.del_flag_=0 
 			<if test="type != null">
-				and type_ = #{type}
+				and sni.type_ = #{type}
 			</if>
 			<if test="subType != null">
-				and sub_type_ = #{subType}
+				and sni.sub_type_ = #{subType}
 			</if>
 			<if test="tenantId != null">
-				and tenant_id_ = #{tenantId}
+				and sni.tenant_id_ = #{tenantId}
 			</if>
 			<if test="status != null">
-				and status_ = #{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+				and sni.status_ = #{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 			</if>
 			<if test="title != null">
-				and title_ like '%' #{title} '%'
+				and sni.title_ like '%' #{title} '%'
 			</if>
 			<if test="search != null">
-				and title_ like '%' #{search} '%'
+				and sni.title_ like '%' #{search} '%'
+			</if>
+			<if test="subjectId != null">
+				and find_in_set(#{subjectId},sni.subject_id_list_)
 			</if>
 			<if test="clientName != 'manage'">
 				<choose>
 					<when test="memo != null and memo != ''">
-						and memo_ = #{memo}
+						and sni.memo_ = #{memo}
 					</when>
 					<otherwise>
-						and (memo_ is null or memo_ = '')
+						and (sni.memo_ is null or sni.memo_ = '')
 					</otherwise>
 				</choose>
 			</if>
@@ -75,8 +80,8 @@
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.cms.dal.entity.SysNewsInformation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO sys_news_information (id_,title_,content_,cover_image_,video_cover_image_,type_,online_time_,offline_time_,sub_type_,status_,create_time_,update_time_,link_url_,href_target_,order_,del_flag_,memo_,tenant_id_,attribute1_,attribute2_)
-		VALUES(#{id},#{title},#{content},#{coverImage},#{videoCoverImage},#{type},#{onlineTime},#{offlineTime},#{subType},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},0,#{memo},#{tenantId},#{attribute1},#{attribute2})
+		INSERT INTO sys_news_information (id_,title_,content_,cover_image_,video_cover_image_,type_,online_time_,offline_time_,sub_type_,status_,create_time_,update_time_,link_url_,href_target_,order_,del_flag_,memo_,tenant_id_,attribute1_,attribute2_,subject_id_list_)
+		VALUES(#{id},#{title},#{content},#{coverImage},#{videoCoverImage},#{type},#{onlineTime},#{offlineTime},#{subType},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},0,#{memo},#{tenantId},#{attribute1},#{attribute2},#{subjectIdList})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -137,6 +142,9 @@
 			<if test="attribute2 != null">
 				attribute2_ = #{attribute2},
 			</if>
+			<if test="subjectIdList != null">
+				subject_id_list_ = #{subjectIdList},
+			</if>
 		</set>
 		WHERE id_ = #{id}
 	</update>
@@ -148,15 +156,16 @@
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="SysNewsInformation" parameterType="map">
-		SELECT * FROM sys_news_information
+		SELECT sni.*,GROUP_CONCAT(s.name_) subject_name_ FROM sys_news_information sni left join subject s on find_in_set(s.id_,sni.subject_id_list_)
 		<include refid="queryCondition" />
-		order by status_ desc,order_ desc,update_time_ desc
+		group by sni.id_
+		order by sni.status_ desc,sni.order_ desc,sni.update_time_ desc
 		<include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM sys_news_information
+		SELECT COUNT(sni.id_) FROM sys_news_information sni
 		<include refid="queryCondition" />
 	</select>
 	
@@ -177,69 +186,75 @@
 	<!-- 分页查询 -->
 	<select id="queryHomePage" resultMap="SysNewsInformation"
 		parameterType="map">
-		SELECT * FROM sys_news_information where del_flag_=0
+		SELECT sni.*,GROUP_CONCAT(s.name_) subject_name_ FROM sys_news_information sni where sni.del_flag_=0
 		<if test="type != null">
-			and type_ = #{type}
+			and sni.type_ = #{type}
 		</if>
 		<if test="subType != null">
-			and sub_type_ = #{subType}
+			and sni.sub_type_ = #{subType}
 		</if>
 		<if test="status != null">
-			and status_ = #{status,
+			and sni.status_ = #{status,
 			typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 		</if>
 		<if test="title != null">
-			and title_ like '%' #{title} '%'
+			and sni.title_ like '%' #{title} '%'
 		</if>
 		<if test="search != null">
-			and title_ like '%' #{search} '%'
+			and sni.title_ like '%' #{search} '%'
 		</if>
 		<if test="tenantId != null">
-			and tenant_id_ = #{tenantId}
+			and sni.tenant_id_ = #{tenantId}
 		</if>
+			<if test="subjectId != null">
+				and find_in_set(#{subjectId},sni.subject_id_list_)
+			</if>
 		<if test="clientName != 'manage'">
 			<choose>
 				<when test="memo != null and memo != ''">
-					and memo_ = #{memo}
+					and sni.memo_ = #{memo}
 				</when>
 				<otherwise>
-					and (memo_ is null or memo_ = '')
+					and (sni.memo_ is null or sni.memo_ = '')
 				</otherwise>
 			</choose>
 		</if>
-		order by status_ desc,order_ desc,update_time_ desc
+		order by sni.status_ desc,sni.order_ desc,sni.update_time_ desc
 		<include refid="global.limit" />
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryHomeCount" resultType="int">
-		SELECT COUNT(*) FROM sys_news_information where del_flag_=0
+		SELECT COUNT(sni.id_) FROM sys_news_information sni where sni.del_flag_=0
 		<if test="type != null">
-			and type_ = #{type}
+			and sni.type_ = #{type}
 		</if>
 		<if test="subType != null">
-			and sub_type_ = #{subType}
+			and sni.sub_type_ = #{subType}
 		</if>
 		<if test="status != null">
-			and status_ = #{status,
+			and sni.status_ = #{status,
 			typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 		</if>
 		<if test="title != null">
-			and title_ like '%' #{title} '%'
+			and sni.title_ like '%' #{title} '%'
 		</if>
 		<if test="search != null">
-			and title_ like '%' #{search} '%'
+			and sni.title_ like '%' #{search} '%'
 		</if>
 		<if test="tenantId != null">
-			and tenant_id_ = #{tenantId}
+			and sni.tenant_id_ = #{tenantId}
 		</if>
+			<if test="subjectId != null">
+				and find_in_set(#{subjectId},sni.subject_id_list_)
+			</if>
 		<if test="clientName != 'manage'">
 			<choose>
 				<when test="memo != null and memo != ''">
-					and memo_ = #{memo}
+					and sni.memo_ = #{memo}
 				</when>
 				<otherwise>
-					and (memo_ is null or memo_ = '')
+					and (sni.memo_ is null or sni.memo_ = '')
 				</otherwise>
 			</choose>
 		</if>

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

@@ -101,6 +101,8 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
                                                            @Param("nextMonday") String nextMonday,
                                                            @Param("studentIds") List<Integer> studentIds);
 
+    List<StudentServeCourseDto> getNoCourseBeServeStudentInfo(@Param("noCourseStudentIds") List<Integer> noCourseStudentIds);
+
     /**
      * @param monday:
      * @return java.util.List<com.ym.mec.biz.dal.dto.StudentServeDto>

+ 42 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -342,6 +342,14 @@ public class StudentServeServiceImpl implements StudentServeService {
         }
         Map<Integer, List<StudentServeCourseDto>> studentCourseMap = studentFutureCourseInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getStudentId));
 
+        Set<Integer> haveCourseBeServeStudentIds = studentCourseMap.keySet();
+        List<Integer> allServeStudentIds = studentDao.getServeStudentIds();
+        Set<Integer> noCourseServeStudentIds = allServeStudentIds.stream().filter(id -> !haveCourseBeServeStudentIds.contains(id)).collect(Collectors.toSet());
+        List<StudentServeCourseDto> noCourseBeServeStudentInfo = new ArrayList<>();
+        if(!CollectionUtils.isEmpty(noCourseServeStudentIds)){
+            noCourseBeServeStudentInfo = studentDao.getNoCourseBeServeStudentInfo(new ArrayList<>(noCourseServeStudentIds));
+        }
+
         List<StudentExtracurricularExercisesSituation> results=new ArrayList<>();
 
         for (Map.Entry<Integer, List<StudentServeCourseDto>> studentCourseMapEntry : studentCourseMap.entrySet()) {
@@ -496,6 +504,40 @@ public class StudentServeServiceImpl implements StudentServeService {
             }
         }
 
+        Map<Integer, Set<String>> noCourseStudentMusicIdsMap = noCourseBeServeStudentInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getStudentId, Collectors.mapping(StudentServeCourseDto::getMusicGroupId, Collectors.toSet())));
+        Map<Integer, List<StudentServeCourseDto>> noCourseStudentCourseMap = noCourseBeServeStudentInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getStudentId));
+        for (Map.Entry<Integer, Set<String>> noCourseStudentMusicIdsMapEntry : noCourseStudentMusicIdsMap.entrySet()) {
+            Map<Integer, Integer> teacherNumMap = new HashMap<>();
+            for (String groupId : noCourseStudentMusicIdsMapEntry.getValue()) {
+                Integer teacherId = null;
+                List<BaseMapDto<Integer, Integer>> studentTeacherIdList = courseScheduleStudentPaymentDao.getStudentClassGroupBishopTeacherMap(null, groupId);
+                if(!CollectionUtils.isEmpty(studentTeacherIdList)){
+                    teacherId = studentTeacherIdList.get(0).getValue();
+                }
+                teacherId = Objects.isNull(teacherId)?noCourseStudentCourseMap.get(noCourseStudentMusicIdsMapEntry.getKey()).get(0).getLeadTeacherId():teacherId;
+                if(Objects.isNull(teacherId)){
+                    continue;
+                }
+
+                if(!teacherNumMap.containsKey(teacherId)){
+                    teacherNumMap.put(teacherId, 1);
+                }else{
+                    teacherNumMap.put(teacherId, teacherNumMap.get(teacherId)+1);
+                }
+
+            }
+
+            for (Map.Entry<Integer, Integer> teacherNumMapEntry : teacherNumMap.entrySet()) {
+                StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(noCourseStudentMusicIdsMapEntry.getKey(),
+                        teacherNumMapEntry.getKey(),
+                        nowDate.get(DateUtil.weekFields.weekOfYear()),
+                        DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
+                        "EXERCISE", null);
+                studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherNumMapEntry.getValue());
+                results.add(studentExtracurricularExercisesSituation);
+            }
+        }
+
         if(!CollectionUtils.isEmpty(results)){
 
             if(CollectionUtils.isEmpty(studentIds)){

+ 23 - 0
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -515,6 +515,29 @@
         ORDER BY cssp.user_id_,course_start_time_
     </select>
 
+    <select id="getNoCourseBeServeStudentInfo" resultMap="StudentServeCourseDto">
+        SELECT
+            sr.user_id_ student_id_,
+            stu.teacher_id_ lead_teacher_id_,
+            'MUSIC' group_type_,
+            sr.music_group_id_
+        FROM
+            student_registration sr
+            LEFT JOIN student stu ON sr.user_id_ = stu.user_id_
+            LEFT JOIN music_group mg ON sr.music_group_id_ = mg.id_
+        WHERE
+            mg.del_flag_ = 0
+            AND mg.organ_id_ IS NOT NULL
+            AND mg.status_ = 'PROGRESS'
+            AND sr.music_group_status_ = 'NORMAL'
+            <if test="noCourseStudentIds!=null and noCourseStudentIds.size()>0">
+                AND sr.user_id_ IN
+                <foreach collection="noCourseStudentIds" item="noCourseStudentId" open="(" close=")" separator=",">
+                    #{noCourseStudentId}
+                </foreach>
+            </if>
+    </select>
+
     <select id="getStudentNames" resultType="string">
         SELECT username_ FROM sys_user WHERE id_ IN
         <foreach collection="studentIds" item="studentId" separator="," open="(" close=")">