yangdamao 1 місяць тому
батько
коміт
3effc2b3b9

+ 3 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/course/CourseController.java

@@ -1,5 +1,8 @@
 package com.zhongzheng.controller.course;
 
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.*;
 import java.util.stream.Collectors;
 

+ 10 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/user/UserStudyLogController.java

@@ -7,6 +7,7 @@ import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.enums.BusinessType;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.framework.web.service.WxTokenService;
+import com.zhongzheng.modules.user.bo.RepairUserStudyBo;
 import com.zhongzheng.modules.user.bo.UserStudyLogAddBo;
 import com.zhongzheng.modules.user.bo.UserStudyLogQueryBo;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
@@ -61,6 +62,15 @@ public class UserStudyLogController extends BaseController {
         return AjaxResult.success(iUserStudyLogService.queryById(id));
     }
 
+    /**
+     * 修复学员学时
+     */
+    @ApiOperation("修复学员学时")
+    @PostMapping("/repair")
+    public AjaxResult<Void> repairUserStudy(@RequestBody RepairUserStudyBo bo) {
+        return AjaxResult.success(iUserStudyLogService.repairUserStudy(bo));
+    }
+
 
 
 

+ 0 - 2
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/poi/ExcelUtil.java

@@ -18,9 +18,7 @@ import com.zhongzheng.common.utils.DictUtils;
 import com.zhongzheng.common.utils.file.FileTypeUtils;
 import com.zhongzheng.common.utils.file.ImageUtils;
 import com.zhongzheng.common.utils.reflect.ReflectUtils;
-import org.apache.poi.hssf.usermodel.*;
 import org.apache.poi.ss.usermodel.*;
-import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.ss.util.CellRangeAddressList;
 import org.apache.poi.xssf.streaming.SXSSFWorkbook;
 import org.apache.poi.xssf.usermodel.XSSFClientAnchor;

+ 15 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/RepairUserStudyBo.java

@@ -0,0 +1,15 @@
+package com.zhongzheng.modules.user.bo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class RepairUserStudyBo implements Serializable {
+
+    private Long orderGoodsId;
+
+    private Long gradeId;
+
+    private Long time;
+}

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserStudyLogService.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.modules.user.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.modules.user.bo.RepairUserStudyBo;
 import com.zhongzheng.modules.user.bo.UserStudyLogAddBo;
 import com.zhongzheng.modules.user.bo.UserStudyLogEditBo;
 import com.zhongzheng.modules.user.bo.UserStudyLogQueryBo;
@@ -55,4 +56,5 @@ public interface IUserStudyLogService extends IService<UserStudyLog> {
     UserStudyLog getOneNoTenant(Long userId);
 
 
+	String repairUserStudy(RepairUserStudyBo bo);
 }

+ 108 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyLogServiceImpl.java

@@ -3,17 +3,34 @@ package com.zhongzheng.modules.user.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ip.IpUtils;
+import com.zhongzheng.modules.course.domain.CoursePhotoLog;
+import com.zhongzheng.modules.course.service.ICoursePhotoLogService;
+import com.zhongzheng.modules.grade.domain.ClassGradeUser;
+import com.zhongzheng.modules.grade.domain.UserPeriod;
+import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
+import com.zhongzheng.modules.grade.service.IClassGradeUserService;
+import com.zhongzheng.modules.grade.service.IUserPeriodService;
+import com.zhongzheng.modules.grade.service.IUserPeriodStatusService;
+import com.zhongzheng.modules.user.bo.RepairUserStudyBo;
 import com.zhongzheng.modules.user.bo.UserStudyLogAddBo;
 import com.zhongzheng.modules.user.bo.UserStudyLogEditBo;
 import com.zhongzheng.modules.user.bo.UserStudyLogQueryBo;
 import com.zhongzheng.modules.user.domain.UserStudyLog;
+import com.zhongzheng.modules.user.domain.UserStudyRecord;
+import com.zhongzheng.modules.user.domain.UserStudyRecordPhoto;
 import com.zhongzheng.modules.user.domain.UserVisitLog;
 import com.zhongzheng.modules.user.mapper.UserStudyLogMapper;
 import com.zhongzheng.modules.user.service.IUserStudyLogService;
