Ver Fonte

提交修改pdf读取时间的记录表

hxl13994548489 há 1 ano atrás
pai
commit
2f8a2bd9db

+ 18 - 0
src/main/java/com/ydtech/modules/order/dao/InsOrderPayDateRecordMapper.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.po.InsOrderPayDateRecord;
+
+/**
+* @author Administrator
+* @description 针对表【ins_order_pay_date_record(自动更新签单时间记录表)】的数据库操作Mapper
+* @createDate 2024-10-15 18:58:00
+* @Entity generator.domain.InsOrderPayDateRecord
+*/
+public interface InsOrderPayDateRecordMapper extends BaseMapper<InsOrderPayDateRecord> {
+
+}
+
+
+
+

+ 25 - 0
src/main/java/com/ydtech/modules/order/dao/InsOrderPdfUrlMapper.java

@@ -0,0 +1,25 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.po.InsOrderPdfUrl;
+import org.apache.ibatis.annotations.Param;
+
+/**
+* @author Administrator
+* @description 针对表【ins_order_pdf_url(子订单保单路径表)】的数据库操作Mapper
+* @createDate 2024-10-15 18:58:08
+* @Entity generator.domain.InsOrderPdfUrl
+*/
+public interface InsOrderPdfUrlMapper extends BaseMapper<InsOrderPdfUrl> {
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/17 15:47
+     *  @Description: 通过子订单id查询保单数据
+     */
+    InsOrderPdfUrl findEntityBySubOrderId(@Param("subOrderId") String subOrderId);
+}
+
+
+
+

+ 32 - 0
src/main/java/com/ydtech/modules/order/entity/api/pingan/utils/PDFUtil.java

@@ -1,15 +1,20 @@
 package com.ydtech.modules.order.entity.api.pingan.utils;
 
 import com.ydtech.constants.InsuranceEnum;
+import com.ydtech.utils.baidu.FileUtil;
+import com.ydtech.utils.baidu.HtppsUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.text.PDFTextStripper;
 
 
 import java.io.*;
+import java.net.MalformedURLException;
+import java.net.URI;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.HashMap;
+import java.util.UUID;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -465,6 +470,33 @@ public class PDFUtil {
         }
     }
 
