|
@@ -1,8 +1,18 @@
|
|
|
package com.ydtech.modules.order.entity.api.pingan.utils;
|
|
package com.ydtech.modules.order.entity.api.pingan.utils;
|
|
|
|
|
|
|
|
|
|
+import com.ydtech.constants.InsuranceEnum;
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
|
|
|
|
+import org.apache.pdfbox.text.PDFTextStripper;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
import java.io.*;
|
|
import java.io.*;
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
|
|
+import java.util.regex.Matcher;
|
|
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @version
|
|
* @version
|
|
|
* @author: hxl
|
|
* @author: hxl
|
|
@@ -23,11 +33,11 @@ public class PDFUtil {
|
|
|
String parentPath = encryptFile.getParent();
|
|
String parentPath = encryptFile.getParent();
|
|
|
String name = encryptFile.getName();
|
|
String name = encryptFile.getName();
|
|
|
String fileName = name.split("\\.")[0] + "-decipher.pdf";
|
|
String fileName = name.split("\\.")[0] + "-decipher.pdf";
|
|
|
- PDDocument load = PDDocument.load(encryptFile, password);
|
|
|
|
|
- load.setAllSecurityToBeRemoved(true);
|
|
|
|
|
- String decodeFilePath = parentPath + File.separator+fileName;
|
|
|
|
|
- load.save(decodeFilePath);
|
|
|
|
|
- load.close();
|
|
|
|
|
|
|
+ //PDDocument load = PDDocument.load(encryptFile, password);
|
|
|
|
|
+ //load.setAllSecurityToBeRemoved(true);
|
|
|
|
|
+ //String decodeFilePath = parentPath + File.separator+fileName;
|
|
|
|
|
+ // load.save(decodeFilePath);
|
|
|
|
|
+ // load.close();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -147,4 +157,424 @@ public class PDFUtil {
|
|
|
decipher(targetPath,password);
|
|
decipher(targetPath,password);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static String getPdfText(String pdfFilePath) {
|
|
|
|
|
+ PDDocument document = null;
|
|
|
|
|
+ String text ="";
|
|
|
|
|
+ try {
|
|
|
|
|
+ document = PDDocument.load(new File(pdfFilePath));
|
|
|
|
|
+ PDFTextStripper pdfStripper = new PDFTextStripper();
|
|
|
|
|
+ pdfStripper.setSortByPosition(true); // 设置为true以按照文档中的顺序提取文本
|
|
|
|
|
+ pdfStripper.setShouldSeparateByBeads(true);
|
|
|
|
|
+ text= pdfStripper.getText(document);
|
|
|
|
|
+ text = text.replaceAll("\\s+", " ");
|
|
|
|
|
+ document.close();
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
|
+ }
|
|
|
|
|
+ return text;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static String getPdfContentStr(String pdfText, String beginStr,String endStr,String dateType) {
|
|
|
|
|
+ String contentStr = getContentStr(pdfText, beginStr, endStr);
|
|
|
|
|
+ if(StringUtils.isNotBlank(contentStr)){
|
|
|
|
|
+ contentStr=contentStr.replaceAll(" ", "");
|
|
|
|
|
+ contentStr=contentStr.replaceAll("\\n+", "");
|
|
|
|
|
+ contentStr=contentStr.replaceAll("\\t+", "");
|
|
|
|
|
+ contentStr=contentStr.replaceAll("\\r+", "");
|
|
|
|
|
+ contentStr = contentStr.replaceAll("\\s+", "");
|
|
|
|
|
+ contentStr = contentStr.replaceAll("[^\u4E00-\u9FA50-9年月日:-]+", "");
|
|
|
|
|
+ contentStr = contentStr.replaceAll("时", "");
|
|
|
|
|
+ }
|
|
|
|
|
+ return contentStr;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static LocalDateTime getPdfContentDate(String pdfText, String beginStr,String endStr,String dateType) {
|
|
|
|
|
+ String payDate = getContentStr(pdfText, beginStr, endStr);
|
|
|
|
|
+ LocalDateTime payDateTime = null;
|
|
|
|
|
+ if("1".equals(dateType)){
|
|
|
|
|
+ payDateTime = getStringTranferDate(payDate);
|
|
|
|
|
+ }else if("2".equals(dateType)){
|
|
|
|
|
+ payDateTime = getStringTranferDateCPIC(payDate);
|
|
|
|
|
+ }else if("3".equals(dateType)){
|
|
|
|
|
+ payDateTime = getStringTranferDatePinAn(payDate);
|
|
|
|
|
+ }
|
|
|
|
|
+ return payDateTime;
|
|
|
|
|
+ }
|
|
|
|
|
+ public static HashMap<String,LocalDateTime> getPdfContent(String pdfPath, String companyId){
|
|
|
|
|
+ HashMap<String,LocalDateTime> map =new HashMap<String,LocalDateTime>();
|
|
|
|
|
+ String pdfText = getPdfText(pdfPath);
|
|
|
|
|
+ System.out.println(pdfText);
|
|
|
|
|
+ String payDate=null;
|
|
|
|
|
+ String signDate=null;
|
|
|
|
|
+ if(StringUtils.isNotBlank(pdfText)){
|
|
|
|
|
+ //缴费时间、签单时间 payDate signingTime
|
|
|
|
|
+ //中煤 ===================== 11
|
|
|
|
|
+ if(companyId.contains(InsuranceEnum.ZMBX.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收付确认时间:", "保单生成时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ //永诚 ----------------------------11
|
|
|
|
|
+ }else if(companyId.contains(InsuranceEnum.AICS.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费确认时间:", "电子保单生成时间");
|
|
|
|
|
+ //payDate = getContentStr(pdfText, "收费确认时间:", "业 电子保单生成时间:");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ //安盛 ================================11
|
|
|
|
|
+ }else if(companyId.contains(InsuranceEnum.TPBX.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费确认时间", "微信二维码");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ //恒邦 ==================== 11
|
|
|
|
|
+ }else if(companyId.contains(InsuranceEnum.HBIC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "保费确认时间:", "保单打印时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "核保");
|
|
|
|
|
+ }
|
|
|
|
|
+ //国任 ========================= 11
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.XDCX.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费确认时间:", "投保确认时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "核保");
|
|
|
|
|
+ }
|
|
|
|
|
+ //平安 =================================33
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.PAIC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费确认时间:", "投保确认时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 华农 ============================1.1
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.HNIC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费确认时间:", "有效保单生成时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 华泰 ============================ 1 1
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.HTIC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费确认时间:", "有效保单生成时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 众安 ================================ 2.2
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.ZAPA.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费确认时间:", "投保确认时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ }
|
|
|
|
|
+ //诚泰 ======================== 1.2
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.CHAC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费确认时间:", "投保确认时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ }
|
|
|
|
|
+ //大家 ====================== 111
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.DJPC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收付确认时间:", "投保确认码");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ }
|
|
|
|
|
+ //泰康 ================================= 1.2
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.TKIC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费确认时间:", "投保确认码");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ }
|
|
|
|
|
+ //紫金 ============================= 1.1
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.ZKIC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费确认时间:", "确认码");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ }
|
|
|
|
|
+ //渤海 =========================== 11
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.BPIC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收款确认时间:", "投保确认码");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "核保");
|
|
|
|
|
+ }
|
|
|
|
|
+ //太平 =================== 1.2
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.TPIC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "保费确认时间:", "确认码");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ }
|
|
|
|
|
+ //天安 ==============================1.1
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.TAIC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费确认时间:", "生成保单时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ }
|
|
|
|
|
+ //人保 ================================1.1
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.PICC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费确认时间:", "投保确认时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ }
|
|
|
|
|
+ //人寿 ===========================1 ,2
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.GPIC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收付确认时间:", "保单打印时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "保险人签章");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //阳光 =========================== 11
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.YGBX.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收款确认:", "电子保单流水号");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "经办");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //太平洋 ================================2.2
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.CPIC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费确认时间:", "保单生成时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 泰山 ========================= 1.1
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.TSBX.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费确认时间:", "保单生成时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ }
|
|
|
|
|
+ //中华 ============================ 3.1
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.CICP.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费确认时间:", "投保确认时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "核保");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 华安 =================== 1.1
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.HAIC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费时间:", "投保确认时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 大地 ===========================1.1
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.CCIC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "收费确认时间:", "投保确认时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 安诚 ====================== 1.3
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.ACIC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "缴费确认时间:", "保单生成时间");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 永安 =============================== 11
|
|
|
|
|
+ else if(companyId.contains(InsuranceEnum.YAIC.getCode())){
|
|
|
|
|
+ payDate = getContentStr(pdfText, "支付确认时间:", "投保确认码");
|
|
|
|
|
+ signDate = getContentStr(pdfText, "签单日期:", "(保险人签章)");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ LocalDateTime payDateTime = null;
|
|
|
|
|
+ LocalDateTime signDateTime = null;
|
|
|
|
|
+ if(companyId.contains(InsuranceEnum.PAIC.getCode()) || companyId.contains(InsuranceEnum.ZAPA.getCode())){
|
|
|
|
|
+ payDateTime = getStringTranferDatePinAn(payDate);
|
|
|
|
|
+ signDateTime = getStringTranferDatePinAn(signDate);
|
|
|
|
|
+ }else if(companyId.contains(InsuranceEnum.CHAC.getCode()) || companyId.contains(InsuranceEnum.TKIC.getCode()) || companyId.contains(InsuranceEnum.TPIC.getCode())
|
|
|
|
|
+ || companyId.contains(InsuranceEnum.GPIC.getCode()) || companyId.contains(InsuranceEnum.ACIC.getCode())){
|
|
|
|
|
+ payDateTime = getStringTranferDate(payDate);
|
|
|
|
|
+ signDateTime = getStringTranferDatePinAn(signDate);
|
|
|
|
|
+ }else if(companyId.contains(InsuranceEnum.CPIC.getCode())){
|
|
|
|
|
+ payDateTime = getStringTranferDateCPIC(payDate);
|
|
|
|
|
+ signDateTime = getStringTranferDateCPIC(signDate);
|
|
|
|
|
+ }else if(companyId.contains(InsuranceEnum.CICP.getCode())){
|
|
|
|
|
+ payDateTime = getStringTranferDatePinAn(payDate);
|
|
|
|
|
+ signDateTime = getStringTranferDate(signDate);
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ payDateTime = getStringTranferDate(payDate);
|
|
|
|
|
+ signDateTime = getStringTranferDate(signDate);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ map.put("payDate",payDateTime);
|
|
|
|
|
+ map.put("signDate",signDateTime);
|
|
|
|
|
+ return map;
|
|
|
|
|
+ }
|
|
|
|
|
+ private static LocalDateTime getStringTranferDateCPIC(String payDate) {
|
|
|
|
|
+ if (StringUtils.isNotBlank(payDate)) {
|
|
|
|
|
+ payDate = payDate.replaceAll(" ", "");
|
|
|
|
|
+ payDate = payDate.replaceAll("\\n+", "");
|
|
|
|
|
+ payDate = payDate.replaceAll("\\t+", "");
|
|
|
|
|
+ payDate = payDate.replaceAll("\\r+", "");
|
|
|
|
|
+ payDate = payDate.replaceAll("\\s+", "");
|
|
|
|
|
+ payDate = payDate.replaceAll("[\u4e00-\u9fa5]", "");
|
|
|
|
|
+ System.out.println(payDate.length());
|
|
|
|
|
+ if (payDate.length() == 18) {
|
|
|
|
|
+ payDate = payDate.substring(0, 10) + " " + payDate.substring(10, 18);
|
|
|
|
|
+ } else if (payDate.length() == 15) {
|
|
|
|
|
+ payDate = payDate.substring(0, 10) + " " + payDate.substring(10, 15) + ":00";
|
|
|
|
|
+ } else if (payDate.length() == 10) {
|
|
|
|
|
+ payDate = payDate + " 00:00:00";
|
|
|
|
|
+ }
|
|
|
|
|
+ return LocalDateTime.parse(payDate, DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"));
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ private static LocalDateTime getStringTranferDate(String payDate) {
|
|
|
|
|
+ if(StringUtils.isNotBlank(payDate)){
|
|
|
|
|
+ payDate=payDate.replaceAll(" ", "");
|
|
|
|
|
+ payDate=payDate.replaceAll("\\n+", "");
|
|
|
|
|
+ payDate=payDate.replaceAll("\\t+", "");
|
|
|
|
|
+ payDate=payDate.replaceAll("\\r+", "");
|
|
|
|
|
+ payDate = payDate.replaceAll("\\s+", "");
|
|
|
|
|
+ payDate = payDate.replaceAll("[\u4e00-\u9fa5]", "");
|
|
|
|
|
+ System.out.println(payDate.length());
|
|
|
|
|
+ if(payDate.length() == 18){
|
|
|
|
|
+ payDate = payDate.substring(0,10)+" "+ payDate.substring(10,18);
|
|
|
|
|
+ }else if(payDate.length() == 15){
|
|
|
|
|
+ payDate = payDate.substring(0,10)+" "+ payDate.substring(10,15)+":00";
|
|
|
|
|
+ }else if(payDate.length() == 10){
|
|
|
|
|
+ payDate = payDate+" 00:00:00";
|
|
|
|
|
+ }
|
|
|
|
|
+ return LocalDateTime.parse(payDate, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static LocalDateTime getStringTranferDatePinAn(String payDate) {
|
|
|
|
|
+ if(StringUtils.isNotBlank(payDate)){
|
|
|
|
|
+ payDate=payDate.replaceAll(" ", "");
|
|
|
|
|
+ payDate=payDate.replaceAll("\\n+", "");
|
|
|
|
|
+ payDate=payDate.replaceAll("\\t+", "");
|
|
|
|
|
+ payDate=payDate.replaceAll("\\r+", "");
|
|
|
|
|
+ payDate = payDate.replaceAll("\\s+", "");
|
|
|
|
|
+ payDate = payDate.replaceAll("[^\u4E00-\u9FA50-9年月日:]+", "");
|
|
|
|
|
+ payDate = payDate.replaceAll("时", "");
|
|
|
|
|
+ int count = 0;
|
|
|
|
|
+ int index = 0;
|
|
|
|
|
+ while ((index = payDate.indexOf(":", index)) != -1) {
|
|
|
|
|
+ index += ":".length();
|
|
|
|
|
+ count++;
|
|
|
|
|
+ }
|
|
|
|
|
+ System.out.println(payDate.length());
|
|
|
|
|
+ if((payDate.length() == 17 && count==2 ) || (payDate.length() == 18 && count==2 ) || ( payDate.length() == 19 && count==2 ) ) {
|
|
|
|
|
+ String minnute = payDate.substring(payDate.indexOf("日") + 1, payDate.length());
|
|
|
|
|
+ String day = payDate.substring(0, payDate.indexOf("日") + 1);
|
|
|
|
|
+ payDate = getContentStr(day) + " " + minnute;
|
|
|
|
|
+ }else if((payDate.length() == 14 && count==1 ) || ( payDate.length() == 15 && count==1 ) || ( payDate.length() == 16 && count==1 )){
|
|
|
|
|
+ String minnute = payDate.substring(payDate.indexOf("日")+1, payDate.length());
|
|
|
|
|
+ String day = payDate.substring(0, payDate.indexOf("日")+1);
|
|
|
|
|
+ payDate = getContentStr(day)+" "+ minnute+":00";
|
|
|
|
|
+ }else if(payDate.length() == 9 ||payDate.length() == 10 || payDate.length() == 11){
|
|
|
|
|
+ payDate = getContentStr(payDate)+" 00:00:00";
|
|
|
|
|
+ }
|
|
|
|
|
+ return LocalDateTime.parse(payDate, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static String getContentStr(String input){
|
|
|
|
|
+ Pattern pattern = Pattern.compile("(\\d{4})年(\\d{1,2})月(\\d{1,2})日");
|
|
|
|
|
+ Matcher matcher = pattern.matcher(input);
|
|
|
|
|
+ if (matcher.matches()) {
|
|
|
|
|
+ String year = matcher.group(1);
|
|
|
|
|
+ String month = matcher.group(2);
|
|
|
|
|
+ String day = matcher.group(3);
|
|
|
|
|
+ return year+"-"+((Integer.parseInt(month)<10 && month.length()==1) ?"0"+month:month)+"-"+((Integer.parseInt(month)<10 && month.length()==1) ?"0"+day:day);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static String getContentStr(String input, String beginStr, String endStr){
|
|
|
|
|
+ // 创建正则表达式,其中"(?s)"表示忽略换行符,"."匹配任何字符(包括换行符)
|
|
|
|
|
+ String regex = "(?s)" + Pattern.quote(beginStr) + "(.+?)" + Pattern.quote(endStr);
|
|
|
|
|
+ Pattern pattern = Pattern.compile(regex);
|
|
|
|
|
+ Matcher matcher = pattern.matcher(input);
|
|
|
|
|
+
|
|
|
|
|
+ if (matcher.find()) {
|
|
|
|
|
+ return matcher.group(1);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static void main(String[] args) throws IOException {
|
|
|
|
|
+ //中煤
|
|
|
|
|
+ //String pdfFilePath = "D:\\nasData\\carInsPolicy\\晋AC692F\\晋AC692F-商业险保单.pdf"; // PDF文件路径
|
|
|
|
|
+ //HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "ZMBX");
|
|
|
|
|
+ //永城
|
|
|
|
|
+ // String pdfFilePath = "D:\\nasData\\carInsPolicy\\1834183151125594114\\晋LD580R114B4032620240026390-交强险保单.pdf"; // PDF文件路径
|
|
|
|
|
+ //HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "AICS");
|
|
|
|
|
+ //安盛
|
|
|
|
|
+ // String pdfFilePath = "D:\\nasData\\carInsPolicy\\1823634528262541312\\晋JH6836-交强险保单.pdf"; // PDF文件路径
|
|
|
|
|
+ // HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "TPBX");
|
|
|
|
|
+ //恒邦
|
|
|
|
|
+ String pdfFilePath = "D:\\nasData\\carInsPolicy\\晋KLY103\\晋KLY103-交强险保单.pdf"; // PDF文件路径
|
|
|
|
|
+ HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "HBIC");
|
|
|
|
|
+ //国任
|
|
|
|
|
+ // String pdfFilePath = "D:\\nasData\\carInsPolicy\\晋A139LV\\晋A139LV-交强险保单.pdf"; // PDF文件路径
|
|
|
|
|
+ // HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "XDCX");
|
|
|
|
|
+ //平安
|
|
|
|
|
+ // String pdfFilePath = "D:\\nasData\\carInsPolicy\\晋C5523Q\\晋C5523Q-交强险保单.pdf"; // PDF文件路径
|
|
|
|
|
+ //HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "PAIC");
|
|
|
|
|
+
|
|
|
|
|
+ //华农
|
|
|
|
|
+ //String pdfFilePath = "D:\\bx\\huanong\\晋KME755-交强险保单.pdf"; // PDF文件路径
|
|
|
|
|
+ //HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "HNIC");
|
|
|
|
|
+
|
|
|
|
|
+ // 华泰
|
|
|
|
|
+ //String pdfFilePath = "D:\\bx\\huatai\\晋AH15L3-交强险保单.pdf"; // PDF文件路径
|
|
|
|
|
+ //HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "HTIC");
|
|
|
|
|
+
|
|
|
|
|
+ //众安
|
|
|
|
|
+ // String pdfFilePath = "D:\\bx\\zongan\\晋JTT447-交强险保单.pdf"; // PDF文件路径
|
|
|
|
|
+ //HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "ZAPA");
|
|
|
|
|
+
|
|
|
|
|
+ //诚泰
|
|
|
|
|
+ // String pdfFilePath = "D:\\bx\\chengtai\\晋A1WJ61-交强险保单.pdf"; // PDF文件路径
|
|
|
|
|
+ //HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "CHAC");
|
|
|
|
|
+
|
|
|
|
|
+ //大家
|
|
|
|
|
+ //String pdfFilePath = "D:\\bx\\dajia\\晋FH3550-交强险保单.pdf"; // PDF文件路径
|
|
|
|
|
+ //HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "DJPC");
|
|
|
|
|
+
|
|
|
|
|
+ //泰康
|
|
|
|
|
+ //String pdfFilePath = "D:\\bx\\taikang\\晋BB0233-交强险保单.pdf"; // PDF文件路径
|
|
|
|
|
+ //HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "TKIC");
|
|
|
|
|
+
|
|
|
|
|
+ //紫荆
|
|
|
|
|
+ //String pdfFilePath = "D:\\bx\\zijin\\晋KTY710-交强险保单.pdf"; // PDF文件路径
|
|
|
|
|
+ //HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "ZKIC");
|
|
|
|
|
+
|
|
|
|
|
+ //渤海
|
|
|
|
|
+ // String pdfFilePath = "D:\\bx\\bohai\\晋C1358S-2141103302024015981-交强险保单.pdf"; // PDF文件路径
|
|
|
|
|
+ // HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "BPIC");
|
|
|
|
|
+
|
|
|
|
|
+ //太平
|
|
|
|
|
+ // String pdfFilePath = "D:\\bx\\taiping\\63fe59c9f37a2a1ab62fe8f23f63943c.pdf"; // PDF文件路径
|
|
|
|
|
+ //HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "TPIC");
|
|
|
|
|
+
|
|
|
|
|
+ //天安
|
|
|
|
|
+ //String pdfFilePath = "D:\\bx\\tianan\\829d3f8efdc565b61092cc675d8ac316.pdf"; // PDF文件路径
|
|
|
|
|
+ //HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "TAIC");
|
|
|
|
|
+
|
|
|
|
|
+ //人民
|
|
|
|
|
+ //String pdfFilePath = "D:\\bx\\renbao\\b504310a9897db5be1745c76463d9e0a.pdf"; // PDF文件路径
|
|
|
|
|
+ // HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "PICC");
|
|
|
|
|
+
|
|
|
|
|
+ //人寿
|
|
|
|
|
+ // String pdfFilePath = "D:\\bx\\renshou\\4d36d1b7f19059ffb14a59d04ae140fb.pdf"; // PDF文件路径
|
|
|
|
|
+ // HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "GPIC");
|
|
|
|
|
+
|
|
|
|
|
+ // String pdfFilePath = "D:\\bx\\renshou\\4d36d1b7f19059ffb14a59d04ae140fb.pdf"; // PDF文件路径
|
|
|
|
|
+ // HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "GPIC");
|
|
|
|
|
+
|
|
|
|
|
+ // String pdfFilePath = "D:\\bx\\renshou\\4d36d1b7f19059ffb14a59d04ae140fb.pdf"; // PDF文件路径
|
|
|
|
|
+ // HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "GPIC");
|
|
|
|
|
+
|
|
|
|
|
+ //阳光
|
|
|
|
|
+ // String pdfFilePath = "D:\\bx\\yangguang\\e364a2ea5b29b5056005c084c69fbcde.pdf"; // PDF文件路径
|
|
|
|
|
+ // HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "YGBX");
|
|
|
|
|
+
|
|
|
|
|
+ //太平洋
|
|
|
|
|
+ // String pdfFilePath = "D:\\bx\\taipingyang\\31f92fc448ef7aab3127a6d7fa07621c.pdf"; // PDF文件路径
|
|
|
|
|
+ // HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "CPIC");
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //泰山
|
|
|
|
|
+ // String pdfFilePath = "D:\\bx\\taishan\\2c46d1bd604efe4d1894bf826af30e0a.pdf"; // PDF文件路径
|
|
|
|
|
+ // HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "TSBX");
|
|
|
|
|
+
|
|
|
|
|
+ // String pdfFilePath = "D:\\bx\\taishan\\2c46d1bd604efe4d1894bf826af30e0a.pdf"; // PDF文件路径
|
|
|
|
|
+ // HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "TSBX");
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //中华
|
|
|
|
|
+ // String pdfFilePath = "D:\\bx\\zhonghua\\e3358efb60e4924c65d28971f4a01f94.pdf"; // PDF文件路径
|
|
|
|
|
+ // HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "CICP");
|
|
|
|
|
+
|
|
|
|
|
+ // 华安
|
|
|
|
|
+ // String pdfFilePath = "D:\\bx\\huaan\\9560fc38737dc922db73bf8ffaa56482.pdf"; // PDF文件路径
|
|
|
|
|
+ // HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "HAIC");
|
|
|
|
|
+ // 大地
|
|
|
|
|
+ // String pdfFilePath = "D:\\bx\\dadi\\24f9830c1807fa47ecb933b78e155ed5.pdf"; // PDF文件路径
|
|
|
|
|
+ // HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "CCIC");
|
|
|
|
|
+ // 安诚
|
|
|
|
|
+ // String pdfFilePath = "D:\\bx\\ancheng\\f0b6430219fe3f32b2d63ab41dba95c4.pdf"; // PDF文件路径
|
|
|
|
|
+ // HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "ACIC");
|
|
|
|
|
+ // 永安
|
|
|
|
|
+ // String pdfFilePath = "D:\\bx\\yongan\\交强.pdf"; // PDF文件路径
|
|
|
|
|
+ // HashMap<String, LocalDateTime> zmbx = getPdfContent(pdfFilePath, "YAIC");
|
|
|
|
|
+
|
|
|
|
|
+ System.out.println(zmbx.toString());
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|