+import com.zhongzheng.modules.user.service.IUserStudyRecordPhotoService;
+import com.zhongzheng.modules.user.service.IUserStudyRecordService;
 import com.zhongzheng.modules.user.vo.UserStudyLogVo;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -34,6 +51,24 @@ import java.util.stream.Collectors;
 @Service
 public class UserStudyLogServiceImpl extends ServiceImpl<UserStudyLogMapper, UserStudyLog> implements IUserStudyLogService {
 
+    @Autowired
+    private IClassGradeUserService iClassGradeUserService;
+
+    @Autowired
+    private IUserStudyRecordService iUserStudyRecordService;
+
+    @Autowired
+    private IUserPeriodService iUserPeriodService;
+
+    @Autowired
+    private IUserPeriodStatusService iUserPeriodStatusService;
+
+    @Autowired
+    private IUserStudyRecordPhotoService iUserStudyRecordPhotoService;
+
+    @Autowired
+    private ICoursePhotoLogService iCoursePhotoLogService;
+
     @Override
     public UserStudyLogVo queryById(Long id){
         UserStudyLog db = this.baseMapper.selectById(id);
@@ -126,4 +161,77 @@ public class UserStudyLogServiceImpl extends ServiceImpl<UserStudyLogMapper, Use
         return baseMapper.getOneNoTenant(userId);
     }
 
+    @Override
+    public String repairUserStudy(RepairUserStudyBo bo) {
+        ClassGradeUser classGradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getOrderGoodsId, bo.getOrderGoodsId()).eq(ClassGradeUser::getGradeId, bo.getGradeId()));
+        if (ObjectUtils.isNull(classGradeUser)){
+            throw new CustomException("班级学员不存在,请检查");
+        }
+        //添加时间
+        Long time = bo.getTime();
+
+        //学习记录
+        List<UserStudyRecord> userStudyRecords = iUserStudyRecordService
+                .list(new LambdaQueryWrapper<UserStudyRecord>().eq(UserStudyRecord::getOrderGoodsId, bo.getOrderGoodsId()).eq(UserStudyRecord::getGradeId, bo.getGradeId()));
+
+        if (CollectionUtils.isEmpty(userStudyRecords)){
+            throw new CustomException("学习记录不存在,请检查");
+        }
+        //学时审核记录
+        List<UserPeriod> userPeriods = iUserPeriodService
+                .list(new LambdaQueryWrapper<UserPeriod>().eq(UserPeriod::getOrderGoodsId, bo.getOrderGoodsId()).eq(UserPeriod::getGradeId, bo.getGradeId()));
+        if (CollectionUtils.isNotEmpty(userPeriods)){
+            List<Long> periodIds = userPeriods.stream().map(UserPeriod::getId).collect(Collectors.toList());
+            List<UserPeriodStatus> periodStatusList = iUserPeriodStatusService.list(new LambdaQueryWrapper<UserPeriodStatus>().in(UserPeriodStatus::getPeriodId, periodIds));
+
+            //获取学习照片
+            if (CollectionUtils.isNotEmpty(periodStatusList)){
+                List<Long> periodStatusIds = periodStatusList.stream().map(UserPeriodStatus::getId).collect(Collectors.toList());
+                List<UserStudyRecordPhoto> photoList = iUserStudyRecordPhotoService.list(new LambdaQueryWrapper<UserStudyRecordPhoto>().in(UserStudyRecordPhoto::getPeriodId, periodStatusIds));
+                if (CollectionUtils.isNotEmpty(photoList)){
+                    photoList.forEach(x -> {
+                        x.setCreateTime(x.getCreateTime()+time);
+                        x.setUpdateTime(x.getUpdateTime()+time);
+                    });
+                    iUserStudyRecordPhotoService.updateBatchById(photoList);
+                }
+                periodStatusList.forEach(y -> {
+                    y.setCreateTime(y.getCreateTime()+time);
+                    y.setUpdateTime(y.getUpdateTime()+time);
+                    y.setRecordStartTime(y.getRecordStartTime()+time);
+                    y.setRecordEndTime(y.getRecordEndTime()+time);
+                    y.setAuditTime(y.getAuditTime()+time);
+                });
+                iUserPeriodStatusService.updateBatchById(periodStatusList);
+            }
+
+            userPeriods.forEach(k -> {
+                k.setCreateTime(k.getCreateTime()+time);
+                k.setUpdateTime(k.getUpdateTime()+time);
+            });
+            iUserPeriodService.updateBatchById(userPeriods);
+        }
+
+        List<CoursePhotoLog> coursePhotoLogs = iCoursePhotoLogService
+                .list(new LambdaQueryWrapper<CoursePhotoLog>().eq(CoursePhotoLog::getOrderGoodsId, bo.getOrderGoodsId()).eq(CoursePhotoLog::getGradeId, bo.getGradeId()));
+        if (CollectionUtils.isNotEmpty(coursePhotoLogs)){
+            coursePhotoLogs.forEach(j -> {
+                j.setCreateTime(j.getCreateTime()+time);
+                j.setUpdateTime(j.getUpdateTime()+time);
+            });
+            iCoursePhotoLogService.updateBatchById(coursePhotoLogs);
+        }
+
+        userStudyRecords.forEach(l -> {
+            l.setCreateTime(l.getCreateTime()+time);
+            l.setUpdateTime(l.getUpdateTime()+time);
+            l.setStartTime(l.getStartTime()+time);
+            l.setEndTime(l.getEndTime()+time);
+            l.setFirstStartTime(l.getFirstStartTime()+time);
+        });
+        iUserStudyRecordService.updateBatchById(userStudyRecords);
+
+        return "";
+    }
+
 }

