|
|
@@ -10,8 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.xjrsoft.common.enums.DeleteMark;
|
|
|
-import com.xjrsoft.common.enums.EnabledMark;
|
|
|
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.xjrsoft.common.enums.EnrollTypeEnum;
|
|
|
import com.xjrsoft.common.enums.GenderDictionaryEnum;
|
|
|
import com.xjrsoft.common.enums.RoleCodeEnum;
|
|
|
@@ -20,11 +19,13 @@ import com.xjrsoft.common.model.result.RT;
|
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
|
import com.xjrsoft.common.page.PageOutput;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
+import com.xjrsoft.module.base.entity.BaseClass;
|
|
|
import com.xjrsoft.module.base.entity.BaseGrade;
|
|
|
import com.xjrsoft.module.base.entity.BaseSemester;
|
|
|
import com.xjrsoft.module.base.service.IBaseClassService;
|
|
|
import com.xjrsoft.module.base.service.IBaseGradeService;
|
|
|
import com.xjrsoft.module.base.service.IBaseSemesterService;
|
|
|
+import com.xjrsoft.module.base.vo.BaseClassPageVo;
|
|
|
import com.xjrsoft.module.databoard.vo.ItemCountVo;
|
|
|
import com.xjrsoft.module.student.dto.AddStudentReportRecordDto;
|
|
|
import com.xjrsoft.module.student.dto.StudentReportRecordPageDto;
|
|
|
@@ -32,10 +33,12 @@ import com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto;
|
|
|
import com.xjrsoft.module.student.dto.StudentReportSignDto;
|
|
|
import com.xjrsoft.module.student.dto.UpdateStudentReportRecordDto;
|
|
|
import com.xjrsoft.module.student.entity.StudentReportPlan;
|
|
|
+import com.xjrsoft.module.student.entity.StudentReportPlanClassRelation;
|
|
|
import com.xjrsoft.module.student.entity.StudentReportRecord;
|
|
|
import com.xjrsoft.module.student.service.IStudentReportPlanService;
|
|
|
import com.xjrsoft.module.student.service.IStudentReportRecordService;
|
|
|
-import com.xjrsoft.module.student.vo.BaseMajorCategorPageVo;
|
|
|
+import com.xjrsoft.module.student.vo.StudentReportRecordExcelVo;
|
|
|
+import com.xjrsoft.module.student.vo.StudentReportRecordItemVo;
|
|
|
import com.xjrsoft.module.student.vo.StudentReportRecordPageVo;
|
|
|
import com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo;
|
|
|
import com.xjrsoft.module.student.vo.StudentReportRecordStatisticsListVo;
|
|
|
@@ -58,6 +61,7 @@ import javax.validation.Valid;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
@@ -198,7 +202,7 @@ public class StudentReportRecordController {
|
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
|
public RT<StudentReportRecordStatisticsVo> classStatistics(@Valid StudentReportRecordStatisticsDto dto){
|
|
|
|
|
|
- if(dto.getTeacherId() == null){
|
|
|
+ if(dto.getTeacherId() == null && dto.getClassId() == null){
|
|
|
dto.setTeacherId(StpUtil.getLoginIdAsLong());
|
|
|
}
|
|
|
if(dto.getBaseSemesterId() == null){
|
|
|
@@ -211,7 +215,7 @@ public class StudentReportRecordController {
|
|
|
dto.setBaseSemesterId(semesterList.get(0).getId());
|
|
|
}
|
|
|
}
|
|
|
- if(dto.getGradeId() == null){
|
|
|
+ if(dto.getGradeId() == null && dto.getClassId() == null){
|
|
|
LambdaQueryWrapper<BaseGrade> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper
|
|
|
.orderByDesc(BaseGrade::getTitle)
|
|
|
@@ -222,7 +226,7 @@ public class StudentReportRecordController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Long planId = planService.getEffectivePlanId(dto.getTeacherId());
|
|
|
+ Long planId = planService.getEffectivePlanId(dto.getTeacherId(), dto.getClassId());
|
|
|
dto.setStudentReportPlanId(planId);
|
|
|
|
|
|
StudentReportRecordStatisticsVo statisticsVo = studentReportRecordService.getClassStatistics(dto);
|
|
|
@@ -244,7 +248,7 @@ public class StudentReportRecordController {
|
|
|
@ApiOperation(value="领导统计")
|
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
|
public RT<StudentReportRecordStatisticsVo> statistics(@Valid StudentReportRecordStatisticsDto dto){
|
|
|
- if(dto.getGradeId() == null){
|
|
|
+ if(dto.getGradeId() == null && (dto.getCategory() == null || dto.getCategory() == 1)){
|
|
|
LambdaQueryWrapper<BaseGrade> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper
|
|
|
.orderByDesc(BaseGrade::getTitle)
|
|
|
@@ -257,6 +261,9 @@ public class StudentReportRecordController {
|
|
|
if(dto.getEnrollType() == null || dto.getEnrollType().isEmpty()){
|
|
|
dto.setEnrollType(EnrollTypeEnum.AUTUMN_ENROLLMENT.getCode());
|
|
|
}
|
|
|
+ if(dto.getCategory() != null && dto.getCategory() == 2 && dto.getBaseSemesterId() == null){
|
|
|
+ dto.setBaseSemesterId(semesterService.getLastSemester());
|
|
|
+ }
|
|
|
List<StudentReportRecordStatisticsListVo> dataList = studentReportRecordService.getStatisticsDataList(dto);
|
|
|
StudentReportRecordStatisticsVo statisticsVo = new StudentReportRecordStatisticsVo();
|
|
|
statisticsVo.setAllCount(dataList.stream().count());
|
|
|
@@ -286,54 +293,81 @@ public class StudentReportRecordController {
|
|
|
&& StudyStatusEnum.AttendDaySchool.getCode().equals(x.getStduyStatus())
|
|
|
&& x.getReportTime() != null
|
|
|
).count());
|
|
|
- Map<String, List<StudentReportRecordStatisticsListVo>> graduatedUniversityMap = dataList.stream().filter(x -> x.getReportTime() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getGraduatedUniversity));
|
|
|
- List<ItemCountVo> graduatedUniversityList = new ArrayList<>();
|
|
|
- for (String graduatedUniversity : graduatedUniversityMap.keySet()) {
|
|
|
- graduatedUniversityList.add(
|
|
|
- new ItemCountVo(){{
|
|
|
- setItem(graduatedUniversity);
|
|
|
- setCount(graduatedUniversityMap.get(graduatedUniversity).size());
|
|
|
- }}
|
|
|
- );
|
|
|
+
|
|
|
+ if(dto.getCategory() != null && dto.getCategory() == 1){
|
|
|
+ Map<String, List<StudentReportRecordStatisticsListVo>> graduatedUniversityMap = dataList.stream().filter(x -> x.getReportTime() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getGraduatedUniversity));
|
|
|
+ List<ItemCountVo> graduatedUniversityList = new ArrayList<>();
|
|
|
+ for (String graduatedUniversity : graduatedUniversityMap.keySet()) {
|
|
|
+ graduatedUniversityList.add(
|
|
|
+ new ItemCountVo(){{
|
|
|
+ setItem(graduatedUniversity);
|
|
|
+ setCount(graduatedUniversityMap.get(graduatedUniversity).size());
|
|
|
+ }}
|
|
|
+ );
|
|
|
+ }
|
|
|
+ statisticsVo.setGraduatedUniversityList(graduatedUniversityList);
|
|
|
}
|
|
|
- statisticsVo.setGraduatedUniversityList(graduatedUniversityList);
|
|
|
|
|
|
Map<String, List<StudentReportRecordStatisticsListVo>> classMap = dataList.stream().filter(x -> x.getReportTime() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getClassName));
|
|
|
- List<ItemCountVo> classList = new ArrayList<>();
|
|
|
+ Map<String, List<StudentReportRecordStatisticsListVo>> classNotMap = dataList.stream().filter(x -> x.getReportTime() == null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getClassName));
|
|
|
+ List<StudentReportRecordItemVo> classList = new ArrayList<>();
|
|
|
for (String className : classMap.keySet()) {
|
|
|
classList.add(
|
|
|
- new ItemCountVo(){{
|
|
|
+ new StudentReportRecordItemVo(){{
|
|
|
setItem(className);
|
|
|
setCount(classMap.get(className).size());
|
|
|
+ if(classNotMap.get(className) != null && !(classNotMap.get(className).isEmpty())){
|
|
|
+ setCount2(classNotMap.get(className).size());
|
|
|
+ }
|
|
|
}}
|
|
|
);
|
|
|
}
|
|
|
statisticsVo.setClassList(classList);
|
|
|
|
|
|
Map<String, List<StudentReportRecordStatisticsListVo>> classTypeMap = dataList.stream().filter(x -> x.getReportTime() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getClassType));
|
|
|
- List<ItemCountVo> classTypeList = new ArrayList<>();
|
|
|
+ Map<String, List<StudentReportRecordStatisticsListVo>> classTypeNotMap = dataList.stream().filter(x -> x.getReportTime() == null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getClassType));
|
|
|
+ List<StudentReportRecordItemVo> classTypeList = new ArrayList<>();
|
|
|
for (String classType : classTypeMap.keySet()) {
|
|
|
classTypeList.add(
|
|
|
- new ItemCountVo(){{
|
|
|
+ new StudentReportRecordItemVo(){{
|
|
|
setItem(classType);
|
|
|
setCount(classTypeMap.get(classType).size());
|
|
|
+ if(classTypeNotMap.get(classType) != null && !(classTypeNotMap.get(classType).isEmpty())){
|
|
|
+ setCount2(classTypeNotMap.get(classType).size());
|
|
|
+ }
|
|
|
}}
|
|
|
);
|
|
|
}
|
|
|
statisticsVo.setClassTypeList(classTypeList);
|
|
|
|
|
|
Map<String, List<StudentReportRecordStatisticsListVo>> majorMap = dataList.stream().filter(x -> x.getReportTime() != null && x.getMajorName() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getMajorName));
|
|
|
- List<ItemCountVo> majorList = new ArrayList<>();
|
|
|
+ Map<String, List<StudentReportRecordStatisticsListVo>> majorNotMap = dataList.stream().filter(x -> x.getReportTime() == null && x.getMajorName() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getMajorName));
|
|
|
+ List<StudentReportRecordItemVo> majorList = new ArrayList<>();
|
|
|
for (String majorName : majorMap.keySet()) {
|
|
|
majorList.add(
|
|
|
- new ItemCountVo(){{
|
|
|
+ new StudentReportRecordItemVo(){{
|
|
|
setItem(majorName);
|
|
|
setCount(majorMap.get(majorName).size());
|
|
|
+ if(majorNotMap.get(majorName) != null && !(majorNotMap.get(majorName).isEmpty())){
|
|
|
+ setCount2(majorNotMap.get(majorName).size());
|
|
|
+ }
|
|
|
}}
|
|
|
);
|
|
|
}
|
|
|
statisticsVo.setMajorList(majorList);
|
|
|
|
|
|
+ Map<String, List<StudentReportRecordStatisticsListVo>> deptMap = dataList.stream().filter(x -> x.getReportTime() != null && x.getDeptName() != null).collect(Collectors.groupingBy(StudentReportRecordStatisticsListVo::getDeptName));
|
|
|
+ List<ItemCountVo> deptList = new ArrayList<>();
|
|
|
+ for (String deptName : deptMap.keySet()) {
|
|
|
+ deptList.add(
|
|
|
+ new ItemCountVo(){{
|
|
|
+ setItem(deptName);
|
|
|
+ setCount(deptMap.get(deptName).size());
|
|
|
+ }}
|
|
|
+ );
|
|
|
+ }
|
|
|
+ statisticsVo.setDeptList(deptList);
|
|
|
+
|
|
|
BigDecimal divide = BigDecimal.ZERO;
|
|
|
if( statisticsVo.getAllCount() != 0){
|
|
|
divide = BigDecimal.valueOf(statisticsVo.getArrivedCount()).divide(BigDecimal.valueOf(statisticsVo.getAllCount()), 4, RoundingMode.HALF_UP);
|
|
|
@@ -350,11 +384,13 @@ public class StudentReportRecordController {
|
|
|
List<String> roleList = StpUtil.getRoleList();
|
|
|
if(roleList.size() == 2 && roleList.contains(RoleCodeEnum.TEACHER.getCode()) && roleList.contains(RoleCodeEnum.CLASSTE.getCode())){
|
|
|
Long classId = classService.getIdByTeacherId(StpUtil.getLoginIdAsLong());
|
|
|
- if(ObjectUtil.isNull(classId)){
|
|
|
+ if(ObjectUtil.isNull(classId) && dto.getClassId() == null){
|
|
|
return RT.ok(new PageOutput<>());
|
|
|
}
|
|
|
- dto.setClassId(classId);
|
|
|
- Long planId = planService.getEffectivePlanId(dto.getTeacherId());
|
|
|
+ if(dto.getClassId() == null){
|
|
|
+ dto.setClassId(classId);
|
|
|
+ }
|
|
|
+ Long planId = planService.getEffectivePlanId(dto.getTeacherId(), dto.getClassId());
|
|
|
dto.setStudentReportPlanId(planId);
|
|
|
}
|
|
|
Page<StudentReportRecordPlanPageVo> planPage = studentReportRecordService.getPlanPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
|
|
|
@@ -362,6 +398,25 @@ public class StudentReportRecordController {
|
|
|
return RT.ok(pageOutput);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping(value = "/class-list")
|
|
|
+ @ApiOperation(value="班主任负责班级")
|
|
|
+ @SaCheckPermission("studentreportrecord:detail")
|
|
|
+ public RT<List<BaseClassPageVo>> classList(@Valid StudentReportRecordPageDto dto){
|
|
|
+
|
|
|
+ long teacherId = StpUtil.getLoginIdAsLong();
|
|
|
+ Long planId = planService.getEffectivePlanId(teacherId, null);
|
|
|
+ List<BaseClassPageVo> list = classService.selectJoinList(BaseClassPageVo.class,
|
|
|
+ new MPJLambdaWrapper<BaseClass>()
|
|
|
+ .select(BaseClass::getId)
|
|
|
+ .selectAs(BaseClass::getName, BaseClassPageVo::getName)
|
|
|
+ .innerJoin(StudentReportPlanClassRelation.class, StudentReportPlanClassRelation::getClassId, BaseClass::getId)
|
|
|
+ .innerJoin(StudentReportPlan.class, StudentReportPlan::getId, StudentReportPlanClassRelation::getStudentReportPlanId)
|
|
|
+ .eq(StudentReportPlan::getId, planId)
|
|
|
+ .eq(BaseClass::getTeacherId, teacherId)
|
|
|
+ );
|
|
|
+ return RT.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
@PostMapping(value = "/sign")
|
|
|
@ApiOperation(value="学生报到")
|
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
|
@@ -369,12 +424,14 @@ public class StudentReportRecordController {
|
|
|
StudentReportRecord record = studentReportRecordService.getById(dto.getId());
|
|
|
StudentReportPlan reportPlan = studentReportPlanService.getById(record.getStudentReportPlanId());
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
- if(reportPlan.getStatus() != 1 || (now.isAfter(reportPlan.getStartTime()) && now.isBefore(reportPlan.getEndTime()))){
|
|
|
+ if(reportPlan.getStatus() != 1 || !(now.isAfter(reportPlan.getStartTime()) && now.isBefore(reportPlan.getEndTime()))){
|
|
|
return RT.error("不在报到时间内,无法报到");
|
|
|
}
|
|
|
return RT.ok(studentReportRecordService.sgin(dto));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@PostMapping(value = "/all-sign")
|
|
|
@ApiOperation(value="变更已报到")
|
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
|
@@ -382,7 +439,7 @@ public class StudentReportRecordController {
|
|
|
StudentReportRecord record = studentReportRecordService.getById(dtoList.get(0).getId());
|
|
|
StudentReportPlan reportPlan = studentReportPlanService.getById(record.getStudentReportPlanId());
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
- if(reportPlan.getStatus() != 1 || (now.isAfter(reportPlan.getStartTime()) && now.isBefore(reportPlan.getEndTime()))){
|
|
|
+ if(reportPlan.getStatus() != 1 || !(now.isAfter(reportPlan.getStartTime()) && now.isBefore(reportPlan.getEndTime()))){
|
|
|
return RT.error("不在报到时间内,无法报到");
|
|
|
}
|
|
|
return RT.ok(studentReportRecordService.allSgin(dtoList));
|
|
|
@@ -392,17 +449,28 @@ public class StudentReportRecordController {
|
|
|
@PostMapping(value = "/update-stduyStatus")
|
|
|
@ApiOperation(value="切换就读方式")
|
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
|
- public RT<Boolean> updateStduyStatus(@Valid StudentReportSignDto dto){
|
|
|
+ public RT<Boolean> updateStduyStatus(@Valid @RequestBody StudentReportSignDto dto){
|
|
|
return RT.ok(studentReportRecordService.updateStduyStatus(dto));
|
|
|
}
|
|
|
|
|
|
- @PostMapping(value = "/export-querty")
|
|
|
+ @PostMapping(value = "/export-query")
|
|
|
@ApiOperation(value="导出")
|
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
|
- public ResponseEntity<byte[]> exportQuerty(@Valid StudentReportRecordPageDto dto){
|
|
|
+ public ResponseEntity<byte[]> exportQuerty(@Valid @RequestBody StudentReportRecordPageDto dto){
|
|
|
List<StudentReportRecordPlanPageVo> planPageList = studentReportRecordService.getPlanPageList(dto);
|
|
|
+
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ List<StudentReportRecordExcelVo> dataList = new ArrayList<>();
|
|
|
+ for (StudentReportRecordPlanPageVo pageVo : planPageList) {
|
|
|
+ StudentReportRecordExcelVo excelVo = BeanUtil.toBean(pageVo, StudentReportRecordExcelVo.class);
|
|
|
+ if(pageVo.getReportTime() != null){
|
|
|
+ excelVo.setReportTime(sdf.format(pageVo.getReportTime()));
|
|
|
+ }
|
|
|
+
|
|
|
+ dataList.add(excelVo);
|
|
|
+ }
|
|
|
ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
|
|
- EasyExcel.write(bot, StudentReportRecordPlanPageVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(planPageList);
|
|
|
+ EasyExcel.write(bot, StudentReportRecordExcelVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(dataList);
|
|
|
String fileName = "exportQuerty" + ExcelTypeEnum.XLSX.getValue();
|
|
|
return RT.fileStream(bot.toByteArray(), fileName);
|
|
|
}
|