现金流增加贴息

This commit is contained in:
zhulh 2021-07-30 15:44:54 +08:00
parent 25653c352d
commit 2d6d37d302

View File

@ -23,14 +23,14 @@ import com.tenwa.reckon.util.IRRCalculateUtil;
import com.tenwa.reckon.util.IrrTools; import com.tenwa.reckon.util.IrrTools;
public class CashFlowExecutor { public class CashFlowExecutor {
private JBOTransaction tx; private JBOTransaction tx;
public CashFlowExecutor(JBOTransaction tx){ public CashFlowExecutor(JBOTransaction tx){
this.tx=tx; this.tx=tx;
} }
public String run(ConditionBean cb , TabCalBean tcb) throws Exception{ public String run(ConditionBean cb , TabCalBean tcb) throws Exception{
this.delete(tcb, cb); this.delete(tcb, cb);
this.add(cb, tcb); this.add(cb, tcb);
@ -87,15 +87,15 @@ public class CashFlowExecutor {
} }
return irr; return irr;
} }
private void delete(TabCalBean tcb,ConditionBean cb) throws Exception{ private void delete(TabCalBean tcb,ConditionBean cb) throws Exception{
BizObjectManager bm=JBOFactory.getBizObjectManager(tcb.getContractCashTb(), tx); BizObjectManager bm=JBOFactory.getBizObjectManager(tcb.getContractCashTb(), tx);
String sql = " delete from O where flowunid='" + tcb.getDocId() + "' and "+tcb.getPlanCName()+"='"+tcb.getPlanCValue()+"'"; String sql = " delete from O where flowunid='" + tcb.getDocId() + "' and "+tcb.getPlanCName()+"='"+tcb.getPlanCValue()+"'";
bm.createQuery(sql).executeUpdate(); bm.createQuery(sql).executeUpdate();
} }
private void add(ConditionBean cb,TabCalBean tcb) throws Exception{ private void add(ConditionBean cb,TabCalBean tcb) throws Exception{
Map<String, Map<String, String>> productRevenues = tcb.getProductRevenues(); Map<String, Map<String, String>> productRevenues = tcb.getProductRevenues();
String GPSDifference = "0";//获取产品中的GPS差额配置 String GPSDifference = "0";//获取产品中的GPS差额配置
Map<String, String> GPSMap = productRevenues == null ? null : productRevenues.get( "GPSDifference" ); Map<String, String> GPSMap = productRevenues == null ? null : productRevenues.get( "GPSDifference" );
@ -115,7 +115,7 @@ public class CashFlowExecutor {
personalInsuranceDifference = "0"; personalInsuranceDifference = "0";
} }
}*/ }*/
String sql = ""; String sql = "";
if("MYSQL".equals(InitDBType.DBTYPE)){ if("MYSQL".equals(InitDBType.DBTYPE)){
sql += "INSERT INTO " +Tools.getTable(tcb.getContractCashTb())+ " (id," + tcb.getPlanCName() + ""; sql += "INSERT INTO " +Tools.getTable(tcb.getContractCashTb())+ " (id," + tcb.getPlanCName() + "";
@ -127,7 +127,7 @@ public class CashFlowExecutor {
sql += ",net_flow"; sql += ",net_flow";
sql += ",flowunid";//create_date,creator_ "+DateUtil.getSystemDate()+"' create_date ,'"+SecurityUtil.getPrincipal().getId()+"' creator_" sql += ",flowunid";//create_date,creator_ "+DateUtil.getSystemDate()+"' create_date ,'"+SecurityUtil.getPrincipal().getId()+"' creator_"
sql += " )"; sql += " )";
sql +=" select replace(uuid(),'-','') id,'"+tcb.getPlanCValue()+"' "+tcb.getPlanCName()+",t.plan_date,sum(t.flowin) fundin,ifnull(group_concat(if(t.flowindetail='',null,t.flowindetail)),'-') fundindetails, "; sql +=" select replace(uuid(),'-','') id,'"+tcb.getPlanCValue()+"' "+tcb.getPlanCName()+",t.plan_date,sum(t.flowin) fundin,ifnull(group_concat(if(t.flowindetail='',null,t.flowindetail)),'-') fundindetails, ";
sql +=" sum(t.flowout) fundout ,ifnull(group_concat(if(t.flowoutdetail='',null,t.flowoutdetail)),'-')fundoutdetails,sum(t.cleanfow)netflow ,'"+tcb.getDocId()+"' flowunid " ; sql +=" sum(t.flowout) fundout ,ifnull(group_concat(if(t.flowoutdetail='',null,t.flowoutdetail)),'-')fundoutdetails,sum(t.cleanfow)netflow ,'"+tcb.getDocId()+"' flowunid " ;
sql +=" from (" ; sql +=" from (" ;
@ -146,7 +146,7 @@ public class CashFlowExecutor {
sql +=" if(fundplan.pay_type='pay_type_in',fundplan.plan_money,-fundplan.plan_money) cleanfow " ; sql +=" if(fundplan.pay_type='pay_type_in',fundplan.plan_money,-fundplan.plan_money) cleanfow " ;
sql +=" from "+Tools.getTable(tcb.getFundFundPlan_tb())+" fundplan " ; sql +=" from "+Tools.getTable(tcb.getFundFundPlan_tb())+" fundplan " ;
sql +=" left join code_library tdd on fundplan.fee_type = tdd.itemno and tdd.codeno='FeeType' " ; sql +=" left join code_library tdd on fundplan.fee_type = tdd.itemno and tdd.codeno='FeeType' " ;
sql +=" where fundplan.flowunid = '"+ tcb.getDocId()+"' and fundplan."+tcb.getPlanCName()+"='"+tcb.getPlanCValue()+"' and fundplan.fee_type in ('feetype2','feetype1','feetype10','feetype16','feetype17','feetype33','feetype24') "; sql +=" where fundplan.flowunid = '"+ tcb.getDocId()+"' and fundplan."+tcb.getPlanCName()+"='"+tcb.getPlanCValue()+"' and fundplan.fee_type in ('feetype2','feetype1','feetype10','feetype16','feetype17','feetype33','feetype24','feetype27') ";
//根据客户张文竹不管是否灵活产品配置的GPS差额和个人意外险差额添加到IRR计算 //根据客户张文竹不管是否灵活产品配置的GPS差额和个人意外险差额添加到IRR计算
/* /*
if( !"0".equals(personalInsuranceDifference) ){ if( !"0".equals(personalInsuranceDifference) ){
@ -156,7 +156,7 @@ public class CashFlowExecutor {
if( !"0".equals(GPSDifference) ){ if( !"0".equals(GPSDifference) ){
sql += "union all select plan_date,'"+GPSDifference+"' flowin,'GPS差额:"+GPSDifference+"' flowindetail,'' flowout,'' flowoutdetil,'"+GPSDifference+"' cleanfow from lc_fund_plan_temp where flowunid = '"+tcb.getDocId()+"' and fee_type='feetype10' "; sql += "union all select plan_date,'"+GPSDifference+"' flowin,'GPS差额:"+GPSDifference+"' flowindetail,'' flowout,'' flowoutdetil,'"+GPSDifference+"' cleanfow from lc_fund_plan_temp where flowunid = '"+tcb.getDocId()+"' and fee_type='feetype10' ";
} }
}else if("ORACLE".equals(InitDBType.DBTYPE)){ }else if("ORACLE".equals(InitDBType.DBTYPE)){
sql += "INSERT INTO " +Tools.getTable(tcb.getContractCashTb())+ " (id," + tcb.getPlanCName() + ""; sql += "INSERT INTO " +Tools.getTable(tcb.getContractCashTb())+ " (id," + tcb.getPlanCName() + "";
sql += ",plan_date"; sql += ",plan_date";
@ -167,7 +167,7 @@ public class CashFlowExecutor {
sql += ",net_flow"; sql += ",net_flow";
sql += ",flowunid";//create_date,creator_ "+DateUtil.getSystemDate()+"' create_date ,'"+SecurityUtil.getPrincipal().getId()+"' creator_" sql += ",flowunid";//create_date,creator_ "+DateUtil.getSystemDate()+"' create_date ,'"+SecurityUtil.getPrincipal().getId()+"' creator_"
sql += " )"; sql += " )";
sql +=" select sys_guid() id,'"+tcb.getPlanCValue()+"' "+tcb.getPlanCName()+",t.plan_date,sum(t.flowin) fundin,nvl(wmsys.wm_concat(case when t.flowindetail='' then null else t.flowindetail end ),'-') fundindetails, "; sql +=" select sys_guid() id,'"+tcb.getPlanCValue()+"' "+tcb.getPlanCName()+",t.plan_date,sum(t.flowin) fundin,nvl(wmsys.wm_concat(case when t.flowindetail='' then null else t.flowindetail end ),'-') fundindetails, ";
sql +=" sum(t.flowout) fundout ,nvl(wmsys.wm_concat(case when t.flowoutdetail='' then null else t.flowoutdetail end),'-') fundoutdetails,sum(t.cleanfow)netflow ,'"+tcb.getDocId()+"' flowunid " ; sql +=" sum(t.flowout) fundout ,nvl(wmsys.wm_concat(case when t.flowoutdetail='' then null else t.flowoutdetail end),'-') fundoutdetails,sum(t.cleanfow)netflow ,'"+tcb.getDocId()+"' flowunid " ;
sql +=" from (" ; sql +=" from (" ;
@ -207,10 +207,10 @@ public class CashFlowExecutor {
sql +=" )t group by t.plan_date "; sql +=" )t group by t.plan_date ";
Transaction Sqlca =null; Transaction Sqlca =null;
Sqlca = Transaction.createTransaction(tx); Sqlca = Transaction.createTransaction(tx);
SqlObject asql = new SqlObject(""); SqlObject asql = new SqlObject("");
asql.setOriginalSql(sql); asql.setOriginalSql(sql);
Sqlca.executeSQL(asql); Sqlca.executeSQL(asql);
String depositStyle = ""; String depositStyle = "";
Map<String, Map<String, String>> productCost = ProductParamUtil.getProductComponentType(productId, "PRD0315"); Map<String, Map<String, String>> productCost = ProductParamUtil.getProductComponentType(productId, "PRD0315");
if( productCost != null && productCost.size() > 0 ){ if( productCost != null && productCost.size() > 0 ){
@ -244,7 +244,7 @@ public class CashFlowExecutor {
break; break;
} }
} }
}else if ("caution_money_method02".equals( depositStyle )){//保证金退回 }else if ("caution_money_method02".equals( depositStyle )){//保证金退回
outMoney = new BigDecimal(cb.getCautionMoney() ); outMoney = new BigDecimal(cb.getCautionMoney() );
inMoney = new BigDecimal(lcftDate.get(0).get("FUND_IN") ); inMoney = new BigDecimal(lcftDate.get(0).get("FUND_IN") );
@ -252,9 +252,9 @@ public class CashFlowExecutor {
asql.setOriginalSql(updateSql); asql.setOriginalSql(updateSql);
Sqlca.executeSQL(asql); Sqlca.executeSQL(asql);
} }
} }
} }