Browse Source

bug修复

dzx 6 months ago
parent
commit
3260d32a50

+ 26 - 1
src/main/java/com/xjrsoft/module/student/controller/BaseNewStudentController.java

@@ -4,6 +4,8 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.dev33.satoken.secure.BCrypt;
 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.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -35,6 +37,7 @@ import com.xjrsoft.module.student.entity.BaseNewStudent;
 import com.xjrsoft.module.student.entity.BaseStudentFamilyMember;
 import com.xjrsoft.module.student.service.IBaseNewStudentService;
 import com.xjrsoft.module.student.service.IBaseStudentFamilyMemberService;
+import com.xjrsoft.module.student.vo.BaseNewStudentExportVo;
 import com.xjrsoft.module.student.vo.BaseNewStudentPageVo;
 import com.xjrsoft.module.student.vo.BaseNewStudentScoreExcelVo;
 import com.xjrsoft.module.student.vo.BaseNewStudentTreeVo;
@@ -44,6 +47,7 @@ import com.xjrsoft.module.student.vo.EnrollmentPlanTreeVo;
 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;
@@ -55,6 +59,7 @@ import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.validation.Valid;
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
@@ -113,7 +118,7 @@ public class BaseNewStudentController {
                 dto.setBaseSemesterId(semesterList.get(0).getId());
             }
         }
-        Page<BaseNewStudentPageVo> page = baseNewStudentService.getPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        Page<BaseNewStudentPageVo> page = baseNewStudentService.getReportPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
         PageOutput<BaseNewStudentPageVo> pageOutput = ConventPage.getPageOutput(page, BaseNewStudentPageVo.class);
         return RT.ok(pageOutput);
     }
@@ -347,4 +352,24 @@ public class BaseNewStudentController {
         return RT.ok(true);
     }
 
+    @GetMapping("/report-export")
+    @ApiOperation(value = "导出")
+    public ResponseEntity<byte[]> exportData(@Valid BaseNewStudentPageDto dto) {
+        List<BaseNewStudentPageVo> reportList = baseNewStudentService.getReportList(dto);
+        List<BaseNewStudentExportVo> exportVos = new ArrayList<>();
+
+        for (BaseNewStudentPageVo el : reportList) {
+            BaseNewStudentExportVo vo = BeanUtil.toBean(el, BaseNewStudentExportVo.class);
+            if(el.getIsAdjust() == 1){
+                vo.setReportStatus("是");
+            }else if(el.getIsAdjust() == 0){
+                vo.setReportStatus("否");
+            }
+        }
+        ByteArrayOutputStream bot = new ByteArrayOutputStream();
+        EasyExcel.write(bot, BaseNewStudentExportVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(exportVos);
+
+        return RT.fileStream(bot.toByteArray(), "RoomBed" + ExcelTypeEnum.XLSX.getValue());
+    }
+
 }

+ 2 - 0
src/main/java/com/xjrsoft/module/student/mapper/BaseNewStudentMapper.java

@@ -26,6 +26,8 @@ public interface BaseNewStudentMapper extends MPJBaseMapper<BaseNewStudent> {
     Page<BaseNewStudentPageVo> getPage(Page<BaseNewStudentPageVo> page, BaseNewStudentPageDto dto);
 
     Page<BaseNewStudentPageVo> getReportPage(Page<BaseNewStudentPageVo> page, BaseNewStudentPageDto dto);
+
+    List<BaseNewStudentPageVo> getReportList(@Param("dto") BaseNewStudentPageDto dto);
     List<EnrollmentPlanTreeVo> getEnrollmentPlanList();
 
     List<EnrollmentPlanGradeVo> getGradeList();

+ 2 - 0
src/main/java/com/xjrsoft/module/student/service/IBaseNewStudentService.java

@@ -29,6 +29,8 @@ public interface IBaseNewStudentService extends MPJBaseService<BaseNewStudent> {
     Page<BaseNewStudentPageVo> getPage(Page<BaseNewStudentPageVo> page, BaseNewStudentPageDto dto);
 
     Page<BaseNewStudentPageVo> getReportPage(Page<BaseNewStudentPageVo> page, BaseNewStudentPageDto dto);
+
+    List<BaseNewStudentPageVo> getReportList(BaseNewStudentPageDto dto);
     List<EnrollmentPlanTreeVo> getEnrollmentPlanList();
 
     List<EnrollmentPlanGradeVo> getGradeList();

+ 6 - 0
src/main/java/com/xjrsoft/module/student/service/impl/BaseNewStudentServiceImpl.java

@@ -72,6 +72,12 @@ public class BaseNewStudentServiceImpl extends MPJBaseServiceImpl<BaseNewStudent
     public Page<BaseNewStudentPageVo> getReportPage(Page<BaseNewStudentPageVo> page, BaseNewStudentPageDto dto) {
         return this.baseMapper.getReportPage(page, dto);
     }
+
+    @Override
+    public List<BaseNewStudentPageVo> getReportList(BaseNewStudentPageDto dto) {
+        return this.baseMapper.getReportList(dto);
+    }
+
     @Override
     public List<EnrollmentPlanTreeVo> getEnrollmentPlanList() {
         return this.baseMapper.getEnrollmentPlanList();

+ 69 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseNewStudentExportVo.java

@@ -0,0 +1,69 @@
+package com.xjrsoft.module.student.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDate;
+
+/**
+* @title: 新生维护信息分页列表出参
+* @Author dzx
+* @Date: 2024-06-27
+* @Version 1.0
+*/
+@Data
+public class BaseNewStudentExportVo {
+
+    @ExcelProperty("班级名称")
+    @ApiModelProperty("班级名称")
+    private String className;
+
+    @ExcelProperty("班主任")
+    @ApiModelProperty("班主任")
+    private String teacherName;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("学生姓名")
+    @ApiModelProperty("学生姓名")
+    private String name;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("性别")
+    @ApiModelProperty("性别中文")
+    private String genderCn;
+    /**
+    * 身份证号
+    */
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("身份证号")
+    @ApiModelProperty("身份证号")
+    private String credentialNumber;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("手机号")
+    @ApiModelProperty("手机号")
+    private String mobile;
+
+    @ExcelProperty("家长联系电话")
+    @ApiModelProperty("家长联系电话")
+    private String familyMobile;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("学生来源")
+    @ApiModelProperty("学生来源")
+    private String sourceCn;
+
+    @ExcelProperty("就读方式")
+    @ApiModelProperty("就读方式")
+    private String stduyStatusCn;
+
+    @ExcelProperty("报到状态")
+    private String reportStatus;
+
+    @ExcelProperty("报到时间")
+    @ApiModelProperty("报到时间")
+    private LocalDate reportTime;
+
+}