+ 105 - 124
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserSubscribeServiceImpl.java

@@ -24,14 +24,12 @@ import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ToolsUtils;
 import com.zhongzheng.common.utils.file.FileUtils;
-import com.zhongzheng.common.utils.file.ImageUtils;
 import com.zhongzheng.common.utils.http.HttpUtils;
 import com.zhongzheng.common.utils.poi.ExcelUtil;
 import com.zhongzheng.modules.alioss.bo.OssRequest;
 import com.zhongzheng.modules.alioss.service.OssService;
 import com.zhongzheng.modules.alioss.vo.FileBean;
 import com.zhongzheng.modules.base.bo.ConsoleQueryBo;
-import com.zhongzheng.modules.base.bo.UserProfileFit;
 import com.zhongzheng.modules.base.domain.UserProfile;
 import com.zhongzheng.modules.base.service.IUserProfileService;
 import com.zhongzheng.modules.course.domain.CourseBusiness;
@@ -59,13 +57,11 @@ import com.zhongzheng.modules.exam.vo.ExamApplyVo;
 import com.zhongzheng.modules.exam.vo.ExamSessionVo;
 import com.zhongzheng.modules.goods.domain.Goods;
 import com.zhongzheng.modules.goods.domain.GoodsQuestionRel;
-import com.zhongzheng.modules.goods.domain.QuestionMerchant;
 import com.zhongzheng.modules.goods.service.IGoodsQuestionRelService;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.domain.ClassGradeUser;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
-import com.zhongzheng.modules.grade.service.IUserPeriodService;
 import com.zhongzheng.modules.grade.vo.ClassGradeVo;
 import com.zhongzheng.modules.inform.bo.InformUserAddBo;
 import com.zhongzheng.modules.inform.service.IInformRemindService;
@@ -83,7 +79,6 @@ import com.zhongzheng.modules.system.service.ISysConfigService;
 import com.zhongzheng.modules.system.service.ISysTaskService;
 import com.zhongzheng.modules.system.service.ISysTenantService;
 import com.zhongzheng.modules.system.vo.SysTaskVo;
-import com.zhongzheng.modules.tencentcloud.service.IFaceOcrService;
 import com.zhongzheng.modules.user.bo.*;
 import com.zhongzheng.modules.user.domain.User;
 import com.zhongzheng.modules.user.domain.UserExamGoods;
