|
@@ -5,6 +5,7 @@ import com.itextpdf.text.*;
|
|
|
import com.itextpdf.text.pdf.*;
|
|
|
import com.itextpdf.text.pdf.draw.LineSeparator;
|
|
|
import com.jpsoft.picc.modules.business.entity.InsuranceApplication;
|
|
|
+import com.jpsoft.picc.modules.business.entity.InsurancePolicy;
|
|
|
import com.jpsoft.picc.modules.business.entity.InsurancePolicyMember;
|
|
|
|
|
|
import java.io.File;
|
|
@@ -102,8 +103,7 @@ public class ItextPDFUtil {
|
|
|
stamp.close();// 关闭
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- public static void createPdf(InsuranceApplication insuranceApplication, List<Map<String,Object>> mapList,List<InsurancePolicyMember> list,String logoUrl,String downloadFilePath)throws Exception{
|
|
|
+ public static void createPdf(InsuranceApplication insuranceApplication,InsurancePolicy insurancePolicy, List<Map<String,Object>> mapList,List<InsurancePolicyMember> list,String logoUrl,String downloadFilePath)throws Exception{
|
|
|
//测试pdf保存路径
|
|
|
// String filePath = "C:/Users/Administrator/Desktop/投保单.pdf";
|
|
|
File file = new File(downloadFilePath);
|
|
@@ -123,7 +123,7 @@ public class ItextPDFUtil {
|
|
|
document.open();
|
|
|
try{
|
|
|
// 4.向文档中添加内容
|
|
|
- new ItextPDFUtil().generatePDF(document,insuranceApplication,mapList,list,logoUrl);
|
|
|
+ new ItextPDFUtil().generatePDF(document,insuranceApplication,insurancePolicy,mapList,list,logoUrl);
|
|
|
}catch (Exception ex){
|
|
|
throw new Exception(ex.getMessage());
|
|
|
}finally {
|
|
@@ -166,7 +166,7 @@ public class ItextPDFUtil {
|
|
|
|
|
|
// 生成PDF文件
|
|
|
|
|
|
- public void generatePDF(Document document,InsuranceApplication insuranceApplication, List<Map<String,Object>> mapList,List<InsurancePolicyMember> list,String logoUrl) throws Exception {
|
|
|
+ public void generatePDF(Document document, InsuranceApplication insuranceApplication, InsurancePolicy insurancePolicy, List<Map<String,Object>> mapList, List<InsurancePolicyMember> list, String logoUrl) throws Exception {
|
|
|
// Image image1 = Image.getInstance("C:/Users/Administrator/Desktop/picc/logo.png");
|
|
|
Image image1 = Image.getInstance(logoUrl);
|
|
|
Paragraph p1 = new Paragraph("", titlefont);
|
|
@@ -266,32 +266,24 @@ public class ItextPDFUtil {
|
|
|
if ("累计法律诉讼费用限额".equals(mapData.get("name"))){
|
|
|
lawValue = (String)mapData.get("limit")+(String)mapData.get("unit");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
table.addCell(PdfTable.createCell("二、承保信息", textfont, Element.ALIGN_LEFT, 7,1,BaseColor.PINK, true));
|
|
|
-
|
|
|
table.addCell(PdfTable.createCell(insuranceApplication.getDefinitionName(), textfont, Element.ALIGN_CENTER,2,mapList.size()+1,BaseColor.WHITE,false));
|
|
|
-
|
|
|
table.addCell(PdfTable.createCell("限额名称", textfont, Element.ALIGN_CENTER,3,1,BaseColor.WHITE,false));
|
|
|
table.addCell(PdfTable.createCell("责任限额/免赔额", textfont, Element.ALIGN_CENTER,1,1,BaseColor.WHITE,false));
|
|
|
table.addCell(PdfTable.createCell("保险费(元)", textfont, Element.ALIGN_CENTER,1,1,BaseColor.WHITE,false));
|
|
|
|
|
|
-
|
|
|
int n =0;
|
|
|
for (Map<String,Object> mapData : mapList){
|
|
|
table.addCell(PdfTable.createCell(mapData.get("name").toString(), textfont, Element.ALIGN_CENTER,3,1,BaseColor.WHITE,false));
|
|
|
table.addCell(PdfTable.createCell(mapData.get("limit").toString()+mapData.get("unit"), textfont, Element.ALIGN_CENTER,1,1,BaseColor.WHITE,false));
|
|
|
n++;
|
|
|
if (n==1){
|
|
|
- table.addCell(PdfTable.createCell(String.valueOf(insuranceApplication.getInsuranceFee()), textfont, Element.ALIGN_CENTER,1,mapList.size(),BaseColor.WHITE,false));
|
|
|
+ table.addCell(PdfTable.createCell(String.valueOf(insurancePolicy.getInsuranceFee()), textfont, Element.ALIGN_CENTER,1,mapList.size(),BaseColor.WHITE,false));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// table.addCell(PdfTable.createCell("累计责任限额", textfont, Element.ALIGN_CENTER,3,1,BaseColor.WHITE,false));
|
|
|
// table.addCell(PdfTable.createCell(cumulativeValue, textfont, Element.ALIGN_CENTER,1,1,BaseColor.WHITE,false));
|
|
|
// table.addCell(PdfTable.createCell(String.valueOf(insuranceApplication.getInsuranceFee()), textfont, Element.ALIGN_CENTER,1,6,BaseColor.WHITE,false));
|
|
@@ -326,12 +318,12 @@ public class ItextPDFUtil {
|
|
|
table.addCell(PdfTable.createCell("", textfont, Element.ALIGN_CENTER,1,1,BaseColor.WHITE,false));
|
|
|
|
|
|
table.addCell(PdfTable.createCell("保险费合计(人民币)", textfont, Element.ALIGN_CENTER,2,1,BaseColor.WHITE,false));
|
|
|
- table.addCell(PdfTable.createCell("(大写):"+ Convert.digitToChinese(insuranceApplication.getInsuranceFee())+"\u3000\u3000\u3000\u3000(小写):¥ "+new DecimalFormat("#,##0.00").format(insuranceApplication.getInsuranceFee()).toString(), textfont, Element.ALIGN_LEFT,5,1,BaseColor.WHITE,false));
|
|
|
+ table.addCell(PdfTable.createCell("(大写):"+ Convert.digitToChinese(insurancePolicy.getInsuranceFee())+"\u3000\u3000\u3000\u3000(小写):¥ "+new DecimalFormat("#,##0.00").format(insurancePolicy.getInsuranceFee()).toString(), textfont, Element.ALIGN_LEFT,5,1,BaseColor.WHITE,false));
|
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
|
|
|
table.addCell(PdfTable.createCell("保险期间", textfont, Element.ALIGN_CENTER,2,1,BaseColor.WHITE,false));
|
|
|
- table.addCell(PdfTable.createCell("自"+simpleDateFormat.format(insuranceApplication.getStartTime())+"零时起至"+simpleDateFormat.format(insuranceApplication.getEndTime())+"二十四时止。", textfont, Element.ALIGN_CENTER,5,1,BaseColor.WHITE,false));
|
|
|
+ table.addCell(PdfTable.createCell("自"+simpleDateFormat.format(insurancePolicy.getStartTime())+"零时起至"+simpleDateFormat.format(insurancePolicy.getEndTime())+"二十四时止。", textfont, Element.ALIGN_CENTER,5,1,BaseColor.WHITE,false));
|
|
|
|
|
|
table.addCell(PdfTable.createCell("保险合同争议处理", textfont, Element.ALIGN_CENTER,2,1,BaseColor.WHITE,false));
|
|
|
table.addCell(PdfTable.createCell("□提交______________仲裁委员会仲裁 □诉讼", textfont, Element.ALIGN_LEFT,5,1,BaseColor.WHITE,false));
|