+    public static String trafferHttpToLocalPath(String path) {
+        if (path.contains("http") || path.contains("https")) {
+            //转成本地路径
+            String os = System.getProperty("os.name").toLowerCase();
+            String tempDir="";
+            if (os.contains("linux")) {
+                tempDir = "/tmp";
+            } else if (os.contains("windows")) {
+                tempDir = System.getProperty("java.io.tmpdir");
+            }
+            String last = path.substring(path.lastIndexOf(".") + 1);
+            File file =new File(tempDir+ UUID.randomUUID()+"."+last);
+            String encodeUrl = FileUtil.urlEncodeChinese(path);
+            URI u = URI.create(encodeUrl);
+            HtppsUtils.disableSSLCertificateChecking();
+            try{
+                InputStream inputStream = u.toURL().openStream();
+                FileUtil.copyInputStreamToFile(inputStream, file);
+            }catch(Exception e){
+
+            }
+            return file.getPath();
+        } else {
+            return path;
+        }
+    }
+
     public static void main(String[] args) throws IOException {
         //中煤
         //String pdfFilePath = "D:\\nasData\\carInsPolicy\\晋AC692F\\晋AC692F-商业险保单.pdf"; // PDF文件路径

+ 148 - 0
src/main/java/com/ydtech/modules/order/entity/po/InsOrderPayDateRecord.java

@@ -0,0 +1,148 @@
+package com.ydtech.modules.order.entity.po;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+/**
+ * 自动更新签单时间记录表
+ * @TableName ins_order_pay_date_record
+ */
+@TableName(value ="ins_order_pay_date_record")
+@Data
+public class InsOrderPayDateRecord implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 子订单号
+     */
+    private String subOrderNo;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    /**
+     * 旧支付时间
+     */
+    private LocalDateTime oldPayDate;
+
+    /**
+     * 旧签单时间
+     */
+    private LocalDateTime oldSignTime;
+
+    /**
+     * 新支付时间
+     */
+    private LocalDateTime newPayDate;
+
+    /**
+     * 新签单时间
+     */
+    private LocalDateTime newSignTime;
+
+    /**
+     * 旧数据
+     */
+    private String oldContent;
+
+    /**
+     * 新数据
+     */
+    private String newContent;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        InsOrderPayDateRecord other = (InsOrderPayDateRecord) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getSubOrderNo() == null ? other.getSubOrderNo() == null : this.getSubOrderNo().equals(other.getSubOrderNo()))
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
+            && (this.getCreateUser() == null ? other.getCreateUser() == null : this.getCreateUser().equals(other.getCreateUser()))
+            && (this.getOldPayDate() == null ? other.getOldPayDate() == null : this.getOldPayDate().equals(other.getOldPayDate()))
+            && (this.getOldSignTime() == null ? other.getOldSignTime() == null : this.getOldSignTime().equals(other.getOldSignTime()))
+            && (this.getNewPayDate() == null ? other.getNewPayDate() == null : this.getNewPayDate().equals(other.getNewPayDate()))
+            && (this.getNewSignTime() == null ? other.getNewSignTime() == null : this.getNewSignTime().equals(other.getNewSignTime()))
+            && (this.getOldContent() == null ? other.getOldContent() == null : this.getOldContent().equals(other.getOldContent()))
+            && (this.getNewContent() == null ? other.getNewContent() == null : this.getNewContent().equals(other.getNewContent()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getSubOrderNo() == null) ? 0 : getSubOrderNo().hashCode());
+        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        result = prime * result + ((getCreateUser() == null) ? 0 : getCreateUser().hashCode());
+        result = prime * result + ((getOldPayDate() == null) ? 0 : getOldPayDate().hashCode());
+        result = prime * result + ((getOldSignTime() == null) ? 0 : getOldSignTime().hashCode());
+        result = prime * result + ((getNewPayDate() == null) ? 0 : getNewPayDate().hashCode());
+        result = prime * result + ((getNewSignTime() == null) ? 0 : getNewSignTime().hashCode());
+        result = prime * result + ((getOldContent() == null) ? 0 : getOldContent().hashCode());
+        result = prime * result + ((getNewContent() == null) ? 0 : getNewContent().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", subOrderNo=").append(subOrderNo);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", createUser=").append(createUser);
+        sb.append(", oldPayDate=").append(oldPayDate);
+        sb.append(", oldSignTime=").append(oldSignTime);
+        sb.append(", newPayDate=").append(newPayDate);
+        sb.append(", newSignTime=").append(newSignTime);
+        sb.append(", oldContent=").append(oldContent);
+        sb.append(", newContent=").append(newContent);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public InsOrderPayDateRecord(Long id, String subOrderNo, Date createTime, String createUser, LocalDateTime oldPayDate, LocalDateTime oldSignTime, LocalDateTime newPayDate, LocalDateTime newSignTime, String oldContent, String newContent) {
+        this.id = id;
+        this.subOrderNo = subOrderNo;
+        this.createTime = createTime;
+        this.createUser = createUser;
+        this.oldPayDate = oldPayDate;
+        this.oldSignTime = oldSignTime;
+        this.newPayDate = newPayDate;
+        this.newSignTime = newSignTime;
+        this.oldContent = oldContent;
+        this.newContent = newContent;
+    }
+}

+ 160 - 0
src/main/java/com/ydtech/modules/order/entity/po/InsOrderPdfUrl.java