@@ -96,17 +91,20 @@ import com.zhongzheng.modules.user.service.IUserStudyRecordPhotoService;
 import com.zhongzheng.modules.user.service.IUserSubscribeService;
 import com.zhongzheng.modules.user.vo.*;
 import com.zhongzheng.modules.wx.service.IWxLoginService;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.multipart.MultipartFile;
 import org.thymeleaf.util.StringUtils;
 
 import javax.imageio.ImageIO;
 import javax.xml.bind.DatatypeConverter;
 import java.awt.*;
+import java.awt.Color;
+import java.awt.Font;
 import java.awt.image.BufferedImage;
 import java.io.*;
 import java.net.URL;
@@ -2193,7 +2191,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
         String zhiyuan = System.getProperty("user.dir");
         String destDirPath = zhiyuan + "/zhongzheng-admin/src/main/resources/"
                 + String.format("%s预约考试%s", DateUtils.timestampToDateFormat(bo.getApplySiteExamTime(), "yyyy-MM-dd"), DateUtils.getNowTime());
-        List<UserExamApplyExport> examApplyExports = new ArrayList<>();
+        List<UserSubApplyExport> examApplyExports = new ArrayList<>();
 
         collect.forEach((k, v) -> {
             String majorPath = destDirPath + "/" + k;
@@ -2261,123 +2259,26 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
                     e.printStackTrace();
                 }
 
-                //身份证
-                try {
-                    String idCardPath = photoPath + "/身份证";
-                    File dirw3 = new File(idCardPath);
-                    if (!dirw3.exists()) {
-                        dirw3.mkdirs();
-                    }
-
-                    InputStream inputStream = ossService.getStreamByObject(user.getIdCardImg1());
-                    //写入本地文件
-                    String inchPath = idCardPath + "/" + String.format("%s$身份证正面.jpg", EncryptHandler.decrypt(user.getRealname()));
-                    FileOutputStream fileOutputStream = new FileOutputStream(inchPath);
-                    byte[] buffer = new byte[1024];
-                    int len = 0;
-                    while ((len = inputStream.read(buffer)) != -1) {
-                        fileOutputStream.write(buffer, 0, len);
-                    }
-                    inputStream.close();
-                    fileOutputStream.close();
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-
-                try {
-                    String idCardPath = photoPath + "/身份证";
-                    File dirw3 = new File(idCardPath);
-                    if (!dirw3.exists()) {
-                        dirw3.mkdirs();
-                    }
-
-                    InputStream inputStream = ossService.getStreamByObject(user.getIdCardImg2());
-                    //写入本地文件
-                    String inchPath = idCardPath + "/" + String.format("%s$身份证背面.jpg", EncryptHandler.decrypt(user.getRealname()));
-                    FileOutputStream fileOutputStream = new FileOutputStream(inchPath);
-                    byte[] buffer = new byte[1024];
-                    int len = 0;
-                    while ((len = inputStream.read(buffer)) != -1) {
-                        fileOutputStream.write(buffer, 0, len);
-                    }
-                    inputStream.close();
-                    fileOutputStream.close();
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-
-                try {
-                    String idCardPath = photoPath + "/承诺书";
-                    File dirw3 = new File(idCardPath);
-                    if (!dirw3.exists()) {
-                        dirw3.mkdirs();
-                    }
-                    String commitmentSeal = getUserProfileValue(keyValue, "commitment_seal");
-                    InputStream inputStream = ossService.getStreamByObject(commitmentSeal);
-                    //写入本地文件
-                    String inchPath = idCardPath + "/" + String.format("%s$承诺书.jpg", EncryptHandler.decrypt(user.getRealname()));
-                    FileOutputStream fileOutputStream = new FileOutputStream(inchPath);
-                    byte[] buffer = new byte[1024];
-                    int len = 0;
-                    while ((len = inputStream.read(buffer)) != -1) {
-                        fileOutputStream.write(buffer, 0, len);
-                    }
-                    inputStream.close();
-                    fileOutputStream.close();
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-
                 //测试计划
-                UserExamApplyExport export = new UserExamApplyExport();
-                export.setUserName(user.getRealname());
-                export.setIdCard(EncryptHandler.decrypt(user.getIdCard()));
-                export.setPhone(EncryptHandler.decrypt(user.getTelphone()));
-                export.setPostName(getUserProfileValue(keyValue, "apply_post"));
-                export.setApplyName(
-                        String.format("%s测试%s-%s", DateUtils.timestampToDateFormat(item.getApplySiteExamTime(), "yyyy.MM.dd")
-                                , applyTimeTransition(item.getApplySiteStartTime()), applyTimeTransition(item.getApplySiteEndTime())));
-                examApplyExports.add(export);
+                examApplyExports.add(applyExport);
             });
-            //打包zip
-            String zipPath = majorPath + "/" + String.format("%s.zip",schoolName);
-            FileUtils.toZip(zipPath, photoPath, true);
-            //删除本地资源
-            Path pathStr = Paths.get(photoPath);
-            try (Stream<Path> walk = Files.walk(pathStr)) {
-                walk.sorted(Comparator.reverseOrder())
-                        .forEach(FileUtils::deleteDirectoryStream);
-            } catch (IOException e) {
-                log.error("删除本地资源失败:" + DateUtils.getNowTime());
-            }
             //报考资料
             if (CollectionUtils.isNotEmpty(applyExports)) {
-                ExcelUtil<UserSubApplyExport> util = new ExcelUtil<UserSubApplyExport>(UserSubApplyExport.class);
                 String path = majorPath + "/" + String.format("%s报名信息表", k) + ".xlsx";
-                util.exportEasyExcelStudy(util.exportEasyData(applyExports), path);
+                createCompleteExcel(path,applyExports);
             }
         });
 
         //测试计划
         if (CollectionUtils.isNotEmpty(examApplyExports)) {
-            ExcelUtil<UserExamApplyExport> util = new ExcelUtil<UserExamApplyExport>(UserExamApplyExport.class);
             String path = destDirPath + "/测试计划.xlsx";
-            util.exportEasyExcelStudy(util.exportEasyData(examApplyExports), path);
+            createCompleteExcel(path,examApplyExports);
         }
 
