夏文涛 2 years ago
parent
commit
69ed8ae140

+ 8 - 3
src/main/java/com/template/api/SmartUserControllerAPI.java

@@ -5,6 +5,7 @@ import com.template.model.request.*;
 import com.template.model.result.CommonResult;
 import com.template.model.result.PageUtils;
 import com.template.model.vo.UserDeleteVo;
+import com.template.model.vo.gauageOutfitVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.validation.BindingResult;
@@ -14,6 +15,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.util.List;
 
 /**
  * @Author: binguo
@@ -116,9 +118,9 @@ public interface SmartUserControllerAPI {
     /**
      * 导出用户数据
      */
-    @GetMapping(value = "smartUserExport")
-    @ApiOperation(value = "导出用户数据", notes = "导出用户数据", httpMethod = "GET")
-    void smartUserExport(HttpServletResponse response, Integer departmentId, String name, @RequestHeader("user_head") String userhead);
+    @PostMapping(value = "smartUserExport")
+    @ApiOperation(value = "导出用户数据", notes = "导出用户数据", httpMethod = "POST")
+    void smartUserExport(HttpServletResponse response,@RequestHeader("user_head") String userhead, @Validated @RequestBody smartUserExportRequest suer);
 
     @PostMapping(value = "/deleteSmartUserByIdOld")
     @ApiOperation(value = "根据ID删除指定用户", notes = "根据ID删除指定用户", httpMethod = "POST")
@@ -242,4 +244,7 @@ public interface SmartUserControllerAPI {
     CommonResult getPhoneAffiliate(@RequestParam String phone);
 
 
+    @GetMapping(value = "/gauageOutfit")
+    @ApiOperation(value = "表头列表集合", notes = "表头列表集合", httpMethod = "GET")
+    CommonResult gauageOutfit();
 }

+ 435 - 105
src/main/java/com/template/controller/SmartUserController.java