@@ -0,0 +1,160 @@
+package com.ydtech.modules.order.entity.po;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 子订单保单路径表
+ * @TableName ins_order_pdf_url
+ */
+@TableName(value ="ins_order_pdf_url")
+@Data
+public class InsOrderPdfUrl implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 子订单号
+     */
+    private String subOrderNo;
+
+    /**
+     * 险种信息
+     */
+    private String riskCode;
+    /***
+     * 交强保单号
+     */
+    private String jqNo;
+    /***
+     * 商业保单号
+     */
+    private String syNo;
+    /***
+     * 驾意保单号
+     */
+    private String jyNo;
+    /***
+     * 交强保单路径
+     */
+    private String jqUrl;
+    /***
+     * 商业保单路径
+     */
+    private String syUrl;
+    /***
+     * 驾意保单路径
+     */
+    private String jyUrl;
+    /***
+     * 交强标志路径
+     */
+    private String jqSignUrl;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        InsOrderPdfUrl other = (InsOrderPdfUrl) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getSubOrderNo() == null ? other.getSubOrderNo() == null : this.getSubOrderNo().equals(other.getSubOrderNo()))
+            && (this.getRiskCode() == null ? other.getRiskCode() == null : this.getRiskCode().equals(other.getRiskCode()))
+            &&  (this.getJqNo() == null ? other.getJqNo() == null : this.getJqNo().equals(other.getJqNo()))
+            && (this.getSyNo() == null ? other.getSyNo() == null : this.getSyNo().equals(other.getSyNo()))
+            && (this.getJyNo() == null ? other.getJyNo() == null : this.getJyNo().equals(other.getJyNo()))
+            && (this.getJqUrl() == null ? other.getJqUrl() == null : this.getJqUrl().equals(other.getJqUrl()))
+            && (this.getSyUrl() == null ? other.getSyUrl() == null : this.getSyUrl().equals(other.getSyUrl()))
+            && (this.getJyUrl() == null ? other.getJyUrl() == null : this.getJyUrl().equals(other.getJyUrl()))
+            && (this.getJqSignUrl() == null ? other.getJqSignUrl() == null : this.getJqSignUrl().equals(other.getJqSignUrl()))
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
+            && (this.getCreateUser() == null ? other.getCreateUser() == null : this.getCreateUser().equals(other.getCreateUser()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getSubOrderNo() == null) ? 0 : getSubOrderNo().hashCode());
+        result = prime * result + ((getRiskCode() == null) ? 0 : getRiskCode().hashCode());
+        result = prime * result + ((getJqNo() == null) ? 0 : getJqNo().hashCode());
+        result = prime * result + ((getSyNo() == null) ? 0 : getSyNo().hashCode());
+        result = prime * result + ((getJyNo() == null) ? 0 : getJyNo().hashCode());
+        result = prime * result + ((getJqUrl() == null) ? 0 : getJqUrl().hashCode());
+        result = prime * result + ((getSyUrl() == null) ? 0 : getSyUrl().hashCode());
+        result = prime * result + ((getJyUrl() == null) ? 0 : getJyUrl().hashCode());
+        result = prime * result + ((getJqSignUrl() == null) ? 0 : getJqSignUrl().hashCode());
+        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        result = prime * result + ((getCreateUser() == null) ? 0 : getCreateUser().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", subOrderNo=").append(subOrderNo);
+        sb.append(", riskCode=").append(riskCode);
+        sb.append(", jqNo=").append(jqNo);
+        sb.append(", syNo=").append(syNo);
+        sb.append(", jyNo=").append(jyNo);
+        sb.append(", jqUrl=").append(jqUrl);
+        sb.append(", syUrl=").append(syUrl);
+        sb.append(", jyUrl=").append(jyUrl);
+        sb.append(", jqSignUrl=").append(jqSignUrl);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", createUser=").append(createUser);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    public InsOrderPdfUrl() {
+    }
+
+    public InsOrderPdfUrl(Long id,String subOrderNo, String riskCode, String jqNo, String syNo, String jyNo, String jqUrl, String syUrl, String jyUrl, String jqSignUrl, Date createTime, String createUser) {
+        this.id = id;
+        this.subOrderNo = subOrderNo;
+        this.riskCode = riskCode;
+        this.jqNo = jqNo;
+        this.syNo = syNo;
+        this.jyNo = jyNo;
+        this.jqUrl = jqUrl;
+        this.syUrl = syUrl;
+        this.jyUrl = jyUrl;
+        this.jqSignUrl = jqSignUrl;
+        this.createTime = createTime;
+        this.createUser = createUser;
+    }
+}

+ 6 - 0
src/main/java/com/ydtech/modules/order/entity/po/InsOrderReadPdf.java

