|
@@ -3,6 +3,8 @@ package com.xjrsoft.module.student.controller;
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
|
|
+import com.alibaba.excel.support.ExcelTypeEnum;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -24,15 +26,20 @@ import com.xjrsoft.module.student.dto.StudentReportRecordPageDto;
|
|
|
import com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto;
|
|
import com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto;
|
|
|
import com.xjrsoft.module.student.dto.StudentReportSignDto;
|
|
import com.xjrsoft.module.student.dto.StudentReportSignDto;
|
|
|
import com.xjrsoft.module.student.dto.UpdateStudentReportRecordDto;
|
|
import com.xjrsoft.module.student.dto.UpdateStudentReportRecordDto;
|
|
|
|
|
+import com.xjrsoft.module.student.entity.StudentReportPlan;
|
|
|
import com.xjrsoft.module.student.entity.StudentReportRecord;
|
|
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.service.IStudentReportRecordService;
|
|
|
|
|
+import com.xjrsoft.module.student.vo.BaseMajorCategorPageVo;
|
|
|
import com.xjrsoft.module.student.vo.StudentReportRecordPageVo;
|
|
import com.xjrsoft.module.student.vo.StudentReportRecordPageVo;
|
|
|
|
|
+import com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo;
|
|
|
import com.xjrsoft.module.student.vo.StudentReportRecordStatisticsListVo;
|
|
import com.xjrsoft.module.student.vo.StudentReportRecordStatisticsListVo;
|
|
|
import com.xjrsoft.module.student.vo.StudentReportRecordStatisticsVo;
|
|
import com.xjrsoft.module.student.vo.StudentReportRecordStatisticsVo;
|
|
|
import com.xjrsoft.module.student.vo.StudentReportRecordVo;
|
|
import com.xjrsoft.module.student.vo.StudentReportRecordVo;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -43,8 +50,10 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -67,6 +76,7 @@ public class StudentReportRecordController {
|
|
|
private final IStudentReportRecordService studentReportRecordService;
|
|
private final IStudentReportRecordService studentReportRecordService;
|
|
|
private final IBaseSemesterService semesterService;
|
|
private final IBaseSemesterService semesterService;
|
|
|
private final IBaseGradeService gradeService;
|
|
private final IBaseGradeService gradeService;
|
|
|
|
|
+ private final IStudentReportPlanService studentReportPlanService;
|
|
|
|
|
|
|
|
@GetMapping(value = "/page")
|
|
@GetMapping(value = "/page")
|
|
|
@ApiOperation(value="学生报到记录表列表(分页)")
|
|
@ApiOperation(value="学生报到记录表列表(分页)")
|
|
@@ -324,35 +334,36 @@ public class StudentReportRecordController {
|
|
|
@GetMapping(value = "/plan-page")
|
|
@GetMapping(value = "/plan-page")
|
|
|
@ApiOperation(value="学生报到记录表列表(分页)")
|
|
@ApiOperation(value="学生报到记录表列表(分页)")
|
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
|
- public RT<PageOutput<StudentReportRecordPageVo>> planPage(@Valid StudentReportRecordPageDto dto){
|
|
|
|
|
-
|
|
|
|
|
- LambdaQueryWrapper<StudentReportRecord> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
- queryWrapper
|
|
|
|
|
- .orderByDesc(StudentReportRecord::getId)
|
|
|
|
|
- .select(StudentReportRecord.class,x -> VoToColumnUtil.fieldsToColumns(StudentReportRecordPageVo.class).contains(x.getProperty()));
|
|
|
|
|
- IPage<StudentReportRecord> page = studentReportRecordService.page(ConventPage.getPage(dto), queryWrapper);
|
|
|
|
|
- PageOutput<StudentReportRecordPageVo> pageOutput = ConventPage.getPageOutput(page, StudentReportRecordPageVo.class);
|
|
|
|
|
|
|
+ public RT<PageOutput<StudentReportRecordPlanPageVo>> planPage(@Valid StudentReportRecordPageDto dto){
|
|
|
|
|
+ Page<StudentReportRecordPlanPageVo> planPage = studentReportRecordService.getPlanPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
|
|
|
|
|
+ PageOutput<StudentReportRecordPlanPageVo> pageOutput = ConventPage.getPageOutput(planPage, StudentReportRecordPlanPageVo.class);
|
|
|
return RT.ok(pageOutput);
|
|
return RT.ok(pageOutput);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PostMapping(value = "/sign")
|
|
@PostMapping(value = "/sign")
|
|
|
@ApiOperation(value="学生报到")
|
|
@ApiOperation(value="学生报到")
|
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
|
- public RT<Boolean> sign(@Valid StudentReportSignDto dto){
|
|
|
|
|
-
|
|
|
|
|
|
|
+ public RT<Boolean> sign(@Valid @RequestBody StudentReportSignDto dto){
|
|
|
StudentReportRecord record = studentReportRecordService.getById(dto.getId());
|
|
StudentReportRecord record = studentReportRecordService.getById(dto.getId());
|
|
|
-
|
|
|
|
|
- return RT.ok(true);
|
|
|
|
|
|
|
+ StudentReportPlan reportPlan = studentReportPlanService.getById(record.getStudentReportPlanId());
|
|
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
+ 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")
|
|
@PostMapping(value = "/all-sign")
|
|
|
@ApiOperation(value="变更已报到")
|
|
@ApiOperation(value="变更已报到")
|
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
|
- public RT<Boolean> allSign(@Valid StudentReportSignDto dto){
|
|
|
|
|
-
|
|
|
|
|
- StudentReportRecord record = studentReportRecordService.getById(dto.getId());
|
|
|
|
|
-
|
|
|
|
|
- return RT.ok(true);
|
|
|
|
|
|
|
+ public RT<Boolean> allSign(@Valid @RequestBody List<StudentReportSignDto> dtoList){
|
|
|
|
|
+ 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()))){
|
|
|
|
|
+ return RT.error("不在报到时间内,无法报到");
|
|
|
|
|
+ }
|
|
|
|
|
+ return RT.ok(studentReportRecordService.allSgin(dtoList));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -360,20 +371,18 @@ public class StudentReportRecordController {
|
|
|
@ApiOperation(value="切换就读方式")
|
|
@ApiOperation(value="切换就读方式")
|
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
|
public RT<Boolean> updateStduyStatus(@Valid StudentReportSignDto dto){
|
|
public RT<Boolean> updateStduyStatus(@Valid StudentReportSignDto dto){
|
|
|
-
|
|
|
|
|
- StudentReportRecord record = studentReportRecordService.getById(dto.getId());
|
|
|
|
|
-
|
|
|
|
|
- return RT.ok(true);
|
|
|
|
|
|
|
+ return RT.ok(studentReportRecordService.updateStduyStatus(dto));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PostMapping(value = "/export-querty")
|
|
@PostMapping(value = "/export-querty")
|
|
|
@ApiOperation(value="导出")
|
|
@ApiOperation(value="导出")
|
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
@SaCheckPermission("studentreportrecord:detail")
|
|
|
- public RT<Boolean> exportQuerty(@Valid StudentReportSignDto dto){
|
|
|
|
|
-
|
|
|
|
|
- StudentReportRecord record = studentReportRecordService.getById(dto.getId());
|
|
|
|
|
-
|
|
|
|
|
- return RT.ok(true);
|
|
|
|
|
|
|
+ public ResponseEntity<byte[]> exportQuerty(@Valid StudentReportRecordPageDto dto){
|
|
|
|
|
+ List<StudentReportRecordPlanPageVo> planPageList = studentReportRecordService.getPlanPageList(dto);
|
|
|
|
|
+ ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
|
|
|
|
+ EasyExcel.write(bot, StudentReportRecordPlanPageVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(planPageList);
|
|
|
|
|
+ String fileName = "exportQuerty" + ExcelTypeEnum.XLSX.getValue();
|
|
|
|
|
+ return RT.fileStream(bot.toByteArray(), fileName);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|