zhuwei 1 kuukausi sitten
vanhempi
commit
0ec0e9d2be

+ 45 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/ChekPdfPaceVo.java

@@ -0,0 +1,45 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.business.entity.ArchiveFile;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2022-07-08
+ */
+@Data
+public class ChekPdfPaceVo {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 当前页
+     */
+    @ApiModelProperty("完成数量")
+    private Integer finishCount;
+
+    @ApiModelProperty("总数量")
+    private Integer totalCount;
+
+    @ApiModelProperty("完成比")
+    private double pace;
+}

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

@@ -1,152 +0,0 @@
-package org.springblade.evisa.controller;
-
-import io.swagger.annotations.Api;
-import lombok.AllArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springblade.business.vo.ScrSignInfoVO;
-import org.springblade.business.vo.TaskSignInfoVO;
-import org.springblade.common.utils.CommonUtil;
-import org.springblade.common.utils.SnowFlakeUtil;
-import org.springblade.core.oss.model.BladeFile;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.evisa.service.ScrDataService;
-import org.springblade.evisa.utils.FileUtils;
-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.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.io.ByteArrayInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
-import java.util.List;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-/**
- * 清表基础数据表 控制器
- *
- * @author BladeX
- * @since 2022-05-18
- */
-@RestController
-@AllArgsConstructor
-@Api(value = "电签类", tags = "电签类接口")
-@Slf4j
-public class  Chek {
-
-    @Autowired
-    private StringRedisTemplate RedisTemplate;
-    @Autowired
-    private JdbcTemplate jdbcTemplate;
-    @Autowired
-    private NewIOSSClient newIOSSClient;
-    // 线程池
-    @Resource(name = "taskExecutor1")
-    private ThreadPoolExecutor executor;
-
-
-
-   // @Scheduled(cron = "0/10 * * * * ?")
-    public void SignInfo() {
-        // 质检SQL
-       // String sql = "select id,file_url as eVisaPdfUrl from u_archive_file where length(file_url)!=char_length(file_url) and file_name not in('封面.pdf','封面1.pdf','卷内目录.pdf','卷内目录1.pdf','背脊.pdf','背脊1.pdf','备考表.pdf','备考表1.pdf') and is_deleted<>10  and  contract_id in(1890322575534399490,1890328157624541186,1887771910584999937) and file_url is not null and file_url like '%.pdf%' LIMIT 30  ";
-        String sql = "select id,file_url as eVisaPdfUrl from u_archive_file where file_url like '%//卷内目录.pdf' and  file_url is not null and file_url like '%.pdf%' LIMIT 30  ";
-
-        List<ScrSignInfoVO> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ScrSignInfoVO.class));
-        if (query != null && query.size() >= 1 ) {
-            for (ScrSignInfoVO dataInfo : query) {
-                if (executor.getQueue().size()<=60 ) {
-                    Long nodeId = dataInfo.getId();
-                    Boolean aBoolean = RedisTemplate.hasKey("sign-" + nodeId);
-
-                    if (!aBoolean) {
-                        RedisTemplate.opsForValue().set("sign-" + nodeId, "1",3600, TimeUnit.SECONDS);
-                        CompletableFuture<Void> runAsync = CompletableFuture.runAsync(() -> {
-                            try {
-                                /*===============执行批量任务===============*/
-                                signTaskBatch(dataInfo);
-                            } catch (Exception e) {
-                                String dsql = "update u_archive_file set is_deleted=9  where id="+nodeId;
-                                jdbcTemplate.execute(dsql);
-                                RedisTemplate.delete("sign-" +nodeId);
-                                e.printStackTrace();
-                            }
-                        }, executor);
-                    }
-                }
-            }
-        }
-        System.out.println("队列数量" + executor.getQueue().size());
-        System.out.println("活跃数量" + executor.getActiveCount());
-        System.out.println("总共数量" + executor.getTaskCount());
-        System.out.println("完成数量" + executor.getCompletedTaskCount());
-    }
-
-
-
-    public void signTaskBatch(ScrSignInfoVO taskApp) throws Exception {
-
-        String pdfurl  =taskApp.getEVisaPdfUrl();
-        Long id  =taskApp.getId();
-
-        InputStream inputStre =getOSSInputStream2(pdfurl);
-        String sysLocalFileUrl = FileUtils.getSysLocalFileUrl();
-        String filecode = SnowFlakeUtil.getId() + "";
-        String dataFileUrl = sysLocalFileUrl + "/pdf/" + filecode + ".pdf";
-
-
-        FileOutputStream fout = new FileOutputStream(dataFileUrl);
-        int bytesRead = 0;
-        byte[] buffer = new byte[8192];
-        while ((bytesRead = inputStre.read(buffer, 0, 8192)) != -1) {
-            fout.write(buffer, 0, bytesRead);
-        }
-        fout.close();
-
-        BladeFile bladeFile = this.newIOSSClient.uploadFile(SnowFlakeUtil.getId() + ".pdf", dataFileUrl);
-
-        if (bladeFile != null && Func.isNotEmpty(bladeFile.getLink())) {
-           String dsql = "update u_archive_file set file_url='"+bladeFile.getLink()+"' ,is_deleted=10  where id="+id;
-           jdbcTemplate.execute(dsql);
-            System.out.println("成功");
-            System.out.println(dsql);
-        }
-        RedisTemplate.delete("sign-" + taskApp.getId());
-    }
-
-    public static InputStream getOSSInputStream2(String urlStr) {
-        try {
-            //获取OSS文件流
-         //  String encodedUrl = URLEncoder.encode(urlStr, StandardCharsets.UTF_8.toString());
-
-            URL url = new URL(urlStr);
-            URLConnection conn = url.openConnection();
-            conn.setRequestProperty("User-Agent", "Mozilla/5.0");
-          //  conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
-            return conn.getInputStream();
-        } catch (Exception e) {
-            System.out.println("zw-----------");
-            e.printStackTrace();
-            return null;
-        }
-    }
-
-
-/*    public static void main(String[] args) throws UnsupportedEncodingException {
-        String data ="https://xinan1.zos.ctyun.cn/huazheng2021/archivedFile/cover/6eae7ee55e6ca24a2cc819534715//卷内目录.pdf";
-
-        getOSSInputStream2(data);
-    }*/
-
-}

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

