m个人投资n次虚拟满标

来源:互联网 发布:数据大魔王txt全文下载 编辑:程序博客网 时间:2024/06/06 16:37
<pre name="code" class="java">public void executefullloan(String loanid,List<User> users,Integer investn){int index=investn%users.size();User user=users.get(index);double remainMoney = 0;try {remainMoney = loanCalculator.calculateMoneyNeedRaised1(loanid);} catch (NoMatchingObjectsException e) {e.printStackTrace();}if(investn==1){Invest investSys=new Invest();investSys.setId(IdGenerator.randomUUID());investSys.setMoney(0D);investSys.setInvestMoney(remainMoney);investSys.setLoan(ht.get(Loan.class,loanid));investSys.setUser(ht.get(User.class,user.getId()));investSys.setStatus(InvestConstants.InvestStatus.REPAYING);investSys.setTime(new Date());ht.save(investSys);// 项目募集完成Loan loan = ht.get(Loan.class, loanid);loan.setStatus(LoanConstants.LoanStatus.REPAYING);ht.update(loan);}else{double m=0;if(Math.floor(remainMoney/(investn*10000))>0){m=Math.floor(remainMoney/(investn*10000))*10000;}else if(Math.floor(remainMoney/(investn*1000))>0){m=Math.floor(remainMoney/(investn*1000))*1000;}else if(Math.floor(remainMoney/(investn*100))>0){m=Math.floor(remainMoney/(investn*100))*100;}Invest investSys=new Invest();investSys.setId(IdGenerator.randomUUID());investSys.setMoney(0D);investSys.setInvestMoney(m);investSys.setLoan(ht.get(Loan.class,loanid));investSys.setUser(ht.get(User.class,user.getId()));investSys.setStatus(InvestConstants.InvestStatus.REPAYING);investSys.setTime(new Date());ht.save(investSys);executefullloan(loanid,users,investn-1);}}


                                             
0 0
原创粉丝点击