|
|
@@ -2,22 +2,27 @@ package com.xjrsoft.module.student.controller;
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
+import com.alibaba.excel.support.ExcelTypeEnum;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.xjrsoft.common.annotation.XjrLog;
|
|
|
+import com.xjrsoft.common.enums.RoleCodeEnum;
|
|
|
import com.xjrsoft.common.model.result.RT;
|
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
|
import com.xjrsoft.common.page.PageOutput;
|
|
|
-import com.xjrsoft.module.banding.dto.ChangeClassDto;
|
|
|
import com.xjrsoft.module.banding.service.IBandingTaskClassStudentService;
|
|
|
import com.xjrsoft.module.student.dto.ChangeBandingStatusDto;
|
|
|
import com.xjrsoft.module.student.dto.StudentReportRecordPageDto;
|
|
|
import com.xjrsoft.module.student.dto.StudentReportSignDto;
|
|
|
import com.xjrsoft.module.student.entity.StudentReportRecord;
|
|
|
import com.xjrsoft.module.student.service.IStudentReportRecordService;
|
|
|
+import com.xjrsoft.module.student.vo.StudentReportRecordExcelVo;
|
|
|
import com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
@@ -25,6 +30,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -100,4 +107,47 @@ public class StudentTryReadingReportController {
|
|
|
return RT.ok(isSuccess);
|
|
|
}
|
|
|
|
|
|
+ @PostMapping(value = "/update-stduyStatus")
|
|
|
+ @ApiOperation(value="切换就读方式")
|
|
|
+ @SaCheckPermission("tryreadingreport:update-stduyStatus")
|
|
|
+ @XjrLog(value = "切换就读方式")
|
|
|
+ public RT<Boolean> updateStduyStatus(@Valid @RequestBody StudentReportSignDto dto){
|
|
|
+ boolean isSuccess = recordService.updateStduyStatusByTryReading(dto);
|
|
|
+ return RT.ok(isSuccess);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping(value = "/export-query")
|
|
|
+ @ApiOperation(value="导出")
|
|
|
+ @SaCheckPermission("studentreportrecord:detail")
|
|
|
+ public ResponseEntity<byte[]> exportQuerty(@Valid @RequestBody StudentReportRecordPageDto dto){
|
|
|
+ List<StudentReportRecordExcelVo> dataList = new ArrayList<>();
|
|
|
+
|
|
|
+ List<String> roleList = StpUtil.getRoleList();
|
|
|
+ if(roleList.contains(RoleCodeEnum.TEACHER.getCode()) && roleList.contains(RoleCodeEnum.CLASSTE.getCode())){
|
|
|
+ if(dto.getClassId() == null){
|
|
|
+ dto.setTeacherId(StpUtil.getLoginIdAsLong());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<StudentReportRecordPlanPageVo> planPageList = recordService.getTryReadingList(dto);
|
|
|
+
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
+ for (StudentReportRecordPlanPageVo pageVo : planPageList) {
|
|
|
+ StudentReportRecordExcelVo excelVo = BeanUtil.toBean(pageVo, StudentReportRecordExcelVo.class);
|
|
|
+ if(pageVo.getReportTime() != null){
|
|
|
+ excelVo.setReportTime(sdf.format(pageVo.getReportTime()));
|
|
|
+ }
|
|
|
+ excelVo.setIsReport("否");
|
|
|
+ if(pageVo.getIsReport() != null && pageVo.getIsReport() == 1){
|
|
|
+ excelVo.setIsReport("是");
|
|
|
+ }
|
|
|
+
|
|
|
+ dataList.add(excelVo);
|
|
|
+ }
|
|
|
+ ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
}
|