diff --git a/src_core/com/tenwa/voucher/serviceImp/OverdueRepurchaseVoucherPSBC.java b/src_core/com/tenwa/voucher/serviceImp/OverdueRepurchaseVoucherPSBC.java index 473203963..178818352 100644 --- a/src_core/com/tenwa/voucher/serviceImp/OverdueRepurchaseVoucherPSBC.java +++ b/src_core/com/tenwa/voucher/serviceImp/OverdueRepurchaseVoucherPSBC.java @@ -91,7 +91,7 @@ public class OverdueRepurchaseVoucherPSBC implements VoucherInfoService { String contractId = loanInfo.get("contractId");//合同id String actualPaymentBackAmount = loanInfo.get("buyback_money");//实际偿还总额 String outstandingPrincipal = findOutstandingPrincipal(contractId, Sqlca);//未还本金 - String outstandingInterest = findOutstandingInterest(contractId, Sqlca);//未还利息 + String outstandingInterest = findOutstandingInterest(contractId, Sqlca);//未到期利息 String overdueInterest = findOverdueInterest(actualPaymentBackAmount, outstandingPrincipal);//未还罚息利息 String customerNo = findCustomerNoByContractId(contractId, Sqlca); logger.info("OverdueRepurchaseVoucherPSBC20210818 查找客户编号信息:customerNo=" + customerNo); @@ -158,16 +158,15 @@ public class OverdueRepurchaseVoucherPSBC implements VoucherInfoService { * @return */ private String findOutstandingInterest(String contractId, Transaction Sqlca) throws Exception { - String sqlInterest = "SELECT SUM(INTEREST) from lc_rent_plan WHERE CONTRACT_ID='"+contractId+"'";//总利息 - String sqlRepaymentInterest = "SELECT SUM(INTEREST) from lc_rent_income WHERE CONTRACT_ID='"+contractId+"' and charge_way = 'PSBC' ";//已还利息 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); + String date = sdf.format(new Date()); + String sqlInterest = "SELECT SUM(INTEREST) from lc_rent_plan WHERE CONTRACT_ID='"+contractId+"' and PLAN_DATE > '"+ date +"'";//未到期利息 String amountInterest = Sqlca.getString(sqlInterest); - String amountRepaymentInterest = Sqlca.getString(sqlRepaymentInterest); - if(StringUtils.isEmpty(amountInterest) || StringUtils.isEmpty(amountRepaymentInterest)){ + if(StringUtils.isEmpty(amountInterest)){ logger.warn("contractId="+ contractId + "生成凭证,查询未到期利息总额信息失败。"); throw new Exception("contractId="+ contractId + "生成凭证,查询未到期利息总额信息失败。"); } - BigDecimal amount = new BigDecimal(amountInterest).subtract(new BigDecimal(amountRepaymentInterest)); - return amount.toString(); + return amountInterest; } /** diff --git a/src_sql/鎶曚骇SQL/dailyfix/zhanglei20210728.sql b/src_sql/鎶曚骇SQL/dailyfix/zhanglei20210728.sql index 9535e2231..81cc1fdab 100644 --- a/src_sql/鎶曚骇SQL/dailyfix/zhanglei20210728.sql +++ b/src_sql/鎶曚骇SQL/dailyfix/zhanglei20210728.sql @@ -488,6 +488,7 @@ INSERT INTO apzl.code_library (codeno, itemno, itemname, bankno, sortno, isinuse CREATE ALGORITHM=UNDEFINED DEFINER=`apzl`@`%` SQL SECURITY DEFINER VIEW `vi_lb_identity_check_creditauth` AS (select `a`.`name` AS `fullName`,`a`.`certid` AS `certId`,`a`.`relation` AS `relation`,`a`.`creditauth` AS `creditauth`,`a`.`credittype` AS `credittype`,`a`.`flowunid` AS `flowunid`,`a`.`phone` AS `phone` from (select `ut`.`name` AS `name`,`ut`.`certid` AS `certid`,(case when (`ut`.`Partner_` = 'Y') then '共同申请人' when ((`ut`.`Partner_` = 'N') and (`ut`.`Spouse_` = 'Y')) then '配偶' when (`ut`.`Partner_` = 'gua') then '担保人' when (`ut`.`Partner_` = 'cust') then '申请人' else '' end) AS `relation`,(case when (`ut`.`creditauth` = 'ap') then '征信授权书_安鹏' when (`ut`.`creditauth` = 'yc') then '征信授权书_邮储' when (`ut`.`creditauth` = 'yc_audit') then '借款服务确认书_邮储' else '' end) AS `creditauth`,(case when (`ut`.`creditauth` = 'ap') then '99001' when (`ut`.`creditauth` = 'yc') then '99002' when (`ut`.`creditauth` = 'yc_audit') then '99003' else '' end) AS `credittype`,`ut`.`flowunid` AS `flowunid`,`ut`.`phone` AS `phone` from (select `cf1`.`name` AS `name`,`cf1`.`certid` AS `certid`,`cf1`.`Partner_` AS `Partner_`,`cf1`.`Spouse_` AS `Spouse_`,'ap' AS `creditauth`,`cf1`.`flowunid` AS `flowunid`,`cf1`.`tel` AS `phone` from `apzl`.`customer_family_temp` `cf1` where (`cf1`.`Partner_` = 'Y') union all (select `lgut`.`FULLNAME` AS `FULLNAME`,`lgut`.`CERTID` AS `CERTID`,'gua' AS `Partner_`,'gua' AS `Spouse_`,'ap' AS `creditauth`,`lgut`.`FLOWUNID` AS `flowunid`,`lgut`.`MOBILE` AS `phone` from `apzl`.`lb_guarantee_unit_temp` `lgut`) union all (select `ccpt`.`FULLNAME` AS `FULLNAME`,`ccpt`.`CERTID` AS `CERTID`,'cust' AS `Partner_`,'cust' AS `Spouse_`,'ap' AS `creditauth`,`ccpt`.`FLOWUNID` AS `flowunid`,`ccpt`.`mobile` AS `phone` from `apzl`.`customer_person_temp` `ccpt` where (`ccpt`.`BALANCESHEET` = '申请人'))) `ut`) `a`); CREATE ALGORITHM=UNDEFINED DEFINER=`apzl`@`%` SQL SECURITY DEFINER VIEW `vi_lb_identity_check_creditauth_loan` AS (select `a`.`name` AS `fullName`,`a`.`certid` AS `certId`,`a`.`relation` AS `relation`,`a`.`creditauth` AS `creditauth`,`a`.`credittype` AS `credittype`,`a`.`flowunid` AS `flowunid`,`a`.`phone` AS `phone` from (select `ut`.`name` AS `name`,`ut`.`certid` AS `certid`,(case when (`ut`.`Partner_` = 'Y') then '共同申请人' when ((`ut`.`Partner_` = 'N') and (`ut`.`Spouse_` = 'Y')) then '配偶' when (`ut`.`Partner_` = 'gua') then '担保人' when (`ut`.`Partner_` = 'cust') then '申请人' else '' end) AS `relation`,(case when (`ut`.`creditauth` = 'ap') then '征信授权书_安鹏' when (`ut`.`creditauth` = 'yc') then '征信授权书_邮储' when (`ut`.`creditauth` = 'yc_audit') then '借款服务确认书_邮储' else '' end) AS `creditauth`,(case when (`ut`.`creditauth` = 'ap') then '99001' when (`ut`.`creditauth` = 'yc') then '99002' when (`ut`.`creditauth` = 'yc_audit') then '99003' else '' end) AS `credittype`,`ut`.`flowunid` AS `flowunid`,`ut`.`phone` AS `phone` from (select `cf1`.`name` AS `name`,`cf1`.`certid` AS `certid`,`cf1`.`Partner_` AS `Partner_`,`cf1`.`Spouse_` AS `Spouse_`,'ap' AS `creditauth`,`cf1`.`PROJECT_ID` AS `flowunid`,`cf1`.`tel` AS `phone` from `apzl`.`customer_family` `cf1` where (`cf1`.`Partner_` = 'Y') union all (select `lgut`.`FULLNAME` AS `FULLNAME`,`lgut`.`CERTID` AS `CERTID`,'gua' AS `Partner_`,'gua' AS `Spouse_`,'ap' AS `creditauth`,`lgut`.`PROJECT_ID` AS `flowunid`,`lgut`.`MOBILE` AS `phone` from `apzl`.`lb_guarantee_unit` `lgut`) union all (select `ccpt`.`FULLNAME` AS `FULLNAME`,`ccpt`.`CERTID` AS `CERTID`,'cust' AS `Partner_`,'cust' AS `Spouse_`,'ap' AS `creditauth`,`lul`.`PROJECT_ID` AS `flowunid`,`ccpt`.`mobile` AS `phone` from (`apzl`.`customer_person` `ccpt` left join `apzl`.`lb_union_lessee` `lul` on((`ccpt`.`CUSTOMERID` = `lul`.`CUSTOMER_ID`))) where (`ccpt`.`BALANCESHEET` = '申请人'))) `ut`) `a`); +INSERT INTO `apzl`.`code_library` (`codeno`, `itemno`, `itemname`, `bankno`, `sortno`, `isinuse`, `itemdescribe`, `itemattribute`, `relativecode`, `attribute1`, `attribute2`, `attribute3`, `attribute4`, `attribute5`, `attribute6`, `attribute7`, `attribute8`, `inputuser`, `inputorg`, `inputtime`, `updateuser`, `updatetime`, `remark`, `helptext`) VALUES ('MissionName', 'com.tenwa.lease.app.quartzmession.CorpusSourceOverdueRepurchaseCreateVoucherJob', '资方逾期回购生成凭证', NULL, '5101002', '1', '资方逾期回购生成凭证', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'SYS_Designer', NULL, '2021/08/20 15:08:32', 'SYS_Designer', '2021/08/20 15:08:32', NULL, NULL);