|
@@ -160,7 +160,6 @@ public class ArchiveController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
@Scheduled(cron = "0/30 * * * * ?")
|
|
@Scheduled(cron = "0/30 * * * * ?")
|
|
public void SplitPdfInfo() {
|
|
public void SplitPdfInfo() {
|
|
//执行代码
|
|
//执行代码
|
|
@@ -168,7 +167,7 @@ public class ArchiveController {
|
|
log.info("分解html开始");
|
|
log.info("分解html开始");
|
|
String sql = "select * from u_archives_split_info where status =2 "; // and TIMESTAMPDIFF(MINUTE, create_time, NOW()) >=3";
|
|
String sql = "select * from u_archives_split_info where status =2 "; // and TIMESTAMPDIFF(MINUTE, create_time, NOW()) >=3";
|
|
List<ArchivesSplitInfoVO> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ArchivesSplitInfoVO.class));
|
|
List<ArchivesSplitInfoVO> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ArchivesSplitInfoVO.class));
|
|
-
|
|
|
|
|
|
+ log.info("分解html开始==="+query.size());
|
|
if (query != null && query.size() >= 1) {
|
|
if (query != null && query.size() >= 1) {
|
|
for (ArchivesSplitInfoVO dataInfo : query) {
|
|
for (ArchivesSplitInfoVO dataInfo : query) {
|
|
if (executor.getQueue().size() <= 10) {
|
|
if (executor.getQueue().size() <= 10) {
|
|
@@ -198,6 +197,7 @@ public class ArchiveController {
|
|
|
|
|
|
public void signTaskBatchpng(ArchivesSplitInfoVO taskSign) {
|
|
public void signTaskBatchpng(ArchivesSplitInfoVO taskSign) {
|
|
try {
|
|
try {
|
|
|
|
+ System.out.println("分解001");
|
|
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/";
|
|
@@ -209,7 +209,7 @@ public class ArchiveController {
|
|
int bkb = 0 ;
|
|
int bkb = 0 ;
|
|
//将imagePath 的数据转成一个可解析的html
|
|
//将imagePath 的数据转成一个可解析的html
|
|
String htmlUrl = pngToHtml(firstPage, archiveId,taskSign.getFirstFileUrl());
|
|
String htmlUrl = pngToHtml(firstPage, archiveId,taskSign.getFirstFileUrl());
|
|
-
|
|
|
|
|
|
+ System.out.println("分解002="+htmlUrl);
|
|
|
|
|
|
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));
|
|
@@ -261,7 +261,7 @@ public class ArchiveController {
|
|
// 分解文件
|
|
// 分解文件
|
|
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,i,zrz);
|
|
|
|
|
|
+ saveDataToMysql(fmlUrl,wjtm,taskSign.getId(),endYm-startYm+1,i,zrz,rq);
|
|
bkb = endYm ;
|
|
bkb = endYm ;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -271,30 +271,31 @@ public class ArchiveController {
|
|
// 添加封面信息
|
|
// 添加封面信息
|
|
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,-4,dutyUser);
|
|
|
|
|
|
+ saveDataToMysql(fmlUrl,"封面",taskSign.getId(),1,-4,dutyUser,"");
|
|
|
|
|
|
// 卷内目录
|
|
// 卷内目录
|
|
String jnmuUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/"+archiveId+"_jnml_001.pdf";
|
|
String jnmuUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/"+archiveId+"_jnml_001.pdf";
|
|
getPdfByPage(baseStart,basePage,fileUlr,jnmuUrl);
|
|
getPdfByPage(baseStart,basePage,fileUlr,jnmuUrl);
|
|
- saveDataToMysql(jnmuUrl,"卷内目录",taskSign.getId(),1,-3,dutyUser);
|
|
|
|
|
|
+ saveDataToMysql(jnmuUrl,"卷内目录",taskSign.getId(),1,-3,dutyUser,"");
|
|
|
|
|
|
// 卷内备考表
|
|
// 卷内备考表
|
|
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,100,dutyUser);
|
|
|
|
|
|
+ saveDataToMysql(jnbkbUrl,"卷内备考表",taskSign.getId(),1,100,dutyUser,"");
|
|
|
|
|
|
// 背脊表
|
|
// 背脊表
|
|
String bjbUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/"+archiveId+"_beiji_001.pdf";
|
|
String bjbUrl = FileUtils.getSysLocalFileUrl() + "archiveSplit/"+archiveId+"_beiji_001.pdf";
|
|
String bjbUrlPng = FileUtils.getSysLocalFileUrl() + "archiveSplit/"+archiveId+"_beiji_001.png";
|
|
String bjbUrlPng = FileUtils.getSysLocalFileUrl() + "archiveSplit/"+archiveId+"_beiji_001.png";
|
|
|
|
+
|
|
getPdfByPage(bkb+2,bkb+2,fileUlr,bjbUrl);
|
|
getPdfByPage(bkb+2,bkb+2,fileUlr,bjbUrl);
|
|
|
|
|
|
- File bgImgFile = new File(bjbUrl);
|
|
|
|
|
|
+ File bgImgFile = new File(bjbUrlPng);
|
|
if (!bgImgFile.exists()) {
|
|
if (!bgImgFile.exists()) {
|
|
savePdfAsImage(1, bjbUrl, bjbUrlPng);
|
|
savePdfAsImage(1, bjbUrl, bjbUrlPng);
|
|
}
|
|
}
|
|
- String state = OcrTitle(bjbUrl,"3");
|
|
|
|
|
|
+ String state = OcrTitle(bjbUrlPng,"3");
|
|
if(state.equals("1")){
|
|
if(state.equals("1")){
|
|
- saveDataToMysql(jnbkbUrl,"背脊表",taskSign.getId(),1,101,dutyUser);
|
|
|
|
|
|
+ saveDataToMysql(bjbUrl,"背脊表",taskSign.getId(),1,101,dutyUser,"");
|
|
}
|
|
}
|
|
bgImgFile.delete();
|
|
bgImgFile.delete();
|
|
|
|
|
|
@@ -312,6 +313,10 @@ public class ArchiveController {
|
|
jdbcTemplate.execute(taxkSql);
|
|
jdbcTemplate.execute(taxkSql);
|
|
jdbcTemplate.execute(taxkSql2);
|
|
jdbcTemplate.execute(taxkSql2);
|
|
|
|
|
|
|
|
+ // 删除html
|
|
|
|
+ File fileHtml = new File(fmlUrl);
|
|
|
|
+ fileHtml.delete();
|
|
|
|
+
|
|
// 修改完成情况
|
|
// 修改完成情况
|
|
RedisTemplate.delete("splithtml-" + archiveId);
|
|
RedisTemplate.delete("splithtml-" + archiveId);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -333,6 +338,7 @@ 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(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文件路径", "");
|
|
}
|
|
}
|
|
@@ -350,7 +356,7 @@ public class ArchiveController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public String OcrTitle(String fileUrl, String type) {
|
|
|
|
|
|
+ public static String OcrTitle(String fileUrl, String type) {
|
|
String lasHhtmlUrl = "";
|
|
String lasHhtmlUrl = "";
|
|
try {
|
|
try {
|
|
// 定义Python解释器路径和脚本路径
|
|
// 定义Python解释器路径和脚本路径
|
|
@@ -445,8 +451,7 @@ public class ArchiveController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public int saveDataToMysql(String upFileUrl,String fileName,String fileId,int filePage,int sort,String dutyUser) {
|
|
|
|
-
|
|
|
|
|
|
+ public int saveDataToMysql(String upFileUrl,String fileName,String fileId,int filePage,int sort,String dutyUser,String fileTime) {
|
|
// 获取封面信息
|
|
// 获取封面信息
|
|
long newPkId = SnowFlakeUtil.getId(); //主键Id
|
|
long newPkId = SnowFlakeUtil.getId(); //主键Id
|
|
File fmfile = new File(upFileUrl);
|
|
File fmfile = new File(upFileUrl);
|
|
@@ -459,7 +464,7 @@ public class ArchiveController {
|
|
" 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 " +
|
|
" ) " +
|
|
" ) " +
|
|
- " SELECT "+newPkId+",project_id,contract_id,node_id,file_number,'" + fileName + "',file_time,'" + 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, " +
|
|
|
|
|
|
+ " 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, " +
|
|
" 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;
|