@@ -67,6 +67,12 @@ public class InsOrderReadPdf implements Serializable {
      */
     private String orderMsg;
 
+
+    /***
+     * 1.交强  2. 商业
+     */
+    private String  type;
+
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
 

+ 28 - 0
src/main/java/com/ydtech/modules/order/service/InsOrderPayDateRecordService.java

@@ -0,0 +1,28 @@
+package com.ydtech.modules.order.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.order.entity.po.InsOrderPayDateRecord;
+
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 针对表【ins_order_pay_date_record(自动更新签单时间记录表)】的数据库操作Service
+* @createDate 2024-10-15 18:58:00
+*/
+public interface InsOrderPayDateRecordService extends IService<InsOrderPayDateRecord> {
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/21 14:59
+     *  @Description: 更新签单时间和签单日期
+     */
+    void udapteOrderDate(String subOrderId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/21 17:01
+     *  @Description:  查看更新时间记录
+     */
+    List<InsOrderPayDateRecord> udapteOrderDateRecord(String subOrderId);
+}

+ 27 - 0
src/main/java/com/ydtech/modules/order/service/InsOrderPdfUrlService.java

@@ -0,0 +1,27 @@
+package com.ydtech.modules.order.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.order.entity.dto.ReadPdfUrlListDto;
+import com.ydtech.modules.order.entity.po.InsOrderPdfUrl;
+
+/**
+* @author Administrator
+* @description 针对表【ins_order_pdf_url(子订单保单路径表)】的数据库操作Service
+* @createDate 2024-10-15 18:58:08
+*/
+public interface InsOrderPdfUrlService extends IService<InsOrderPdfUrl> {
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/16 10:49
+     *  @Description:  统一返回报价接口
+     */
+    ReadPdfUrlListDto readPdfUrlList(String subOrderId,boolean  flag);
+    /**
+     *  @version 
+     *  @author: hxl
+     *  @Date: 2024/10/17 15:55
+     *  @Description:
+     */ 
+    ReadPdfUrlListDto productOrderPdf(String subOrderId);
+}

+ 138 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsOrderPayDateRecordServiceImpl.java

@@ -0,0 +1,138 @@
+package com.ydtech.modules.order.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.esm.model.EsmInsCompany;
+import com.ydtech.modules.order.dao.InsOrderPayDateRecordMapper;
+import com.ydtech.modules.order.entity.InsAreaCompany;
+import com.ydtech.modules.order.entity.api.pingan.utils.PDFUtil;
+import com.ydtech.modules.order.entity.dto.ReadPdfUrlListDto;
+import com.ydtech.modules.order.entity.po.InsOrderPayDateRecord;
+import com.ydtech.modules.order.entity.po.InsOrderReadPdf;
+import com.ydtech.modules.order.service.InsAreaCompanyService;
+import com.ydtech.modules.order.service.InsOrderPayDateRecordService;
+import com.ydtech.modules.order.service.InsOrderPdfUrlService;
+import com.ydtech.modules.order.service.InsOrderReadPdfService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author Administrator
+ * @description 针对表【ins_order_pay_date_record(自动更新签单时间记录表)】的数据库操作Service实现
+ * @createDate 2024-10-15 18:58:00
+ */
+@Service
+public class InsOrderPayDateRecordServiceImpl extends ServiceImpl<InsOrderPayDateRecordMapper, InsOrderPayDateRecord>
+        implements InsOrderPayDateRecordService {
+
+     @Autowired
+     private InsOrderPdfUrlService  insOrderPdfUrlService;
+
+    @Autowired
+    private InsAreaCompanyService insAreaCompanyService;
+
+    @Value("${upload.file.path}")
+    private String uploadFilePath;
+
+    @Value("${upload.file.url}")
+    private String showFileUrl;
+
+    @Value("${api.url}")
+    private String apiUrl;
+
+    @Autowired
+    private InsOrderReadPdfService  insOrderReadPdfService;
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/21 15:00
+     *  @Description: 更新签单日期和缴费时间
+     */
+    @Override
+    public void udapteOrderDate(String subOrderId) {
+        ReadPdfUrlListDto readPdfUrlListDto =null;
+        try{
+             readPdfUrlListDto = insOrderPdfUrlService.readPdfUrlList(subOrderId, false);
+        }catch(Exception e) {
+             throw new SystemException(e.getMessage());
+        }
+        //判断外部订单
+        InsAreaCompany subOrder = insAreaCompanyService.getById(subOrderId);
+        if(readPdfUrlListDto!=null){
+            String code ="";
+            String fileurl ="";
+            //判断订单交强路径是否为空
+            if(readPdfUrlListDto.getOldfileList()!=null && !readPdfUrlListDto.getOldfileList().isEmpty()){
+                code="jq";
+                //交强
+                fileurl = readPdfUrlListDto.getOldfileList().get(0).getFileurl();
+            }else if(readPdfUrlListDto.getBusinessList()!=null && !readPdfUrlListDto.getBusinessList().isEmpty()){
+                code="sy";
+                //商业
+                fileurl = readPdfUrlListDto.getBusinessList().get(0).getFileurl();
+            }else{
+                throw   new SystemException("保单路径错误");
+            }
+            if(StringUtils.isNotBlank(fileurl)){
+                fileurl = fileurl.replaceAll(apiUrl+showFileUrl, "");
+                fileurl = uploadFilePath+fileurl;
+            }
+            //通过保险公司配置读取截取的前缀和后缀
+            LambdaQueryWrapper<InsOrderReadPdf> qws = new LambdaQueryWrapper<>();
+            qws.eq(InsOrderReadPdf::getCompanyId,subOrder.getCompanyId());
+            List<InsOrderReadPdf> list = insOrderReadPdfService.list(qws);
+            HashMap<String,LocalDateTime> map=new HashMap<>();
+            HashMap<String,LocalDateTime> oldMap=new HashMap<>();
+            oldMap.put("payDate",subOrder.getPayDate());
+            oldMap.put("signingTime",subOrder.getPayDate());
+            String pdfText = PDFUtil.getPdfText(fileurl);
+            if(StringUtils.isNotBlank(pdfText)){
+                if(list!=null  && list.size()>0){
+                    for(InsOrderReadPdf insOrderReadPdf:list){
+                       LocalDateTime pdfContentDate = PDFUtil.getPdfContentDate(pdfText, insOrderReadPdf.getReadBegin(), insOrderReadPdf.getReadEnd(), insOrderReadPdf.getReadType());
+                       map.put(insOrderReadPdf.getReadName(),pdfContentDate);
+                    }
+                }
+            }
+            //插入數據
+            InsOrderPayDateRecord  dto=new InsOrderPayDateRecord(null, subOrderId, new Date(), new BaseController().getUserId(), subOrder.getPayDate(), subOrder.getSigningTime(), map.get("payDate"), map.get("signingTime"), oldMap.toString(), map.toString());
+            this.save(dto);
+            if(map.get("payDate")!=null){
+                subOrder.setPayDate(map.get("payDate"));
+            }
+            if(map.get("signingTime")!=null){
+                subOrder.setSigningTime(map.get("signingTime"));
+            }
+           // insAreaCompanyService.save(subOrder);
+
+        }else{
+           throw   new SystemException("生成保单失败");
+        }
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/21 17:01
+     *  @Description:  查看保单修改记录
+     */
+    @Override
+    public List<InsOrderPayDateRecord> udapteOrderDateRecord(String subOrderId) {
+        LambdaQueryWrapper<InsOrderPayDateRecord> lqw = new LambdaQueryWrapper<>();
+        lqw.eq(InsOrderPayDateRecord::getSubOrderNo, subOrderId);
+        return this.list(lqw);
+    }
+}
+
+
+
+

+ 289 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsOrderPdfUrlServiceImpl.java

@@ -0,0 +1,289 @@
+package com.ydtech.modules.order.service.impl;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.constants.InsuranceEnum;
+import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.order.dao.InsOrderPdfUrlMapper;
+import com.ydtech.modules.order.entity.InsAreaCompany;
+import com.ydtech.modules.order.entity.InsAreaCompanyExternalPolicy;
+import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.entity.dto.ReadPdfUrlDto;
+import com.ydtech.modules.order.entity.dto.ReadPdfUrlListDto;
+import com.ydtech.modules.order.entity.po.InsOrderPdfUrl;
+import com.ydtech.modules.order.service.*;
+import com.ydtech.utils.OrderUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+* @author Administrator
+* @description 针对表【ins_order_pdf_url(子订单保单路径表)】的数据库操作Service实现
+* @createDate 2024-10-15 18:58:08
+*/
+@Service
+public class InsOrderPdfUrlServiceImpl extends ServiceImpl<InsOrderPdfUrlMapper, InsOrderPdfUrl>
+    implements InsOrderPdfUrlService {
+
+
+    @Autowired
+    private InsOrderPdfUrlMapper insOrderPdfUrlMapper;
+
+    @Autowired
+    private InsAreaCompanyService insAreaCompanyService;
+
+    @Autowired
+    private InsOrdersService insOrdersService;
+
+    @Autowired
+    private InsAreaCompanyExternalPolicyService insAreaCompanyExternalPolicyService;
+
+    // 爬虫
+    @Autowired
+    private InsCrawlerOrderService insCrawlerOrderService;
+
+    @Autowired
+    private YongAnOrderService yongAnOrderService;
+
+    @Autowired
+    private HuaTaiOrderApiService huaTaiOrderApiService;
+
+    @Autowired
+    private YongchengOrderApiService yongchengOrderApiService;
+
+    @Autowired
+    private GuorenOrderApiService guorenOrderApiService;
+
+    @Autowired
+    private ZijinOrderApiService zijinOrderApiService;
+
+    @Autowired
+    private BoHaiOrderApiService boHaiOrderApiService;
+
+    @Autowired
+    private DaJiaOrderService daJiaOrderService;
+
+    @Autowired
+    private ZhongMeiOrderApiService zhongMeiOrderApiService;
+
+    @Autowired
+    private PingAnOrderApiService pingAnOrderApiService;
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/16 10:49
+     *  @Description:  统一返回保单的pdf
+     */
+    @Override
+    public ReadPdfUrlListDto readPdfUrlList(String subOrderId,boolean flag) {
+        //判断外部订单
+        InsAreaCompany subOrder = insAreaCompanyService.getById(subOrderId);
+        InsOrders insOrders = insOrdersService.getById(subOrder.getOrderno());
+        InsOrderPdfUrl jqUrlEntity = insOrderPdfUrlMapper.findEntityBySubOrderId(subOrderId);
+        return insertOrderPdfData(subOrder,insOrders, false,jqUrlEntity);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/17 15:22
+     *  @Description:  重新生成
+     */
+    @Override
+    public ReadPdfUrlListDto productOrderPdf(String subOrderId) {
+        InsAreaCompany subOrder = insAreaCompanyService.getById(subOrderId);
+        InsOrders insOrders = insOrdersService.getById(subOrder.getOrderno());
+        ReadPdfUrlListDto orderPdfData =null;
+        try{
+            orderPdfData = getOrderPdfData(subOrder, insOrders, true);
+        }catch(Exception e){
+            throw  new SystemException(e.getMessage());
+        }
+        InsOrderPdfUrl insOrderPdfUrl = tranferData(orderPdfData, subOrder.getId(), subOrder.getProduct());
+        this.saveOrUpdate(insOrderPdfUrl);
+        return readPdfUrlList(subOrderId,true);
+    }
+
+
+
+    public  ReadPdfUrlListDto  insertOrderPdfData(InsAreaCompany subOrder,InsOrders insOrders,boolean flag,InsOrderPdfUrl jqUrlEntity){
+        if(jqUrlEntity!=null){
+            InsAreaCompanyExternalPolicy  insAreaCompanyExternalPolicy  =new InsAreaCompanyExternalPolicy(subOrder.getId(),
+                    jqUrlEntity.getJqUrl(),jqUrlEntity.getSyUrl(),jqUrlEntity.getJyUrl(),jqUrlEntity.getJqSignUrl());
+            subOrder.setJyPolicyNo(jqUrlEntity.getJyNo());
+            return  new ReadPdfUrlListDto(insAreaCompanyExternalPolicy,subOrder, insOrders.getIsExternal()==null?"0":String.valueOf(insOrders.getIsExternal()));
+        }else{
+            ReadPdfUrlListDto orderPdfData =null;
+            try{
+               orderPdfData = getOrderPdfData(subOrder, insOrders, flag);
+            }catch(Exception e){
+                throw  new SystemException(e.getMessage());
+            }
+            InsOrderPdfUrl insOrderPdfUrl = tranferData(orderPdfData, subOrder.getId(), subOrder.getProduct());
+            this.saveOrUpdate(insOrderPdfUrl);
+            return orderPdfData;
+        }
+    }
+    public  ReadPdfUrlListDto  getOrderPdfData(InsAreaCompany subOrder,InsOrders insOrders,boolean flag){
+        //处理驾意险保单号
+        String jyPolicyNo = null;
+        if (!Objects.isNull(subOrder.getCrossInsurance())) {
+            jyPolicyNo = OrderUtils.getJyPolicyNo(subOrder.getCompanyId(), String.valueOf(subOrder.getApiType()==null?1:subOrder.getApiType()), subOrder.getCrossInsurance().toString(), insOrders.getIsExternal()==null?"0":String.valueOf(insOrders.getIsExternal()));
+        }
+        subOrder.setJyPolicyNo(jyPolicyNo);
+        if(insOrders.getIsExternal()!=null && insOrders.getIsExternal() ==1){
+            if(flag ){
+                throw  new SystemException("外部订单不允许重新生成");
+            }
+            //外部订单
+            return insAreaCompanyExternalPolicyService.getPolicyByCompanyIdPdfList(subOrder,insOrders);
+        }
+        //永安财险 YAIC   无驾意险保单
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.YAIC.getCode())){
+            throw  new SystemException("永安财险报价暂不支持获取保单");
+            //return yongAnOrderService.getPolicyByCompanyIdPdfList(subOrder,null,flag);
+        }
+        //华泰财险 HTIC 无驾意险保单
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.HTIC.getCode())){
+            if(subOrder.getApiType()!=null && subOrder.getApiType()==1){
+                return huaTaiOrderApiService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+            }else if(subOrder.getApiType()!=null && subOrder.getApiType()==2){
+                return insCrawlerOrderService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+            }
+        }
+        //中煤财险 ZMBX  测试通过
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.ZMBX.getCode())){
+            return zhongMeiOrderApiService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+        }
+        //永诚财险 AICS   测试通过
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.AICS.getCode())){
+            return yongchengOrderApiService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+        }
+        // 国任财险 XDCX  测试通过
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.XDCX.getCode())){
+            return guorenOrderApiService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+        }
+        //紫金财险 ZKIC  测试通过
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.ZKIC.getCode())){
+            return zijinOrderApiService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+        }
+        //渤海财险  BPIC  测试通过库中暂无驾意险保单无法测试驾意险
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.BPIC.getCode())){
+            return boHaiOrderApiService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+        }
+        //恒邦财险 HBIC   爬虫   调不通
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.HBIC.getCode())){
+            return insCrawlerOrderService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+        }
+        //诚泰财险  TPBX 爬虫 调不通
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.CHAC.getCode())){
+            return insCrawlerOrderService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+        }
+        //安盛天平  TPBX 爬虫  测试通过
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.TPBX.getCode())){
+            return insCrawlerOrderService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+        }
+        //中国人寿  GPIC 爬虫  测试通过  外部訂單  沒有爬虫订单
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.GPIC.getCode())){
+            return insCrawlerOrderService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+        }
+        //太平财险 TPIC  爬虫   下载失败
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.TPIC.getCode())){
+            return insCrawlerOrderService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+        }
+        //华农财险 HNIC  爬虫  下载失败
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.HNIC.getCode())){
+            return insCrawlerOrderService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+        }
+        //泰康财险 TKIC 爬虫  测试通过
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.TKIC.getCode())){
+            return insCrawlerOrderService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+        }
+        //众安财险 ZAPA  爬虫   驾意保单没有返回
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.ZAPA.getCode())){
+            return insCrawlerOrderService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+        }
+        //大家财险 DJPC  下载失败
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.DJPC.getCode())){
+            if(subOrder.getApiType()!=null && subOrder.getApiType()==1){
+                return daJiaOrderService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+                //爬虫 测试通过
+            }else if(subOrder.getApiType()!=null && subOrder.getApiType()==2){
+                return insCrawlerOrderService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+            }
+        }
+        //平安财险   上线再调式
+        else if(subOrder.getCompanyId().contains(InsuranceEnum.PAIC.getCode())){
+            return pingAnOrderApiService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+        }
+
+        return null;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/17 17:50
+     *  @Description: 转换成保单格式
+     */
+    public InsOrderPdfUrl tranferData(ReadPdfUrlListDto readPdfUrlListDto,String subOrderId,String riskCode){
+        InsOrderPdfUrl jqUrlEntity = insOrderPdfUrlMapper.findEntityBySubOrderId(subOrderId);
+        InsOrderPdfUrl newEntity  =new  InsOrderPdfUrl();
+        if(jqUrlEntity!=null){
+            newEntity.setId(jqUrlEntity.getId());
+        }
+        newEntity.setSubOrderNo(subOrderId);
+        newEntity.setRiskCode(riskCode);
+        ArrayList<ReadPdfUrlDto> oldfileList = readPdfUrlListDto.getOldfileList();
+        ArrayList<ReadPdfUrlDto> businessList = readPdfUrlListDto.getBusinessList();
+        ArrayList<ReadPdfUrlDto> accidentList = readPdfUrlListDto.getAccidentList();
+        String jqPolicyNo = readPdfUrlListDto.getJqPolicyNo();
+        String syPolicyNo = readPdfUrlListDto.getSyPolicyNo();
+        String jyPolicyNo = readPdfUrlListDto.getJyPolicyNo();
+        if(StringUtils.isNotBlank(jqPolicyNo)){
+            ReadPdfUrlDto  jq= oldfileList.stream().filter(s->s.getFileTitle().equals("交强电子保单")).collect(Collectors.toList()).get(0);
+            List<ReadPdfUrlDto> jqSignList = oldfileList.stream().filter(s -> s.getFileTitle().equals("交强电子标志")).collect(Collectors.toList());
+            ReadPdfUrlDto  jqSign=null ;
+            if(jqSignList!=null  && jqSignList.size()>0){
+                jqSign =jqSignList.get(0);
+            }
+            if(jq!=null){
+                newEntity.setJqNo(jqPolicyNo);
+                newEntity.setJqUrl(jq.getFileurl());
+            }
+            if(jqSign!=null){
+                newEntity.setJqSignUrl(jqSign.getFileurl());
+            }
+        }
+        if(StringUtils.isNotBlank(syPolicyNo)){
+            ReadPdfUrlDto  sy= businessList.stream().filter(s->s.getFileTitle().equals("商业电子保单")).collect(Collectors.toList()).get(0);
+            if(sy!=null){
+                newEntity.setSyNo(syPolicyNo);
+                newEntity.setSyUrl(sy.getFileurl());
+            }
+        }
+
+        if(StringUtils.isNotBlank(jyPolicyNo)){
+            ReadPdfUrlDto  jy= accidentList.stream().filter(s->s.getFileTitle().equals("驾意险保单")).collect(Collectors.toList()).get(0);
+            if(jy!=null){
+                newEntity.setJyNo(jyPolicyNo);
+                newEntity.setJyUrl(jy.getFileurl());
+            }
+        }
+        return newEntity;
+    }
+}
+
+
+
+

