Bladeren bron

Merge branch 'dev' of http://219.151.181.73:3000/zhuwei/bladex into dev

lvy 4 dagen geleden
bovenliggende
commit
6a7e86a087

+ 2 - 2
blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/TaskSplitMapper.xml

@@ -40,11 +40,11 @@
     </select>
 
     <update id="updateArchiveByContratId" >
-        update u_archives_auto set split_status = 0 where contract_id = #{contractId} and is_deleted = 0
+        update u_archives_auto set split_status = 2 where contract_id = #{contractId} and is_deleted = 0
     </update>
 
     <update id="updateArchiveByIds">
-        update u_archives_auto set split_status = 0 where is_deleted = 0 and id in
+        update u_archives_auto set split_status = 2 where is_deleted = 0 and id in
         <foreach item="item" collection="split" separator="," close=")" open="(" index="index">
             #{item}
         </foreach>

+ 15 - 2
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/Archive2Controller.java

@@ -64,7 +64,7 @@ public class Archive2Controller {
         //执行代码
         log.info("分解pdf专图片");
        // String sql = "SELECT distinct b.id,b.archive_id as archiveId ,REPLACE(b.file_url,'https://xinan1.zos.ctyun.cn','http://100.86.2.1:80') as fileUrl from u_archives_auto a ,u_archive_file b  where a.id=b.archive_id  and a.is_deleted=0 and b.is_deleted=0 and a.split_status=10 LIMIT 20";
-        String sql = "SELECT distinct b.id,b.archive_id as archiveId ,b.file_url as fileUrl from u_archives_auto a ,u_archive_file b  where a.id=b.archive_id  and a.is_deleted=0 and b.is_deleted=0 and a.split_status=10 LIMIT 20";
+        String sql = "SELECT distinct b.id,b.archive_id as archiveId ,b.file_url  as fileUrl from u_archives_auto a ,u_archive_file b  where a.id=b.archive_id  and a.is_deleted=0 and b.is_deleted=0 and a.split_status=2 LIMIT 20";
         List<TaskArchiveSplitVO> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TaskArchiveSplitVO.class));
 
         if (query != null && query.size() >= 1) {
@@ -339,7 +339,7 @@ public class Archive2Controller {
 
     public static int getPdfByPage(int startPage, int endPage, String filePath, String savePath) {
         try {
-            InputStream inputStreamByUrl = CommonUtil.getOSSInputStream3(filePath);
+            InputStream inputStreamByUrl = CommonUtil.getOSSInputStream(filePath);
             // 加载PDF文件
             PDDocument document = PDDocument.load(inputStreamByUrl);
             // 创建新文档
@@ -430,4 +430,17 @@ public class Archive2Controller {
         fmfile.delete();
         return 200;
     }
+
+/*    public static void main(String[] args) {
+        // 获取pdf第二页的数据
+        String fileUrl = "/Users/hongchuangyanfa/Desktop/archiveSplit/PDF合并.pdf";
+        String firstUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/" + 123 + "first__" + 1 + "__.pdf";
+        int pdfByPage = getPdfByPage(0, 1, fileUrl, firstUrl);
+        File file = new File(firstUrl);
+
+        // 保存第一页为300DPI图片
+        String imagePath = FileUtils.getSysLocalFileUrl() + "archiveSplit/" + 123 + "first__" + 1 + "__.png";
+        File imgfile = new File(imagePath);
+        int dataNum = savePdfAsImage(1, fileUrl, imagePath);
+    }*/
 }

+ 0 - 497
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/ArchiveController.java

@@ -1,497 +0,0 @@
-package org.springblade.evisa.controller;
-
-import io.swagger.annotations.Api;
-import lombok.AllArgsConstructor;
-import lombok.Synchronized;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.pdfbox.pdmodel.PDDocument;
-import org.apache.pdfbox.pdmodel.PDPage;
-import org.jsoup.Jsoup;
-import org.jsoup.nodes.Document;
-import org.jsoup.nodes.Element;
-import org.jsoup.select.Elements;
-import org.springblade.common.utils.CommonUtil;
-import org.springblade.common.utils.SafeURLEncoder;
-import org.springblade.common.utils.SnowFlakeUtil;
-import org.springblade.core.oss.model.BladeFile;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.IoUtil;
-import org.springblade.evisa.utils.FileUtils;
-import org.springblade.evisa.vo.ArchivesSplitInfoVO;
-import org.springblade.evisa.vo.TaskArchiveSplitVO;
-import org.springblade.resource.feign.NewIOSSClient;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.StringRedisTemplate;
-import org.springframework.jdbc.core.BeanPropertyRowMapper;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.pdfbox.rendering.PDFRenderer;
-
-import java.awt.image.BufferedImage;
-import javax.imageio.ImageIO;
-
-
-/**
- * 清表基础数据表 控制器
- *
- * @author BladeX
- * @since 2022-05-18
- */
-@RestController
-@AllArgsConstructor
-@Api(value = "电签类", tags = "电签类接口")
-@Slf4j
-public class ArchiveController {
-
-    private final StringRedisTemplate RedisTemplate;
-
-    private final JdbcTemplate jdbcTemplate;
-
-    private final NewIOSSClient newIOSSClient;
-
-    // 线程池
-    @Resource(name = "archivePoolExecutor")
-    private ThreadPoolExecutor archExecutor;
-
-   // @Scheduled(cron = "0/30 * * * * ?")
-    public void SignTaskBatchPng() {
-        //执行代码
-        log.info("分解pdf专图片");
-       // String sql = "SELECT distinct b.id,b.archive_id as archiveId ,REPLACE(b.file_url,'https://xinan1.zos.ctyun.cn','http://100.86.2.1:80') as fileUrl,c.id as taskId from u_archives_auto a , u_archive_file b ,u_task_split c  where a.id=b.archive_id and ((FIND_IN_SET(a.id,c.ids) and c.type=3) or (a.contract_id=c.contract_id and c.type=2)) and a.is_deleted=0 and b.is_deleted=0 and a.split_status not in(1,2) LIMIT 20";
-        String sql = "SELECT distinct b.id,b.archive_id as archiveId ,b.file_url as fileUrl,c.id as taskId from u_archives_auto a , u_archive_file b ,u_task_split c  where a.id=b.archive_id and ((FIND_IN_SET(a.id,c.ids) and c.type=3) or (a.contract_id=c.contract_id and c.type=2)) and a.is_deleted=0 and b.is_deleted=0 and a.split_status not in(1,2) LIMIT 20";
-        List<TaskArchiveSplitVO> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TaskArchiveSplitVO.class));
-
-        if (query != null && query.size() >= 1) {
-            for (TaskArchiveSplitVO dataInfo : query) {
-                if (archExecutor.getQueue().size() <= 20) {
-                    Boolean aBoolean = RedisTemplate.hasKey("splitpng-" + dataInfo.getArchiveId());
-                    if (!aBoolean) {
-                        RedisTemplate.opsForValue().setIfAbsent("splitpng-" + dataInfo.getArchiveId(), "1", 600, TimeUnit.SECONDS);
-                        CompletableFuture<Void> runAsync = CompletableFuture.runAsync(() -> {
-                            try {
-                                signTaskBatchpngToHtml(dataInfo);
-                            } catch (Exception e) {
-                                e.printStackTrace();
-                            }
-                        }, archExecutor);
-                    }
-                }
-            }
-        }
-        System.out.println("队列数量_img" + archExecutor.getQueue().size());
-        System.out.println("活跃数量_img" + archExecutor.getActiveCount());
-        System.out.println("总共数量_img" + archExecutor.getTaskCount());
-        System.out.println("完成数量_img" + archExecutor.getCompletedTaskCount());
-    }
-
-    // 分解第一页的任务
-
-    public void signTaskBatchpngToHtml(TaskArchiveSplitVO taskSign) {
-        try {
-            String fileUrl = taskSign.getFileUrl();
-            String archiveId = taskSign.getArchiveId();
-            String id = taskSign.getId();
-            String taskId = taskSign.getTaskId();
-            List<String> listPdf = new ArrayList<>();
-            int startPage = 0;
-            for (int i = 2; i <= 10; i++) {
-                // 获取pdf第二页的数据
-                String firstUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/" + archiveId + "first__" + i + "__.pdf";
-                File file = new File(firstUrl);
-                if (!file.exists()) {
-                    int pdfByPage = getPdfByPage(i, i, fileUrl, firstUrl);
-                    if(pdfByPage==1){
-                        String sql22 = "INSERT INTO u_archives_split_info(id,status,file_url,first_file_url,task_id,archive_id,create_time) VALUES(?,?,?,?,?,?,SYSDATE())";
-                        int addCount = jdbcTemplate.update(sql22, id, 4, fileUrl, "获取数据源失败", taskId, archiveId);
-                        String updateSql = "UPDATE u_archives_auto SET split_status=? WHERE id=?";
-                        int delCount = jdbcTemplate.update(updateSql, 1, archiveId);
-                        return;
-                    }
-                }
-
-                // 保存第一页为300DPI图片
-                String imagePath = FileUtils.getSysLocalFileUrl() + "archiveSplit/" + archiveId + "first__" + i + "__.png";
-                File imgfile = new File(imagePath);
-                if (!imgfile.exists()) {
-                    int dataNum = savePdfAsImage(1, firstUrl, imagePath);
-                }
-                // 删除pdf
-                file.delete();
-                String state = OcrTitle(imagePath, "1");
-                if (state.equals("1")) {
-                    if (startPage < 2) {
-                        startPage = i;
-                    }
-                    listPdf.add(imagePath);
-                } else {
-                    imgfile.delete();
-                    break;
-                }
-            }
-            System.out.println(listPdf.size());
-            String filePath = startPage + "--" + (listPdf.size() + 1);
-            //判断
-            List<Map<String, Object>> mapList = jdbcTemplate.queryForList("select * from u_archives_split_info where id=" + id + "");
-            if (mapList != null && Func.isNotEmpty(mapList) && mapList.size() >= 1) {
-                String status = mapList.get(0).get("status") + "";
-               // if (status.equals("3")) {
-                    String updateSql = "update u_archives_split_info set status=2 ,file_url='"+fileUrl+"',first_file_url ='"+filePath+"' where id=" + id;
-                    jdbcTemplate.update(updateSql);
-                String uateSql = "UPDATE u_archives_auto SET split_status=? WHERE id=?";
-                int delCount = jdbcTemplate.update(uateSql, 2, archiveId);
-              //  }
-
-            } else {
-                // 所有SQL都改为参数化查询
-                String sql22 = "INSERT INTO u_archives_split_info(id,status,file_url,first_file_url,task_id,archive_id,create_time) VALUES(?,?,?,?,?,?,SYSDATE())";
-                int addCount = jdbcTemplate.update(sql22, id, 2, fileUrl, filePath, taskId, archiveId);
-
-                String updateSql = "UPDATE u_archives_auto SET split_status=? WHERE id=?";
-                int delCount = jdbcTemplate.update(updateSql, 2, archiveId);
-            }
-            String delSql = "DELETE FROM u_archive_file WHERE id<>? AND archive_id=?";
-            jdbcTemplate.update(delSql, id, archiveId);
-            RedisTemplate.delete("splitpng-" + archiveId);
-
-        } catch (Exception e) {
-            System.out.println("12321312");
-            e.printStackTrace();
-        }
-    }
-  //  @Scheduled(cron = "0/30 * * * * ?")
-    public void SplitPdfInfo() {
-        //执行代码
-        log.info("分解html开始");
-        String sql = "select  * from u_archives_split_info where status =2 LIMIT 20 "; // and TIMESTAMPDIFF(MINUTE, create_time, NOW()) >=3";
-        List<ArchivesSplitInfoVO> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ArchivesSplitInfoVO.class));
-        log.info("分解html开始===" + query.size());
-        if (query != null && query.size() >= 1) {
-            for (ArchivesSplitInfoVO dataInfo : query) {
-                if (archExecutor.getQueue().size() <= 10) {
-                    Boolean aBoolean = RedisTemplate.hasKey("splithtml-" + dataInfo.getArchiveId());
-                    if (!aBoolean) {
-
-                        if (!aBoolean) {
-                            RedisTemplate.opsForValue().setIfAbsent("splithtml-" + dataInfo.getArchiveId(), "1", 1200, TimeUnit.SECONDS);
-                            CompletableFuture<Void> runAsync = CompletableFuture.runAsync(() -> {
-                                try {
-                                    /*===============执行批量任务===============*/
-                                    signTaskBatchpng(dataInfo);
-                                } finally {
-                                    RedisTemplate.delete("splithtml-" + dataInfo.getArchiveId());
-                                }
-                            }, archExecutor);
-                        }
-                    }
-                }
-            }
-        }
-        System.out.println("队列数量_html" + archExecutor.getQueue().size());
-        System.out.println("活跃数量_html" + archExecutor.getActiveCount());
-        System.out.println("总共数量_html" + archExecutor.getTaskCount());
-        System.out.println("完成数量_html" + archExecutor.getCompletedTaskCount());
-    }
-
-    public void signTaskBatchpng(ArchivesSplitInfoVO taskSign) {
-        try {
-            System.out.println("分解001");
-            String archiveId = taskSign.getArchiveId();
-            String fileUlr = taskSign.getFileUrl();
-            String firstPage = FileUtils.getSysLocalFileUrl() + "archiveSplit/";
-            String firstFileUrl = taskSign.getFirstFileUrl();
-            String firstUrl[] = firstFileUrl.split("--");
-            int basePage = Integer.parseInt(firstUrl[1]);
-            int baseStart = Integer.parseInt(firstUrl[0]);
-            String dutyUser = "";
-            int bkb = 0;
-            //将imagePath 的数据转成一个可解析的html
-            String htmlUrl = pngToHtml(firstPage, archiveId, taskSign.getFirstFileUrl());
-            System.out.println("分解002=" + htmlUrl);
-
-            if (htmlUrl.indexOf("_001.html") >= 0 && htmlUrl.indexOf("archiveSplit") >= 0) {
-                String htmlString = IoUtil.readToString(new FileInputStream(htmlUrl));
-                Document doc = Jsoup.parse(htmlString);
-                Element table = doc.select("table").first();
-                Elements trs = table.select("tr");
-                //由于解析已经成功,可能数据已经分解过,需要删除
-                if (trs != null && trs.size() >= 1) {
-                    String sql = "delete from u_archive_file where id<>'" + taskSign.getId() + "' and archive_id='" + archiveId + "'";
-                    jdbcTemplate.execute(sql);
-                }
-
-                for (int i = 0; i <= trs.size() - 1; i++) {
-                    Element tr = trs.get(i);
-                    String zrz = tr.select("td").get(0).text();
-                    String wjtm = tr.select("td").get(1).text();
-                    String rq = tr.select("td").get(2).text();
-                    String ym = tr.select("td").get(3).text();
-                    if (zrz.equals("责任者") && wjtm.equals("文件题名") && rq.equals("日期")) {
-                        continue;
-                    }
-                    int startYm = 0;
-                    int endYm = 0;
-                    if (i < trs.size() - 1) {
-                        startYm = Func.toInt(ym);
-                        String enData = trs.get(i + 1).select("td").get(3).text();
-                        if (enData.indexOf("页") >= 0) {
-                            enData = trs.get(i + 2).select("td").get(3).text();
-                        }
-
-                        String[] parts = enData.split("(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)");
-                        if (parts != null && parts.length >= 1) {
-                            endYm = Func.toInt(parts[0]);
-                        }
-                    } else {
-                        String[] split = ym.split("(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)");
-                        if (split != null && split.length >= 3) {
-                            startYm = Func.toInt(split[0]);
-                            endYm = Func.toInt(split[2]);
-                        } else {
-                            startYm = Func.toInt(split[0]);
-                            endYm = Func.toInt(split[0]);
-                        }
-                    }
-                    startYm = basePage + startYm;
-                    endYm = basePage + endYm;
-                    dutyUser = zrz;
-                    System.out.println("序号=" + i + "--文件提名:" + wjtm + "--开始(" + startYm + "-" + endYm + ")---页数" + (endYm - startYm + 1));
-                    // 分解文件
-                    String fmlUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/" + archiveId + "_cf_00" + i + ".pdf";
-                    getPdfByPage(startYm, endYm, fileUlr, fmlUrl);
-                    saveDataToMysql(fmlUrl, wjtm, taskSign.getId(), endYm - startYm + 1, i, zrz, rq);
-                    bkb = endYm;
-                }
-            } else {
-                return;
-            }
-
-            // 添加封面信息
-            String fmlUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/" + archiveId + "_fm_001.pdf";
-            getPdfByPage(1, 1, fileUlr, fmlUrl);
-            saveDataToMysql(fmlUrl, "封面", taskSign.getId(), 1, -4, dutyUser, "");
-
-            // 卷内目录
-            String jnmuUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/" + archiveId + "_jnml_001.pdf";
-            getPdfByPage(baseStart, basePage, fileUlr, jnmuUrl);
-            saveDataToMysql(jnmuUrl, "卷内目录", taskSign.getId(), 1, -3, dutyUser, "");
-
-            // 卷内备考表
-            String jnbkbUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/" + archiveId + "_jnbkb_001.pdf";
-            getPdfByPage(bkb + 1, bkb + 1, fileUlr, jnbkbUrl);
-
-            File jlPdfFile = new File(jnbkbUrl);
-            if (jlPdfFile.exists()) {
-                saveDataToMysql(jnbkbUrl, "卷内备考表", taskSign.getId(), 1, 100, dutyUser, "");
-            }
-
-            // 背脊表
-            String bjbUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/" + archiveId + "_beiji_001.pdf";
-            String bjbUrlPng = FileUtils.getSysLocalFileUrl() + "archiveSplit/" + archiveId + "_beiji_001.png";
-
-            int pdfByPage = getPdfByPage(bkb + 2, bkb + 2, fileUlr, bjbUrl);
-            if(pdfByPage==0){
-                File bgImgFile = new File(bjbUrlPng);
-                if (!bgImgFile.exists()) {
-                    int dataNum = savePdfAsImage(1, bjbUrl, bjbUrlPng);
-                }
-                String state = OcrTitle(bjbUrlPng, "3");
-                if (state.equals("1")) {
-                    saveDataToMysql(bjbUrl, "背脊表", taskSign.getId(), 1, 101, dutyUser, "");
-                }
-                bgImgFile.delete();
-            }
-            // 修改任务状态
-            String updateSql = "update u_archives_split_info set status=3 where id=" + taskSign.getId();
-            jdbcTemplate.execute(updateSql);
-            // 修改 u_archives_auto 为 已经分解
-            String updateSqlAuto = "update u_archives_auto set split_status=1 where id=" + taskSign.getArchiveId();
-            jdbcTemplate.execute(updateSqlAuto);
-
-            // 统计各个任务的结果
-            String taxkSql = "UPDATE u_task_split a set finished = (SELECT count(1) from u_archives_auto b where FIND_IN_SET(b.id,a.ids) and b.split_status=1) where FIND_IN_SET(" + taskSign.getArchiveId() + ",a.ids)  and a.type=3";
-            String taxkSql2 = "UPDATE u_task_split a set finished = (SELECT count(1) from u_archives_auto b where a.contract_id=b.contract_id) where a.id=" + taskSign.getTaskId() + " and a.type=2";
-            jdbcTemplate.execute(taxkSql);
-            jdbcTemplate.execute(taxkSql2);
-
-            // 删除html
-            File fileHtml = new File(fmlUrl);
-            fileHtml.delete();
-
-            // 修改完成情况
-            RedisTemplate.delete("splithtml-" + archiveId);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    public static String pngToHtml(String fileUrl, String pKeyId, String pageNum) {
-        String lasHhtmlUrl = "";
-        try {
-            // 定义Python解释器路径和脚本路径
-            String pythonScript = "/Users/hongchuangyanfa/Desktop/PycharmProjects/splitPngToHtml.py";
-            // 构建命令
-            ProcessBuilder pb = new ProcessBuilder("python3", pythonScript, fileUrl, pKeyId, pageNum);
-            Process process = pb.start();
-
-            // 读取Python脚本输出
-            BufferedReader reader = new BufferedReader(
-                    new InputStreamReader(process.getInputStream()));
-            String htmlUrl;
-            while ((htmlUrl = reader.readLine()) != null) {
-                System.out.println(htmlUrl);
-                if (htmlUrl.indexOf("html文件路径") >= 0 && htmlUrl.indexOf("_001.html") >= 0 && htmlUrl.indexOf("archiveSplit") >= 0) {
-                    lasHhtmlUrl = htmlUrl.replace("html文件路径", "");
-                }
-            }
-            // 等待进程结束
-            int exitCode = process.waitFor();
-            if (exitCode == 0) {
-                return lasHhtmlUrl;
-            } else {
-                return "1";
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            return "1";
-        }
-    }
-
-    public static String OcrTitle(String fileUrl, String type) {
-        String lasHhtmlUrl = "";
-        try {
-            // 定义Python解释器路径和脚本路径
-            String pythonScript = "/Users/hongchuangyanfa/Desktop/PycharmProjects/splitPngByTitle.py";
-            // 构建命令
-            ProcessBuilder pb = new ProcessBuilder("python3", pythonScript, fileUrl, type);
-            Process process = pb.start();
-
-            // 读取Python脚本输出
-            BufferedReader reader = new BufferedReader(
-                    new InputStreamReader(process.getInputStream()));
-            String htmlUrl;
-            while ((htmlUrl = reader.readLine()) != null) {
-                System.out.println("222" + htmlUrl);
-                if (htmlUrl.indexOf("图片中是否有卷内目录") >= 0 && htmlUrl.indexOf("True") >= 0) {
-                    return "1";
-                }
-            }
-            // 等待进程结束
-            int exitCode = process.waitFor();
-            if (exitCode == 0) {
-                return lasHhtmlUrl;
-            } else {
-                return "1";
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            return "1";
-        }
-    }
-
-
-    public static int getPdfByPage(int startPage, int endPage, String filePath, String savePath) {
-        try {
-            InputStream inputStreamByUrl = CommonUtil.getOSSInputStream3(filePath);
-            // 加载PDF文件
-            PDDocument document = PDDocument.load(inputStreamByUrl);
-            // 创建新文档
-            PDDocument newDocument = new PDDocument();
-
-            // 注意:PDFBox中的页面索引从0开始
-            int actualStart = Math.max(0, startPage - 1); // 将用户输入的1转换为0
-            int actualEnd = Math.min(document.getNumberOfPages() - 1, endPage - 1); // 将用户输入的10转换为9
-
-            // 添加指定范围的页面
-            for (int i = actualStart; i <= actualEnd; i++) {
-                PDPage page = document.getPage(i);
-                newDocument.addPage(page);
-            }
-
-            // 保存为新文件
-            newDocument.save(savePath);
-            newDocument.close();
-            document.close();
-            return 0;
-        } catch (Exception e) {
-            return 1;
-        }
-    }
-
-    public static int savePdfAsImage(int pageNum, String filePath, String outputPath) {
-        try (InputStream inputStream = FileUtils.getInputStreamByUrl(filePath);
-             PDDocument document = PDDocument.load(inputStream)) {
-
-            // 验证页码范围
-            if (pageNum < 1 || pageNum > document.getNumberOfPages()) {
-                return 1;
-            }
-
-            PDFRenderer renderer = new PDFRenderer(document);
-
-            // 设置DPI为300
-            final int DPI = 300;
-
-            // 渲染指定页面(注意PDFBox使用0-based索引)
-            //BufferedImage image = renderer.renderImage(pageNum - 1, DPI / 72f);
-            BufferedImage image = renderer.renderImageWithDPI(0, DPI); // 0 表示第一页
-            // 确保输出目录存在
-            File outputFile = new File(outputPath);
-            outputFile.getParentFile().mkdirs();
-
-            // 保存为PNG格式(可改为JPG等)
-            ImageIO.write(image, "PNG", outputFile);
-
-            log.info("PDF页面已成功保存为图片: {}", outputPath);
-            inputStream.close();
-            document.close();
-            return 0;
-        } catch (Exception e) {
-            log.error("PDF转图片失败", e);
-            return 1;
-        }
-    }
-
-    public int saveDataToMysql(String upFileUrl, String fileName, String fileId, int filePage, int sort, String dutyUser, String fileTime) {
-        // 获取封面信息
-        long newPkId = SnowFlakeUtil.getId(); //主键Id
-        File fmfile = new File(upFileUrl);
-        if (fmfile.exists()) {
-            BladeFile bladeFile = this.newIOSSClient.uploadFile(fileName + ".pdf", upFileUrl);
-            if (bladeFile != null && Func.isNotEmpty(bladeFile.getLink())) {
-                String FmPdfUrl = bladeFile.getLink();
-                String sql = " insert into u_archive_file( " +
-                        " id,project_id,contract_id,node_id,file_number,file_name,file_time,file_url,pdf_file_url,file_page,is_approval,is_certification,is_need_certification,duty_user,create_user,create_dept,create_time,update_user,update_time,status,is_deleted,sheet_type,sheet_source, " +
-                        " drawing_no,cite_change_number,certification_time,e_visa_file,node_ext_id,file_type,archive_id,origin_id,filming_time,filmingor_time,tag_id,pic_code,refer_code,film_code,width,height,ftime,utime,del_time,sort,box_name,box_number,is_auto_file,is_archive,page_num, " +
-                        " file_size,source_type,is_element,pdf_page_url,fid,rectification,classify,m_wbs_tree_contract_p_key_id,u_image_classification_file_id,archive_file_storage_type,node_tree_structure,date_name,archive_file_stroage_type,out_id,sort_num " +
-                        "   ) " +
-                        " SELECT " + newPkId + ",project_id,contract_id,node_id,file_number,'" + fileName + "','" + fileTime + "','" + FmPdfUrl + "','" + FmPdfUrl + "'," + filePage + ",is_approval,is_certification,is_need_certification,'" + dutyUser + "',create_user,create_dept,create_time,update_user,update_time,status,is_deleted,sheet_type,sheet_source, " +
-                        "        drawing_no,cite_change_number,certification_time,e_visa_file,node_ext_id,file_type,archive_id,origin_id,filming_time,filmingor_time,tag_id,pic_code,refer_code,film_code,width,height,ftime,utime,del_time," + sort + ",box_name,box_number,is_auto_file,is_archive,page_num, " +
-                        "        file_size,source_type,is_element,pdf_page_url,fid,rectification,classify,m_wbs_tree_contract_p_key_id,u_image_classification_file_id,archive_file_storage_type,node_tree_structure,date_name,archive_file_stroage_type,out_id,sort_num " +
-                        " from u_archive_file where id=" + fileId;
-                System.out.println(fileName + "----" + sql);
-                jdbcTemplate.execute(sql);
-
-            } else {
-                // 检查一下oss是否启动
-                System.out.println("oss服务未启动,无法上传文件到oss");
-                return 500;
-            }
-        } else {
-            return 404;
-        }
-        fmfile.delete();
-        return 200;
-    }
-}

+ 1 - 1
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/ChekSignData.java

@@ -47,7 +47,7 @@ public class ChekSignData {
     @Resource(name = "taskExecutor1")
     private ThreadPoolExecutor executor;
 
-//    @Scheduled(cron = "0/10 * * * * ?")
+    @Scheduled(cron = "0/10 * * * * ?")
     public void SignInfo() {
         // 质检SQL
         String sql = "SELECT a.id ,a.e_visa_pdf_url,b.process_instance_id,a.contract_id,a.project_id,c.remark_type from u_information_query a ,u_task b ,m_project_info c where  c.id=a.project_id  and a.`status` = 2 and a.is_deleted=0 and a.e_visa_pdf_url is not null  and b.form_data_id = a.id and b.`status` = 2 and a.chek_status=1 LIMIT 30";

+ 7 - 9
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVDataServiceImpl.java

@@ -454,10 +454,6 @@ public class EVDataServiceImpl implements EVDataService {
                 taskApp.setPdfDataType(type);
                 if (StringUtils.isNotEmpty(pdfTrialUrlPosition) || StringUtils.isNotEmpty(pdfTrialUrl) || StringUtils.isNotEmpty(eVisaPdfUrl) || StringUtils.isNotEmpty(pdfUrl)) {
                     if ("1".equals(type)) {
-                       /* String approvalPdf = eVisaPdfUrl.length() >= 10 ? eVisaPdfUrl : pdfUrl;
-                        approvalPdf = pdfTrialUrl.length() >= 10 ? pdfTrialUrl : approvalPdf;
-                        approvalPdf = pdfTrialUrlPosition.length() >= 10 ? pdfTrialUrlPosition : approvalPdf;
-                        taskApp.setSignPdfUrl(getHppsToHttp(approvalPdf));*/
                         String nodeDdfUrl = map.get("node_pdf_url") + "";
                         if(pdfTrialUrlPosition!=null && pdfTrialUrlPosition.length()>=10){
                             taskApp.setSignPdfUrl(getHppsToHttp(pdfTrialUrlPosition));
@@ -577,17 +573,19 @@ public class EVDataServiceImpl implements EVDataService {
                 SignBackPdfInfo(taskApp);
                 return;
             }
-            ProjectInfo projectInfo = projectClient.getById(taskApp.getProjectId());
-            if (projectInfo == null || Func.isEmpty(projectInfo)) {
+
+            List<Map<String, Object>> projectList = jdbcTemplate.queryForList("select * from u_project_info where  id = " + taskApp.getProjectId());
+            if (projectList == null || Func.isEmpty(projectList)) {
                 taskApp.setSigState(2);
                 taskApp.setSignSmg("未获取项目信息");
                 SignBackPdfInfo(taskApp);
                 return;
             } else {
-                Integer remarkType = projectInfo.getRemarkType();
-                if (remarkType != null && Func.isNotEmpty(remarkType) && remarkType == 2) {
+                Map<String, Object> projectInfo = projectList.get(0);
+                String remarkType = projectInfo.get("remarkType")+"";//.getRemarkType();
+                if (remarkType != null && Func.isNotEmpty(remarkType) && remarkType.equals("2")) {
                     taskApp.setRemarkType("2");
-                }else if (remarkType != null && Func.isNotEmpty(remarkType) && remarkType == 3) {
+                }else if (remarkType != null && Func.isNotEmpty(remarkType) && remarkType .equals("3")) {
                     taskApp.setRemarkType("3");
                 }else {
                     taskApp.setRemarkType("1");

+ 16 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/SubTable.java

@@ -42,6 +42,8 @@ public class SubTable {
     private FormData design;
     /**实测值*/
     private FormData data;
+    // 频率对象
+    private String plStr;
 
     private TableElementConverter tec;
     private List<Long> delTabList = new ArrayList<>();
@@ -212,8 +214,21 @@ public class SubTable {
              designs = this.design.getValues().stream().map(ElementData::stringValue).collect(Collectors.toList());
         }
         for(FormData item:this.mainList){
+
             String key = FormulaUtils.parseItemName(item.getEName()).trim();
-            keyMap.put(key, "1");
+            String code = item.getCode();
+            if(code!=null && code.contains(":")){
+                String[] split = code.split(":");
+                String key1 = split[0];
+                String key2 = split[1];
+                if(this.getPlStr().indexOf(key1)>=0 && this.getPlStr().indexOf(key2)>=0){
+                    System.out.println("123");
+                }else{
+                    keyMap.put(key, "1");
+                }
+            }else{
+                keyMap.put(key, "1");
+            }
         }
 
         // 计算元素是否需要覆盖

+ 11 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -445,7 +445,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                                 /*手写部分的数据加载*/
                                 if (t.getPoint().contains("混凝土强度") && false) {
 //                                    List<Long> ids = getNodeType46(tec).stream().map(CurrentNode::getPkId).collect(Collectors.toList());
-                                    /*质检附表m_20230316104657_1636197331206406144*/
+                                    /*质检m_20230316104657_1636197331206406144*/
                                     List<Map<String, Object>> listMaps = this.jdbcTemplate.queryForList("select a.p_key_id,b.key_10 name,b.key_6 design,b.key_5 data from m_wbs_tree_contract a join m_20230316104657_1636197331206406144 b on a.p_key_id=b.p_key_id where  a.is_deleted=0 and a.parent_id =" + tec.getCurrentNode().getId());
                                     if (listMaps.size() > 0) {
                                         Map<String, String> coordsMap = FormulaUtils.getElementCell("/www/wwwroot/Users/hongchuangyanfa/Desktop/privateUrl/1636291886580760576.html");
@@ -1894,6 +1894,16 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             List<FormData> subTableFds = tec.pick(e -> StringUtils.isEquals(first.getInitTableName(), e.getTableName()));
             /*初始化附表对象*/
             SubTable sta = new SubTable(subTableFds, tec, mainTableList);
+            // 频率 数据的处理
+
+            List<Map<String, Object>> mapList = jdbcTemplate.queryForList("select * from m_formula_option where id = " + tec.getNodeId());
+            if(mapList!=null && mapList.size()>0){
+                String initTableName = mainTableList.get(0).getInitTableName();
+                String plStr = mapList.get(0).get("val")+"";
+                if(plStr!=null && plStr.length()>10 && plStr.contains(initTableName)){
+                    sta.setPlStr(plStr);
+                }
+            }
             sta.put(inspectionList);
             /*把附表数据刷入对应的附表元素对象*/
             sta.flush();
@@ -1905,8 +1915,6 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             /*把主表的表头表尾信息拷贝*/
             headerFooterSub(subTableFds, tec);
             /*如果识别到手填内容需要在附表写入数据后,更新评定关联数据*/
-
-
             if (StringUtils.isNotEmpty(tec.getIsRemoveForSubTab()) && "1".equals(tec.getIsRemoveForSubTab())) {
                 if (!subTabList.isEmpty()) {
                     String queryIds = subTabList.stream().map(e -> e.getPKeyId() + "").collect(Collectors.joining(","));