fei
23 小时以前 359f1d48b1d859a23cd35a425d2cffb1e9d1c811
修改了对应代码
14个文件已修改
450 ■■■■ 已修改文件
archiveManager/pom.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoSmall.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/mapper/DocumentMaterialsMapper.java 177 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/pom.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java 80 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/pom.xml 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
archiveManager/pom.xml
@@ -116,6 +116,8 @@
            <artifactId>spring-test</artifactId>
        </dependency>
    </dependencies>
</project>
archiveManager/src/main/java/com/ruoyi/domain/DocumentMaterials.java
@@ -27,11 +27,11 @@
    /** $column.columnComment */
    @TableId(type = IdType.AUTO)
    private Long materialId;
    @Excel(name = "文件材料序号", handler = NumberFormatHandler.class)
    @Excel(name = "文件材料序号", handler = NumberFormatHandler.class, headerColor = IndexedColors.BLACK)
    private Long fileNumber;
    @Excel(name = "文件编号")
    @Excel(name = "文件编号", headerColor = IndexedColors.BLACK)
    private String documentNumber;
@@ -58,9 +58,10 @@
    private Date date;
    /** $column.columnComment */
    @Excel(name = "页号", handler = NumberFormatHandler.class, headerColor = IndexedColors.BLACK)
   // @Excel(name = "页号", handler = NumberFormatHandler.class, headerColor = IndexedColors.BLACK)
    private Long pageNumber;
    @Excel(name = "页号", height = 10,width = 10,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
    private String pageNumberFormatted;
    /** $column.columnComment */
    @Excel(name = "页次", headerColor = IndexedColors.BLACK)
    private Long pageOrder;
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVo.java
@@ -26,9 +26,12 @@
    @Excel(name = "日期", width = 10, dateFormat = "yyyy-MM-dd", height = 10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private Date date;
    @Excel(name = "页号", height = 10,width = 10,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
    // 页号(原始数值,用于计算)
    private Long pageNumber;
    // 格式化后的页号,用于显示范围,如"38-38"或"23-38"
    @Excel(name = "页号", height = 10,width = 10,headerColor = IndexedColors.RED, headerBackgroundColor = IndexedColors.WHITE)
    private String pageNumberFormatted;
    @Excel(name = "备注", height = 20,width=10,headerColor = IndexedColors.BLACK, headerBackgroundColor = IndexedColors.WHITE)
    private String remarks;
@@ -42,3 +45,6 @@
//    @Excel(name = "图片", cellType = Excel.ColumnType.IMAGE)
//    private String url;
}
archiveManager/src/main/java/com/ruoyi/domain/vo/DocumentMaterialsVoSmall.java
@@ -27,18 +27,18 @@
    private Date date;
    @Excel(name = "页号",width = 10, headerFontSize=12, headerColor = IndexedColors.BLACK, headerFontBold = true)
    private String pageNumberFormatted;
    private Long pageNumber;
    @Excel(name = "备注",width = 8,  headerFontSize=12,headerColor = IndexedColors.BLACK, headerFontBold = true)
    private String remarks;
    public DocumentMaterialsVoSmall(Long num, String documentNumber, String creator, String title, Date date, Long pageNumber, String remarks) {
    public DocumentMaterialsVoSmall(Long num, String documentNumber, String creator, String title, Date date, String pageNumberFormatted, String remarks) {
        this.num = num;
        this.documentNumber = documentNumber;
        this.creator = creator;
        this.title = title;
        this.date = date;
        this.pageNumber = pageNumber;
       this.pageNumberFormatted = pageNumberFormatted;
        this.remarks = remarks;
    }
archiveManager/src/main/java/com/ruoyi/mapper/DocumentMaterialsMapper.java
@@ -1,86 +1,91 @@
package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.DocumentMaterials;
import com.ruoyi.domain.vo.DocumentMaterialFileStyle;
import com.ruoyi.domain.vo.DocumentMaterialsFileList;
import com.ruoyi.domain.vo.DocumentMaterialsVo;
import com.ruoyi.domain.vo.DocumentMaterialsVoLarge;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
 * 【文件材料综合信息】Mapper接口
 *
 * @author ruoyi
 * @date 2025-07-26
 */
@Mapper
public interface DocumentMaterialsMapper extends BaseMapper<DocumentMaterials> {
    @Select("update document_materials SET url = #{url},size_type=#{sizeType}, file_number=#{fileNumber},page_order=#{pageOrder},width=#{width},height=#{height},horizontal_resolution=#{horizontalResolution},vertical_resolution=#{verticalResolution},file_size=#{fileSize}, format=#{format} where page_number = #{pageNumber} and record_id=#{recordId}")
    Long updateInfoByPageNumber(@Param("pageNumber") Long pageNumber,@Param("sizeType") String sizeType, @Param("fileNumber") Long fileNumber,@Param("pageOrder") Long pageOrder,@Param("width") int width, @Param("height") int height,  @Param("horizontalResolution") int horizontalResolution, @Param("verticalResolution") int verticalResolution, @Param("fileSize") Double fileSize,@Param("url")  String url,@Param("format")  String format, @Param("recordId") Long recordId);
    //根据题名拿到最大的pageOrder
    @Select("select count(*) from document_materials where title=#{title} and page_number<#{pageNumber} and stage=#{stage} and record_id=#{recordId}")
    Long getMaxPageOrder(@Param("title")String title,@Param("pageNumber") Long pageNumber,@Param("stage") String stage, @Param("recordId") Long recordId);
    //计算文件的序号,title有可能重复
    @Select("select count(distinct(concat_ws(',', title, stage)))-1 from document_materials where  page_number<=#{pageNumber} and record_id=#{recordId}")
    Long getFileNumber(@Param("pageNumber") Long pageNumber, @Param("recordId") Long recordId);
    //查询卷内目录
    @Select(
            "select ROW_NUMBER() OVER (ORDER BY page_number) AS num, document_number, creator,title, date, page_number,dm.remarks, ar.record_id, publicity from document_materials as dm, archive_records as ar \n" +
            "            WHERE ar.id = dm.record_id and page_number  IN (\n" +
            "            SELECT MIN(page_number)\n" +
            "            FROM document_materials where record_id=#{recordId}\n" +
            "             GROUP BY stage, title) and ar.id =#{recordId} order by page_number ;")
    List<DocumentMaterialsVo> getArchiveMatInfo(@Param("recordId") int recordId);
    @Select(  "select ROW_NUMBER() OVER (ORDER BY page_number) AS num,ar.record_id, file_number, \n" +
            "            document_number, creator, title, date, page_number, page_order, \n" +
            "            stage, publicity, is_attachment, dm.retention_period, security_level, is_sensitive,\n" +
            "            is_canceled, format, size_type, horizontal_resolution, vertical_resolution, width,\n" +
            "            height, file_size, attachment_history_numbers,url, dm.remarks\n" +
            "            from document_materials as dm, archive_records as ar WHERE dm.record_id=ar.id \n" +
            "and dm.record_id=#{recordId} and file_style!='其它材料' ")
    List<DocumentMaterialsVoLarge> getDocumentMaterialsvoLarge(@Param("recordId") int recordId);
    @Select(  "select ROW_NUMBER() OVER (ORDER BY page_number) AS num,file_style, ar.record_id, ar.inquiry_number, ar.case_title, " +
            "            document_number, title, page_number, \n" +
            "            publicity, dm.retention_period, dm.remarks\n" +
            "            from document_materials as dm, archive_records as ar WHERE dm.record_id=ar.id \n" +
            "and dm.record_id=#{recordId} and file_style!='其它材料' ")
    List<DocumentMaterialsFileList> getDocumentMaterialsFileList(@Param("recordId") int recordId);
    @Select("select count(*) as cnt, file_style from document_materials " +
            "where record_id=#{recordId} GROUP BY file_style")
    List<DocumentMaterialFileStyle> getFileStyleInfo(@Param("recordId") int recordId);
    @Select("select if(count(*) < max(page_number), false, true) as res from document_materials where record_id=#{recordId}")
    boolean isPageNumberLegal(@Param("recordId") int recordId);
    //拿到除其它材料之外的全部数据的个数
    @Select("select count(*) FROM document_materials where file_style!='其他材料' and record_id=#{recordId}")
    int getCount(@Param("recordId") int recordId);
    //判断卷内目录是否全部上传了附件
    @Select("select if(num=total_count, true, false) as res from (\n" +
            "SELECT\n" +
            " ROW_NUMBER() OVER (ORDER BY page_number) AS num,  SUM(CASE WHEN dm.url IS NOT NULL THEN 1 ELSE 0 END) OVER() AS total_count\n" +
            " from document_materials as dm, archive_records as ar \n" +
            "         WHERE ar.id = dm.record_id and page_number  IN (SELECT MIN(page_number) \n" +
            "         FROM document_materials where record_id=#{recordId}\n" +
            "         GROUP BY stage, title) and ar.id =#{recordId} order by page_number desc limit 1) as res ")
    Boolean judgeArchiveInfo(   @Param("recordId") int recordId);
}
package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.DocumentMaterials;
import com.ruoyi.domain.vo.DocumentMaterialFileStyle;
import com.ruoyi.domain.vo.DocumentMaterialsFileList;
import com.ruoyi.domain.vo.DocumentMaterialsVo;
import com.ruoyi.domain.vo.DocumentMaterialsVoLarge;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
 * 【文件材料综合信息】Mapper接口
 *
 * @author ruoyi
 * @date 2025-07-26
 */
@Mapper
public interface DocumentMaterialsMapper extends BaseMapper<DocumentMaterials> {
    @Select("update document_materials SET url = #{url},size_type=#{sizeType}, file_number=#{fileNumber},page_order=#{pageOrder},width=#{width},height=#{height},horizontal_resolution=#{horizontalResolution},vertical_resolution=#{verticalResolution},file_size=#{fileSize}, format=#{format} where page_number = #{pageNumber} and record_id=#{recordId}")
    Long updateInfoByPageNumber(@Param("pageNumber") Long pageNumber,@Param("sizeType") String sizeType, @Param("fileNumber") Long fileNumber,@Param("pageOrder") Long pageOrder,@Param("width") int width, @Param("height") int height,  @Param("horizontalResolution") int horizontalResolution, @Param("verticalResolution") int verticalResolution, @Param("fileSize") Double fileSize,@Param("url")  String url,@Param("format")  String format, @Param("recordId") Long recordId);
    //根据题名拿到最大的pageOrder
    @Select("select count(*) from document_materials where title=#{title} and page_number<#{pageNumber} and stage=#{stage} and record_id=#{recordId}")
    Long getMaxPageOrder(@Param("title")String title,@Param("pageNumber") Long pageNumber,@Param("stage") String stage, @Param("recordId") Long recordId);
    //计算文件的序号,title有可能重复
    @Select("select count(distinct(concat_ws(',', title, stage)))-1 from document_materials where  page_number<=#{pageNumber} and record_id=#{recordId}")
    Long getFileNumber(@Param("pageNumber") Long pageNumber, @Param("recordId") Long recordId);
    //查询卷内目录
    @Select(
            "select ROW_NUMBER() OVER (ORDER BY page_number) AS num, document_number, creator,title, date, page_number,dm.remarks, ar.record_id, publicity from document_materials as dm, archive_records as ar \n" +
            "            WHERE ar.id = dm.record_id and page_number  IN (\n" +
            "            SELECT MIN(page_number)\n" +
            "            FROM document_materials where record_id=#{recordId}\n" +
            "             GROUP BY stage, title) and ar.id =#{recordId} order by page_number ;")
    List<DocumentMaterialsVo> getArchiveMatInfo(@Param("recordId") int recordId);
    @Select(  "select ROW_NUMBER() OVER (ORDER BY page_number) AS num,ar.record_id, file_number, \n" +
            "            document_number, creator, title, date, page_number, page_order, \n" +
            "            stage, publicity, is_attachment, dm.retention_period, security_level, is_sensitive,\n" +
            "            is_canceled, format, size_type, horizontal_resolution, vertical_resolution, width,\n" +
            "            height, file_size, attachment_history_numbers,url, dm.remarks\n" +
            "            from document_materials as dm, archive_records as ar WHERE dm.record_id=ar.id \n" +
            "and dm.record_id=#{recordId} and file_style!='其它材料' ")
    List<DocumentMaterialsVoLarge> getDocumentMaterialsvoLarge(@Param("recordId") int recordId);
    @Select(  "select ROW_NUMBER() OVER (ORDER BY page_number) AS num,file_style, ar.record_id, ar.inquiry_number, ar.case_title, " +
            "            document_number, title, page_number, \n" +
            "            publicity, dm.retention_period, dm.remarks\n" +
            "            from document_materials as dm, archive_records as ar WHERE dm.record_id=ar.id \n" +
            "and dm.record_id=#{recordId} and file_style!='其它材料' ")
    List<DocumentMaterialsFileList> getDocumentMaterialsFileList(@Param("recordId") int recordId);
    @Select("select count(*) as cnt, file_style from document_materials " +
            "where record_id=#{recordId} GROUP BY file_style")
    List<DocumentMaterialFileStyle> getFileStyleInfo(@Param("recordId") int recordId);
    @Select("select if(count(*) < max(page_number), false, true) as res from document_materials where record_id=#{recordId}")
    boolean isPageNumberLegal(@Param("recordId") int recordId);
    //拿到除其它材料之外的全部数据的个数
    @Select("select count(*) FROM document_materials where file_style!='其他材料' and record_id=#{recordId}")
    int getCount(@Param("recordId") int recordId);
    //获取指定案卷的最大页号
    @Select("select max(page_number) FROM document_materials where record_id=#{recordId}")
    Long getMaxPageNumber(@Param("recordId") int recordId);
    //判断卷内目录是否全部上传了附件
    @Select("select if(num=total_count, true, false) as res from (\n" +
            "SELECT\n" +
            " ROW_NUMBER() OVER (ORDER BY page_number) AS num,  SUM(CASE WHEN dm.url IS NOT NULL THEN 1 ELSE 0 END) OVER() AS total_count\n" +
            " from document_materials as dm, archive_records as ar \n" +
            "         WHERE ar.id = dm.record_id and page_number  IN (SELECT MIN(page_number) \n" +
            "         FROM document_materials where record_id=#{recordId}\n" +
            "         GROUP BY stage, title) and ar.id =#{recordId} order by page_number desc limit 1) as res ")
    Boolean judgeArchiveInfo(   @Param("recordId") int recordId);
}
archiveManager/src/main/java/com/ruoyi/service/IArchiveRecordsService.java
@@ -97,6 +97,8 @@
    public int updateStatusByIds(Long [] ids);
    public List<ArchiveRecordSmall> findByIds(ArchiveRecords archiveRecords);
    AjaxResult mySave(ArchiveRecords archiveRecords);
    boolean whether(@Param("recordId") Long recordId);
archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java
@@ -15,13 +15,13 @@
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.ArchiveRecords;
import com.ruoyi.domain.Archiverecordstouser;
import com.ruoyi.domain.vo.AnalysisResult;
import com.ruoyi.domain.vo.ArchiveInfoVo;
import com.ruoyi.domain.vo.ArchiveRecordSmall;
import com.ruoyi.mapper.ArchiveRecordsMapper;
import com.ruoyi.mapper.ArchiverecordstouserMapper;
import com.ruoyi.service.IArchiveRecordsService;
import com.ruoyi.service.IArchiverecordstouserService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -41,6 +41,9 @@
//    @Autowired
//    private ArchiveRecordsMapper archiveRecordsMapper;
    @Autowired
    private IArchiverecordstouserService archiverecordstouserService;
    @Autowired
    private ArchiverecordstouserMapper archiverecordstouserMapper;
@@ -373,6 +376,11 @@
    @Override
    public int updateArchiveById(String status, Long id) {
        // 获取当前用户ID
        Long userId = SecurityUtils.getUserId();
        // 可以在这里使用userId进行授权操作
        archiverecordstouserService.deleteArchiverecordstouserByRecordId(id, userId);
        this.baseMapper.updateStatusById(status, id);
        return 0;
    }
@@ -394,10 +402,9 @@
    }
    @Override
    public AjaxResult mySave(ArchiveRecords archiveRecords) {
        //检查是否有重复数据插入
        // 检查是否有重复数据插入
        LambdaQueryWrapper<ArchiveRecords> lqw = new LambdaQueryWrapper<>();
        lqw.eq(!StringUtils.isEmpty(archiveRecords.getRecordId()), ArchiveRecords::getRecordId,archiveRecords.getRecordId());
        List<ArchiveRecords> list = list(lqw);
@@ -430,3 +437,4 @@
        return this.baseMapper.whether(recordId);
    }
}
archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java
@@ -129,8 +129,9 @@
    @Override
    public int insertDocumentMaterials(DocumentMaterials documentMaterials) {
        LocalDateTime time = LocalDateTime.now();
        Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant());
        documentMaterials.setCreatedAt(date);
        System.out.println(documentMaterials.getFileStyle());
@@ -142,7 +143,6 @@
        boolean res = false;
        try {
             res = this.save(documentMaterials);
        } catch (Exception e) {
            System.out.println(e);
            throw new ErrorcodeExceptionextends(500, "同一个案卷内,不允许页码重复!");
@@ -265,7 +265,32 @@
    @Override
    public List<DocumentMaterialsVo> findArchMInfo(String recordId) {
        return this.baseMapper.getArchiveMatInfo(Integer.parseInt(recordId));
        // 获取原始数据列表
        List<DocumentMaterialsVo> dataList = this.baseMapper.getArchiveMatInfo(Integer.parseInt(recordId));
        // 获取该案卷的最大页号(总页数)
        Long totalPages = this.baseMapper.getMaxPageNumber(Integer.parseInt(recordId));
        // 如果数据列表不为空
        if (dataList != null && !dataList.isEmpty() && totalPages != null) {
            int size = dataList.size();
            // 遍历所有条目,设置pageNumberFormatted
            for (int i = 0; i < size; i++) {
                DocumentMaterialsVo item = dataList.get(i);
                Long pageNumber = item.getPageNumber();
                if (i == size - 1) {
                    // 最后一行:格式化页号为"最后一页页号-总页数"的形式
                    item.setPageNumberFormatted(pageNumber + "-" + totalPages);
                } else {
                    // 其他行:直接使用pageNumber的值
                    item.setPageNumberFormatted(pageNumber != null ? pageNumber.toString() : "");
                }
            }
        }
        return dataList;
    }
    @Override
@@ -291,6 +316,32 @@
            BeanUtils.copyProperties(archiveCategory, documentMaterials);
            documentMaterials.setRecordId(Long.parseLong(recordId));
            documentMaterials.setVisible(1);
               // 验证必填字段
        if (StringUtils.isEmpty(documentMaterials.getTitle())) {
            throw new ErrorcodeExceptionextends(400, "文件题名不能为空");
        }
        if (StringUtils.isEmpty(documentMaterials.getFileStyle())) {
            throw new ErrorcodeExceptionextends(400, "材料类型不能为空");
        }
        // 材料类型不是"其它材料"时,页号必须输入
        if (!"其他材料".equals(documentMaterials.getFileStyle()) && documentMaterials.getPageNumber() == null) {
            throw new ErrorcodeExceptionextends(400, "当前材料类型非其它材料,页号必须输入");
        }
        if (StringUtils.isEmpty(documentMaterials.getIsAttachment())) {
            throw new ErrorcodeExceptionextends(400, "是否为附件不能为空");
        }
        if (StringUtils.isEmpty(documentMaterials.getStage())) {
            throw new ErrorcodeExceptionextends(400, "所处阶段不能为空");
        }
        if (StringUtils.isEmpty(documentMaterials.getRetentionPeriod())) {
            throw new ErrorcodeExceptionextends(400, "保管期限不能为空");
        }
        if (StringUtils.isEmpty(documentMaterials.getIsSensitive())) {
            throw new ErrorcodeExceptionextends(400, "是否敏感不能为空");
        }
        if (StringUtils.isEmpty(documentMaterials.getIsCanceled())) {
            throw new ErrorcodeExceptionextends(400, "是否注销不能为空");
        }
            this.insertDocumentMaterials(documentMaterials);
        }
@@ -431,3 +482,5 @@
}
ruoyi-admin/pom.xml
@@ -139,11 +139,15 @@
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.5.15</version>
                <configuration>
                    <includeSystemScope>true</includeSystemScope>
                    <mainClass>com.ruoyi.RuoYiApplication</mainClass>
                    <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
                </configuration>
                <executions>
