From aa561988699dd5395400127e2bb4c8fdd5ccbb1d Mon Sep 17 00:00:00 2001 From: "vluk@2fi-solutions.com.hk" Date: Tue, 28 Oct 2025 01:08:56 +0800 Subject: [PATCH] no message --- .../lioner/pdf/service/PdfMergeService.java | 3 +- .../lioner/pdf/service/PdfService.java | 273 ++++++++++++++---- 2 files changed, 213 insertions(+), 63 deletions(-) diff --git a/src/main/java/com/ffii/lioner/modules/lioner/pdf/service/PdfMergeService.java b/src/main/java/com/ffii/lioner/modules/lioner/pdf/service/PdfMergeService.java index 4760d3e..ecda115 100644 --- a/src/main/java/com/ffii/lioner/modules/lioner/pdf/service/PdfMergeService.java +++ b/src/main/java/com/ffii/lioner/modules/lioner/pdf/service/PdfMergeService.java @@ -51,7 +51,7 @@ public class PdfMergeService { public byte[] mergePdfsItext7(String formCode, byte[] pdfABytes, byte[] pdfBBytes) throws IOException { // Defined constants for clarity - final int IDA_SIG_PAGE = 11; // Page to skip for IDA + final int IDA_SIG_PAGE = 15; // Page to skip for IDA final int FNA_SIG_PAGE = 7; // Page to skip for FNA final int HSBC_REP_PAGE = 11; // Page to replace for HSBCFIN final int HSBCA31_REP_START = 28; // Start page to replace for HSBCA31 (Page 28) @@ -70,6 +70,7 @@ public class PdfMergeService { PdfWriter writer = new PdfWriter(baos); PdfDocument mergedPdf = new PdfDocument(writer); + PdfMerger merger = new PdfMerger(mergedPdf); // 1. Process PDF A (The primary document) diff --git a/src/main/java/com/ffii/lioner/modules/lioner/pdf/service/PdfService.java b/src/main/java/com/ffii/lioner/modules/lioner/pdf/service/PdfService.java index 1dbb467..57ab39e 100644 --- a/src/main/java/com/ffii/lioner/modules/lioner/pdf/service/PdfService.java +++ b/src/main/java/com/ffii/lioner/modules/lioner/pdf/service/PdfService.java @@ -608,6 +608,86 @@ public class PdfService extends AbstractBaseEntityService commonField.setNameChi(fieldValue); + + case "formMedical" -> commonField.getOthers().put("formMedical", fieldValue); + case "formNonMedical" -> commonField.getOthers().put("formNonMedical", fieldValue); + + case "ch_single" -> commonField.getOthers().put("maritalStatusSingle", fieldValue); + case "ch_married" -> commonField.getOthers().put("maritalStatusMarried", fieldValue); + case "ch_marital_others" -> commonField.getOthers().put("maritalStatusOther", fieldValue); + case "fill_marital_others" -> commonField.getOthers().put("maritalStatusOtherDesc", fieldValue); + case "fill_11" -> commonField.setIdCard(fieldValue); - case "fill_12" -> commonField.setCountryOfIssue(fieldValue); + case "ch_hkid" -> commonField.getOthers().put("hkidPerm", fieldValue); + case "ch_hkid_non" -> commonField.getOthers().put("hkidNon", fieldValue); + case "ch_prcid" -> commonField.getOthers().put("prcId", fieldValue); + case "ch_othersid" -> commonField.getOthers().put("othersId", fieldValue); + case "ch_passport" -> commonField.getOthers().put("passportYes", fieldValue); + case "ch_travel_doc" -> commonField.getOthers().put("travelDocYes", fieldValue); case "fill_13" -> commonField.setPassportNo(fieldValue); + case "fill_14" -> commonField.getOthers().put("othersIdType", fieldValue); + + case "fill_12" -> commonField.setCountryOfIssue(fieldValue); case "fill_14_date" -> commonField.getOthers().put("passportExpiryDate", fieldValue); case "fill_15" -> commonField.setPlaceOfBirth(fieldValue); case "fill_16" -> commonField.setCountryOfCitizenship(fieldValue); @@ -2556,6 +2727,7 @@ public class PdfService extends AbstractBaseEntityService commonField.setMmDateOfBirth(fieldValue); case "date_yyyy" -> commonField.setYyyyDateOfBirth(fieldValue); + case "fill_phone_code" -> commonField.getOthers().put("contactNoCode", fieldValue); case "fill_17" -> commonField.setContactNo(fieldValue); case "fill_18" -> commonField.setEmail(fieldValue); //case "fill_19" -> commonField.getOthers().put("address1", fieldValue); @@ -2568,50 +2740,25 @@ public class PdfService extends AbstractBaseEntityService commonField.setEduPostSec(fieldValue); /* Page1 End */ /* Page2 Start */ - case "own_income" -> commonField.setOwn_income(fieldValue); - case "savings" -> commonField.setSavings(fieldValue); - case "premium_financing" -> commonField.setPremium_financing(fieldValue); - case "others_funds" -> commonField.setOthers_funds(fieldValue); - case "others_funds_desc" -> commonField.setOthers_funds_desc(fieldValue); - - - case "fill_1_2" -> { - commonField.getOthers().put("relateFatherRelation", "Father"); - commonField.getOthers().put("relateFatherName", fieldValue); - } - case "fill_2_2" -> commonField.getOthers().put("relateFatherAge", fieldValue); - case "fill_6_2" -> { - commonField.getOthers().put("relateMotherRelation", "Mother"); - commonField.getOthers().put("relateMotherName", fieldValue); - } - case "fill_7_2" -> commonField.getOthers().put("relateMotherAge", fieldValue); - case "fill_11_2" -> { - commonField.getOthers().put("relateSpouseRelation", "Spouse"); - commonField.getOthers().put("relateSpouseName", fieldValue); - } - case "fill_12_2" -> commonField.getOthers().put("relateSpouseAge", fieldValue); - case "fill_16_2" -> { - commonField.getOthers().put("relateSonRelation", "Son"); - commonField.getOthers().put("relateSonName", fieldValue); - } - case "fill_17_2" -> commonField.getOthers().put("relateSonAge", fieldValue); - case "fill_21_2" -> { - commonField.getOthers().put("relateDaughterRelation", "Daughter"); - commonField.getOthers().put("relateDaughterName", fieldValue); - } - case "fill_22_2" -> commonField.getOthers().put("relateDaughterAge", fieldValue); - case "fill_26" -> { - commonField.getOthers().put("relateBotherRelation", "Bother"); - commonField.getOthers().put("relateBotherName", fieldValue); - } - case "fill_27" -> commonField.getOthers().put("relateBotherAge", fieldValue); - case "fill_31" -> { - commonField.getOthers().put("relateSisterRelation", "Sister"); - commonField.getOthers().put("relateSisterName", fieldValue); + case "salary" -> commonField.setFna_c3b_salary(fieldValue); + case "income" -> commonField.setFna_c3b_income(fieldValue); + case "savings" -> commonField.setFna_c3b_saving(fieldValue); + case "premium_financing" -> commonField.setFna_c3b_policy(fieldValue); + case "policy_replacement" -> commonField.setFna_c3b_policy(fieldValue); + case "others_funds" -> commonField.setFna_c3b_others(fieldValue); + case "others_funds_desc" -> commonField.setFna_c3b_desc(fieldValue); + + case "relate1_name" -> { + for(int i=1; i<=9; i++){ + commonField.getOthers().put("relate" + i + "_name", "relate" + i + "_name"); + commonField.getOthers().put("relate" + i + "_relationship", "relate" + i + "_relationship"); + commonField.getOthers().put("relate" + i + "_age", "relate" + i + "_age"); + commonField.getOthers().put("relate" + i + "_occ", "relate" + i + "_occ"); + commonField.getOthers().put("relate" + i + "_marital", "relate" + i + "_marital"); + commonField.getOthers().put("relate" + i + "_dep_dd", "relate" + i + "_dep_dd"); + } } - case "fill_32" -> commonField.getOthers().put("relateSisterAge", fieldValue); - /* Page2 End */ /* Page3 Start */ case "toggle_3_2" -> commonField.setBankruptYes(fieldValue); @@ -2630,6 +2777,9 @@ public class PdfService extends AbstractBaseEntityService commonField.getOthers().put("travelYes", fieldValue); + case "ch_travel_no" -> commonField.getOthers().put("travelNo", fieldValue); + case "toggle_1_3" -> commonField.getOthers().put("futureAddressYes", fieldValue); case "toggle_2_2" -> commonField.getOthers().put("futureAddressNo", fieldValue); case "fill_1_4_1" -> commonField.getOthers().put("futureAddress", fieldValue); @@ -3452,8 +3602,7 @@ public class PdfService extends AbstractBaseEntityService commonField.setPassportNo(fieldValue); + //case "1_10_passport_num" -> commonField.setPassportNo(fieldValue); case "1_12_1" -> commonField.setOccupation(fieldValue); case "1_12_2" -> commonField.setOccupationTitle(fieldValue); @@ -3860,8 +4009,8 @@ public class PdfService extends AbstractBaseEntityService commonField.getOthers().put("corAddressNt", fieldValue); /* Page2 End */ /* Page3 Start */ - case "1_13b_tel_mobile_code" -> commonField.setContactNo(fieldValue); - case "1_13b_email" -> commonField.setEmail(fieldValue); + //case "1_13b_tel_mobile_code" -> commonField.setContactNo(fieldValue); + //case "1_13b_email" -> commonField.setEmail(fieldValue); case "1_14d_tax1" -> commonField.setTaxResidency1(fieldValue); case "1_14d_tax2" -> commonField.setTaxResidency2(fieldValue);