|
|
|
@@ -21,6 +21,7 @@ import org.apache.pdfbox.pdmodel.PDDocument; |
|
|
|
import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm; |
|
|
|
import org.apache.pdfbox.pdmodel.interactive.form.PDButton; |
|
|
|
import org.apache.pdfbox.pdmodel.interactive.form.PDField; |
|
|
|
import org.checkerframework.checker.units.qual.s; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
@@ -391,7 +392,7 @@ public class PdfService extends AbstractBaseEntityService<Pdf, Long, PdfReposito |
|
|
|
} else if("SLAPP".equals(formCode)){ |
|
|
|
SLAPP_checkBox(form2, commonField); |
|
|
|
} else if("HSBCA31".equals(formCode)){ |
|
|
|
HSBCA31_checkBox(form2, commonField); |
|
|
|
HSBCA31_checkBox(form2, commonField, client); |
|
|
|
} else if ("SLGII".equals(formCode)) { |
|
|
|
SLGII_checkBox(form2, commonField); |
|
|
|
} |
|
|
|
@@ -1182,6 +1183,15 @@ public class PdfService extends AbstractBaseEntityService<Pdf, Long, PdfReposito |
|
|
|
setValueIfPresent(form, "email", commonField.getEmail()); |
|
|
|
setValueIfPresent(form, "occupation", commonField.getOccupationTitle()); |
|
|
|
*/ |
|
|
|
if(client != null && client.getConsultantId() != null){ |
|
|
|
Consultant consultant = consultantService.find(Long.valueOf(client.getConsultantId())).orElseThrow(); |
|
|
|
|
|
|
|
if(consultant.getName() != null){ |
|
|
|
setValueIfPresent(form, "s Names", consultant.getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
setValueIfPresent(form, "Policy No", commonField.getOthers().get("SLAppPolicyNo")); |
|
|
|
setValueIfPresent(form, "age", commonField.getOthers().get("SLAppAge")); |
|
|
|
|
|
|
|
setValueIfPresent(form, "name", StringUtils.trimToEmpty(StringUtils.trimToEmpty(client.getLastname()) + " " + StringUtils.trimToEmpty(client.getFirstname()))); |
|
|
|
setValueIfPresent(form, "date_of_birth", commonField.getDateOfBirth()); |
|
|
|
@@ -1341,6 +1351,13 @@ public class PdfService extends AbstractBaseEntityService<Pdf, Long, PdfReposito |
|
|
|
|
|
|
|
private void SLAPP_textBox(PdfAcroForm form, CommonField commonField, Client client){ |
|
|
|
/* Page1 Start */ |
|
|
|
if(client != null && client.getConsultantId() != null){ |
|
|
|
Consultant consultant = consultantService.find(Long.valueOf(client.getConsultantId())).orElseThrow(); |
|
|
|
|
|
|
|
if(consultant.getName() != null){ |
|
|
|
setValueIfPresent(form, "inter1", consultant.getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
setValueIfPresent(form, "1_1_surname", client.getLastname()); |
|
|
|
setValueIfPresent(form, "1_1_given_name", client.getFirstname()); |
|
|
|
@@ -1705,6 +1722,10 @@ public class PdfService extends AbstractBaseEntityService<Pdf, Long, PdfReposito |
|
|
|
setValueIfPresent(form, "Text173_1", StringUtils.trimToNull(StringUtils.trimToEmpty(StringUtils.trimToEmpty(commonField.getOthers().get("empNatureA")) + " " + StringUtils.trimToEmpty(commonField.getOthers().get("empNatureB"))))); |
|
|
|
setValueIfPresent(form, "fill_16_2", commonField.getOthers().get("empPosition")); |
|
|
|
setValueIfPresent(form, "fill_17_1", commonField.getOthers().get("empCompanyAddress")); |
|
|
|
|
|
|
|
setValueIfPresent(form, "fill_17_3", StringUtils.trimToEmpty(StringUtils.trimToEmpty(commonField.getTaxPin1()) + StringUtils.trimToEmpty(commonField.getTaxPin2()) + StringUtils.trimToEmpty(commonField.getTaxPin3()))); |
|
|
|
setValueIfPresent(form, "fill_0004", StringUtils.trimToEmpty(StringUtils.trimToEmpty(commonField.getTaxResidency1()) + StringUtils.trimToEmpty(commonField.getTaxResidency2()) + StringUtils.trimToEmpty(commonField.getTaxResidency3()))); |
|
|
|
|
|
|
|
/* Page2 End */ |
|
|
|
/* Page3 Start */ |
|
|
|
//setValueIfPresent(form, "undefined_51", commonField.getContactNo()); |
|
|
|
@@ -1777,6 +1798,8 @@ public class PdfService extends AbstractBaseEntityService<Pdf, Long, PdfReposito |
|
|
|
|
|
|
|
setValueIfPresent(form, "fill_4114", formatNum(client.getCashDepositsCurrent())); |
|
|
|
setValueIfPresent(form, "fill_4215", formatNum(client.getCashDepositsLast())); |
|
|
|
setValueIfPresent(form, "fill_4916", formatNum(client.getRealEstateCurrent())); |
|
|
|
setValueIfPresent(form, "fill_5017", formatNum(client.getRealEstateLast())); |
|
|
|
setValueIfPresent(form, "fill_5318", formatNum(client.getPersonalPropertiesCurrent())); |
|
|
|
setValueIfPresent(form, "fill_5419", formatNum(client.getPersonalPropertiesLast())); |
|
|
|
setValueIfPresent(form, "fill_5720", formatNum(client.getInvestmentsCurrent())); |
|
|
|
@@ -1831,11 +1854,27 @@ public class PdfService extends AbstractBaseEntityService<Pdf, Long, PdfReposito |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void HSBCA31_checkBox(PDAcroForm form2, CommonField commonField){ |
|
|
|
private void HSBCA31_checkBox(PDAcroForm form2, CommonField commonField, Client client){ |
|
|
|
/* Page1 Start */ |
|
|
|
setValueIfPresent(form2, "Checkk Box6", commonField.getGenderMale()); |
|
|
|
setValueIfPresent(form2, "Check kBox7", commonField.getGenderFemale()); |
|
|
|
|
|
|
|
if(!"".equals(client.getCrAddressPostalCode())){ |
|
|
|
setValueIfPresent(form2, "Check Box10", "Yes"); |
|
|
|
} |
|
|
|
|
|
|
|
if(!"".equals(StringUtils.trimToEmpty(client.getPhone1Code()))){ |
|
|
|
if("852".equals(client.getPhone1Code()) || "+852".equals(client.getPhone1Code())){ |
|
|
|
setValueIfPresent(form2, "Check Box12_2", "Yes"); |
|
|
|
}else if("1".equals(client.getPhone1Code()) || "+1".equals(client.getPhone1Code())){ |
|
|
|
setValueIfPresent(form2, "Check Box13_2", "Yes"); |
|
|
|
}else if("86".equals(client.getPhone1Code()) || "+86".equals(client.getPhone1Code())){ |
|
|
|
setValueIfPresent(form2, "Check Box14_2", "Yes"); |
|
|
|
}else{ |
|
|
|
setValueIfPresent(form2, "Check Box15_2", "Yes"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
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()) |
|
|
|
@@ -1900,6 +1939,12 @@ public class PdfService extends AbstractBaseEntityService<Pdf, Long, PdfReposito |
|
|
|
setValueIfPresent(form2, "Check Box74", commonField.getOthers().get("formMedical")); |
|
|
|
setValueIfPresent(form2, "Check Box75", commonField.getOthers().get("formNonMedical")); |
|
|
|
/* Page7 End */ |
|
|
|
/* Page8 Start */ |
|
|
|
if("Yes".equals(commonField.getFna_c3a_single_pay())){ |
|
|
|
setValueIfPresent(form2, "Check Box1a01", "Yes"); |
|
|
|
} |
|
|
|
|
|
|
|
/* Page8 End */ |
|
|
|
/* Page9 Start */ |
|
|
|
setValueIfPresent(form2, "Check Box72_1a", commonField.getOthers().get("appyOtherInsuranceYes")); |
|
|
|
setValueIfPresent(form2, "Check Box73_1", commonField.getOthers().get("appyOtherInsuranceNo")); |
|
|
|
@@ -2363,8 +2408,10 @@ public class PdfService extends AbstractBaseEntityService<Pdf, Long, PdfReposito |
|
|
|
|
|
|
|
setValueIfPresent(form, "7_2c_cash", formatNum(client.getCashDepositsCurrent())); |
|
|
|
setValueIfPresent(form, "7_2c_cash_24", formatNum(client.getCashDepositsLast())); |
|
|
|
setValueIfPresent(form, "7_2c_real", formatNum(client.getPersonalPropertiesCurrent())); |
|
|
|
setValueIfPresent(form, "7_2c_real_24", formatNum(client.getPersonalPropertiesLast())); |
|
|
|
setValueIfPresent(form, "7_2c_high", formatNum(client.getPersonalPropertiesCurrent())); |
|
|
|
setValueIfPresent(form, "7_2c_high_24", formatNum(client.getPersonalPropertiesLast())); |
|
|
|
setValueIfPresent(form, "7_2c_real", formatNum(client.getRealEstateCurrent())); |
|
|
|
setValueIfPresent(form, "7_2c_real_24", formatNum(client.getRealEstateLast())); |
|
|
|
setValueIfPresent(form, "7_2c_stocks", formatNum(client.getInvestmentsCurrent())); |
|
|
|
setValueIfPresent(form, "7_2c_stocks_24", formatNum(client.getInvestmentsLast())); |
|
|
|
setValueIfPresent(form, "7_2c_business", formatNum(client.getNetBusinessInterestCurrent())); |
|
|
|
@@ -3631,6 +3678,9 @@ public class PdfService extends AbstractBaseEntityService<Pdf, Long, PdfReposito |
|
|
|
private void SLAPP(String fieldName, String fieldValue, CommonField commonField,PDAcroForm acroForm){ |
|
|
|
switch (fieldName) { |
|
|
|
/* Page1 Start */ |
|
|
|
case "policyNo" -> commonField.getOthers().put("SLAppPolicyNo", "611" + fieldValue); |
|
|
|
case "1_6_last" -> commonField.getOthers().put("SLAppAge", fieldValue); |
|
|
|
|
|
|
|
case "1_2_name_ch" -> commonField.setNameChi(fieldValue); |
|
|
|
|
|
|
|
case "ch1_4_m" -> commonField.setGenderMale(fieldValue); |
|
|
|
@@ -4579,6 +4629,8 @@ public class PdfService extends AbstractBaseEntityService<Pdf, Long, PdfReposito |
|
|
|
+ " ff.remarks, " |
|
|
|
+ " f.filename, " |
|
|
|
+ " c.clientCode, " |
|
|
|
+ " c.lastname, " |
|
|
|
+ " c.firstname, " |
|
|
|
+ " t.name as templateName, " |
|
|
|
+ " t.remarks AS formCode, " |
|
|
|
+ " fb.bytes AS blobValue " |
|
|
|
@@ -4621,6 +4673,9 @@ public class PdfService extends AbstractBaseEntityService<Pdf, Long, PdfReposito |
|
|
|
if(!"".equals(StringUtils.trimToEmpty(client.getCrAddressCity()))){ |
|
|
|
value += StringUtils.trimToEmpty(client.getCrAddressCity()) + " "; |
|
|
|
} |
|
|
|
if(!"".equals(StringUtils.trimToEmpty(client.getCrAddressPostalCode()))){ |
|
|
|
value += StringUtils.trimToEmpty(client.getCrAddressPostalCode()) + " "; |
|
|
|
} |
|
|
|
if(!"".equals(StringUtils.trimToEmpty(client.getCrAddressCountry()))){ |
|
|
|
value += StringUtils.trimToEmpty(client.getCrAddressCountry()) + " "; |
|
|
|
} |
|
|
|
@@ -4655,6 +4710,9 @@ public class PdfService extends AbstractBaseEntityService<Pdf, Long, PdfReposito |
|
|
|
if(!"".equals(StringUtils.trimToEmpty(client.getCorAddressCity()))){ |
|
|
|
value += StringUtils.trimToEmpty(client.getCorAddressCity()) + " "; |
|
|
|
} |
|
|
|
if(!"".equals(StringUtils.trimToEmpty(client.getCorAddressPostalCode()))){ |
|
|
|
value += StringUtils.trimToEmpty(client.getCorAddressPostalCode()) + " "; |
|
|
|
} |
|
|
|
if(!"".equals(StringUtils.trimToEmpty(client.getCorAddressCountry()))){ |
|
|
|
value += StringUtils.trimToEmpty(client.getCorAddressCountry()) + " "; |
|
|
|
} |
|
|
|
|