@@ -1,99 +0,0 @@
-package org.springblade.evisa.controller;
-
-import io.swagger.annotations.Api;
-import lombok.AllArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springblade.common.utils.SnowFlakeUtil;
-import org.springblade.core.launch.StartEventListener;
-import org.springblade.core.tool.utils.Func;
-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.JdbcTemplate;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-
-
-/**
- * 清表基础数据表 控制器
- *
- * @author BladeX
- * @since 2022-05-18
- */
-@RestController
-@AllArgsConstructor
-@Api(value = "电签类", tags = "电签类接口")
-@Slf4j
-public class testTaskInfo222 {
-
-    private final StringRedisTemplate RedisTemplate;
-
-    private final JdbcTemplate jdbcTemplate;
-
-    private final NewIOSSClient newIOSSClient;
-
-    // 线程池
-    @Resource(name = "archivePoolExecutor")
-    private ThreadPoolExecutor archExecutor;
-    @Autowired
-    private StartEventListener startEventListener;
-
-  //  @Scheduled(cron = "0/10 * * * * ?")
-    public void SignTaskBatchPng() {
-        //执行代码
-        log.info("分解pdf专图片");
-     
-      //  String sql = "select * from u_information_query where is_deleted=0 and  id=1614886382873305090";
-        String sql = "SELECT * from u_task22 where is_deleted=0 LIMIT 900" ;
-        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
-        System.out.println(mapList.size());
-
-
-        if (mapList != null && mapList.size() >= 1) {
-            for (Map<String, Object> dataInfo : mapList) {
-
-                String id=dataInfo.get("id")+"";
-                String ndid=dataInfo.get("form_data_id")+"";
-
-                if (archExecutor.getQueue().size() <= 1000) {
-                    Boolean aBoolean = RedisTemplate.hasKey("taskIdxx-" + id);
-                    if (!aBoolean) {
-                        RedisTemplate.opsForValue().setIfAbsent("taskIdxx-" + id, "1", 100, TimeUnit.SECONDS);
-                        CompletableFuture<Void> runAsync = CompletableFuture.runAsync(() -> {
-                            try {
-                                signTaskBatchpngToHtml(id,ndid);
-                            } 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(String id,String ndid) {
-        //
-        String UPdate = "delete from  u_information_query_zhu where id='"+ndid+"'";
-        jdbcTemplate.execute(UPdate);
-
-        String UPdat2e = "update u_task22 set is_deleted=10 where id='"+id+"'";
-        jdbcTemplate.execute(UPdat2e);
-        RedisTemplate.delete("taskIdxx-" + id);
-    }
-
-}