1.跟据产品和融资额以及期数测算租金

This commit is contained in:
zhangbb 2020-06-28 11:34:56 +08:00
parent 0f048aecb2
commit b9b92759e6

View File

@ -0,0 +1,58 @@
package com.tenwa.flow.util;
import java.util.HashMap;
import java.util.Map;
import com.amarsoft.app.util.ProductParamUtil;
import com.tenwa.reckon.util.NumTools;
import com.tenwa.reckon.util.NumberUtils;
import com.tenwa.reckon.util.RentTools;
public class CalculateUtil {
/**
*
* @param product_id 产品编号
* @param clean_lease_money 融资额
* @param income_number 期数
* @return rent 每月租金
* @throws Exception
*/
public static String getRentByProductId(String product_id,String clean_lease_money,String income_number) throws Exception{
Map<String,String> map = new HashMap<String,String>();
//年利率
String retu_vale = ProductParamUtil.getProductParameterValue(product_id,"PRD0350","product_rate","ProductRate");
//期数
String rem_rent_list = income_number;
//融资额
String rem_corpus = clean_lease_money;
//数字 1:期初; 0:期末
String period_type = ProductParamUtil.getProductParameterValue(product_id,"PRD0350","period_type","begin_end");
if("period_type_1".equals(period_type)){
period_type="1";
}else{
period_type="0";
}
//还款间隔,汽车一般都是月付所以先按12来以后有需求再改
String income_number_year = "12";
//未来值默认为"0"
String nominalprice ="0";
map.put("retu_vale", retu_vale);
map.put("rem_rent_list", rem_rent_list);
map.put("rem_corpus", rem_corpus);
map.put("period_type", period_type);
map.put("income_number_year", income_number_year);
map.put("nominalprice", nominalprice);
String rent = RentTools.getRentByPmt(map);
//租金圆整
String rentRound = ProductParamUtil.getProductParameterValue(product_id,"PRD0323","RentRound","RentRound");
String rentRoundType = ProductParamUtil.getProductParameterValue(product_id,"PRD0323","RentRound","RentRoundType");
if(rentRound.length()>0){
rent=NumberUtils.rentRound(rent, rentRound,rentRoundType);
}else{
rent = NumTools.formatNumberDoubleScale(rent, 2);
}
return rent;
}
}