首页 > 数据库 >基于spring boot+vue+mysql的电子招投标系统

基于spring boot+vue+mysql的电子招投标系统

时间:2024-09-20 18:21:27浏览次数:3  
标签:vue return spring boot user org import com public

结尾名片获取源码

开发语言:Java

框架:SpringBoot

持久化框架:Mybatis-plus

JDK版本:JDK1.8

服务器:tomcat7\8\9

数据库:mysql 5.7以上

数据库工具:Navicat11以上

开发软件:eclipse/myeclipse/idea

Maven:Maven3.5.4

浏览器:谷歌浏览器\Edge

功能描述

随着信息技术的不断发展,电子招投标系统已经成为了现代企业进行招标投标活动的重要工具。本文主要研究了一个基于SpringBoot+Vue+HTML+MySQL的电子招投标系统的设计与实现。该系统主要包括管理员、责任单位和供应商三种角色,涵盖了责任单位管理、供应商管理、招标分类管理、招标项目管理、在线投标管理、结果公示管理、中标公告管理、市场监督管理、帮助中心管理、新闻资讯管理和管理员管理等功能模块。

在后台管理员功能模块中,管理员可以对责任单位和供应商进行管理,同时还可以对招标项目进行分类管理和项目管理。此外,管理员还可以对在线投标活动进行管理,并对招标结果进行公示和中标公告发布。市场监督管理功能可以帮助管理员对市场进行有效监管,确保招投标活动的公平公正。帮助中心管理、新闻资讯管理和管理员管理等辅助功能则有助于提高系统的使用效率和用户体验。

在后台责任单位功能模块中,责任单位可以对招标项目进行管理,参与在线投标活动,并查看招标结果公示和中标公告。这些功能使得责任单位能够更加便捷地参与到招投标活动中,提高了工作效率。

在后台供应商功能模块中,供应商可以参与在线投标活动,并查看中标公告。这些功能使得供应商能够更加方便地了解招标信息,提高了参与度。

前台部分为责任单位和供应商提供了注册登录功能,用户可以通过前台查看系统首页、招标项目、结果公示、中标管理、市场监督、帮助中心、新闻资讯、业界资讯和个人中心等信息。通过前台展示的信息,用户可以更加直观地了解到招投标活动的相关信息,提高了信息的透明度。

功能展示

 

实现代码

Controller层


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();
    }
}

Dao层


package com.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.entity.UserEntity;

/**
 * 用户
 */
public interface UserDao extends BaseMapper<UserEntity> {
	
	List<UserEntity> selectListView(@Param("ew") Wrapper<UserEntity> wrapper);

	List<UserEntity> selectListView(Pagination page,@Param("ew") Wrapper<UserEntity> wrapper);
	
}

Server层


package com.service;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.IService;
import com.entity.UserEntity;
import com.utils.PageUtils;


/**
 * 系统用户
 */
public interface UserService extends IService<UserEntity> {
 	PageUtils queryPage(Map<String, Object> params);
    
   	List<UserEntity> selectListView(Wrapper<UserEntity> wrapper);
   	
   	PageUtils queryPage(Map<String, Object> params,Wrapper<UserEntity> wrapper);
	   	
}

package com.service.impl;


import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.dao.UserDao;
import com.entity.UserEntity;
import com.service.UserService;
import com.utils.PageUtils;
import com.utils.Query;


/**
 * 系统用户
 */
@Service("userService")
public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements UserService {

	@Override
	public PageUtils queryPage(Map<String, Object> params) {
		Page<UserEntity> page = this.selectPage(
                new Query<UserEntity>(params).getPage(),
                new EntityWrapper<UserEntity>()
        );
        return new PageUtils(page);
	}

	@Override
	public List<UserEntity> selectListView(Wrapper<UserEntity> wrapper) {
		return baseMapper.selectListView(wrapper);
	}

	@Override
	public PageUtils queryPage(Map<String, Object> params,
			Wrapper<UserEntity> wrapper) {
		 Page<UserEntity> page =new Query<UserEntity>(params).getPage();
	        page.setRecords(baseMapper.selectListView(page,wrapper));
	    	PageUtils pageUtil = new PageUtils(page);
	    	return pageUtil;
	}
}

权限验证

package com.interceptor;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;

import com.annotation.IgnoreAuth;
import com.entity.EIException;
import com.entity.TokenEntity;
import com.service.TokenService;
import com.utils.R;

/**
 * 权限(Token)验证
 */
@Component
public class AuthorizationInterceptor implements HandlerInterceptor {

    public static final String LOGIN_TOKEN_KEY = "Token";

    @Autowired
    private TokenService tokenService;
    
	@Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