+ 8 - 1
src/main/java/com/ydtech/modules/order/service/impl/InsOrderReadPdfServiceImpl.java

@@ -19,6 +19,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.io.File;
 import java.util.Date;
 import java.util.List;
 
@@ -69,7 +70,9 @@ public class InsOrderReadPdfServiceImpl extends ServiceImpl<InsOrderReadPdfMappe
         LambdaQueryWrapper<InsOrderReadPdf> qw = new LambdaQueryWrapper<>();
         qw.eq(InsOrderReadPdf::getCompanyId,insOrderReadPdfContentVo.getCompanyId());
         List<InsOrderReadPdf> list = this.list(qw);
-        String pdfText = PDFUtil.getPdfText(insOrderReadPdfContentVo.getUrl());
+        String url = insOrderReadPdfContentVo.getUrl();
+        String laoclUrl = PDFUtil.trafferHttpToLocalPath(url);
+        String pdfText = PDFUtil.getPdfText(laoclUrl);
         String content ="";
         if(StringUtils.isNotBlank(pdfText)){
             if(list!=null  && list.size()>0){
@@ -79,6 +82,10 @@ public class InsOrderReadPdfServiceImpl extends ServiceImpl<InsOrderReadPdfMappe
                 }
             }
         }
+        if (url.contains("http") || url.contains("https")) {
+            File file =new File(laoclUrl);
+            file.delete();
+        }
         return new InsOrderReadPdfContentDto(pdfText,content);
     }
 }