-        //打包zip 上传oss
-        String zipPath = zhiyuan + "/zhongzheng-admin/src/main/resources/"
-                + String.format("%s预约考试%s.zip", DateUtils.timestampToDateFormat(bo.getApplySiteExamTime(), "yyyy-MM-dd"), DateUtils.getNowTime());
-        FileUtils.toZip(zipPath, destDirPath, true);
-        //上传oss
-        OssRequest ossRequest = new OssRequest();
-        ossRequest.setGradeId(0L);
-        ossRequest.setUserId(0L);
-        ossRequest.setImageStatus(7);
-        File file1 = new File(zipPath);
-        ossRequest.setFile(FileUtils.getMultipartFile(file1));
+        String filename = FileUtils.encodingZipFilename("学员信息数据");
+        String zipFile = FileUtils.getZipAbsoluteFile(filename);
+        FileUtils.toZip(zipFile, destDirPath, true);
         try {
-            String upload = ossService.upload(ossRequest);
             //删除本地资源
             Path pathStr = Paths.get(destDirPath);
             try (Stream<Path> walk = Files.walk(pathStr)) {
@@ -2387,22 +2288,10 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
                 log.error("删除本地资源失败:" + DateUtils.getNowTime());
             }
 
-            Path zipStr = Paths.get(zipPath);
-            try (Stream<Path> walk = Files.walk(zipStr)) {
-                walk.sorted(Comparator.reverseOrder())
-                        .forEach(FileUtils::deleteDirectoryStream);
-            } catch (IOException e) {
-                log.error("删除本地资源失败:" + DateUtils.getNowTime());
-            }
-            map.put("zip", AjaxResult.success(upload));
+            map.put("zip", AjaxResult.success(filename));
         } catch (Exception e) {
             e.printStackTrace();
         }
-
-//        collect.forEach((k,v ) ->{
-//
-//
-//        });
 //        List<UserSubscribeStudentExportVo> list1 = new ArrayList<>();
 //        List<FileBean> fileBeanList = new ArrayList<>(); //图片列表
 //        String filename = FileUtils.encodingZipFilename("学员信息数据");
