|
|
@@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.malk.sdzl.entity.dto.OmFormContent;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
|
|
|
/**
|
|
|
* OM 表单字段映射。字段配置依据《OM表单字段唯一标识清单.xlsx》固化,
|
|
|
@@ -79,63 +81,36 @@ public final class OmFormContentMapper {
|
|
|
addForm("FORM-C73526894F3647F690DECD5F16EE67AF4FKX", "OM收款单", new String[][] {
|
|
|
{"section", "selectField_x1tbicc"},
|
|
|
{"accountingEntity", "selectField_tafovni"},
|
|
|
- {"customer", "associationFormField_mtv6c4pv"},
|
|
|
{"dateOfEntry", "dateField_mpcdx37x"},
|
|
|
{"collectionBank", "associationFormField_mtv6c4pt"},
|
|
|
{"collectionAmount", "numberField_mpceu15v"},
|
|
|
{"operator", "employeeField_mpcdx37w"},
|
|
|
{"incomeInformation", "tableField_mpcdx39v"},
|
|
|
- {"revenueCategory", "selectField_mtv6c4px"},
|
|
|
- {"subjectCode", "textField_mpcdx39x"},
|
|
|
- {"subAccountCodeVerification", "numberField_mq6eh339"},
|
|
|
- {"incomeSubject", "selectField_mtv6c4pz"},
|
|
|
- {"incomeCode", "textField_mpcdx39z"},
|
|
|
- {"project", "selectField_mtv6c4q1"},
|
|
|
- {"itemCode", "textField_mpcdx3a1"},
|
|
|
- {"costCenter", "selectField_mtv6c4q2"},
|
|
|
- {"costCenterCode", "textField_mpcdx3a3"},
|
|
|
- {"amountOfMoney", "numberField_mpcdx3a4"},
|
|
|
- {"incomeBillAmount", "numberField_mpceu15w"},
|
|
|
- {"explain", "textareaField_mpceu15x"},
|
|
|
-// {"选择合同", "associationFormField_mtv6c4q3"},
|
|
|
- {"cricContractNumber", "textField_mpceu160"},
|
|
|
{"remarks", "textareaField_mpceu16o"},
|
|
|
{"accountCodeVerification", "numberField_mq6eh337"},
|
|
|
- {"全称", "textField_mtv6c4pu"},
|
|
|
+ {"customer", "textField_mtv6c4pu"},
|
|
|
{"accountingSubjectCode", "textField_mq6erof9"},
|
|
|
{"eliminationMode", "textField_mpcdx37c"},
|
|
|
- {"accountingEntity", "textField_mpcdx370"},
|
|
|
- {"section", "textField_mpcdx36z"},
|
|
|
- {"transferInformation", "tableField_mpceu163"},
|
|
|
- {"transferCategory", "textField_mpceu164"},
|
|
|
- {"transferCategoryCode", "textField_mpceu165"},
|
|
|
- {"transferAssessment", "textField_mpceu166"},
|
|
|
- {"transferAssessmentCode", "textField_mpceu167"},
|
|
|
- {"transferProject", "textField_mpceu169"},
|
|
|
- {"transferProjectCode", "textField_mpceu168"},
|
|
|
- {"projectCostCenter", "textField_mpceu16a"},
|
|
|
- {"projectCostCenterCode", "textField_mpceu16b"},
|
|
|
- {"projectAmount", "numberField_mpceu16c"},
|
|
|
- {"projectBillAmount", "numberField_mpceu16d"},
|
|
|
- {"noteIncomeType", "selectField_mpxozyvs"},
|
|
|
- {"projectExplain", "textareaField_mpceu16e"},
|
|
|
- {"totalTransferNotes", "numberField_mpceu16f"},
|
|
|
- {"totalTransferCategories", "numberField_mpceu16h"},
|
|
|
- {"billsRegistrationForm", "textField_mpcdx38t"},
|
|
|
- {"billAmount", "numberField_mpceu16m"},
|
|
|
- {"billStatus", "textField_mpceu16n"},
|
|
|
- {"totalRevenueNotes", "numberField_mpcdx3aj"},
|
|
|
- {"totalRevenueCategory", "numberField_mpcdx3ak"},
|
|
|
- {"incomeAccounting", "employeeField_mpcdx3b2"},
|
|
|
- {"cashier", "employeeField_mpcdx3b3"},
|
|
|
- {"omReturnNewHouse", "textField_mq6e84og"},
|
|
|
- {"omDifferenceReasons", "textField_mpceu16p"},
|
|
|
- {"processEndDate", "dateField_mpceu16r"},
|
|
|
- {"accountant", "textareaField_mq6e84oi"},
|
|
|
- {"secondRentPerson", "textareaField_mq6e84ok"},
|
|
|
- {"marketingPartner", "textareaField_mq6e84on"},
|
|
|
- {"channelGroupSettlement", "textareaField_mq6e84om"},
|
|
|
+ {"accountingCode", "textField_mq6erof9"},
|
|
|
+ {"sectionCode", "textField_mv4tszev"},
|
|
|
});
|
|
|
+ addDetailFields("FORM-C73526894F3647F690DECD5F16EE67AF4FKX", "tableField_mpcdx39v",
|
|
|
+ new String[][] {
|
|
|
+ {"revenueCategory", "selectField_mtv6c4px"},
|
|
|
+ {"subjectCode", "textField_mpcdx39x"},
|
|
|
+ {"subAccountCodeVerification", "numberField_mq6eh339"},
|
|
|
+ {"incomeSubject", "selectField_mtv6c4pz"},
|
|
|
+ {"incomeCode", "textField_mpcdx39z"},
|
|
|
+ {"project", "selectField_mtv6c4q1"},
|
|
|
+ {"itemCode", "textField_mpcdx3a1"},
|
|
|
+ {"costCenter", "selectField_mtv6c4q2"},
|
|
|
+ {"costCenterCode", "textField_mpcdx3a3"},
|
|
|
+ {"amountOfMoney", "numberField_mpcdx3a4"},
|
|
|
+ {"incomeBillAmount", "numberField_mpceu15w"},
|
|
|
+ {"explain", "textareaField_mpceu15x"},
|
|
|
+// {"选择合同", "associationFormField_mtv6c4q3"},
|
|
|
+ {"cricContractNumber", "textField_mpceu160"},
|
|
|
+ });
|
|
|
addForm("FORM-A10F4E77BF0D4A1E9216626A4C57AFE6P7GP", "OM开票申请单", new String[][] {
|
|
|
{"开票申请流水号", "serialNumberField_mtv3my6j"},
|
|
|
{"operator", "employeeField_mpcdx37w"},
|
|
|
@@ -159,36 +134,36 @@ public final class OmFormContentMapper {
|
|
|
{"cricBillingContent", "selectField_mtcb9a4h"},
|
|
|
{"cric", "tableField_mpcdx394"},
|
|
|
// {"关联产品", "associationFormField_mtbeqiyj"},
|
|
|
- {"cricContractNo", "textField_mpcdx396"},
|
|
|
- {"cricProductName", "textField_mpcdx397"},
|
|
|
- {"cricSubprojectName", "textField_mpcdx398"},
|
|
|
- {"cricExecutionAmount", "numberField_mpcdx399"},
|
|
|
- {"CRIC开票金额", "numberField_mtbeqiyk"},
|
|
|
- {"CRIC业绩金额", "numberField_mtbeqiyl"},
|
|
|
- {"cricInvoicedAmount", "numberField_mpcdx39a"},
|
|
|
- {"cricUninvoicedAmount", "numberField_mpcdx39c"},
|
|
|
- {"amountReceivedByCric", "numberField_mpcdx39b"},
|
|
|
- {"cricThisInvoicingAmount", "numberField_mpcdx39d"},
|
|
|
+// {"cricContractNo", "textField_mpcdx396"},
|
|
|
+// {"cricProductName", "textField_mpcdx397"},
|
|
|
+// {"cricSubprojectName", "textField_mpcdx398"},
|
|
|
+// {"cricExecutionAmount", "numberField_mpcdx399"},
|
|
|
+// {"CRIC开票金额", "numberField_mtbeqiyk"},
|
|
|
+// {"CRIC业绩金额", "numberField_mtbeqiyl"},
|
|
|
+// {"cricInvoicedAmount", "numberField_mpcdx39a"},
|
|
|
+// {"cricUninvoicedAmount", "numberField_mpcdx39c"},
|
|
|
+// {"amountReceivedByCric", "numberField_mpcdx39b"},
|
|
|
+// {"cricThisInvoicingAmount", "numberField_mpcdx39d"},
|
|
|
{"totalAmountInvoicing", "numberField_mpcdx39e"},
|
|
|
{"billInformation", "tableField_mpcdx39v"},
|
|
|
- {"revenueCategory", "selectField_mtv8djh4"},
|
|
|
- {"revenueCategoryCode", "textField_mpcdx39x"},
|
|
|
- {"assessmentSubject", "selectField_g9kc21s"},
|
|
|
- {"billAssessmentSubjectCode", "textField_mpcdx39z"},
|
|
|
- {"costCenter", "selectField_j69kuio"},
|
|
|
- {"costCenterCode", "textField_mpcdx3a3"},
|
|
|
- {"project", "selectField_mrsytbp6"},
|
|
|
- {"itemCode", "textField_mpcdx3a1"},
|
|
|
- {"invoicingAmountIncludTax", "numberField_mpcdx3a4"},
|
|
|
- {"taxRate", "selectField_mtv8djh5"},
|
|
|
- {"amountexcludingTax", "numberField_mpcdx3a6"},
|
|
|
- {"taxAmount", "numberField_mpcdx3a7"},
|
|
|
- {"taxAdjustment", "numberField_mpcdx3a8"},
|
|
|
- {"internalSettlement", "selectField_mtv8djh7"},
|
|
|
- {"debitAccount", "textField_mpcdx3ab"},
|
|
|
- {"debitAccountCode", "textField_mpcdx3ac"},
|
|
|
- {"transferSubjects", "textField_mpcdx3ad"},
|
|
|
- {"transferAccountCode", "textField_mpcdx3ae"},
|
|
|
+// {"revenueCategory", "selectField_mtv8djh4"},
|
|
|
+// {"revenueCategoryCode", "textField_mpcdx39x"},
|
|
|
+// {"assessmentSubject", "selectField_g9kc21s"},
|
|
|
+// {"billAssessmentSubjectCode", "textField_mpcdx39z"},
|
|
|
+// {"costCenter", "selectField_j69kuio"},
|
|
|
+// {"costCenterCode", "textField_mpcdx3a3"},
|
|
|
+// {"project", "selectField_mrsytbp6"},
|
|
|
+// {"itemCode", "textField_mpcdx3a1"},
|
|
|
+// {"invoicingAmountIncludTax", "numberField_mpcdx3a4"},
|
|
|
+// {"taxRate", "selectField_mtv8djh5"},
|
|
|
+// {"amountexcludingTax", "numberField_mpcdx3a6"},
|
|
|
+// {"taxAmount", "numberField_mpcdx3a7"},
|
|
|
+// {"taxAdjustment", "numberField_mpcdx3a8"},
|
|
|
+// {"internalSettlement", "selectField_mtv8djh7"},
|
|
|
+// {"debitAccount", "textField_mpcdx3ab"},
|
|
|
+// {"debitAccountCode", "textField_mpcdx3ac"},
|
|
|
+// {"transferSubjects", "textField_mpcdx3ad"},
|
|
|
+// {"transferAccountCode", "textField_mpcdx3ae"},
|
|
|
{"totalAmountIncludTax", "numberField_mpcdx3aj"},
|
|
|
{"totalAmountExcludingTax", "numberField_mpcdx3ak"},
|
|
|
{"totalTaxAmount", "numberField_mpcdx3al"},
|
|
|
@@ -198,15 +173,49 @@ public final class OmFormContentMapper {
|
|
|
{"allpowerReceiveMailbox", "textField_mpcdx37t"},
|
|
|
{"remarks", "textareaField_mpcdx3ba"},
|
|
|
{"附件", "attachmentField_mtv8djha"},
|
|
|
- {"incomeAccounting", "employeeField_mpcdx3b2"},
|
|
|
- {"cashier", "employeeField_mpcdx3b3"},
|
|
|
- {"channelGroupSettlement", "employeeField_mpcdx3b5"},
|
|
|
- {"accountant", "employeeField_mpcdx3b7"},
|
|
|
- {"eInvoiceReceiptMobile", "textField_mpcdx3ar"},
|
|
|
- {"eInvoiceReceiptMailbox", "textField_mpcdx3at"},
|
|
|
- {"oaCoding", "textField_mpxp3omf"},
|
|
|
- {"taxType", "selectField_mtbeqiyg"},
|
|
|
+// {"incomeAccounting", "employeeField_mpcdx3b2"},
|
|
|
+// {"cashier", "employeeField_mpcdx3b3"},
|
|
|
+// {"channelGroupSettlement", "employeeField_mpcdx3b5"},
|
|
|
+// {"accountant", "employeeField_mpcdx3b7"},
|
|
|
+// {"eInvoiceReceiptMobile", "textField_mpcdx3ar"},
|
|
|
+// {"eInvoiceReceiptMailbox", "textField_mpcdx3at"},
|
|
|
+// {"oaCoding", "textField_mpxp3omf"},
|
|
|
+// {"taxType", "selectField_mtbeqiyg"},
|
|
|
});
|
|
|
+ addDetailFields("FORM-A10F4E77BF0D4A1E9216626A4C57AFE6P7GP", "tableField_mpcdx394",
|
|
|
+ new String[][] {
|
|
|
+ {"cricContractNo", "textField_mpcdx396"},
|
|
|
+ {"cricProductName", "textField_mpcdx397"},
|
|
|
+ {"cricSubprojectName", "textField_mpcdx398"},
|
|
|
+ {"cricExecutionAmount", "numberField_mpcdx399"},
|
|
|
+ {"CRIC开票金额", "numberField_mtbeqiyk"},
|
|
|
+ {"CRIC业绩金额", "numberField_mtbeqiyl"},
|
|
|
+ {"cricInvoicedAmount", "numberField_mpcdx39a"},
|
|
|
+ {"cricUninvoicedAmount", "numberField_mpcdx39c"},
|
|
|
+ {"amountReceivedByCric", "numberField_mpcdx39b"},
|
|
|
+ {"cricThisInvoicingAmount", "numberField_mpcdx39d"},
|
|
|
+ });
|
|
|
+ addDetailFields("FORM-A10F4E77BF0D4A1E9216626A4C57AFE6P7GP", "tableField_mpcdx39v",
|
|
|
+ new String[][] {
|
|
|
+ {"revenueCategory", "selectField_mtv8djh4"},
|
|
|
+ {"revenueCategoryCode", "textField_mpcdx39x"},
|
|
|
+ {"assessmentSubject", "selectField_g9kc21s"},
|
|
|
+ {"billAssessmentSubjectCode", "textField_mpcdx39z"},
|
|
|
+ {"costCenter", "selectField_j69kuio"},
|
|
|
+ {"costCenterCode", "textField_mpcdx3a3"},
|
|
|
+ {"project", "selectField_mrsytbp6"},
|
|
|
+ {"itemCode", "textField_mpcdx3a1"},
|
|
|
+ {"invoicingAmountIncludTax", "numberField_mpcdx3a4"},
|
|
|
+ {"taxRate", "selectField_mtv8djh5"},
|
|
|
+ {"amountexcludingTax", "numberField_mpcdx3a6"},
|
|
|
+ {"taxAmount", "numberField_mpcdx3a7"},
|
|
|
+ {"taxAdjustment", "numberField_mpcdx3a8"},
|
|
|
+ {"internalSettlement", "selectField_mtv8djh7"},
|
|
|
+ {"debitAccount", "textField_mpcdx3ab"},
|
|
|
+ {"debitAccountCode", "textField_mpcdx3ac"},
|
|
|
+ {"transferSubjects", "textField_mpcdx3ad"},
|
|
|
+ {"transferAccountCode", "textField_mpcdx3ae"},
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
private OmFormContentMapper() {
|
|
|
@@ -233,7 +242,14 @@ public final class OmFormContentMapper {
|
|
|
content.setFormUuid(formUuid.trim());
|
|
|
content.setFormName(definition.formName);
|
|
|
for (FieldDefinition field : definition.fields) {
|
|
|
- content.putField(field.fieldName, field.fieldId, findValue(formData, field.fieldId));
|
|
|
+ if (definition.detailFieldIds.contains(field.fieldId)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<FieldDefinition> detailFields = definition.detailFields.get(field.fieldId);
|
|
|
+ Object value = detailFields == null
|
|
|
+ ? findValue(formData, field.fieldId)
|
|
|
+ : mapDetailRows(findRawValue(formData, field.fieldId), detailFields);
|
|
|
+ content.putField(field.fieldName, field.fieldId, value);
|
|
|
}
|
|
|
return content;
|
|
|
}
|
|
|
@@ -255,6 +271,38 @@ public final class OmFormContentMapper {
|
|
|
FORM_DEFINITIONS.put(formUuid, definition);
|
|
|
}
|
|
|
|
|
|
+ private static void addDetailFields(String formUuid, String tableFieldId, String[][] fields) {
|
|
|
+ FormDefinition definition = FORM_DEFINITIONS.get(formUuid);
|
|
|
+ if (definition == null) {
|
|
|
+ throw new IllegalArgumentException("未找到 OM 表单定义:" + formUuid);
|
|
|
+ }
|
|
|
+ List<FieldDefinition> detailFields = new ArrayList<>();
|
|
|
+ for (String[] field : fields) {
|
|
|
+ FieldDefinition detailField = new FieldDefinition(field[0], field[1]);
|
|
|
+ detailFields.add(detailField);
|
|
|
+ definition.detailFieldIds.add(detailField.fieldId);
|
|
|
+ }
|
|
|
+ definition.detailFields.put(tableFieldId, detailFields);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static List<Object> mapDetailRows(Object source, List<FieldDefinition> fields) {
|
|
|
+ List<Object> details = new ArrayList<>();
|
|
|
+ if (!(source instanceof Iterable)) {
|
|
|
+ return details;
|
|
|
+ }
|
|
|
+ for (Object sourceRow : (Iterable) source) {
|
|
|
+ if (!(sourceRow instanceof Map)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Map<String, Object> detail = new LinkedHashMap<>();
|
|
|
+ for (FieldDefinition field : fields) {
|
|
|
+ detail.put(field.fieldName, findValue(sourceRow, field.fieldId));
|
|
|
+ }
|
|
|
+ details.add(detail);
|
|
|
+ }
|
|
|
+ return details;
|
|
|
+ }
|
|
|
+
|
|
|
private static Object findValue(Object source, String fieldId) {
|
|
|
if (source instanceof Map) {
|
|
|
Map map = (Map) source;
|
|
|
@@ -283,9 +331,34 @@ public final class OmFormContentMapper {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ private static Object findRawValue(Object source, String fieldId) {
|
|
|
+ if (source instanceof Map) {
|
|
|
+ Map map = (Map) source;
|
|
|
+ if (map.containsKey(fieldId)) {
|
|
|
+ return map.get(fieldId);
|
|
|
+ }
|
|
|
+ for (Object value : map.values()) {
|
|
|
+ Object found = findRawValue(value, fieldId);
|
|
|
+ if (found != null) {
|
|
|
+ return found;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (source instanceof Iterable) {
|
|
|
+ for (Object value : (Iterable) source) {
|
|
|
+ Object found = findRawValue(value, fieldId);
|
|
|
+ if (found != null) {
|
|
|
+ return found;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
private static class FormDefinition {
|
|
|
private final String formName;
|
|
|
private final List<FieldDefinition> fields = new ArrayList<>();
|
|
|
+ private final Map<String, List<FieldDefinition>> detailFields = new LinkedHashMap<>();
|
|
|
+ private final Set<String> detailFieldIds = new HashSet<>();
|
|
|
|
|
|
private FormDefinition(String formName) {
|
|
|
this.formName = formName;
|