@@ -169,9 +173,16 @@
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
<!--                    <compilerArgs>-->
<!--                        <arg>-XDignore.symbol.file</arg>-->
<!--                    </compilerArgs>-->
<!--                    <fork>true</fork>-->
                </configuration>
            </plugin>
        </plugins>
        <finalName>${project.artifactId}</finalName>
    </build>
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/ArchiveRecordsController.java
@@ -14,7 +14,6 @@
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.poi.ExcelExp;
import com.ruoyi.common.utils.poi.ExcelUtilManySheetFour;
import com.ruoyi.common.utils.poi.ExcelUtilManySheetSecond;
import com.ruoyi.domain.ArchiveRecords;
import com.ruoyi.domain.DocumentMaterials;
import com.ruoyi.domain.vo.*;
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java
@@ -25,17 +25,20 @@
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.poi.ExcelExp;
import com.ruoyi.common.utils.poi.ExcelUtilManySheet;
import com.ruoyi.common.utils.poi.ExcelUtilManySheetSecond;
import com.ruoyi.domain.ArchiveCategory;
import com.ruoyi.domain.ArchiveProjectName;
import com.ruoyi.domain.ArchiveRecords;
import com.ruoyi.domain.DocumentMaterials;
import com.ruoyi.domain.vo.*;
import com.ruoyi.framework.config.ServerConfig;
import com.ruoyi.framework.web.domain.server.Sys;
import com.ruoyi.service.IArchiveProjectNameService;
import com.ruoyi.service.IArchiveRecordsService;
import com.ruoyi.service.IDocumentMaterialsService;
import com.ruoyi.service.impl.BarcodeService;
@@ -72,6 +75,8 @@
@RequestMapping("/system/materials")
public class DocumentMaterialsController extends BaseController
{
    @Autowired
    private IArchiveProjectNameService iArchiveProjectNameService;
    @Autowired
    private BarcodeService barcodeService;
    @Autowired
@@ -452,6 +457,23 @@
    {
        //09-备考表.pdf
        String pdf09Path = "09-备考表.pdf";
        //根据项目名称拿到公司名称和项目负责人
        String compName = "广州盈家档案管理有限公司";
        String li_person = "仇翀";
        String sh_person = "曾瑞莹";
        ArchiveRecords archiveRecords = iArchiveRecordsService.selectArchiveRecordsById(id);
        ArchiveProjectName tmp = new ArchiveProjectName();
        tmp.setName(archiveRecords.getProjectName());
        List<ArchiveProjectName> projectName = iArchiveProjectNameService.selectArchiveProjectNameList(tmp);
        if(!projectName.isEmpty())
        {
            if(StringUtils.isEmpty(projectName.get(0).getCompanyName()))
                compName = projectName.get(0).getCompanyName();
            if(StringUtils.isEmpty(projectName.get(0).getCreatePerson()))
                li_person = projectName.get(0).getCreatePerson();
        }
        //  pdfGenerateService.generateFileStyleInfo(pdf09Path, aIV.getRecordId(), id);
        //拿到相关数据
        List<DocumentMaterialFileStyle> dmfs = documentMaterialsService.findFileStyleInfo(Math.toIntExact(id));
@@ -484,6 +506,7 @@
        hs.put("picPages", picPages);
        hs.put("texPages", texPages);
        hs.put("volumeNumber", recordId);
        hs.put("company", compName);
        hs.put("time", cdt);
        if (!getLicense()) {
@@ -494,9 +517,21 @@
        try {
            // 获取 Word 模板所在路径
            String filepath = "09-备考表.docx";
//            String filepath = "09-备考表.docx";
//            // 通过 XWPFTemplate 编译文件并渲染数据到模板中
//            XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
//            );
            // 获取 Word 模板所在路径
            ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
            org.springframework.core.io.Resource resource = resolver.getResource("classpath:09.docx");
//                String filepath = resource.getFile().getAbsolutePath();
//                // 通过 XWPFTemplate 编译文件并渲染数据到模板中
//                XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
//                       );
            InputStream inputStream = resource.getInputStream();
            // 通过 XWPFTemplate 编译文件并渲染数据到模板中
            XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
            XWPFTemplate template = XWPFTemplate.compile(inputStream).render(hs
            );
            String renderedDocPath = "rendered_output.docx";
@@ -530,7 +565,7 @@
        //拿到卷内目录的excel
        List<DocumentMaterialsVoSmall> list2 = dsvs.stream().map(res1 -> new DocumentMaterialsVoSmall(res1.getNum(), res1.getDocumentNumber(),res1.getCreator(),
                res1.getTitle(), res1.getDate(), res1.getPageNumber(), res1.getRemarks())).collect(Collectors.toList());
                res1.getTitle(), res1.getDate(), res1.getPageNumberFormatted(), res1.getRemarks())).collect(Collectors.toList());
        if(!dsvs.isEmpty()) {
            String recordId = dsvs.get(0).getRecordId();
            byte[] imgr = barcodeService.generateBarcodeImage(recordId);
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java
@@ -6,11 +6,14 @@
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.PdfPCell;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.poi.*;
import com.ruoyi.domain.ArchiveProjectName;
import com.ruoyi.domain.ArchiveRecords;
import com.ruoyi.domain.DocumentMaterials;
import com.ruoyi.domain.vo.*;
import com.ruoyi.service.IArchiveProjectNameService;
import com.ruoyi.service.IArchiveRecordsService;
import com.ruoyi.service.IDocumentMaterialsService;
import com.ruoyi.service.impl.BarcodeService;
@@ -53,7 +56,8 @@
    private BarcodeService barcodeService;
    @Autowired
    private IDocumentMaterialsService documentMaterialsService;
    @Autowired
    private IArchiveProjectNameService iArchiveProjectNameService;
    @Autowired
    private IArchiveRecordsService iArchiveRecordsService;
@@ -569,12 +573,30 @@
                            picPages = documentMaterialFileStyle.getCnt();
                    }
                }
                String compName = "广州盈家档案管理有限公司";
                String li_person = "仇翀";
                String sh_person = "曾瑞莹";
                ArchiveRecords archiveRecords1 = iArchiveRecordsService.selectArchiveRecordsById(ids[i]);
                ArchiveProjectName tmp = new ArchiveProjectName();
                tmp.setName(archiveRecords1.getProjectName());
                List<ArchiveProjectName> projectName = iArchiveProjectNameService.selectArchiveProjectNameList(tmp);
                if(!projectName.isEmpty())
                {
                    if(StringUtils.isEmpty(projectName.get(0).getCompanyName()))
                        compName = projectName.get(0).getCompanyName();
                    if(StringUtils.isEmpty(projectName.get(0).getCreatePerson()))
                        li_person = projectName.get(0).getCreatePerson();
                }
                allPages = texPages + picPages + patPages;
                hs.put("pages", allPages);
                hs.put("patPages", patPages);
                hs.put("picPages", picPages);
                hs.put("texPages", texPages);
                hs.put("volumeNumber", aIV.getRecordId());
                hs.put("company", compName);
                hs.put("time", cdt);
                if (!getLicense()) {
@@ -584,10 +606,16 @@
                try {
                    // 获取 Word 模板所在路径
                    String filepath = "09-备考表.docx";
                    ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
                    org.springframework.core.io.Resource resource = resolver.getResource("classpath:09.docx");
//                String filepath = resource.getFile().getAbsolutePath();
//                // 通过 XWPFTemplate 编译文件并渲染数据到模板中
//                XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
//                       );
                    InputStream inputStream = resource.getInputStream();
                    // 通过 XWPFTemplate 编译文件并渲染数据到模板中
                    XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
                    XWPFTemplate template = XWPFTemplate.compile(inputStream).render(hs
                    );
                    String renderedDocPath = "rendered_output.docx";
@@ -726,7 +754,7 @@
                //拿到卷内目录的excel
                List<DocumentMaterialsVoSmall> list2 = dsvs.stream().map(res1 -> new DocumentMaterialsVoSmall(res1.getNum(), res1.getDocumentNumber(),res1.getCreator(),
                        res1.getTitle(), res1.getDate(), res1.getPageNumber(), res1.getRemarks())).collect(Collectors.toList());
                        res1.getTitle(), res1.getDate(), res1.getPageNumberFormatted(), res1.getRemarks())).collect(Collectors.toList());
                if(!dsvs.isEmpty()) {
                    String recordId = dsvs.get(0).getRecordId();
                    byte[] imgr = barcodeService.generateBarcodeImage(recordId);
@@ -1097,12 +1125,30 @@
                        picPages = documentMaterialFileStyle.getCnt();
                }
            }
            String compName = "广州盈家档案管理有限公司";
            String li_person = "仇翀";
            String sh_person = "曾瑞莹";
            ArchiveRecords archiveRecords = iArchiveRecordsService.selectArchiveRecordsById(id);
            ArchiveProjectName tmp = new ArchiveProjectName();
            tmp.setName(archiveRecords.getProjectName());
            List<ArchiveProjectName> projectName = iArchiveProjectNameService.selectArchiveProjectNameList(tmp);
            if(!projectName.isEmpty())
            {
                if(StringUtils.isEmpty(projectName.get(0).getCompanyName()))
                    compName = projectName.get(0).getCompanyName();
                if(StringUtils.isEmpty(projectName.get(0).getCreatePerson()))
                    li_person = projectName.get(0).getCreatePerson();
            }
            allPages = texPages + picPages + patPages;
            hs.put("pages", allPages);
            hs.put("patPages", patPages);
            hs.put("picPages", picPages);
            hs.put("texPages", texPages);
            hs.put("volumeNumber", aIV.getRecordId());
            hs.put("company", compName);
            hs.put("time", cdt);
            if (!getLicense()) {
@@ -1113,10 +1159,22 @@
            try {
                // 获取 Word 模板所在路径
                String filepath = "09-备考表.docx";
                // 通过 XWPFTemplate 编译文件并渲染数据到模板中
                XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
                       );
                ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
                org.springframework.core.io.Resource resource = resolver.getResource("classpath:09.docx");
//                String filepath = resource.getFile().getAbsolutePath();
//                // 通过 XWPFTemplate 编译文件并渲染数据到模板中
//                XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
//                       );
                InputStream inputStream = resource.getInputStream();
                    // 通过 XWPFTemplate 编译文件并渲染数据到模板中
                    XWPFTemplate template = XWPFTemplate.compile(inputStream).render(hs
                    );
                String renderedDocPath = "rendered_output.docx";
                File renderedFile = new File(renderedDocPath);
@@ -1148,7 +1206,7 @@
            com.aspose.words.Document doc = new com.aspose.words.Document("09-备考表.docx");
           // com.aspose.words.Document doc = new com.aspose.words.Document("09.docx");
@@ -1271,7 +1329,7 @@
            //拿到卷内目录的excel
            List<DocumentMaterialsVoSmall> list2 = dsvs.stream().map(res -> new DocumentMaterialsVoSmall(res.getNum(), res.getDocumentNumber(),res.getCreator(),
                    res.getTitle(), res.getDate(), res.getPageNumber(), res.getRemarks())).collect(Collectors.toList());
                    res.getTitle(), res.getDate(), res.getPageNumberFormatted(), res.getRemarks())).collect(Collectors.toList());
            String recordId = dsvs.get(0).getRecordId();
            byte[] imgr = barcodeService.generateBarcodeImage(recordId);
