生成pdf

This commit is contained in:
mx 2024-10-14 17:13:05 +08:00
parent 84399d2c6b
commit 9f53101a20
26 changed files with 584 additions and 141 deletions

BIN
doc/Deng.ttf Normal file

Binary file not shown.

BIN
doc/Dengb.ttf Normal file

Binary file not shown.

BIN
doc/Dengl.ttf Normal file

Binary file not shown.

BIN
doc/gb2312.ttf Normal file

Binary file not shown.

BIN
doc/image/cs-all.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

BIN
doc/image/cs-left.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

BIN
doc/image/cs-right.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

BIN
doc/image/pay1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 KiB

BIN
doc/image/sw-all.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

BIN
doc/image/sw-left.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

BIN
doc/image/sw-right.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View File

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 172 KiB

View File

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

View File

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View File

@ -6,6 +6,8 @@
<style>
body{
font-size:9pt;
writing-mode: horizontal-tb;
direction: ltr;
}
table {
font-size:9.1pt;
@ -18,19 +20,41 @@
vertical-align: middle;
}
.title{
text-indent:18pt;
text-align:justify;
font-weight:bold;
text-indent: 18pt;
text-align: justify;
font-weight: bold;
font-size: 8pt;
margin-top: 6pt;
/*margin-bottom: 3pt;*/
font-family: 'DengXian';
}
.content{
/*margin-bottom:0pt;*/
text-indent:27pt;
text-align:justify;
line-height:100%;
line-height: 13pt;
font-size: 8pt;
font-family: 'FangSong_GB2312';
}
p{
margin-top: 3pt;
margin-bottom: 3pt;
}
.bottom-sign{
page-break-after: always;
width: 100%;
}
.sign{
display: inline-block;
float: left;
width: 50%; /* 调整宽度以适应内容 */
vertical-align: top;
}
</style>
<body>
<div style="width: 100%;">
<div style="width: 100%">
<#-- <div style="width: 100% ;height: 5pt; "></div>-->
<#-- <div >-->
<#-- <p style="text-align:center;margin-left:300px;margin-top:1pt; margin-bottom:0pt;">-->
@ -48,19 +72,14 @@
<span style=" font-weight: bold">${main.name}</span></p>
<p style=" margin: 0 auto; text-align:center; font-size:16pt">
<span style=" font-weight:bold">服务合同</span></p>
<p class="content" style="margin-left:21pt; text-indent:19pt;">本合同由缔约双方在自愿、平等、公平及诚实信用原则的基础上,本着共赢互利原则,根据《中华人民共和国民法典》等</p>
<p class="content" >相关法律、法规的规定,双方签订以下服务合同以资信守,本服务合同后附的《服务通用条款》为本服务单的有效组成部分</p>
<p class="content" >(以下合称为“本协议”),对双方均具有约束力。</p>
<div style="text-align:center">
<p class="content" style="margin-left:21pt; text-indent:19pt;">本合同由缔约双方在自愿、平等、公平及诚实信用原则的基础上,本着共赢互利原则,根据《中华人民共和国民法典》等相关法律、法规的规定,双方签订以下服务合同以资信守,本服务合同后附的《服务通用条款》为本服务单的有效组成部分(以下合称为“本协议”),对双方均具有约束力。</p>
<div style="text-align:center ">
<table style="width:526.55pt; margin-right:auto; margin-left:auto;">
<tbody>
<tr >
<td style="width:88.2pt;height: 30pt">
服务公司
</td>
<td style="width:88.2pt;height: 30pt">
金额
</td>
<td style="width:88.2pt;height: 30pt">
服务类别
</td>
@ -68,7 +87,7 @@
具体内容
</td>
<td style="width:88.2pt;height: 30pt">
是否代账
金额
</td>
</tr>
<#list serviceCompany as company>
@ -76,9 +95,6 @@
<td>
${company.companyName}
</td>
<td>
${company.contractAmount}元
</td>
<td>
<#list company.businessList as item>
<#if item_has_next>
@ -88,19 +104,21 @@
</#if>
</#list>
</td>
<td colspan="2">
<td colspan="2" >
<#list company.businessList as item>
<div style="height: 5pt;width: 1pt"></div>
<p class="content" style="text-indent:5pt">
<#-- <div style="height: 5pt;width: 1pt"></div>-->
<p class="content" style="text-indent:5pt; margin-top: 1pt; ">
${item.businessTypeName}
<#if item.businessAmount??>
${item.businessTypeName}-金额:${item.businessAmount}元
-金额:${item.businessAmount}元
</#if>
<#if item.businessDesc?? && item.businessDesc != "">
-备注:${item.businessDesc}
</#if>
</p>
<#list item.detailBos as detail>
<p class="content" style="text-indent:32pt">${detail.businessProjectLabel}
<p class="content" style="text-indent:32pt; line-height: 6pt; font-size: 6pt">
${detail.businessProjectLabel}
<#if detail.extentInfo?? && detail.extentInfo != "">
<#assign extenInfo = detail.extentInfo?split("$")>
@ -121,12 +139,7 @@
</#list>
</td>
<td>
<#if company.isProxy?? && company.isProxy == "1">
<#else>
</#if>
${company.contractAmount}元
</td>
</tr>
</#list>
@ -134,7 +147,7 @@
<td >
付款账号
</td>
<td colspan="5" >
<td colspan="4" >
<div style="height: 5pt;width: 1pt"></div>
<div style="float: left;">
<p class="content" style="text-indent:5pt">公司名称:${main.name?if_exists}</p>
@ -142,14 +155,14 @@
<p class="content" style="text-indent:5pt">开户行:${main.bank?if_exists}</p>
</div>
<div style="float: left;">
<img style=" width:50pt; height:50pt; " src="${imagePath}/doc/image/pay.png"/>
<img style=" width:50pt; height:50pt; margin-left: 50pt " src="${imagePath}/doc/image/pay1.jpg"/>
</div>
</td>
</tr>
<tr >
<td colspan="6" style="width:515pt; ">
<div style="height: 5pt;width: 1pt"></div>
<p style="margin:5pt; text-indent:18pt; text-align:justify; ">
<td colspan="5" style="width:515pt; ">
<#-- <div style="height: 5pt;width: 1pt"></div>-->
<p class="content" style="margin:5pt; text-indent:18pt; text-align:justify; ">
<span style="">合同金额:共计¥</span>
<span style=" text-decoration:underline"> ${contract.contractAmount}</span>
<span style="">元(大写金额:</span>
@ -161,8 +174,7 @@
<td >
付款方式
</td>
<td colspan="5">
<div style="height: 5pt;width: 1pt"></div>
<td colspan="4">
<p class="content" style="text-indent:5pt">${contract.payModeDesc}</p>
</td>
</tr>
@ -170,7 +182,7 @@
<td >
合同备注
</td>
<td colspan="5">
<td colspan="4">
<div style="height: 5pt;width: 1pt"></div>
<p class="content" style="text-indent:5pt">
<#if contract.signDesc?? && contract.signDesc != "">
@ -184,101 +196,86 @@
</tbody>
</table>
</div>
<p style=" text-indent:9pt; text-align:justify; ">
<span style="">&nbsp;</span></p>
<p class="title">一、服务期限</p>
<#-- <p style=" text-indent:9pt; text-align:justify; ">-->
<#-- <span style="">&nbsp;</span></p>-->
<p class="title" >一、服务期限</p>
<#if contract.startServiceDate??>
<p class="content">本合同中的服务周期为
${contract.startServiceDate?string('yyyy年MM月dd日')}至${contract.endServiceDate?string('yyyy年MM月dd日')}。
</p>
</#if>
<p class="content">本合同中的企业托管服务,在合同到期前 30 天,乙方有义务告知甲方。如果双方在合同期满前 30 天内未提出终止或变更要</p>
<p class="content" style="text-indent:0pt;">求,未办理交接手续,本合同将自行延期一年。如为其他业务,则与双方约定时间为准。</p>
<p class="content">本合同中的企业托管服务,在合同到期前 30 天,乙方有义务告知甲方。如果双方在合同期满前 30 天内未提出终止或变更要求,未办理交接手续,本合同将自行延期一年。如为其他业务,则与双方约定时间为准。</p>
<p class="title">二、甲方权利与义务</p>
<p class="content">(一)甲方须按本合同约定,按时足额支付服务费用,否则乙方有权拒绝提供服务;</p>
<p class="content">(二)甲方应无保留地向乙方陈述与代理事务有关的真实情况,提供的资料必须真实合法,且法定代表人、监事、股东等信息</p>
<p class="content" style="text-indent:0pt;">的提交须经过其本人同意,否则因此导致的所有风险与责任均由甲方自行承担;</p>
<p class="title"> 二、甲方权利与义务</p>
<p class="content"> (一)甲方须按本合同约定,按时足额支付服务费用,否则乙方有权拒绝提供服务;</p>
<p class="content"> (二)甲方应无保留地向乙方陈述与代理事务有关的真实情况,提供的资料必须真实合法,且法定代表人、监事、股东等信息的提交须经过其本人同意,否则因此导致的所有风险与责任均由甲方自行承担;</p>
<p class="title"> 三、乙方权利和义务</p>
<p class="content"> (一)乙方在收到甲方支付的款项后,立即启动本合同约定的服务;</p>
<p class="content"> (二)乙方按照甲方提供的真实有效的企业入住信息,为甲方办理新设企业的委托服务;</p>
<p class="content"> (三)乙方应及时将服务办理完毕后形成的相关资料交予甲方;</p>
<p class="content"> (四)除为履行本合同所需外,未经甲方事先同意,乙方不得擅自向第三方泄露甲方的商业信息及其他资料。</p>
<p class="content"> (五)甲方若有违法违规经营情形,或甲方示意乙方提供不当的服务以及其他不符合法律、行政法规的要求,乙方有权拒绝;若甲方坚持其不当要求,乙方有权单方解除本合同,本合同自乙方向甲方发出通知之日起合同终止,由此造成的相关责任由甲方自行承担。</p>
<p class="content"> (六)如甲方不按乙方要求完整、及时地准备和提供相应的资料,导致乙方受托事项办理的延误或未完成,由此所发生的一切后果完全由甲方承担,乙方不承担任何责任。</p>
<p class="content"> (七)乙方有权委托第三方完成本应由乙方提供的服务。</p>
<p class="title"> 四、违约责任</p>
<p class="content"> 甲乙双方任何一方无正当理由提前终止本合同的应按照本合同服务总金额的20%向守约方支付违约金,乙方扣除违约金后退还剩余服务期费用;如乙方为甲方注册成立公司后,甲方无正当理由提前解除或终止合同的,乙方不予退还本合同的服务费用。</p>
<p class="content"> 若甲方拖欠乙方服务费以应付而未付的金额为基础按每天万分之五的日利率计收每日逾期利息。若甲方逾期支付达1个月视为甲方主动终止本合同乙方有权终止提供服务由此产生的经济、法律及其他责任由甲方自行承担在甲方未按照本合同约定支付服务费和其他费用的情况下乙方有权将甲方资料予以留置在甲方所欠费用结清后乙方归还甲方相关资料。</p>
<p class="content"> (三)任何一方违反本合同部分条款约定的,不影响其余条款的效力和继续履行。对违约情形,守约方有权要求违约方予以更正,若违约方拒绝纠正的,守约方有权单方解除本合同并要求违约方承担违约赔偿责任。</p>
<p class="content"> (四)由于乙方过错给甲方造成损失的,乙方应承担赔偿责任,但赔偿责任以该合作周期内所收取的该项服务的服务费用为赔偿上限。</p>
<p class="title"> 五、不可抗力</p>
<p class="content"> 不可抗力是指法律规章或政策变化、社会异常事件(如罢工、骚乱、盗窃、抢劫以及其它不能预见的客观情况)、自然灾害(如台风、洪水、冰雹、地震、海啸、火灾、旱灾、大雪、山崩)等对其发生和后果不能防止或避免的事件。</p>
<p class="content"> 发生不可抗力事件时,双方应互相协商,寻求公平合理的解决争议途经,并尽一切努力减轻不可抗力造成的不良后果。在不可抗力造成本合同无法履行的情况下,双方互不承担责任,且甲方和乙方均有权选择终止本合同,乙方已收款项在扣除已经完成的服务费用和已经产生的成本后进行返还。</p>
<p class="title"> 六、通知与送达</p>
<p class="content"> 甲方确保其通信地址、联系人、联系电话的准确性及有效性,因乙方经努力而无法与甲方取得联系而引起的一切后果,由甲方承担;</p>
<p class="content"> (一)如果是专人送交,则在对方签收视为已送达。</p>
<p class="content"> (二)如用快递、传真发送,则在收到传输确认书的当天被视为送到,如果传输当天不是工作日,或传输时工作日已结束营业,则在下一个工作日被视作已送达日。</p>
<p class="content"> 以电子邮件、微信、QQ等社交软件发出的则为发送人的邮件系统确认电子邮件发送至收件人的邮件接收系统后的当天为送达日。</p>
<p class="content"> (四)各方均应积极履行通知义务,且确保送达地址的有效及准确,任何一方不得以拒绝签收、无人签收、变更地址未收到等理由否定送达效力。</p>
<p class="content"> (五)乙方工商注册环节的企业营业执照、印章等物品的快递费用由乙方承担,注册企业之后所开具发票的快递(到付)费用由甲方自行承担。</p>
<p class="title"> 七、合同份数及法律效力</p>
<p class="content"> 本合同一式贰份,甲方持壹份,乙方持壹份,每份合同具有相同的法律效力。本合同自双方签署后生效。</p>
<p class="title"> 八、其他</p>
<p class="content"> (一)乙方出于宣传目的而采取发放宣传册、广告、网页推广、销售人员宣讲等方式展现的内容不具有合同效力,双方权利义务内容以本合同为准。</p>
<p class="content"> (二)乙方工作人员无权向甲方作出超出本合同内容的承诺以及代表乙方以个人形式签署任何文件,双方均应以加盖印章的文件作为双方权利义务约定的唯一形式。</p>
<p class="content"> (三)本合同内容若需做出任何修改补充,甲、乙双方共同协商后,可形成补充协议,补充协议与本合同冲突的,以补充协议为准。</p>
<p class="content"> (四)因本合同发生争议,双方协商解决;如果协商不成,甲、乙双方一致同意提交仲裁委员会按照其仲裁规则进行裁决,其裁决是终局性的,对双方具有约束力。因争议解决产生的案件受理费、律师费、保全费、公证费、鉴定费等由败诉方承担。</p>
<p class="content"> (五)本合同传真及扫描件与合同原件具有同等法律效力。</p>
<p class="title">三、乙方权利和义务</p>
<p class="content">(一)乙方在收到甲方支付的款项后,立即启动本合同约定的服务;</p>
<p class="content">(二)乙方按照甲方提供的真实有效的企业信息,为甲方办理企业的委托服务;</p>
<p class="content">(三)乙方应及时将服务办理完毕后形成的相关资料交予甲方;</p>
<p class="content">(四)除为履行本合同所需外,未经甲方事先同意,乙方不得擅自向第三方泄露甲方的商业信息及其他资料。</p>
<p class="content">(五)甲方若有违法违规经营情形,或甲方示意乙方提供不当的服务以及其他不符合法律、行政法规的要求,乙方有权拒</p>
<p class="content" style="text-indent:0pt;">绝;若 甲方坚持其不当要求,乙方有权单方解除本合同,本合同自乙方向甲方发出通知之日起终止,由此造成的相关责任由甲方</p>
<p class="content" style="text-indent:0pt;">自行承担。</p>
<p class="content">(六)如甲方不按乙方要求完整、及时地准备和提供相应的资料,导致乙方受托事项办理的延误或未完成,由此所发生的一切</p>
<p class="content" style="text-indent:0pt;">后果完全由甲方承担,乙方不承担任何责任。</p>
<p class="title">四、违约责任</p>
<p class="content">(一)甲乙双方任何一方无正当理由提前终止本合同的,应按照本合同服务总金额的 20%向守约方支付违约金,乙方扣除违约</p>
<p class="content" style="text-indent:0pt;">金后退还剩余服务期费用;如乙方为甲方注册成立公司后,甲方无正当理由提前解除或终止合同的,乙方不予退还本合同的服务费</p>
<p class="content" style="text-indent:0pt;">用。</p>
<p class="content">(二)若甲方拖欠乙方服务费,以应付而未付的金额为基础,按每天万分之五的日利率计收每日逾期利息。若甲方逾期支付达</p>
<p class="content" style="text-indent:0pt;">1个月视为甲方主动终止本合同乙方有权终止提供服务由此产生的经济、法律及其他责任由甲方自行承担在甲方未按照本合</p>
<p class="content" style="text-indent:0pt;">同约定支付服务费和其他费用的情况下,乙方有权将甲方资料予 以留置,在甲方所欠费用结清后,乙方归还甲方相关资料。</p>
<p class="content">(三)任何一方违反本合同部分条款约定的,不影响其余条款的效力和继续履行。对违约情形,守约方有权要求违约方予以更</p>
<p class="content" style="text-indent:0pt;">正,若违约方拒绝纠正的,守约方有权单方解除本合同并要求违约方承担违约赔偿责任</p>
<p class="content">(四)由于乙方过错给甲方造成损失的,乙方应承担赔偿责任,但赔偿责任以该合作周期内所收取的该项服务的服务费用为赔</p>
<p class="content" style="text-indent:0pt;">偿上限。</p>
<p class="title">五、不可抗力</p>
<p class="content">不可抗力是指法律规章或政策变化、社会异常事件(如罢工、骚乱、盗窃、抢劫以及其它不能预见的客观情况)、自然灾害</p>
<p class="content" style="text-indent:0pt;">(如台风、洪水、冰雹、地震、海啸、火灾、旱灾、大雪、山崩)等对其发生和后果不能防止或避免的事件。</p>
<p class="content">发生不可抗力事件时,双方应互相协商,寻求公平合理的解决争议途经,并尽一切努力减轻不可抗力造成的不良后果。在不可</p>
<p class="content" style="text-indent:0pt;">抗力造成本合同无法履行的情况下,双方互不承担责任,且甲方和乙方均有权选择终止本合同,乙方已收款项在扣除已经完成的服务</p>
<p class="content" style="text-indent:0pt;">费用和已经产生的成本后进行返还。</p>
<p class="title">六、通知与送达</p>
<p>甲方确保其通信地址、联系人、联系电话的准确性及有效性,因乙方经努力而无法与甲方取得联系而引起的一切后果,由甲方承担;</p>
<p class="content">(一)如果是专人送交,则在对方签收视为已送达。</p>
<p class="content">(二)如用快递、传真发送,则在收到传输确认书的当天被视为送到,如果传输当天不是工作日,或传输时工作日已结束营</p>
<p class="content" style="text-indent:0pt;">业,则在下一个工作日被视作已送达日。</p>
<p class="content">(三)以电子邮件、微信等工具发出的,则为发送人的邮件系统确认电子邮件发送至收件人的邮件接收系统后的当天为送达</p>
<p class="content" style="text-indent:0pt;">日。</p>
<p class="content">(四)各方均应积极履行通知义务,且确保送达地址的有效及准确,任何一方不得以拒绝签收、无人签收、变更地址未收到等</p>
<p class="content" style="text-indent:0pt;">理由否定送达效力。</p>
<p class="content">(五)乙方工商注册环节的企业营业执照、印章等物品的快递费用由乙方承担,注册企业之后所产生的快递(到付)费用由甲</p>
<p class="content" style="text-indent:0pt;">方自行承担。</p>
<p class="title">七、合同份数及法律效力</p>
<p class="content">本合同一式贰份,甲方持壹份,乙方持壹份,每份合同具有相同的法律效力。本合同自双方签署后生效。</p>
<p class="title">八、其他</p>
<p class="content">(一)乙方出于宣传目的而采取发放宣传册、广告、网页推广、销售人员宣讲等方式展现的内容不具有合同效力,双方权利义</p>
<p class="content" style="text-indent:0pt;">务内容以本合同为准。</p>
<p class="content">(二)乙方工作人员无权向甲方作出超出本合同内容的承诺以及代表乙方以个人形式签署任何文件,双方均应以加盖印章的文</p>
<p class="content" style="text-indent:0pt;">件作为双方权利义务约定的唯一形式。</p>
<p class="content">(三)本合同内容若需做出任何修改补充,甲、乙双方共同协商,可形成补充协议,补充协议与本合同冲突的,以补充协议为准。</p>
<p class="content">(四)因本合同发生争议,双方协商解决;如果协商不成,甲、乙双方一致同意提交仲裁委员会按照其仲裁规则进行裁决,其</p>
<p class="content" style="text-indent:0pt;">裁决是终局性的,对双方具有约束力。因争议解决产生的案件受理费、律师费、保全费、公证费、鉴定费等由败诉方承担。</p>
<p class="content">(五)本合同传真及扫描件与合同原件具有同等法律效力。</p>
<p class="content"> &nbsp;</p>
<p class="content">甲方名称(签章) ${company.companyName?if_exists}</p>
<p class="content">甲方联系人: ${company.legalPersonName?if_exists}</p>
<p class="content">联系方式: ${company.legalPersonPhone?if_exists}</p>
<p class="content">签约日期: ${contract.applyDate?string('yyyy年MM月dd日')}
<#--<span style=" text-decoration:underline"></span> 年
<span style=" text-decoration:underline"></span> 月
<span style=" text-decoration:underline"></span> 日-->
</p>
<p class="content"> &nbsp;</p>
<p class="content">乙方名称(签章): ${main.name?if_exists}</p>
<p class="content">乙方联系人: ${user.nickname?if_exists}</p>
<p class="content">联系方式: ${user.phonenumber?if_exists}</p>
<p class="content">签约日期: ${contract.applyDate?string('yyyy年MM月dd日')}
<#--<span style=" text-decoration:underline"> </span> 年
<span style=" text-decoration:underline"> </span> 月
<span style=" text-decoration:underline"> </span> 日-->
</p>
<#if isSign?? && isSign>
<div style="height: 500px;width: 100%;padding-top: -120px;padding-left: 120px">
<img style="width:150px; height:150px; " src="${imagePath}/doc/image/allZ.png"/>
<div class="bottom-sign" style="page-break-after: always; width: 100%;" >
<div class="sign" >
<#if firstPartyType?? && firstPartyType == 1>
<p class="content">甲方名称(签章) ${company.companyName?if_exists}</p>
<p class="content">甲方纳税人识别号: ${company.customerNum?if_exists}</p>
<p class="content">甲方联系人: ${company.legalPersonName?if_exists}</p>
</#if>
<#if firstPartyType?? && firstPartyType == 2>
<p class="content">甲方名称: ${company.legalPersonName?if_exists}</p>
<p class="content">甲方联系人(签章): </p>
</#if>
<p class="content">联系方式: ${company.legalPersonPhone?if_exists}</p>
<p class="content">签约日期: ${contract.applyDate?string('yyyy年MM月dd日')}
<#--<span style=" text-decoration:underline"></span> 年
<span style=" text-decoration:underline"></span> 月
<span style=" text-decoration:underline"></span> 日-->
</p>
</div>
</#if>
<div class="sign" >
<p class="content">乙方名称(签章): ${main.name?if_exists}</p>
<p class="content">乙方纳税人识别号: ${main.customer_num?if_exists}</p>
<p class="content">联系人: ${user.nickname?if_exists}</p>
<p class="content">联系方式: ${user.phonenumber?if_exists}</p>
<p class="content">签约日期: ${contract.applyDate?string('yyyy年MM月dd日')}
<#--<span style=" text-decoration:underline"> </span> 年
<span style=" text-decoration:underline"> </span> 月
<span style=" text-decoration:underline"> </span> 日-->
</p>
<#-- <#if isSign?? && isSign>-->
<img style="width:150px; height:150px; margin-top: -120px;margin-left: 120px" src="${imagePath}/doc/image/${mainPrefix}all.png"/>
<#-- </#if>-->
</div>
</div>
</div>
</body>

View File

@ -45,6 +45,9 @@ spring:
url: jdbc:mysql://192.168.18.119:3308/pusongplus?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
username: root
password: Ps123456
# url: jdbc:mysql://47.95.38.123:3306/pusongplus?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
# username: root
# password: Ps123456@
# 从库数据源
# slave:
# lazy: true

View File

@ -46,6 +46,23 @@
<artifactId>itextpdf</artifactId>
<version>5.5.13</version>
</dependency>
<!-- itext7html转pdf -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>html2pdf</artifactId>
<version>3.0.2</version>
</dependency>
<!-- 中文字体支持 -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>font-asian</artifactId>
<version>7.1.13</version>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>3.0.11.RELEASE</version>
</dependency>
<dependency>
<groupId>com.itextpdf.tool</groupId>
<artifactId>xmlworker</artifactId>
@ -61,6 +78,23 @@
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>10.1.24</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel-support</artifactId>
<version>3.3.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-core</artifactId>
<version>3.5.7</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,14 +1,14 @@
package com.pusong.common.doc.util;
import java.io.IOException;
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.*;
import com.pusong.common.core.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
/**
* 设置页面附加属性
@ -35,6 +35,8 @@ public class PDFBuilder extends PdfPageEventHelper {
private static BaseFont baseFont;
// 生成下划线空白占位符
private static String Blank;
public String mainPrefix;
static {
try {
// 中文字体依赖itext得itext-asian包
@ -57,10 +59,11 @@ public class PDFBuilder extends PdfPageEventHelper {
* Creates a new instance of PdfReportM1HeaderFooter 无参构造方法.
*
*/
public PDFBuilder(Object header,Object isSign,String imagepath) {
public PDFBuilder(Object header, Object isSign, String imagepath, String mainPrefix) {
this.header = header == null?null:header.toString();
this.isSign = isSign == null?null:(Boolean)isSign;
this.imagepath = imagepath;
this.mainPrefix = mainPrefix;
}
/**
@ -106,13 +109,20 @@ public class PDFBuilder extends PdfPageEventHelper {
return;
}
//生成下划线使用空格占位
ColumnText.showTextAligned(writer.getDirectContent(),
Element.ALIGN_LEFT, new Phrase(PDFBuilder.Blank, new Font(PDFBuilder.baseFont, Font.DEFAULTSIZE, Font.UNDERLINE)),
document.left(-1), document.top()+10, 0);
ColumnText.showTextAligned(
writer.getDirectContent()
, Element.ALIGN_LEFT
, new Phrase(PDFBuilder.Blank, new Font(PDFBuilder.baseFont, Font.DEFAULTSIZE, Font.UNDERLINE))
, document.left(- 1)
, document.top() + 10
, 0);
// 1.写入页眉
ColumnText.showTextAligned(writer.getDirectContent(),
Element.ALIGN_LEFT, new Phrase(header, fontDetail),
document.right()/2+20, document.top()+10 , 0);
Element.ALIGN_LEFT
, new Phrase(header, fontDetail)
, document.right() / 2 + 20
, document.top()+10
, 0);
}
//加半章图片

View File

@ -5,6 +5,7 @@ import com.itextpdf.text.Document;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.pdf.PdfWriter;
import com.itextpdf.tool.xml.XMLWorkerHelper;
import com.pusong.common.doc.util.itext7.HtmlToPdfUtils;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
@ -13,9 +14,6 @@ import org.slf4j.LoggerFactory;
import java.io.*;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PdfGenerator {
@ -25,6 +23,9 @@ public class PdfGenerator {
public static final String HEAD = "head";
//是否签章
public static final String SIGN = "isSign";
public static final String MAINPREFIX = "mainPrefix";
public static Configuration configuration =null;
static {
configuration = new Configuration(Configuration.VERSION_2_3_31);
@ -75,11 +76,11 @@ public class PdfGenerator {
public static void makePdf(Map<String, Object> data, String pdfpath, String templateName) throws Exception{
// 加载模板
Template template = configuration.getTemplate(templateName);
data.put("imagePath",System.getProperty("user.dir"));
data.put("imagePath", System.getProperty("user.dir"));
// 生成HTML
String html = processTemplate(template, data);
// 生成PDF
PDFBuilder builder = new PDFBuilder(data.get(HEAD),data.get(SIGN),System.getProperty("user.dir"));
PDFBuilder builder = new PDFBuilder(data.get(HEAD), data.get(SIGN), System.getProperty("user.dir"), data.get(MAINPREFIX).toString());
generatePdf(html, pdfpath, builder);
}
@ -89,7 +90,29 @@ public class PdfGenerator {
return writer.toString();
}
private static void generatePdf(String html, String outputPath,PDFBuilder builder) {
private static void generatePdf(String html, String outputPath, PDFBuilder builder) {
// String waterMarkText = "自定义水印";//
InputStream inputStream = new ByteArrayInputStream(html.getBytes());
// String ttcPath = "C:\\Users\\Administrator\\Downloads\\gb2312.ttf";
//微软雅黑在windows系统里的位置如下linux系统直接拷贝该文件放在linux目录下即可
FileOutputStream fileOutputStream = null;
try {
fileOutputStream = new FileOutputStream(outputPath);
HtmlToPdfUtils.convertToPdf(inputStream, builder, fileOutputStream);
}catch (Exception e){
log.error("", e);
}finally {
try {
fileOutputStream.flush();
fileOutputStream.close();
}catch (Exception e){
log.error("", e);
}
}
}
private static void generatePdf2(String html, String outputPath, PDFBuilder builder) {
Document document = null;
PdfWriter writer = null;
try{
@ -99,9 +122,10 @@ public class PdfGenerator {
writer.setPageEvent(builder);
document.open();
XMLWorkerHelper.getInstance().parseXHtml(writer, document, new ByteArrayInputStream(html.getBytes()),
XMLWorkerHelper.class.getResourceAsStream("/default.css"),
// XMLWorkerHelper.class.getResourceAsStream("/default.css"),
Charset.forName("UTF-8"),
new CustomXMLWorkerFontProvider());
}catch (Exception e){
log.error("生成pdf异常",e);
}finally {
@ -115,4 +139,5 @@ public class PdfGenerator {
}
}

View File

@ -0,0 +1,126 @@
package com.pusong.common.doc.util;
import com.itextpdf.html2pdf.ConverterProperties;
import com.itextpdf.html2pdf.HtmlConverter;
import com.itextpdf.html2pdf.resolver.font.DefaultFontProvider;
import com.itextpdf.layout.font.FontProvider;
import org.apache.tomcat.util.http.fileupload.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.Context;
import java.io.*;
/**
* @Author: yh
* @Date: 2023/6/5 12:05
* @Description:
*/
public class PdfItext {
Logger log = LoggerFactory.getLogger(PdfItext.class);
/**
* @param templatePath 模板全路径
* @param path 生成pdf文件夹
* @param fileName 生成pdf文件名
* @param context 填充参数
*/
public static void htmlToPdf(String templatePath, String path, String fileName, Context context) {
String linuxPath = PdfItext.getFileAbsolutePath(templatePath, templatePath, false);
ConverterProperties converterProperties = new ConverterProperties();
FontProvider dfp = new DefaultFontProvider();
// dfp.addSystemFonts(); //添加中文字体库 方式a -window环境有自带字体 linux环境需要安装中文字体可参考 https://www.zhihu.com/question/423159370/answer/2706867741
//添加中文字体库 方式b 使用项目导入的字体库 已验证linux环境不安装中文字体能正常显示中文
dfp.addFont(getFileAbsolutePath("C:\\Users\\Administrator\\Downloads\\simhei.ttf", "C:\\Users\\Administrator\\Downloads\\simhei.ttf", false));
converterProperties.setFontProvider(dfp);
//将本地的模板转换成字符串
String htmlStr = toHtmlString(new File(linuxPath));
//模板参数替换
String replaceHtmlStr = new TemplateEngine().process(htmlStr, context);
File destDir = new File(path);
if (!destDir.exists()) {
destDir.mkdirs();
}
try (OutputStream out = new FileOutputStream(new File(path + fileName))) {
HtmlConverter.convertToPdf(replaceHtmlStr, out, converterProperties);
} catch (Exception e) {
e.printStackTrace();
System.out.println("pdf转换异常3{}"+ e);
}
}
public static void main(String[] args) throws Exception {
//模板内容填充参数
Context context = new Context();
// context.setVariable("name2", "晨曦话java");
// context.setVariable("name1", "晨曦话三国");
PdfItext.htmlToPdf("C:\\Users\\Administrator\\Desktop\\aa.html", "C:\\Users\\Administrator\\Downloads\\", "temp.pdf", context);
}
/**
* 读取本地html文件里的html代码
* @param file File file=new File("文件的绝对路径")
* @return
*/
public static String toHtmlString(File file) {
// 获取HTML文件流
StringBuffer htmlSb = new StringBuffer();
try {
BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(file), "utf-8"));
while (br.ready()) {
htmlSb.append(br.readLine());
}
br.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
// HTML文件字符串
String htmlStr = htmlSb.toString();
// 返回经过清洁的html文本
return htmlStr;
}
/**
* 解决linux下运行jar无法加载jar包下文件window环境能正常加载
*
* @param templatePath 模板路径 传相对路径 比如 /templates/template.htm
* @param createPath 生成路径 比如 /mnt/pdf/templates/template.html
* @param isConvered 是否覆盖模板默认false. 如模板变化需覆盖生成
* @return 返回的路径就是放在linux服务器上的文件路径
*/
public static String getFileAbsolutePath(String templatePath, String createPath, boolean isConvered) {
try {
// 创建临时文件获取jar里面的配置文件
File file = new File(createPath);
if (file.exists() && !isConvered) {
return file.getAbsolutePath();
}
InputStream inputStream = null;
try {
ClassPathResource resource = new ClassPathResource(templatePath);
inputStream = resource.getInputStream();
byte[] buffer = new byte[inputStream.available()];
inputStream.read(buffer);
OutputStream outStream = new FileOutputStream(file);
outStream.write(buffer);
return file.getAbsolutePath();
} finally {
IOUtils.closeQuietly(inputStream);
}
} catch (Exception e) {
System.out.println("FileUtil getFilePath Fail cause by:"+ e);
}
return null;
}
}

View File

@ -0,0 +1,67 @@
package com.pusong.common.doc.util.itext7;
import com.itextpdf.html2pdf.ConverterProperties;
import com.itextpdf.html2pdf.HtmlConverter;
import com.itextpdf.io.font.FontProgram;
import com.itextpdf.io.font.FontProgramFactory;
import com.itextpdf.kernel.events.PdfDocumentEvent;
import com.itextpdf.kernel.geom.PageSize;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.font.FontProvider;
import com.pusong.common.doc.util.PDFBuilder;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class HtmlToPdfUtils {
/**
* html转pdf
*
* @param inputStream 输入流
* @param waterMark 水印
* @param fontPath 字体路径ttc后缀的字体需要添加<b>,0<b/>
* @param outputStream 输出流
* @date : 2021/1/15 14:07
*/
public static void convertToPdf(InputStream inputStream, PDFBuilder builder, OutputStream outputStream) throws IOException {
PdfWriter pdfWriter = new PdfWriter(outputStream);
PdfDocument pdfDocument = new PdfDocument(pdfWriter);
//设置为A4大小
pdfDocument.setDefaultPageSize(PageSize.A4);
//添加水印
// pdfDocument.addEventHandler(PdfDocumentEvent.END_PAGE, new WaterMarkEventHandler(waterMark));
pdfDocument.addEventHandler(PdfDocumentEvent.END_PAGE, new PageEventHandler(builder));
//添加中文字体支持
ConverterProperties properties = new ConverterProperties();
FontProvider fontProvider = new FontProvider();
// PdfFont sysFont = PdfFontFactory.createFont("STSongStd-Light", "UniGB-UCS2-H", false);
// fontProvider.addFont(sysFont.getFontProgram(), "UniGB-UCS2-H");
//添加自定义字体例如微软雅黑
// if (StrUtil.isNotBlank(fontPath)){
FontProgram gb2312 = FontProgramFactory.createFont(System.getProperty("user.dir") + "/doc/gb2312.ttf");
fontProvider.addFont(gb2312);
FontProgram Deng = FontProgramFactory.createFont(System.getProperty("user.dir") + "/doc/Deng.ttf");
fontProvider.addFont(Deng);
FontProgram Dengb = FontProgramFactory.createFont(System.getProperty("user.dir") + "/doc/Dengb.ttf");
fontProvider.addFont(Dengb);
// Dengb.getFontNames().getFontName();
// }
properties.setFontProvider(fontProvider);
HtmlConverter.convertToPdf(inputStream, pdfDocument, properties);
pdfWriter.close();
pdfDocument.close();
}
}

View File

@ -0,0 +1,92 @@
package com.pusong.common.doc.util.itext7;
import com.itextpdf.io.image.ImageData;
import com.itextpdf.io.image.ImageDataFactory;
import com.itextpdf.kernel.colors.DeviceRgb;
import com.itextpdf.kernel.events.Event;
import com.itextpdf.kernel.events.IEventHandler;
import com.itextpdf.kernel.events.PdfDocumentEvent;
import com.itextpdf.kernel.font.PdfFont;
import com.itextpdf.kernel.font.PdfFontFactory;
import com.itextpdf.kernel.geom.Rectangle;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfPage;
import com.itextpdf.kernel.pdf.canvas.PdfCanvas;
import com.itextpdf.layout.Canvas;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.layout.property.TextAlignment;
import com.pusong.common.doc.util.PDFBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.MalformedURLException;
public class PageEventHandler implements IEventHandler {
Logger logger = LoggerFactory.getLogger(PageEventHandler.class);
private boolean isSign ;
private String headStr;
private String imagePath;
private String mainPrefix;
public PageEventHandler(PDFBuilder builder){
this.isSign = builder.isSign;
this.headStr = builder.header;
this.imagePath = System.getProperty("user.dir");
this.mainPrefix = builder.mainPrefix;
}
@Override
public void handleEvent(Event event) {
PdfDocumentEvent documentEvent = (PdfDocumentEvent) event;
PdfDocument document = documentEvent.getDocument();
PdfPage page = documentEvent.getPage();
Rectangle pageSize = page.getPageSize();
PdfFont pdfFont = null;
try {
// pdfFont = PdfFontFactory.createFont();//"STSongStd-Light", "UniGB-UCS2-H", false
pdfFont = PdfFontFactory.createFont("STSongStd-Light", "UniGB-UCS2-H", false);
} catch (Exception e) {
logger.error("", e);
}
PdfCanvas pdfCanvas = new PdfCanvas(page.getLastContentStream(), page.getResources(), document);
Canvas canvas = new Canvas(pdfCanvas, pageSize);
Paragraph paragraph = new Paragraph(headStr)
.setFontSize(8)
.setFont(pdfFont)
.setFontColor(new DeviceRgb(0, 0, 0))
;
canvas.showTextAligned(paragraph, pageSize.getRight() / 2, pageSize.getTop() - 20, TextAlignment.LEFT);
PdfCanvas pdfCanvas1 = canvas.getPdfCanvas();
pdfCanvas1.moveTo(0 + 25, pageSize.getTop() - 25).lineTo(pageSize.getRight() - 25, pageSize.getTop() - 25).stroke();
sign(canvas, document.getPageNumber(page), pageSize.getRight());
canvas.close();
}
public void sign(Canvas canvas, int pageNum, float right){
if (!isSign){
// return;
}
String psth;
if(pageNum % 2 == 1){
psth = imagePath + "/doc/image/"+ mainPrefix +"left.png";
}else{
psth = imagePath + "/doc/image/" + mainPrefix + "right.png";
}
// 加半章图片
try {
ImageData image = ImageDataFactory.create(psth);
PdfCanvas pdfCanvas = canvas.getPdfCanvas();
float width = 75 * 0.72f;
pdfCanvas.addImage(image,right - width,400, width, false);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
}

View File

@ -0,0 +1,77 @@
package com.pusong.common.doc.util.itext7;
import com.itextpdf.kernel.colors.DeviceRgb;
import com.itextpdf.kernel.events.Event;
import com.itextpdf.kernel.events.IEventHandler;
import com.itextpdf.kernel.events.PdfDocumentEvent;
import com.itextpdf.kernel.font.PdfFont;
import com.itextpdf.kernel.font.PdfFontFactory;
import com.itextpdf.kernel.geom.Rectangle;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfPage;
import com.itextpdf.kernel.pdf.canvas.PdfCanvas;
import com.itextpdf.layout.Canvas;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.layout.property.TextAlignment;
import com.itextpdf.layout.property.VerticalAlignment;
import java.io.IOException;
public class WaterMarkEventHandler implements IEventHandler {
/**
* 水印内容
*/
private String waterMarkContent;
/**
* 一页中有几列水印
*/
private int waterMarkX;
/**
* 一页中每列有多少水印
*/
private int waterMarkY;
public WaterMarkEventHandler(String waterMarkContent) {
this(waterMarkContent, 5, 5);
}
public WaterMarkEventHandler(String waterMarkContent, int waterMarkX, int waterMarkY) {
this.waterMarkContent = waterMarkContent;
this.waterMarkX = waterMarkX;
this.waterMarkY = waterMarkY;
}
@Override
public void handleEvent(Event event) {
PdfDocumentEvent documentEvent = (PdfDocumentEvent) event;
PdfDocument document = documentEvent.getDocument();
PdfPage page = documentEvent.getPage();
Rectangle pageSize = page.getPageSize();
PdfFont pdfFont = null;
try {
pdfFont = PdfFontFactory.createFont("STSongStd-Light", "UniGB-UCS2-H", false);//"STSongStd-Light", "UniGB-UCS2-H", false
} catch (IOException e) {
e.printStackTrace();
}
PdfCanvas pdfCanvas = new PdfCanvas(page.newContentStreamAfter(), page.getResources(), document);
Paragraph waterMark = new Paragraph(waterMarkContent).setOpacity(0.5f);
Canvas canvas = new Canvas(pdfCanvas, pageSize)
.setFontColor(new DeviceRgb(0, 0, 0))
.setFontSize(16)
.setFont(pdfFont);
for (int i = 0; i < waterMarkX; i++) {
for (int j = 0; j < waterMarkY; j++) {
canvas.showTextAligned(waterMark, (150 + i * 300), (160 + j * 150), document.getNumberOfPages(), TextAlignment.CENTER, VerticalAlignment.BOTTOM, 120);
}
}
canvas.close();
}
}

View File

@ -1,21 +1,20 @@
package com.pusong.business.domain.bo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pusong.business.domain.PsContractInfo;
import com.pusong.common.core.validate.AddGroup;
import com.pusong.common.core.validate.EditGroup;
import com.pusong.common.core.validate.QueryGroup;
import com.pusong.common.mybatis.core.domain.BaseEntity;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMapping;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* 合同基本信息业务对象 ps_contract_info
*
@ -62,6 +61,7 @@ public class PsContractInfoBo {
@NotNull(message = "服务周期开始时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startServiceDate;
/**
* 服务周期结束时间
*/

View File

@ -43,6 +43,8 @@ import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
import static com.pusong.common.doc.util.PdfGenerator.MAINPREFIX;
/**
* 合同基本信息Service业务层处理
*
@ -625,6 +627,16 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
map.put("business", detailBos);
map.put("serviceCompany", bo.getServiceCompanyInfoList());
map.put("main", JSON.parseObject(main.getRemark()));// 合同主体信息
map.put("mainId", bo.getContractMain());
if (bo.getContractMain().equals("1")){
map.put(MAINPREFIX, "zx-");
}else if (bo.getContractMain().equals("2")){
map.put(MAINPREFIX, "cs-");
}else if (bo.getContractMain().equals("3")){
map.put(MAINPREFIX, "sw-");
}
map.put("firstPartyType", bo.getFirstPartyType());
map.put("company", bo.getCompanyInfoBo());
map.put("customer",customer);
// 合同总金额大写