|
@@ -10,6 +10,7 @@ import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
|
import org.jsoup.nodes.Element;
|
|
|
import org.jsoup.select.Elements;
|
|
|
+import org.springblade.business.entity.InformationQuery;
|
|
|
import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.common.utils.CommonUtil;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
@@ -17,6 +18,11 @@ import org.springblade.core.oss.model.BladeFile;
|
|
|
import org.springblade.core.tool.utils.FileUtil;
|
|
|
import org.springblade.core.tool.utils.IoUtil;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
+import org.springblade.core.tool.utils.ResourceUtil;
|
|
|
+import org.springblade.manager.entity.ExcelTab;
|
|
|
+import org.springblade.manager.entity.TableFile;
|
|
|
+import org.springblade.manager.entity.WbsTreeContract;
|
|
|
+import org.springblade.manager.entity.WbsTreePrivate;
|
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
|
import org.springblade.manager.entity.*;
|
|
|
import org.springblade.repair.util.ExcelInfoUtils;
|
|
@@ -25,6 +31,7 @@ import org.springblade.resource.feign.NewIOSSClient;
|
|
|
import org.springblade.system.cache.ParamCache;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
+import org.springframework.jdbc.core.SingleColumnRowMapper;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.transaction.support.TransactionTemplate;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -680,4 +687,49 @@ public class CheckAndRepairController {
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping("/checkNodePdfByClsssify")
|
|
|
+ //@Scheduled(cron = "00 10 17 * * ?")
|
|
|
+ public void checkNodePdfByClsssify() throws FileNotFoundException {
|
|
|
+ String sql="select id,wbs_id,classify,pdf_url,e_visa_pdf_url FROM u_information_query WHERE project_id in(1750070685257990145,1795277868551389185) AND is_deleted=0 AND node_pdf_url is NOT NULL AND status in(0,1,2)";
|
|
|
+ List<InformationQuery> informationQueryList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(InformationQuery.class));
|
|
|
+ System.out.println("一共有"+informationQueryList.size()+"条数据");
|
|
|
+ int i=1;
|
|
|
+ for (InformationQuery informationQuery : informationQueryList) {
|
|
|
+ List<String> pdfs=new ArrayList<>();
|
|
|
+ String sql1="select domain_pdf_url from m_table_file where tab_id="+informationQuery.getWbsId()+" and classify="+informationQuery.getClassify()+" and domain_pdf_url is not null and is_deleted=0 order by sort ASC";
|
|
|
+ List<String> tableFileList = jdbcTemplate.query(sql1,new SingleColumnRowMapper<>(String.class));
|
|
|
+ tableFileList=tableFileList.stream().filter(StringUtils::isNotEmpty).collect(Collectors.toList());
|
|
|
+ if(!tableFileList.isEmpty()){
|
|
|
+ String informationQueryPdf=StringUtils.isNotEmpty(informationQuery.getEVisaPdfUrl())?informationQuery.getEVisaPdfUrl():informationQuery.getPdfUrl();
|
|
|
+ pdfs.add(informationQueryPdf);
|
|
|
+ pdfs.addAll(tableFileList);
|
|
|
+ String file_path = FileUtils.getSysLocalFileUrl();
|
|
|
+ String listPdf = file_path + "/nodePDF/" + informationQuery.getWbsId() + ".pdf";
|
|
|
+ File tabpdf2 = ResourceUtil.getFile(listPdf);
|
|
|
+ if (tabpdf2.exists()) {
|
|
|
+ tabpdf2.delete();
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ FileUtils.mergePdfPublicMethods(pdfs, listPdf);
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(informationQuery.getWbsId() + ".pdf", listPdf);
|
|
|
+ if(bladeFile!=null && StringUtils.isNotEmpty(bladeFile.getLink())){
|
|
|
+ String update="update u_information_query set node_pdf_url="+"'"+bladeFile.getLink()+"'"+" where id="+informationQuery.getId();
|
|
|
+ System.out.println("合并后======================================"+update);
|
|
|
+ jdbcTemplate.update(update);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ System.out.println("合并pdf失败!informationQueryID:"+informationQuery.getId());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ String informationQueryPdf=StringUtils.isNotEmpty(informationQuery.getEVisaPdfUrl())?informationQuery.getEVisaPdfUrl():informationQuery.getPdfUrl();
|
|
|
+ String update="update u_information_query set node_pdf_url="+"'"+informationQueryPdf+"'"+" where id="+informationQuery.getId();
|
|
|
+ System.out.println(update);
|
|
|
+ jdbcTemplate.update(update);
|
|
|
+ }
|
|
|
+ System.out.println("已处理"+i+"条数据,还剩下条"+(informationQueryList.size()-i)+"数据:"+informationQuery.getId());
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|