@@ -2347,7 +2347,7 @@ public class SmartUserController implements SmartUserControllerAPI {
         int useBs = 1;
         int useXw = 1;
 
-        if(org.springframework.util.StringUtils.hasText(isur.getCardNo())){
+        if (org.springframework.util.StringUtils.hasText(isur.getCardNo())) {
             //重复性判断
             int existCount = smartUserService.querySmartUserByCardNo(isur.getCardNo());
             if (existCount > 0) {
@@ -4357,25 +4357,184 @@ public class SmartUserController implements SmartUserControllerAPI {
     }
     //endregion
 
+    //region 导出表头列表集合
+    @Override
+    @DESRespondSecret(validated = false)
+    public CommonResult gauageOutfit() {
+        int i = 1;
+        List<gauageOutfitVo> govs = new ArrayList<>();
+
+        //region 学号
+        gauageOutfitVo cardNo = new gauageOutfitVo();
+        cardNo.setId(i);
+        cardNo.setName("学号");
+        govs.add(cardNo);
+        i++;
+        //endregion
+        //region 姓名
+        gauageOutfitVo name = new gauageOutfitVo();
+        name.setId(i);
+        name.setName("姓名");
+        govs.add(name);
+        i++;
+        //endregion
+        //region 身份
+        gauageOutfitVo identity = new gauageOutfitVo();
+        identity.setId(i);
+        identity.setName("身份");
+        govs.add(identity);
+        i++;
+        //endregion
+        //region 职务
+        gauageOutfitVo duties = new gauageOutfitVo();
+        duties.setId(i);
+        duties.setName("职务");
+        govs.add(duties);
+        i++;
+        //endregion
+        //region 身份证号
+        gauageOutfitVo idcard = new gauageOutfitVo();
+        idcard.setId(i);
+        idcard.setName("身份证号");
+        govs.add(idcard);
+        i++;
+        //endregion
+        //region 性别
+        gauageOutfitVo sex = new gauageOutfitVo();
+        sex.setId(i);
+        sex.setName("性别");
+        govs.add(sex);
+        i++;
+        //endregion
+        //region 部门
+        gauageOutfitVo department = new gauageOutfitVo();
+        department.setId(i);
+        department.setName("部门");
+        govs.add(department);
+        i++;
+        //endregion
+        //region 人脸照片
+        gauageOutfitVo iamge = new gauageOutfitVo();
+        iamge.setId(i);
+        iamge.setName("人脸照片");
+        govs.add(iamge);
+        i++;
+        //endregion
+        //region 年级
+        gauageOutfitVo grade = new gauageOutfitVo();
+        grade.setId(i);
+        grade.setName("年级");
+        govs.add(grade);
+        i++;
+        //endregion
+        //region 班级
+        gauageOutfitVo classes = new gauageOutfitVo();
+        classes.setId(i);
+        classes.setName("班级");
+        govs.add(classes);
+        i++;
+        //endregion
+        //region 时间组
+        gauageOutfitVo timeGroup = new gauageOutfitVo();
+        timeGroup.setId(i);
+        timeGroup.setName("时间组");
+        govs.add(timeGroup);
+        i++;
+        //endregion
+        //region 学院
+        gauageOutfitVo college = new gauageOutfitVo();
+        college.setId(i);
+        college.setName("学院");
+        govs.add(college);
+        i++;
+        //endregion
+        //region 专业
+        gauageOutfitVo speciality = new gauageOutfitVo();
+        speciality.setId(i);
+        speciality.setName("专业");
+        govs.add(speciality);
+        i++;
+        //endregion
+        //region 校区
+        gauageOutfitVo campus = new gauageOutfitVo();
+        campus.setId(i);
+        campus.setName("校区");
+        govs.add(campus);
+        i++;
+        //endregion
+        //region 宿舍号
+        gauageOutfitVo dormitory = new gauageOutfitVo();
+        dormitory.setId(i);
+        dormitory.setName("宿舍号");
+        govs.add(dormitory);
+        i++;
+        //endregion
+        //region 手机号
+        gauageOutfitVo phone = new gauageOutfitVo();
+        phone.setId(i);
+        phone.setName("手机号");
+        govs.add(phone);
+        i++;
+        //endregion
+        //region 关联人
+        gauageOutfitVo affiliate = new gauageOutfitVo();
+        affiliate.setId(i);
+        affiliate.setName("关联人");
+        govs.add(affiliate);
+        i++;
+        //endregion
+        //region 职称
+        gauageOutfitVo title = new gauageOutfitVo();
+        title.setId(i);
+        title.setName("职称");
+        govs.add(title);
+        i++;
+        //endregion
+        //region 家庭地址
+        gauageOutfitVo address = new gauageOutfitVo();
+        address.setId(i);
+        address.setName("家庭地址");
+        govs.add(address);
+        i++;
+        //endregion
+        //region 民族
+        gauageOutfitVo nation = new gauageOutfitVo();
+        nation.setId(i);
+        nation.setName("民族");
+        govs.add(nation);
+        i++;
+        //endregion
+        //region 生源地
+        gauageOutfitVo student = new gauageOutfitVo();
+        student.setId(i);
+        student.setName("生源地");
+        govs.add(student);
+        i++;
+        //endregion
+        //region 毕业学院
+        gauageOutfitVo graduate = new gauageOutfitVo();
+        graduate.setId(i);
+        graduate.setName("毕业学院");
+        govs.add(graduate);
+        //endregion
+        return CommonResult.ok(govs);
+    }
+    //endregion
+
     //region 用户导出
 
     /**
-     * 用户导出
-     *
-     * @param response     响应头
-     * @param departmentId 部门ID
-     * @param name         名称
-     * @param userhead     请求头
+     * @param response 响应头
+     * @param userhead 请求头
+     * @param sure     请求参数
      */
     @Override
     @DESRespondSecret(validated = false)
-    public void smartUserExport(HttpServletResponse response, Integer departmentId, String name, String userhead) {
+    public void smartUserExport(HttpServletResponse response, String userhead, smartUserExportRequest sure) {
         //region 角色判断
         String userID = AesUtils.decrypt(userhead);
         SmartUser operateData = smartUserService.getSmartById(Integer.valueOf(userID));
-        if (operateData != null) {
-
-
+        if (operateData != null && sure != null && sure.getGauageOutfitVos() != null && sure.getGauageOutfitVos().size() > 0) {
             QueryWrapper<SmartAuthority> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("user_id", operateData.getId());
             List<SmartAuthority> authorities = smartAuthorityService.getAuthorByKey(queryWrapper);
@@ -4404,6 +4563,7 @@ public class SmartUserController implements SmartUserControllerAPI {
                 //获取该部门下的所有子级部门ID
                 List<Integer> childDepartmentIds = new ArrayList<>();
                 List<SmartDepartment> departments = smartDepartmentService.list(null);
+                Integer departmentId = sure != null ? sure.getDepartmentId() : null;
                 childDepartmentIds.add(departmentId);
                 QueryDepartmentTreeRecords(departmentId, departments, childDepartmentIds);
 
@@ -4418,6 +4578,8 @@ public class SmartUserController implements SmartUserControllerAPI {
                     }
                 }
 
+                String name = sure != null ? sure.getName() : null;
+
                 List<SmartUser> users = smartUserService.querySmartUsers(authDepartments, name);
 
                 List<String> affiliates = new ArrayList<>();
@@ -4443,95 +4605,238 @@ public class SmartUserController implements SmartUserControllerAPI {
                 Workbook workbook = new XSSFWorkbook();
                 Sheet sheet = workbook.createSheet("用户信息管理");
                 Row headerRow = sheet.createRow(0);
+                int exportIndex = 1;
+                List<String> gauageStrs = sure.getGauageOutfitVos().stream().map(gauageOutfitVo::getName).collect(Collectors.toList());
+
                 headerRow.createCell(0).setCellValue("序号");
-                headerRow.createCell(1).setCellValue("学号");
-                headerRow.createCell(2).setCellValue("姓名");
-                headerRow.createCell(3).setCellValue("身份");
-                headerRow.createCell(4).setCellValue("身份证号");
-                headerRow.createCell(5).setCellValue("性别");
-                headerRow.createCell(6).setCellValue("部门");
-                headerRow.createCell(7).setCellValue("人脸");
-                headerRow.createCell(8).setCellValue("年级");
-                headerRow.createCell(9).setCellValue("学院");
-                headerRow.createCell(10).setCellValue("专业");
-                headerRow.createCell(11).setCellValue("班级");
-                headerRow.createCell(12).setCellValue("校区");
-                headerRow.createCell(13).setCellValue("宿舍号");
-                headerRow.createCell(14).setCellValue("手机号");
-                headerRow.createCell(15).setCellValue("关联人");
-                headerRow.createCell(16).setCellValue("职称");
-                headerRow.createCell(17).setCellValue("家庭住址");
-                headerRow.createCell(18).setCellValue("民族");
-                headerRow.createCell(19).setCellValue("生源地");
-                headerRow.createCell(20).setCellValue("毕业学校");
-                headerRow.createCell(21).setCellValue("职务");
+                if (gauageStrs.contains("学号")) {
+                    headerRow.createCell(exportIndex).setCellValue("学号");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("姓名")) {
+                    headerRow.createCell(exportIndex).setCellValue("姓名");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("身份")) {
+                    headerRow.createCell(exportIndex).setCellValue("身份");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("职务")) {
+                    headerRow.createCell(exportIndex).setCellValue("职务");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("身份证号")) {
+                    headerRow.createCell(exportIndex).setCellValue("身份证号");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("性别")) {
+                    headerRow.createCell(exportIndex).setCellValue("性别");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("部门")) {
+                    headerRow.createCell(exportIndex).setCellValue("部门");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("人脸照片")) {
+                    headerRow.createCell(exportIndex).setCellValue("人脸照片");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("年级")) {
+                    headerRow.createCell(exportIndex).setCellValue("年级");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("班级")) {
+                    headerRow.createCell(exportIndex).setCellValue("班级");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("时间组")) {
+                    headerRow.createCell(exportIndex).setCellValue("时间组");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("学院")) {
+                    headerRow.createCell(exportIndex).setCellValue("学院");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("专业")) {
+                    headerRow.createCell(exportIndex).setCellValue("专业");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("校区")) {
+                    headerRow.createCell(exportIndex).setCellValue("校区");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("宿舍号")) {
+                    headerRow.createCell(exportIndex).setCellValue("宿舍号");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("手机号")) {
+                    headerRow.createCell(exportIndex).setCellValue("手机号");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("关联人")) {
+                    headerRow.createCell(exportIndex).setCellValue("关联人");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("职称")) {
+                    headerRow.createCell(exportIndex).setCellValue("职称");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("家庭住址")) {
+                    headerRow.createCell(exportIndex).setCellValue("家庭住址");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("民族")) {
+                    headerRow.createCell(exportIndex).setCellValue("民族");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("生源地")) {
+                    headerRow.createCell(exportIndex).setCellValue("生源地");
+                    exportIndex++;
+                }
+                if (gauageStrs.contains("毕业学院")) {
+                    headerRow.createCell(exportIndex).setCellValue("毕业学院");
+                    exportIndex++;
+                }
+
+
+                List<SmartTimeGroup> timeGroups = new ArrayList<>();
+                if (gauageStrs.contains("时间组")) {
+                    timeGroups = smartTimeGroupService.list(null);
+                }
 
                 for (int i = 0; i < users.size(); i++) {
+                    int valueIndex = 1;
                     SmartUser user = users.get(i);
 
                     Row dataRow = sheet.createRow(i + 1);
                     dataRow.createCell(0).setCellValue(i + 1);//序号
-                    dataRow.createCell(1).setCellValue(user.getCardNo());//学号
-                    dataRow.createCell(2).setCellValue(user.getName());//姓名
-                    dataRow.createCell(3).setCellValue(eIdentityStatu.stringOf(user.getIdentityId()));//身份
-                    dataRow.createCell(4).setCellValue(user.getIdCard());//身份证号
-                    dataRow.createCell(5).setCellValue(eSexStatu.stringOf(user.getSexId()));//性别
-                    //获取父级部门ID
-                    Optional<SmartDepartment> department = departments.stream().filter(e -> e.getId().equals(user.getDepartmentId())).findFirst();
-                    if (department != null && department.isPresent()) {
-                        dataRow.createCell(6).setCellValue(QueryParentDepartments(department.get().getParentId(), departments, null));//部门
+                    if (gauageStrs.contains("学号")) {
+                        dataRow.createCell(valueIndex).setCellValue(user.getCardNo());//学号
+                        valueIndex++;
                     }
-
-                    dataRow.createCell(7).setCellValue(user.getHeadImage() == null ? "" : user.getHeadImage());//人脸
-
-                    String grade = "";
-                    Optional<SmartGrade> gradeData = grades == null ? null : grades.stream().filter(e -> e.getId().toString().equals(user.getGrade())).findFirst();
-                    if (gradeData != null && gradeData.isPresent()) {
-                        grade = gradeData.get().getName();
+                    if (gauageStrs.contains("姓名")) {
+                        dataRow.createCell(valueIndex).setCellValue(user.getName());//姓名
+                        valueIndex++;
                     }
-                    dataRow.createCell(8).setCellValue(grade);//年级
-                    dataRow.createCell(9).setCellValue(user.getCollege() == null ? "" : user.getCollege());//学院
-                    dataRow.createCell(10).setCellValue(user.getSpeciality() == null ? "" : user.getSpeciality());//专业
-
-                    String classStr = "";
-                    Optional<SmartClass> classData = classes == null ? null : classes.stream().filter(e -> e.getId().equals(user.getSchoolClass())).findFirst();
-                    if (classData != null && classData.isPresent()) {
-                        classStr = classData.get().getName();
+                    if (gauageStrs.contains("身份")) {
+                        dataRow.createCell(valueIndex).setCellValue(eIdentityStatu.stringOf(user.getIdentityId()));//身份
+                        valueIndex++;
                     }
-                    dataRow.createCell(11).setCellValue(classStr);//班级
-
-                    dataRow.createCell(12).setCellValue(user.getCampus() == null ? "" : user.getCampus());//校区
-                    dataRow.createCell(13).setCellValue(user.getDormitoryNumber() == null ? "" : user.getDormitoryNumber());//宿舍号
-                    dataRow.createCell(14).setCellValue(user.getPhone() == null ? "" : user.getPhone());//手机号
-
-                    List<String> affiliateCellStrs = new ArrayList<>();
-                    if (user.getAffiliate() != null && affiliateDatas != null) {
-                        String[] affArrayStr = user.getAffiliate().split(",");
-                        for (int j = 0; j < affArrayStr.length; j++) {
-                            String affArrayIndex = affArrayStr[j];
-                            Optional<SmartUser> affUser = affiliateDatas.stream().filter(e -> e.getId().toString().equals(affArrayIndex)).findFirst();
-                            if (affUser != null && affUser.isPresent()) {
-                                affiliateCellStrs.add(affUser.get().getName());
+                    if (gauageStrs.contains("职务")) {
+                        String dutieStr = "";
+                        if (duties != null && duties.size() > 0 && user.getDuties() != null) {
+                            Optional<SmartDuties> oduty = duties.stream().filter(e -> e.getId().equals(user.getDuties())).findFirst();
+                            if (oduty != null && oduty.isPresent()) {
+                                dutieStr = oduty.get().getName();
                             }
+                        }
+                        dataRow.createCell(valueIndex).setCellValue(dutieStr);//职务
 
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("身份证号")) {
+                        dataRow.createCell(valueIndex).setCellValue(user.getIdCard());//身份证号
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("性别")) {
+                        dataRow.createCell(valueIndex).setCellValue(eSexStatu.stringOf(user.getSexId()));//性别
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("部门")) {
+                        //获取父级部门ID
+                        Optional<SmartDepartment> department = departments.stream().filter(e -> e.getId().equals(user.getDepartmentId())).findFirst();
+                        if (department != null && department.isPresent()) {
+                            dataRow.createCell(valueIndex).setCellValue(QueryParentDepartments(department.get().getParentId(), departments, null));//部门
                         }
+                        valueIndex++;
                     }
+                    if (gauageStrs.contains("人脸照片")) {
+                        dataRow.createCell(valueIndex).setCellValue(user.getHeadImage() == null ? "" : user.getHeadImage());//人脸
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("年级")) {
+                        String grade = "";
+                        Optional<SmartGrade> gradeData = grades == null ? null : grades.stream().filter(e -> e.getId().toString().equals(user.getGrade())).findFirst();
+                        if (gradeData != null && gradeData.isPresent()) {
+                            grade = gradeData.get().getName();
+                        }
+                        dataRow.createCell(valueIndex).setCellValue(grade);//年级
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("班级")) {
+                        String classStr = "";
+                        Optional<SmartClass> classData = classes == null ? null : classes.stream().filter(e -> e.getId().equals(user.getSchoolClass())).findFirst();
+                        if (classData != null && classData.isPresent()) {
+                            classStr = classData.get().getName();
+                        }
+                        dataRow.createCell(valueIndex).setCellValue(classStr);//班级
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("时间组")) {
+                        Optional<SmartTimeGroup> oTime = timeGroups != null && timeGroups.size() > 0 && user.getTimeGroupId() != null ? timeGroups.stream().filter(e -> e.getId().equals(user.getTimeGroupId())).findFirst() : null;
+                        String timeStr = "";
+                        if(oTime != null && oTime.isPresent()){
+                            timeStr = oTime.get().getName();
+                        }
+                        dataRow.createCell(valueIndex).setCellValue(timeStr);//时间组
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("学院")) {
+                        dataRow.createCell(valueIndex).setCellValue(user.getCollege() == null ? "" : user.getCollege());//学院
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("专业")) {
+                        dataRow.createCell(valueIndex).setCellValue(user.getSpeciality() == null ? "" : user.getSpeciality());//专业
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("校区")) {
+                        dataRow.createCell(valueIndex).setCellValue(user.getCampus() == null ? "" : user.getCampus());//校区
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("宿舍号")) {
+                        dataRow.createCell(valueIndex).setCellValue(user.getDormitoryNumber() == null ? "" : user.getDormitoryNumber());//宿舍号
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("手机号")) {
+                        dataRow.createCell(valueIndex).setCellValue(user.getPhone() == null ? "" : user.getPhone());//手机号
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("关联人")) {
+                        List<String> affiliateCellStrs = new ArrayList<>();
+                        if (user.getAffiliate() != null && affiliateDatas != null) {
+                            String[] affArrayStr = user.getAffiliate().split(",");
+                            for (int j = 0; j < affArrayStr.length; j++) {
+                                String affArrayIndex = affArrayStr[j];
+                                Optional<SmartUser> affUser = affiliateDatas.stream().filter(e -> e.getId().toString().equals(affArrayIndex)).findFirst();
+                                if (affUser != null && affUser.isPresent()) {
+                                    affiliateCellStrs.add(affUser.get().getName());
+                                }
 
-                    dataRow.createCell(15).setCellValue(StringUtils.join(affiliateCellStrs, ","));//关联人
-
-                    dataRow.createCell(16).setCellValue(user.getTitle() == null ? "" : user.getTitle());//职称
-                    dataRow.createCell(17).setCellValue(user.getAddress() == null ? "" : user.getAddress());//家庭住址
-                    dataRow.createCell(18).setCellValue(user.getNation() == null ? "" : user.getNation());//民族
-                    dataRow.createCell(19).setCellValue(user.getOfStudent() == null ? "" : user.getOfStudent());//生源地
-                    dataRow.createCell(20).setCellValue(user.getGraduate() == null ? "" : user.getGraduate());//毕业学校
-                    String dutieStr = "";
-                    if (duties != null && duties.size() > 0 && user.getDuties() != null) {
-                        Optional<SmartDuties> oduty = duties.stream().filter(e -> e.getId().equals(user.getDuties())).findFirst();
-                        if (oduty != null && oduty.isPresent()) {
-                            dutieStr = oduty.get().getName();
+                            }
                         }
+                        dataRow.createCell(valueIndex).setCellValue(StringUtils.join(affiliateCellStrs, ","));//关联人
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("职称")) {
+                        dataRow.createCell(valueIndex).setCellValue(user.getTitle() == null ? "" : user.getTitle());//职称
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("家庭住址")) {
+                        dataRow.createCell(valueIndex).setCellValue(user.getAddress() == null ? "" : user.getAddress());//家庭住址
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("民族")) {
+                        dataRow.createCell(valueIndex).setCellValue(user.getNation() == null ? "" : user.getNation());//民族
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("生源地")) {
+                        dataRow.createCell(valueIndex).setCellValue(user.getOfStudent() == null ? "" : user.getOfStudent());//生源地
+                        valueIndex++;
+                    }
+                    if (gauageStrs.contains("毕业学院")) {
+                        dataRow.createCell(valueIndex).setCellValue(user.getGraduate() == null ? "" : user.getGraduate());//毕业学校
+                        valueIndex++;
                     }
-                    dataRow.createCell(21).setCellValue(dutieStr);//职务
                 }
 
                 // 将工作簿写入文件
@@ -4551,7 +4856,9 @@ public class SmartUserController implements SmartUserControllerAPI {
      * @param lists    数据集合
      * @return
      */
-    private List<DepartmentTreeVo> QueryDepartmentTreeRecords(Integer parentID, List<SmartDepartment> lists, List<Integer> departmentIds) {
+    private List<DepartmentTreeVo> QueryDepartmentTreeRecords
+    (Integer
+             parentID, List<SmartDepartment> lists, List<Integer> departmentIds) {
         List<DepartmentTreeVo> newTrees = new ArrayList<>();
 
         List<SmartDepartment> datas = lists.stream().filter(e -> e.getParentId().equals(parentID)).collect(Collectors.toList());
@@ -4574,7 +4881,10 @@ public class SmartUserController implements SmartUserControllerAPI {
      * @param lists    数据集合
      * @return
      */
-    private String QueryParentDepartments(Integer parentID, List<SmartDepartment> lists, String departmentStr) {
+    private String QueryParentDepartments
+    (Integer
+             parentID, List<SmartDepartment> lists, String
+             departmentStr) {
 
         Optional<SmartDepartment> data = lists.stream().filter(e -> e.getId().equals(parentID)).findFirst();
 
@@ -4590,7 +4900,9 @@ public class SmartUserController implements SmartUserControllerAPI {
     //region 根据数据ID删除用户数据(旧的)
     @Override
     @DESRespondSecret(validated = true)
-    public CommonResult deleteSmartUserByIdOld(useridsRequest ur, BindingResult bindingResult) throws Exception {
+    public CommonResult deleteSmartUserByIdOld
+    (useridsRequest ur, BindingResult
+            bindingResult) throws Exception {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
             return CommonResult.fail(st);
@@ -4694,7 +5006,9 @@ public class SmartUserController implements SmartUserControllerAPI {
 
     //region 根据数据ID删除用户数据
     @Override
-    public CommonResult deleteSmartUserById(useridsRequest ur, BindingResult bindingResult) throws Exception {
+    public CommonResult deleteSmartUserById
+    (useridsRequest ur, BindingResult
+            bindingResult) throws Exception {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
             return CommonResult.fail(st);
@@ -4842,7 +5156,8 @@ public class SmartUserController implements SmartUserControllerAPI {
     //region 根据当前用户ID获取受访学生数据
     @Override
     @DESRespondSecret(validated = true)
-    public CommonResult queryAffiliateUserById(int id) {
+    public CommonResult queryAffiliateUserById
+    (int id) {
         List<AffiliateUserVo> result = smartUserService.queryAffiliateUserById(id);
 
         if (result != null && result.size() > 0) {
@@ -4864,7 +5179,8 @@ public class SmartUserController implements SmartUserControllerAPI {
     //region 导出人员Excel模板
     @Override
     @DESRespondSecret(validated = true)
-    public CommonResult downloadUserExcel() {
+    public CommonResult downloadUserExcel
+    () {
         return CommonResult.ok("200", "操作成功", "https://wanzai-1306339220.cos.ap-shanghai.myqcloud.com/excelModel/人员信息表.xlsx");
     }
     //endregion
@@ -4872,7 +5188,8 @@ public class SmartUserController implements SmartUserControllerAPI {
     //region 导出教师模板
     @Override
     @DESRespondSecret(validated = true)
-    public CommonResult downloadTeacherExcel() {
+    public CommonResult downloadTeacherExcel
+    () {
         return CommonResult.ok("200", "操作成功", "https://wanzai-1306339220.cos.ap-shanghai.myqcloud.com/excelModel/教师信息表.xlsx");
     }
     //endregion
@@ -4880,7 +5197,8 @@ public class SmartUserController implements SmartUserControllerAPI {
     //region 导出更新人员Excel模板
     @Override
     @DESRespondSecret(validated = true)
-    public CommonResult downloadUpdateUserExcel() {
+    public CommonResult downloadUpdateUserExcel
+    () {
         return CommonResult.ok("200", "操作成功", "https://wanzai-1306339220.cos.ap-shanghai.myqcloud.com/excelModel/更新信息表.xlsx");
     }
     //endregion
@@ -4888,7 +5206,8 @@ public class SmartUserController implements SmartUserControllerAPI {
     //region 根据用户ID查询学生
     @Override
     @DESRespondSecret(validated = true)
-    public CommonResult queryStudents(int userId) {
+    public CommonResult queryStudents(
+            int userId) {
 
         List<SmartUser> students = new ArrayList<>();
         SmartUser user = smartUserService.getSmartById(userId);
@@ -4925,7 +5244,8 @@ public class SmartUserController implements SmartUserControllerAPI {
     //region 根据数据ID获取用户信息
     @Override
     @DESRespondSecret(validated = true)
-    public CommonResult queryInfoData(int id) {
+    public CommonResult queryInfoData(
+            int id) {
 
         SmartUser su = smartUserService.getSmartById(id);
         if (su == null) {
@@ -4954,9 +5274,9 @@ public class SmartUserController implements SmartUserControllerAPI {
         }
 
         userData.setHeadImage(su.getHeadImage());
-        if(org.springframework.util.StringUtils.hasText(su.getGrade())){
+        if (org.springframework.util.StringUtils.hasText(su.getGrade())) {
             Optional<SmartGrade> oGrade = grades.stream().filter(e -> String.valueOf(e.getId()).equals(su.getGrade())).findFirst();
-            if(oGrade != null && oGrade.isPresent()){
+            if (oGrade != null && oGrade.isPresent()) {
                 userData.setGrade(oGrade.get().getName());
             }
         }
@@ -5007,7 +5327,9 @@ public class SmartUserController implements SmartUserControllerAPI {
     //region 绑定学生
     @Override
     @DESRespondSecret(validated = true)
-    public CommonResult bindStudent(bindStudentRequest bsr, BindingResult bindingResult) {
+    public CommonResult bindStudent
+    (bindStudentRequest
+             bsr, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
             return CommonResult.fail(st);
@@ -5112,7 +5434,8 @@ public class SmartUserController implements SmartUserControllerAPI {
 
     //region 根据数据ID获取用户信息
     @Override
-    public CommonResult queryUserData(int id) {
+    public CommonResult queryUserData(
+            int id) {
         SmartUserVo user = smartUserService.querySmartUserById(id);
 
         return CommonResult.ok(user);
@@ -5121,7 +5444,8 @@ public class SmartUserController implements SmartUserControllerAPI {
 
     //region 删除记录的分页数据
     @Override
-    public CommonResult queryUserDeletePage(int currentPage, int pageCount) {
+    public CommonResult queryUserDeletePage
+    (int currentPage, int pageCount) {
         PageUtils<UserDeleteVo> result = smartUserService.queryUserDeletePage(currentPage, pageCount);
 
         List<SmartDepartment> departments = smartDepartmentService.list(null);
@@ -5141,7 +5465,8 @@ public class SmartUserController implements SmartUserControllerAPI {
 
     //region 获取班级下的学生
     @Override
-    public CommonResult queryClassUser(int userId, String keyWord) {
+    public CommonResult queryClassUser(
+            int userId, String keyWord) {
         SmartUser userData = smartUserService.getSmartById(userId);
         if (userData == null) {
             return CommonResult.fail("未查到用户信息,获取失败");
@@ -5207,7 +5532,10 @@ public class SmartUserController implements SmartUserControllerAPI {
 
     //region 批量设置学生时间组
     @Override
-    public CommonResult setUserTimeGroup(setUserTimeGroupRequest isur, BindingResult bindingResult) throws Exception {
+    public CommonResult setUserTimeGroup
+    (setUserTimeGroupRequest
+             isur, BindingResult bindingResult) throws
+            Exception {
         if (bindingResult.hasErrors()) {
             String st = paramUtils.getParamError(bindingResult);
             return CommonResult.fail(st);
@@ -5274,9 +5602,9 @@ public class SmartUserController implements SmartUserControllerAPI {
     }
 
 
-
     @Override
-    public CommonResult getPhoneUser(String phone) {
+    public CommonResult getPhoneUser
+            (String phone) {
 
         if (ObjectUtils.isEmpty(phone)) {
             return CommonResult.fail("参数异常");
@@ -5289,7 +5617,8 @@ public class SmartUserController implements SmartUserControllerAPI {
 
 
     @Override
-    public CommonResult getPhoneAffiliate(String phone) {
+    public CommonResult getPhoneAffiliate
+            (String phone) {
         if (ObjectUtils.isEmpty(phone)) {
             return CommonResult.fail("参数异常");
         }
@@ -5303,7 +5632,7 @@ public class SmartUserController implements SmartUserControllerAPI {
         }
 
 //        通过关联人找到对应用户
-        List<SmartUser> smartUsers=smartUserService.getAffiliateUser(affiliate);
+        List<SmartUser> smartUsers = smartUserService.getAffiliateUser(affiliate);
 
 
         return CommonResult.ok(smartUsers);
@@ -5332,7 +5661,8 @@ public class SmartUserController implements SmartUserControllerAPI {
      *
      * @return
      */
-    public String queryGraduationYear(int grade) {
+    public String queryGraduationYear(
+            int grade) {
         String endTime = "";
         int endYear = Year.now().getValue();
         // 获取当前年份

+ 35 - 0
src/main/java/com/template/model/request/smartUserExportRequest.java

@@ -0,0 +1,35 @@
+package com.template.model.request;
+
+import com.template.model.vo.gauageOutfitVo;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-04
+ */
+@Data
+public class smartUserExportRequest {
+    /**
+     * 部门ID
+     */
+    private Integer departmentId;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 表头集合
+     */
+    private List<gauageOutfitVo> gauageOutfitVos;
+}

+ 23 - 0
src/main/java/com/template/model/vo/gauageOutfitVo.java

@@ -0,0 +1,23 @@
+package com.template.model.vo;
+
+import lombok.Data;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/12/4 星期一 15:57
+ * @Description: com.template.model.vo
+ * @Version: 1.0
+ */
+@Data
+public class gauageOutfitVo {
+    /**
+     * 数据ID
+     */
+    private Integer id;
+
+    /**
+     * 表头名称
+     */
+    private String name;
+
+}

BIN
target/mybatis_plus-0.0.1-SNAPSHOT.jar.original