ruoyi-common/pom.xml
@@ -69,7 +69,7 @@
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <!-- JSON工具类 -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
@@ -147,10 +147,40 @@
            <version>5.5.13</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.messaging.saaj</groupId>
            <artifactId>saaj-impl</artifactId>
            <version>3.0.2</version>
        </dependency>
        <!-- 也可以同时添加这个 -->
        <dependency>
            <groupId>javax.xml.soap</groupId>
            <artifactId>javax.xml.soap-api</artifactId>
            <version>1.4.0</version>
        </dependency>
    </dependencies>
<!--    <build>-->
<!--        <plugins>-->
<!--            <plugin>-->
<!--                <groupId>org.apache.maven.plugins</groupId>-->
<!--                <artifactId>maven-compiler-plugin</artifactId>-->
<!--                <version>3.1</version>-->
<!--                <configuration>-->
<!--                    <source>1.8</source>-->
<!--                    <target>1.8</target>-->
<!--                    <encoding>UTF-8</encoding>-->
<!--                    <compilerArgs>-->
<!--                        <arg>-XDignore.symbol.file</arg>-->
<!--                    </compilerArgs>-->
<!--                    <fork>true</fork>-->
<!--                </configuration>-->
<!--            </plugin>-->
<!--        </plugins>-->
<!--    </build>-->
<!--    <build>-->
<!--        <plugins>-->
<!--        <plugin>-->
<!--        <groupId>org.apache.maven.plugins</groupId>-->
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtilManySheet.java
@@ -541,7 +541,7 @@
                style.setWrapText(true);
                Font headerFont = wb.createFont();
                headerFont.setFontName(excel.headerFontName());
                headerFont.setFontHeightInPoints((short) 12);
                headerFont.setFontHeightInPoints((short) 10);
                headerFont.setBold(excel.headerFontBold());
                headerFont.setColor(excel.headerColor().index);
                style.setFont(headerFont);
@@ -1026,4 +1026,4 @@
        }
        return val;
    }
}
}