Selaa lähdekoodia

Merge branch 'contract' into dev1.0

liutao 5 kuukautta sitten
vanhempi
commit
798fcff7a8

+ 53 - 4
src/main/java/com/sunxung/factoring/service/financing/contract/impl/NewContractMakingServiceImpl.java

@@ -272,6 +272,23 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
                     }
                     map.put("financingAmountCname", amountCname);
                     map.put("financingAmount", financingAmount);
+                    // 融资信息
+//            ContractFinancingInfo contractFinancingInfo = contractMakingMapper
+//                    .getFinancingByContractMakingId(making.getId());
+                    ProjectInformationVo projectInformationVo = projectInformationService.getByBusinessNo(contractInfo.getBusinessNo());
+                    // 授信决议
+                    CreditResolution creditResolution = creditResolutionService.getByProjectInformationId(projectInformationVo.getProjectInformationId());
+                    // 授信金额
+                    BigDecimal creditLine = BigDecimal.ZERO;
+                    if (null != creditResolution) {
+                        creditLine = creditResolution.getProposedCreditLine();
+                    }
+                    if (creditLine != null) {
+                        amountCname = MoneyToCNFormatUtil
+                                .formatToCN(creditLine.doubleValue());
+                    }
+                    map.put("creditAmountCname", amountCname);
+                    map.put("creditAmount", creditLine);
                     Date date = new Date();
                     map.put("year", DateUtil.getYear(date));
                     map.put("month", DateUtil.getMonth(date));
@@ -716,12 +733,16 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
             String factoringLegalPersion = masterContract.getFactoringLegalPerson();
             //保理商注册地址
             String factoringAddress = masterContract.getFactoringAddress();
+            //保理商联系人邮箱
+            String factoringEmail = masterContract.getFactoringAgentEmail();
             // 保理合同编号
             String factoringContractNo = masterContract.getContractNo();
             // 合同名称
             String contractName = masterContract.getContractName();
             // 设置债务人
             String debtorCompanyName = "";
+            //债务人信息
+            ReviewMasterContractDebtor contractDebtor = null;
             List<ReviewMasterContractDebtor> debtorList = reviewMasterContractDebtorService.lambdaQuery().eq(ReviewMasterContractDebtor::getReviewMasterContractId, masterContract.getId()).list();
 
             if (null != debtorList && debtorList.size() > 0) {
@@ -731,6 +752,9 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
                 if (StringUtil.isNotEmpty(debtorCompanyName) && debtorCompanyName.contains("、")) {
                     debtorCompanyName = debtorCompanyName.substring(0, debtorCompanyName.toString().length() - 1);
                 }
+
+                //债务人信息
+                contractDebtor = debtorList.get(0);
             }
             // 融资金额
             BigDecimal financingAmount = BigDecimal.ZERO;
@@ -814,10 +838,14 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
                     map.put("factoringLegalPersion", factoringLegalPersion);
                     map.put("factoringAddress", ConstantUtil.OUR_COMPANY_ADDRESS_NAME);
                     map.put("factoringContractNo", factoringContractNo);
+                    map.put("factoringEmail", factoringEmail);
                     map.put("contractName", contractName);
                     map.put("legalRepresentative", legalRepresentative);
                     map.put("currency_cn", currency_cn);
                     map.put("currency_en", currency_en);
+                    if (contractDebtor != null) {
+                        map.put("contactEmail", contractDebtor.getEmail());
+                    }
                     Date date = new Date();
                     map.put("year", DateUtil.getYear(date));
                     map.put("month", DateUtil.getMonth(date));
@@ -1202,6 +1230,8 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
             String actualAddress = rltRepay.getActualAddress();
             //责任人联系方式
             String contactNumber = rltRepay.getResponsiblePhone();
+            //责任人联系邮箱
+            String responsibleEmail = rltRepay.getResponsibleEmail();
             //责任人法定代表人
             String legalRepresentative = rltRepay.getLegalRepresentative();
             //责任人邮箱
@@ -1221,6 +1251,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
                     map.put("certificateNo", certificateNo);
                     map.put("address", address);
                     map.put("actualAddress", actualAddress);
+                    map.put("responsibleEmail", responsibleEmail);
                     map.put("contactNumber", contactNumber);
                     Date date = new Date();
                     map.put("day", DateUtil.getDay(date));
@@ -1256,6 +1287,8 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
                     map.put("certificateNo", certificateNo);
                     map.put("address", address);
                     map.put("actualAddress", actualAddress);
+                    map.put("contactNumber", contactNumber);
+                    map.put("responsibleEmail", responsibleEmail);
                     Date date = new Date();
                     map.put("day", DateUtil.getDay(date));
                     map.put("month", DateUtil.getMonth(date));
@@ -1757,6 +1790,8 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
                 BigDecimal manageFeeAmount = null;
                 // 管理费金额大写
                 String manageFeeAmountName = null;
+                // 管理费率
+                String manageFeeRate = null;
                 //管理费支付方式
                 String manageFeeCollectionMethod = null;
                 // 其他费用
@@ -1885,6 +1920,8 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
                     marginReturnCondition = contractFinancingInfo.getMarginReturnCondition();
                     // 管理费金额
                     manageFeeAmount = financingInfo.getManagementFeeAmount();
