11package cn .cordys .crm .contract .service ;
22
3+ import cn .cordys .common .constants .BusinessModuleField ;
34import cn .cordys .common .constants .FormKey ;
45import cn .cordys .common .dto .ExportDTO ;
56import cn .cordys .common .dto .ExportHeadDTO ;
910import cn .cordys .crm .contract .dto .request .ContractInvoicePageRequest ;
1011import cn .cordys .crm .contract .dto .response .ContractInvoiceListResponse ;
1112import cn .cordys .crm .contract .mapper .ExtContractInvoiceMapper ;
13+ import cn .cordys .crm .system .dto .field .SelectField ;
1214import cn .cordys .crm .system .dto .field .base .BaseField ;
1315import cn .cordys .registry .ExportThreadRegistry ;
1416import com .github .pagehelper .PageHelper ;
1517import jakarta .annotation .Resource ;
1618import lombok .extern .slf4j .Slf4j ;
19+ import org .apache .commons .lang3 .Strings ;
1720import org .springframework .stereotype .Service ;
1821import org .springframework .transaction .annotation .Transactional ;
1922
@@ -61,16 +64,17 @@ public List<List<Object>> getExportData(String taskId, ExportDTO exportDTO) thro
6164 return data ;
6265 }
6366
64- private List <Object > buildData (List <ExportHeadDTO > headList , ContractInvoiceListResponse data , Map <String , BaseField > fieldConfigMap ) {
67+ private List <Object > buildData (List <ExportHeadDTO > headList , ContractInvoiceListResponse data ,
68+ Map <String , BaseField > fieldConfigMap ) {
6569 //固定字段map
66- LinkedHashMap <String , Object > systemFiledMap = getSystemFieldMap (data );
70+ LinkedHashMap <String , Object > systemFiledMap = getSystemFieldMap (data , fieldConfigMap );
6771 //自定义字段map
6872 Map <String , Object > moduleFieldMap = getFieldIdValueMap (data .getModuleFields ());
6973 //处理数据转换
7074 return transModuleFieldValue (headList , systemFiledMap , moduleFieldMap , new ArrayList <>(), fieldConfigMap );
7175 }
7276
73- public LinkedHashMap <String , Object > getSystemFieldMap (ContractInvoiceListResponse data ) {
77+ public LinkedHashMap <String , Object > getSystemFieldMap (ContractInvoiceListResponse data , Map < String , BaseField > fieldConfigMap ) {
7478 LinkedHashMap <String , Object > systemFiledMap = new LinkedHashMap <>();
7579 systemFiledMap .put ("contractId" , data .getContractName ());
7680 systemFiledMap .put ("owner" , data .getOwnerName ());
@@ -81,6 +85,14 @@ public LinkedHashMap<String, Object> getSystemFieldMap(ContractInvoiceListRespon
8185 systemFiledMap .put ("businessTitleId" , data .getBusinessTitleId ());
8286 systemFiledMap .put ("approvalStatus" , data .getApprovalStatus () == null ? null : Translator .get ("contract.approval_status." + data .getApprovalStatus ().toLowerCase ()));
8387
88+ for (BaseField field : fieldConfigMap .values ()) {
89+ if (Strings .CS .equals (BusinessModuleField .INVOICE_INVOICE_TYPE .getBusinessKey (), field .getBusinessKey ())
90+ && field instanceof SelectField invoiceTypeField ) {
91+ String invoiceTypeName = getOptionLabel (data .getInvoiceType (), invoiceTypeField .getOptions ());
92+ systemFiledMap .put ("invoiceType" , invoiceTypeName );
93+ }
94+ }
95+
8496 systemFiledMap .put ("createUser" , data .getCreateUserName ());
8597 systemFiledMap .put ("createTime" , TimeUtils .getDateTimeStr (data .getCreateTime ()));
8698 systemFiledMap .put ("updateUser" , data .getUpdateUserName ());
0 commit comments