复利计算再升级------------------------------------------------------------
客户在大家的引导下,有了更多的想法:
- 这个数据我经常会填.....帮我预先填上呗?......
- 把界面做得简单漂亮好操作一点呗?
- 能不能帮我转成个APP,我装到手机上就更方便了?
- 我觉得这个很有用,很多人可能都需要这些功能,做到我的微信公众号上吧?
- 能不能不要让我填表单,让我发条消息,或者对着手机说句话就可以了?
每组选一两个方向加以改进,让我们的投资计算与记录工具,达到可以发布给用户使用的版本,并发布博客对此次更新进行说明与总结。
截止日期:2016.4.14晚11点。
选择一,把数据填上去。
选择二,把界面做的漂亮方便操作
新增加一个用户登录界面,里面存储了账号,会对输入的账号进行判断是否存在。
简化了界面,由于搭档在页面部分仍在学习中,所以以后会加以完善。
对客户投资的资产可以每年进行记录,并且存进数据库当中。
接下来是部分代码,具体代码上传到Github上面
显示用户资金界面代码:
1 <%@ page import="com.yu.Dao.DaoFactory" %>
2 <%@ page import="com.yu.Dao.Iuserdao" %>
3 <%@ page import="com.yu.model.User" %>
4 <%@ page import="java.util.List" %>
5 <%@ page import="com.yu.Dao.Icompany" %>
6 <%@ page import="com.yu.Dao.Inumberdao" %>
7 <%@ page import="com.yu.model.Number" %><%--
8 Created by IntelliJ IDEA.
9 User: lenovo
10 Date: 2016/4/14
11 Time: 17:17
12 To change this template use File | Settings | File Templates.
13 --%>
14 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
15 <html>
16 <head>
17 <title>UserList</title>
18 </head>
19 <body>
20 <%
21 String con = request.getParameter("checkname");
22 if(con==null)
23 {con="";}
24 Iuserdao userdao= DaoFactory.getuserdao();
25 Inumberdao numberdao=DaoFactory.getnumberdao();
26 User lu=(User)session.getAttribute("loginuser");
27 Number num=null;
28 %>
29
30 <table align="center" width="1000" border="1">
31 <tr>
32 <form action="showlist.jsp" method="post">
33 查询用户:<input type="text" name="checkname" value="<%=con%>"/>
34 <input type="submit" value="查询"/>
35 </form>
36 </tr>
37 <tr>
38 <td>投资年限</td><td>用户名</td><td>用户昵称</td><td>用户资产</td>
39 </tr>
40 <%
41 int year=Integer.parseInt(request.getParameter("year"));
42 int i=-1;
43
44 for(int x=0;x<year;x++){
45 i=i+1;
46 num=numberdao.load(i);
47 %>
48 <tr>
49 <td><%=i%></td><td><%=lu.getUsername()%></td>
50 <td><%=lu.getNeckname()%></td>
51 <td><%=num.getFuterMoney()%></td>
52 </tr>
53
54 <%}
55 %>
56
57 </table>
58
59 </body>
60 </html>
对计算进行处理和管理传进的一些输入流的处理用到了Servlte
1 package com.yu.Selveter;
2
3 import com.yu.Dao.DaoFactory;
4 import com.yu.Dao.Inumberdao;
5 import com.yu.model.Number;
6 import com.yu.model.User;
7
8 import javax.servlet.ServletException;
9 import javax.servlet.http.HttpServlet;
10 import javax.servlet.http.HttpServletRequest;
11 import javax.servlet.http.HttpServletResponse;
12 import javax.servlet.http.HttpSession;
13 import java.io.IOException;
14
15 /**
16 * Created by lenovo on 2016/4/13.
17 */
18 public class FuliSelveter extends HttpServlet{
19 @Override
20 protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
21 this.doPost(req,resp);
22 }
23
24 @Override
25 protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
26 Number number=new Number(); //获得number变量的值
27 int select=0;
28 try {
29 select= Integer.parseInt(req.getParameter("select"));
30 HttpSession session =req.getSession();
31 User user= (User)session.getAttribute("loginuser");
32 number.setNonMoney(Double.valueOf(req.getParameter("NonMoney")));
33 number.setId(user.getId());
34 number.setYear(Integer.parseInt(req.getParameter("Year")));
35 number.setRate(Double.valueOf(req.getParameter("Rate")));
36 number.setFuterMoney(Double.valueOf(req.getParameter("FuterMoney")));
37 resp.setContentType("text/html;charset=UTF-8");
38 //存进number数据库中
39 Inumberdao num= DaoFactory.getnumberdao();
40 double FuterMoney=number.getFuterMoney();
41 double NonMoney=number.getNonMoney();
42 double Rate=number.getRate();
43 int Year=number.getYear();
44 int userid=number.getUserid();
45 double result=0;
46 if(select==1){
47
48 FuterMoney=NonMoney*Math.pow((1+Rate ),Year );
49 result=FuterMoney;
50 session.setAttribute("result",result);
51 resp.sendRedirect(req.getContextPath()+"/admin/user/FuliFuterMoney.jsp");
52 }
53 else if(select==2){
54 NonMoney=FuterMoney/Math.pow((1+Rate ),Year ) ;
55 result=NonMoney;
56 session.setAttribute("result",result);
57 resp.sendRedirect(req.getContextPath()+"/admin/user/FuliNonMoney.jsp");
58
59 }else if(select==3){
60 Rate=Math.pow((FuterMoney/NonMoney),1/Year)-1;
61 result=Rate;
62 session.setAttribute("result",result);
63 resp.sendRedirect(req.getContextPath()+"/admin/user/FuliRate.jsp");
64 }else if(select==4){
65 Year= (int) ((Math.log(FuterMoney/NonMoney))/(Math.log(1+Rate)));
66 result=Year;
67 session.setAttribute("result",result);
68 resp.sendRedirect(req.getContextPath()+"/admin/user/FuliYear.jsp");
69 }else {
70 FuterMoney=NonMoney*(1+Rate*Year );
71 result=FuterMoney;
72 session.setAttribute("result",result);
73 resp.sendRedirect(req.getContextPath()+"/admin/user/DanliFuterMoney.jsp");
74 }
75
76
77 }catch (NumberFormatException e){
78
79 }
80
81
82 }
83 }
总结:仍需跟队友好好沟通,互相进步。