Explorar o código

update:服务指标改造

yonge %!s(int64=3) %!d(string=hai) anos
pai
achega
26cbeb23b6

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ExtracurricularExercises.java

@@ -17,6 +17,8 @@ public class ExtracurricularExercises extends BaseEntity {
 	/**  */
 	private Long id;
 	
+	private String musicGroupId;
+	
 	/** 老师编号 */
 	@ApiModelProperty(value="等级")
 	private Integer teacherId;
@@ -249,6 +251,14 @@ public class ExtracurricularExercises extends BaseEntity {
 		this.organName = organName;
 	}
 
+	public String getMusicGroupId() {
+		return musicGroupId;
+	}
+
+	public void setMusicGroupId(String musicGroupId) {
+		this.musicGroupId = musicGroupId;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 13 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentExtracurricularExercisesSituation.java

@@ -15,6 +15,8 @@ public class StudentExtracurricularExercisesSituation extends BaseEntity {
 	/**  */
 	private Long id;
 	
+	private String musicGroupId;
+	
 	/**  */
 	private Integer studentId;
 	
@@ -64,7 +66,8 @@ public class StudentExtracurricularExercisesSituation extends BaseEntity {
 	public StudentExtracurricularExercisesSituation() {
 	}
 
-	public StudentExtracurricularExercisesSituation(Integer studentId, Integer teacherId, Integer weekOfYear, Date monday, Date sunday,  String serveType, String courseIds) {
+	public StudentExtracurricularExercisesSituation(String musicGroupId, Integer studentId, Integer teacherId, Integer weekOfYear, Date monday, Date sunday,  String serveType, String courseIds) {
+		this.musicGroupId = musicGroupId;
 		this.studentId = studentId;
 		this.weekOfYear = weekOfYear;
 		this.monday = monday;
@@ -111,6 +114,14 @@ public class StudentExtracurricularExercisesSituation extends BaseEntity {
 		return this.id;
 	}
 			
+	public String getMusicGroupId() {
+		return musicGroupId;
+	}
+
+	public void setMusicGroupId(String musicGroupId) {
+		this.musicGroupId = musicGroupId;
+	}
+
 	public void setStudentId(Integer studentId){
 		this.studentId = studentId;
 	}
@@ -248,7 +259,7 @@ public class StudentExtracurricularExercisesSituation extends BaseEntity {
 			StudentExtracurricularExercisesSituation dto = (StudentExtracurricularExercisesSituation) obj;
 
 			if (this.monday.equals(dto.getMonday()) && this.studentId.intValue() == dto.getStudentId() && this.teacherId.intValue() == dto.getTeacherId()
-					&& this.serveType.equals(dto.getServeType())) {
+					&& this.serveType.equals(dto.getServeType()) && this.musicGroupId.equals(dto.getMusicGroupId())) {
 				return true;
 			}
 		}

+ 14 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -448,14 +448,14 @@ public class StudentServeServiceImpl implements StudentServeService {
         
         Map<Integer,Map<Integer,Set<Long>>> studentTeacherCourseMap = new HashMap<Integer, Map<Integer,Set<Long>>>();
         Map<Integer,Map<Integer,Set<Long>>> studentTeacherNotOverCourseMap = new HashMap<Integer, Map<Integer,Set<Long>>>();
-        Map<Integer,Map<Integer,Integer>> studentTeacherCourseNumMap = new HashMap<Integer, Map<Integer,Integer>>();
+        //Map<Integer,Map<Integer,Integer>> studentTeacherCourseNumMap = new HashMap<Integer, Map<Integer,Integer>>();
 		
 		Map<Integer, Set<Long>> teacherCourseMap = null;
 		Map<Integer, Set<Long>> teacherNotOverCourseMap = null;
 		Integer teacherId = null;
 		Set<Long> courseIdList = null;
 		ClassGroupTypeEnum teacherType;
-		Map<Integer,Integer> teacherCourseNumMap = null;
+		//Map<Integer,Integer> teacherCourseNumMap = null;
 		List<Integer> musicGroupStudentIdList = null;
         
         //理论上一个学生一个乐团只布置一次作业
@@ -492,23 +492,23 @@ public class StudentServeServiceImpl implements StudentServeService {
 						continue;
 					}
 					
-					teacherCourseNumMap = studentTeacherCourseNumMap.get(studentId);
+					/*teacherCourseNumMap = studentTeacherCourseNumMap.get(studentId);
 					if(teacherCourseNumMap == null){
 						teacherCourseNumMap = new HashMap<Integer, Integer>();
 					}
 					teacherCourseNumMap.put(teacherId, teacherCourseNumMap.get(teacherId) == null ? 1 : teacherCourseNumMap.get(teacherId) + 1);
-					studentTeacherCourseNumMap.put(studentId, teacherCourseNumMap);
+					studentTeacherCourseNumMap.put(studentId, teacherCourseNumMap);*/
 					
 					//本周没有课,布置课外训练
-					studentExtracurricularExercisesSituation = new StudentExtracurricularExercisesSituation(studentId, teacherId,
+					studentExtracurricularExercisesSituation = new StudentExtracurricularExercisesSituation(musicGroupId, studentId, teacherId,
 							nowDate.get(DateUtil.weekFields.weekOfYear()), DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(
 									sunDayDate.toString(), "yyyy-MM-dd"), "EXERCISE", null);
 					
-					
-					studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherCourseNumMap.get(teacherId));
+					studentExtracurricularExercisesSituation.setExpectExercisesNum(1);
+					/*studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherCourseNumMap.get(teacherId));
 					if(results.contains(studentExtracurricularExercisesSituation)){
 						results.remove(studentExtracurricularExercisesSituation);
-					}
+					}*/
 					results.add(studentExtracurricularExercisesSituation);
 				}else{//如果本周有课
 
@@ -527,7 +527,7 @@ public class StudentServeServiceImpl implements StudentServeService {
 					teacherCourseMap.put(teacherId, courseIdList);
 					studentTeacherCourseMap.put(studentId, teacherCourseMap);
 					
-					studentExtracurricularExercisesSituation = new StudentExtracurricularExercisesSituation(studentId, teacherId,
+					studentExtracurricularExercisesSituation = new StudentExtracurricularExercisesSituation(musicGroupId, studentId, teacherId,
 							nowDate.get(DateUtil.weekFields.weekOfYear()), DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(
 									sunDayDate.toString(), "yyyy-MM-dd"), "HOMEWORK", StringUtils.join(courseIdList, ","));
                     studentExtracurricularExercisesSituation.setExpectExercisesNum(courseIdList.size());
@@ -633,7 +633,11 @@ public class StudentServeServiceImpl implements StudentServeService {
 
                 List<ExtracurricularExercisesReply> studentAllExercises = studentExercisesMap.get(weekServiceWithStudent.getStudentId());
                 if(!CollectionUtils.isEmpty(studentAllExercises)&&weekServiceWithStudent.getServeType().equals("EXERCISE")){
-                    List<ExtracurricularExercisesReply> studentExercises = studentAllExercises.stream().filter(s -> weekServiceWithStudent.getTeacherId().equals(s.getExtracurricularExercises().getTeacherId())).collect(Collectors.toList());
+					List<ExtracurricularExercisesReply> studentExercises = studentAllExercises
+							.stream()
+							.filter(s -> (weekServiceWithStudent.getTeacherId().equals(s.getExtracurricularExercises().getTeacherId())
+									&& weekServiceWithStudent.getMusicGroupId().equals(s.getExtracurricularExercises().getMusicGroupId())))
+							.collect(Collectors.toList());
                     if(!CollectionUtils.isEmpty(studentExercises)){
                         weekServiceWithStudent.setActualExercisesNum(studentExercises.size()>weekServiceWithStudent.getExpectExercisesNum()?weekServiceWithStudent.getExpectExercisesNum():studentExercises.size());
                         long replyNum = studentExercises.stream().filter(e -> e.getStatus()==1).count();

+ 3 - 5
mec-biz/src/main/resources/config/mybatis/ExtracurricularExercisesMapper.xml

@@ -177,12 +177,10 @@
 			su.avatar_ headUrl,
 			GROUP_CONCAT(sub.name_) subjectName,
 		    stu.member_rank_setting_id_ memberRankSettingId,
-			stu.subject_id_list_ subjectIdList
+			stu.subject_id_list_ subjectIdList,
+			sees.music_group_id_ musicGroupId
 		FROM
 			student_extracurricular_exercises_situation_ sees
-			<if test="musicGroupId!=null and musicGroupId!=''">
-				LEFT JOIN student_registration sr ON sees.student_id_=sr.user_id_
-			</if>
 			<if test="classGroupId!=null">
 				LEFT JOIN class_group_student_mapper cgsm ON sees.student_id_ = cgsm.user_id_
 			</if>
@@ -206,7 +204,7 @@
 				AND FIND_IN_SET(sees.student_id_,#{studentIds})
 			</if>
 			<if test="musicGroupId!=null and musicGroupId!=''">
-				AND sr.music_group_id_=#{musicGroupId}
+				AND sees.music_group_id_=#{musicGroupId}
 			</if>
 			<if test="classGroupId!=null">
 				AND cgsm.class_group_id_ = #{classGroupId}

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

@@ -9,6 +9,7 @@
     <resultMap type="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation"
                id="StudentExtracurricularExercisesSituation">
         <result column="id_" property="id"/>
+        <result column="music_group_id_" property="musicGroupId"/>
         <result column="student_id_" property="studentId"/>
         <result column="week_of_year_" property="weekOfYear"/>
         <result column="monday_" property="monday"/>
@@ -61,24 +62,24 @@
         </selectKey>
         -->
         INSERT INTO student_extracurricular_exercises_situation_
-        (id_,student_id_,week_of_year_,monday_,sunday_,teacher_id_,expect_exercises_num_,
+        (id_,music_group_id_,student_id_,week_of_year_,monday_,sunday_,teacher_id_,expect_exercises_num_,
         actual_exercises_num_,exercises_reply_num_,exercises_message_num_,
         exercises_message_timely_num_,create_time_,update_time_,last_submit_time_,
         serve_type_,course_ids_,not_over_course_ids_,not_over_course_num_,tenant_id_)
-        VALUES(#{id},#{studentId},#{weekOfYear},#{monday},#{sunday},#{teacherId},#{expectExercisesNum},#{actualExercisesNum},#{exercisesReplyNum},
+        VALUES(#{id},#{musicGroupId},#{studentId},#{weekOfYear},#{monday},#{sunday},#{teacherId},#{expectExercisesNum},#{actualExercisesNum},#{exercisesReplyNum},
         #{exercisesMessageNum},#{exercisesMessageTimelyNum},NOW(),NOW(),#{lastSubmitTime},#{serveType},#{courseIds},#{notOverCourseIds},#{notOverCourseNum},#{tenantId})
     </insert>
 
     <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation"
             useGeneratedKeys="true" keyColumn="id" keyProperty="id">
         INSERT INTO student_extracurricular_exercises_situation_
-        (student_id_,week_of_year_,monday_,sunday_,teacher_id_,expect_exercises_num_,
+        (music_group_id_,student_id_,week_of_year_,monday_,sunday_,teacher_id_,expect_exercises_num_,
         actual_exercises_num_,exercises_reply_num_,exercises_message_num_,
         exercises_message_timely_num_,create_time_,update_time_,last_submit_time_,
         serve_type_,course_ids_,not_over_course_ids_,not_over_course_num_,tenant_id_)
         VALUES
         <foreach collection="situations" item="situation" separator=",">
-            (#{situation.studentId},#{situation.weekOfYear},#{situation.monday},#{situation.sunday},#{situation.teacherId},#{situation.expectExercisesNum},
+            (#{situation.musicGroupId},#{situation.studentId},#{situation.weekOfYear},#{situation.monday},#{situation.sunday},#{situation.teacherId},#{situation.expectExercisesNum},
             #{situation.actualExercisesNum},#{situation.exercisesReplyNum},#{situation.exercisesMessageNum},#{situation.exercisesMessageTimelyNum},
             NOW(),NOW(),#{situation.lastSubmitTime},#{situation.serveType},#{situation.courseIds},#{situation.notOverCourseIds},#{situation.notOverCourseNum},#{situation.tenantId})
         </foreach>
@@ -118,6 +119,9 @@
             <if test="studentId != null">
                 student_id_ = #{studentId},
             </if>
+            <if test="musicGroupId != null">
+                music_group_id_ = #{musicGroupId},
+            </if>
             <if test="expectExercisesNum != null">
                 expect_exercises_num_ = #{expectExercisesNum},
             </if>
@@ -172,6 +176,9 @@
                 <if test="situation.studentId != null">
                     student_id_ = #{situation.studentId},
                 </if>
+	            <if test="situation.musicGroupId != null">
+	                music_group_id_ = #{situation.musicGroupId},
+	            </if>
                 <if test="situation.expectExercisesNum != null">
                     expect_exercises_num_ = #{situation.expectExercisesNum},
                 </if>
@@ -259,6 +266,7 @@
     <select id="findExercisesSituations" resultMap="StudentExercisesSituationDto">
         SELECT
         sees.id_ id_,
+        sees.music_group_id_,
         student_id_,
         stu.username_ student_name_,
         tea.real_name_ teacher_name_,