package com.hr.esign;


import org.apache.commons.lang3.StringUtils;
import org.zefer.pd4ml.PD4Constants;
import org.zefer.pd4ml.PD4ML;

import java.awt.*;
import java.io.*;
import java.security.InvalidParameterException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

/**
 * @author L.Wen
 */
public class HtmlToPDFUtil {
    private int topValue = 10;
    private int leftValue = 20;
    private int rightValue = 10;
    private int bottomValue = 10;
    private int userSpaceWidth = 1024;

    private static String filePath = "D:\\_____Work\\";// 本地测试用

    public static void main(String[] args) {
        try {
            HtmlToPDFUtil jt = new HtmlToPDFUtil();
            String title = "标题-测试生成PDF";
            String text = "正文-这里是正文";
            //此处填写你的html文件
            //在下面，body中设置了style，设置了默认字体为宋体，这样导出时的html语言就默认带有了字体，汉字才会导出成功
            String html = "<!doctype html>\n" +
                    "<html lang=\"en\"> \n" +
                    " <head> \n" +
                    "  <meta charset=\"utf-8\"> \n" +
                    "  <meta content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\" name=\"viewport\"> \n" +
                    "  <meta name=\"format-detection\" content=\"telephone=no\"> \n" +
                    "  <meta content=\"yes\" name=\"apple-mobile-web-app-capable\"> \n" +
                    "  <meta content=\"yes\" name=\"apple-touch-fullscreen\"> \n" +
                    "  <meta content=\"black\" name=\"apple-mobile-web-app-status-bar-style\"> \n" +
                    "  <link rel=\"stylesheet\" href=\"css/common.css\"> \n" +
                    "  <script type=\"text/javascript\" src=\"https://loansm.oss-cn-hangzhou.aliyuncs.com/js/jquery-2.2.3.min.js\"></script> \n" +
                    "  <script type=\"text/javascript\" src=\"https://common-libs-web.oss-cn-hangzhou.aliyuncs.com/mobile-detect.min.js\"></script> \n" +
                    "  <script type=\"text/javascript\" src=\"https://loansm.oss-cn-hangzhou.aliyuncs.com/js/vue2.js\"></script> \n" +
                    "  <script type=\"text/javascript\" src=\"../../src/js/tools.js\"></script> \n" +
                    "  <script type=\"text/javascript\" src=\"../../src/js/config.js\"></script> \n" +
                    "  <title>个人信息共享授权书</title> \n" +
                    "  <style>\n" +
                    "      .containerV2 {\n" +
                    "        font-size: 13px;\n" +
                    "        text-indent: 0;\n" +
                    "        margin: 0;\n" +
                    "        padding: 0 20px;\n" +
                    "        line-height: 26px;\n" +
                    "      }\n" +
                    "\n" +
                    "      .mar-top-10 {\n" +
                    "        margin-top: 5px;\n" +
                    "      }\n" +
                    "\n" +
                    "      .font-we {\n" +
                    "        font-weight: bold;\n" +
                    "        color: #000;\n" +
                    "      }\n" +
                    "\n" +
                    "      .table {\n" +
                    "        display: flex;\n" +
                    "        flex-direction: column;\n" +
                    "        width: 100%;\n" +
                    "        height: auto;\n" +
                    "        gap: 0;\n" +
                    "        border: 1px solid #333;\n" +
                    "      }\n" +
                    "\n" +
                    "      .table .table-label {\n" +
                    "        width: 100%;\n" +
                    "        font-weight: 600;\n" +
                    "        /* height: 3rem; */\n" +
                    "        display: grid;\n" +
                    "        grid-template-columns: 30px 40px 40px 1fr 1fr 30px;\n" +
                    "      }\n" +
                    "\n" +
                    "      .table .table-label div {\n" +
                    "        display: flex;\n" +
                    "        justify-content: center;\n" +
                    "        align-items: center;\n" +
                    "        text-align: center;\n" +
                    "        box-sizing: border-box;\n" +
                    "        border: 1px solid #333;\n" +
                    "        line-height: 1.5;\n" +
                    "      }\n" +
                    "\n" +
                    "      .table .table-row {\n" +
                    "        width: 100%;\n" +
                    "        display: grid;\n" +
                    "        grid-template-columns: 30px 40px 40px 1fr 1fr 30px;\n" +
                    "      }\n" +
                    "\n" +
                    "      .table .table-row div {\n" +
                    "        display: flex;\n" +
                    "        justify-content: center;\n" +
                    "        align-items: center;\n" +
                    "        box-sizing: border-box;\n" +
                    "        border: 1px solid #333;\n" +
                    "        height: auto;\n" +
                    "        line-height: 1.5;\n" +
                    "        /* 过长无空格字母串与数字为了阅读完整性，不会换行，使用此属性可断字换行 */\n" +
                    "        word-break: break-all;\n" +
                    "      }\n" +
                    "    </style> \n" +
                    " </head> \n" +
                    " <body> \n" +
                    "  <div class=\"containerV2\" id=\"protocolApp\"> \n" +
                    "   <div style=\"text-indent: 0; font-weight: 700\">\n" +
                    "    重要提示：\n" +
                    "   </div> \n" +
                    "   <div style=\"text-indent: 2em\"> <span style=\"font-weight: bold\"> 为维护您（以下简称“本人”或“您”）的合法权益，请在线签署《个人信息共享授权书》（以下简称“本授权书”）前，仔细阅读、充分理解本授权书各条款内容，特别是免除或减轻<span>张三</span><span>、121212121212</span>及其关联公司（以下简称“被授权人”）责任，或限制您权利的条款，其中免除或减轻责任条款将以黑体加粗形式提示您。您点击本授权书所在页面按钮并进入下一页面或勾选本授权书即视为您已阅读本授权书，并同意接受本授权书条款的约束，本授权书即完成在线签署并生效。<span style=\"font-weight: normal\">为了保护您的个人信息，本授权书在向您展示时将部分隐藏您的身份信息，您的身份信息详情以您在本平台账户对应的实名信息为准。 </span> </span> \n" +
                    "   </div> \n" +
                    "   <div align=\"center\" style=\"padding-top: 10px\" class=\"bg\"> \n" +
                    "    <h3>个人信息共享授权书</h3> \n" +
                    "   </div> \n" +
                    "   <div class=\"mar-top-10\"> <span class=\"font-we\">本人姓名: 李四 </span> \n" +
                    "    <br> <span style=\"white-space: nowrap; text-indent: 2em\" class=\"font-we\">本人身份证号码: 1212121211111 </span> \n" +
                    "   </div> \n" +
                    "   <br> \n" +
                    "   <div class=\"mar-top-10 font-we\" style=\"text-indent: 0\">\n" +
                    "    一、定义\n" +
                    "   </div> \n" +
                    "   <div>\n" +
                    "    1、个人信息，指如下信息：\n" +
                    "   </div> \n" +
                    "   <div>\n" +
                    "     （1）<span style=\"font-weight: bold\">个人识别信息,</span>指本人的<span style=\"font-weight: bold\"> 手机号码、微信号、身份证号码 ， </span> 以及平台通过向本人申请电话状态权限/IDFA权限、位置权限（如涉及）而收集的本人的 <span style=\"font-weight: bold\"> 唯一设备识别码（IMEI、IMSI）、IP地址、地理位置。 </span> \n" +
                    "   </div> \n" +
                    "   <div>\n" +
                    "     （2）<span style=\"font-weight: bold\">个人资质信息 ，</span> 指本人的 <span style=\"font-weight: bold\"> 姓名、年龄、户籍、现居住地址、婚姻状况、配偶信息（如涉及）、常用邮箱地址、房产情况（房产类型、房产价值等）、车辆情况（车辆品牌、车辆价值、车牌号、购车方式等）、工资发放形式、教育程度、信用情况（芝麻信用分、逾期信息等）、社保情况、公积金情况、信用卡情况、商业保单情况、月工资收入、职业类型、经营企业情况、单位/公司名称、单位/公司电话、单位/公司地址、单位/公司性质、紧急联系人信息、贷款用途（具体以本人在页面实际填写的信息为准）。 </span> 其中<span style=\"font-weight: bold\">紧急联系人信息指本人与紧急联系人的关系、紧急联系人的姓名及电话，</span> 配偶信息指 <span style=\"font-weight: bold\"> 本人配偶的姓名、身份证号、工作电话及联系电话。 </span> \n" +
                    "   </div> \n" +
                    "   <div>\n" +
                    "     （3）<span style=\"font-weight: bold\">个人账户信息,</span> 指本人的 <span style=\"font-weight: bold\">银行卡号、开户行、开户行地址、预留手机号。 </span> \n" +
                    "   </div> \n" +
                    "   <div>\n" +
                    "     2、助贷/助融机构，指为本人提供贷款服务、产品，融资服务或产品，贷款咨询服务的机构，在本授权书下机构指 <span style=\"font-weight: bold\">根据本人个人信息匹配出的机构</span> 及其前述机构的分支机构、关联方，具体详见本协议底部表格所列之机构。 \n" +
                    "   </div> \n" +
                    "   <div>\n" +
                    "     3、广告及分析服务类提供商，指受被授权人委托对本人的产品需求/偏好进行评估，并向本人推荐本人需要的贷款产品及服务的第三方机构，具体详见本协议底部表格所列之机构。 \n" +
                    "   </div> \n" +
                    "   <div>\n" +
                    "     4、信用机构及数据服务商，指基于被授权人委托，向被授权人提供本人的身份识别信息、风险识别信息、资质评估信息、表征信用情况的综合评分或信用评级的第三方机构，具体详见本协议底部表格所列之机构。 \n" +
                    "   </div> \n" +
                    "   <div class=\"mar-top-10 font-we\">\n" +
                    "     二、授权内容 \n" +
                    "    <br> 1、在平台为本人提供服务过程中，为了便于被授权人向本人推荐适合本人的贷款产品，本人授权被授权人收集并存储本人提交的个人信息。 \n" +
                    "    <br> 2、为了便于助贷/助融机构根据本人的资信情况对本人进行授信评估，确定本人是否满足监管机构要求及最终是否向本人放款，以实现本人的借款交易目的，本人授权被授权人将本人的个人识别信息、个人资质信息、个人账户信息（如涉及）共享给助贷/助融机构，同时授权助贷/助融机构基于前述目的收集、存储、使用、分析本人的个人信息。 \n" +
                    "    <br> 3、为了对本人的产品需求/偏好进行评估，并向本人推荐平台产品及服务，本人授权被授权人将本人的个人识别信息共享给广告及分析服务类提供商，同时授权广告及分析服务类提供商分析评估本人的产品需求/偏好，并将分析评估结果反馈给被授权人或者直接根据分析评估结果向本人拨打电话为本人推荐产品。 \n" +
                    "    <br> 4、为了对本人的信用状况进行评估，本人授权被授权人将本人的姓名、手机号码、身份证号共享给信用机构及数据服务商进行分析处理，并将处理后的信息分析结果反馈给被授权人，同时授权信用机构及数据服务商基于本人的前述个人信息获取本人的身份识别信息、风险识别信息、资质评估信息、表征信用情况的综合评估或信用评级，并将前述结果提供给被授权人。 \n" +
                    "    <br> 5、本人已经充分认识到本人的财产性信息对本人而言是私密且重要的信息（本授权书项下的财产性信息包括本人的住房性质、公积金情况、社保情况、车辆情况、月工资收入、商业保单情况、企业主情况、信用情况及个人账户信息），本人已经充分理解并知悉提供和使用财产性信息的风险，这些风险包括但不限于：纳入这些信息对本人的信用评级（评分）、信用报告等结果可能产生不利影响，该等信息被被授权人依法提供给第三方后被他人不当利用的风险，因本人的信用状况较好而造成本人被第三方推销产品或服务等打扰的风险等。 \n" +
                    "    <br> \n" +
                    "   </div> \n" +
                    "   <div class=\"mar-top-10 font-we\">\n" +
                    "    三、授权期限\n" +
                    "   </div> \n" +
                    "   <div class=\"mar-top-10\">\n" +
                    "     本授权书自本人签署时生效。授权期限自本授权书生效之日起至本人与被授权人的业务终止之日止， <span style=\"font-weight: bold\"> 但在授权有效期内被授权人已实施的行为及依其自身性质需在授权终止后实施或需持续实施的行为，不受授权终止的影响。本授权书具有独立法律效力，不因本人签署的任何业务合同或协议成立与否、效力状态变化（包括但不限于部分或全部条款无效或被撤销而无效或失效）的影响。 </span> \n" +
                    "   </div> \n" +
                    "   <br> \n" +
                    "   <div class=\"mar-top-10 font-we\">\n" +
                    "    四、争议解决\n" +
                    "   </div> \n" +
                    "   <div class=\"mar-top-10\">\n" +
                    "     若本人与被授权人发生任何纠纷或争议，应友好协商解决。 <span style=\"font-weight: bold\"> 协商解决不成的，本人同意将纠纷或争议提交至本授权书签订地（即重庆市两江新区）有管辖权的人民法院。 </span> \n" +
                    "   </div> \n" +
                    "   <br> \n" +
                    "   <div class=\"mar-top-10 font-we\">\n" +
                    "     五、本人已知悉本授权书所有内容（特别是加粗字体内容）的意义及由此产生的法律效力，自愿作出上述授权，本授权书是本人真实的意思表示，本人同意承担由此带来的一切法律后果。 \n" +
                    "   </div> \n" +
                    "   <br> \n" +
                    "   <div class=\"mar-top-10 font-we\"> \n" +
                    "    <p style=\"margin: 0; text-align: right\">登录账号:<span>222222222222222</span></p> \n" +
                    "    <p style=\"margin: 0; text-align: right\">uid:<span>kkkkkkk</span></p> \n" +
                    "   </div> \n" +
                    "   <br> \n" +
                    "   <div class=\"mar-top-10 font-we\">\n" +
                    "    六、附：机构列表\n" +
                    "   </div> \n" +
                    "   <table class=\"table\"> \n" +
                    "    <tr> \n" +
                    "     <th>\n" +
                    "      序号\n" +
                    "     </th> \n" +
                    "     <th>\n" +
                    "      机构类型\n" +
                    "     </th> \n" +
                    "     <th>\n" +
                    "      机构名称\n" +
                    "     </th> \n" +
                    "     <th>\n" +
                    "      共享个人信息范围\n" +
                    "     </th> \n" +
                    "     <th>\n" +
                    "      使用目的\n" +
                    "     </th> \n" +
                    "     <th>\n" +
                    "      官方电话\n" +
                    "     </th> \n" +
                    "    </tr>\n" +
                    "    <tr> \n" +
                    "     <td>\n" +
                    "      1\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      助贷/助融机构\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      新疆万鸿信息科技有限公司\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      姓名,手机号,IP,年龄,性别,所在城市,职业身份,教育程度,社保,公积金,房产,车产,个人保险,芝麻分,当前逾期情况,贷款金额,贷款期限,月收入,工资发放形式,月经营流水,月开票收入,营业执照,系统类型,信用卡\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      为您匹配贷款产品、服务机构或贷款咨询顾问\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      \n" +
                    "     </td> \n" +
                    "    </tr>\n" +
                    "<tr> \n" +
                    "     <td>\n" +
                    "      2\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      助贷/助融机构\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      上海侯曦信息科技有限公司\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      姓名,手机号,IP,年龄,性别,所在城市,职业身份,教育程度,社保,公积金,房产,车产,个人保险,芝麻分,当前逾期情况,贷款金额,贷款期限,月收入,工资发放形式,月经营流水,月开票收入,营业执照,系统类型,信用卡\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      为您匹配贷款产品、服务机构或贷款咨询顾问\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      \n" +
                    "     </td> \n" +
                    "    </tr>\n" +
                    "<tr> \n" +
                    "     <td>\n" +
                    "      3\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      助贷/助融机构\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      智博融资租赁（深圳）有限公司\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      姓名,手机号,IP,年龄,性别,所在城市,职业身份,教育程度,社保,公积金,房产,车产,个人保险,芝麻分,当前逾期情况,贷款金额,贷款期限,月收入,工资发放形式,月经营流水,月开票收入,营业执照,系统类型,信用卡\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      为您匹配贷款产品、服务机构或贷款咨询顾问\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      \n" +
                    "     </td> \n" +
                    "    </tr>\n" +
                    "<tr> \n" +
                    "     <td>\n" +
                    "      4\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      助贷/助融机构\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      恒昌众鼎融资租赁有限公司\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      姓名,手机号,IP,年龄,性别,所在城市,职业身份,教育程度,社保,公积金,房产,车产,个人保险,芝麻分,当前逾期情况,贷款金额,贷款期限,月收入,工资发放形式,月经营流水,月开票收入,营业执照,系统类型,信用卡\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      为您匹配贷款产品、服务机构或贷款咨询顾问\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      \n" +
                    "     </td> \n" +
                    "    </tr>\n" +
                    "<tr> \n" +
                    "     <td>\n" +
                    "      5\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      信用机构及数据服务商\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      杭州天谷信息科技有限公司\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      姓名、身份证号\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      实名认证\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      400-0878-198\n" +
                    "     </td> \n" +
                    "    </tr>\n" +
                    "<tr> \n" +
                    "     <td>\n" +
                    "      6\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      信用机构及数据服务商\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      贵州数据宝网络科技有限公司\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      姓名、手机号\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      手机号归属地检测、二要素认证、空号检测\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      400-0999-656\n" +
                    "     </td> \n" +
                    "    </tr>\n" +
                    "<tr> \n" +
                    "     <td>\n" +
                    "      7\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      信用机构及数据服务商\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      郑州埃文科技有限公司\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      IP地址\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      IP归属地检测\n" +
                    "     </td> \n" +
                    "     <td>\n" +
                    "      400-0371-911\n" +
                    "     </td> \n" +
                    "    </tr>\n" +
                    "   </table> \n" +
                    "   <div style=\"height: 60px\"></div> \n" +
                    "  </div>  \n" +
                    "  <script>\n" +
                    "    let appId = getQueryString(\"appId\");\n" +
                    "    let userId = getQueryString(\"userId\");\n" +
                    "    let phone = getQueryString(\"phone\");\n" +
                    "    let isAlliance = getQueryString(\"isAlliance\");\n" +
                    "\n" +
                    "    new Vue({\n" +
                    "      el: \"#protocolApp\",\n" +
                    "      data: {\n" +
                    "        appId: \"\",\n" +
                    "\n" +
                    "        // 用户相关\n" +
                    "        uid: \"\",\n" +
                    "        phone: \"\",\n" +
                    "        realName: \"\",\n" +
                    "        idCardNo: \"\",\n" +
                    "\n" +
                    "        // 公司相关\n" +
                    "        companyName: \"\",\n" +
                    "        actualOperator: \"\",\n" +
                    "\n" +
                    "        isAlliance: 1,\n" +
                    "        allianceId: \"\",\n" +
                    "        productId: [],\n" +
                    "        requestId: \"\",\n" +
                    "        channelCode: \"\",\n" +
                    "        productIdList: [],\n" +
                    "        alliancePlanList: [],\n" +
                    "        carPlanList: [],\n" +
                    "\n" +
                    "        // 机构列表\n" +
                    "        institutionList: [],\n" +
                    "        institutionTypeObj: {\n" +
                    "          0: \"助贷/助融机构\",\n" +
                    "          1: \"信用机构及数据服务商\",\n" +
                    "          2: \"助贷/助融机构\",\n" +
                    "        }, // 机构类型\n" +
                    "      },\n" +
                    "      methods: {\n" +
                    "        ParamsFn() {\n" +
                    "          var reg = /^(\\d{3})\\d{4}(\\d{4})$/;\n" +
                    "          const urlParams = new URLSearchParams(window.location.search);\n" +
                    "          const encodedParams = urlParams.get(\"params\");\n" +
                    "          console.log(encodedParams);\n" +
                    "          const params = JSON.parse(encodedParams);\n" +
                    "          console.log(\"params\", params);\n" +
                    "\n" +
                    "          if (appId) this.appId = appId;\n" +
                    "          if (userId) this.uid = userId;\n" +
                    "          if (phone) this.phone = (phone + \"\").replace(reg, \"$1****$2\");\n" +
                    "          if (isAlliance) this.isAlliance = isAlliance;\n" +
                    "\n" +
                    "          if (!params) return;\n" +
                    "\n" +
                    "          this.appId = params.appId;\n" +
                    "          this.companyName = params.companyName;\n" +
                    "          this.companyAddress = params.companyAddress;\n" +
                    "          this.phone = (params.phone + \"\").replace(reg, \"$1****$2\");\n" +
                    "          this.uid = params.uid;\n" +
                    "          this.idCardNo = params.idCardNo;\n" +
                    "          this.realName = params.realName;\n" +
                    "          this.productId = params.productId;\n" +
                    "          this.isAlliance = params.isAlliance;\n" +
                    "          this.allianceId = params.allianceId;\n" +
                    "          this.requestId = params.requestId;\n" +
                    "          this.channelCode = params.channelCode;\n" +
                    "          this.productIdList = params.productIdList || [];\n" +
                    "          this.alliancePlanList = params.alliancePlanList || [];\n" +
                    "          this.carPlanList = params.carPlanList || [];\n" +
                    "        },\n" +
                    "        async getAppinfo() {\n" +
                    "          try {\n" +
                    "            const res = await $.ajax({\n" +
                    "              url: `/api/v1/get/appinfo/`,\n" +
                    "              type: \"post\",\n" +
                    "            });\n" +
                    "\n" +
                    "            if (res.code === 0) {\n" +
                    "              this.companyName = res.data.companyName;\n" +
                    "              this.actualOperator = res.data.actualOperator;\n" +
                    "            }\n" +
                    "          } catch (error) {\n" +
                    "            console.error(\"获取应用信息失败:\", error);\n" +
                    "          }\n" +
                    "        },\n" +
                    "      },\n" +
                    "      async mounted() {\n" +
                    "        let _this = this;\n" +
                    "\n" +
                    "        _this.ParamsFn();\n" +
                    "\n" +
                    "        await _this.getAppinfo();\n" +
                    "\n" +
                    "        if (_this.isAlliance == 0) {\n" +
                    "          // 2024-11-13 新增接口\n" +
                    "          $.ajax({\n" +
                    "            url: baseRequestUrl + \"/alliance/unionProduct/agreementConfig\", // url\n" +
                    "            data: JSON.stringify({ planId: _this.allianceId }),\n" +
                    "            headers: { userId: _this.uid },\n" +
                    "            contentType: \"application/json\",\n" +
                    "            type: \"post\", // type 默认POST\n" +
                    "            async: false,\n" +
                    "            success: function (res) {\n" +
                    "              if (res.code == 0) {\n" +
                    "                _this.institutionList = res.data;\n" +
                    "              }\n" +
                    "            },\n" +
                    "            error: function (e) {\n" +
                    "              console.log(e);\n" +
                    "            },\n" +
                    "          });\n" +
                    "        } else if (_this.isAlliance == 1) {\n" +
                    "          // 同业联盟接口\n" +
                    "          $.ajax({\n" +
                    "            url: baseRequestUrl + \"/alliance/agreementConfig\", // url\n" +
                    "            type: \"get\", // type 默认POST\n" +
                    "            async: false,\n" +
                    "            success: function (res) {\n" +
                    "              console.log(res, \"同业联盟\");\n" +
                    "              if (res.code == 0) {\n" +
                    "                // 同业联盟数据\n" +
                    "                console.log(\"同业联盟数据\", res.data);\n" +
                    "                _this.institutionList = res.data;\n" +
                    "              }\n" +
                    "            },\n" +
                    "            error: function (e) {\n" +
                    "              console.log(e);\n" +
                    "            },\n" +
                    "          });\n" +
                    "        } else if (_this.isAlliance == 2) {\n" +
                    "          // requestId\n" +
                    "          let data = {\n" +
                    "            allianceId: _this.allianceId,\n" +
                    "          };\n" +
                    "          if (_this.requestId) {\n" +
                    "            data.requestId = _this.requestId;\n" +
                    "          }\n" +
                    "          // 新卖量接口\n" +
                    "          $.ajax({\n" +
                    "            url: baseRequestUrl + \"/alliance/newModel/agreementConfig/v2\",\n" +
                    "            data: JSON.stringify(data),\n" +
                    "            headers: { userId: _this.uid },\n" +
                    "            contentType: \"application/json\",\n" +
                    "            type: \"post\", // type 默认POST\n" +
                    "            async: false,\n" +
                    "            success: function (res) {\n" +
                    "              if (res.code === 0) {\n" +
                    "                console.log(\"新同业联盟卖量请求结果\", res);\n" +
                    "                _this.institutionList = res.data;\n" +
                    "              }\n" +
                    "            },\n" +
                    "          });\n" +
                    "        } else if (_this.isAlliance == 3) {\n" +
                    "          let url = baseRequestUrl + \"/h5/car/loan/agreementConfig\";\n" +
                    "          if (_this.allianceId) {\n" +
                    "            url += `?productPlanId=`;\n" +
                    "          }\n" +
                    "          $.ajax({\n" +
                    "            url,\n" +
                    "            async: false,\n" +
                    "            type: \"get\",\n" +
                    "            success: function (res) {\n" +
                    "              if (res.code === 0) {\n" +
                    "                console.log(\"车抵贷协议请求结果\", res);\n" +
                    "                _this.institutionList = res.data;\n" +
                    "              }\n" +
                    "            },\n" +
                    "            error: function (e) {\n" +
                    "              console.error(\"车抵贷协议请求错误\", e);\n" +
                    "            },\n" +
                    "          });\n" +
                    "        } else if (_this.isAlliance == 4) {\n" +
                    "          // 极速贷\n" +
                    "          let url = baseRequestUrl + \"/h5/fast/agreementConfig\";\n" +
                    "          if (_this.allianceId) {\n" +
                    "            url += `?productPlanId=`;\n" +
                    "          }\n" +
                    "\n" +
                    "          $.ajax({\n" +
                    "            url,\n" +
                    "            async: false,\n" +
                    "            type: \"get\",\n" +
                    "            success: function (result) {\n" +
                    "              if (result.code == 0) {\n" +
                    "                _this.institutionList = result.data;\n" +
                    "              }\n" +
                    "            },\n" +
                    "            error: function (error) {\n" +
                    "              console.error(\"极速贷协议请求错误\", error);\n" +
                    "            },\n" +
                    "          });\n" +
                    "        } else if (_this.isAlliance === 5) {\n" +
                    "          // 房抵贷\n" +
                    "          let url = baseRequestUrl + \"/h5/house/loan/agreementConfig\";\n" +
                    "\n" +
                    "          if (_this.allianceId) {\n" +
                    "            url += `?productPlanId=`;\n" +
                    "          }\n" +
                    "          $.ajax({\n" +
                    "            url,\n" +
                    "            async: false,\n" +
                    "            type: \"get\",\n" +
                    "            success: function (res) {\n" +
                    "              if (res.code === 0) {\n" +
                    "                console.log(\"房抵贷协议请求结果\", res);\n" +
                    "                _this.institutionList = res.data;\n" +
                    "              }\n" +
                    "            },\n" +
                    "            error: function (e) {\n" +
                    "              console.error(\"房抵贷协议请求错误\", e);\n" +
                    "            },\n" +
                    "          });\n" +
                    "        } else {\n" +
                    "          let params = {};\n" +
                    "\n" +
                    "          // -2 同业产品授权页 -3 助贷授权页\n" +
                    "          if (_this.isAlliance == -2 || _this.isAlliance == -3) {\n" +
                    "            if (_this.productIdList.length) params.productIdList = _this.productIdList;\n" +
                    "            if (_this.alliancePlanList.length) params.alliancePlanList = _this.alliancePlanList;\n" +
                    "            if (_this.carPlanList.length) params.carPlanList = _this.carPlanList;\n" +
                    "\n" +
                    "            if (_this.channelCode) params.channelCode = _this.channelCode;\n" +
                    "          } else {\n" +
                    "            params.productIdList = _this.productId;\n" +
                    "          }\n" +
                    "\n" +
                    "          const data = JSON.stringify(params);\n" +
                    "          $.ajax({\n" +
                    "            url: baseRequestUrl + \"/agreement/product/showAgreement\",\n" +
                    "            type: \"post\",\n" +
                    "            async: false,\n" +
                    "            contentType: \"application/json\",\n" +
                    "            data,\n" +
                    "            headers: { userId: _this.uid },\n" +
                    "            success: function (res) {\n" +
                    "              if (res.code == 0) {\n" +
                    "                _this.institutionList = res.data;\n" +
                    "              }\n" +
                    "            },\n" +
                    "            error: function (err) {\n" +
                    "              console.log(\"个人信息授权书产品部分获取失败\", err);\n" +
                    "            },\n" +
                    "          });\n" +
                    "        }\n" +
                    "      },\n" +
                    "    });\n" +
                    "  </script> \n" +
                    " </body>\n" +
                    "</html>";

            html="<!doctype html>\n" +
                    "<html lang=\"en\"> \n" +
                    " <head> \n" +
                    "  <meta charset=\"utf-8\"> \n" +
                    "  <meta content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\" name=\"viewport\"> \n" +
                    "  <meta name=\"format-detection\" content=\"telephone=no\"> \n" +
                    "  <meta content=\"yes\" name=\"apple-mobile-web-app-capable\"> \n" +
                    "  <meta content=\"yes\" name=\"apple-touch-fullscreen\"> \n" +
                    "  <meta content=\"black\" name=\"apple-mobile-web-app-status-bar-style\"> \n" +
                    "  <link rel=\"stylesheet\" href=\"css/common.css\"> \n" +
                    "  <script type=\"text/javascript\" src=\"https://loansm.oss-cn-hangzhou.aliyuncs.com/js/jquery-2.2.3.min.js\"></script> \n" +
                    "  <script type=\"text/javascript\" src=\"https://common-libs-web.oss-cn-hangzhou.aliyuncs.com/mobile-detect.min.js\"></script> \n" +
                    "  <script type=\"text/javascript\" src=\"https://loansm.oss-cn-hangzhou.aliyuncs.com/js/vue2.js\"></script> \n" +
                    "  <script type=\"text/javascript\" src=\"../../src/js/tools.js\"></script> \n" +
                    "  <script type=\"text/javascript\" src=\"../../src/js/config.js\"></script> \n" +
                    "  <title>个人信息共享授权书</title> \n" +
                    "  <style>\n" +
                    "    </style> \n" +
                    " </head> \n" +
                    " <body> \n" +
                    "  <div class=\"container\" id=\"app\"> \n" +
                    "   <p class=\"MsoNormal\" align=\"center\" style=\"text-align:center;font-family:DengXian;font-size:12px;\"> <b><span style=\"font-family:华文宋体;line-height:35.2px;font-size:22px;\">个人信息共享授权书</span></b><span style=\"font-family:华文宋体;line-height:35.2px;font-size:22px;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\"> <b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">重要提示：</span></b><b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span></b> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\"> <b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"><span>为维护您（以下简称</span>“本人”或“您”）的合法权益，请在线签署《个人信息共享授权书》（以下简称“本授权书”）前，仔细阅读、充分理解本授权书各条款内容，特别是免除或减轻</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">张三</span><b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"><span>（以下简称</span>“被授权人”）责任</span></b><b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">，或限制您权利的条款，其中免除或减轻责任条款将以黑体加粗形式提示您。您点击本授权书所在页面按钮并进入下一页面或勾选本授权书即视为您已阅读本授权书，并同意接受本授权书条款的约束，本授权书即完成在线签署并生效。</span></b><b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span></b> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\"> <b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\"><span>本人姓名：</span>李四</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\"> <b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\"><span>本人身份证号码：</span>1212121211111</span></b><b><i><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span></i></b><b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">（为了保护您的个人信息，本授权书在向您展示时将部分隐藏您的身份信息，您的身份信息详情以您在本平台账户对应的实名信息为准）</span><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">&nbsp;</span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\"> <b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">一、定义</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">1、个人信息，指您的如下信息：</span><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"><span>（</span>1）</span><b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">个人识别信息</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">，指您的</span><b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">手机号码、微信号</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"><span>，以及平台通过向您申请电话状态权限</span>/IDFA权限、位置权限（如涉及）而收集的您的</span><b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\"><span>唯一设备识别码（</span>IMEI、IMSI）、IP地址、地理位置。</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"><span>（</span>2）</span><b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">个人资质信息</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">，指您的</span><b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\"><span>姓名、年龄、户籍、现居住地址、婚姻状况、配偶信息（如涉及）、常用邮箱地址、房产情况（房产类型、房产价值等）、车辆情况（车辆品牌、车辆价值等）、工资发放形式、教育程度、信用情况（芝麻信用分、逾期信息等）、社保情况、公积金情况、信用卡情况、商业保单情况、月工资收入、职业类型、经营企业情况、单位</span>/公司名称、单位/公司电话、单位/公司地址、单位/公司性质、紧急联系人信息、贷款用途（具体以您在页面实际填写的信息为准）</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">。其中</span><b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">紧急联系人信息指您与紧急联系人的关系、紧急联系人的姓名及电话</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">，配偶信息指</span><b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">您配偶的姓名、身份证号、工作电话及联系电话</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">。</span><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"><span>（</span>3）</span><b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">个人账户信息</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">，指您的</span><b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">银行卡号、开户行、开户行地址、预留手机号。</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">2、贷款机构，指提供贷款产品的贷款服务机构，包括安庆市银谷小额贷款有限责任公司，及本平台合作机构，具体见本授权书合作机构列表。</span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px; font-weight: 400;\"> 3、广告及分析服务类提供商，指受被授权人委托对您的产品需求/偏好进行评估， 并向您推荐您需要的贷款产品及服务的第三方机构，具体详见本协议附件所列的第三方公司。 </span> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px; font-weight: normal;\">4、信用机构及数据服务商，指基于被授权人委托，向被授权人提供您的身份识别信息、风险识别信息、资质评估信息、表征信用情况的综合评分或信用评级的第三方机构，具体详见本协议附件所列的第三方公司。</span><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">&nbsp;</span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\"> <b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">二、授权内容</span></b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">1、 在平台为您提供服务过程中，为了便于平台贷款机构根据您的资信情况对您进行授信评估，您授权被授权人收集并存储您提交的个人信息。</span></b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">2、为了便于贷款机构确定您是否满足监管机构要求及最终是否向您放款，以实现您的借款交易目的，您授权被授权人将您的个人识别信息、个人资质信息、个人账户信息（如涉及）共享给贷款机构，同时授权贷款机构基于前述目的收集、存储、使用、分析您的个人信息。</span></b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">3、为了对您的产品需求/偏好进行评估，并向您推荐平台产品及服务，您授权被授权人将您的个人识别信息共享给广告及分析服务类提供商，同时授权广告及分析服务类提供商分析评估您的产品需求/偏好，并将分析评估结果反馈给被授权人或者直接根据分析评估结果向您拨打电话为您推荐产品。</span></b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">4、为了对您的信用状况进行评估，以为您提供您选择的金融产品或服务，您授权被授权人将您的姓名、手机号码、身份证号共享给信用机构及数据服务商进行分析处理，并将处理后的信息分析结果反馈给被授权人，同时授权信用机构及数据服务商基于您的前述个人信息获取您的身份识别信息、风险识别信息、资质评估信息、表征信用情况的综合评估或信用评级，并将前述结果提供给被授权人。</span></b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">5、您已经充分认识到您的财产性信息对您而言是私密且重要的信息（本授权书项下的财产性信息包括您的住房性质、公积金情况、社保情况、车辆情况、月工资收入、商业保单情况、企业主情况、信用情况及个人账户信息），您已经充分理解并知悉提供和使用财产性信息的风险，这些风险包括但不限于：纳入这些信息对您的信用评级（评分）、信用报告等结果可能产生不利影响，该等信息被被授权人依法提供给第三方后被他人不当利用的风险，因您的信用状况较好而造成您被第三方推销产品或服务等打扰的风险等。</span></b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">&nbsp;</span> </p> <!-- 新增同业联盟协议 --> \n" +
                    "   <p> </p>\n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\"> <b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">三、个人信息的共享</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> </p> <b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span><b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"> 为了根据您的需求进行更好的风控/贷款额度评估，您授权同意我们将收集的个人信息共享给如下合作机构： </span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> \n" +
                    "   <table border cellspacing=\"0\" width=\"100%\"> \n" +
                    "    <thead> \n" +
                    "     <tr> \n" +
                    "      <th> 产品名称 </th> \n" +
                    "      <th> 共享信息目的 </th> \n" +
                    "      <th> 共享个人信息范围 </th> \n" +
                    "      <th> 授权公司全称 </th> \n" +
                    "      <th> 官方电话 </th> \n" +
                    "      <th> 共享方式 </th> \n" +
                    "      <th>相关协议</th> \n" +
                    "     </tr> \n" +
                    "    </thead> <!-- 循环数据 allianceList --> \n" +
                    "    <tbody>\n" +
                    "     <tr null> \n" +
                    "      <td> <!-- 机构简称1 --> 银谷E贷 </td> \n" +
                    "      <td> <!-- 共享信息目的1 --> 实名认证，匹配借款需求、额度评估 </td> \n" +
                    "      <td> <!-- 共享个人信息范围1 --> 姓名,手机号,IP,年龄,性别,所在城市,职业身份,教育程度,社保,公积金,房产,车产,个人保险,芝麻分,当前逾期情况,贷款金额,贷款期限,月收入,工资发放形式,月经营流水,月开票收入,营业执照,系统类型,信用卡 </td> \n" +
                    "      <td> <!-- 授权公司全称 1 --> 安庆市银谷小额贷款有限责任公司 </td> \n" +
                    "      <td> <!-- 官方电话1 --> 400-963-8005 </td> \n" +
                    "      <td> <!-- 共享方式1 --> 后台接口传输 </td> \n" +
                    "      <td> \n" +
                    "        \n" +
                    "       <template v-else> \n" +
                    "        <div>\n" +
                    "         /\n" +
                    "        </div> \n" +
                    "       </template> </td> \n" +
                    "     </tr> <tr null> \n" +
                    "      <td> <!-- 机构简称1 --> 吉分期 </td> \n" +
                    "      <td> <!-- 共享信息目的1 --> 实名认证，匹配借款需求、额度评估 </td> \n" +
                    "      <td> <!-- 共享个人信息范围1 --> 姓名,手机号,IP,年龄,性别,所在城市,职业身份,教育程度,社保,公积金,房产,车产,个人保险,芝麻分,当前逾期情况,贷款金额,贷款期限,月收入,工资发放形式,月经营流水,月开票收入,营业执照,系统类型,信用卡 </td> \n" +
                    "      <td> <!-- 授权公司全称 1 --> 河池市铠丰小额贷款有限责任公司 </td> \n" +
                    "      <td> <!-- 官方电话1 --> 18977813333 </td> \n" +
                    "      <td> <!-- 共享方式1 --> 后台接口传输 </td> \n" +
                    "      <td> \n" +
                    "        \n" +
                    "       <template v-else> \n" +
                    "        <div>\n" +
                    "         /\n" +
                    "        </div> \n" +
                    "       </template> </td> \n" +
                    "     </tr> \n" +
                    "    </tbody>\n" +
                    "   </table> \n" +
                    "   <p></p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\"> <b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">四、授权期限</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px; font-weight: normal;\">本授权书自您签署时生效。授权期限自本授权书生效之日起至您与我们的业务终止之日止，</span><b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">但在授权有效期内我们已实施的行为及依其自身性质需在授权终止后实施或需持续实施的行为，不受授权终止的影响。本授权书具有独立法律效力，不因您签署的任何业务合同或协议成立与否、效力状态变化（包括但不限于部分或全部条款无效或被撤销而无效或失效）的影响。</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">&nbsp;</span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\"> <b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">五、争议解决</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px; font-weight: normal;\">若本人与被授权人发生任何纠纷或争议，应友好协商解决。</span><b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">协商解决不成的，本人同意将纠纷或争议提交至本授权书签订地（即重庆市两江新区）有管辖权的人民法院</span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">。</span><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">&nbsp;</span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\"> <b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">六、本人已知悉本授权书所有内容（特别是加粗字体内容）的意义及由此产生的法律效力，自愿作出上述授权，本授权书是本人真实的意思表示，本人同意承担由此带来的一切法律后果。</span></b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" align=\"right\" style=\"text-align:right;font-family:DengXian;font-size:12px;\"> <span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\">&nbsp;</span> </p> \n" +
                    "   <p class=\"MsoNormal\" align=\"right\" style=\"text-align:right;font-family:DengXian;font-size:12px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px; font-weight: normal;\"><span>您的登录账号：</span></span><b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"> 222222222222222 </span></b><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span> </p> \n" +
                    "   <p class=\"MsoNormal\" align=\"right\" style=\"text-align:right;font-family:DengXian;font-size:12px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px; font-weight: normal;\"><span>您的</span>UID：</span><span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">kkkkkkk</span> </p> \n" +
                    "   <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;\"> <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\">&nbsp;</span> </p> <!-- <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\">\n" +
                    "            <b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\"><span>七、</span>\n" +
                    "                    <span>附件：</span></span></b><span style=\"line-height:22.4px;font-size:14px; font-weight: 700;\"></span>\n" +
                    "        </p>\n" +
                    "        <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\">\n" +
                    "            <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px; font-weight: normal;\">广告及分析服务类提供商的名称及联系方式：</span><span\n" +
                    "                style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span>\n" +
                    "        </p>\n" +
                    "        <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\">\n" +
                    "            <span\n" +
                    "                style=\"font-family:华文宋体;line-height:22.4px;font-size:14px; font-weight: normal;\"><span>（</span>1）海尔消费金融有限公司（山东省青岛市崂山区海尔路1号甲1号楼）；</span><span\n" +
                    "                style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span>\n" +
                    "        </p>\n" +
                    "        <p class=\"MsoNormal\" style=\"font-family:DengXian;font-size:12px;text-indent:21px;\">\n" +
                    "            <span style=\"font-family:华文宋体;line-height:22.4px;font-size:14px; font-weight: normal;\">联系方式：400-0878-198</span><span\n" +
                    "                style=\"font-family:华文宋体;line-height:22.4px;font-size:14px;\"></span>\n" +
                    "        </p> --> \n" +
                    "   <div style=\"height: 200px;\"> \n" +
                    "   </div> \n" +
                    "  </div> \n" +
                    "  <script>\n" +
                    "        let userId = getQueryString('userId') || 1256\n" +
                    "        let appId = getQueryString('appId') || 106\n" +
                    "        let uid = getQueryString('userId') ? getQueryString('userId') : ''\n" +
                    "        var reg = /^(\\d{3})\\d{4}(\\d{4})$/;\n" +
                    "        let phone = getQueryString('phone') ? getQueryString('phone').replace(reg, \"$1****$2\") : ''\n" +
                    "        new Vue({\n" +
                    "            el: '#app',\n" +
                    "            data: {\n" +
                    "                appName: '惠融钱包',\n" +
                    "                companyName: '重庆惠融数字科技有限公司',\n" +
                    "                realName: '',\n" +
                    "                idCardNo: '',\n" +
                    "                certifyTime: '',\n" +
                    "                phone: '',\n" +
                    "                uid: '',\n" +
                    "                allianceList: [\n" +
                    "                    {\n" +
                    "                        name: '银谷E贷',\n" +
                    "                        sharePurpose: '实名认证，匹配借款需求、额度评估',\n" +
                    "                        shareRange: '姓名,手机号,IP,年龄,性别,所在城市,职业身份,教育程度,社保,公积金,房产,车产,个人保险,芝麻分,当前逾期情况,贷款金额,贷款期限,月收入,工资发放形式,月经营流水,月开票收入,营业执照,系统类型,信用卡',\n" +
                    "                        shareCompanyFullName: '安庆市银谷小额贷款有限责任公司',\n" +
                    "                        companyMobile: '400-963-8005',\n" +
                    "                        shareType: '后台接口传输',\n" +
                    "                        aggreementConfigVOS: null\n" +
                    "                    },\n" +
                    "                    {\n" +
                    "                        name: '吉分期',\n" +
                    "                        sharePurpose: '实名认证，匹配借款需求、额度评估',\n" +
                    "                        shareRange: '姓名,手机号,IP,年龄,性别,所在城市,职业身份,教育程度,社保,公积金,房产,车产,个人保险,芝麻分,当前逾期情况,贷款金额,贷款期限,月收入,工资发放形式,月经营流水,月开票收入,营业执照,系统类型,信用卡',\n" +
                    "                        shareCompanyFullName: '河池市铠丰小额贷款有限责任公司',\n" +
                    "                        companyMobile: '18977813333',\n" +
                    "                        shareType: '后台接口传输',\n" +
                    "                        aggreementConfigVOS: null\n" +
                    "                    },\n" +
                    "                    // {\n" +
                    "                    //     name: '闪钱借款',\n" +
                    "                    //     sharePurpose: '实名认证，匹配借款需求、额度评估',\n" +
                    "                    //     shareRange: '姓名,手机号,IP,年龄,性别,所在城市,职业身份,教育程度,社保,公积金,房产,车产,个人保险,芝麻分,当前逾期情况,贷款金额,贷款期限,月收入,工资发放形式,月经营流水,月开票收入,营业执照,系统类型,信用卡',\n" +
                    "                    //     shareCompanyFullName: '山西安易信互联网小额贷款有限公司',\n" +
                    "                    //     companyMobile: '0357-2223353',\n" +
                    "                    //     shareType: '后台接口传输'\n" +
                    "                    // },\n" +
                    "                    // {\n" +
                    "                    //     name: '期贷',\n" +
                    "                    //     sharePurpose: '实名认证，匹配借款需求、额度评估',\n" +
                    "                    //     shareRange: '姓名,手机号,IP,年龄,性别,所在城市,职业身份,教育程度,社保,公积金,房产,车产,个人保险,芝麻分,当前逾期情况,贷款金额,贷款期限,月收入,工资发放形式,月经营流水,月开票收入,营业执照,系统类型,信用卡',\n" +
                    "                    //     shareCompanyFullName: '重庆两江新区通融小额贷款有限公司',\n" +
                    "                    //     companyMobile: '023-88151333',\n" +
                    "                    //     shareType: '后台接口传输',\n" +
                    "                    //     aggreementConfigVOS: [\n" +
                    "                    //         {\n" +
                    "                    //             showName: '服务协议',\n" +
                    "                    //             showUrl: 'https://h5.bicredit.xin/view/agreement/external/qd-server.html'\n" +
                    "                    //         },\n" +
                    "                    //         {\n" +
                    "                    //             showName: '隐私政策',\n" +
                    "                    //             showUrl: 'https://h5.bicredit.xin/view/agreement/external/qd.html'\n" +
                    "                    //         }\n" +
                    "                    //     ]\n" +
                    "                    // }\n" +
                    "                ],// 同业联盟数据\n" +
                    "            },\n" +
                    "            mounted: function () {\n" +
                    "                console.log('uidl',uid)\n" +
                    "                this.phone = phone\n" +
                    "                this.uid = uid\n" +
                    "                let _this = this;\n" +
                    "                $.ajax({\n" +
                    "                    url: baseRequestUrl + '/api/v1/get/appinfo/' + appId, // url\n" +
                    "                    type: 'post', // type 默认POST\n" +
                    "                    async: false,\n" +
                    "                    success: function (res) {\n" +
                    "                        if (res.code === 0) {\n" +
                    "                            _this.appName = res.data.appName ? res.data.appName : '惠融钱包'\n" +
                    "                            _this.companyName = res.data.companyName ? res.data.companyName : '重庆惠融数字科技有限公司'\n" +
                    "                        }\n" +
                    "                    },\n" +
                    "                    error: function (e) {\n" +
                    "                        console.log(e)\n" +
                    "                    }\n" +
                    "                });\n" +
                    "\n" +
                    "                $.ajax({\n" +
                    "                    url: baseRequestUrl + '/api/v1/get/realinfo/' + userId, // url\n" +
                    "                    type: 'post', // type 默认POST\n" +
                    "                    async: false,\n" +
                    "                    success: function (res) {\n" +
                    "                        console.log(res, 'res')\n" +
                    "                        if (res.code === 0 && res.data) {\n" +
                    "                            _this.realName = res.data.realName ? res.data.realName : ''\n" +
                    "                            _this.idCardNo = res.data.idCardNo ? res.data.idCardNo : ''\n" +
                    "                            _this.certifyTime = res.data.certifyTime ? res.data.certifyTime : ''\n" +
                    "                        }\n" +
                    "                    },\n" +
                    "                    error: function (e) {\n" +
                    "                        console.log(e)\n" +
                    "                    }\n" +
                    "                });\n" +
                    "                // 同业联盟接口\n" +
                    "                // $.ajax({\n" +
                    "                //     url: baseRequestUrl + '/alliance/agreementConfig', // url\n" +
                    "                //     type: 'get', // type 默认POST\n" +
                    "                //     async: false,\n" +
                    "                //     success: function (res) {\n" +
                    "                //         console.log(res, '同业联盟')\n" +
                    "                //         if (res.code == 0) {\n" +
                    "                //             // 同业联盟数据\n" +
                    "                //             console.log('同业联盟数据', res.data)\n" +
                    "                //             _this.allianceList = res.data\n" +
                    "                //         }\n" +
                    "                //     },\n" +
                    "                //     error: function (e) {\n" +
                    "                //         console.log(e)\n" +
                    "\n" +
                    "                //     }\n" +
                    "                // });\n" +
                    "            },\n" +
                    "            methods: {\n" +
                    "                idCardFn(idCard) {\n" +
                    "                    let reg = /^(.{4})(?:\\d+)(.{2})$/\n" +
                    "                    return idCard.replace(reg, '\\$1**********\\$2') || ''\n" +
                    "                },\n" +
                    "                noPassByName(str) {\n" +
                    "                    if (null != str && str != undefined) {\n" +
                    "                        if (str.length == 2) {\n" +
                    "                            return str.substring(0, 1) + '*' //截取name 字符串截取第一个字符，\n" +
                    "                        } else if (str.length == 3) {\n" +
                    "                            return str.substring(0, 1) + \"*\" + str.substring(2, 3)//截取第一个和第三个字符\n" +
                    "                        } else if (str.length > 3) {\n" +
                    "                            return str.substring(0, 1) + \"*\" + '*' + str.substring(3, str.length)//截取第一个和大于第4个字符\n" +
                    "                        }\n" +
                    "                    } else {\n" +
                    "                        return \"\";\n" +
                    "                    }\n" +
                    "                },\n" +
                    "            }\n" +
                    "        })\n" +
                    "\n" +
                    "\n" +
                    "    </script>  \n" +
                    " </body>\n" +
                    "</html>";
            Map<String, Object> paramMap = new HashMap<>();
            paramMap.put("title", title);
            paramMap.put("text", text);
            //获取查询结果
            for (Map.Entry<String, Object> entry : paramMap.entrySet()) {
                //替换标签值内容
                if (StringUtils.isNotEmpty(html)) {
                    html = html.replace("${" + entry.getKey() + "}$", entry.getValue().toString());
                }
            }
            //此处填写你下载的地方
            String fileName = UUID.randomUUID().toString() + ".pdf";
            String fileAbsolutePath = filePath + fileName;
            jt.doConversion(html, fileAbsolutePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * 将html里面的标签内容替换成指定内容，并转换成pdf，返回pdf文件的路径
     *
     * @param paramMap  指定内容
     * @param html      html字符串
     * @param localPath 本地目录
     * @return pdf文件的路径
     */
    public static String htmlStr2PDF(Map<String, Object> paramMap, String html, String localPath) {
        String fileAbsolutePath = "";
        try {
            HtmlToPDFUtil jt = new HtmlToPDFUtil();
            for (Map.Entry<String, Object> entry : paramMap.entrySet()) {
                //替换标签值内容
                if (StringUtils.isNotEmpty(html)) {
                    html = html.replace("${" + entry.getKey() + "}$", entry.getValue().toString());
                }
            }
            // 此处填写pdf文件的路径
            String fileName = UUID.randomUUID().toString() + ".pdf";
            fileAbsolutePath = localPath + fileName;
            jt.doConversion(html, fileAbsolutePath);
            return fileAbsolutePath;
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }

    }

    public byte[] doConversion(String htmlDocument) throws InvalidParameterException, IOException {
        PD4ML pd4ml = new PD4ML();
        pd4ml.enableDebugInfo();
        pd4ml.setHtmlWidth(userSpaceWidth);
        pd4ml.setPageSize(pd4ml.changePageOrientation(PD4Constants.A4));
        pd4ml.setPageInsetsMM(new Insets(topValue, leftValue, bottomValue, rightValue));
        pd4ml.addStyle("BODY {margin: 0; font-family:MSJH;}", true);//background:#111;
        pd4ml.addStyle(".table {display: flex;flex-direction: column;width: 100%;height: auto;gap: 0;border: 1px solid #333;}",true);
        pd4ml.addStyle(".table .table-label {width: 100%;font-weight: 600;display: grid;grid-template-columns: 30px 40px 40px 1fr 1fr 30px;}",true);
        pd4ml.addStyle(".table .table-row {width: 100%;display: grid;grid-template-columns: 30px 40px 40px 1fr 1fr 30px;}",true);
        pd4ml.addStyle(".table .table-row div {display: flex;justify-content: center;align-items: center;box-sizing: border-box;border: 1px solid #333;height: auto;line-height: 1.5;word-break: break-all;}",true);
        pd4ml.addStyle("/* 表格整体样式 */\n" +
                "        table {\n" +
                "            width: 100%; /* 表格宽度占满父容器 */\n" +
                "            border-collapse: collapse; /* 合并边框 */\n" +
                "            text-align: center; /* 文字居中对齐 */\n" +
                "        }\n" +
                "\n" +
                "        /* 表头样式 */\n" +
                "        th {\n" +
                "             text-align:center; "+
                "            font-weight: bold; /* 加粗 */\n" +
                "            border: 1px solid #333; /* 边框 */\n" +
                "        }\n" +
                "\n" +
                "        /* 表格单元格样式 */\n" +
                "        td {\n" +
                "       text-align: center; vertical-align: middle;"+
                "            border: 1px solid #333; /* 边框 */\n" +
                "        }\n" +
//                "\n" +
//                "        /* 表格行样式 */\n" +
//                "        tr:nth-child(even) {\n" +
//                "            background-color: #f9f9f9; /* 偶数行背景颜色（浅灰色） */\n" +
//                "        }\n" +
//                "\n" +
                "        /* 表格标题样式 */\n" +
                "        caption {\n" +
                "            font-weight: bold; /* 加粗 */\n" +
                "        }",true);
        String classPath = HtmlToPDFUtil.class.getResource("/") + "fonts";
        pd4ml.useTTF(classPath, true);
        pd4ml.setDefaultTTFs("SimSun", "SimSun", "SimSun");
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        pd4ml.render(new StringReader(htmlDocument), byteArrayOutputStream);
        byteArrayOutputStream.close();
        return byteArrayOutputStream.toByteArray();
    }

    /**
     * 将字符串形式的html转换成pdf
     *
     * @param htmlDocument 字符串形式的html
     * @param outputPath   转换成pdf的存放位置
     * @throws InvalidParameterException
     * @throws IOException
     */
    public void doConversion(String htmlDocument, String outputPath) throws InvalidParameterException, IOException {
        PD4ML pd4ml = new PD4ML();
        pd4ml.enableDebugInfo();
        pd4ml.setHtmlWidth(userSpaceWidth);
        pd4ml.setPageSize(pd4ml.changePageOrientation(PD4Constants.A4));
        pd4ml.setPageInsetsMM(new Insets(topValue, leftValue, bottomValue, rightValue));
        pd4ml.addStyle("BODY {margin: 0; font-family:MSJH;}", true);//background:#111;
        pd4ml.addStyle(".table {display: flex;flex-direction: column;width: 100%;height: auto;gap: 0;border: 1px solid #333;}",true);
        pd4ml.addStyle(".table .table-label {width: 100%;font-weight: 600;display: grid;grid-template-columns: 30px 40px 40px 1fr 1fr 30px;}",true);
        pd4ml.addStyle(".table .table-row {width: 100%;display: grid;grid-template-columns: 30px 40px 40px 1fr 1fr 30px;}",true);
        pd4ml.addStyle(".table .table-row div {display: flex;justify-content: center;align-items: center;box-sizing: border-box;border: 1px solid #333;height: auto;line-height: 1.5;word-break: break-all;}",true);
        pd4ml.addStyle("/* 表格整体样式 */\n" +
                "        table {\n" +
                "            width: 100%; /* 表格宽度占满父容器 */\n" +
                "            border-collapse: collapse; /* 合并边框 */\n" +
                "            text-align: center; /* 文字居中对齐 */\n" +
                "        }\n" +
                "\n" +
                "        /* 表头样式 */\n" +
                "        th {\n" +
                "             text-align:center; "+
                "            font-weight: bold; /* 加粗 */\n" +
                "            border: 1px solid #333; /* 边框 */\n" +
                "        }\n" +
                "\n" +
                "        /* 表格单元格样式 */\n" +
                "        td {\n" +
                "       text-align: center; vertical-align: middle;"+
                "            border: 1px solid #333; /* 边框 */\n" +
                "        }\n" +
//                "\n" +
//                "        /* 表格行样式 */\n" +
//                "        tr:nth-child(even) {\n" +
//                "            background-color: #f9f9f9; /* 偶数行背景颜色（浅灰色） */\n" +
//                "        }\n" +
//                "\n" +
                "        /* 表格标题样式 */\n" +
                "        caption {\n" +
                "            font-weight: bold; /* 加粗 */\n" +
                "        }",true);
        String classPath = HtmlToPDFUtil.class.getResource("/") + "fonts";
        pd4ml.useTTF(classPath, true);
        pd4ml.setDefaultTTFs("SimSun", "SimSun", "SimSun");
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        pd4ml.render(new StringReader(htmlDocument), byteArrayOutputStream);
        byteArrayOutputStream.close();
        File output = new File(outputPath);
        FileOutputStream fos = new FileOutputStream(output);
        fos.write(byteArrayOutputStream.toByteArray());
        fos.close();
    }

    /**
     * 将 html文件读取成字符串
     *
     * @param path     html文件位置
     * @param encoding 编码格式
     * @return 字符串
     * @throws IOException
     */
    private static String readFile(String path, String encoding) throws IOException {
        File f = new File(path);
        FileInputStream is = new FileInputStream(f);
        BufferedInputStream bis = new BufferedInputStream(is);
        ByteArrayOutputStream fos = new ByteArrayOutputStream();
        byte[] buffer = new byte[2048];
        int read;
        do {
            read = is.read(buffer, 0, buffer.length);
            if (read > 0) {
                fos.write(buffer, 0, read);
            }
        } while (read > -1);
        fos.close();
        bis.close();
        is.close();
        return fos.toString(encoding);
    }

}