基于javaweb的SpringBoot个人投资理财系统(java+springboot+layui+html+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

320023452402

330023452402

340023452402

350023452402

基于javaweb的SpringBoot个人投资理财系统(java+springboot+layui+html+mysql)

一、项目运行 环境配置:

Jdk1.8 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术:

SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
    @PutMapping("/user/revokeUserPayMoney")
@ResponseBody
public Msg revokeUserPayMoney(@RequestParam("userPayMoneyId") Integer userPayMoneyId, HttpSession session) {
UserPayMoney upm = userPayMoneyService.selectUserPayMoneyById(userPayMoneyId);
upm.setStatus(3);
Integer result = userPayMoneyService.updateUserPayMoney(upm);

if (result == 1) {
session.setAttribute("myFinanceActiveUrl", "payMoneyActive");
return Msg.success();
}
return Msg.fail();
}

@PutMapping("/user/revokeUserTermFinancial")
@ResponseBody
public Msg revokeUserTermFinancial(@RequestParam("userTermFinancialId") Integer userTermFinancialId, HttpSession session) {
UserTermFinancial utf = userTermFinancialService.selectUserTermFinancialById(userTermFinancialId);
utf.setStatus(3);
Integer result = userTermFinancialService.updateUserTermFinancial(utf);

if (result == 1) {
session.setAttribute("myFinanceActiveUrl", "termFinancialActive");
return Msg.success();
}
return Msg.fail();
}

@PutMapping("/user/revokeUserFundProduct")
@ResponseBody
public Msg revokeUserFundProduct(@RequestParam("userFundProductId") Integer userFundProductId,HttpSession session) {

UserFundProduct ufp = userFundProductService.selectUserFundProductById(userFundProductId);
ufp.setStatus(3);
Integer result = userFundProductService.updateUserFundProduct(ufp);

if (result == 1) {
session.setAttribute("myFinanceActiveUrl", "fundProductActive");
return Msg.success();
}
return Msg.fail();
}
}
package com.bjpowernode.finance.controller;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
        user.setUsername(username);
user.setPassword(password);
user.setStatus(0);
user.setReputation("良好");
userService.insertUser(user);
return Msg.success().add("url", "/");
}


}
package com.bjpowernode.finance.common;