@@ -2473,6 +2362,98 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
         return map;
     }
 
+
+    private static void createCompleteExcel(String path,  List<UserSubApplyExport> applyExports) {
+        Workbook workbook = new XSSFWorkbook();
+        Sheet sheet = workbook.createSheet("Sheet1");
+
+        // 创建样式
+        CellStyle noteStyle = createNoteStyle(workbook);
+        CellStyle headerStyle = createHeaderStyle(workbook);
+
+        // 第1行:注意事项
+        Row noteRow = sheet.createRow(0);
+        Cell noteCell = noteRow.createCell(0);
+        noteCell.setCellValue("模板内容皆为必填,身份证号不可以是这种‘1.10101E+17’格式,性别、学历信息请从列表中选择,‘工作单位’填写工作单位的全称,请按要求填写");
+        noteCell.setCellStyle(noteStyle);
+        // 设置水平对齐 - 靠左
+        noteStyle.setAlignment(HorizontalAlignment.LEFT);
+        sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 7));
+
+        // 第2行:表头
+        Row headerRow = sheet.createRow(1);
+        String[] headers = {"姓名", "性别", "身份证号", "手机号", "学历", "工作单位", "岗位"};
+        for (int i = 0; i < headers.length; i++) {
+            Cell cell = headerRow.createCell(i);
+            cell.setCellValue(headers[i]);
+            cell.setCellStyle(headerStyle);
+            sheet.setColumnWidth(i, 15 * 450);
+        }
+
+        // 添加数据
+        int rowNum = 2;
+        for (UserSubApplyExport emp : applyExports) {
+            Row row = sheet.createRow(rowNum++);
+
+            Cell cell0 = row.createCell(0);
+            cell0.setCellValue(emp.getUserName());
+
+            Cell cell1 = row.createCell(1);
+            cell1.setCellValue(emp.getSex());
+
+            Cell cell2 = row.createCell(2);
+            cell2.setCellValue(emp.getIdCard());
+
+            Cell cell3 = row.createCell(3);
+            cell3.setCellValue(emp.getPhone());
+
+            Cell cell4 = row.createCell(4);
+            cell4.setCellValue(emp.getEducation());
+
+            Cell cell5 = row.createCell(5);
+            cell5.setCellValue(emp.getCompanyName());
+
+            Cell cell6 = row.createCell(6);
+            cell6.setCellValue(emp.getPostName());
+
+        }
+
+        // 设置行高
+        noteRow.setHeightInPoints(30);
+        headerRow.setHeightInPoints(20);
+
+        // 写入文件
+        try (FileOutputStream fos = new FileOutputStream(path)) {
+            workbook.write(fos);
+            workbook.close();
+        }catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static CellStyle createNoteStyle(Workbook workbook) {
+        CellStyle style = workbook.createCellStyle();
+        style.setFillForegroundColor(IndexedColors.SEA_GREEN.getIndex());
+        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+
+        style.setAlignment(HorizontalAlignment.CENTER);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);
+
+        return style;
+    }
+
+    private static CellStyle createHeaderStyle(Workbook workbook) {
+        CellStyle style = workbook.createCellStyle();
+
+        style.setBorderBottom(BorderStyle.THIN);
+        style.setBorderTop(BorderStyle.THIN);
+        style.setBorderLeft(BorderStyle.THIN);
+        style.setBorderRight(BorderStyle.THIN);
+        style.setAlignment(HorizontalAlignment.CENTER);
+
+        return style;
+    }
+
     @Override
     public Map<String, Object> listSignExport(UserSubscribeQueryBo bo) {
         Map<String, Object> map = new HashMap<>();

+ 31 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserSubExportVo.java

@@ -0,0 +1,31 @@
+package com.zhongzheng.modules.user.vo;
+
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+/**
+ * 用户预约考试视图对象 mall_package
+ *
+ * @author ruoyi
+ * @date 2021-12-07
+ */
+@Data
+public class UserSubExportVo implements Serializable {
+
+	private String userName;
+
+	private String sex;
+
+	private String idCard;
+
+	private String phone;
+
+	private String education;
+
+	private String companyName;
+
+	private String postName;
+}