|
@@ -14,6 +14,8 @@ import org.dromara.common.core.utils.StringUtils;
|
|
|
import org.dromara.common.redis.utils.RedisUtils;
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
import org.dromara.system.domain.*;
|
|
|
+import org.dromara.system.domain.bo.FormalParentsStudentBo;
|
|
|
+import org.dromara.system.domain.bo.FormalTeacherClassBo;
|
|
|
import org.dromara.system.domain.bo.SysDeptBo;
|
|
|
import org.dromara.system.domain.bo.XiaoyuanInfoBo;
|
|
|
import org.dromara.system.domain.info.XiaoyuanInfo;
|
|
@@ -28,6 +30,8 @@ import org.dromara.system.mapper.*;
|
|
|
import org.dromara.system.mapper.info.XiaoyuanInfoMapper;
|
|
|
import org.dromara.system.mapper.notice.XiaoyuanNoticeMapper;
|
|
|
import org.dromara.system.mapper.xiake.XiakeConfigMapper;
|
|
|
+import org.dromara.system.service.IFormalParentsStudentService;
|
|
|
+import org.dromara.system.service.ISysDeptService;
|
|
|
import org.dromara.system.service.common.IAppletService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -59,6 +63,8 @@ public class AppletServiceImpl implements IAppletService {
|
|
|
|
|
|
private final FormalTeacherClassMapper formalTeacherClassMapper;
|
|
|
|
|
|
+ private final IFormalParentsStudentService formalParentsStudentServicel;
|
|
|
+
|
|
|
|
|
|
private final RegisterTeacherMapper registerTeacherMapper;
|
|
|
|
|
@@ -68,6 +74,7 @@ public class AppletServiceImpl implements IAppletService {
|
|
|
private final XiaoyuanNoticeMapper xiaoyuanNoticeMapper;
|
|
|
|
|
|
private final XiaoyuanInfoMapper xiaoyuanInfoMapper;
|
|
|
+ private final ISysDeptService deptService;
|
|
|
|
|
|
@Override
|
|
|
public R<Void> xiake(FormalTeacherClass formalTeacherClass) {
|
|
@@ -197,26 +204,12 @@ public class AppletServiceImpl implements IAppletService {
|
|
|
for (SysDeptVo sysDept : fSysDeptList) {
|
|
|
for (SysDeptVo dept : pSysDeptList) {
|
|
|
if (sysDept.getDeptId().equals(dept.getParentId())) {
|
|
|
- String key = DateUtils.getDate() + ":" + sysDept.getDeptId() + ":" + dept.getDeptId();
|
|
|
+ String key = sysDept.getDeptId() + ":" + dept.getDeptId();
|
|
|
String value = dept.getDeptName() + ":time";
|
|
|
RedisUtils.setCacheObject(key, value);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- //设置昨日延迟放学数量 = TODAY_YAN_CHI + formalTeacherClass.getSchoolId() + ":" + DateUtils.getDate()
|
|
|
- Object num = RedisUtils.getCacheObject(TODAY_YAN_CHI + ":" + pSysDeptList.get(0).getDeptId() + ":" + DateUtils.getDateByDays(-1));
|
|
|
- if (ObjectUtils.isEmpty(num)) {
|
|
|
- //设置昨日延迟放学数量 = 0
|
|
|
- RedisUtils.setCacheObject(LAST_DAY_YAN_CHI + ":" + pSysDeptList.get(0).getDeptId() + ":" + DateUtils.getDateByDays(-1), 0);
|
|
|
- //设置昨日准时放学数量 = pSysDeptList.size() - 昨日延迟放学数量
|
|
|
- RedisUtils.setCacheObject(LAST_DAY_ZHUN_SHI + ":" + pSysDeptList.get(0).getDeptId() + ":" + DateUtils.getDateByDays(-1), pSysDeptList.size());
|
|
|
- } else {
|
|
|
- RedisUtils.setCacheObject(LAST_DAY_YAN_CHI + ":" + pSysDeptList.get(0).getDeptId() + ":" + DateUtils.getDateByDays(-1), num);
|
|
|
- RedisUtils.setCacheObject(LAST_DAY_ZHUN_SHI + ":" + pSysDeptList.get(0).getDeptId() + ":" + DateUtils.getDateByDays(-1), pSysDeptList.size() - (int) num);
|
|
|
- }
|
|
|
- //设置今日延迟放学数量
|
|
|
- RedisUtils.setCacheObject(TODAY_YAN_CHI + ":" + pSysDeptList.get(0).getDeptId() + ":" + DateUtils.getDate(), 0);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -384,6 +377,71 @@ public class AppletServiceImpl implements IAppletService {
|
|
|
return AjaxResult.success(map);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public AjaxResult pcClassStudentNum() {
|
|
|
+ List<Map<String,Object>> mapList = new ArrayList<>();
|
|
|
+ LoginUser loginUser = LoginHelper.getLoginUser();
|
|
|
+ List<RoleDTO> roles = loginUser.getRoles();
|
|
|
+ boolean bls = false;
|
|
|
+ for (RoleDTO role : roles) {
|
|
|
+ if ("school".equals(role.getRoleKey())) {
|
|
|
+ bls = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if("admin".equals(loginUser.getUsername())){
|
|
|
+ bls = true;
|
|
|
+ }
|
|
|
+ //查看所有班级
|
|
|
+ if(bls){
|
|
|
+ List<SysDeptVo> sysDeptVos = deptService.selectDeptList(new SysDeptBo());
|
|
|
+ //查询所有班级的学生
|
|
|
+ List<Long> deptIdList = sysDeptVos.stream().map(SysDeptVo::getDeptId).collect(Collectors.toList());
|
|
|
+ FormalParentsStudentBo sbo = new FormalParentsStudentBo();
|
|
|
+ sbo.setClassIds(deptIdList);
|
|
|
+ List<FormalParentsStudentVo> formalParentsStudent = formalParentsStudentServicel.queryList(sbo);
|
|
|
+ Map<Long, List<FormalParentsStudentVo>> studentMap = formalParentsStudent.stream().collect(Collectors.groupingBy(FormalParentsStudentVo::getClassId));
|
|
|
+ for (SysDeptVo sysDeptVo : sysDeptVos) {
|
|
|
+ if(sysDeptVo.getParentId()!=0L && studentMap.get(sysDeptVo.getParentId())!=null){
|
|
|
+ Map<String,Object> cMap = new HashMap<>();
|
|
|
+ sysDeptVo.setStudentNum(studentMap.get(sysDeptVo.getParentId()).size());
|
|
|
+ cMap.put("className",sysDeptVo.getDeptName());
|
|
|
+ cMap.put("value",sysDeptVo);
|
|
|
+ mapList.add(cMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ //老师,查询自己的班级
|
|
|
+ FormalTeacherClassBo formalTeacherClass = new FormalTeacherClassBo();
|
|
|
+ formalTeacherClass.setTeacherId(loginUser.getUserId());
|
|
|
+ List<FormalTeacherClassVo> formalTeacherClassList = formalTeacherClassMapper.queryMapperList(formalTeacherClass);
|
|
|
+ List<Long> classIds = formalTeacherClassList.stream().map(FormalTeacherClassVo::getClassId).collect(Collectors.toList());
|
|
|
+ FormalParentsStudentBo sbo = new FormalParentsStudentBo();
|
|
|
+ sbo.setClassIds(classIds);
|
|
|
+ List<FormalParentsStudentVo> formalParentsStudent = formalParentsStudentServicel.queryList(sbo);
|
|
|
+ Map<Long, List<FormalParentsStudentVo>> studentMap = formalParentsStudent.stream().collect(Collectors.groupingBy(FormalParentsStudentVo::getClassId));
|
|
|
+ for (FormalTeacherClassVo formalTeacherClassVo : formalTeacherClassList) {
|
|
|
+ //查询部门
|
|
|
+ SysDeptVo sysDeptVo = sysDeptMapper.selectDeptById(formalTeacherClassVo.getClassId());
|
|
|
+ if(sysDeptVo!=null){
|
|
|
+ int index = 0;
|
|
|
+ if(studentMap.get(formalTeacherClassVo.getClassId())!=null){
|
|
|
+ index = studentMap.get(formalTeacherClassVo.getClassId()).size();
|
|
|
+ }
|
|
|
+ sysDeptVo.setStudentNum(index);
|
|
|
+ Map<String,Object> tMap = new HashMap<>();
|
|
|
+ tMap.put("className",sysDeptVo.getDeptName());
|
|
|
+ tMap.put("value",sysDeptVo);
|
|
|
+ mapList.add(tMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return AjaxResult.success(mapList);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 首页统计今日准时放学/延迟放学/本周发布文章
|
|
|
*/
|