+ 26 - 0
src/main/resources/mapper/modules/order/InsOrderPayDateRecordMapper.xml

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ydtech.modules.order.dao.InsOrderPayDateRecordMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.order.entity.po.InsOrderPayDateRecord">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="subOrderNo" column="sub_order_no" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="createUser" column="create_user" jdbcType="VARCHAR"/>
+            <result property="oldPayDate" column="old_pay_date" jdbcType="TIMESTAMP"/>
+            <result property="oldSignTime" column="old_sign_time" jdbcType="TIMESTAMP"/>
+            <result property="newPayDate" column="new_pay_date" jdbcType="TIMESTAMP"/>
+            <result property="newSignTime" column="new_sign_time" jdbcType="TIMESTAMP"/>
+            <result property="oldContent" column="old_content" jdbcType="VARCHAR"/>
+            <result property="newContent" column="new_content" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,sub_order_no,create_time,
+        create_user,old_pay_date,old_sign_time,
+        new_pay_date,new_sign_time,old_content,
+        new_content
+    </sql>
+</mapper>

+ 45 - 0
src/main/resources/mapper/modules/order/InsOrderPdfUrlMapper.xml

@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ydtech.modules.order.dao.InsOrderPdfUrlMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.order.entity.po.InsOrderPdfUrl">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="subOrderNo" column="sub_order_no" jdbcType="VARCHAR"/>
+            <result property="riskCode" column="risk_code" jdbcType="VARCHAR"/>
+            <result property="jqNo" column="jq_no" jdbcType="VARCHAR"/>
+            <result property="syNo" column="sy_no" jdbcType="VARCHAR"/>
+            <result property="jyNo" column="jy_no" jdbcType="VARCHAR"/>
+            <result property="jqUrl" column="jq_url" jdbcType="VARCHAR"/>
+            <result property="syUrl" column="sy_url" jdbcType="VARCHAR"/>
+            <result property="jyUrl" column="jy_url" jdbcType="VARCHAR"/>
+            <result property="jqSignUrl" column="jq_sign_url" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="createUser" column="create_user" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,sub_order_no,risk_code,
+        jq_no,sy_no,jy_no,jq_url,sy_url,jy_url,jq_sign_url
+        create_time,create_user
+    </sql>
+    <select id="findEntityBySubOrderId"
+            resultType="com.ydtech.modules.order.entity.po.InsOrderPdfUrl">
+      select
+          id,
+          sub_order_no,
+          risk_code,
+          jq_no,
+          sy_no,
+          jy_no,
+          jq_url,
+          sy_url,
+          jy_url,
+          jq_sign_url
+      from
+          ins_order_pdf_url
+      where
+          sub_order_no =#{subOrderId}
+    </select>
+</mapper>