        //支持跨域请求
        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
        response.setHeader("Access-Control-Max-Age", "3600");
        response.setHeader("Access-Control-Allow-Credentials", "true");
        response.setHeader("Access-Control-Allow-Headers", "x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization");
        response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));

        IgnoreAuth annotation;
        if (handler instanceof HandlerMethod) {
            annotation = ((HandlerMethod) handler).getMethodAnnotation(IgnoreAuth.class);
        } else {
            return true;
        }

        //从header中获取token
        String token = request.getHeader(LOGIN_TOKEN_KEY);
        
        /**
         * 不需要验证权限的方法直接放过
         */
        if(annotation!=null) {
        	return true;
        }
        
        TokenEntity tokenEntity = null;
        if(StringUtils.isNotBlank(token)) {
        	tokenEntity = tokenService.getTokenEntity(token);
        }
        
        if(tokenEntity != null) {
        	request.getSession().setAttribute("userId", tokenEntity.getUserid());
        	request.getSession().setAttribute("role", tokenEntity.getRole());
        	request.getSession().setAttribute("tableName", tokenEntity.getTablename());
        	request.getSession().setAttribute("username", tokenEntity.getUsername());
        	return true;
        }
        
		PrintWriter writer = null;
		response.setCharacterEncoding("UTF-8");
		response.setContentType("application/json; charset=utf-8");
		try {
		    writer = response.getWriter();
		    writer.print(JSONObject.toJSONString(R.error(401, "请先登录")));
		} finally {
		    if(writer != null){
		        writer.close();
		    }
		}
//				throw new EIException("请先登录", 401);
		return false;
    }
}

标签:vue,return,spring,boot,user,org,import,com,public
From: https://blog.csdn.net/Steve1122/article/details/142392138

相关文章

  • 【F153】基于Springboot+vue实现的无人智慧超市管理系统
    主营内容:SpringBoot、Vue、SSM、HLMT、Jsp、PHP、Nodejs、Python、爬虫、数据可视化、小程序、安卓app等设计与开发。收藏点赞不迷路,关注作者有好处项目描述本系统结合现今主流管理系统的功能模块以及设计方式进行分析,使用Java语言和Springboot框架进行开发设计,具体研究......
  • Vue 3 来读取和创建 Excel 文件
    在前端处理Excel文件(读取和创建)通常借助于一些第三方库,如 xlsx。以下是如何使用 xlsx 库在前端从Excel文件中读取数据以及创建并写入数据的详细步骤。1.安装xlsx库并导入npminstallxlsximport*asXLSXfrom'xlsx';2.创建并下载Excel文件直接上代码<but......
  • 1--SpringBoot外卖项目介绍及环境搭建 详解
    目录软件开发整体流程软件开发流程角色分工软件环境苍穹外卖项目介绍项目介绍产品原型技术选型开发环境搭建前端环境搭建后端环境搭建完善登录功能导入接口文档Swagger介绍使用方式常用注解软件开发整体流程软件开发流程需求分析:需求规则说明书、产品原......
  • vue2实现监听usb接口的扫码器,获取扫码数据。
    原理扫码枪本质就是一个快速输入+回车(注意:扫码输入法要设置英文,不然会乱码)全局安装importscannerfrom'./install';Vue.use(scanner);使用exportdefault{data(){return{items:[],//扫码结果isStart:false//是否开启扫码}......
  • 2024-09-20 如何去除vue前端框架upload组件中的缓存 ==》v-if+setTimeout
    在很多前端框架中的upload组件,比如arco-design的a-upload组件,在遍历渲染过程中会发现上传完成后,切换到另一个a-upload组件,它的图片会显示上一个a-upload组件的缓存 正常上传,然后点击红色,红色对应的图片应该被清空,实际上却并没有,如下解决方案:给a-upload组件加一个条件判断v-if......
  • Spring的启动流程
    Spring容器的启动流程是一个复杂的过程,涉及多个阶段和组件的协作。核心是ApplicationContext(如ClassPathXmlApplicationContext、AnnotationConfigApplicationContext等)接口的启动。通过对Spring启动流程的详细分析,可以更好地理解Spring是如何加载、解析、实例化、初始化并管理Bea......
  • vue解决history路由模式刷新重定向问题(apache服务器)
    问题:vue文件打包后部署到apache服务器下,vue在history路由模式时,访问www.xx.com/about路径时刷新会导致notfount页面,这是因为www.xx.com/about目录不存在于服务器。解决:apche服务器重写路由到www.xx.com/下。然后刷新可正常访问到about页面apache开启路由重写1、配置文件......
  • 基于Python+Vue开发的鲜牛奶订购管理系统
    项目简介该项目是基于Python+Vue开发的鲜牛奶订购管理系统(前后端分离),这是一项为大学生课程设计作业而开发的项目。该系统旨在帮助大学生学习并掌握Python编程技能,同时锻炼他们的项目设计与开发能力。通过学习基于Python的牛奶订购管理系统项目,大学生可以在实践中学习和提升自己......
  • 基于Python+Vue开发的反诈视频宣传管理系统
    项目简介该项目是基于Python+Vue开发的反诈视频宣传管理系统(前后端分离),这是一项为大学生课程设计作业而开发的项目。该系统旨在帮助大学生学习并掌握Python编程技能,同时锻炼他们的项目设计与开发能力。通过学习基于Python的反诈宣传管理系统项目,大学生可以在实践中学习和提升自......
  • 基于Python+Vue开发的美容预约管理系统
    项目简介该项目是基于Python+Vue开发的美容预约管理系统(前后端分离),这是一项为大学生课程设计作业而开发的项目。该系统旨在帮助大学生学习并掌握Python编程技能,同时锻炼他们的项目设计与开发能力。通过学习基于Python的美容诊所预约管理系统项目,大学生可以在实践中学习和提升自......