|
@@ -17,6 +17,8 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.Date;
|
|
|
import java.util.Iterator;
|
|
|
import java.util.List;
|
|
@@ -80,6 +82,9 @@ public class SysNewsTypeServiceImpl extends BaseServiceImpl<Integer, SysNewsType
|
|
|
}else if(sni.getTitle().equals("学员考勤异常")){
|
|
|
//当前老师是否有学员考勤异常
|
|
|
sni.setRedDot(informationDao.countStudentAttendanceError(startTime,userId));
|
|
|
+ } else if (sni.getTitle().equals("训练列表")) {
|
|
|
+ //训练列表
|
|
|
+ sni.setRedDot(queryHomework(userId));
|
|
|
}
|
|
|
}
|
|
|
e.setInformationList(list);
|
|
@@ -92,6 +97,23 @@ public class SysNewsTypeServiceImpl extends BaseServiceImpl<Integer, SysNewsType
|
|
|
return treeMenus;
|
|
|
}
|
|
|
|
|
|
+ private Boolean queryHomework(Integer userId) {
|
|
|
+ int courseIdCount = informationDao.queryHomework(userId);
|
|
|
+ if (courseIdCount > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
+ // 获取周一
|
|
|
+ LocalDate monday = now.minusDays(now.getDayOfWeek().getValue() - 1);
|
|
|
+ int practiceIdCount = informationDao.queryPractice(userId,monday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
|
|
+
|
|
|
+ if (practiceIdCount > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
private List<SysNewsType> getChildren(SysNewsType rootMenu, List<SysNewsType> allMenus) {
|
|
|
List<SysNewsType> childrenList = allMenus.stream().filter(e -> e.getParentId().equals(rootMenu.getId()))
|
|
|
.map(menu -> menu.setChildren(getChildren(menu, allMenus)))
|