基于SSM的基金投资交易管理网站的设计与实现

news2024/9/21 16:35:26

末尾获取源码
开发语言:Java
Java开发工具:JDK1.8
后端框架:SSM
前端:采用JSP技术开发
数据库:MySQL5.7和Navicat管理工具结合
服务器:Tomcat8.5
开发软件:IDEA / Eclipse
是否Maven项目:是


目录

一、项目简介

二、系统功能

三、系统项目截图

管理员功能实现

基金管理

基金净值管理

用户管理

 论坛管理

公告信息管理

用户功能实现

基金信息

 在线论坛

持有基金管理

交易记录管理

四、核心代码

登录相关

文件上传

封装


一、项目简介

计算机网络发展到现在已经好几十年了,在理论上面已经有了很丰富的基础,并且在现实生活中也到处都在使用,可以说,经过几十年的发展,互联网技术已经把地域信息的隔阂给消除了,让整个世界都可以即时通话和联系,极大的方便了人们的生活。所以说,基金投资交易管理网站用计算机技术来进行设计,不仅在管理方面更加的系统化,操作性强,最重要的是关于数据的保存和使用都能节约大量的时间,该系统非常的好用。

基金投资交易管理网站管理数据的工具是MySQL,编码的语言是Java,运用的框架是SSM框架。该系统的目标用户包括管理员,用户。管理员的功能包括管理基金,管理基金净值,管理基金自选,管理持有基金,管理交易记录,管理论坛帖子,管理公告等。用户的功能包括购买基金,查看基金净值,查看基金经理,把基金添加自选,卖出持有基金,查看基金交易记录等。

基金投资交易管理网站不仅能让操作人员使用更加地方便,并且设计的也很合理,能有效的避免误操作,让数据在录入的环节就符合设计需要,极大的规避了源头性的输入误差,顺利的让数据变得更加可控并且可靠,让出错的几率降到最低。


二、系统功能

对管理员具体功能的设计结果将以图4.1所示的管理员功能结构图来进行体现。管理员对于基金投资交易管理网站操作的功能包括管理基金,管理基金净值,管理基金自选,管理持有基金,管理交易记录,管理论坛帖子,管理公告等。

 对用户具体功能的设计结果将以图4.2所示的用户功能结构图来进行体现。用户对于基金投资交易管理网站操作的功能包括购买基金,查看基金净值,查看基金经理,把基金添加自选,卖出持有基金,查看基金交易记录等。

 



三、系统项目截图

管理员功能实现

基金管理

该功能主要用于实现对基金基本信息的管理,基金管理界面的运行效果见图5.1。在此界面,管理员下架基金,修改基金信息,可以添加新的基金信息。其中基金信息包括基金代码,基金风险类型,基金名称等信息。

 

基金净值管理

该功能主要用于实现对基金净值基本信息的管理,基金净值管理界面的运行效果见图5.2。在此界面,管理员修改基金净值信息,可以添加基金净值信息,基金净值包括基金类型,基金名称,基金代码,净值等信息。

 

用户管理

该功能主要用于实现对用户基本信息的管理,用户管理界面的运行效果见图5.3。在此界面,管理员删除用户,查询用户,新增用户等。

 

 论坛管理

该功能主要用于实现对论坛帖子基本信息的管理,论坛管理界面的运行效果见图5.4。在此界面,管理员查看帖子内容以及发帖时间,查看帖子回复信息,可以批量删除帖子。

 

公告信息管理

该功能主要用于实现对公告基本信息的管理,公告信息管理界面的运行效果见图5.5。在此界面,管理员增删改查公告信息。

 

用户功能实现

基金信息

基金信息界面的运行效果见图5.6。在此界面,用户查看基金的详细内容,查看该基金的基金经理信息,可以把本界面的基金添加自选,可以购买本界面的基金。

 

 在线论坛

在线论坛界面的运行效果见图5.7。在此界面,用户查看论坛帖子,发布帖子,评论查看的帖子。

 

持有基金管理

持有基金管理界面的运行效果见图5.8。在此界面,用户查看自己购买的基金信息,可以对自己持有的基金进行卖出操作。

 

交易记录管理

交易记录管理界面的运行效果见图5.9。在此界面,用户查看所有卖出基金的交易记录信息以及买入基金的交易记录信息等。可以通过基金名称获取该基金的交易记录信息等,可以批量删除基金的交易记录信息等。

 


四、核心代码

登录相关


package com.controller;


import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;

