| 
					
				 | 
			
			
				@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.transaction.annotation.Isolation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.util.CollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.time.LocalDateTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.time.format.DateTimeFormatter; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -89,22 +90,41 @@ public class ExtracurricularExercisesServiceImpl extends BaseServiceImpl<Long, E 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		PageInfo<ExtracurricularExercises> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Map<String, Object> params = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		MapUtil.populateMap(params, queryInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<Map<String, Object>> result = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		List<ExtracurricularExercises> dataList = extracurricularExercisesDao.findExtraExercises(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		Map<String, List<ExtracurricularExercises>> collect = dataList.stream().collect(Collectors.groupingBy(e -> DateUtil.dateToString(e.getCreateTime(), "yyyy-MM-dd"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(!CollectionUtils.isEmpty(dataList)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			List<Long> extraExerciseIds = dataList.stream().map(ExtracurricularExercises::getId).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			List<ExtracurricularExercisesReply> extraExerciseStudentsByExtraExercises = extracurricularExercisesReplyDao.findExtraExerciseStudentsByExtraExercises(extraExerciseIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Map<Long, List<ExtracurricularExercisesReply>> idStudentsMap = extraExerciseStudentsByExtraExercises.stream().collect(Collectors.groupingBy(ExtracurricularExercisesReply::getExtracurricularExercisesId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			for (ExtracurricularExercises extracurricularExercises : dataList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				List<ExtracurricularExercisesReply> extracurricularExercisesReplies = idStudentsMap.get(extracurricularExercises.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if(CollectionUtils.isEmpty(extracurricularExercisesReplies)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				long repliedNum = extracurricularExercisesReplies.stream().filter(e -> e.getIsReplied() == 0).count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if(repliedNum<=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					extracurricularExercises.setIsReplied(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				long submitNum = extracurricularExercisesReplies.stream().filter(e -> e.getIsView() == 1).count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if(submitNum>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					extracurricularExercises.setIsSubmit(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		List<Map<String, Object>> result = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		List<Date> dates=new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		collect.keySet().forEach(ds-> dates.add(DateUtil.stringToDate(ds,"yyyy-MM-dd"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		dates.sort(Comparator.comparing(Date::getTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		dates.sort(Comparator.reverseOrder()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		for (Date date : dates) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			String key=DateUtil.dateToString(date, "yyyy-MM-dd"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			Map<String, Object> r = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			r.put("day", key); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			collect.get(key).sort(Comparator.comparing(ExtracurricularExercises::getCreateTime).reversed()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			r.put("list", collect.get(key)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			result.add(r); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Map<String, List<ExtracurricularExercises>> collect = dataList.stream().collect(Collectors.groupingBy(e -> DateUtil.dateToString(e.getCreateTime(), "yyyy-MM-dd"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			List<Date> dates=new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			collect.keySet().forEach(ds-> dates.add(DateUtil.stringToDate(ds,"yyyy-MM-dd"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			dates.sort(Comparator.comparing(Date::getTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			dates.sort(Comparator.reverseOrder()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			for (Date date : dates) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				String key=DateUtil.dateToString(date, "yyyy-MM-dd"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				Map<String, Object> r = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				r.put("day", key); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				collect.get(key).sort(Comparator.comparing(ExtracurricularExercises::getCreateTime).reversed()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				r.put("list", collect.get(key)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				result.add(r); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 |