1.正式考试,模拟考试考试申请接口修改
2.用户头像批量上传(压缩zip 包上传)
3.通知公告接口修改
17 files modified
2 files added
569 ■■■■ changed files
pom.xml 14 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/config/FileConfig.java 43 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/utils/FileUtil.java 187 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/controller/ApplyController.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/mapper/ApplyMapper.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/mapper/ApplyMapper.xml 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/service/ApplyService.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/service/impl/ApplyServiceImpl.java 4 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/desk/controller/NoticeController.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/desk/mapper/NoticeMapper.xml 17 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java 128 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml 51 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/vo/UserVO.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/controller/TrainingRegistrationController.java 85 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/mapper/TrainingRegistrationMapper.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/mapper/TrainingRegistrationMapper.xml 9 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/service/TrainingRegistrationService.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/service/impl/TrainingRegistrationServiceImpl.java 4 ●●●● patch | view | raw | blame | history
src/main/resources/application-dev.yml 6 ●●●●● patch | view | raw | blame | history
pom.xml
@@ -245,6 +245,20 @@
            <artifactId>javase</artifactId>
            <version>3.3.3</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/net.lingala.zip4j/zip4j -->
        <dependency>
            <groupId>net.lingala.zip4j</groupId>
            <artifactId>zip4j</artifactId>
            <version>1.3.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-mock -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-mock</artifactId>
            <version>2.0.8</version>
        </dependency>
    </dependencies>
    <build>
src/main/java/org/springblade/common/config/FileConfig.java
New file
@@ -0,0 +1,43 @@
package org.springblade.common.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
/**
 *Jun 12, 2019
 *
 * FileConfig.java
 */
