最新版房贷计算器
来源:互联网 发布:软件代理销售协议 编辑:程序博客网 时间:2024/04/28 23:30
import com.freeter.model.Calculator;
@RestController
@RequestMapping("app/calculator")
public class calculatorController {
@RequestMapping(value = "houseLoan", produces = "application/json;charset=UTF-8")
public String tradeCalculator(Calculator cal) {
double totalAmountMortgage = 0;
double reimbursemenAmount = 0
double interestPayment = 0
double interestPaymentMonth = 0;
double averageMonthlyAmount = 0;
double interestDurationLoan = 0;
double remainingLoan = 0;
double totalDueAmount = 0;
JSONObject result = new JSONObject();
int errCode = 1;
String desc = "成功";
if (cal.isLoanType() == true) {
if (cal.isComputeMode() == true) {
totalAmountMortgage = (cal.getArea() * cal.getUnitPrice());
reimbursemenAmount = totalAmountMortgage * cal.getPercentage() * 0.1;
} else {
totalAmountMortgage = cal.getTotalLoan();
reimbursemenAmount = totalAmountMortgage;
}
downPayment = (totalAmountMortgage - reimbursemenAmount);
if (cal.isRepayment() == true) {
averageMonthlyAmount = (reimbursemenAmount * cal.getInterestRates() / 12
* Math.pow(1 + cal.getInterestRates() / 12, +cal.getMonth())
/ (Math.pow(1 + cal.getInterestRates() / 12, cal.getMonth()) - 1));
remainingLoan = reimbursemenAmount;
for (int i = 0; i < cal.getMonth(); i++) {
interestPaymentMonth = remainingLoan * cal.getInterestRates() / 12;
interestDurationLoan = averageMonthlyAmount - interestPaymentMonth;
interestPayment = interestPayment + interestPaymentMonth;//
remainingLoan = remainingLoan - interestDurationLoan;/
totalDueAmount = reimbursemenAmount + interestPayment;
result.put("totalAmountMortgage", totalAmountMortgage);
result.put("reimbursemenAmount", reimbursemenAmount);/
result.put("interestPayment", interestPayment);//
result.put("downPayment", downPayment);//
result.put("averageMonthlyAmount", averageMonthlyAmount);//
} else {
interestDurationLoan = reimbursemenAmount / cal.getMonth();
double reimbursemenAmount1 = reimbursemenAmount;
for (int i = 0; i < cal.getMonth(); i++) {
interestPaymentMonth = reimbursemenAmount1 * cal.getInterestRates() / 12;
System.out.println("第" + i + "期" + "本金:" + interestDurationLoan + "利息" + interestPaymentMonth
+ " 总额:" + (interestDurationLoan + interestPaymentMonth));
averageMonthlyAmount = interestDurationLoan + interestPaymentMonth;
interestPayment += interestPaymentMonth;
reimbursemenAmount1 -= interestDurationLoan;
}
totalDueAmount = reimbursemenAmount + interestPayment;
result.put("totalAmountMortgage", totalAmountMortgage);
result.put("reimbursemenAmount", reimbursemenAmount);
result.put("interestPayment", interestPayment);
result.put("downPayment", downPayment);
result.put("month", cal.getMonth());
result.put("averageMonthlyAmount", averageMonthlyAmount);
}
} else {
reimbursemenAmount = cal.getTradeMoney() + cal.getReservedFound();
if (cal.isRepayment() == true) {
double tradeMoney = cal.getTradeMoney();
double ReservedFound = cal.getReservedFound();
for (int i = 0; i < cal.getMonth(); i++) {
interestPaymentMonth = ReservedFound * cal.getInterestRates() / 12
+ tradeMoney * cal.getTradeInterestRates() / 12;
interestPayment = interestPayment + interestPaymentMonth;
tradeMoney = tradeMoney - ((cal.getTradeMoney() * cal.getTradeInterestRates() / 12
* Math.pow(1 + cal.getTradeInterestRates() / 12, +cal.getMonth())
/ (Math.pow(1 + cal.getTradeInterestRates() / 12, cal.getMonth()) - 1))
- (tradeMoney * cal.getTradeInterestRates() / 12));
ReservedFound = ReservedFound - ((cal.getReservedFound() * cal.getInterestRates() / 12
* Math.pow(1 + cal.getInterestRates() / 12, +cal.getMonth())
/ (Math.pow(1 + cal.getInterestRates() / 12, cal.getMonth()) - 1))
- (ReservedFound * cal.getInterestRates() / 12));
}
totalDueAmount = reimbursemenAmount + interestPayment;
result.put("reimbursemenAmount", reimbursemenAmount);
result.put("totalDueAmount", totalDueAmount);
result.put("interestPayment", interestPayment);
result.put("month", cal.getMonth());
result.put("averageMonthlyAmount", averageMonthlyAmount);
} else {
reimbursemenAmount = cal.getTradeMoney() + cal.getReservedFound();
interestDurationLoan = reimbursemenAmount / cal.getMonth();
double tradeMoney = cal.getTradeMoney();//
double ReservedFound = cal.getReservedFound();
tradeMoney = tradeMoney - (cal.getTradeMoney() / cal.getMonth());
ReservedFound = ReservedFound - (cal.getReservedFound() / cal.getMonth());
}
totalDueAmount = reimbursemenAmount + interestPayment;
result.put("reimbursemenAmount", reimbursemenAmount);
result.put("totalDueAmount", totalDueAmount);
result.put("interestPayment", interestPayment);
result.put("averageMonthlyAmount", averageMonthlyAmount);
}
}
result.put("errCode", errCode);
result.put("desc", desc);
return result.toString();
}
}
@RestController
@RequestMapping("app/calculator")
public class calculatorController {
@RequestMapping(value = "houseLoan", produces = "application/json;charset=UTF-8")
public String tradeCalculator(Calculator cal) {
double totalAmountMortgage = 0;
double reimbursemenAmount = 0
double interestPayment = 0
double interestPaymentMonth = 0;
double averageMonthlyAmount = 0;
double interestDurationLoan = 0;
double remainingLoan = 0;
double totalDueAmount = 0;
JSONObject result = new JSONObject();
int errCode = 1;
String desc = "成功";
if (cal.isLoanType() == true) {
if (cal.isComputeMode() == true) {
totalAmountMortgage = (cal.getArea() * cal.getUnitPrice());
reimbursemenAmount = totalAmountMortgage * cal.getPercentage() * 0.1;
} else {
totalAmountMortgage = cal.getTotalLoan();
reimbursemenAmount = totalAmountMortgage;
}
downPayment = (totalAmountMortgage - reimbursemenAmount);
if (cal.isRepayment() == true) {
averageMonthlyAmount = (reimbursemenAmount * cal.getInterestRates() / 12
* Math.pow(1 + cal.getInterestRates() / 12, +cal.getMonth())
/ (Math.pow(1 + cal.getInterestRates() / 12, cal.getMonth()) - 1));
remainingLoan = reimbursemenAmount;
for (int i = 0; i < cal.getMonth(); i++) {
interestPaymentMonth = remainingLoan * cal.getInterestRates() / 12;
interestDurationLoan = averageMonthlyAmount - interestPaymentMonth;
interestPayment = interestPayment + interestPaymentMonth;//
remainingLoan = remainingLoan - interestDurationLoan;/
totalDueAmount = reimbursemenAmount + interestPayment;
result.put("totalAmountMortgage", totalAmountMortgage);
result.put("reimbursemenAmount", reimbursemenAmount);/
result.put("interestPayment", interestPayment);//
result.put("downPayment", downPayment);//
result.put("averageMonthlyAmount", averageMonthlyAmount);//
} else {
interestDurationLoan = reimbursemenAmount / cal.getMonth();
double reimbursemenAmount1 = reimbursemenAmount;
for (int i = 0; i < cal.getMonth(); i++) {
interestPaymentMonth = reimbursemenAmount1 * cal.getInterestRates() / 12;
System.out.println("第" + i + "期" + "本金:" + interestDurationLoan + "利息" + interestPaymentMonth
+ " 总额:" + (interestDurationLoan + interestPaymentMonth));
averageMonthlyAmount = interestDurationLoan + interestPaymentMonth;
interestPayment += interestPaymentMonth;
reimbursemenAmount1 -= interestDurationLoan;
}
totalDueAmount = reimbursemenAmount + interestPayment;
result.put("totalAmountMortgage", totalAmountMortgage);
result.put("reimbursemenAmount", reimbursemenAmount);
result.put("interestPayment", interestPayment);
result.put("downPayment", downPayment);
result.put("month", cal.getMonth());
result.put("averageMonthlyAmount", averageMonthlyAmount);
}
} else {
reimbursemenAmount = cal.getTradeMoney() + cal.getReservedFound();
if (cal.isRepayment() == true) {
double tradeMoney = cal.getTradeMoney();
double ReservedFound = cal.getReservedFound();
for (int i = 0; i < cal.getMonth(); i++) {
interestPaymentMonth = ReservedFound * cal.getInterestRates() / 12
+ tradeMoney * cal.getTradeInterestRates() / 12;
interestPayment = interestPayment + interestPaymentMonth;
tradeMoney = tradeMoney - ((cal.getTradeMoney() * cal.getTradeInterestRates() / 12
* Math.pow(1 + cal.getTradeInterestRates() / 12, +cal.getMonth())
/ (Math.pow(1 + cal.getTradeInterestRates() / 12, cal.getMonth()) - 1))
- (tradeMoney * cal.getTradeInterestRates() / 12));
ReservedFound = ReservedFound - ((cal.getReservedFound() * cal.getInterestRates() / 12
* Math.pow(1 + cal.getInterestRates() / 12, +cal.getMonth())
/ (Math.pow(1 + cal.getInterestRates() / 12, cal.getMonth()) - 1))
- (ReservedFound * cal.getInterestRates() / 12));
}
totalDueAmount = reimbursemenAmount + interestPayment;
result.put("reimbursemenAmount", reimbursemenAmount);
result.put("totalDueAmount", totalDueAmount);
result.put("interestPayment", interestPayment);
result.put("month", cal.getMonth());
result.put("averageMonthlyAmount", averageMonthlyAmount);
} else {
reimbursemenAmount = cal.getTradeMoney() + cal.getReservedFound();
interestDurationLoan = reimbursemenAmount / cal.getMonth();
double tradeMoney = cal.getTradeMoney();//
double ReservedFound = cal.getReservedFound();
tradeMoney = tradeMoney - (cal.getTradeMoney() / cal.getMonth());
ReservedFound = ReservedFound - (cal.getReservedFound() / cal.getMonth());
}
totalDueAmount = reimbursemenAmount + interestPayment;
result.put("reimbursemenAmount", reimbursemenAmount);
result.put("totalDueAmount", totalDueAmount);
result.put("interestPayment", interestPayment);
result.put("averageMonthlyAmount", averageMonthlyAmount);
}
}
result.put("errCode", errCode);
result.put("desc", desc);
return result.toString();
}
}
阅读全文
2 0
- 最新版房贷计算器
- 房贷计算器
- 房贷计算器java版
- 房贷计算器移动端接口
- 气球贷计算器
- PHP房贷计算器代码,等额本息,等额本金
- jQueryEasyUI实现房贷计算器详细教程0--前言
- jQueryEasyUI实现房贷计算器详细教程1--HTML部分
- jQueryEasyUI实现房贷计算器详细教程2--jQuery部分
- jQueryEasyUI实现房贷计算器详细教程3--EasyUI部分
- 仿安居客房贷计算器
- C语言:房贷计算器(等额本息与等额本金对比计算器)
- 2006最新版个人所得税计算器
- 2006最新版个人所得税计算器
- 2006最新版个人所得税计算器
- 房贷
- 如何多次房贷
- 房贷知识
- 17.nm
- JavaScript中的函数表达式
- 抽象类,接口,匿名对象
- Hibernate中简答的增删改查
- hdu 6156 Palindrome Function
- 最新版房贷计算器
- String str = new String("Hello");
- 图片懒加载库echo.js源码学习
- 关于Mysql 间隙锁的理解
- 扩展欧几里得算法详解
- 写个自己看的博客随笔_发布游戏或者应用
- 学习笔记TF046:TensoFlow开发环境,Mac、Ubuntu/Linux、Windows,CPU版本、GPU版本
- OS上误删dbf文件,未宕机情况下的应急恢复!宕机后则无法恢复!
- [bzoj 1606] [Usaco2008 Dec]Hay For Sale 购买干草 (dp)