/**
* 对所有乱码进行拦截及纠正,包括get提交方式,解决get提交方式乱码,方式是重写了request的getParameter方法,
* 让其在返回值的时候检查提交方式,如果为“get”就进行解码。 使用过滤器的@WebFilter注解进行配置和值的初始化
*/
@WebFilter(filterName = "encodingFilter", urlPatterns = "/*", initParams = {
@WebInitParam(name = "code", value = "utf-8") })
public class EncodingFilter implements Filter {

private String code = null;

public void destroy() {
}

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
// 设置码表
request.setCharacterEncoding(code);
response.setCharacterEncoding(code);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
@Autowired
UserTermFinancialService userTermFinancialService;
@Autowired
FlowOfFundsService flowOfFundsService;

/**
* 跳转到期限理财界面
*
* @param model
* @return
*/
@RequestMapping("/user/finance/toTermFinancial.html")
public String toPaymoney(Model model) {
List<TermFinancial> list = termFinancialService.selectAllTermFinancial();
model.addAttribute("termFinancialList", list);
model.addAttribute("pageTopBarInfo", "期限理财界面");
model.addAttribute("activeUrl1", "financeActive");
model.addAttribute("activeUrl2", "termFinancialActive");
return "/user/finance/termfinancial";
}

/**
* 购买工资理财产品
*
* @param termFinancialId
* @param userId
* @return
*/
@PostMapping("/user/buyTermFinancial")
@ResponseBody
public Msg buyTermFinancial(@RequestParam("termFinancialId") Integer termFinancialId,
@RequestParam("userId") Integer userId) {
UserTermFinancial utf = new UserTermFinancial();
utf.setUserid(userId);
utf.setTermid(termFinancialId);
utf.setStarttime(new Date());
TermFinancial tf = termFinancialService.selectTermFinancialById(termFinancialId);
utf.setAveryield(tf.getAnnualincome());
utf.setProfit(tf.getAnnualincome().multiply(tf.getLeastmoney()));
utf.setStatus(1);
Integer result = userTermFinancialService.insertUserTermFinancial(utf);
if (result == 1) {
FlowOfFunds fof = new FlowOfFunds();
fof.setUserid(userId);
fof.setFlowmoney(tf.getLeastmoney());
fof.setType(1);
fof.setSource(tf.getName());
fof.setCreatetime(new Date());
fof.setFunddesc("无");
flowOfFundsService.insertFlowOfFunds(fof);
return Msg.success();
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
}
package com.bjpowernode.finance.controller;



@Controller
public class MyFinanceController {

@Autowired
UserChangeMoneyService userChangeMoneyService;
@Autowired
UserPayMoneyService userPayMoneyService;
@Autowired
UserFundProductService userFundProductService;
@Autowired
UserTermFinancialService userTermFinancialService;

@GetMapping("/user/personal/toMyFinance.html")
public String toMyFinance(Model model, HttpSession session) {

User user = (User) session.getAttribute("loginUser");
Integer userId = user.getId();

List<UserChangeMoney> userChangeMoneyList = userChangeMoneyService.selectUserChangeMoneyByUserId(userId);
model.addAttribute("userChangeMoneyList", userChangeMoneyList);

List<UserPayMoney> userPayMoneyList = userPayMoneyService.selectUserPayMoneyByUserId(userId);
model.addAttribute("userPayMoneyList", userPayMoneyList);

List<UserTermFinancial> userTermFinancialList = userTermFinancialService.selectUserTermFinancialByUserId(userId);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 * 跳转到我的消息界面
* @param pageNum
* @param pageSize
* @param model
* @param session
* @return
*/
@RequestMapping("/user/personal/toMyInfo.html")
public String toMyInfo(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
Model model, HttpSession session) {
User loginUser = (User) session.getAttribute("loginUser");

PageHelper.startPage(pageNum, pageSize);
List<Info> list = infoService.selectInfoOrderByUserIdDesc(loginUser.getId());
PageInfo<Info> pageInfo = new PageInfo<Info>(list, 5);
model.addAttribute("infoPageInfo", pageInfo);
model.addAttribute("infoList", list);
model.addAttribute("pageTopBarInfo", "我的消息界面");
return "/user/personal/myinfo";
}

/**
* 更新消息(已读)
* @param id
* @return
*/
@PutMapping("/user/updateInfo/{infoId}")
@ResponseBody
public Msg updateInfo(@PathVariable("infoId") Integer id) {
Info info = infoService.selectInfoById(id);
info.setStatus(1);
Integer result = infoService.updateInfo(info);
if (result == 1) {
return Msg.success();
}
return Msg.fail();
}

/**
* 删除消息
* @param id
* @return
*/
@DeleteMapping("/user/deleteInfo/{infoId}")
@ResponseBody
public Msg deleteInfo(@PathVariable("infoId") Integer id) {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
@Controller
public class PayMoneyController {

@Autowired
PayMoneyService payMoneyService;
@Autowired
UserPayMoneyService userPayMoneyService;
@Autowired
FlowOfFundsService flowOfFundsService;

/**
* 跳转到工资理财界面
* @param model
* @return
*/
@RequestMapping("/user/finance/toPayMoney.html")
public String toPaymoney(Model model){
List<PayMoney> list = payMoneyService.selectAllPayMoney();
model.addAttribute("payMoneyList",list);
model.addAttribute("pageTopBarInfo","工资理财界面");
model.addAttribute("activeUrl1","financeActive");
model.addAttribute("activeUrl2","payMoneyActive");
return "/user/finance/paymoney";
}

/**
* 购买工资理财产品
* @param payMoneyId
* @param userId
* @return
*/
@PostMapping("/user/buyPayMoney")
@ResponseBody
public Msg buyPayMoney(@RequestParam("payMoneyId")Integer payMoneyId,
@RequestParam("userId") Integer userId ){
PayMoney pm = payMoneyService.selectPayMoneyById(payMoneyId);
UserPayMoney upm = new UserPayMoney();
upm.setUserid(userId);
upm.setPayid(payMoneyId);
upm.setStarttime(new Date());
upm.setAveryield(new BigDecimal("0.03123"));
upm.setProfit(new BigDecimal("0.03123").multiply(pm.getMonthmoney()));
upm.setStatus(1);
Integer result = userPayMoneyService.insertUserPayMoney(upm);
if (result==1){
FlowOfFunds fof = new FlowOfFunds();
fof.setUserid(userId);
fof.setFlowmoney(pm.getMonthmoney());
fof.setType(1);
fof.setSource("工资理财");
fof.setCreatetime(new Date());
if (pm.getType()==1){


项目链接:
https://javayms.github.io?id=421122512008200mz
https://javayms.pages.dev?id=421122512008200mz