|
@@ -62,7 +62,7 @@ public class ArchiveController {
|
|
@Resource(name = "taskExecutor1")
|
|
@Resource(name = "taskExecutor1")
|
|
private ThreadPoolExecutor executor;
|
|
private ThreadPoolExecutor executor;
|
|
|
|
|
|
- @Scheduled(cron = "0 0/1 * * * ?")
|
|
|
|
|
|
+ // @Scheduled(cron = "0 0/1 * * * ?")
|
|
public void SignInfo() {
|
|
public void SignInfo() {
|
|
//执行代码
|
|
//执行代码
|
|
|
|
|
|
@@ -156,7 +156,7 @@ public class ArchiveController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- // @Scheduled(cron = "0/30 * * * * ?")
|
|
|
|
|
|
+ // @Scheduled(cron = "0/30 * * * * ?")
|
|
public void SplitPdfInfo() {
|
|
public void SplitPdfInfo() {
|
|
//执行代码
|
|
//执行代码
|
|
|
|
|
|
@@ -191,72 +191,89 @@ public class ArchiveController {
|
|
System.out.println("完成数量_html" + executor.getCompletedTaskCount());
|
|
System.out.println("完成数量_html" + executor.getCompletedTaskCount());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
public void signTaskBatchpng(ArchivesSplitInfoVO taskSign) {
|
|
public void signTaskBatchpng(ArchivesSplitInfoVO taskSign) {
|
|
try {
|
|
try {
|
|
String archiveId = taskSign.getArchiveId();
|
|
String archiveId = taskSign.getArchiveId();
|
|
String fileUlr = taskSign.getFileUrl();
|
|
String fileUlr = taskSign.getFileUrl();
|
|
String firstPage = FileUtils.getSysLocalFileUrl() + "archiveSplit/";
|
|
String firstPage = FileUtils.getSysLocalFileUrl() + "archiveSplit/";
|
|
|
|
+ String firstFileUrl = taskSign.getFirstFileUrl();
|
|
|
|
+ int basePage = Integer.parseInt(firstFileUrl.split("--")[1]);
|
|
int bkb = 0 ;
|
|
int bkb = 0 ;
|
|
//将imagePath 的数据转成一个可解析的html
|
|
//将imagePath 的数据转成一个可解析的html
|
|
String htmlUrl = pngToHtml(firstPage, archiveId,taskSign.getFirstFileUrl());
|
|
String htmlUrl = pngToHtml(firstPage, archiveId,taskSign.getFirstFileUrl());
|
|
|
|
|
|
|
|
+
|
|
if (htmlUrl.indexOf("_001.html") >= 0 && htmlUrl.indexOf("archiveSplit") >= 0) {
|
|
if (htmlUrl.indexOf("_001.html") >= 0 && htmlUrl.indexOf("archiveSplit") >= 0) {
|
|
String htmlString = IoUtil.readToString(new FileInputStream(htmlUrl));
|
|
String htmlString = IoUtil.readToString(new FileInputStream(htmlUrl));
|
|
Document doc = Jsoup.parse(htmlString);
|
|
Document doc = Jsoup.parse(htmlString);
|
|
Element table = doc.select("table").first();
|
|
Element table = doc.select("table").first();
|
|
Elements trs = table.select("tr");
|
|
Elements trs = table.select("tr");
|
|
|
|
|
|
- for (int i = 1; i <= trs.size() - 1; i++) {
|
|
|
|
|
|
+ for (int i = 0; i <= trs.size() - 1; i++) {
|
|
Element tr = trs.get(i);
|
|
Element tr = trs.get(i);
|
|
String zrz = tr.select("td").get(0).text();
|
|
String zrz = tr.select("td").get(0).text();
|
|
String wjtm = tr.select("td").get(1).text();
|
|
String wjtm = tr.select("td").get(1).text();
|
|
String rq = tr.select("td").get(2).text();
|
|
String rq = tr.select("td").get(2).text();
|
|
String ym = tr.select("td").get(3).text();
|
|
String ym = tr.select("td").get(3).text();
|
|
|
|
+ if(zrz.equals("责任者") && wjtm.equals("文件题名") && rq.equals("日期")){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
int startYm = 0;
|
|
int startYm = 0;
|
|
int endYm = 0;
|
|
int endYm = 0;
|
|
if(i<trs.size()-1){
|
|
if(i<trs.size()-1){
|
|
startYm = Func.toInt(ym);
|
|
startYm = Func.toInt(ym);
|
|
String enData = trs.get(i+1).select("td").get(3).text();
|
|
String enData = trs.get(i+1).select("td").get(3).text();
|
|
- if(enData.indexOf("-")>=0){
|
|
|
|
- endYm = Func.toInt(enData.split("-")[0])-1;
|
|
|
|
- }else{
|
|
|
|
- endYm = Func.toInt(enData)-1;
|
|
|
|
|
|
+ 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{
|
|
}else{
|
|
- if(ym.indexOf("-")>=0){
|
|
|
|
- String[] split = ym.split("-");
|
|
|
|
|
|
+ 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]);
|
|
startYm = Func.toInt(split[0]);
|
|
- endYm = Func.toInt(split[1]);
|
|
|
|
|
|
+ endYm = Func.toInt(split[0]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- startYm = startYm + 2 ;
|
|
|
|
- endYm = endYm + 2 ;
|
|
|
|
- System.out.println(zrz + " " + wjtm + " " + rq + " " + ym);
|
|
|
|
|
|
+ startYm = basePage+startYm ;
|
|
|
|
+ endYm = basePage+endYm ;
|
|
|
|
+ System.out.println("序号="+i+"--文件提名:"+wjtm +"--开始("+startYm+"-"+endYm+")---页数"+(endYm-startYm+1));
|
|
// 分解文件
|
|
// 分解文件
|
|
String fmlUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/"+archiveId+"_cf_00"+i+".pdf";
|
|
String fmlUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/"+archiveId+"_cf_00"+i+".pdf";
|
|
getPdfByPage(startYm,endYm,fileUlr,fmlUrl);
|
|
getPdfByPage(startYm,endYm,fileUlr,fmlUrl);
|
|
- saveDataToMysql(fmlUrl,wjtm,taskSign.getId(),endYm-startYm+1);
|
|
|
|
|
|
+ saveDataToMysql(fmlUrl,wjtm,taskSign.getId(),endYm-startYm+1,i);
|
|
bkb = endYm ;
|
|
bkb = endYm ;
|
|
}
|
|
}
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
-
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
|
|
// 添加封面信息
|
|
// 添加封面信息
|
|
String fmlUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/"+archiveId+"_fm_001.pdf";
|
|
String fmlUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/"+archiveId+"_fm_001.pdf";
|
|
getPdfByPage(1,1,fileUlr,fmlUrl);
|
|
getPdfByPage(1,1,fileUlr,fmlUrl);
|
|
- saveDataToMysql(fmlUrl,"封面",taskSign.getId(),1);
|
|
|
|
|
|
+ saveDataToMysql(fmlUrl,"封面",taskSign.getId(),1,-4);
|
|
|
|
|
|
// 卷内目录
|
|
// 卷内目录
|
|
String jnmuUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/"+archiveId+"_jnml_001.pdf";
|
|
String jnmuUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/"+archiveId+"_jnml_001.pdf";
|
|
getPdfByPage(2,2,fileUlr,jnmuUrl);
|
|
getPdfByPage(2,2,fileUlr,jnmuUrl);
|
|
- saveDataToMysql(jnmuUrl,"卷内目录",taskSign.getId(),1);
|
|
|
|
|
|
+ saveDataToMysql(jnmuUrl,"卷内目录",taskSign.getId(),1,-3);
|
|
|
|
|
|
// 卷内备考表
|
|
// 卷内备考表
|
|
String jnbkbUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/"+archiveId+"_jnbkb_001.pdf";
|
|
String jnbkbUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/"+archiveId+"_jnbkb_001.pdf";
|
|
getPdfByPage(bkb+1,bkb+1,fileUlr,jnbkbUrl);
|
|
getPdfByPage(bkb+1,bkb+1,fileUlr,jnbkbUrl);
|
|
- saveDataToMysql(jnbkbUrl,"卷内备考表",taskSign.getId(),1);
|
|
|
|
|
|
+ saveDataToMysql(jnbkbUrl,"卷内备考表",taskSign.getId(),1,100);
|
|
|
|
+
|
|
|
|
+ // 背脊表
|
|
|
|
+ String bjbUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/"+archiveId+"_beiji_001.pdf";
|
|
|
|
+ getPdfByPage(bkb+2,bkb+2,fileUlr,jnbkbUrl);
|
|
|
|
+ saveDataToMysql(jnbkbUrl,"背脊表",taskSign.getId(),1,101);
|
|
|
|
|
|
// 修改任务状态
|
|
// 修改任务状态
|
|
String updateSql = "update u_archives_split_info set status=3 where id=" + taskSign.getId();
|
|
String updateSql = "update u_archives_split_info set status=3 where id=" + taskSign.getId();
|
|
@@ -293,7 +310,6 @@ public class ArchiveController {
|
|
new InputStreamReader(process.getInputStream()));
|
|
new InputStreamReader(process.getInputStream()));
|
|
String htmlUrl;
|
|
String htmlUrl;
|
|
while ((htmlUrl = reader.readLine()) != null) {
|
|
while ((htmlUrl = reader.readLine()) != null) {
|
|
- System.out.println("222" + htmlUrl);
|
|
|
|
if (htmlUrl.indexOf("html文件路径") >= 0 && htmlUrl.indexOf("_001.html") >= 0 && htmlUrl.indexOf("archiveSplit") >= 0) {
|
|
if (htmlUrl.indexOf("html文件路径") >= 0 && htmlUrl.indexOf("_001.html") >= 0 && htmlUrl.indexOf("archiveSplit") >= 0) {
|
|
lasHhtmlUrl = htmlUrl.replace("html文件路径", "");
|
|
lasHhtmlUrl = htmlUrl.replace("html文件路径", "");
|
|
}
|
|
}
|
|
@@ -410,7 +426,8 @@ public class ArchiveController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public int saveDataToMysql(String upFileUrl,String fileName,String fileId,int filePage) {
|
|
|
|
|
|
+ public int saveDataToMysql(String upFileUrl,String fileName,String fileId,int filePage,int sort) {
|
|
|
|
+
|
|
// 获取封面信息
|
|
// 获取封面信息
|
|
long newPkId = SnowFlakeUtil.getId(); //主键Id
|
|
long newPkId = SnowFlakeUtil.getId(); //主键Id
|
|
File fmfile = new File(upFileUrl);
|
|
File fmfile = new File(upFileUrl);
|
|
@@ -424,7 +441,7 @@ public class ArchiveController {
|
|
" 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 " +
|
|
" 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 + "',file_time,'" + FmPdfUrl + "','" + FmPdfUrl + "',"+filePage+",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, " +
|
|
" SELECT "+newPkId+",project_id,contract_id,node_id,file_number,'" + fileName + "',file_time,'" + FmPdfUrl + "','" + FmPdfUrl + "',"+filePage+",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, " +
|
|
|
|
|
|
+ " 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 " +
|
|
" 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;
|
|
" from u_archive_file where id=" + fileId;
|
|
System.out.println(fileName + "----" + sql);
|
|
System.out.println(fileName + "----" + sql);
|