+                    // 管理费率
+                    manageFeeRate = StringUtil.subZeroAndDot(PercentageUtil.convertPercentage(financingInfo.getManagementFeeRatio().doubleValue()).split("%")[0]);
                     // 管理费金额大写
                     if (null != manageFeeAmount) {
                         manageFeeAmountName = MoneyToCNFormatUtil.formatToCN(manageFeeAmount.doubleValue());
@@ -2165,6 +2202,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
                 dataMap.put("manageFeeAmount", NumberFormatUtil.convertDecimal(manageFeeAmount,
                         NumberFormatUtil.THOUSAND_SEPARATOR_TWO_DECIMAL));
                 dataMap.put("manageFeeAmountName", manageFeeAmountName);
+                dataMap.put("manageFeeRate", manageFeeRate);
                 dataMap.put("manageFeeCollectionMethod", manageFeeCollectionMethod);
                 dataMap.put("otherFee",
                         NumberFormatUtil.convertDecimal(otherFee, NumberFormatUtil.THOUSAND_SEPARATOR_TWO_DECIMAL));
@@ -2386,8 +2424,14 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
                         Map<String, Object> debtorMap = new HashMap<>();
                         if (debtorList.size() > 1) {
                             debtorMap.put("debtorName", masterContractDebtor.getCompanyName() + "、");
+                            debtorMap.put("debtorContactName", masterContractDebtor.getContact() + "、");
+                            debtorMap.put("debtorContactNumer", masterContractDebtor.getContactNumber() + "、");
+                            debtorMap.put("debtorContactEmail", masterContractDebtor.getEmail() + "、");
                         } else {
                             debtorMap.put("debtorName", masterContractDebtor.getCompanyName());
+                            debtorMap.put("debtorContactName", masterContractDebtor.getContact());
+                            debtorMap.put("debtorContactNumer", masterContractDebtor.getContactNumber());
+                            debtorMap.put("debtorContactEmail", masterContractDebtor.getEmail());
 
                         }
                         debtorMap.put("num", "qz" + m);
@@ -2553,12 +2597,14 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
                 String factoringLegalPersion = masterContract.getFactoringLegalPerson();
                 String factoringAgentName = masterContract.getFactoringAgentName();
                 String factoringAgentPhone = masterContract.getFactoringAgentPhone();
+                String factoringEmail = masterContract.getFactoringAgentEmail();
                 // 保理申请人公司名称
                 String applicantCompanyName = masterContract.getApplicantCompanyName();
                 String applicantLegalPerson = masterContract.getApplicantCompanyLegalPerson();
                 String applicantCompanyAddress = masterContract.getApplicantCompanyAddress();
                 String applicantContact = masterContract.getApplicantContact();
                 String applicantContactNumber = masterContract.getApplicantContactNumber();
+                String applicantEmail = masterContract.getApplicantEmail();
                 //我司指定账户户名
                 String ourAccountName = masterContract.getOurAccountName();
                 //我司指定账户开户行
@@ -2581,6 +2627,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
                 confirmMap.put("applicantCompanyAddress", applicantCompanyAddress);
                 confirmMap.put("applicantContact", applicantContact);
                 confirmMap.put("applicantContactNumber", applicantContactNumber);
+                confirmMap.put("applicantEmail", applicantEmail);
                 confirmMap.put("factoringName", factoringName);
                 confirmMap.put("ourAccountName", ourAccountName);
                 confirmMap.put("ourAccountBank", ourAccountBank);
@@ -2591,13 +2638,15 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
                 confirmMap.put("factoringAddress", ConstantUtil.OUR_COMPANY_ADDRESS_NAME);
                 confirmMap.put("factoringAgentName", factoringAgentName);
                 confirmMap.put("factoringAgentPhone", factoringAgentPhone);
+                confirmMap.put("factoringEmail", factoringEmail);
                 //融资本金
                 BigDecimal financingAmmount = financingInfo.getFinancingAmount() == null ? BigDecimal.ZERO : financingInfo.getFinancingAmount();
                 BigDecimal financingDays = new BigDecimal(Integer.parseInt(financingInfo.getFinancingPeriod().toString()));
-                //融资本金+ (融资本金✖12%-管理费率➗360✖融资期限)
-                BigDecimal balanceLong = financingAmmount.add(financingAmmount.multiply(new BigDecimal(0.12).subtract(financingInfo.getManagementFeeRatio()).divide(new BigDecimal(360), BigDecimal.ROUND_CEILING).multiply(financingDays)));
-                //BigDecimal balanceLong = financingAmmount.add(financingAmmount.multiply(new BigDecimal(0.12).subtract(new BigDecimal(financingInfo.getManagementFeeRatio()))));
-                confirmMap.put("financingAmountInterest", balanceLong);
+                //融资本金+(融资本金*(12%-管理费率/融资利率)/360)*融资期限
+                BigDecimal balanceLong = financingAmmount
+                        .add(financingAmmount
+                                .multiply(new BigDecimal(0.12).subtract(new BigDecimal(financingInfo.getManagementFeeRatio().doubleValue()).divide(new BigDecimal(financingInfo.getFinancingRate().doubleValue()))).divide(new BigDecimal(360)))
+                                .multiply(financingDays));                confirmMap.put("financingAmountInterest", balanceLong);
                 BigDecimal balance = balanceLong.setScale(2, RoundingMode.HALF_UP);
                 managementFeeRatioStr = PercentageUtil.convertPercentage(financingInfo.getFinancingRate().add(financingInfo.getManagementFeeRatio()).doubleValue());
                 if (StringUtil.isNotEmpty(managementFeeRatioStr)) {