Bladeren bron

会计发票导入调整

sangwenwei 1 maand geleden
bovenliggende
commit
77f986b663

+ 2 - 0
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/mapper/xml/CwFinanceInvoiceMapper.xml

@@ -669,6 +669,7 @@
         `type`,
         billing_type,
         billing_workplace_real,
+        billing_workplace_real_id,
         taxpayer_identification_no,
         address,
         tel_phone,
@@ -702,6 +703,7 @@
             #{item.type},
             #{item.billingType},
             #{item.billingWorkplaceReal},
+            #{item.billingWorkplaceRealId},
             #{item.taxpayerIdentificationNo},
             #{item.address},
             #{item.telPhone},

+ 35 - 6
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/service/CwFinanceInvoiceService.java

@@ -1463,23 +1463,51 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
                 if ("企业开票".equals(cwFinanceImportDTO.getBillingType())){
                     for (CwWorkClientBaseDTO cwWorkClientBaseDTO : cwWorkClientBaseDTOList) {
                         if (cwWorkClientBaseDTO.getName().equals(cwFinanceImportDTO.getBillingWorkplaceReal())){
-                            cwFinanceInvoice.setBillingWorkplaceRealId(cwWorkClientBaseDTO.getClientId());
+                            cwFinanceInvoice.setBillingWorkplaceRealId(cwWorkClientBaseDTO.getId());
                             cwFinanceInvoice.setBillingWorkplaceReal(cwWorkClientBaseDTO.getName());
-                            cwFinanceInvoice.setTaxpayerIdentificationNo(cwWorkClientBaseDTO.getUscCode());
-                            cwFinanceInvoice.setAddress(cwWorkClientBaseDTO.getAddress());
-                            cwFinanceInvoice.setTelPhone(cwWorkClientBaseDTO.getMobile());
+                            if (StringUtils.isNotBlank(cwFinanceImportDTO.getTaxpayerIdentificationNo())){
+                                cwFinanceInvoice.setTaxpayerIdentificationNo(cwFinanceImportDTO.getTaxpayerIdentificationNo());
+                            }else {
+                                cwFinanceInvoice.setTaxpayerIdentificationNo(cwWorkClientBaseDTO.getUscCode());
+                            }
+                            if (StringUtils.isNotBlank(cwFinanceImportDTO.getAddress())){
+                                cwFinanceInvoice.setAddress(cwFinanceImportDTO.getAddress());
+                            }else {
+                                cwFinanceInvoice.setAddress(cwWorkClientBaseDTO.getAddress());
+                            }
+                            if (StringUtils.isNotBlank(cwFinanceImportDTO.getTelPhone())){
+                                cwFinanceInvoice.setTelPhone(cwFinanceImportDTO.getTelPhone());
+                            }else {
+                                cwFinanceInvoice.setTelPhone(cwWorkClientBaseDTO.getMobile());
+                            }
+
+                            List<CwWorkClientBillingDTO> billing = cwWorkClientBaseMapper.getBilling(cwWorkClientBaseDTO.getId());
 
                             if (StringUtils.isNotBlank(cwFinanceImportDTO.getOpenBank())){
-                                List<CwWorkClientBillingDTO> billing = cwWorkClientBaseMapper.getBilling(cwWorkClientBaseDTO.getClientId());
                                 if (CollectionUtils.isNotEmpty(billing)){
                                     for (CwWorkClientBillingDTO cwWorkClientBillingDTO : billing) {
                                         if (cwWorkClientBillingDTO.getAccountHolder().equals(cwFinanceImportDTO.getOpenBank())){
                                             cwFinanceInvoice.setOpenBank(cwWorkClientBillingDTO.getAccountHolder());
-                                            cwFinanceInvoice.setBankAccount(cwWorkClientBillingDTO.getAccount());
+                                            if (StringUtils.isNotBlank(cwFinanceImportDTO.getBankAccount())){
+                                                cwFinanceInvoice.setBankAccount(cwFinanceImportDTO.getBankAccount());
+                                            }else {
+                                                cwFinanceInvoice.setBankAccount(cwWorkClientBillingDTO.getAccount());
+                                            }
+                                            if (StringUtils.isBlank(cwFinanceInvoice.getTelPhone())){
+                                                cwFinanceInvoice.setTelPhone(cwWorkClientBillingDTO.getPhone());
+                                            }
+
                                             break;
                                         }
                                     }
                                 }
+                            }else {
+                                if (CollectionUtils.isNotEmpty(billing)){
+                                    cwFinanceInvoice.setOpenBank(billing.get(0).getAccountHolder());
+                                    cwFinanceInvoice.setBankAccount(billing.get(0).getAccount());
+                                    cwFinanceInvoice.setTelPhone(billing.get(0).getPhone());
+                                }
+
                             }
 
                             break;
@@ -1575,6 +1603,7 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
                 cwFinanceInvoice.setDelFlag(0);
                 cwFinanceInvoice.setInvalidStatus("0");
                 cwFinanceInvoice.setReceivablesStatus("0");
+                cwFinanceInvoice.setRedInvoiceFlag(0);
                 invoiceArrayList.add(cwFinanceInvoice);
 
                 cwFinanceInvoiceBase.setCreateById(userDTO.getId());