/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UserController{
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private TokenService tokenService;

	/**
	 * 登录
	 */
	@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}
	
	/**
	 * 注册
	 */
	@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

	/**
	 * 退出
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
	
	/**
     * 列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UserEntity user){
        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
    	PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/list")
    public R list( UserEntity user){
       	EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
      	ew.allEq(MPUtil.allEQMapPre( user, "user")); 
        return R.ok().put("data", userService.selectListView(ew));
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//全部更新
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

文件上传

package com.controller;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;

/**
 * 上传文件映射表
 */
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File path = new File(ResourceUtils.getURL("classpath:static").getPath());
		if(!path.exists()) {
		    path = new File("");
		}
		File upload = new File(path.getAbsolutePath(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}
	
	/**
	 * 下载文件
	 */
	@IgnoreAuth
	@RequestMapping("/download")
	public ResponseEntity<byte[]> download(@RequestParam String fileName) {
		try {
			File path = new File(ResourceUtils.getURL("classpath:static").getPath());
			if(!path.exists()) {
			    path = new File("");
			}
			File upload = new File(path.getAbsolutePath(),"/upload/");
			if(!upload.exists()) {
			    upload.mkdirs();
			}
			File file = new File(upload.getAbsolutePath()+"/"+fileName);
			if(file.exists()){
				/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
					getResponse().sendError(403);
				}*/
				HttpHeaders headers = new HttpHeaders();
			    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    
			    headers.setContentDispositionFormData("attachment", fileName);    
			    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

封装

package com.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * 返回数据
 */
public class R extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	
	public R() {
		put("code", 0);
	}
	
	public static R error() {
		return error(500, "未知异常,请联系管理员");
	}
	
	public static R error(String msg) {
		return error(500, msg);
	}
	
	public static R error(int code, String msg) {
		R r = new R();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}

	public static R ok(String msg) {
		R r = new R();
		r.put("msg", msg);
		return r;
	}
	
	public static R ok(Map<String, Object> map) {
		R r = new R();
		r.putAll(map);
		return r;
	}
	
	public static R ok() {
		return new R();
	}

	public R put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1365909.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Java学习笔记(五)——时间相关类

文章目录 JDK7以前时间相关类Date 时间类阅读源码练习 SimpleDateFormat 格式化时间作用构造方法常用方法日期和时间模式练习 Calendar 日历获取Calendar对象的方法Calendar常用方法 JDK8新增时间相关类变化Date类ZoneId&#xff1a;时区Instant&#xff1a;时间戳ZoneDateTime…

ECharts 实现省份在对应地图的中心位置

使用 ECharts 下载的中国省市区的json文件不是居中的(如下图所示)&#xff0c;此时需要修改json文件中的 cp 地理位置&#xff0c;设置成每个省份的中心位置 {"type": "FeatureCollection","features":[{ "type": "Feature"…

C++ 手写堆 || 堆模版题:堆排序

输入一个长度为 n 的整数数列&#xff0c;从小到大输出前 m 小的数。 输入格式 第一行包含整数 n 和 m 。 第二行包含 n 个整数&#xff0c;表示整数数列。 输出格式 共一行&#xff0c;包含 m 个整数&#xff0c;表示整数数列中前 m 小的数。 数据范围 1≤m≤n≤105 &…

护眼灯色温多少合适?盘点合适色温的护眼台灯

有了孩子&#xff0c;就等于同时有了软肋和铠甲&#xff0c;也总是在自己的能力范围内&#xff0c;把最好的东西给他。当孩子开始学习知识后更是如此&#xff0c;能力范围内最好的教育资源、最好的学习环境&#xff0c;以及各种与之配套的学习用具。护眼台灯在这时候就安排上了…

热钱涌向线控底盘!XYZ全栈集成引领新风向

在车身、底盘部分&#xff0c;中央计算区域控制带动传统车控、底盘及动力控制ECU市场迎来新一轮技术升级和域融合窗口期。线控制动、转向及空气悬架&#xff0c;正在加速与智能驾驶融合并进一步提升驾乘体验。 12月13-15日&#xff0c;2023&#xff08;第七届&#xff09;高工…

插画新手必看!13个免费UI插画素材网站,轻松打造炫酷设计!

即时设计 作为一个专业的设计网站&#xff0c;即时设计在很多情况下也可以作为一个高质量的插图网站使用。它可以为用户提供近5万个设计材料和模板&#xff0c;其中插图占据了很大的空间&#xff0c;可以为用户的设计提供很多帮助。在搜索插图材料的同时&#xff0c;还可以获取…

强化学习7——价值迭代算法在强化学习中的应用

价值迭代算法 价值迭代算法相对于策略迭代更加直接&#xff0c;它直接根据以下公式来迭代更新。 V ∗ ( s ) max ⁡ a ∈ A { r ( s , a ) γ ∑ s ′ ∈ S P ( s ′ ∣ s , a ) V ∗ ( s ′ ) } V^*(s)\max_{a\in\mathcal{A}}\{r(s,a)\gamma\sum_{s\in\mathcal{S}}P(s|s,…

二叉树的深度和高度问题(算法村第八关白银挑战)

二叉树的最大深度 104. 二叉树的最大深度 - 力扣&#xff08;LeetCode&#xff09; 给定一个二叉树 root &#xff0c;返回其最大深度。 二叉树的 最大深度 是指从根节点到最远叶子节点的最长路径上的节点数。 示例 1&#xff1a; 输入&#xff1a;root [3,9,20,null,null…

爱奇艺的cmd5x签名校验算法及视频下载

点击上方↑↑↑蓝字[协议分析与还原]关注我们 “ js分析&#xff0c;分析爱奇艺的cmd5x校验值。” 最近来了个从web网页自动下载爱奇艺的视频内容的需求&#xff0c;本以为很简单&#xff0c;却发现里面还是有些门道的&#xff0c;需要解决里面的校验的问题&#xff0c;特记录。…

Unity C# 枚举多选

枚举多选 &#x1f96a;例子&#x1f354;判断 &#x1f96a;例子 [System.Flags]public enum TestEnum{ None 0,Rooms 1 << 1,Walls1<<2,Objects1<<3,Slabs 1 << 4,All Rooms|Walls|Objects|Slabs}&#x1f354;判断 TestEnum test TestEnum.R…

(一)看参考手册学stm32基于hal库,点灯时钟配置

&#xff08;一&#xff09;看参考手册学stm32基于hal库&#xff0c;点灯时钟配置 这篇文章主要是个人的学习经验&#xff0c;想分享出来供大家提供思路&#xff0c;如果其中有不足之处请批评指正哈。 废话不多说直接开始主题&#xff0c;本人是基于STM32F407VET6芯片&#xf…

解析电商直播发展现状:成都天府锋巢直播基地能做什么?

近日&#xff0c;电商巨浪席卷过后&#xff0c;千舟如何“再”过万重山&#xff0c;已成为无数电商从业者的一轮新课题。成都新兴直播基地——天府锋巢直播产业基地&#xff0c;正在致力于打造一个包含电商直播、娱乐直播、跨境直播等多种直播业态的全域直播基地。新一轮直播业…

80/20法则-扫盲和复习篇

80/20法则-扫盲和复习篇 一、80/20法则二、对于目标三、时间管理应用四、“二八定律”基本内容总结 一、80/20法则 “80/20法则”是20世纪初意大利统计学家、经济学家维尔弗雷多帕累托提出的&#xff0c;他指出&#xff1a;在任何特定群体中&#xff0c;重要的因子通常只占少数…

基于spark的个性化招聘推荐系统

介绍 本就业推荐系统是一个基于Spark框架的个性化推荐平台&#xff0c;使用Python Django框架、Vue和Element-Plus UI组件库构建而成。该系统通过Scrapy爬虫框架抓取招聘网站的职位数据&#xff0c;用户可以根据关键词查询符合条件的职位信息&#xff0c;同时还提供了基于协同…

线性渐变linear-gradient——线性渐变实现虚线斜线条纹

1.效果图 2.html <div class"box"><div class"address-edit"></div></div> 3.css <style>*{margin: 0;padding: 0;}.box{position: relative;width: 100vw;height: 300px;background-color: #fff;}.address-edit::before…

结构体(structure)的认识

前言——————希望现在在努力的各位都能感动以后享受成功的自己&#xff01; 今天我们来了解了解一下结构体&#xff0c;结构体又有什么奥妙呢&#xff0c;废话不多说&#xff0c;何为结构体呢&#xff1f;------->结构是⼀些值的集合&#xff0c;这些值称为成员变量。结…

leetcode:滑动窗口

目录 1.定长滑动窗口 1.1 几乎唯一子数组的最大和(使用map来计数) 1.2 长度为k子数组中的最大和 2.不定长滑动窗口 2.1 最多k个重复元素的最长子数组 2.2 绝对差不超过限制的最长连续子数组(multiset&#xff09; 2.3 将x减到0的最小操作数(正难则反 逆向思维) 2.4 统计…

分布式架构那些事儿

今天给大家搬运一波福利&#xff0c;那就是分布式架构那些事&#xff01;说到分布式架构&#xff0c;你是不是觉得高大上、遥不可及&#xff1f;别慌&#xff0c;我会讲得通俗易懂&#xff0c;让你秒变架构大神&#xff01;听完之后直接带回家装逼&#xff01;一起来Get新知识&…

< Linux >缓冲区

在上一篇文件的重定向&#xff0c;通常会涉及文件描述符的操控。文件描述符1&#xff08;fd 1&#xff09;通常代表着标准输出&#xff08;stdout&#xff09;&#xff0c;它默认是指向用户的终端或控制台。当执行文件重定向操作时&#xff0c;如果我们关闭文件描述符1&#xf…

SurfaceFlinger的commit/handleTransaction分析

整体背景介绍 hi&#xff0c;粉丝朋友们&#xff1a; 大家好&#xff01;本节我们来讲解一下SurfaceFlinger主要合成工作的第一个阶段任务commit 一般SurfaceFlinger端的合成工作主要有两个 1.commit 主要就是处理app端发起的一系列transaction的事务请求&#xff0c;需要对这…