diff --git a/src/main/java/com/ffii/lioner/modules/lioner/commonField/entity/CommonField.java b/src/main/java/com/ffii/lioner/modules/lioner/commonField/entity/CommonField.java index efb8b60..be4a970 100644 --- a/src/main/java/com/ffii/lioner/modules/lioner/commonField/entity/CommonField.java +++ b/src/main/java/com/ffii/lioner/modules/lioner/commonField/entity/CommonField.java @@ -1,5 +1,12 @@ package com.ffii.lioner.modules.lioner.commonField.entity; +import java.util.HashMap; +import java.util.Map; + +import org.hibernate.annotations.JdbcTypeCode; +import org.hibernate.annotations.Type; +import org.hibernate.type.SqlTypes; + import com.ffii.core.entity.BaseEntity; import jakarta.persistence.Column; @@ -306,12 +313,6 @@ public class CommonField extends BaseEntity{ @Column private String email; - @Column - private String address1; - - @Column - private String address2; - //IDA @Column private String own_income; @@ -346,12 +347,6 @@ public class CommonField extends BaseEntity{ @Column private String companyName; - @Column - private String companyAddress1; - - @Column - private String companyAddress2; - @Column private String companyNature1; @@ -496,6 +491,205 @@ public class CommonField extends BaseEntity{ @Column private String insuranceCurrency3; + @Column + private String employed; + + @Column + private String homemaker; + + @Column + private String student; + + @Column + private String investor; + + @Column + private String retired; + + @Column + private String employedSelf; + + @Column + private String employedNon; + + @Column + private String partTime; + + @Column + private String ultimateTotalLife; + + @Column + private String declinedYes; + + @Column + private String declinedNo; + + @Column + private String declinedDesc; + + @Column + private String hazardousActivity; + + @Column + private String incomeSalary; + + @Column + private String incomeSalaryLastYear; + + @Column + private String incomeBonus; + + @Column + private String incomeBonusLastYear; + + @Column + private String incomeOther; + + @Column + private String incomeOtherLastYear; + + @Column + private String incomeInterest; + + @Column + private String incomeInterestLastYear; + + @Column + private String incomeDividents; + + @Column + private String incomeDividentsLastYear; + + @Column + private String incomeRentals; + + @Column + private String incomeRentalsLastYear; + + @Column + private String totalAnnualIncome; + + @Column + private String assetCash; + + @Column + private String assetInvestment; + + @Column + private String assetRealEstate; + + @Column + private String assetNetBusinessInterest; + + @Column + private String assetProperties; + + @Column + private String liaLoan; + + @Column + private String liaMargin; + + @Column + private String liaLoanGurantee; + + @Column + private String liaMortgage; + + @Column + private String liaOther; + + @Column + private String realEstatePurchaseDate1; + + @Column + private String realEstatePurchaseDate2; + + @Column + private String realEstatePurchaseDate3; + + @Column + private String bankruptYes; + + @Column + private String bankruptNo; + + @Column + private String bankruptDesc; + + @Column + private String replaceInsuranceYes; + + @Column + private String replaceInsuranceNo; + + /* + + @Column + private String crAddressRoom; + + @Column + private String crAddressFloor; + + @Column + private String crAddressBlock; + + @Column + private String crAddressBuilding; + + @Column + private String crAddressStreet; + + @Column + private String crAddressArea; + + @Column + private String crAddressCity; + + @Column + private String crAddressCountry; + + @Column + private String crAddressPostalCode; + + @Column + private String corAddressRoom; + + @Column + private String corAddressFloor; + + @Column + private String corAddressBlock; + + @Column + private String corAddressBuilding; + + @Column + private String corAddressStreet; + + @Column + private String corAddressArea; + + @Column + private String corAddressCity; + + @Column + private String corAddressCountry; + + @Column + private String corAddressPostalCode; + + */ + + @Column + private String tobarccoYes; + + @Column + private String tobarccoNo; + + @Column(columnDefinition = "json") + @JdbcTypeCode(SqlTypes.JSON) + private Map others = new HashMap<>(); //this is a logical field @Column @@ -1287,22 +1481,6 @@ public class CommonField extends BaseEntity{ this.email = email; } - public String getAddress1() { - return address1; - } - - public void setAddress1(String address1) { - this.address1 = address1; - } - - public String getAddress2() { - return address2; - } - - public void setAddress2(String address2) { - this.address2 = address2; - } - public String getOwn_income() { return own_income; } @@ -1391,22 +1569,6 @@ public class CommonField extends BaseEntity{ this.companyName = companyName; } - public String getCompanyAddress1() { - return companyAddress1; - } - - public void setCompanyAddress1(String companyAddress1) { - this.companyAddress1 = companyAddress1; - } - - public String getCompanyAddress2() { - return companyAddress2; - } - - public void setCompanyAddress2(String companyAddress2) { - this.companyAddress2 = companyAddress2; - } - public String getCompanyNature1() { return companyNature1; } @@ -1790,9 +1952,382 @@ public class CommonField extends BaseEntity{ public void setInsuranceLife3(String insuranceLife3) { this.insuranceLife3 = insuranceLife3; } + + public String getEmployed() { + return employed; + } - + public void setEmployed(String employed) { + this.employed = employed; + } + + public String getHomemaker() { + return homemaker; + } + + public void setHomemaker(String homemaker) { + this.homemaker = homemaker; + } + + public String getStudent() { + return student; + } + + public void setStudent(String student) { + this.student = student; + } + + public String getInvestor() { + return investor; + } + + public void setInvestor(String investor) { + this.investor = investor; + } + public String getRetired() { + return retired; + } + + public void setRetired(String retired) { + this.retired = retired; + } + + public String getEmployedSelf() { + return employedSelf; + } + + public void setEmployedSelf(String employedSelf) { + this.employedSelf = employedSelf; + } + + public String getEmployedNon() { + return employedNon; + } + + public void setEmployedNon(String employedNon) { + this.employedNon = employedNon; + } + + public String getPartTime() { + return partTime; + } + + public void setPartTime(String partTime) { + this.partTime = partTime; + } + + public String getUltimateTotalLife() { + return ultimateTotalLife; + } + + public void setUltimateTotalLife(String ultimateTotalLife) { + this.ultimateTotalLife = ultimateTotalLife; + } + + public String getDeclinedYes() { + return declinedYes; + } + + public void setDeclinedYes(String declinedYes) { + this.declinedYes = declinedYes; + } + + public String getDeclinedNo() { + return declinedNo; + } + + public void setDeclinedNo(String declinedNo) { + this.declinedNo = declinedNo; + } + + public String getDeclinedDesc() { + return declinedDesc; + } + + public void setDeclinedDesc(String declinedDesc) { + this.declinedDesc = declinedDesc; + } + + public String getHazardousActivity() { + return hazardousActivity; + } + + public void setHazardousActivity(String hazardousActivity) { + this.hazardousActivity = hazardousActivity; + } + + public String getIncomeSalary() { + return incomeSalary; + } + + public void setIncomeSalary(String incomeSalary) { + this.incomeSalary = incomeSalary; + } + + public String getIncomeSalaryLastYear() { + return incomeSalaryLastYear; + } + + public void setIncomeSalaryLastYear(String incomeSalaryLastYear) { + this.incomeSalaryLastYear = incomeSalaryLastYear; + } + + public String getIncomeBonus() { + return incomeBonus; + } + + public void setIncomeBonus(String incomeBonus) { + this.incomeBonus = incomeBonus; + } + + public String getIncomeBonusLastYear() { + return incomeBonusLastYear; + } + + public void setIncomeBonusLastYear(String incomeBonusLastYear) { + this.incomeBonusLastYear = incomeBonusLastYear; + } + + public String getIncomeOther() { + return incomeOther; + } + + public void setIncomeOther(String incomeOther) { + this.incomeOther = incomeOther; + } + + public String getIncomeOtherLastYear() { + return incomeOtherLastYear; + } + + public void setIncomeOtherLastYear(String incomeOtherLastYear) { + this.incomeOtherLastYear = incomeOtherLastYear; + } + + public String getIncomeInterest() { + return incomeInterest; + } + + public void setIncomeInterest(String incomeInterest) { + this.incomeInterest = incomeInterest; + } + + public String getIncomeInterestLastYear() { + return incomeInterestLastYear; + } + + public void setIncomeInterestLastYear(String incomeInterestLastYear) { + this.incomeInterestLastYear = incomeInterestLastYear; + } + + public String getIncomeDividents() { + return incomeDividents; + } + + public void setIncomeDividents(String incomeDividents) { + this.incomeDividents = incomeDividents; + } + + public String getIncomeDividentsLastYear() { + return incomeDividentsLastYear; + } + + public void setIncomeDividentsLastYear(String incomeDividentsLastYear) { + this.incomeDividentsLastYear = incomeDividentsLastYear; + } + + public String getIncomeRentals() { + return incomeRentals; + } + + public void setIncomeRentals(String incomeRentals) { + this.incomeRentals = incomeRentals; + } + + public String getIncomeRentalsLastYear() { + return incomeRentalsLastYear; + } + + public void setIncomeRentalsLastYear(String incomeRentalsLastYear) { + this.incomeRentalsLastYear = incomeRentalsLastYear; + } + + public String getAssetCash() { + return assetCash; + } + + public void setAssetCash(String assetCash) { + this.assetCash = assetCash; + } + + public String getAssetInvestment() { + return assetInvestment; + } + + public void setAssetInvestment(String assetInvestment) { + this.assetInvestment = assetInvestment; + } + + public String getAssetRealEstate() { + return assetRealEstate; + } + + public void setAssetRealEstate(String assetRealEstate) { + this.assetRealEstate = assetRealEstate; + } + + public String getAssetNetBusinessInterest() { + return assetNetBusinessInterest; + } + + public void setAssetNetBusinessInterest(String assetNetBusinessInterest) { + this.assetNetBusinessInterest = assetNetBusinessInterest; + } + + public String getAssetProperties() { + return assetProperties; + } + + public void setAssetProperties(String assetProperties) { + this.assetProperties = assetProperties; + } + + public String getLiaLoan() { + return liaLoan; + } + + public void setLiaLoan(String liaLoan) { + this.liaLoan = liaLoan; + } + + public String getLiaMargin() { + return liaMargin; + } + + public void setLiaMargin(String liaMargin) { + this.liaMargin = liaMargin; + } + + public String getLiaLoanGurantee() { + return liaLoanGurantee; + } + + public void setLiaLoanGurantee(String liaLoanGurantee) { + this.liaLoanGurantee = liaLoanGurantee; + } + + public String getLiaMortgage() { + return liaMortgage; + } + + public void setLiaMortgage(String liaMortgage) { + this.liaMortgage = liaMortgage; + } + + public String getLiaOther() { + return liaOther; + } + + public void setLiaOther(String liaOther) { + this.liaOther = liaOther; + } + + public String getTotalAnnualIncome() { + return totalAnnualIncome; + } + + public void setTotalAnnualIncome(String totalAnnualIncome) { + this.totalAnnualIncome = totalAnnualIncome; + } + + public String getRealEstatePurchaseDate1() { + return realEstatePurchaseDate1; + } + + public void setRealEstatePurchaseDate1(String realEstatePurchaseDate1) { + this.realEstatePurchaseDate1 = realEstatePurchaseDate1; + } + + public String getRealEstatePurchaseDate2() { + return realEstatePurchaseDate2; + } + + public void setRealEstatePurchaseDate2(String realEstatePurchaseDate2) { + this.realEstatePurchaseDate2 = realEstatePurchaseDate2; + } + + public String getRealEstatePurchaseDate3() { + return realEstatePurchaseDate3; + } + + public void setRealEstatePurchaseDate3(String realEstatePurchaseDate3) { + this.realEstatePurchaseDate3 = realEstatePurchaseDate3; + } + + public String getBankruptYes() { + return bankruptYes; + } + + public void setBankruptYes(String bankruptYes) { + this.bankruptYes = bankruptYes; + } + + public String getBankruptNo() { + return bankruptNo; + } + + public void setBankruptNo(String bankruptNo) { + this.bankruptNo = bankruptNo; + } + + public String getBankruptDesc() { + return bankruptDesc; + } + + public void setBankruptDesc(String bankruptDesc) { + this.bankruptDesc = bankruptDesc; + } + + public String getTobarccoYes() { + return tobarccoYes; + } + + public void setTobarccoYes(String tobarccoYes) { + this.tobarccoYes = tobarccoYes; + } + + public String getReplaceInsuranceYes() { + return replaceInsuranceYes; + } + + public void setReplaceInsuranceYes(String replaceInsuranceYes) { + this.replaceInsuranceYes = replaceInsuranceYes; + } + + public String getReplaceInsuranceNo() { + return replaceInsuranceNo; + } + + public void setReplaceInsuranceNo(String replaceInsuranceNo) { + this.replaceInsuranceNo = replaceInsuranceNo; + } + + public String getTobarccoNo() { + return tobarccoNo; + } + + public void setTobarccoNo(String tobarccoNo) { + this.tobarccoNo = tobarccoNo; + } + + public Map getOthers() { + return others; + } + + public void setOthers(Map others) { + this.others = others; + } } 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 9c5da86..4440fa2 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 @@ -11,6 +11,8 @@ import java.time.format.DateTimeParseException; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; @@ -306,395 +308,25 @@ public class PdfService extends AbstractBaseEntityService commonField.setFna_c3b_desc(fieldValue); + + setValueIfPresent(form, "part3_3_6_2", commonField.getFna_c1c_3_amount()); + /* Page2 End */ + /* Page3 Start */ + + /* Page3 End */ + + if(client != null && client.getConsultantId() != null){ + Consultant consultant = consultantService.find(Long.valueOf(client.getConsultantId())).orElseThrow(); + + if(consultant.getName() != null){ + setValueIfPresent(form, "Full Name of Advisor", consultant.getName()); + } + } + + setValueIfPresent(form, "Full Name of Applicants", commonField.getName()); + //setValueIfPresent(form, "Full Name of Applicants1", commonField.getOthers().get("name1")); + //setValueIfPresent(form, "Full Name of Applicants2", commonField.getOthers().get("name2")); + + } + + private void MLFNA_EN_checkBox(PDAcroForm form2, CommonField commonField){ + /* Page1 Start */ + // exported year? only can one way from FNA b1 d year + setValueIfPresent(form2, "part2_1a", commonField.getFna_b1_a()); + setValueIfPresent(form2, "part2_1b", commonField.getFna_b1_c()); + setValueIfPresent(form2, "part2_1c", commonField.getFna_b1_d()); + setValueIfPresent(form2, "part2_1d", commonField.getFna_b1_e()); + + setValueIfPresent(form2, "part2_1c_a", commonField.getFna_b2_a()); + setValueIfPresent(form2, "part2_1c_b", commonField.getFna_b2_b()); + setValueIfPresent(form2, "part2_1c_c", commonField.getFna_b2_c()); + setValueIfPresent(form2, "part2_1c_d", commonField.getFna_b2_d()); + setValueIfPresent(form2, "part2_1c_e", commonField.getFna_b2_e()); + setValueIfPresent(form2, "part2_1c_f", commonField.getFna_b2_f()); + setValueIfPresent(form2, "part2_1c_g", commonField.getFna_b2_g()); + + setValueIfPresent(form2, "part2_1d_1", commonField.getFna_b1b_1()); + setValueIfPresent(form2, "part2_1d_2", commonField.getFna_b1b_2()); + setValueIfPresent(form2, "part2_1d_3", commonField.getFna_b1b_3()); + + setValueIfPresent(form2, "part2_1e", commonField.getFna_b1_b()); + setValueIfPresent(form2, "part2_1f", commonField.getFna_b1_f()); + + setValueIfPresent(form2, "part2_2_a", commonField.getFna_b2_a()); + setValueIfPresent(form2, "part2_2_b", commonField.getFna_b2_b()); + setValueIfPresent(form2, "part2_2_c", commonField.getFna_b2_c()); + setValueIfPresent(form2, "part2_2_d", commonField.getFna_b2_d()); + setValueIfPresent(form2, "part2_2_e", commonField.getFna_b2_e()); + setValueIfPresent(form2, "part2_2_f", commonField.getFna_b2_f()); + setValueIfPresent(form2, "part2_2_g", commonField.getFna_b2_g()); + /* Page1 End */ + /* Page2 Start */ + setValueIfPresent(form2, "part3_3_5_2a", commonField.getFna_c3b_saving()); + setValueIfPresent(form2, "part3_3_5_2b", commonField.getFna_c3b_investments()); + setValueIfPresent(form2, "part3_3_5_2c", commonField.getFna_c3b_others()); + setValueIfPresent(form2, "part3_3_5_2c_other", commonField.getFna_c3b_desc()); + + setValueIfPresent(form2, "part3_3_6_yes", commonField.getFna_c3c_yes()); + setValueIfPresent(form2, "part3_3_6_no", commonField.getFna_c3c_no()); + + if(convertStringToNum(commonField.getFna_c1c_3_amount()) > 0){ + setValueIfPresent(form2, "part3_3_6_1_yes", "Yes"); + setValueIfPresent(form2, "part3_3_6_1_no", "Off"); + } + + /* Page2 End */ + /* Page3 Start */ + setValueIfPresent(form2, "part3_4_4_1a", commonField.getFna_c3a_2_5()); + setValueIfPresent(form2, "part3_4_4_1b", commonField.getFna_c3a_6_10()); + setValueIfPresent(form2, "part3_4_4_1c", commonField.getFna_c3a_11_15()); + setValueIfPresent(form2, "part3_4_4_1d", commonField.getFna_c3a_16_20()); + setValueIfPresent(form2, "part3_4_4_1f", commonField.getFna_c3a_life()); + if("Yes".equals(commonField.getFna_c3a_life()) || "Yes".equals(commonField.getFna_c3a_6_10()) + || "Yes".equals(commonField.getFna_c3a_11_15()) || "Yes".equals(commonField.getFna_c3a_16_20()) || "Yes".equals(commonField.getFna_c3a_life()) + ){ + setValueIfPresent(form2, "part3_4_regular", "Yes"); + } + setValueIfPresent(form2, "part3_4_single_pay", commonField.getFna_c3a_single_pay()); + + setValueIfPresent(form2, "a Business Earning", commonField.getFna_c3b_salary()); + setValueIfPresent(form2, "b Others Please specify", commonField.getFna_c3b_income()); + setValueIfPresent(form2, "Check Box15", commonField.getFna_c3b_investments()); + setValueIfPresent(form2, "Check Box16", commonField.getFna_c3b_others()); + + /* Page3 End */ + } + + private void SLFNA_EN_textBox(PdfAcroForm form, CommonField commonField, Client client){ + /* Page1 Start */ + setValueIfPresent(form, "name", commonField.getName()); + setValueIfPresent(form, "date_of_birth", commonField.getDateOfBirth()); + setValueIfPresent(form, "address1", commonField.getOthers().get("address1")); + setValueIfPresent(form, "address2", commonField.getOthers().get("address2")); + setValueIfPresent(form, "contact", commonField.getContactNo()); + setValueIfPresent(form, "email", commonField.getEmail()); + setValueIfPresent(form, "occupation", commonField.getOccupation()); + + setValueIfPresent(form, "1amount", commonField.getFna_b1_d_amount()); + setValueIfPresent(form, "cb1f", commonField.getFna_b1_f_other()); + + /* Page1 End */ + /* Page2 Start */ + setValueIfPresent(form, "4a1", commonField.getFna_c1d_amount()); + setValueIfPresent(form, "4b1", commonField.getFna_c2a_amount()); + setValueIfPresent(form, "4b2", commonField.getFna_c2a_desc()); + setValueIfPresent(form, "4b3", commonField.getFna_c2b_amount()); + + setValueIfPresent(form, "4b5", substractNums(commonField.getFna_c2a_amount(), commonField.getFna_c2b_amount())); + + /* Page2 End */ + + /* Page4 Start */ + setValueIfPresent(form, "6a2_other1", commonField.getFna_d_desc()); + + setValueIfPresent(form, "5obj1", commonField.getOthers().get("recObj1")); + setValueIfPresent(form, "5obj2", commonField.getOthers().get("recObj2")); + setValueIfPresent(form, "5obj3", commonField.getOthers().get("recObj3")); + setValueIfPresent(form, "5obj4", commonField.getOthers().get("recObj4")); + setValueIfPresent(form, "5obj5", commonField.getOthers().get("recObj5")); + setValueIfPresent(form, "5obj6", commonField.getOthers().get("recObj6")); + + setValueIfPresent(form, "5name1_1", commonField.getOthers().get("recProd1_1")); + setValueIfPresent(form, "5name1_2", commonField.getOthers().get("recProd1_2")); + setValueIfPresent(form, "5name2_1", commonField.getOthers().get("recProd2_1")); + setValueIfPresent(form, "5name2_2", commonField.getOthers().get("recProd2_2")); + setValueIfPresent(form, "5name3_1", commonField.getOthers().get("recProd3_1")); + setValueIfPresent(form, "5name3_2", commonField.getOthers().get("recProd3_2")); + setValueIfPresent(form, "5name4_1", commonField.getOthers().get("recProd4_1")); + setValueIfPresent(form, "5name4_2", commonField.getOthers().get("recProd4_2")); + setValueIfPresent(form, "5name5_1", commonField.getOthers().get("recProd5_1")); + setValueIfPresent(form, "5name5_2", commonField.getOthers().get("recProd5_2")); + setValueIfPresent(form, "5name6_1", commonField.getOthers().get("recProd6_1")); + setValueIfPresent(form, "5name6_2", commonField.getOthers().get("recProd6_2")); + + setValueIfPresent(form, "5slected1_1", commonField.getOthers().get("recSelect1_1")); + setValueIfPresent(form, "5slected1_2", commonField.getOthers().get("recSelect1_2")); + setValueIfPresent(form, "5slected2_1", commonField.getOthers().get("recSelect2_1")); + setValueIfPresent(form, "5slected2_2", commonField.getOthers().get("recSelect2_2")); + setValueIfPresent(form, "5slected3_1", commonField.getOthers().get("recSelect3_1")); + setValueIfPresent(form, "5slected3_2", commonField.getOthers().get("recSelect3_2")); + setValueIfPresent(form, "5slected4_1", commonField.getOthers().get("recSelect4_1")); + setValueIfPresent(form, "5slected4_2", commonField.getOthers().get("recSelect4_2")); + setValueIfPresent(form, "5slected5_1", commonField.getOthers().get("recSelect5_1")); + setValueIfPresent(form, "5slected5_2", commonField.getOthers().get("recSelect5_2")); + setValueIfPresent(form, "5slected6_1", commonField.getOthers().get("recSelect6_1")); + setValueIfPresent(form, "5slected6_2", commonField.getOthers().get("recSelect6_2")); + + /* Page4 End */ + + /* special fields start */ + + //age + if(StringUtil.isNotEmpty(commonField.getDateOfBirth())){ + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy"); + + try { + // Parse the string into a LocalDate object + LocalDate dob = LocalDate.parse(commonField.getDateOfBirth(), formatter); + + // Get the current date + LocalDate currentDate = LocalDate.now(); + + // Calculate the period between the two dates + Period period = Period.between(dob, currentDate); + + setValueIfPresent(form, "age", String.valueOf(period.getYears())); + + } catch (DateTimeParseException e) { + System.err.println("Error parsing date. Please ensure the format is dd/MM/yyyy."); + } + + } + /* special fields end */ + + if(client != null && client.getConsultantId() != null){ + Consultant consultant = consultantService.find(Long.valueOf(client.getConsultantId())).orElseThrow(); + + if(consultant.getName() != null){ + setValueIfPresent(form, "consultant_name_and_num", consultant.getName()); + } + } + + setValueIfPresent(form, "applicant_name", commonField.getName()); + setValueIfPresent(form, "applicant_name1", commonField.getOthers().get("name1")); + setValueIfPresent(form, "applicant_name2", commonField.getOthers().get("name2")); + } + + private void SLFNA_EN_checkBox(PDAcroForm form2, CommonField commonField){ + /* Page1 Start */ + if(commonField.getMaritalStatus() != null && "SINGLE".equals(commonField.getMaritalStatus().toUpperCase())){ + setValueIfPresent(form2, "chhs", "Yes"); + } + if(commonField.getMaritalStatus() != null && "MARRIED".equals(commonField.getMaritalStatus().toUpperCase())){ + setValueIfPresent(form2, "chhm", "Yes"); + } + + setValueIfPresent(form2, "chh1", commonField.getEduPri()); + setValueIfPresent(form2, "chh2", commonField.getEduSec()); + setValueIfPresent(form2, "chh4", commonField.getEduPostSec()); + + setValueIfPresent(form2, "chh5", commonField.getFna_a_life_0()); + setValueIfPresent(form2, "chh6", commonField.getFna_a_life_less_5()); + setValueIfPresent(form2, "chh7", commonField.getFna_a_life_above_5()); + + setValueIfPresent(form2, "cb1a", commonField.getFna_b1_a()); + setValueIfPresent(form2, "cb1b", commonField.getFna_b1_b()); + setValueIfPresent(form2, "cb1c", commonField.getFna_b1_c()); + setValueIfPresent(form2, "cb1d", commonField.getFna_b1_d()); + setValueIfPresent(form2, "cb1e", commonField.getFna_b1_e()); + + setValueIfPresent(form2, "cb10", commonField.getFna_b1b_1()); + setValueIfPresent(form2, "cb11", commonField.getFna_b1b_2()); + setValueIfPresent(form2, "cb12", commonField.getFna_b1b_3()); + + setValueIfPresent(form2, "cb13", commonField.getFna_b2_a()); + setValueIfPresent(form2, "cb14", commonField.getFna_b2_b()); + setValueIfPresent(form2, "cb15", commonField.getFna_b2_c()); + setValueIfPresent(form2, "cb16", commonField.getFna_b2_d()); + setValueIfPresent(form2, "cb17", commonField.getFna_b2_e()); + setValueIfPresent(form2, "cb18", commonField.getFna_b2_f()); + setValueIfPresent(form2, "cb19", commonField.getFna_b2_g()); + + /* Page1 END */ + /* Page2 Start */ + setValueIfPresent(form2, "cb4a1", commonField.getFna_c1d_amount()); + setValueIfPresent(form2, "cb4b1", commonField.getFna_c2a_cash()); + setValueIfPresent(form2, "cb4b2", commonField.getFna_c2a_bank_account()); + setValueIfPresent(form2, "cb4b3", commonField.getFna_c2a_market_account()); + setValueIfPresent(form2, "cb4b4", commonField.getFna_c2a_stocks()); + setValueIfPresent(form2, "cb4b5", commonField.getFna_c2a_bonds()); + setValueIfPresent(form2, "cb4b6", commonField.getFna_c2a_us()); + setValueIfPresent(form2, "cb4b7", commonField.getFna_c2a_others()); + + setValueIfPresent(form2, "cb4c1", commonField.getFna_c3a_2_5()); + setValueIfPresent(form2, "cb4c2", commonField.getFna_c3a_6_10()); + setValueIfPresent(form2, "cb4c3", commonField.getFna_c3a_11_15()); + setValueIfPresent(form2, "cb4c4", commonField.getFna_c3a_16_20()); + setValueIfPresent(form2, "cb4c5", commonField.getFna_c3a_life()); + setValueIfPresent(form2, "cb4c6", commonField.getFna_c3a_single_pay()); + + setValueIfPresent(form2, "cb4d1", commonField.getFna_c1e_10()); + setValueIfPresent(form2, "cb4d2", commonField.getFna_c1e_10_20()); + setValueIfPresent(form2, "cb4d3", commonField.getFna_c1e_21_30()); + setValueIfPresent(form2, "cb4d4", commonField.getFna_c1e_31_40()); + setValueIfPresent(form2, "cb4d5", commonField.getFna_c1e_41_50()); + setValueIfPresent(form2, "cb4d6", commonField.getFna_c1e_50()); + + setValueIfPresent(form2, "cb4e1", commonField.getFna_c3b_salary()); + setValueIfPresent(form2, "cb4e2", commonField.getFna_c3b_income()); + setValueIfPresent(form2, "cb4e3", commonField.getFna_c3b_investments()); + setValueIfPresent(form2, "cb4e4", commonField.getFna_c3b_saving()); + setValueIfPresent(form2, "cb4e5", commonField.getFna_c3b_others()); + + setValueIfPresent(form2, "cb4h1", commonField.getFna_c3c_yes()); + setValueIfPresent(form2, "cb4h2", commonField.getFna_c3c_no()); + /* Page2 End */ + + /* Page4 Start */ + setValueIfPresent(form2, "cb6a1", commonField.getFna_d_1()); + setValueIfPresent(form2, "cb6a2", commonField.getFna_d_3()); + /* Page4 End */ + } + + private void SLAPP_textBox(PdfAcroForm form, CommonField commonField, Client client){ + /* Page1 Start */ + setValueIfPresent(form, "1_2_name_ch", commonField.getNameChi()); + + setValueIfPresent(form, "1_6_dd", commonField.getDdDateOfBirth()); + setValueIfPresent(form, "1_6_mm", commonField.getDdDateOfBirth()); + setValueIfPresent(form, "1_6_yyyy", commonField.getYyyyDateOfBirth()); + + setValueIfPresent(form, "1_7_country", commonField.getPlaceOfBirth()); + setValueIfPresent(form, "1_8", commonField.getCountryOfCitizenship()); + + if("HK".equals(commonField.getCountryOfIssue()) || "Hong Kong".equals(commonField.getCountryOfIssue())){ + setValueIfPresent(form, "1_10_id_num", commonField.getIdCard()); + } + + setValueIfPresent(form, "1_8", commonField.getCountryOfCitizenship()); + + setValueIfPresent(form, "1_12_1", commonField.getOccupation()); + setValueIfPresent(form, "1_12_2", commonField.getOccupationTitle()); + + setValueIfPresent(form, "1_12_5", commonField.getFna_c1a_amount()); + if(commonField.getFna_c1a_amount() != null && !commonField.getFna_c1a_amount().isBlank()){ + setValueIfPresent(form, "1_12_5_usd", "USD"); + setValueIfPresent(form, "1_12_5_pa", "P.A."); + } + setValueIfPresent(form, "1_12_6", commonField.getCompanyName()); + + setValueIfPresent(form, "1_12_7_1", commonField.getOthers().get("companyAddress1")); + setValueIfPresent(form, "1_12_7_2", commonField.getOthers().get("companyAddress2")); + + setValueIfPresent(form, "1_12_8_1", commonField.getCompanyNature1()); + setValueIfPresent(form, "1_12_8_2", commonField.getCompanyNature2()); + + /* + setValueIfPresent(form, "ch1_13_rm", commonField.getCrAddressRoom()); + setValueIfPresent(form, "ch1_13_floor", commonField.getCrAddressFloor()); + setValueIfPresent(form, "ch1_13_block", commonField.getCrAddressBlock()); + setValueIfPresent(form, "ch1_13_building", commonField.getCrAddressBuilding()); + setValueIfPresent(form, "ch1_13_street", commonField.getCrAddressStreet()); + setValueIfPresent(form, "ch1_13_country", commonField.getCrAddressCountry()); + setValueIfPresent(form, "1_13_zip", commonField.getCrAddressPostalCode()); + + setValueIfPresent(form, "ch1_13_corr_rm", commonField.getCorAddressRoom()); + setValueIfPresent(form, "ch1_13_corr_floor", commonField.getCorAddressFloor()); + setValueIfPresent(form, "ch1_13_corr_block", commonField.getCorAddressBlock()); + setValueIfPresent(form, "ch1_13_corr_building", commonField.getCorAddressBuilding()); + setValueIfPresent(form, "ch1_13_corr_street", commonField.getCorAddressStreet()); + setValueIfPresent(form, "ch1_13_corr_zip", commonField.getCorAddressPostalCode()); + */ + setValueIfPresent(form, "ch1_13_rm", commonField.getOthers().get("crAddressRoom")); + setValueIfPresent(form, "ch1_13_floor", commonField.getOthers().get("crAddressFloor")); + setValueIfPresent(form, "ch1_13_block", commonField.getOthers().get("crAddressBlock")); + setValueIfPresent(form, "ch1_13_building", commonField.getOthers().get("crAddressBuilding")); + setValueIfPresent(form, "ch1_13_street", commonField.getOthers().get("crAddressStreet")); + setValueIfPresent(form, "ch1_13_country", commonField.getOthers().get("crAddressCountry")); + setValueIfPresent(form, "1_13_zip", commonField.getOthers().get("crAddressPostalCode")); + setValueIfPresent(form, "ch1_13_hk", commonField.getOthers().get("crAddressHk")); + setValueIfPresent(form, "ch1_13_kln", commonField.getOthers().get("crAddressKln")); + setValueIfPresent(form, "ch1_13_nt", commonField.getOthers().get("crAddressNt")); + + setValueIfPresent(form, "ch1_13_corr_rm", commonField.getOthers().get("corAddressRoom")); + setValueIfPresent(form, "ch1_13_corr_floor", commonField.getOthers().get("corAddressFloor")); + setValueIfPresent(form, "ch1_13_corr_block", commonField.getOthers().get("corAddressBlock")); + setValueIfPresent(form, "ch1_13_corr_building", commonField.getOthers().get("corAddressBuilding")); + setValueIfPresent(form, "ch1_13_street", commonField.getOthers().get("corAddressStreet")); + setValueIfPresent(form, "ch1_13_corr_street", commonField.getOthers().get("corAddressCountry")); + setValueIfPresent(form, "ch1_13_corr_zip", commonField.getOthers().get("corAddressPostalCode")); + setValueIfPresent(form, "ch1_13_corr_hk", commonField.getOthers().get("corAddressHk")); + setValueIfPresent(form, "ch1_13_corr_kln", commonField.getOthers().get("corAddressKln")); + setValueIfPresent(form, "ch1_13_corr_nt", commonField.getOthers().get("crAddressNt")); + + setValueIfPresent(form, "1_13_tel_mobile", commonField.getContactNo()); + + setValueIfPresent(form, "1_14d_tax1", commonField.getTaxResidency1()); + setValueIfPresent(form, "1_14d_tax_num1", commonField.getTaxPin1()); + setValueIfPresent(form, "1_14d_explain1", commonField.getTaxReasonB1()); + + setValueIfPresent(form, "1_14d_tax2", commonField.getTaxResidency2()); + setValueIfPresent(form, "1_14d_tax_num2", commonField.getTaxPin2()); + setValueIfPresent(form, "1_14d_explain2", commonField.getTaxReasonB2()); + + setValueIfPresent(form, "1_14d_tax3", commonField.getTaxResidency3()); + setValueIfPresent(form, "1_14d_tax_num3", commonField.getTaxPin3()); + setValueIfPresent(form, "1_14d_explain3", commonField.getTaxReasonB3()); + + setValueIfPresent(form, "4_1_name1_1", commonField.getInsuranceCompany1_1()); + setValueIfPresent(form, "4_1_name1_2", commonField.getInsuranceCompany1_2()); + setValueIfPresent(form, "4_1_name1_3", commonField.getInsuranceCompany1_3()); + setValueIfPresent(form, "4_1_year1", commonField.getInsuranceYear1()); + setValueIfPresent(form, "4_1_currency1", commonField.getInsuranceCurrency1()); + setValueIfPresent(form, "4_1_sum1", commonField.getInsuranceSumInsured1()); + + setValueIfPresent(form, "4_1_name2_1", commonField.getInsuranceCompany2_1()); + setValueIfPresent(form, "4_1_name2_2", commonField.getInsuranceCompany2_2()); + setValueIfPresent(form, "4_1_name2_3", commonField.getInsuranceCompany2_3()); + setValueIfPresent(form, "4_1_year2", commonField.getInsuranceYear2()); + setValueIfPresent(form, "4_1_currency2", commonField.getInsuranceCurrency2()); + setValueIfPresent(form, "4_1_sum2", commonField.getInsuranceSumInsured2()); + + setValueIfPresent(form, "4_1_name3_1", commonField.getInsuranceCompany3_1()); + setValueIfPresent(form, "4_1_name3_2", commonField.getInsuranceCompany3_2()); + setValueIfPresent(form, "4_1_name3_3", commonField.getInsuranceCompany3_3()); + setValueIfPresent(form, "4_1_year3", commonField.getInsuranceYear3()); + setValueIfPresent(form, "4_1_currency3", commonField.getInsuranceCurrency3()); + setValueIfPresent(form, "4_1_sum3", commonField.getInsuranceSumInsured3()); + + } + + private void SLAPP_checkBox(PDAcroForm form2, CommonField commonField){ + /* Page1 Start */ + setValueIfPresent(form2, "ch1_4_m", commonField.getGenderMale()); + setValueIfPresent(form2, "ch1_4_f", commonField.getGenderFemale()); + + if("HK".equals(commonField.getCountryOfIssue()) || "Hong Kong".equals(commonField.getCountryOfIssue())){ + setValueIfPresent(form2, "1_10_6", "Yes"); + } + + if(commonField.getPassportNo() != null && !commonField.getPassportNo().isBlank()){ + setValueIfPresent(form2, "1_10_6", "Yes"); + } + + if(!form2.getField("1_14d_tax1").getValueAsString().isBlank()){ + setValueIfPresent(form2, "ch1_14d_reason1_b", "On"); + setValueIfPresent(form2, "ch1_14d_reason1_b", "On"); + setValueIfPresent(form2, "ch1_14d_reason1_b", "On"); + } + if(!form2.getField("1_14d_tax2").getValueAsString().isBlank()){ + setValueIfPresent(form2, "ch1_14d_reason2_b", "On"); + setValueIfPresent(form2, "ch1_14d_reason2_b", "On"); + setValueIfPresent(form2, "ch1_14d_reason2_b", "On"); + } + if(!form2.getField("1_14d_tax3").getValueAsString().isBlank()){ + setValueIfPresent(form2, "ch1_14d_reason3_b", "On"); + setValueIfPresent(form2, "ch1_14d_reason3_b", "On"); + setValueIfPresent(form2, "ch1_14d_reason3_b", "On"); + } + + if("A".equals(commonField.getTaxReason1())){ + setValueIfPresent(form2, "ch1_14d_reason1_a", "Off"); + } + if("B".equals(commonField.getTaxReason1())){ + setValueIfPresent(form2, "ch1_14d_reason1_b", "Off"); + } + if("C".equals(commonField.getTaxReason1())){ + setValueIfPresent(form2, "ch1_14d_reason1_c", "Yes"); + } + + if("A".equals(commonField.getTaxReason2())){ + setValueIfPresent(form2, "ch1_14d_reason2_a", "Yes"); + } + if("B".equals(commonField.getTaxReason2())){ + setValueIfPresent(form2, "ch1_14d_reason2_b", "Yes"); + } + if("C".equals(commonField.getTaxReason2())){ + setValueIfPresent(form2, "ch1_14d_reason2_c", "Yes"); + } + + if("A".equals(commonField.getTaxReason3())){ + setValueIfPresent(form2, "ch1_14d_reason3_a", "Yes"); + } + if("B".equals(commonField.getTaxReason3())){ + setValueIfPresent(form2, "ch1_14d_reason3_b", "Yes"); + } + if("C".equals(commonField.getTaxReason3())){ + setValueIfPresent(form2, "ch1_14d_reason3_c", "Yes"); + } + + setValueIfPresent(form2, "ch2_5_1p", commonField.getEduPri()); + setValueIfPresent(form2, "ch2_5_1s", commonField.getEduSec()); + setValueIfPresent(form2, "ch2_5_1m", commonField.getEduPostSec()); + if("Yes".equals(commonField.getEduUni())){ + setValueIfPresent(form2, "ch2_5_1m", "Off"); + setValueIfPresent(form2, "ch2_5_1u", commonField.getEduUni()); + } + + setValueIfPresent(form2, "ch2_5_2w", commonField.getFna_a_life_0()); + setValueIfPresent(form2, "ch2_5_2_less5", commonField.getFna_a_life_less_5()); + setValueIfPresent(form2, "ch2_5_2_5above", commonField.getFna_a_life_above_5()); + + if("Yes".equals(commonField.getInsuranceLife1())){ + setValueIfPresent(form2, "ch4_1_life", "Off"); + setValueIfPresent(form2, "ch4_1_accident", "On"); + setValueIfPresent(form2, "ch4_1_critical", "On"); + setValueIfPresent(form2, "ch4_1_hospital", "On"); + }else if("Yes".equals(commonField.getInsuranceCritical1())){ + setValueIfPresent(form2, "ch4_1_life", "On"); + setValueIfPresent(form2, "ch4_1_accident", "On"); + setValueIfPresent(form2, "ch4_1_critical", "Off"); + setValueIfPresent(form2, "ch4_1_hospital", "On"); + }else if("Yes".equals(commonField.getInsuranceOther1()) + && "Accident".equals(commonField.getInsuranceOtherDesc1())){ + setValueIfPresent(form2, "ch4_1_life", "On"); + setValueIfPresent(form2, "ch4_1_accident", "Off"); + setValueIfPresent(form2, "ch4_1_critical", "On"); + setValueIfPresent(form2, "ch4_1_hospital", "On"); + }else if("Yes".equals(commonField.getInsuranceOther1()) + && "Hospital".equals(commonField.getInsuranceOtherDesc1())){ + setValueIfPresent(form2, "ch4_1_life", "On"); + setValueIfPresent(form2, "ch4_1_accident", "On"); + setValueIfPresent(form2, "ch4_1_critical", "On"); + setValueIfPresent(form2, "ch4_1_hospital", "Off"); + } + + if("Yes".equals(commonField.getInsuranceLife2())){ + setValueIfPresent(form2, "ch4_2_life", "Off"); + setValueIfPresent(form2, "ch4_2_accident", "On"); + setValueIfPresent(form2, "ch4_2_critical", "On"); + setValueIfPresent(form2, "ch4_2_hospital", "On"); + }else if("Yes".equals(commonField.getInsuranceCritical2())){ + setValueIfPresent(form2, "ch4_2_life", "On"); + setValueIfPresent(form2, "ch4_2_accident", "On"); + setValueIfPresent(form2, "ch4_2_critical", "Off"); + setValueIfPresent(form2, "ch4_2_hospital", "On"); + }else if("Yes".equals(commonField.getInsuranceOther2()) + && "Accident".equals(commonField.getInsuranceOtherDesc2())){ + setValueIfPresent(form2, "ch4_2_life", "On"); + setValueIfPresent(form2, "ch4_2_accident", "Off"); + setValueIfPresent(form2, "ch4_2_critical", "On"); + setValueIfPresent(form2, "ch4_2_hospital", "On"); + }else if("Yes".equals(commonField.getInsuranceOther2()) + && "Hospital".equals(commonField.getInsuranceOtherDesc2())){ + setValueIfPresent(form2, "ch4_2_life", "On"); + setValueIfPresent(form2, "ch4_2_accident", "On"); + setValueIfPresent(form2, "ch4_2_critical", "On"); + setValueIfPresent(form2, "ch4_2_hospital", "Off"); + } + + if("Yes".equals(commonField.getInsuranceLife3())){ + setValueIfPresent(form2, "ch4_3_life", "Off"); + setValueIfPresent(form2, "ch4_3_accident", "On"); + setValueIfPresent(form2, "ch4_3_critical", "On"); + setValueIfPresent(form2, "ch4_3_hospital", "On"); + }else if("Yes".equals(commonField.getInsuranceCritical3())){ + setValueIfPresent(form2, "ch4_3_life", "On"); + setValueIfPresent(form2, "ch4_3_accident", "On"); + setValueIfPresent(form2, "ch4_3_critical", "Off"); + setValueIfPresent(form2, "ch4_3_hospital", "On"); + }else if("Yes".equals(commonField.getInsuranceOther3()) + && "Accident".equals(commonField.getInsuranceOtherDesc3())){ + setValueIfPresent(form2, "ch4_3_life", "On"); + setValueIfPresent(form2, "ch4_3_accident", "Off"); + setValueIfPresent(form2, "ch4_3_critical", "On"); + setValueIfPresent(form2, "ch4_3_hospital", "On"); + }else if("Yes".equals(commonField.getInsuranceOther3()) + && "Hospital".equals(commonField.getInsuranceOtherDesc3())){ + setValueIfPresent(form2, "ch4_3_life", "On"); + setValueIfPresent(form2, "ch4_3_accident", "On"); + setValueIfPresent(form2, "ch4_3_critical", "On"); + setValueIfPresent(form2, "ch4_3_hospital", "Off"); + } + + setValueIfPresent(form2, "ch1_13_hk", commonField.getOthers().get("crAddressHk")); + setValueIfPresent(form2, "ch1_13_kln", commonField.getOthers().get("crAddressKln")); + setValueIfPresent(form2, "ch1_13_nt", commonField.getOthers().get("crAddressNt")); + + setValueIfPresent(form2, "ch1_13_corr_hk", commonField.getOthers().get("corAddressHk")); + setValueIfPresent(form2, "ch1_13_corr_kln", commonField.getOthers().get("corAddressKln")); + setValueIfPresent(form2, "ch1_13_corr_nt", commonField.getOthers().get("corAddressNt")); + + } + + private void HSBCA31_textBox(PdfAcroForm form, CommonField commonField, Client client){ + /* Page1 Start */ + setValueIfPresent(form, "fill_15", commonField.getFirstName()); + setValueIfPresent(form, "fill_16", commonField.getGivenName()); + + setValueIfPresent(form, "fill_17", commonField.getNameChi()); + setValueIfPresent(form, "Text1", commonField.getIdCard()); + setValueIfPresent(form, "passportNo", commonField.getPassportNo()); + setValueIfPresent(form, "Text12", commonField.getCountryOfIssue()); + setValueIfPresent(form, "fill_18", commonField.getDateOfBirth()); + setValueIfPresent(form, "Text12", commonField.getCountryOfIssue()); + setValueIfPresent(form, "fill_18", commonField.getDateOfBirth()); + setValueIfPresent(form, "fill_19", commonField.getCountryOfCitizenship()); + setValueIfPresent(form, "fill_20", commonField.getPlaceOfBirth()); + /* Page1 End */ + /* Page2 Start */ + setValueIfPresent(form, "Text16_1", commonField.getOthers().get("crAddress1")); + setValueIfPresent(form, "Text16_2", commonField.getOthers().get("crAddress2")); + + setValueIfPresent(form, "address1", commonField.getOthers().get("address1")); + setValueIfPresent(form, "address2", commonField.getOthers().get("address2")); + + setValueIfPresent(form, "fill_12", commonField.getContactNo()); + setValueIfPresent(form, "Text182", commonField.getEmail()); + + setValueIfPresent(form, "Text174", commonField.getCompanyName()); + setValueIfPresent(form, "Text173_1", commonField.getCompanyNature1()); + setValueIfPresent(form, "Text173_2", commonField.getCompanyNature2()); + setValueIfPresent(form, "fill_16_2", commonField.getOccupationTitle()); + setValueIfPresent(form, "fill_17_1", commonField.getOthers().get("companyAddress1")); + setValueIfPresent(form, "fill_17_2", commonField.getOthers().get("companyAddress2")); + /* Page2 End */ + /* Page3 Start */ + setValueIfPresent(form, "undefined_51", commonField.getContactNo()); + /* Page3 End */ + /* Page12 Start */ + setValueIfPresent(form, "undefined_17ha_1", commonField.getInsuranceCompany1_1()); + setValueIfPresent(form, "undefined_17ha_2", commonField.getInsuranceCompany1_2()); + setValueIfPresent(form, "undefined_17ha_3", commonField.getInsuranceCompany1_3()); + setValueIfPresent(form, "undefined_17hk", commonField.getInsuranceSumInsured1()); + setValueIfPresent(form, "undefined_17hl", commonField.getInsuranceYear1()); + + setValueIfPresent(form, "undefined_17hn_1", commonField.getInsuranceCompany2_1()); + setValueIfPresent(form, "undefined_17hn_2", commonField.getInsuranceCompany2_2()); + setValueIfPresent(form, "undefined_17hn_3", commonField.getInsuranceCompany2_3()); + setValueIfPresent(form, "undefined_17ho", commonField.getInsuranceSumInsured1()); + setValueIfPresent(form, "undefined_17hp", commonField.getInsuranceYear1()); + + setValueIfPresent(form, "undefined_17hr_1", commonField.getInsuranceCompany3_1()); + setValueIfPresent(form, "undefined_17hr_2", commonField.getInsuranceCompany3_2()); + setValueIfPresent(form, "undefined_17hr_3", commonField.getInsuranceCompany3_3()); + setValueIfPresent(form, "undefined_17hsb", commonField.getInsuranceSumInsured1()); + setValueIfPresent(form, "undefined_17ht", commonField.getInsuranceYear1()); + + setValueIfPresent(form, "fill_2_6", commonField.getUltimateTotalLife()); + setValueIfPresent(form, "fill_2_6e", commonField.getDeclinedDesc()); + setValueIfPresent(form, "fill_15_7y", commonField.getDeclinedDesc()); + + /* Page12 End */ + /* Page13 Start */ + setValueIfPresent(form, "fill_9_6", commonField.getIncomeSalary()); + setValueIfPresent(form, "fill_1k0_5", commonField.getIncomeSalaryLastYear()); + setValueIfPresent(form, "fill_13_4", commonField.getIncomeBonus()); + setValueIfPresent(form, "fill_14_4", commonField.getIncomeBonusLastYear()); + setValueIfPresent(form, "fill_17_7", commonField.getIncomeInterest()); + setValueIfPresent(form, "fill_18_6", commonField.getIncomeInterestLastYear()); + setValueIfPresent(form, "fill_2k1_5", commonField.getAssetInvestment()); + setValueIfPresent(form, "fill_2k9_3", commonField.getIncomeDividents()); + setValueIfPresent(form, "fill_3k0_3", commonField.getIncomeDividentsLastYear()); + setValueIfPresent(form, "fill_k33_3", commonField.getIncomeRentals()); + setValueIfPresent(form, "fill_34_2", commonField.getIncomeRentalsLastYear()); + setValueIfPresent(form, "fill_k37_2", commonField.getIncomeOther()); + setValueIfPresent(form, "fill_38_2", commonField.getIncomeOtherLastYear()); + setValueIfPresent(form, "fill_37_2", commonField.getTotalAnnualIncome()); + setValueIfPresent(form, "fill_39_2", commonField.getFna_c1b_amount()); + setValueIfPresent(form, "fill_4114", commonField.getAssetCash()); + setValueIfPresent(form, "fill_4916", commonField.getAssetRealEstate()); + setValueIfPresent(form, "fill_5720", commonField.getAssetInvestment()); + setValueIfPresent(form, "fill_5318", commonField.getAssetProperties()); + setValueIfPresent(form, "fill_111130", commonField.getFna_c2a_amount()); + setValueIfPresent(form, "fill_1111", commonField.getFna_c2b_amount()); + /* Page13 End */ + /* Page14 Start */ + setValueIfPresent(form, "fill_73_1", commonField.getOthers().get("realEstateAddress1_1")); + setValueIfPresent(form, "fill_73_2", commonField.getOthers().get("realEstateAddress1_2")); + setValueIfPresent(form, "fill_77_1", commonField.getOthers().get("realEstateAddress2_1")); + setValueIfPresent(form, "fill_77_2", commonField.getOthers().get("realEstateAddress2_2")); + setValueIfPresent(form, "fill_81_1", commonField.getOthers().get("realEstateAddress3_1")); + setValueIfPresent(form, "fill_81_2", commonField.getOthers().get("realEstateAddress3_2")); + setValueIfPresent(form, "fill_74", commonField.getRealEstatePurchaseDate1()); + setValueIfPresent(form, "fill_78", commonField.getRealEstatePurchaseDate2()); + setValueIfPresent(form, "fill_82", commonField.getRealEstatePurchaseDate3()); + + setValueIfPresent(form, "Text26001", commonField.getBankruptNo()); + /* Page14 End */ + setValueIfPresent(form, "fill_4_12", commonField.getFna_a_retire()); + + } + + private void HSBCA31_checkBox(PDAcroForm form2, CommonField commonField){ + /* Page1 Start */ + setValueIfPresent(form2, "Checkk Box6", commonField.getGenderMale()); + setValueIfPresent(form2, "Check kBox7", commonField.getGenderFemale()); + + if(form2.getField("Text1") != null && form2.getField("Text1").getValueAsString() != null && !form2.getField("Text1").getValueAsString().isBlank() + && ("HK".equals(commonField.getCountryOfIssue().toUpperCase()) + || "HONG KONG".equals(commonField.getCountryOfIssue().toUpperCase()) + || "香港".equals(commonField.getCountryOfIssue()) ) + ){ + setValueIfPresent(form2, "Check Bokx21", "Yes"); + } + + /* Page1 End */ + + /* Page2 Start */ + setValueIfPresent(form2, "Check Box175", commonField.getEmployedSelf()); + setValueIfPresent(form2, "Check Box177", commonField.getEmployed()); + setValueIfPresent(form2, "Check Box179", commonField.getPartTime()); + setValueIfPresent(form2, "Check Box181", commonField.getEmployedNon()); + setValueIfPresent(form2, "Check Box176", commonField.getStudent()); + setValueIfPresent(form2, "Check Box178", commonField.getHomemaker()); + setValueIfPresent(form2, "Check Box180", commonField.getRetired()); + /* Page2 End + + /* Page12 Start */ + setValueIfPresent(form2, "Check Box74b", commonField.getDeclinedYes()); + setValueIfPresent(form2, "Check Box74_1a", commonField.getDeclinedNo()); + + /* Page12 End */ + /* Page14 Start */ + setValueIfPresent(form2, "Check Box65f", commonField.getOwn_income()); + setValueIfPresent(form2, "Check Box65d", commonField.getPremium_financing()); + setValueIfPresent(form2, "Check Box65c", commonField.getSavings()); + setValueIfPresent(form2, "Check Box65b", commonField.getBankruptYes()); + setValueIfPresent(form2, "Check Box83", commonField.getBankruptNo()); + /* Page14 End */ + } + + private void MLB03S_textBox(PdfAcroForm form, CommonField commonField, Client client){ + /* Page1 Start */ + setValueIfPresent(form, "SurName1", commonField.getFirstName()); + setValueIfPresent(form, "GivenName1", commonField.getGivenName()); + setValueIfPresent(form, "ChineseName1", commonField.getNameChi()); + + setValueIfPresent(form, "DD1", commonField.getDdDateOfBirth()); + setValueIfPresent(form, "MM1", commonField.getMmDateOfBirth()); + setValueIfPresent(form, "YYYY1", commonField.getYyyyDateOfBirth()); + + setValueIfPresent(form, "Field_LocationA1", commonField.getPlaceOfBirth()); + //setValueIfPresent(form, "Field_LocationB1", commonField.getPlaceOfBirth()); + setValueIfPresent(form, "ID1", commonField.getIdCard()); + + setValueIfPresent(form, "Nationality1", commonField.getCountryOfCitizenship()); + setValueIfPresent(form, "Company1", commonField.getCompanyName()); + setValueIfPresent(form, "BusinessNature1", commonField.getCompanyNature1()); + setValueIfPresent(form, "BusinessNature2", commonField.getCompanyNature2()); + setValueIfPresent(form, "Occupation1", commonField.getOccupation()); + setValueIfPresent(form, "JobNature1", commonField.getOccupationTitle()); + + setValueIfPresent(form, "Income1", addNums(commonField.getIncomeSalary(), commonField.getIncomeBonus()) ); + + setValueIfPresent(form, "JobNature1", commonField.getOthers().get("crAddressRoom")); + setValueIfPresent(form, "Floor1", commonField.getOthers().get("crAddressRoom")); + setValueIfPresent(form, "Block1", commonField.getOthers().get("crAddressBlock")); + setValueIfPresent(form, "Block1", commonField.getOthers().get("crAddressBlock")); + setValueIfPresent(form, "Block1", commonField.getOthers().get("crAddressStreet")); + setValueIfPresent(form, "City1", commonField.getOthers().get("crAddressCity")); + setValueIfPresent(form, "District1", commonField.getOthers().get("crAddressDistrict")); + setValueIfPresent(form, "Country1", commonField.getOthers().get("crAddressCountry")); + setValueIfPresent(form, "Country1", commonField.getOthers().get("crAddressPostalCode")); + + /* Page1 End */ + /* Page2 Start */ + setValueIfPresent(form, "Room3", commonField.getOthers().get("corAddressRoom")); + setValueIfPresent(form, "Room3", commonField.getOthers().get("corAddressFloor")); + setValueIfPresent(form, "Block3", commonField.getOthers().get("corAddressBlock")); + setValueIfPresent(form, "Building3", commonField.getOthers().get("corAddressBuilding")); + setValueIfPresent(form, "Street3", commonField.getOthers().get("corAddressStreet")); + setValueIfPresent(form, "City3", commonField.getOthers().get("corAddressCity")); + setValueIfPresent(form, "District3", commonField.getOthers().get("corAddressDistrict")); + setValueIfPresent(form, "Country3", commonField.getOthers().get("corAddressCountry")); + setValueIfPresent(form, "PostalCode3", commonField.getOthers().get("corAddressPostalCode")); + + setValueIfPresent(form, "ContactB1", commonField.getContactNo()); + setValueIfPresent(form, "Email", commonField.getEmail()); + /* Page2 End */ + /* Page3 Start */ + setValueIfPresent(form, "Field_Wealth4", commonField.getOthers().get("sourceOtherDesc")); + /* Page3 End */ + /* Page7 Start */ + setValueIfPresent(form, "Residency1", commonField.getTaxResidency1()); + setValueIfPresent(form, "Residency2", commonField.getTaxResidency2()); + setValueIfPresent(form, "Residency3", commonField.getTaxResidency3()); + setValueIfPresent(form, "TIN1", commonField.getTaxPin1()); + setValueIfPresent(form, "TIN2", commonField.getTaxPin2()); + setValueIfPresent(form, "TIN3", commonField.getTaxPin3()); + setValueIfPresent(form, "ABC1", commonField.getTaxReason1()); + setValueIfPresent(form, "ABC2", commonField.getTaxReason2()); + setValueIfPresent(form, "ABC3", commonField.getTaxReason3()); + setValueIfPresent(form, "Reason1", commonField.getTaxReasonB1()); + setValueIfPresent(form, "Reason2", commonField.getTaxReasonB2()); + setValueIfPresent(form, "Reason3", commonField.getTaxReasonB3()); + /* Page7 End */ + + } + + private void MLB03S_checkBox(PDAcroForm form2, CommonField commonField){ + /* Page1 Start */ + setValueIfPresent(form2, "male", commonField.getGenderMale()); + setValueIfPresent(form2, "female", commonField.getGenderFemale()); + + if("HONG KONG".equals(commonField.getPlaceOfBirth().toUpperCase()) + || "HK".equals(commonField.getPlaceOfBirth().toUpperCase()) + || "HONGKONG".equals(commonField.getPlaceOfBirth().toUpperCase()) + || "HK SAR".equals(commonField.getPlaceOfBirth().toUpperCase()) + || "HKSAR".equals(commonField.getPlaceOfBirth().toUpperCase()) + || "香港".equals(commonField.getPlaceOfBirth().toUpperCase())){ + setValueIfPresent(form2, "hk", "Yes"); + } + if("HONG KONG".equals(commonField.getPlaceOfBirth().toUpperCase()) + || "MACAU".equals(commonField.getPlaceOfBirth().toUpperCase()) + || "澳門".equals(commonField.getPlaceOfBirth().toUpperCase())){ + setValueIfPresent(form2, "macau", "Yes"); + } + + setValueIfPresent(form2, "Checkbox_Y", commonField.getTobarccoYes()); + setValueIfPresent(form2, "Checkbox_N", commonField.getTobarccoYes()); + /* Page1 End */ + /* Page3 Start */ + setValueIfPresent(form2, "Checkbox_Wealth1", commonField.getOthers().get("sourceIncome")); + if("Yes".equals(commonField.getOthers().get("sourceInvestment")) + || "Yes".equals(commonField.getOthers().get("sourceInvestment")) ){ + setValueIfPresent(form2, "Checkbox_Wealth2", "Yes"); + } + setValueIfPresent(form2, "Checkbox_Wealth3", commonField.getOthers().get("sourceInheritance")); + setValueIfPresent(form2, "Checkbox_Wealth4", commonField.getOthers().get("sourceOther")); + + setValueIfPresent(form2, "Checkbox_EudcationPri", commonField.getEduPri()); + setValueIfPresent(form2, "Checkbox_EudcationSec", commonField.getEduSec()); + setValueIfPresent(form2, "Checkbox_EudcationPostSec", commonField.getEduPostSec()); + setValueIfPresent(form2, "Checkbox_EudcationTer", commonField.getEduUni()); + /* Page3 End */ + /* Page8 Start */ + setValueIfPresent(form2, "c_DeclartionYes", commonField.getReplaceInsuranceYes()); + setValueIfPresent(form2, "c_DeclartionNo", commonField.getReplaceInsuranceNo()); + /* Page8 End */ + + } + + private void SLGII_textBox(PdfAcroForm form, CommonField commonField, Client client){ + /* Page1 Start */ + setValueIfPresent(form, "surname", commonField.getFirstName()); + setValueIfPresent(form, "given_name", commonField.getGivenName()); + setValueIfPresent(form, "ChineseName1", commonField.getNameChi()); + + setValueIfPresent(form, "ch1_4_m", commonField.getGenderMale()); + setValueIfPresent(form, "ch1_4_f", commonField.getGenderFemale()); + + setValueIfPresent(form, "1_6dd", commonField.getDdDateOfBirth()); + setValueIfPresent(form, "1_6mm", commonField.getMmDateOfBirth()); + setValueIfPresent(form, "1_6yyyy", commonField.getYyyyDateOfBirth()); + + setValueIfPresent(form, "1_7", commonField.getPlaceOfBirth()); + setValueIfPresent(form, "1_8", commonField.getCountryOfCitizenship()); + + if("HONG KONG".equals(commonField.getPlaceOfBirth())){ + setValueIfPresent(form, "1_10id", commonField.getIdCard()); + } + setValueIfPresent(form, "1_10passport", commonField.getPassportNo()); + setValueIfPresent(form, "fill_14_date", commonField.getOthers().get("passportExpiryDate")); + + /* Page1 End */ + /* Page2 Start */ + setValueIfPresent(form, "ch1_12_self", commonField.getEmployedSelf()); + setValueIfPresent(form, "ch1_12_full", commonField.getEmployed()); + setValueIfPresent(form, "ch1_12_student", commonField.getStudent()); + setValueIfPresent(form, "ch1_12_housewife", commonField.getPartTime()); + setValueIfPresent(form, "ch1_12_part", commonField.getHomemaker()); + setValueIfPresent(form, "ch1_12_retired", commonField.getBankruptNo()); + + setValueIfPresent(form, "1_12_occupation", commonField.getOccupation()); + setValueIfPresent(form, "1_12_exact_duty", commonField.getOccupationTitle()); + + setValueIfPresent(form, "1_12_employer", commonField.getCompanyName()); + setValueIfPresent(form, "1_12_employer_address_1", commonField.getOthers().get("companyAddress1")); + setValueIfPresent(form, "1_12_employer_address_2", commonField.getOthers().get("companyAddress2")); + + setValueIfPresent(form, "1_12_nature_1", commonField.getCompanyNature1()); + setValueIfPresent(form, "1_12_nature_2", commonField.getCompanyNature2()); + + setValueIfPresent(form, "1_13a_rm", commonField.getOthers().get("crAddressRoom")); + setValueIfPresent(form, "1_13a_floor", commonField.getOthers().get("crAddressFloor")); + setValueIfPresent(form, "1_13a_block", commonField.getOthers().get("crAddressBlock")); + setValueIfPresent(form, "1_13a_district", commonField.getOthers().get("crAddressCountry")); + setValueIfPresent(form, "1_13a_zip", commonField.getOthers().get("crAddressPostalCode")); + setValueIfPresent(form, "ch1_13a_hk", commonField.getOthers().get("crAddressHK")); + setValueIfPresent(form, "ch1_13a_kln", commonField.getOthers().get("crAddressKln")); + setValueIfPresent(form, "ch1_13a_nt", commonField.getOthers().get("crAddressNt")); + + setValueIfPresent(form, "1_13bc_rm", commonField.getOthers().get("corAddressRoom")); + setValueIfPresent(form, "1_13bc_floor", commonField.getOthers().get("corAddressFloor")); + setValueIfPresent(form, "1_13bc_block", commonField.getOthers().get("corAddressBlock")); + setValueIfPresent(form, "1_13bc_building", commonField.getOthers().get("corAddressBuilding")); + setValueIfPresent(form, "1_13bc_street", commonField.getOthers().get("corAddressStreet")); + setValueIfPresent(form, "1_13bc_district", commonField.getOthers().get("corAddressCountry")); + setValueIfPresent(form, "ch1_13bc_hk", commonField.getOthers().get("corAddressHK")); + setValueIfPresent(form, "ch1_13bc_kln", commonField.getOthers().get("corAddressKln")); + setValueIfPresent(form, "ch1_13bc_nt", commonField.getOthers().get("corAddressNt")); + + /* Page2 End */ + /* Page3 Start */ + setValueIfPresent(form, "1_13b_tel_mobile_code", commonField.getContactNo()); + setValueIfPresent(form, "1_13b_email", commonField.getEmail()); + + setValueIfPresent(form, "1_14d_tax1", commonField.getTaxResidency1()); + setValueIfPresent(form, "1_14d_tax2", commonField.getTaxResidency2()); + setValueIfPresent(form, "1_14d_tax3", commonField.getTaxResidency3()); + + setValueIfPresent(form, "1_14d_tax_num1", commonField.getTaxPin1()); + setValueIfPresent(form, "1_14d_tax_num2", commonField.getTaxPin2()); + setValueIfPresent(form, "1_14d_tax_num3", commonField.getTaxPin3()); + + if(commonField.getTaxResidency1() != null && !commonField.getTaxResidency1().isBlank()){ + setValueIfPresent(form, "ch1_14d_reason1_a", "On"); + setValueIfPresent(form, "ch1_14d_reason1_b", "On"); + setValueIfPresent(form, "ch1_14d_reason1_c", "On"); + } + if(commonField.getTaxResidency2() != null && !commonField.getTaxResidency2().isBlank()){ + setValueIfPresent(form, "ch1_14d_reason2_a", "On"); + setValueIfPresent(form, "ch1_14d_reason2_b", "On"); + setValueIfPresent(form, "ch1_14d_reason2_c", "On"); + } + if(commonField.getTaxResidency3() != null && !commonField.getTaxResidency3().isBlank()){ + setValueIfPresent(form, "ch1_14d_reason3_a", "On"); + setValueIfPresent(form, "ch1_14d_reason3_b", "On"); + setValueIfPresent(form, "ch1_14d_reason3_c", "On"); + } + + if("A".equals(commonField.getTaxReason1())){ + setValueIfPresent(form, "ch1_14d_reason1_a", "OFF"); + } + if("B".equals(commonField.getTaxReason1())){ + setValueIfPresent(form, "ch1_14d_reason1_b", "OFF"); + } + if("C".equals(commonField.getTaxReason1())){ + setValueIfPresent(form, "ch1_14d_reason1_c", "OFF"); + } + if("A".equals(commonField.getTaxReason2())){ + setValueIfPresent(form, "ch1_14d_reason2_a", "OFF"); + } + if("B".equals(commonField.getTaxReason2())){ + setValueIfPresent(form, "ch1_14d_reason2_b", "OFF"); + } + if("C".equals(commonField.getTaxReason2())){ + setValueIfPresent(form, "ch1_14d_reason2_c", "OFF"); + } + if("A".equals(commonField.getTaxReason3())){ + setValueIfPresent(form, "ch1_14d_reason3_a", "OFF"); + } + if("B".equals(commonField.getTaxReason3())){ + setValueIfPresent(form, "ch1_14d_reason3_b", "OFF"); + } + if("C".equals(commonField.getTaxReason3())){ + setValueIfPresent(form, "ch1_14d_reason3_c", "OFF"); + } + + setValueIfPresent(form, "1_14d_explain1", commonField.getTaxReasonB1()); + setValueIfPresent(form, "1_14d_explain2", commonField.getTaxReasonB2()); + setValueIfPresent(form, "1_14d_explain3", commonField.getTaxReasonB3()); + + /* Page3 End */ + /* Page6 Start */ + setValueIfPresent(form, "4_1_name1_1", commonField.getInsuranceCompany1_1()); + setValueIfPresent(form, "4_1_name1_2", commonField.getInsuranceCompany1_2()); + setValueIfPresent(form, "4_1_name1_3", commonField.getInsuranceCompany1_3()); + setValueIfPresent(form, "4_1_name2_1", commonField.getInsuranceCompany2_1()); + setValueIfPresent(form, "4_1_name2_2", commonField.getInsuranceCompany2_2()); + setValueIfPresent(form, "4_1_name2_3", commonField.getInsuranceCompany2_3()); + setValueIfPresent(form, "4_1_name3_1", commonField.getInsuranceCompany3_1()); + setValueIfPresent(form, "4_1_name3_2", commonField.getInsuranceCompany3_2()); + setValueIfPresent(form, "4_1_name3_3", commonField.getInsuranceCompany3_3()); + setValueIfPresent(form, "4_1_year1", commonField.getInsuranceYear1()); + setValueIfPresent(form, "4_1_year2", commonField.getInsuranceYear2()); + setValueIfPresent(form, "4_1_year3", commonField.getInsuranceYear3()); + + setValueIfPresent(form, "4_1_sum1", commonField.getInsuranceSumInsured1()); + setValueIfPresent(form, "4_1_sum2", commonField.getInsuranceSumInsured2()); + setValueIfPresent(form, "4_1_sum3", commonField.getInsuranceSumInsured3()); + + if(commonField.getInsuranceSumInsured1() != null && !commonField.getInsuranceSumInsured1().isBlank()){ + setValueIfPresent(form, "ch4_1_life", "On"); + setValueIfPresent(form, "ch4_1_accident", "On"); + setValueIfPresent(form, "ch4_1_critical", "On"); + setValueIfPresent(form, "ch4_1_hospital", "On"); + + } + if("Yes".equals(commonField.getInsuranceLife1())){ + setValueIfPresent(form, "ch4_1_life", "Off"); + } + if("Yes".equals(commonField.getInsuranceCritical1())){ + setValueIfPresent(form, "ch4_1_critical", "Off"); + } + + if(commonField.getInsuranceSumInsured2() != null && !commonField.getInsuranceSumInsured2().isBlank()){ + setValueIfPresent(form, "ch4_2_life", "On"); + setValueIfPresent(form, "ch4_2_accident", "On"); + setValueIfPresent(form, "ch4_2_critical", "On"); + setValueIfPresent(form, "ch4_2_hospital", "On"); + + } + if("Yes".equals(commonField.getInsuranceLife2())){ + setValueIfPresent(form, "ch4_2_life", "Off"); + } + if("Yes".equals(commonField.getInsuranceCritical2())){ + setValueIfPresent(form, "ch4_2_critical", "Off"); + } + + if(commonField.getInsuranceSumInsured3() != null && !commonField.getInsuranceSumInsured3().isBlank()){ + setValueIfPresent(form, "ch4_3_life", "On"); + setValueIfPresent(form, "ch4_3_accident", "On"); + setValueIfPresent(form, "ch4_3_critical", "On"); + setValueIfPresent(form, "ch4_3_hospital", "On"); + + } + if("Yes".equals(commonField.getInsuranceLife3())){ + setValueIfPresent(form, "ch4_3_life", "Off"); + } + if("Yes".equals(commonField.getInsuranceCritical3())){ + setValueIfPresent(form, "ch4_3_critical", "Off"); + } + + setValueIfPresent(form, "5_1a_city1", commonField.getOthers().get("travelCity1")); + setValueIfPresent(form, "5_1a_city2", commonField.getOthers().get("travelCity2")); + setValueIfPresent(form, "5_1a_city3", commonField.getOthers().get("travelCity3")); + setValueIfPresent(form, "5_1a_purpose1", commonField.getOthers().get("travelPurpose1")); + setValueIfPresent(form, "5_1a_purpose2", commonField.getOthers().get("travelPurpose2")); + setValueIfPresent(form, "5_1a_purpose3", commonField.getOthers().get("travelPurpose3")); + setValueIfPresent(form, "5_1a_frequency1", commonField.getOthers().get("5_1a_frequency1")); + setValueIfPresent(form, "5_1a_frequency2", commonField.getOthers().get("travelFrequency2")); + setValueIfPresent(form, "5_1a_frequency3", commonField.getOthers().get("travelFrequency3")); + + setValueIfPresent(form, "5_1b_city1", commonField.getOthers().get("travelNextCity1")); + setValueIfPresent(form, "5_1b_city2", commonField.getOthers().get("travelNextCity2")); + setValueIfPresent(form, "5_1b_city3", commonField.getOthers().get("travelNextCity3")); + setValueIfPresent(form, "5_1b_purpose1", commonField.getOthers().get("travelNextPurpose1")); + setValueIfPresent(form, "5_1b_purpose2", commonField.getOthers().get("travelNextPurpose2")); + setValueIfPresent(form, "5_1b_purpose3", commonField.getOthers().get("travelNextPurpose3")); + setValueIfPresent(form, "5_1b_frequency1", commonField.getOthers().get("travelNextFrequency1")); + setValueIfPresent(form, "5_1b_frequency2", commonField.getOthers().get("travelNextFrequency2")); + setValueIfPresent(form, "5_1b_frequency3", commonField.getOthers().get("travelNextFrequency3")); + + /* Page6 End */ + /* Page7 Start */ + setValueIfPresent(form, "ch5_1c_yes", commonField.getOthers().get("futureAddressYes")); + setValueIfPresent(form, "ch5_1c_no", commonField.getOthers().get("futureAddressNo")); + setValueIfPresent(form, "5_1c_address_1", commonField.getOthers().get("futureAddress1")); + setValueIfPresent(form, "5_1c_address_2", commonField.getOthers().get("futureAddress2")); + setValueIfPresent(form, "5_1c_reason", commonField.getOthers().get("futureAddressReason")); + setValueIfPresent(form, "5_1c_how_long", commonField.getOthers().get("futureAddressHowLong")); + if(StringUtils.trimToNull(commonField.getOthers().get("futureAddressReason")) != null + && StringUtils.trimToNull(commonField.getOthers().get("futureAddressHowLong")) != null ){ + setValueIfPresent(form, "fill_2_4", commonField.getOthers().get("futureAddressReasonHowLong")); + } + if("Yes".equals(commonField.getOthers().get("hazard"))){ + setValueIfPresent(form, "ch5_2_yes", "Yes"); + } + if("Off".equals(commonField.getOthers().get("hazard"))){ + setValueIfPresent(form, "ch5_2_no", "Yes"); + } + setValueIfPresent(form, "ch5_3_yes", commonField.getDeclinedYes()); + setValueIfPresent(form, "ch5_3_no", commonField.getDeclinedNo()); + setValueIfPresent(form, "ch5_6_yes", commonField.getOthers().get("pendingChargeYes")); + setValueIfPresent(form, "ch5_6_no", commonField.getOthers().get("pendingChargeNo")); + /* Page7 End */ + /* Page10 Start */ + int i = 1; + if("Father".equals(commonField.getOthers().get("relateFatherRelation"))){ + setValueIfPresent(form, "7_1a_name" + i, commonField.getOthers().get("relateFatherName")); + setValueIfPresent(form, "7_1a_age" + i, commonField.getOthers().get("relateFatherAge")); + setValueIfPresent(form, "7_1a_relation" + i, commonField.getOthers().get("relateFatherRelation")); + + i++; + } + if("Mother".equals(commonField.getOthers().get("relateMotherRelation"))){ + setValueIfPresent(form, "7_1a_name" + i, commonField.getOthers().get("relateMotherName")); + setValueIfPresent(form, "7_1a_age" + i, commonField.getOthers().get("relateMotherAge")); + setValueIfPresent(form, "7_1a_relation" + i, commonField.getOthers().get("relateMotherRelation")); + + i++; + } + if("Mother".equals(commonField.getOthers().get("relateMotherRelation"))){ + setValueIfPresent(form, "7_1a_name" + i, commonField.getOthers().get("relateMotherName")); + setValueIfPresent(form, "7_1a_age" + i, commonField.getOthers().get("relateMotherAge")); + setValueIfPresent(form, "7_1a_relation" + i, commonField.getOthers().get("relateMotherRelation")); + + i++; + } + if("Spouse".equals(commonField.getOthers().get("relateSpouseRelation"))){ + setValueIfPresent(form, "7_1a_name" + i, commonField.getOthers().get("relateSpouseName")); + setValueIfPresent(form, "7_1a_age" + i, commonField.getOthers().get("relateSpouseAge")); + setValueIfPresent(form, "7_1a_relation" + i, commonField.getOthers().get("relateSpouseRelation")); + + i++; + } + if(i <= 4 && "Son".equals(commonField.getOthers().get("relateSonRelation"))){ + setValueIfPresent(form, "7_1a_name" + i, commonField.getOthers().get("relateSonName")); + setValueIfPresent(form, "7_1a_age" + i, commonField.getOthers().get("relateSonAge")); + setValueIfPresent(form, "7_1a_relation" + i, commonField.getOthers().get("relateSonRelation")); + + i++; + } + if(i <= 4 && "Bother".equals(commonField.getOthers().get("relateBotherRelation"))){ + setValueIfPresent(form, "7_1a_name" + i, commonField.getOthers().get("relateBotherName")); + setValueIfPresent(form, "7_1a_age" + i, commonField.getOthers().get("relateBotherAge")); + setValueIfPresent(form, "7_1a_relation" + i, commonField.getOthers().get("relateBotherRelation")); + + i++; + } + if(i <= 4 && "Sister".equals(commonField.getOthers().get("relateSisterRelation"))){ + setValueIfPresent(form, "7_1a_name" + i, commonField.getOthers().get("relateSisterName")); + setValueIfPresent(form, "7_1a_age" + i, commonField.getOthers().get("relateSisterAge")); + setValueIfPresent(form, "7_1a_relation" + i, commonField.getOthers().get("relateSisterRelation")); + + i++; + } + if(commonField.getOthers().get("companyStartYear") != null && commonField.getOthers().get("companyEndYear") != null + && !commonField.getOthers().get("companyStartYear").isBlank() && !commonField.getOthers().get("companyEndYear").isBlank()){ + setValueIfPresent(form, "7_1b", commonField.getOthers().get("companyStartYear") + " - " + commonField.getOthers().get("companyEndYear")); + } + if("Yes".equals(commonField.getOthers().get("businessOwnerYes"))){ + setValueIfPresent(form, "7_1c", commonField.getOthers().get("businessOwnerPercent")); + } + setValueIfPresent(form, "7_1d", commonField.getOthers().get("businessOwnerNoEmployee")); + /* Page10 End */ + + setValueIfPresent(form, "7_2a_salary", commonField.getIncomeSalary()); + setValueIfPresent(form, "7_2a_bonuses", commonField.getIncomeBonus()); + setValueIfPresent(form, "7_2a_invest", commonField.getIncomeInterest()); + setValueIfPresent(form, "7_2a_dividends", commonField.getIncomeDividents()); + setValueIfPresent(form, "7_2a_rental", commonField.getIncomeRentals()); + setValueIfPresent(form, "7_2a_invest", commonField.getIncomeOther()); + setValueIfPresent(form, "7_2a_sum", addNums(form.getField("7_2a_salary").getValueAsString(), form.getField("7_2a_bonuses").getValueAsString(),form.getField("7_2a_invest").getValueAsString(),form.getField("7_2a_dividends").getValueAsString(), form.getField("7_2a_rental").getValueAsString(), form.getField("7_2a_invest").getValueAsString())); + + setValueIfPresent(form, "7_2c_cash", commonField.getAssetCash()); + setValueIfPresent(form, "7_2c_real", commonField.getAssetRealEstate()); + setValueIfPresent(form, "7_2c_stocks", commonField.getAssetInvestment()); + setValueIfPresent(form, "7_2c_high", commonField.getAssetProperties()); + setValueIfPresent(form, "7_2c_total", commonField.getFna_c2a_amount()); + + setValueIfPresent(form, "7_2c_lia_loan", commonField.getLiaLoan()); + setValueIfPresent(form, "7_2c_lia_mortgages", commonField.getLiaMortgage()); + setValueIfPresent(form, "7_2c_lia_margin", commonField.getLiaMargin()); + setValueIfPresent(form, "7_2c_lia_loan", commonField.getLiaLoanGurantee()); + setValueIfPresent(form, "7_2c_lia_other", commonField.getLiaOther()); + + setValueIfPresent(form, "7_2d_address1_1", commonField.getOthers().get("realEstateAddress1_1")); + setValueIfPresent(form, "7_2d_address1_2", commonField.getOthers().get("realEstateAddress1_2")); + setValueIfPresent(form, "7_2d_address2_1", commonField.getOthers().get("realEstateAddress2_1")); + setValueIfPresent(form, "7_2d_address2_2", commonField.getOthers().get("realEstateAddress2_2")); + setValueIfPresent(form, "7_2d_address3_1", commonField.getOthers().get("realEstateAddress3_1")); + setValueIfPresent(form, "7_2d_address3_2", commonField.getOthers().get("realEstateAddress3_2")); + + setValueIfPresent(form, "7_2d_year1", commonField.getRealEstatePurchaseDate1()); + setValueIfPresent(form, "7_2d_year2", commonField.getRealEstatePurchaseDate2()); + setValueIfPresent(form, "7_2d_year3", commonField.getRealEstatePurchaseDate3()); + + + } + + private void SLGII_checkBox(PDAcroForm form2, CommonField commonField){ + //setValueIfPresent(form2, "Checkbox_EudcationPri", commonField.getEduPri()); + + /* Page1 Start */ + setValueIfPresent(form2, "ch1_4_m", commonField.getGenderMale()); + setValueIfPresent(form2, "ch1_4_f", commonField.getGenderFemale()); + + /* Page1 End */ + /* Page2 Start */ + setValueIfPresent(form2, "ch1_12_self", commonField.getEmployedSelf()); + setValueIfPresent(form2, "ch1_12_full", commonField.getEmployed()); + setValueIfPresent(form2, "ch1_12_student", commonField.getStudent()); + setValueIfPresent(form2, "ch1_12_housewife", commonField.getPartTime()); + setValueIfPresent(form2, "ch1_12_part", commonField.getHomemaker()); + setValueIfPresent(form2, "ch1_12_retired", commonField.getBankruptNo()); + + setValueIfPresent(form2, "ch1_13a_hk", commonField.getOthers().get("crAddressHK")); + setValueIfPresent(form2, "ch1_13a_kln", commonField.getOthers().get("crAddressKln")); + setValueIfPresent(form2, "ch1_13a_nt", commonField.getOthers().get("crAddressNt")); + + setValueIfPresent(form2, "ch1_13bc_hk", commonField.getOthers().get("corAddressHK")); + setValueIfPresent(form2, "ch1_13bc_kln", commonField.getOthers().get("corAddressKln")); + setValueIfPresent(form2, "ch1_13bc_nt", commonField.getOthers().get("corAddressNt")); + + /* Page2 End */ + /* Page3 Start */ + + if(commonField.getTaxResidency1() != null && !commonField.getTaxResidency1().isBlank()){ + setValueIfPresent(form2, "ch1_14d_reason1_a", "On"); + setValueIfPresent(form2, "ch1_14d_reason1_b", "On"); + setValueIfPresent(form2, "ch1_14d_reason1_c", "On"); + } + if(commonField.getTaxResidency2() != null && !commonField.getTaxResidency2().isBlank()){ + setValueIfPresent(form2, "ch1_14d_reason2_a", "On"); + setValueIfPresent(form2, "ch1_14d_reason2_b", "On"); + setValueIfPresent(form2, "ch1_14d_reason2_c", "On"); + } + if(commonField.getTaxResidency3() != null && !commonField.getTaxResidency3().isBlank()){ + setValueIfPresent(form2, "ch1_14d_reason3_a", "On"); + setValueIfPresent(form2, "ch1_14d_reason3_b", "On"); + setValueIfPresent(form2, "ch1_14d_reason3_c", "On"); + } - setValueIfPresent(form2, "ch2_5_2w", commonField.getFna_a_life_0()); - setValueIfPresent(form2, "ch2_5_2_less5", commonField.getFna_a_life_less_5()); - setValueIfPresent(form2, "ch2_5_2_5above", commonField.getFna_a_life_above_5()); - - if("Yes".equals(commonField.getInsuranceLife1())){ - setValueIfPresent(form2, "ch4_1_life", "Off"); - setValueIfPresent(form2, "ch4_1_accident", "On"); - setValueIfPresent(form2, "ch4_1_critical", "On"); - setValueIfPresent(form2, "ch4_1_hospital", "On"); - }else if("Yes".equals(commonField.getInsuranceCritical1())){ - setValueIfPresent(form2, "ch4_1_life", "On"); - setValueIfPresent(form2, "ch4_1_accident", "On"); - setValueIfPresent(form2, "ch4_1_critical", "Off"); - setValueIfPresent(form2, "ch4_1_hospital", "On"); - }else if("Yes".equals(commonField.getInsuranceOther1()) - && "Accident".equals(commonField.getInsuranceOtherDesc1())){ - setValueIfPresent(form2, "ch4_1_life", "On"); - setValueIfPresent(form2, "ch4_1_accident", "Off"); - setValueIfPresent(form2, "ch4_1_critical", "On"); - setValueIfPresent(form2, "ch4_1_hospital", "On"); - }else if("Yes".equals(commonField.getInsuranceOther1()) - && "Hospital".equals(commonField.getInsuranceOtherDesc1())){ - setValueIfPresent(form2, "ch4_1_life", "On"); - setValueIfPresent(form2, "ch4_1_accident", "On"); - setValueIfPresent(form2, "ch4_1_critical", "On"); - setValueIfPresent(form2, "ch4_1_hospital", "Off"); - } - - if("Yes".equals(commonField.getInsuranceLife2())){ - setValueIfPresent(form2, "ch4_2_life", "Off"); - setValueIfPresent(form2, "ch4_2_accident", "On"); - setValueIfPresent(form2, "ch4_2_critical", "On"); - setValueIfPresent(form2, "ch4_2_hospital", "On"); - }else if("Yes".equals(commonField.getInsuranceCritical2())){ - setValueIfPresent(form2, "ch4_2_life", "On"); - setValueIfPresent(form2, "ch4_2_accident", "On"); - setValueIfPresent(form2, "ch4_2_critical", "Off"); - setValueIfPresent(form2, "ch4_2_hospital", "On"); - }else if("Yes".equals(commonField.getInsuranceOther2()) - && "Accident".equals(commonField.getInsuranceOtherDesc2())){ - setValueIfPresent(form2, "ch4_2_life", "On"); - setValueIfPresent(form2, "ch4_2_accident", "Off"); - setValueIfPresent(form2, "ch4_2_critical", "On"); - setValueIfPresent(form2, "ch4_2_hospital", "On"); - }else if("Yes".equals(commonField.getInsuranceOther2()) - && "Hospital".equals(commonField.getInsuranceOtherDesc2())){ - setValueIfPresent(form2, "ch4_2_life", "On"); - setValueIfPresent(form2, "ch4_2_accident", "On"); - setValueIfPresent(form2, "ch4_2_critical", "On"); - setValueIfPresent(form2, "ch4_2_hospital", "Off"); - } + if("A".equals(commonField.getTaxReason1())){ + setValueIfPresent(form2, "ch1_14d_reason1_a", "OFF"); + } + if("B".equals(commonField.getTaxReason1())){ + setValueIfPresent(form2, "ch1_14d_reason1_b", "OFF"); + } + if("C".equals(commonField.getTaxReason1())){ + setValueIfPresent(form2, "ch1_14d_reason1_c", "OFF"); + } + if("A".equals(commonField.getTaxReason2())){ + setValueIfPresent(form2, "ch1_14d_reason2_a", "OFF"); + } + if("B".equals(commonField.getTaxReason2())){ + setValueIfPresent(form2, "ch1_14d_reason2_b", "OFF"); + } + if("C".equals(commonField.getTaxReason2())){ + setValueIfPresent(form2, "ch1_14d_reason2_c", "OFF"); + } + if("A".equals(commonField.getTaxReason3())){ + setValueIfPresent(form2, "ch1_14d_reason3_a", "OFF"); + } + if("B".equals(commonField.getTaxReason3())){ + setValueIfPresent(form2, "ch1_14d_reason3_b", "OFF"); + } + if("C".equals(commonField.getTaxReason3())){ + setValueIfPresent(form2, "ch1_14d_reason3_c", "OFF"); + } + + /* Page3 End */ + /* Page6 Start */ + if(commonField.getInsuranceSumInsured1() != null && !commonField.getInsuranceSumInsured1().isBlank()){ + setValueIfPresent(form2, "ch4_1_life", "On"); + setValueIfPresent(form2, "ch4_1_accident", "On"); + setValueIfPresent(form2, "ch4_1_critical", "On"); + setValueIfPresent(form2, "ch4_1_hospital", "On"); + + } + if("Yes".equals(commonField.getInsuranceLife1())){ + setValueIfPresent(form2, "ch4_1_life", "Off"); + } + if("Yes".equals(commonField.getInsuranceCritical1())){ + setValueIfPresent(form2, "ch4_1_critical", "Off"); + } - if("Yes".equals(commonField.getInsuranceLife3())){ - setValueIfPresent(form2, "ch4_3_life", "Off"); - setValueIfPresent(form2, "ch4_3_accident", "On"); - setValueIfPresent(form2, "ch4_3_critical", "On"); - setValueIfPresent(form2, "ch4_3_hospital", "On"); - }else if("Yes".equals(commonField.getInsuranceCritical3())){ - setValueIfPresent(form2, "ch4_3_life", "On"); - setValueIfPresent(form2, "ch4_3_accident", "On"); - setValueIfPresent(form2, "ch4_3_critical", "Off"); - setValueIfPresent(form2, "ch4_3_hospital", "On"); - }else if("Yes".equals(commonField.getInsuranceOther3()) - && "Accident".equals(commonField.getInsuranceOtherDesc3())){ - setValueIfPresent(form2, "ch4_3_life", "On"); - setValueIfPresent(form2, "ch4_3_accident", "Off"); - setValueIfPresent(form2, "ch4_3_critical", "On"); - setValueIfPresent(form2, "ch4_3_hospital", "On"); - }else if("Yes".equals(commonField.getInsuranceOther3()) - && "Hospital".equals(commonField.getInsuranceOtherDesc3())){ - setValueIfPresent(form2, "ch4_3_life", "On"); - setValueIfPresent(form2, "ch4_3_accident", "On"); - setValueIfPresent(form2, "ch4_3_critical", "On"); - setValueIfPresent(form2, "ch4_3_hospital", "Off"); - } - - } - } - - // Save the modified document to the output stream - sourceDoc.save(outputStream); - sourceDoc.close(); - return outputStream.toByteArray(); + if(commonField.getInsuranceSumInsured2() != null && !commonField.getInsuranceSumInsured2().isBlank()){ + setValueIfPresent(form2, "ch4_2_life", "On"); + setValueIfPresent(form2, "ch4_2_accident", "On"); + setValueIfPresent(form2, "ch4_2_critical", "On"); + setValueIfPresent(form2, "ch4_2_hospital", "On"); - } else { - return pdfBytes; // Return original bytes if no form found - } - } catch (IOException e) { - // logger.error("Error processing PDF with iText for ID: " + id, e); + } + if("Yes".equals(commonField.getInsuranceLife2())){ + setValueIfPresent(form2, "ch4_2_life", "Off"); + } + if("Yes".equals(commonField.getInsuranceCritical2())){ + setValueIfPresent(form2, "ch4_2_critical", "Off"); } - // try (InputStream is = pdfFile.getInputStream()) { - // return pdfBytes; - // } catch (Exception e) { - // throw new UnprocessableEntityException("Fail to load PDF: " + e); - // } - return modifiedPdfBytes; - // return fileService.getfileBlob((long) 2); - } + if(commonField.getInsuranceSumInsured3() != null && !commonField.getInsuranceSumInsured3().isBlank()){ + setValueIfPresent(form2, "ch4_3_life", "On"); + setValueIfPresent(form2, "ch4_3_accident", "On"); + setValueIfPresent(form2, "ch4_3_critical", "On"); + setValueIfPresent(form2, "ch4_3_hospital", "On"); + + } + if("Yes".equals(commonField.getInsuranceLife3())){ + setValueIfPresent(form2, "ch4_3_life", "Off"); + } + if("Yes".equals(commonField.getInsuranceCritical3())){ + setValueIfPresent(form2, "ch4_3_critical", "Off"); + } + + /* Page6 End */ + /* Page7 Start */ + setValueIfPresent(form2, "ch5_1c_yes", commonField.getOthers().get("futureAddressYes")); + setValueIfPresent(form2, "ch5_1c_no", commonField.getOthers().get("futureAddressNo")); + if("Yes".equals(commonField.getOthers().get("hazard"))){ + setValueIfPresent(form2, "ch5_2_yes", "Yes"); + } + if("Off".equals(commonField.getOthers().get("hazard"))){ + setValueIfPresent(form2, "ch5_2_no", "Yes"); + } + setValueIfPresent(form2, "ch5_3_yes", commonField.getDeclinedYes()); + setValueIfPresent(form2, "ch5_3_no", commonField.getDeclinedNo()); + setValueIfPresent(form2, "ch5_6_yes", commonField.getOthers().get("pendingChargeYes")); + setValueIfPresent(form2, "ch5_6_no", commonField.getOthers().get("pendingChargeNo")); + /* Page7 End */ + + } public List> list(Map args){ StringBuilder sql = new StringBuilder("SELECT" + + " (select concat('V', count(1) + 1) from filled_form where clientId = ff.clientId and templateId = ff.templateId and id < ff.id) as vNum, " + " ff.id, " + " ff.templateId, " + " ff.fileId, " @@ -1196,7 +2234,7 @@ public class PdfService extends AbstractBaseEntityService commonField.setIdCard(fieldValue); case "fill_12" -> commonField.setCountryOfIssue(fieldValue); case "fill_13" -> commonField.setPassportNo(fieldValue); + case "fill_14_date" -> commonField.getOthers().put("passportExpiryDate", fieldValue); case "fill_15" -> commonField.setPlaceOfBirth(fieldValue); case "fill_16" -> commonField.setCountryOfCitizenship(fieldValue); @@ -1310,8 +2349,10 @@ public class PdfService extends AbstractBaseEntityService commonField.setContactNo(fieldValue); case "fill_18" -> commonField.setEmail(fieldValue); - case "fill_19" -> commonField.setAddress1(fieldValue); - case "fill_19_1" -> commonField.setAddress2(fieldValue); + case "fill_19" -> commonField.getOthers().put("address1", fieldValue); + case "fill_19_1" -> commonField.getOthers().put("address2", fieldValue); + case "fill_23" -> commonField.getOthers().put("crAddress1", fieldValue); + case "fill_23_1" -> commonField.getOthers().put("crAddress2", fieldValue); case "edu_pri" -> commonField.setEduPri(fieldValue); case "edu_sec" -> commonField.setEduSec(fieldValue); @@ -1323,7 +2364,95 @@ public class PdfService extends AbstractBaseEntityService 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("relateSonRelation", "Daughter"); + commonField.getOthers().put("relateSonName", fieldValue); + } + case "fill_22_2" -> commonField.getOthers().put("relateSonAge", 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 "fill_32" -> commonField.getOthers().put("relateSisterAge", fieldValue); + + /* Page2 End */ + /* Page3 Start */ + case "toggle_3_2" -> commonField.setBankruptYes(fieldValue); + case "toggle_6_2" -> commonField.setBankruptNo(fieldValue); + case "fill_18_1" -> commonField.setBankruptNo(fieldValue); + + case "fill_3_3" -> commonField.getOthers().put("travelCity1",fieldValue); + case "fill_6_3" -> commonField.getOthers().put("travelCity2",fieldValue); + case "fill_9_3" -> commonField.getOthers().put("travelCity3",fieldValue); + case "fill_5_3" -> commonField.getOthers().put("travelPurpose1",fieldValue); + case "fill_7_3" -> commonField.getOthers().put("travelPurpose2",fieldValue); + case "fill_10_3" -> commonField.getOthers().put("travelPurpose3",fieldValue); + case "fill_4_3" -> commonField.getOthers().put("travelFrequency1",fieldValue); + case "fill_8_3" -> commonField.getOthers().put("travelFrequency2",fieldValue); + case "fill_11_3" -> commonField.getOthers().put("travelFrequency3",fieldValue); + + /* Page3 End */ + /* Page4 Start */ + 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("futureAddress1", fieldValue); + case "fill_1_4_2" -> commonField.getOthers().put("futureAddress2", fieldValue); + case "fill_2_4" -> commonField.getOthers().put("futureAddressReasonHowLong", fieldValue); + + case "toggle_3_3" -> commonField.getOthers().put("futureAddressReturnYes", fieldValue); + case "toggle_4_3" -> commonField.getOthers().put("futureAddressReturnNo", fieldValue); + case "toggle_5_3" -> commonField.getOthers().put("futureAddressReturnNa", fieldValue); + + case "fill_3_4" -> commonField.getOthers().put("travelNextCity1", fieldValue); + case "fill_6_4" -> commonField.getOthers().put("travelNextCity2", fieldValue); + case "fill_9_4" -> commonField.getOthers().put("travelNextCity3", fieldValue); + case "fill_5_4" -> commonField.getOthers().put("travelNextPurpose1", fieldValue); + case "fill_8_4" -> commonField.getOthers().put("travelNextPurpose2", fieldValue); + case "fill_11_4" -> commonField.getOthers().put("travelNextPurpose3", fieldValue); + case "fill_4_4" -> commonField.getOthers().put("travelNextFrequency1", fieldValue); + case "fill_7_4" -> commonField.getOthers().put("travelNextFrequency2", fieldValue); + case "fill_10_4" -> commonField.getOthers().put("travelNextFrequency3", fieldValue); + + /* Page4 End */ + /* Page5 Start */ + case "toggle_3_4" -> commonField.getOthers().put("pendingChargeYes", fieldValue); + case "undefined_11" -> commonField.getOthers().put("pendingChargeNo", fieldValue); + + case "tobaccoYes" -> commonField.setTobarccoYes(fieldValue); + case "tobaccoNo" -> commonField.setTobarccoNo(fieldValue); + + case "hazardousActivity" -> commonField.setHazardousActivity(fieldValue); + + + /* Page5 End */ /* Page6 Start */ case "fill_8_country_1" -> commonField.setTaxResidency1(fieldValue); case "fill_1_6" -> commonField.setTaxPin1(fieldValue); @@ -1344,7 +2473,7 @@ public class PdfService extends AbstractBaseEntityService { commonField.setInsuranceSumInsured1(fieldValue); - if(!commonField.getInsuranceSumInsured1().isBlank()){ + if(commonField.getInsuranceSumInsured1() != null && !commonField.getInsuranceSumInsured1().isBlank()){ commonField.setInsuranceCurrency1("USD"); } } @@ -1361,7 +2490,7 @@ public class PdfService extends AbstractBaseEntityService { commonField.setInsuranceSumInsured2(fieldValue); - if(!commonField.getInsuranceSumInsured2().isBlank()){ + if(commonField.getInsuranceSumInsured2() != null && !commonField.getInsuranceSumInsured2().isBlank()){ commonField.setInsuranceCurrency2("USD"); } } @@ -1379,7 +2508,7 @@ public class PdfService extends AbstractBaseEntityService { commonField.setInsuranceSumInsured3(fieldValue); - if(!commonField.getInsuranceSumInsured3().isBlank()){ + if(commonField.getInsuranceSumInsured3() != null && !commonField.getInsuranceSumInsured3().isBlank()){ commonField.setInsuranceCurrency3("USD"); } } @@ -1389,22 +2518,86 @@ public class PdfService extends AbstractBaseEntityService commonField.setInsuranceOther3(fieldValue); case "undefined_23" -> commonField.setInsuranceOtherDesc3(fieldValue); case "fill_5_7" -> commonField.setInsuranceYear3(fieldValue); + + case "ultimateTotalLife" -> commonField.setUltimateTotalLife(fieldValue); + + case "declinedYes" -> commonField.setDeclinedYes(fieldValue); + case "declinedNo" -> commonField.setDeclinedNo(fieldValue); + case "declinedDesc" -> commonField.setDeclinedDesc(fieldValue); + + case "replaceInsuranceYes" -> commonField.setReplaceInsuranceYes(fieldValue); + case "replaceInsuranceNo" -> commonField.setReplaceInsuranceNo(fieldValue); + /* Page7 End */ /* Page8 Start */ + case "employed" -> commonField.setEmployed(fieldValue); + case "homemaker" -> commonField.setHomemaker(fieldValue); + case "student" -> commonField.setStudent(fieldValue); + case "investor" -> commonField.setInvestor(fieldValue); + case "retired" -> commonField.setRetired(fieldValue); + case "fill_3_8" -> commonField.setOccupationTitle(fieldValue); case "fill_4_6_1" -> commonField.setCompanyName(fieldValue); - case "fill_4_6_2" -> commonField.setCompanyAddress1(fieldValue); - case "fill_4_6_3" -> commonField.setCompanyAddress2(fieldValue); + case "fill_4_6_2" -> commonField.getOthers().put("companyAddress1", fieldValue); + case "fill_4_6_3" -> commonField.getOthers().put("companyAddress2", fieldValue); case "fill_5_8_1" -> commonField.setCompanyNature1(fieldValue); case "fill_5_8_2" -> commonField.setCompanyNature2(fieldValue); + + case "toggle_6_4" -> commonField.getOthers().put("businessOwnerYes", fieldValue); + case "fill_22_5" -> commonField.getOthers().put("businessOwnerPercent", fieldValue); + case "fill_25_3" -> commonField.getOthers().put("businessOwnerNoEmployee", fieldValue); + /* Page8 End */ /* Page9 Start */ case "fill_26_4" -> commonField.setFna_c1a_amount(fieldValue); + case "totalAnnualIncome" -> commonField.setTotalAnnualIncome(fieldValue); - case "total_asset" -> commonField.setFna_c2a_amount(fieldValue); - case "fill_56" -> commonField.setFna_c2b_amount(fieldValue); + case "totalLiquidAsset" -> commonField.setFna_c2a_amount(fieldValue); + case "totalLiquidLia" -> commonField.setFna_c2b_amount(fieldValue); + + case "incomeSalary" -> commonField.setIncomeSalary(fieldValue); + case "incomeSalaryLastYear" -> commonField.setIncomeSalaryLastYear(fieldValue); + case "incomeBonus" -> commonField.setIncomeBonus(fieldValue); + case "incomeBonusLastYear" -> commonField.setIncomeBonusLastYear(fieldValue); + case "incomeOther" -> commonField.setIncomeOther(fieldValue); + case "incomeOtherLastYear" -> commonField.setIncomeOtherLastYear(fieldValue); + case "incomeInterest" -> commonField.setIncomeInterest(fieldValue); + case "incomeInterestLastYear" -> commonField.setIncomeInterestLastYear(fieldValue); + case "incomeDividents" -> commonField.setIncomeDividents(fieldValue); + case "incomeDividentsLastYear" -> commonField.setIncomeDividentsLastYear(fieldValue); + case "incomeRentals" -> commonField.setIncomeRentals(fieldValue); + case "incomeRentalsLastYear" -> commonField.setIncomeRentalsLastYear(fieldValue); + case "assetCash" -> commonField.setAssetCash(fieldValue); + case "assetInvestment" -> commonField.setAssetInvestment(fieldValue); + case "assetRealEstate" -> commonField.setAssetRealEstate(fieldValue); + case "assetNetBusinessInterest" -> commonField.setAssetNetBusinessInterest(fieldValue); + case "assetProperties" -> commonField.setAssetProperties(fieldValue); + case "liaLoan" -> commonField.setLiaLoan(fieldValue); + case "liaMargin" -> commonField.setLiaMargin(fieldValue); + case "liaLoanGurantee" -> commonField.setLiaLoanGurantee(fieldValue); + case "liaMortgage" -> commonField.setLiaMortgage(fieldValue); + case "liaOther" -> commonField.setLiaOther(fieldValue); + + case "fill_30_4" -> commonField.getOthers().put("realEstateAddress1_1", fieldValue); + case "fill_30_4_1" -> commonField.getOthers().put("realEstateAddress1_2", fieldValue); + case "fill_35_2" -> commonField.getOthers().put("realEstateAddress2_1", fieldValue); + case "fill_35_2_1" -> commonField.getOthers().put("realEstateAddress2_2", fieldValue); + case "fill_40_2" -> commonField.getOthers().put("realEstateAddress3_1", fieldValue); + case "fill_40_2_1" -> commonField.getOthers().put("realEstateAddress3_2", fieldValue); + case "fill_31_4" -> commonField.setRealEstatePurchaseDate1(fieldValue); + case "fill_36_2" -> commonField.setRealEstatePurchaseDate2(fieldValue); + case "fill_41_2" -> commonField.setRealEstatePurchaseDate3(fieldValue); + /* Page9 End */ + /* Page10 Start */ + case "toggle_3_7" -> commonField.getOthers().put("sourceIncome", fieldValue); + case "toggle_4_6" -> commonField.getOthers().put("sourceBusiness", fieldValue); + case "toggle_6_5" -> commonField.getOthers().put("sourceInvestment", fieldValue); + case "undefined_33" -> commonField.getOthers().put("sourceInheritance", fieldValue); + case "toggle_7_5" -> commonField.getOthers().put("sourceOther", fieldValue); + case "fill_2_9" -> commonField.getOthers().put("sourceOtherDesc", fieldValue); + /* Page10 End */ } /* Special logic Start */ @@ -1413,6 +2606,15 @@ public class PdfService extends AbstractBaseEntityService commonField.setName(fieldValue); + case "fna_a_name_1" -> commonField.getOthers().put("name1", fieldValue); + case "fna_a_name_2" -> commonField.getOthers().put("name2", fieldValue); + case "fna_a_birth" -> commonField.setDateOfBirth(fieldValue); case "fna_a_id_card" -> commonField.setIdCard(fieldValue); case "fna_a_occupation" -> commonField.setOccupation(fieldValue); @@ -1463,10 +2668,14 @@ public class PdfService extends AbstractBaseEntityService commonField.setFna_b1_a_amount(fieldValue); case "fna_b1_b" -> commonField.setFna_b1_b(fieldValue); case "fna_b1a_4_amount" -> commonField.setFna_b1a_4_amount(fieldValue); + case "fna_b1b_1" -> commonField.setFna_b1b_1(fieldValue); + case "fna_b1b_2" -> commonField.setFna_b1b_2(fieldValue); + case "fna_b1b_3" -> commonField.setFna_b1b_3(fieldValue); case "fna_b1_c" -> commonField.setFna_b1_c(fieldValue); case "fna_b1_d" -> commonField.setFna_b1_d(fieldValue); case "fna_b1_d_year" -> commonField.setFna_b1_d_year(fieldValue); case "fna_b1_d_amount" -> commonField.setFna_b1_d_amount(fieldValue); + /* Page1 End */ /* Page2 Start */ case "fna_b1_e" -> commonField.setFna_b1_e(fieldValue); @@ -1521,7 +2730,40 @@ public class PdfService extends AbstractBaseEntityService commonField.setFna_d_1(fieldValue); case "fna_d_2" -> commonField.setFna_d_2(fieldValue); case "fna_d_3" -> commonField.setFna_d_3(fieldValue); - case "fna_d_desc" -> commonField.setFna_d_desc(fieldValue); + case "fna_d_desc" -> commonField.setFna_d_desc(fieldValue); + + case "fna_d_b1_1" -> commonField.getOthers().put("recObj1", fieldValue); + case "fna_d_b1_2" -> commonField.getOthers().put("recObj2", fieldValue); + case "fna_d_b1_3" -> commonField.getOthers().put("recObj3", fieldValue); + case "fna_d_b1_4" -> commonField.getOthers().put("recObj4", fieldValue); + case "fna_d_b1_5" -> commonField.getOthers().put("recObj5", fieldValue); + case "fna_d_b1_6" -> commonField.getOthers().put("recObj6", fieldValue); + + case "fna_d_name_1" -> commonField.getOthers().put("recProd1_1", fieldValue); + case "fna_d_name_1_2" -> commonField.getOthers().put("recProd1_2", fieldValue); + case "fna_d_name_2" -> commonField.getOthers().put("recProd2_1", fieldValue); + case "fna_d_name_2_2" -> commonField.getOthers().put("recProd2_2", fieldValue); + case "fna_d_name_3" -> commonField.getOthers().put("recProd3_2", fieldValue); + case "fna_d_name_3_2" -> commonField.getOthers().put("recProd3_2", fieldValue); + case "fna_d_name_4" -> commonField.getOthers().put("recProd4_1", fieldValue); + case "fna_d_name_4_2" -> commonField.getOthers().put("recProd4_2", fieldValue); + case "fna_d_name_5" -> commonField.getOthers().put("recProd5_1", fieldValue); + case "fna_d_name_5_2" -> commonField.getOthers().put("recProd5_2", fieldValue); + case "fna_d_name_6" -> commonField.getOthers().put("recProd6_1", fieldValue); + case "fna_d_name_6_2" -> commonField.getOthers().put("recProd6_2", fieldValue); + + case "fna_d_product_1" -> commonField.getOthers().put("recSelect1_1", fieldValue); + case "fna_d_product_1_2" -> commonField.getOthers().put("recSelect1_2", fieldValue); + case "fna_d_product_2" -> commonField.getOthers().put("recSelect2_1", fieldValue); + case "fna_d_product_2_2" -> commonField.getOthers().put("recSelect2_2", fieldValue); + case "fna_d_product_3" -> commonField.getOthers().put("recSelect3_1", fieldValue); + case "fna_d_product_3_2" -> commonField.getOthers().put("recSelect3_2", fieldValue); + case "fna_d_product_4" -> commonField.getOthers().put("recSelect4_1", fieldValue); + case "fna_d_product_4_2" -> commonField.getOthers().put("recSelect4_2", fieldValue); + case "fna_d_product_5" -> commonField.getOthers().put("recSelect5_1", fieldValue); + case "fna_d_product_5_2" -> commonField.getOthers().put("recSelect5_2", fieldValue); + case "fna_d_product_6" -> commonField.getOthers().put("recSelect6_1", fieldValue); + case "fna_d_product_6_2" -> commonField.getOthers().put("recSelect6_2", fieldValue); /* Page6 End */ } } @@ -1532,6 +2774,8 @@ public class PdfService extends AbstractBaseEntityService commonField.setName(fieldValue); + case "fill_3_1" -> commonField.getOthers().put("name1", fieldValue); + case "fill_3_2" -> commonField.getOthers().put("name2", fieldValue); case "fill_4" -> commonField.setNameChi(fieldValue); case "fill_5" -> commonField.setGender(fieldValue); case "fill_6" -> commonField.setDateOfBirth(fieldValue); @@ -1674,6 +2918,13 @@ public class PdfService extends AbstractBaseEntityService commonField.setFna_b1_f(fieldValue); case "part2_1f_desc" -> commonField.setFna_b1_f_other(fieldValue); + + case "a Business Earning" -> commonField.setFna_c3b_salary(fieldValue); + case "b Others Please specify" -> commonField.setFna_c3b_income(fieldValue); + case "Check Box15" -> commonField.setFna_c3b_investments(fieldValue); + case "Check Box16" -> commonField.setFna_c3b_others(fieldValue); + case "undefined_6" -> commonField.setFna_c3b_desc(fieldValue); + case "part2_2_a" -> commonField.setFna_b2_a(fieldValue); case "part2_2_b" -> commonField.setFna_b2_b(fieldValue); case "part2_2_c" -> commonField.setFna_b2_c(fieldValue); @@ -1721,8 +2972,8 @@ public class PdfService extends AbstractBaseEntityService commonField.setName(fieldValue); case "date_of_birth" -> commonField.setDateOfBirth(fieldValue); case "occupation" -> commonField.setOccupation(fieldValue); - case "address1" -> commonField.setAddress1(fieldValue); - case "address2" -> commonField.setAddress2(fieldValue); + case "address1" -> commonField.getOthers().put("address1", fieldValue); + case "address2" -> commonField.getOthers().put("address2", fieldValue); case "contact" -> commonField.setContactNo(fieldValue); case "email" -> commonField.setEmail(fieldValue); @@ -1759,7 +3010,9 @@ public class PdfService extends AbstractBaseEntityService commonField.setFna_c1d_amount(fieldValue); //need to set the check box when get - case "4a1" -> commonField.setFna_c2a_amount(fieldValue); + case "4a1" -> commonField.setFna_c1d_amount(fieldValue); + case "4b1" -> commonField.setFna_c2a_amount(fieldValue); + case "cb4b1" -> commonField.setFna_c2a_cash(fieldValue); case "cb4b2" -> commonField.setFna_c2a_bank_account(fieldValue); case "cb4b3" -> commonField.setFna_c2a_market_account(fieldValue); @@ -1802,6 +3055,39 @@ public class PdfService extends AbstractBaseEntityService commonField.setFna_d_1(fieldValue); case "cb6a2" -> commonField.setFna_d_3(fieldValue); case "6a2_other1" -> commonField.setFna_d_desc(fieldValue); + + case "5obj1" -> commonField.getOthers().put("recObj1", fieldValue); + case "5obj2" -> commonField.getOthers().put("recObj2", fieldValue); + case "5obj3" -> commonField.getOthers().put("recObj3", fieldValue); + case "5obj4" -> commonField.getOthers().put("recObj4", fieldValue); + case "5obj5" -> commonField.getOthers().put("recObj5", fieldValue); + case "5obj6" -> commonField.getOthers().put("recObj6", fieldValue); + + case "5name1_1" -> commonField.getOthers().put("recProd1_1", fieldValue); + case "5name1_2" -> commonField.getOthers().put("recProd1_2", fieldValue); + case "5name2_1" -> commonField.getOthers().put("recProd2_1", fieldValue); + case "5name2_2" -> commonField.getOthers().put("recProd2_2", fieldValue); + case "5name3_1" -> commonField.getOthers().put("recProd3_2", fieldValue); + case "5name3_2" -> commonField.getOthers().put("recProd3_2", fieldValue); + case "5name4_1" -> commonField.getOthers().put("recProd4_1", fieldValue); + case "5name4_2" -> commonField.getOthers().put("recProd4_2", fieldValue); + case "5name5_1" -> commonField.getOthers().put("recProd5_1", fieldValue); + case "5name5_2" -> commonField.getOthers().put("recProd5_2", fieldValue); + case "5name6_1" -> commonField.getOthers().put("recProd6_1", fieldValue); + case "5name6_2" -> commonField.getOthers().put("recProd6_2", fieldValue); + + case "5slected1_1" -> commonField.getOthers().put("recSelect1_1", fieldValue); + case "5slected1_2" -> commonField.getOthers().put("recSelect1_2", fieldValue); + case "5slected2_1" -> commonField.getOthers().put("recSelect2_1", fieldValue); + case "5slected2_2" -> commonField.getOthers().put("recSelect2_2", fieldValue); + case "5slected3_1" -> commonField.getOthers().put("recSelect3_1", fieldValue); + case "5slected3_2" -> commonField.getOthers().put("recSelect3_2", fieldValue); + case "5slected4_1" -> commonField.getOthers().put("recSelect4_1", fieldValue); + case "5slected4_2" -> commonField.getOthers().put("recSelect4_2", fieldValue); + case "5slected5_1" -> commonField.getOthers().put("recSelect5_1", fieldValue); + case "5slected5_2" -> commonField.getOthers().put("recSelect5_2", fieldValue); + case "5slected6_1" -> commonField.getOthers().put("recSelect6_1", fieldValue); + case "5slected6_2" -> commonField.getOthers().put("recSelect6_2", fieldValue); /* Page4 End */ } @@ -1842,12 +3128,50 @@ public class PdfService extends AbstractBaseEntityService commonField.setFna_c1a_amount(fieldValue); case "1_12_6" -> commonField.setCompanyName(fieldValue); - case "1_12_7_1" -> commonField.setCompanyAddress1(fieldValue); - case "1_12_7_2" -> commonField.setCompanyAddress2(fieldValue); + case "1_12_7_1" -> commonField.getOthers().put("companyAddress1", fieldValue); + case "1_12_7_2" -> commonField.getOthers().put("companyAddress2", fieldValue); case "1_12_8_1" -> commonField.setCompanyNature1(fieldValue); case "1_12_8_2" -> commonField.setCompanyNature2(fieldValue); + /* + case "ch1_13_rm" -> commonField.setCrAddressRoom(fieldValue); + case "ch1_13_floor" -> commonField.setCrAddressFloor(fieldValue); + case "ch1_13_block" -> commonField.setCrAddressBlock(fieldValue); + case "ch1_13_building" -> commonField.setCrAddressBuilding(fieldValue); + case "ch1_13_street" -> commonField.setCrAddressStreet(fieldValue); + case "ch1_13_country" -> commonField.setCrAddressCountry(fieldValue); + case "1_13_zip" -> commonField.setCrAddressPostalCode(fieldValue); + + case "ch1_13_corr_rm" -> commonField.setCorAddressRoom(fieldValue); + case "ch1_13_corr_floor" -> commonField.setCorAddressFloor(fieldValue); + case "ch1_13_corr_block" -> commonField.setCorAddressBlock(fieldValue); + case "ch1_13_corr_building" -> commonField.setCorAddressBuilding(fieldValue); + case "ch1_13_corr_street" -> commonField.setCorAddressStreet(fieldValue); + case "ch1_13_corr_zip" -> commonField.setCorAddressPostalCode(fieldValue); + */ + case "ch1_13_rm" -> commonField.getOthers().put("crAddressRoom", fieldValue); + case "ch1_13_floor" -> commonField.getOthers().put("crAddressFloor", fieldValue); + case "ch1_13_block" -> commonField.getOthers().put("crAddressBlock", fieldValue); + case "ch1_13_building" -> commonField.getOthers().put("crAddressBuilding", fieldValue); + case "ch1_13_street" -> commonField.getOthers().put("crAddressStreet", fieldValue); + case "ch1_13_country" -> commonField.getOthers().put("crAddressCountry", fieldValue); + case "1_13_zip" -> commonField.getOthers().put("crAddressPostalCode", fieldValue); + case "ch1_13_hk" -> commonField.getOthers().put("crAddressHk", fieldValue); + case "ch1_13_kln" -> commonField.getOthers().put("crAddressKln", fieldValue); + case "ch1_13_nt" -> commonField.getOthers().put("crAddressNt", fieldValue); + + case "ch1_13_corr_rm" -> commonField.getOthers().put("corAddressRoom", fieldValue); + case "ch1_13_corr_floor" -> commonField.getOthers().put("corAddressFloor", fieldValue); + case "ch1_13_corr_block" -> commonField.getOthers().put("corAddressBlock", fieldValue); + case "ch1_13_corr_building" -> commonField.getOthers().put("corAddressBuilding", fieldValue); + case "ch1_13_corr_street" -> commonField.getOthers().put("corAddressStreet", fieldValue); + case "ch1_13_corr_country" -> commonField.getOthers().put("corAddressCountry", fieldValue); + case "ch1_13_corr_zip" -> commonField.getOthers().put("corAddressPostalCode", fieldValue); + case "ch1_13_corr_hk" -> commonField.getOthers().put("corAddressHk", fieldValue); + case "ch1_13_corr_kln" -> commonField.getOthers().put("corAddressKln", fieldValue); + case "ch1_13_corr_nt" -> commonField.getOthers().put("corAddressNt", fieldValue); + case "1_13_tel_mobile" -> commonField.setContactNo(fieldValue); case "1_14d_tax1" -> commonField.setTaxResidency1(fieldValue); @@ -1887,34 +3211,46 @@ public class PdfService extends AbstractBaseEntityService commonField.setInsuranceCurrency1(fieldValue); case "4_1_sum1" -> commonField.setInsuranceSumInsured1(fieldValue); case "ch4_1_life" -> { - if("Off".equals(fieldValue)) - commonField.setInsuranceLife1("Yes"); - else if("On".equals(fieldValue)) - commonField.setInsuranceLife1("Off"); + if(acroForm.getField("4_1_sum1").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum1").getValueAsString().isBlank()) + commonField.setInsuranceLife1("Yes"); + else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum1").getValueAsString().isBlank()) + commonField.setInsuranceLife1("Off"); + } + } case "ch4_1_accident" -> { - if("Off".equals(fieldValue)){ - commonField.setInsuranceOther1("Yes"); - commonField.setInsuranceOtherDesc1("Accident"); - }else if("On".equals(fieldValue)){ - //commonField.setInsuranceOther1("Off"); - //commonField.setInsuranceOtherDesc1(""); + if(acroForm.getField("4_1_sum1").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum1").getValueAsString().isBlank()){ + commonField.setInsuranceOther1("Yes"); + commonField.setInsuranceOtherDesc1("Accident"); + }else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum1").getValueAsString().isBlank()){ + //commonField.setInsuranceOther1("Off"); + //commonField.setInsuranceOtherDesc1(""); + } } + } case "ch4_1_critical" -> { - if("Off".equals(fieldValue)) - commonField.setInsuranceCritical1("Yes"); - else if("On".equals(fieldValue)) - commonField.setInsuranceCritical1("Off"); + if(acroForm.getField("4_1_sum1").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum1").getValueAsString().isBlank()) + commonField.setInsuranceCritical1("Yes"); + else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum1").getValueAsString().isBlank()) + commonField.setInsuranceCritical1("Off"); + } + } case "ch4_1_hospital" -> { - if("Off".equals(fieldValue)){ - commonField.setInsuranceOther1("Yes"); - commonField.setInsuranceOtherDesc1("Hospital"); - }else if("On".equals(fieldValue)){ - //commonField.setInsuranceOther1("Off"); - //commonField.setInsuranceOtherDesc1(""); + if(acroForm.getField("4_1_sum1").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum1").getValueAsString().isBlank()){ + commonField.setInsuranceOther1("Yes"); + commonField.setInsuranceOtherDesc1("Hospital"); + }else if("On".equals(fieldValue)){ + //commonField.setInsuranceOther1("Off"); + //commonField.setInsuranceOtherDesc1(""); + } } + } case "4_1_name2_1" -> commonField.setInsuranceCompany2_1(fieldValue); @@ -1924,34 +3260,46 @@ public class PdfService extends AbstractBaseEntityService commonField.setInsuranceCurrency2(fieldValue); case "4_1_sum2" -> commonField.setInsuranceSumInsured2(fieldValue); case "ch4_2_life" -> { - if("Off".equals(fieldValue)) - commonField.setInsuranceLife2("Yes"); - else if("On".equals(fieldValue)) - commonField.setInsuranceLife2("Off"); + if(acroForm.getField("4_1_sum2").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum2").getValueAsString().isBlank()) + commonField.setInsuranceLife2("Yes"); + else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum2").getValueAsString().isBlank()) + commonField.setInsuranceLife2("Off"); + } + } case "ch4_2_accident" -> { - if("Off".equals(fieldValue)){ - commonField.setInsuranceOther2("Yes"); - commonField.setInsuranceOtherDesc2("Accident"); - }else if("On".equals(fieldValue)){ - //commonField.setInsuranceOther1("Off"); - //commonField.setInsuranceOtherDesc1(""); + if(acroForm.getField("4_1_sum2").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum2").getValueAsString().isBlank()){ + commonField.setInsuranceOther2("Yes"); + commonField.setInsuranceOtherDesc2("Accident"); + }else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum2").getValueAsString().isBlank()){ + //commonField.setInsuranceOther1("Off"); + //commonField.setInsuranceOtherDesc1(""); + } } + } case "ch4_2_critical" -> { - if("Off".equals(fieldValue)) - commonField.setInsuranceCritical2("Yes"); - else if("On".equals(fieldValue)) - commonField.setInsuranceCritical2("Off"); + if(acroForm.getField("4_1_sum2").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum2").getValueAsString().isBlank()) + commonField.setInsuranceCritical2("Yes"); + else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum2").getValueAsString().isBlank()) + commonField.setInsuranceCritical2("Off"); + } + } case "ch4_2_hospital" -> { - if("Off".equals(fieldValue)){ - commonField.setInsuranceOther2("Yes"); - commonField.setInsuranceOtherDesc2("Hospital"); - }else if("On".equals(fieldValue)){ - //commonField.setInsuranceOther1("Off"); - //commonField.setInsuranceOtherDesc1(""); + if(acroForm.getField("4_1_sum2").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum2").getValueAsString().isBlank()){ + commonField.setInsuranceOther2("Yes"); + commonField.setInsuranceOtherDesc2("Hospital"); + }else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum2").getValueAsString().isBlank()){ + //commonField.setInsuranceOther1("Off"); + //commonField.setInsuranceOtherDesc1(""); + } } + } case "4_1_name3_1" -> commonField.setInsuranceCompany3_1(fieldValue); @@ -1961,37 +3309,62 @@ public class PdfService extends AbstractBaseEntityService commonField.setInsuranceCurrency3(fieldValue); case "4_1_sum3" -> commonField.setInsuranceSumInsured3(fieldValue); case "ch4_3_life" -> { - if("Off".equals(fieldValue)) - commonField.setInsuranceLife3("Yes"); - else if("On".equals(fieldValue)) - commonField.setInsuranceLife3("Off"); + if(acroForm.getField("4_1_sum3").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum3").getValueAsString().isBlank()) + commonField.setInsuranceLife3("Yes"); + else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum3").getValueAsString().isBlank()) + commonField.setInsuranceLife3("Off"); + } + } case "ch4_3_accident" -> { - if("Off".equals(fieldValue)){ - commonField.setInsuranceOther3("Yes"); - commonField.setInsuranceOtherDesc3("Accident"); - }else if("On".equals(fieldValue)){ - //commonField.setInsuranceOther1("Off"); - //commonField.setInsuranceOtherDesc1(""); + if(acroForm.getField("4_1_sum3").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum3").getValueAsString().isBlank()){ + commonField.setInsuranceOther3("Yes"); + commonField.setInsuranceOtherDesc3("Accident"); + }else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum3").getValueAsString().isBlank()){ + //commonField.setInsuranceOther1("Off"); + //commonField.setInsuranceOtherDesc1(""); + } } + } case "ch4_3_critical" -> { - if("Off".equals(fieldValue)) - commonField.setInsuranceCritical3("Yes"); - else if("On".equals(fieldValue)) - commonField.setInsuranceCritical3("Off"); + if(acroForm.getField("4_1_sum3").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum3").getValueAsString().isBlank()) + commonField.setInsuranceCritical3("Yes"); + else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum3").getValueAsString().isBlank()) + commonField.setInsuranceCritical3("Off"); + } + } case "ch4_3_hospital" -> { - if("Off".equals(fieldValue)){ - commonField.setInsuranceOther3("Yes"); - commonField.setInsuranceOtherDesc3("Hospital"); - }else if("On".equals(fieldValue)){ - //commonField.setInsuranceOther1("Off"); - //commonField.setInsuranceOtherDesc1(""); + if(acroForm.getField("4_1_sum3").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum3").getValueAsString().isBlank()){ + commonField.setInsuranceOther3("Yes"); + commonField.setInsuranceOtherDesc3("Hospital"); + }else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum3").getValueAsString().isBlank()){ + //commonField.setInsuranceOther1("Off"); + //commonField.setInsuranceOtherDesc1(""); + } } + } } } + + if ("HSBCA31".equals(formCode)) { + HSBCA31(fieldName, fieldValue, commonField, acroForm); + } + + if ("MLB03S".equals(formCode)) { + MLB03S(fieldName, fieldValue, commonField, acroForm); + } + + if ("SLGII".equals(formCode)) { + SLGII(fieldName, fieldValue, commonField, acroForm); + + } //logger.info("end Field: " + field.getPartialName() + ", Value: " + field.getValueAsString()); // You can save this data to a database, or perform other operations @@ -2004,6 +3377,603 @@ public class PdfService extends AbstractBaseEntityService commonField.setFirstName(fieldValue); + case "fill_16" -> commonField.setGivenName(fieldValue); + + case "fill_17" -> commonField.setNameChi(fieldValue); + + case "Text1" -> commonField.setIdCard(fieldValue); + case "passportNo" -> commonField.setPassportNo(fieldValue); + case "Text12" -> commonField.setCountryOfIssue(fieldValue); + case "fill_18" -> commonField.setDateOfBirth(fieldValue); + case "Checkk Box6" -> commonField.setGenderMale(fieldValue); + case "Check kBox7" -> commonField.setGenderFemale(fieldValue); + + case "fill_19" -> commonField.setCountryOfCitizenship(fieldValue); + case "fill_20" -> commonField.setPlaceOfBirth(fieldValue); + /* Page1 End */ + /* Page2 Start */ + case "Text16_1" -> commonField.getOthers().put("crAddress1", fieldValue); + case "Text16_2" -> commonField.getOthers().put("crAddress2", fieldValue); + + case "address1" -> commonField.getOthers().put("address1", fieldValue); + case "address2" -> commonField.getOthers().put("address2", fieldValue); + + case "fill_12" -> commonField.setContactNo(fieldValue); + case "Text182" -> commonField.setEmail(fieldValue); + case "Check Box175" -> commonField.setEmployedSelf(fieldValue); + case "Check Box177" -> commonField.setEmployed(fieldValue); + case "Check Box179" -> commonField.setPartTime(fieldValue); + case "Check Box181" -> commonField.setEmployedNon(fieldValue); + case "Check Box176" -> commonField.setStudent(fieldValue); + case "Check Box178" -> commonField.setHomemaker(fieldValue); + case "Check Box180" -> commonField.setRetired(fieldValue); + + case "Text174" -> commonField.setCompanyName(fieldValue); + case "Text173_1" -> commonField.setCompanyNature1(fieldValue); + case "Text173_2" -> commonField.setCompanyNature2(fieldValue); + case "fill_16_2" -> commonField.setOccupationTitle(fieldValue); + case "fill_17_1" -> commonField.getOthers().put("companyAddress1", fieldValue); + case "fill_17_2" -> commonField.getOthers().put("companyAddress2", fieldValue); + /* Page2 End */ + /* Page3 Start */ + case "undefined_51" -> commonField.setContactNo(fieldValue); + /* Page3 End */ + /* Page12 Start */ + case "undefined_17ha_1" -> commonField.setInsuranceCompany1_1(fieldValue); + case "undefined_17ha_2" -> commonField.setInsuranceCompany1_2(fieldValue); + case "undefined_17ha_3" -> commonField.setInsuranceCompany1_3(fieldValue); + case "undefined_17hk" -> commonField.setInsuranceSumInsured1(fieldValue); + case "undefined_17hl" -> commonField.setInsuranceYear1(fieldValue); + + case "undefined_17hn_1" -> commonField.setInsuranceCompany2_1(fieldValue); + case "undefined_17hn_2" -> commonField.setInsuranceCompany2_2(fieldValue); + case "undefined_17hn_3" -> commonField.setInsuranceCompany2_3(fieldValue); + case "undefined_17ho" -> commonField.setInsuranceSumInsured1(fieldValue); + case "undefined_17hp" -> commonField.setInsuranceYear1(fieldValue); + + case "undefined_17hr_1" -> commonField.setInsuranceCompany3_1(fieldValue); + case "undefined_17hr_2" -> commonField.setInsuranceCompany3_2(fieldValue); + case "undefined_17hr_3" -> commonField.setInsuranceCompany3_3(fieldValue); + case "undefined_17hsb" -> commonField.setInsuranceSumInsured1(fieldValue); + case "undefined_17ht" -> commonField.setInsuranceYear1(fieldValue); + + case "fill_2_6" -> commonField.setUltimateTotalLife(fieldValue); + + case "Check Box74b" -> commonField.setDeclinedYes(fieldValue); + case "Check Box74_1a" -> commonField.setDeclinedNo(fieldValue); + case "fill_2_6e" -> commonField.setDeclinedDesc(fieldValue); + + case "fill_15_7y" -> commonField.setDeclinedDesc(fieldValue); + /* Page12 End */ + /* Page13 Start */ + case "fill_9_6" -> commonField.setIncomeSalary(fieldValue); + case "fill_1k0_5" -> commonField.setIncomeSalaryLastYear(fieldValue); + case "fill_13_4" -> commonField.setIncomeBonus(fieldValue); + case "fill_14_4" -> commonField.setIncomeBonusLastYear(fieldValue); + case "fill_17_7" -> commonField.setIncomeInterest(fieldValue); + case "fill_18_6" -> commonField.setIncomeInterestLastYear(fieldValue); + case "fill_2k1_5" -> commonField.setAssetInvestment(fieldValue); + + case "fill_2k9_3" -> commonField.setIncomeDividents(fieldValue); + case "fill_3k0_3" -> commonField.setIncomeDividentsLastYear(fieldValue); + case "fill_k33_3" -> commonField.setIncomeRentals(fieldValue); + case "fill_34_2" -> commonField.setIncomeRentalsLastYear(fieldValue); + case "fill_k37_2" -> commonField.setIncomeOther(fieldValue); + case "fill_38_2" -> commonField.setIncomeOtherLastYear(fieldValue); + case "fill_37_2" -> commonField.setTotalAnnualIncome(fieldValue); + + case "fill_39_2" -> commonField.setFna_c1b_amount(fieldValue); + + case "fill_4114" -> commonField.setAssetCash(fieldValue); + case "fill_4916" -> commonField.setAssetRealEstate(fieldValue); + case "fill_5720" -> commonField.setAssetInvestment(fieldValue); + case "fill_5318" -> commonField.setAssetProperties(fieldValue); + + case "fill_111130" -> commonField.setFna_c2a_amount(fieldValue); + case "fill_1111" -> commonField.setFna_c2b_amount(fieldValue); + /* Page13 End */ + /* Page14 Start */ + case "fill_73_1" -> commonField.getOthers().put("realEstateAddress1_1", fieldValue); + case "fill_73_2" -> commonField.getOthers().put("realEstateAddress1_2", fieldValue); + case "fill_77_1" -> commonField.getOthers().put("realEstateAddress2_1", fieldValue); + case "fill_77_2" -> commonField.getOthers().put("realEstateAddress2_2", fieldValue); + case "fill_81_1" -> commonField.getOthers().put("realEstateAddress3_1", fieldValue); + case "fill_81_2" -> commonField.getOthers().put("realEstateAddress3_2", fieldValue); + case "fill_74" -> commonField.setRealEstatePurchaseDate1(fieldValue); + case "fill_78" -> commonField.setRealEstatePurchaseDate2(fieldValue); + case "fill_82" -> commonField.setRealEstatePurchaseDate3(fieldValue); + + case "Check Box65f" -> commonField.setOwn_income(fieldValue); + case "Check Box65d" -> commonField.setPremium_financing(fieldValue); + case "Check Box65c" -> commonField.setSavings(fieldValue); + + case "Check Box65b" -> commonField.setBankruptYes(fieldValue); + case "Check Box83" -> commonField.setBankruptNo(fieldValue); + case "Text26001" -> commonField.setBankruptNo(fieldValue); + /* Page14 End */ + case "fill_4_12" -> commonField.setFna_a_retire(fieldValue); + + + } + } + + private void MLB03S(String fieldName, String fieldValue, CommonField commonField,PDAcroForm acroForm){ + switch (fieldName) { + /* Page1 Start */ + case "SurName1" -> commonField.setFirstName(fieldValue); + case "GivenName1" -> commonField.setGivenName(fieldValue); + case "ChineseName1" -> commonField.setNameChi(fieldValue); + + case "male" -> commonField.setGenderMale(fieldValue); + case "female" -> commonField.setGenderFemale(fieldValue); + + case "DD1" -> commonField.setDdDateOfBirth(fieldValue); + case "MM1" -> commonField.setMmDateOfBirth(fieldValue); + case "YYYY1" -> commonField.setYyyyDateOfBirth(fieldValue); + + case "hk" -> { + if("Yes".equals(fieldValue)) + commonField.setPlaceOfBirth("Hong Kong"); + } + case "macau" -> { + if("Yes".equals(fieldValue)) + commonField.setPlaceOfBirth("Macau"); + } + case "Field_LocationA1" -> commonField.setPlaceOfBirth(fieldValue); + case "Field_LocationB1" -> commonField.setPlaceOfBirth(fieldValue); + + case "ID1" -> commonField.setIdCard(fieldValue); + + case "Nationality1" -> commonField.setCountryOfCitizenship(fieldValue); + case "Company1" -> commonField.setCompanyName(fieldValue); + case "BusinessNature1" -> commonField.setCompanyNature1(fieldValue); + case "BusinessNature2" -> commonField.setCompanyNature2(fieldValue); + case "Occupation1" -> commonField.setOccupation(fieldValue); + case "JobNature1" -> commonField.setOccupationTitle(fieldValue); + + //Income1 = IDA commonField.getIncomeSalary() + commonField.getIncomeBonus() ??? beware of it may have , and english P.A. or even USD + case "Room1" -> commonField.getOthers().put("crAddressRoom", fieldValue); + case "Floor1" -> commonField.getOthers().put("crAddressFloor", fieldValue); + case "Block1" -> commonField.getOthers().put("crAddressBlock", fieldValue); + case "Building1" -> commonField.getOthers().put("crAddressBuilding", fieldValue); + case "Street1" -> commonField.getOthers().put("crAddressStreet", fieldValue); + case "City1" -> commonField.getOthers().put("crAddressCity", fieldValue); + case "District1" -> commonField.getOthers().put("crAddressDistrict", fieldValue); + case "Country1" -> commonField.getOthers().put("crAddressCountry", fieldValue); + case "PostalCode1" -> commonField.getOthers().put("crAddressPostalCode", fieldValue); + + case "Checkbox_Y" -> commonField.setTobarccoYes(fieldValue); + case "Checkbox_N" -> commonField.setTobarccoNo(fieldValue); + /* Page1 End */ + /* Page2 Start */ + case "Room3" -> commonField.getOthers().put("corAddressRoom", fieldValue); + case "Floor3" -> commonField.getOthers().put("corAddressFloor", fieldValue); + case "Block3" -> commonField.getOthers().put("corAddressBlock", fieldValue); + case "Building3" -> commonField.getOthers().put("corAddressBuilding", fieldValue); + case "Street3" -> commonField.getOthers().put("corAddressStreet", fieldValue); + case "City3" -> commonField.getOthers().put("corAddressCity", fieldValue); + case "District3" -> commonField.getOthers().put("corAddressDistrict", fieldValue); + case "Country3" -> commonField.getOthers().put("corAddressCountry", fieldValue); + case "PostalCode3" -> commonField.getOthers().put("corAddressPostalCode", fieldValue); + + case "ContactB1" -> commonField.setContactNo(fieldValue); + case "Email" -> commonField.setEmail(fieldValue); + /* Page2 End */ + /* Page3 Start */ + case "Checkbox_Wealth1" -> commonField.getOthers().put("sourceIncome", fieldValue); + case "Checkbox_Wealth2" -> commonField.getOthers().put("sourceInvestment", fieldValue); + case "Checkbox_Wealth3" -> commonField.getOthers().put("sourceInheritance", fieldValue); + case "Checkbox_Wealth4" -> commonField.getOthers().put("sourceOther", fieldValue); + case "Field_Wealth4" -> commonField.getOthers().put("sourceOtherDesc", fieldValue); + + case "Checkbox_EudcationPri" -> commonField.setEduPri(fieldValue); + case "Checkbox_EudcationSec" -> commonField.setEduSec(fieldValue); + case "Checkbox_EudcationPostSec" -> commonField.setEduPostSec(fieldValue); + case "Checkbox_EudcationTer" -> commonField.setEduUni(fieldValue); + /* Page3 End */ + /* Page7 Start */ + + case "Residency1" -> commonField.setTaxResidency1(fieldValue); + case "Residency2" -> commonField.setTaxResidency2(fieldValue); + case "Residency3" -> commonField.setTaxResidency3(fieldValue); + case "TIN1" -> commonField.setTaxPin1(fieldValue); + case "TIN2" -> commonField.setTaxPin2(fieldValue); + case "TIN3" -> commonField.setTaxPin3(fieldValue); + case "ABC1" -> commonField.setTaxReason1(fieldValue); + case "ABC2" -> commonField.setTaxReason2(fieldValue); + case "ABC3" -> commonField.setTaxReason3(fieldValue); + case "Reason1" -> commonField.setTaxReasonB1(fieldValue); + case "Reason2" -> commonField.setTaxReasonB2(fieldValue); + case "Reason3" -> commonField.setTaxReasonB3(fieldValue); + + /* Page7 End */ + /* Page8 Start */ + case "c_DeclartionYes" -> commonField.setReplaceInsuranceYes(fieldValue); + case "c_DeclartionNo" -> commonField.setReplaceInsuranceNo(fieldValue); + /* Page8 End */ + + } + } + + private void SLGII(String fieldName, String fieldValue, CommonField commonField,PDAcroForm acroForm){ + switch (fieldName) { + /* Page1 Start */ + case "surname" -> commonField.setFirstName(fieldValue); + case "given_name" -> commonField.setGivenName(fieldValue); + case "ChineseName1" -> commonField.setNameChi(fieldValue); + + case "ch1_4_m" -> commonField.setGenderMale(fieldValue); + case "ch1_4_f" -> commonField.setGenderFemale(fieldValue); + + case "ch1_5n" -> commonField.setTobarccoYes(fieldValue); + case "ch1_5s" -> commonField.setTobarccoNo(fieldValue); + + case "1_6dd" -> commonField.setDdDateOfBirth(fieldValue); + case "1_6mm" -> commonField.setMmDateOfBirth(fieldValue); + case "1_6yyyy" -> commonField.setYyyyDateOfBirth(fieldValue); + + case "1_7" -> commonField.setPlaceOfBirth(fieldValue); + case "1_8" -> commonField.setCountryOfCitizenship(fieldValue); + + case "1_10id" -> { + commonField.setIdCard(fieldValue); + commonField.setPlaceOfBirth("Hong Kong"); + } + case "1_10passport" -> { + commonField.setPassportNo(fieldValue); + } + case "fill_14_date" -> commonField.getOthers().put("passportExpiryDate", fieldValue); + /* Page1 End */ + /* Page2 Start */ + case "ch1_12_self" -> commonField.setEmployedSelf(fieldValue); + case "ch1_12_full" -> commonField.setEmployed(fieldValue); + case "ch1_12_student" -> commonField.setStudent(fieldValue); + case "ch1_12_housewife" -> commonField.setPartTime(fieldValue); + case "ch1_12_part" -> commonField.setHomemaker(fieldValue); + case "ch1_12_retired" -> commonField.setRetired(fieldValue); + + case "1_12_occupation" -> commonField.setOccupation(fieldValue); + case "1_12_exact_duty" -> commonField.setOccupationTitle(fieldValue); + + case "1_12_employer" -> commonField.setCompanyName(fieldValue); + case "1_12_employer_address_1" -> commonField.getOthers().put("companyAddress1", fieldValue); + case "1_12_employer_address_2" -> commonField.getOthers().put("companyAddress2", fieldValue); + + case "1_12_nature_1" -> commonField.setCompanyNature1(fieldValue); + case "1_12_nature_2" -> commonField.setCompanyNature2(fieldValue); + + case "1_13a_rm" -> commonField.getOthers().put("crAddressRoom", fieldValue); + case "1_13a_floor" -> commonField.getOthers().put("crAddressFloor", fieldValue); + case "1_13a_block" -> commonField.getOthers().put("crAddressBlock", fieldValue); + case "1_13a_building" -> commonField.getOthers().put("crAddressBuilding", fieldValue); + case "1_13a_district" -> commonField.getOthers().put("crAddressCountry", fieldValue); + case "1_13a_zip" -> commonField.getOthers().put("crAddressPostalCode", fieldValue); + case "ch1_13a_hk" -> commonField.getOthers().put("crAddressHK", fieldValue); + case "ch1_13a_kln" -> commonField.getOthers().put("crAddressKln", fieldValue); + case "ch1_13a_nt" -> commonField.getOthers().put("crAddressNt", fieldValue); + + case "1_13bc_rm" -> commonField.getOthers().put("corAddressRoom", fieldValue); + case "1_13bc_floor" -> commonField.getOthers().put("corAddressFloor", fieldValue); + case "1_13bc_block" -> commonField.getOthers().put("corAddressBlock", fieldValue); + case "1_13bc_building" -> commonField.getOthers().put("corAddressBuilding", fieldValue); + case "1_13bc_street" -> commonField.getOthers().put("corAddressStreet", fieldValue); + case "1_13bc_district" -> commonField.getOthers().put("corAddressCountry", fieldValue); + case "1_13bc_zip" -> commonField.getOthers().put("corAddressPostalCode", fieldValue); + case "ch1_13bc_hk" -> commonField.getOthers().put("corAddressHK", fieldValue); + case "ch1_13bc_kln" -> commonField.getOthers().put("corAddressKln", fieldValue); + case "ch1_13bc_nt" -> 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_14d_tax1" -> commonField.setTaxResidency1(fieldValue); + case "1_14d_tax2" -> commonField.setTaxResidency2(fieldValue); + case "1_14d_tax3" -> commonField.setTaxResidency3(fieldValue); + case "1_14d_tax_num1" -> commonField.setTaxPin1(fieldValue); + case "1_14d_tax_num2" -> commonField.setTaxPin2(fieldValue); + case "1_14d_tax_num3" -> commonField.setTaxPin3(fieldValue); + case "ch1_14d_reason1_a" -> { + if("Off".equals(fieldValue)){ + commonField.setTaxReason1("A"); + } + } + case "ch1_14d_reason1_b" -> { + if("Off".equals(fieldValue)){ + commonField.setTaxReason1("B"); + } + } + case "ch1_14d_reason1_c" -> { + if("Off".equals(fieldValue)){ + commonField.setTaxReason1("C"); + } + } + case "ch1_14d_reason2_a" -> { + if("Off".equals(fieldValue)){ + commonField.setTaxReason2("A"); + } + } + case "ch1_14d_reason2_b" -> { + if("Off".equals(fieldValue)){ + commonField.setTaxReason2("B"); + } + } + case "ch1_14d_reason2_c" -> { + if("Off".equals(fieldValue)){ + commonField.setTaxReason2("C"); + } + } + case "ch1_14d_reason3_a" -> { + if("Off".equals(fieldValue)){ + commonField.setTaxReason3("A"); + } + } + case "ch1_14d_reason3_b" -> { + if("Off".equals(fieldValue)){ + commonField.setTaxReason3("B"); + } + } + case "ch1_14d_reason3_c" -> { + if("Off".equals(fieldValue)){ + commonField.setTaxReason3("C"); + } + } + case "1_14d_explain1" -> commonField.setTaxReasonB1(fieldValue); + case "1_14d_explain2" -> commonField.setTaxReasonB2(fieldValue); + case "1_14d_explain3" -> commonField.setTaxReasonB3(fieldValue); + /* Page3 End */ + /* Page6 Start */ + case "4_1_name1_1" -> commonField.setInsuranceCompany1_1(fieldValue); + case "4_1_name1_2" -> commonField.setInsuranceCompany1_2(fieldValue); + case "4_1_name1_3" -> commonField.setInsuranceCompany1_3(fieldValue); + case "4_1_name2_1" -> commonField.setInsuranceCompany2_1(fieldValue); + case "4_1_name2_2" -> commonField.setInsuranceCompany2_2(fieldValue); + case "4_1_name2_3" -> commonField.setInsuranceCompany2_3(fieldValue); + case "4_1_name3_1" -> commonField.setInsuranceCompany3_1(fieldValue); + case "4_1_name3_2" -> commonField.setInsuranceCompany3_2(fieldValue); + case "4_1_name3_3" -> commonField.setInsuranceCompany3_3(fieldValue); + case "4_1_year1" -> commonField.setInsuranceYear1(fieldValue); + case "4_1_year2" -> commonField.setInsuranceYear2(fieldValue); + case "4_1_year3" -> commonField.setInsuranceYear3(fieldValue); + + case "4_1_sum1" -> commonField.setInsuranceSumInsured1(fieldValue); + case "4_1_sum2" -> commonField.setInsuranceSumInsured2(fieldValue); + case "4_1_sum3" -> commonField.setInsuranceSumInsured3(fieldValue); + case "ch4_1_life" -> { + if(acroForm.getField("4_1_sum1").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum1").getValueAsString().isBlank()) + commonField.setInsuranceLife1("Yes"); + else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum1").getValueAsString().isBlank()) + commonField.setInsuranceLife1("Off"); + } + + } + case "ch4_1_accident" -> { + if(acroForm.getField("4_1_sum1").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum1").getValueAsString().isBlank()){ + commonField.setInsuranceOther1("Yes"); + commonField.setInsuranceOtherDesc1("Accident"); + }else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum1").getValueAsString().isBlank()){ + //commonField.setInsuranceOther1("Off"); + //commonField.setInsuranceOtherDesc1(""); + } + } + + } + case "ch4_1_critical" -> { + if(acroForm.getField("4_1_sum1").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum1").getValueAsString().isBlank()) + commonField.setInsuranceCritical1("Yes"); + else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum1").getValueAsString().isBlank()) + commonField.setInsuranceCritical1("Off"); + } + + } + case "ch4_1_hospital" -> { + if(acroForm.getField("4_1_sum1").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum1").getValueAsString().isBlank()){ + commonField.setInsuranceOther1("Yes"); + commonField.setInsuranceOtherDesc1("Hospital"); + }else if("On".equals(fieldValue)){ + //commonField.setInsuranceOther1("Off"); + //commonField.setInsuranceOtherDesc1(""); + } + } + + } + case "ch4_2_life" -> { + if(acroForm.getField("4_1_sum2").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum2").getValueAsString().isBlank()) + commonField.setInsuranceLife2("Yes"); + else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum2").getValueAsString().isBlank()) + commonField.setInsuranceLife2("Off"); + } + + } + case "ch4_2_accident" -> { + if(acroForm.getField("4_1_sum2").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum2").getValueAsString().isBlank()){ + commonField.setInsuranceOther2("Yes"); + commonField.setInsuranceOtherDesc2("Accident"); + }else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum2").getValueAsString().isBlank()){ + //commonField.setInsuranceOther1("Off"); + //commonField.setInsuranceOtherDesc1(""); + } + } + + } + case "ch4_2_critical" -> { + if(acroForm.getField("4_1_sum2").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum2").getValueAsString().isBlank()) + commonField.setInsuranceCritical2("Yes"); + else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum2").getValueAsString().isBlank()) + commonField.setInsuranceCritical2("Off"); + } + + } + case "ch4_2_hospital" -> { + if(acroForm.getField("4_1_sum2").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum2").getValueAsString().isBlank()){ + commonField.setInsuranceOther2("Yes"); + commonField.setInsuranceOtherDesc2("Hospital"); + }else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum2").getValueAsString().isBlank()){ + //commonField.setInsuranceOther1("Off"); + //commonField.setInsuranceOtherDesc1(""); + } + } + + } + case "ch4_3_life" -> { + if(acroForm.getField("4_1_sum3").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum3").getValueAsString().isBlank()) + commonField.setInsuranceLife3("Yes"); + else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum3").getValueAsString().isBlank()) + commonField.setInsuranceLife3("Off"); + } + + } + case "ch4_3_accident" -> { + if(acroForm.getField("4_1_sum3").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum3").getValueAsString().isBlank()){ + commonField.setInsuranceOther3("Yes"); + commonField.setInsuranceOtherDesc3("Accident"); + }else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum3").getValueAsString().isBlank()){ + //commonField.setInsuranceOther1("Off"); + //commonField.setInsuranceOtherDesc1(""); + } + } + + } + case "ch4_3_critical" -> { + if(acroForm.getField("4_1_sum3").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum3").getValueAsString().isBlank()) + commonField.setInsuranceCritical3("Yes"); + else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum3").getValueAsString().isBlank()) + commonField.setInsuranceCritical3("Off"); + } + + } + case "ch4_3_hospital" -> { + if(acroForm.getField("4_1_sum3").getValueAsString() != null ){ + if("Off".equals(fieldValue) && !acroForm.getField("4_1_sum3").getValueAsString().isBlank()){ + commonField.setInsuranceOther3("Yes"); + commonField.setInsuranceOtherDesc3("Hospital"); + }else if("On".equals(fieldValue) && !acroForm.getField("4_1_sum3").getValueAsString().isBlank()){ + //commonField.setInsuranceOther1("Off"); + //commonField.setInsuranceOtherDesc1(""); + } + } + + } + + + case "5_1a_city1" -> commonField.getOthers().put("travelCity1", fieldValue); + case "5_1a_city2" -> commonField.getOthers().put("travelCity2", fieldValue); + case "5_1a_city3" -> commonField.getOthers().put("travelCity3", fieldValue); + case "5_1a_purpose1" -> commonField.getOthers().put("travelPurpose1", fieldValue); + case "5_1a_purpose2" -> commonField.getOthers().put("travelPurpose2", fieldValue); + case "5_1a_purpose3" -> commonField.getOthers().put("travelPurpose3", fieldValue); + case "5_1a_frequency1" -> commonField.getOthers().put("travelFrequency1", fieldValue); + case "5_1a_frequency2" -> commonField.getOthers().put("travelFrequency2", fieldValue); + case "5_1a_frequency3" -> commonField.getOthers().put("travelFrequency3", fieldValue); + /* + setValueIfPresent(form, "5_1a_city1", commonField.getOthers().get("travelCity1")); + setValueIfPresent(form, "5_1a_city2", commonField.getOthers().get("travelCity2")); + setValueIfPresent(form, "5_1a_city3", commonField.getOthers().get("travelCity3")); + setValueIfPresent(form, "5_1a_purpose1", commonField.getOthers().get("travelPurpose1")); + setValueIfPresent(form, "5_1a_purpose2", commonField.getOthers().get("travelPurpose2")); + setValueIfPresent(form, "5_1a_purpose3", commonField.getOthers().get("travelPurpose3")); + setValueIfPresent(form, "5_1a_frequency1", commonField.getOthers().get("travelFrequency1")); + setValueIfPresent(form, "5_1a_frequency2", commonField.getOthers().get("travelFrequency2")); + setValueIfPresent(form, "5_1a_frequency3", commonField.getOthers().get("travelFrequency3")); + */ + case "5_1b_city1" -> commonField.getOthers().put("travelNextCity1", fieldValue); + case "5_1b_city2" -> commonField.getOthers().put("travelNextCity2", fieldValue); + case "5_1b_city3" -> commonField.getOthers().put("travelNextCity3", fieldValue); + case "5_1b_purpose1" -> commonField.getOthers().put("travelNextPurpose1", fieldValue); + case "5_1b_purpose2" -> commonField.getOthers().put("travelNextPurpose2", fieldValue); + case "5_1b_purpose3" -> commonField.getOthers().put("travelNextPurpose3", fieldValue); + case "5_1b_frequency1" -> commonField.getOthers().put("travelNextFrequency1", fieldValue); + case "5_1b_frequency2" -> commonField.getOthers().put("travelNextFrequency2", fieldValue); + case "5_1b_frequency3" -> commonField.getOthers().put("travelNextFrequency3", fieldValue); + + /* Page6 End */ + /* Page7 Start */ + case "ch5_1c_yes" -> commonField.getOthers().put("futureAddressYes", fieldValue); + case "ch5_1c_no" -> commonField.getOthers().put("futureAddressNo", fieldValue); + case "5_1c_address_1" -> commonField.getOthers().put("futureAddress1", fieldValue); + case "5_1c_address_2" -> commonField.getOthers().put("futureAddress2", fieldValue); + case "5_1c_reason" -> commonField.getOthers().put("futureAddressReason", fieldValue); + case "5_1c_how_long" -> commonField.getOthers().put("futureAddressHowLong", fieldValue); + //set it by this if both null futureAddressReason futureAddressHowLong; setValueIfPresent(form, "fill_2_4", commonField.getOthers().get("futureAddressReasonHowLong")); + + //set 5_1c_return if commonField.getOthers().put("futureAddressReturnYes" "futureAddressReturnNo" "futureAddressReturnNa" + // if commonField.getOthers().put("hazard", "Yes"); then set ch5_2_yes else no + + case "ch5_3_yes" -> commonField.setDeclinedYes(fieldValue); + case "ch5_3_no" -> commonField.setDeclinedNo(fieldValue); + case "ch5_6_yes" -> commonField.getOthers().put("pendingChargeYes", fieldValue); + case "ch5_6_no" -> commonField.getOthers().put("pendingChargeNo", fieldValue); + + + /* Page7 End */ + /* Page10 Start */ + + /* + * 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("relateSonRelation", "Daughter"); + commonField.getOthers().put("relateSonName", fieldValue); + } + case "fill_22_2" -> commonField.getOthers().put("relateSonAge", 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 "fill_32" -> commonField.getOthers().put("relateSisterAge", fieldValue); + */ + + //setValueIfPresent(form, "fill_1_8", commonField.getOthers().get("companyStartYear")); + //setValueIfPresent(form, "fill_2_7", commonField.getOthers().get("companyEndYear")); + + //case "toggle_6_4" -> commonField.getOthers().put("businessOwnerYes", fieldValue); + //case "fill_22_5" -> commonField.getOthers().put("businessOwnerPercent", fieldValue); + + //case "fill_25_3" -> commonField.getOthers().put("businessOwnerNoEmployee", fieldValue); + + + /* Page10 End */ + } + } + private void setValueIfPresent(PdfAcroForm form, String fieldName, String value) { PdfFormField field = form.getField(fieldName); if (field != null) { @@ -2040,5 +4010,59 @@ public class PdfService extends AbstractBaseEntityService= bValue) + return String.valueOf(aValue - bValue); + else + return ""; + } } \ No newline at end of file diff --git a/src/main/java/com/ffii/lioner/modules/lioner/template/service/TemplateService.java b/src/main/java/com/ffii/lioner/modules/lioner/template/service/TemplateService.java index e0ba797..f65c81a 100644 --- a/src/main/java/com/ffii/lioner/modules/lioner/template/service/TemplateService.java +++ b/src/main/java/com/ffii/lioner/modules/lioner/template/service/TemplateService.java @@ -1,41 +1,26 @@ package com.ffii.lioner.modules.lioner.template.service; -import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; - -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; -import com.ffii.lioner.modules.lioner.template.entity.Template; -import com.ffii.lioner.modules.lioner.template.entity.TemplateRepository; -import com.ffii.lioner.modules.lioner.commonField.entity.CommonField; -import com.ffii.lioner.modules.lioner.commonField.service.CommonFieldService; -import com.ffii.lioner.modules.lioner.entity.ImpEvent; -import com.ffii.lioner.modules.lioner.template.req.UpdateTemplateReq; -import com.ffii.lioner.modules.lioner.service.FileService; -import com.ffii.lioner.modules.common.SecurityUtils; -import com.ffii.lioner.modules.common.service.AuditLogService; -import com.ffii.lioner.modules.master.entity.SubDivision; import com.fasterxml.jackson.databind.ObjectMapper; import com.ffii.core.exception.NotFoundException; import com.ffii.core.exception.UnprocessableEntityException; import com.ffii.core.support.AbstractBaseEntityService; import com.ffii.core.support.JdbcDao; import com.ffii.core.utils.BeanUtils; -import com.ffii.core.utils.JsonUtils; -import com.ffii.core.utils.Params; +import com.ffii.lioner.modules.common.service.AuditLogService; +import com.ffii.lioner.modules.lioner.service.FileService; +import com.ffii.lioner.modules.lioner.template.entity.Template; +import com.ffii.lioner.modules.lioner.template.entity.TemplateRepository; +import com.ffii.lioner.modules.lioner.template.req.UpdateTemplateReq; @Service @@ -163,7 +148,7 @@ public class TemplateService extends AbstractBaseEntityService