|
@@ -10,11 +10,14 @@ import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.common.tenant.TenantContextHolder;
|
|
|
|
|
|
+import com.ym.mec.util.date.DateUtil;
|
|
|
+import com.ym.mec.web.WebFeignService;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -25,6 +28,8 @@ public class SysNewsTypeServiceImpl extends BaseServiceImpl<Integer, SysNewsType
|
|
|
private SysNewsTypeDao sysNewsTypeDao;
|
|
|
@Autowired
|
|
|
private SysNewsInformationDao informationDao;
|
|
|
+ @Autowired
|
|
|
+ private WebFeignService webFeignService;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Integer, SysNewsType> getDAO() {
|
|
@@ -54,10 +59,10 @@ public class SysNewsTypeServiceImpl extends BaseServiceImpl<Integer, SysNewsType
|
|
|
return sysNewsTypeDao.queryByParentId(parentId);
|
|
|
}
|
|
|
|
|
|
- public List<SysNewsType> listWithTree(Integer id, String memo) {
|
|
|
+ public List<SysNewsType> listWithTree(Integer id, String memo,Integer userId) {
|
|
|
SysNewsType newsType = sysNewsTypeDao.get(id);
|
|
|
List<SysNewsType> all = sysNewsTypeDao.findAll(null);
|
|
|
-
|
|
|
+ String startTime = DateUtil.format(DateUtil.getFirstDayOfMonth(DateUtil.addMonths(new Date(), -1)),DateUtil.ISO_EXPANDED_DATE_FORMAT);
|
|
|
all.forEach(e -> {
|
|
|
List<SysNewsInformation> list = informationDao.queryBySubType(e.getId(), memo);
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
@@ -69,7 +74,13 @@ public class SysNewsTypeServiceImpl extends BaseServiceImpl<Integer, SysNewsType
|
|
|
sni = iterator.next();
|
|
|
if(TenantContextHolder.getTenantId() != 1 && StringUtils.indexOf(sni.getTitle(), "商城") >= 0){
|
|
|
iterator.remove();
|
|
|
- }
|
|
|
+ }else if(sni.getTitle().equals("进阶课堂")){
|
|
|
+ //当前学员是否有可购买vip课
|
|
|
+ sni.setRedDot(webFeignService.queryVipPracticeGroups());
|
|
|
+ }else if(sni.getTitle().equals("学员考勤异常")){
|
|
|
+ //当前老师是否有学员考勤异常
|
|
|
+ sni.setRedDot(informationDao.countStudentAttendanceError(startTime,userId));
|
|
|
+ }
|
|
|
}
|
|
|
e.setInformationList(list);
|
|
|
});
|