@ConfigurationProperties(prefix = "upload")
@Component
@Order
public class FileConfig {
    public static String localtion;
    public static String maxFileSize;
    public static String maxRequestSize;
    /**
     * @param localtion the localtion to set
     */
    public void setLocaltion(String localtion) {
        FileConfig.localtion = localtion;
    }
    /**
     * @param maxFileSize the maxFileSize to set
     */
    public void setMaxFileSize(String maxFileSize) {
        FileConfig.maxFileSize = maxFileSize;
    }
    /**
     * @param maxRequestSize the maxRequestSize to set
     */
    public void setMaxRequestSize(String maxRequestSize) {
        FileConfig.maxRequestSize = maxRequestSize;
    }
}
src/main/java/org/springblade/common/utils/FileUtil.java
New file
@@ -0,0 +1,187 @@
package org.springblade.common.utils;
import java.io.*;
import java.nio.channels.FileChannel;
import java.util.List;
import net.lingala.zip4j.core.ZipFile;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
public class FileUtil {
    public static void clearFiles(String workspaceRootPath) {
        File file = new File(workspaceRootPath);
        deleteFile(file);
    }
    public static void deleteFile(File file) {
        if (file.exists()) {
            if (file.isDirectory()) {
                File[] files = file.listFiles();
                for (int i = 0; i < files.length; i++) {
                    deleteFile(files[i]);
                }
            }
        }
        file.delete();
    }
    public static void fileWrite(String str, String fileNamePath) throws IOException {
        FileWriter writer = null;
        try {
            File file = new File(fileNamePath);
            if (!file.getParentFile().exists()) {
                file.getParentFile().mkdirs();
                file.createNewFile();
            }
            writer = new FileWriter(file, true);
            writer.write(str + System.getProperty("line.separator"));
        } catch (IOException e) {
        } finally {
            if (writer != null) {
                writer.close();
            }
        }
    }
    public static File mkFile(String fileName) {
        File f = new File(fileName);
        try {
            if (f.exists()) {
                f.delete();
            }
            f.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return f;
    }
    public static void copyDirAndFile(String oldPath, String newPath) throws IOException {
        if (!(new File(newPath)).exists()) {
            (new File(newPath)).mkdir();
        }
        File file = new File(oldPath);
        //file name list
        String[] filePaths = file.list();
        for (String filePath : filePaths) {
            String oldFullPath = oldPath + file.separator + filePath;
            String newFullPath = newPath + file.separator + filePath;
            File oldFile = new File(oldFullPath);
            File newFile = new File(newFullPath);
            if (oldFile.isDirectory()) {
                copyDirAndFile(oldFullPath, newFullPath);
            } else if (oldFile.isFile()) {
                copyFile(oldFile, newFile);
            }
        }
    }
    public static void copyFile(File source, File dest) throws IOException {
        FileChannel inputChannel = null;
        FileChannel outputChannel = null;
        try {
            inputChannel = new FileInputStream(source).getChannel();
            outputChannel = new FileOutputStream(dest).getChannel();
            outputChannel.transferFrom(inputChannel, 0, inputChannel.size());
        } finally {
            inputChannel.close();
            outputChannel.close();
        }
    }
    /**
     *
     * 解压zip 包
     * @author panchaoyuan
     * @param srcFile    Unzipped file
     * @param destDirPath   Unzipped destination folder
     * @throws RuntimeException
     * @throws IOException
     */
    public static void unZip(MultipartFile  srcFile, String destDirPath,String savePath) throws RuntimeException, IOException {
        File file = null;
        InputStream ins = srcFile.getInputStream();
        String savaPaths = savePath+srcFile.getOriginalFilename();
        System.out.println("savaPaths = " + savaPaths);
        file=new File(savaPaths);
        inputStreamToFile(ins, file);
        if (!file.exists()) {
            throw new RuntimeException(file.getPath() + ",file is not found");
        }
        ZipFile zipFile = null;
        try {
            zipFile = new ZipFile(file);
//            zipFile.setFileNameCharset("utf-8");
            zipFile.setFileNameCharset("gbk");
            //解压到 destDirPath
            zipFile.extractAll(destDirPath);
        }catch(Exception e) {
            throw new RuntimeException("unzip error from FileUtil", e);
        }
    }
    /**
     * 输入流转换为文件
     * @author panchaoyuan
     * @return
     */
    private static void inputStreamToFile(InputStream ins, File file) {
        try {
            OutputStream os = new FileOutputStream(file);
            int bytesRead = 0;
            byte[] buffer = new byte[8192];
            while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
                os.write(buffer, 0, bytesRead);
            }
            os.close();
            ins.close();
        }catch(Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 获取解压出来的图片
     * @author arsn
     * @return
     */
    public List<MultipartFile> getSubFiles(String  desFile,List<MultipartFile> fileList){
        //取出图片数据遍历
        File file = new File(desFile);
        File[] files = file.listFiles();
        for (File fileIndex : files) {
            if (!fileIndex.exists()) {
                throw new NullPointerException("Cannot find " + fileIndex);
            } else if (fileIndex.isFile()) {
                try {
                    //将 file 转换为 MultipartFile
                    File file1 = new File(desFile+File.separator + fileIndex.getName());
                    FileInputStream fileInputStream = new FileInputStream(file1);
                    MockMultipartFile mockMultipartFile = null;
                    try {
                        String name = fileIndex.getName();
                        mockMultipartFile = new MockMultipartFile(name,fileInputStream);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    fileList.add(mockMultipartFile);
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
            } else {
                if (fileIndex.isDirectory()) {
                    getSubFiles(fileIndex.getAbsolutePath(),fileList);
                }
            }
        }
        return fileList;
    }
}
src/main/java/org/springblade/modules/apply/controller/ApplyController.java
@@ -603,13 +603,14 @@
    /**
     * 生成试卷,报名
     * 生成考试,报名
     * @param ids 报名ids
     */
    @PostMapping("/batchExam")
    public R batchExam(@RequestParam String ids,
                       String examTime,
                       @RequestParam Date startTime,
                       @RequestParam Integer number,
                       Date endTime){
        if (!ids.equals("")){
            List<String> list = Arrays.asList(ids.split(","));
@@ -653,7 +654,7 @@
        }else {
            //查询已报名未关联试卷的人员
            List<Long> applyIds = applyService.getApplyIds();
            List<Long> applyIds = applyService.getApplyIds(number);
            if (applyIds.size()>0){
                //生成考试
                ExamPaper examPaper = new ExamPaper();
src/main/java/org/springblade/modules/apply/mapper/ApplyMapper.java
@@ -88,7 +88,7 @@
     * 查询报名人员未关联考试的ids集合
     * @return
     */
    List<Long> getApplyIds();
    List<Long> getApplyIds(@Param("number") Integer number);
    /**
     * 查询考试人数
src/main/java/org/springblade/modules/apply/mapper/ApplyMapper.xml
@@ -229,6 +229,7 @@
        and sa.apply_status = 2
        and bu.is_apply = 1
        and sa.exam_id is null
        limit 0,#{number}
    </select>
    <!--查询考试人数-->
src/main/java/org/springblade/modules/apply/service/ApplyService.java
@@ -88,7 +88,7 @@
     * 查询报名人员未关联考试的ids集合
     * @return
     */
    List<Long> getApplyIds();
    List<Long> getApplyIds(Integer number);
    /**
     * 查询报名清册信息
src/main/java/org/springblade/modules/apply/service/impl/ApplyServiceImpl.java
@@ -394,8 +394,8 @@
     * @return
     */
    @Override
    public List<Long> getApplyIds() {
        return baseMapper.getApplyIds();
    public List<Long> getApplyIds(Integer number) {
        return baseMapper.getApplyIds(number);
    }
    /**
src/main/java/org/springblade/modules/desk/controller/NoticeController.java
@@ -90,7 +90,7 @@
    /**
     * 多表联合查询自定义分页
     */
    @GetMapping("/page")
        @GetMapping("/page")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "category", value = "公告类型", paramType = "query", dataType = "integer"),
        @ApiImplicitParam(name = "title", value = "公告标题", paramType = "query", dataType = "string")
src/main/java/org/springblade/modules/desk/mapper/NoticeMapper.xml
@@ -49,12 +49,6 @@
        ( SELECT * FROM blade_dict WHERE code = 'notice' ) d
        ON
        n.category = d.dict_key
        <if test="notice.deptId!=null and notice.jurisdiction!=null">
            left join
            blade_user bu
            on
            bu.dept_id = n.dept_id
        </if>
        WHERE
        n.is_deleted = 0
        <if test="notice.title!=null">
@@ -66,15 +60,8 @@
        <if test="notice.type!=null">
            and n.type = #{notice.type}
        </if>
        <if test="notice.deptId!=null and notice.jurisdiction!=null">
            and (n.dept_id = #{notice.deptId} or bu.jurisdiction = #{notice.jurisdiction}
            or n.dept_id = 1123598813738675201
            )
        </if>
        <if test="notice.deptId!=null and notice.jurisdiction==null">
            and (n.dept_id = #{notice.deptId} and n.category=2
            or n.dept_id = 1123598813738675201
            )
        <if test="notice.deptId!=null and notice.deptId!=''">
            and n.dept_id = #{notice.deptId}
        </if>
        <if test="notice.startTime!=null and notice.startTime!=''">
            and n.release_time &gt;= #{notice.startTime}
src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java
@@ -16,40 +16,31 @@
 */
package org.springblade.modules.resource.endpoint;
import com.alibaba.fastjson.JSON;
import io.minio.*;
import io.minio.errors.*;
import io.swagger.annotations.Api;
import javafx.scene.Parent;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springblade.common.config.FileConfig;
import org.springblade.common.constant.FtpConstant;
import org.springblade.common.utils.arg;
import org.springblade.common.utils.FileUtil;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.oss.model.OssFile;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.utils.FileUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.resource.builder.oss.OssBuilder;
import org.springblade.modules.resource.entity.Attach;
import org.springblade.modules.resource.service.IAttachService;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.service.IUserService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -57,10 +48,8 @@
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.*;
import java.util.regex.Pattern;
import static org.springblade.common.constant.FtpConstant.*;
@@ -85,6 +74,9 @@
     * 附件表服务
     */
    private final IAttachService attachService;
    private final IUserService userService;
    /**
     * 创建存储桶
@@ -280,6 +272,104 @@
    /**
     * 文件上传,zip
     *
     * @param file 图片对象
     */
    @PostMapping("put-file-zip")
    public R putFileZip(@RequestParam MultipartFile file) throws Exception {
        Map<String, Object> map = new HashMap<>(1);
        //填写你文件上传的地址以及相应信息
        String url = "http://223.82.109.183:2081";
        String access = "zhbaadmin";
        String secret = "zhbapassword";
        String bucket = "zhba";
        MinioClient minioClient =
            MinioClient.builder()
                .endpoint(url)
                .credentials(access, secret)
                .build();
        // 检查存储桶是否已经存在
        boolean isExist = minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucket).build());
        if (!isExist) {
            // 创建一个名为zip的存储桶,用于zip文件。
            minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucket).build());
            minioClient.setBucketPolicy(SetBucketPolicyArgs.builder().bucket(bucket).build());
        }
        String fileName = file.getOriginalFilename();
        String namePath = fileName.substring(0,fileName.lastIndexOf("."));
        String fileType = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase(Locale.US);
        //判断文件是不是zip类型
        if(!fileType.equals("zip")){
            map.put("data","上传文件类型不符!");
            return R.data(map);
        }
        //FileConfig.localtion是配置文件和config类生产的,测试demo可以直接把FileConfig.localtion替换成D:/test
        String uuid = UUID.randomUUID().toString();
        String desPath = FileConfig.localtion + File.separator + uuid.replaceAll("-", "");
//        String desPath = "D:/test" + File.separator + uuid.replaceAll("-", "");
        //遗漏了这个代码,在本地测试环境不会出问题,在服务器上一定会报没有找到文件的错误
        String savePath = FileConfig.localtion + File.separator;
        FileUtil fileUtil = new FileUtil();
        //解压zip文件
        FileUtil.unZip(file, desPath,savePath);
        List<MultipartFile> fileList = new ArrayList<>();
        //获取图片文件
        fileList = fileUtil.getSubFiles(desPath+File.separator+namePath,fileList);
        for (MultipartFile multipartFile : fileList){
            if(multipartFile.getName().toLowerCase().endsWith(".png") || multipartFile.getName().toLowerCase().endsWith(".jpg")) {
                String newName = "upload/picture/" + UUID.randomUUID().toString().replaceAll("-", "") + multipartFile.getName().substring(multipartFile.getName().lastIndexOf("."));
                InputStream in = multipartFile.getInputStream();
                String[] split = newName.split("/");
                //创建头部信息
                Map<String, String> headers = new HashMap<>(1 << 2);
                //添加自定义内容类型
                headers.put("Content-Type", "application/octet-stream");
                //上传
                minioClient.putObject(
                    PutObjectArgs.builder().bucket(bucket).object(newName).stream(
                        in, in.available(), -1)
                        .headers(headers)
                        .build());
                String urls = "http://223.82.109.183:2081/zhba/" + newName;
                //取出身份证号,查询用户信息,更新用户信息
                String pictrueName = multipartFile.getName().substring(0, multipartFile.getName().lastIndexOf("."));
//                String regex ="([1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx])|([1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3})";
                String regex ="[\u4e00-\u9fa5]";
                Pattern compile = Pattern.compile(regex);
                String idCardNo = compile.matcher(pictrueName).replaceAll("");
                User user = userService.getUserInfoByIdCardNo(idCardNo);
                //设置用户头像url
                if (null!=user){
                    user.setAvatar(urls);
                    //更新用户信息
                    userService.updateById(user);
                    //内网数据推送
                    //数据推送
                    String s = "update blade_user set avatar = " + "'" + urls + "'" + "where id = " + "'" + user.getId() + "'";
                    FtpUtil.sqlFileUpload(s);
                    //文件推送
                    InputStream inputStream = multipartFile.getInputStream();
                    FtpUtil.uploadFile(ftpHost_dev, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream);
                    in.close();
                }
            }
        }
        //最后要删除文件
        FileUtil.clearFiles(desPath);
        //数据封装
        map.put("data", "上传成功!");
        //返回
        return R.data(map);
    }
    /**
     * 文件上传,自定义上传
     *
     * @param file 图片对象
@@ -387,7 +477,7 @@
     */
    private Long buildAttach(String fileName, Long fileSize, BladeFile bladeFile, String deptid, String type, Long noticeId, String cardid, InputStream in) throws Exception {
        //BladeUser user = AuthUtil.getUser();
        String fileExtension = FileUtil.getFileExtension(fileName);
        String fileExtension = org.springblade.core.tool.utils.FileUtil.getFileExtension(fileName);
        Attach attach = new Attach();
        attach.setDomain(bladeFile.getDomain());
        attach.setLink(bladeFile.getLink());
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -299,30 +299,39 @@
    <!--保安员列表树 安员列表树,帅选无保安证,下拉tree-->
    <select id="getSecurityApplyTree" resultType="org.springblade.modules.system.node.TreeNode">
        (select #{user.deptId} as id,
            '全部' as name,
            0 as parentId
            from blade_user)
        (
            select #{user.deptId} as id,
                '全部' as name,
                0 as parentId
                from blade_user
        )
        union all
        (select
            bu.id,
            bu.real_name as name,
            #{user.deptId} parentId
        from
            blade_user bu
        left join
        blade_dept bd
        on
        bu.dept_id = bd.id
        where
        bu.is_deleted = 0
        and
        bd.dept_category = 1
        and
        (hold = 2 or hold = 3)
        and bd.id = #{user.deptId}
        (
            select
                distinct
                bu.id,
                bu.real_name as name,
                #{user.deptId} parentId
            from
                blade_user bu
            left join
            blade_dept bd
            on
            bu.dept_id = bd.id
            where
            bu.is_deleted = 0
            and bu.status = 1
            and bd.dept_category = 1
            and (hold = 2 or hold = 3)
            and bd.id = #{user.deptId}
            <if test="user.examType==1">
                and bu.is_apply != 1
            </if>
            <if test="user.examType==2">
                and bu.is_train != 1
            </if>
        )
    </select>
src/main/java/org/springblade/modules/system/vo/UserVO.java
@@ -112,5 +112,10 @@
     */
    private Integer age;
    /**
     * 考试类型  1:正式考试   2:模拟考试
     */
    private Integer examType;
}
src/main/java/org/springblade/modules/training/controller/TrainingRegistrationController.java
@@ -457,11 +457,14 @@
    /**
     * 生成试卷,报名
     * @param ids 报名ids
     * @param startTime 考试开始时间
     * @param number 报名人数
     */
    @PostMapping("/batchExam")
    public R batchExam(@RequestParam String ids,
                       String examTime,
                       @RequestParam Date startTime,
                       @RequestParam Integer number,
                       Date endTime){
        if (!ids.equals("")){
            List<String> list = Arrays.asList(ids.split(","));
@@ -506,52 +509,56 @@
                    FtpUtil.sqlFileUpload(s1);
                });
            }
        }else {
            //查询已报名未关联试卷的人员
            List<Long> applyIds = trainingRegistrationService.getTrainIds();
            if (applyIds.size()>0){
                //生成考试
                ExamPaper examPaper = new ExamPaper();
            if (number==0){
                return R.data("报名人数不能小于1人");
            }else {
                //查询已报名的人员前 number 个
                //查询已报名未关联试卷的人员
                List<Long> applyIds = trainingRegistrationService.getTrainIds(number);
                if (applyIds.size()>0){
                    //生成考试
                    ExamPaper examPaper = new ExamPaper();
//                examPaper.setExamTime(examTime);
                examPaper.setExamType(2);
                examPaper.setStartTime(startTime);
                    examPaper.setExamType(2);
                    examPaper.setStartTime(startTime);
//                examPaper.setEndTime(endTime);
                Calendar instance = Calendar.getInstance();
                instance.setTime(startTime);
                int year = instance.get(Calendar.YEAR);
                int month = instance.get(Calendar.MONTH)+1;
                int day = instance.get(Calendar.DAY_OF_MONTH);
                String examName = year + "年" + month+ "月"+ day +"日" +"保安员证模拟考试";
                examPaper.setExamName(examName);
                //待审核
                examPaper.setAuditStatus(3);
                //生成考试
                examPaperService.save(examPaper);
                    Calendar instance = Calendar.getInstance();
                    instance.setTime(startTime);
                    int year = instance.get(Calendar.YEAR);
                    int month = instance.get(Calendar.MONTH)+1;
                    int day = instance.get(Calendar.DAY_OF_MONTH);
                    String examName = year + "年" + month+ "月"+ day +"日" +"保安员证模拟考试";
                    examPaper.setExamName(examName);
                    //待审核
                    examPaper.setAuditStatus(3);
                    //生成考试
                    examPaperService.save(examPaper);
                Long sid = examPaper.getId();
                String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examPaper.getStartTime());
                String s = "insert into ksxt_exam(id,exam_name,exam_type,start_time,audit_status) " +
                    "values(" + "'" + sid + "'" +
                    "," + "'" + examPaper.getExamName() + "'" +
                    "," + "'" + examPaper.getExamType() +"'" +
                    "," + "'" + format +"'" +
                    ","  +"'" + examPaper.getAuditStatus() + "'" + ")";
                FtpUtil.sqlFileUpload(s);
                    Long sid = examPaper.getId();
                    String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examPaper.getStartTime());
                    String s = "insert into ksxt_exam(id,exam_name,exam_type,start_time,audit_status) " +
                        "values(" + "'" + sid + "'" +
                        "," + "'" + examPaper.getExamName() + "'" +
                        "," + "'" + examPaper.getExamType() +"'" +
                        "," + "'" + format +"'" +
                        ","  +"'" + examPaper.getAuditStatus() + "'" + ")";
                    FtpUtil.sqlFileUpload(s);
                //修改报名信息
                applyIds.forEach(id ->{
                    TrainingRegistration trainingRegistration = new TrainingRegistration();
                    trainingRegistration.setId(id);
                    trainingRegistration.setTrainExamId(examPaper.getId().toString());
                    trainingRegistrationService.updateById(trainingRegistration);
                    //修改报名信息
                    applyIds.forEach(id ->{
                        TrainingRegistration trainingRegistration = new TrainingRegistration();
                        trainingRegistration.setId(id);
                        trainingRegistration.setTrainExamId(examPaper.getId().toString());
                        trainingRegistrationService.updateById(trainingRegistration);
                    String s1 =
                        "update sys_training_registration set train_exam_id = " + "'" + trainingRegistration.getTrainExamId()+ "'"
                            + " " +"where id = " + "'" + trainingRegistration.getId() + "'";
                    FtpUtil.sqlFileUpload(s1);
                });
                        String s1 =
                            "update sys_training_registration set train_exam_id = " + "'" + trainingRegistration.getTrainExamId()+ "'"
                                + " " +"where id = " + "'" + trainingRegistration.getId() + "'";
                        FtpUtil.sqlFileUpload(s1);
                    });
                }
            }
        }
        return null;
src/main/java/org/springblade/modules/training/mapper/TrainingRegistrationMapper.java
@@ -57,5 +57,5 @@
     * 查询已报名培训公司未关联考试的人员
     * @return
     */
    List<Long> getTrainIds();
    List<Long> getTrainIds(@Param("number") Integer number);
}
src/main/java/org/springblade/modules/training/mapper/TrainingRegistrationMapper.xml
@@ -50,7 +50,7 @@
            and bu.real_name like concat('%', #{trainingRegistration.realName},'%')
        </if>
        <if test="trainingRegistration.cancel!=null">
            and sr.cancel = #{trainingRegistration.cancel}
            and (sr.training_unit_id is null or ke.audit_status = 3)
        </if>
    </select>
@@ -154,11 +154,16 @@
        blade_user bu
        on
        str.user_id = bu.id
        left join
            ksxt_exam ke
        on
            ke.id = str.train_exam_id
        WHERE
        1=1
        and str.is_exam = 1
        and str.cancel = 1
        and bu.is_train = 1
        and str.train_exam_id is null
        and (str.train_exam_id is null or ke.audit_status = 3)
        limit 0,#{number}
    </select>
</mapper>
src/main/java/org/springblade/modules/training/service/TrainingRegistrationService.java
@@ -61,5 +61,5 @@
     * 查询已报名培训公司未关联考试的人员
     * @return
     */
    List<Long> getTrainIds();
    List<Long> getTrainIds(Integer number);
}
src/main/java/org/springblade/modules/training/service/impl/TrainingRegistrationServiceImpl.java
@@ -261,7 +261,7 @@
     * @return
     */
    @Override
    public List<Long> getTrainIds() {
        return baseMapper.getTrainIds();
    public List<Long> getTrainIds(Integer number) {
        return baseMapper.getTrainIds(number);
    }
}
src/main/resources/application-dev.yml
@@ -53,3 +53,9 @@
    upload-domain: http://localhost:8999
    remote-path: /usr/share/nginx/html
upload:
#  localtion: ${UPLOAD_DIR:/home/zhongsong/anbao}
  localtion: ${UPLOAD_DIR:D:/test}
  maxFileSize: 10240KB
  maxRequestSize: 102400KB