| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- 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.support.ExcelTypeEnum;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.xjrsoft.common.enums.EnabledMark;
- import com.xjrsoft.common.model.result.RT;
- import com.xjrsoft.common.page.ConventPage;
- import com.xjrsoft.common.page.PageOutput;
- import com.xjrsoft.module.student.dto.AddBaseStudentAssessmentInspectionDto;
- import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionMobilePageDto;
- import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionPageDto;
- import com.xjrsoft.module.student.dto.CalssQuantitativeAssessmentPageDto;
- import com.xjrsoft.module.student.dto.CancelStudentDto;
- import com.xjrsoft.module.student.dto.UpdateBaseStudentAssessmentInspectionDto;
- import com.xjrsoft.module.student.entity.BaseStudentAssessmentInspection;
- import com.xjrsoft.module.student.entity.BaseStudentAssessmentStudentRelation;
- import com.xjrsoft.module.student.service.IBaseStudentAssessmentInspectionService;
- import com.xjrsoft.module.student.service.IBaseStudentAssessmentStudentRelationService;
- import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionMobilePageVo;
- import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionMobileVo;
- import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionPageVo;
- import com.xjrsoft.module.student.vo.BaseStudentAssessmentInspectionVo;
- import com.xjrsoft.module.student.vo.CalssQuantitativeAssessmentPageVo;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import lombok.AllArgsConstructor;
- import org.springframework.http.ResponseEntity;
- import org.springframework.web.bind.annotation.DeleteMapping;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.PutMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
- import javax.validation.Valid;
- import java.io.IOException;
- import java.util.Date;
- import java.util.List;
- import static com.alibaba.fastjson.JSONPatch.OperationType.remove;
- /**
- * @title: 学生班级巡查考核
- * @Author dzx
- * @Date: 2023-11-16
- * @Version 1.0
- */
- @RestController
- @RequestMapping("/student" + "/basestudentassessmentinspection")
- @Api(value = "/student" + "/basestudentassessmentinspection", tags = "学生班级巡查考核代码")
- @AllArgsConstructor
- public class BaseStudentAssessmentInspectionController {
- private final IBaseStudentAssessmentInspectionService inspectionService;
- private final IBaseStudentAssessmentStudentRelationService studentRelationService;
- @GetMapping(value = "/page")
- @ApiOperation(value = "学生班级巡查考核列表(分页)")
- @SaCheckPermission("basestudentassessmentinspection:detail")
- public RT<PageOutput<BaseStudentAssessmentInspectionPageVo>> page(@Valid BaseStudentAssessmentInspectionPageDto dto) {
- List<String> roleList = StpUtil.getRoleList();
- if(roleList.size() == 2 && roleList.contains("TEACHER") && roleList.contains("CLASSTE")){
- dto.setTeacherId(StpUtil.getLoginIdAsLong());
- }
- Page<BaseStudentAssessmentInspectionPageVo> page = inspectionService.getPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
- return RT.ok(ConventPage.getPageOutput(page, BaseStudentAssessmentInspectionPageVo.class));
- }
- @GetMapping(value = "/info")
- @ApiOperation(value = "根据id查询学生班级巡查考核信息")
- @SaCheckPermission("basestudentassessmentinspection:detail")
- public RT<BaseStudentAssessmentInspectionVo> info(@RequestParam Long id) {
- BaseStudentAssessmentInspectionVo result = inspectionService.getInfo(id);
- return RT.ok(result);
- }
- @GetMapping(value = "/mobile-page")
- @ApiOperation(value = "学生操行分记录管理列表(移动端)")
- @SaCheckPermission("basestudentbehaviormanage:detail")
- public RT<PageOutput<BaseStudentAssessmentInspectionMobilePageVo>> mobilePage(@Valid BaseStudentAssessmentInspectionMobilePageDto dto) {
- Page<BaseStudentAssessmentInspectionMobilePageVo> page = inspectionService.getMobilePage(new Page<>(dto.getLimit(), dto.getSize()), dto);
- if (page == null) {
- return RT.ok(ConventPage.getPageOutputNull(BaseStudentAssessmentInspectionMobilePageVo.class));
- }
- return RT.ok(ConventPage.getPageOutput(page, BaseStudentAssessmentInspectionMobilePageVo.class));
- }
- @GetMapping(value = "/mobile-info")
- @ApiOperation(value = "根据id查询学生班级巡查考核信息(移动端)")
- @SaCheckPermission("basestudentassessmentinspection:detail")
- public RT<BaseStudentAssessmentInspectionMobileVo> mobileInfo(@Valid Long id) {
- BaseStudentAssessmentInspectionMobileVo result = inspectionService.getMobileInfo(id);
- return RT.ok(result);
- }
- @PostMapping
- @ApiOperation(value = "新增学生班级巡查考核")
- @SaCheckPermission("basestudentassessmentinspection:add")
- public RT<Boolean> add(@Valid @RequestBody AddBaseStudentAssessmentInspectionDto dto) {
- BaseStudentAssessmentInspection inspection = BeanUtil.toBean(dto, BaseStudentAssessmentInspection.class);
- inspection.setCreateDate(new Date());
- inspection.setPersonalStudentUserIds(dto.getStudentUserIds());
- boolean isSuccess = inspectionService.save(inspection);
- inspectionService.dataHandle(inspection.getId());
- inspectionService.noticeTeacher(inspection.getId());
- return RT.ok(isSuccess);
- }
- @PutMapping
- @ApiOperation(value = "修改学生班级巡查考核")
- @SaCheckPermission("basestudentassessmentinspection:edit")
- public RT<Boolean> update(@Valid @RequestBody UpdateBaseStudentAssessmentInspectionDto dto) {
- BaseStudentAssessmentInspection baseStudentAssessmentInspection = BeanUtil.toBean(dto, BaseStudentAssessmentInspection.class);
- return RT.ok(inspectionService.updateById(baseStudentAssessmentInspection));
- }
- @DeleteMapping
- @ApiOperation(value = "删除学生班级巡查考核")
- @SaCheckPermission("basestudentassessmentinspection:delete")
- public RT<Boolean> delete(@Valid @RequestBody List<Long> ids) {
- return RT.ok(inspectionService.removeBatchByIds(ids));
- }
- @GetMapping(value = "/calss-quantitative-assessment-page")
- @ApiOperation(value = "班级量化考核列表(分页)")
- @SaCheckPermission("basestudentassessmentinspection:detail")
- public RT<PageOutput<CalssQuantitativeAssessmentPageVo>> calssQuantitativeAssessmentPage(@Valid CalssQuantitativeAssessmentPageDto dto) {
- IPage<CalssQuantitativeAssessmentPageVo> page = inspectionService.getCalssQuantitativeAssessmentPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
- return RT.ok(ConventPage.getPageOutput(page, CalssQuantitativeAssessmentPageVo.class));
- }
- // @PostMapping("/export-query")
- // @ApiOperation(value = "入参导出")
- // public ResponseEntity<byte[]> exportDataQuery(@Valid @RequestBody QuantitativeAssessmentExcelDto dto) {
- @PostMapping("/export-query")
- @ApiOperation(value = "导出")
- public ResponseEntity<byte[]> exportDataQuery(@Valid @RequestBody CalssQuantitativeAssessmentPageDto dto) throws IOException {
- byte[] bytes = inspectionService.getExcelByte(dto);
- String fileName = "recordExport" + ExcelTypeEnum.XLSX.getValue();
- return RT.fileStream(bytes, fileName);
- }
- @PostMapping("/cancel-student")
- @ApiOperation(value = "作废学生")
- public RT<Boolean> cancelStudent(@RequestBody CancelStudentDto dto){
- BaseStudentAssessmentStudentRelation relation = studentRelationService.getById(dto.getId());
- relation.setEnabledMark(EnabledMark.DISABLED.getCode());
- boolean update = studentRelationService.updateById(relation);
- return RT.ok(update);
- }
- }
|