基于nodejs的在线跑腿管理系统

2023-10-26

末尾获取源码
开发语言:nodejs
框架:Express
数据库:MySQL5.7
数据库工具:Navicat 11

开发软件:Hbuilder / VS code
浏览器:edge / 谷歌


目录

一、项目简介

二、系统功能

三、系统项目截图

3.1前台首页

3.2后台管理

四、核心代码

4.1登录相关

4.2文件上传

4.3封装


一、项目简介

在线跑腿管理系统利用网络沟通、计算机信息存储管理,有着与传统的方式所无法替代的优点。比如计算检索速度特别快、可靠性特别高、存储容量特别大、保密性特别好、可保存时间特别长、成本特别低等。在工作效率上,能够得到极大地提高,延伸至服务水平也会有好的收获,有了网络,在线跑腿管理系统的各方面的管理更加科学和系统,更加规范和简便。


二、系统功能

本在线跑腿管理系统主要包括三大功能模块,即用户功能模块和管理员功能模块、跑腿人模块、用户模块。

(1)管理员模块:系统中的核心用户是管理员,管理员登录后,通过管理员来管理后台系统。主要功能有:首页、个人中心、用户管理、跑腿管理、服务类型管理、服务信息管理、跑腿接单管理、订单完成管理、订单评价管理、系统管理。 

(2)跑腿人:首页、个人中心、跑腿接单管理、订单完成管理、订单评价管理、在线交流管理。

(3)用户:首页、个人中心、服务信息管理、跑腿接单管理、订单完成管理、订单评价管理、在线交流管理。



三、系统项目截图

3.1前台首页

 

 

 

 

 

 

3.2后台管理


四、核心代码

4.1登录相关


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

4.2文件上传

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

4.3封装

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

基于nodejs的在线跑腿管理系统 的相关文章

  • 如何在 AWS CDK 堆栈中压缩 Node Lambda 依赖项?

    我正在使用 CDK 通过 API Gateway Lambda 和 DynamoDB 创建一个简单的无服务器项目 到目前为止看起来很酷 但是当我向 Lambda 添加外部依赖项时出现以下错误 Runtime ImportModuleErro
  • 使用 Node.JS 客户端库插入 Google Analytics 内容实验

    我正在尝试使用 Node js 客户端库配置内容实验 但无法计算出语法 我应该将主体 实验资源 放置在哪里 如此处所述 https developers google com analytics devguides config mgmt
  • iOS - App Store - 更改订阅的到期日期

    我想使用 Play 商店 API 更改 Play 商店中订阅的到期日期 我有一个移动应用程序 您可以在其中购买续订应用商店订阅或者您可以从应用程序中的促销活动中免费获得一些时间 这里的主要问题是如果您已从 App Store 购买了订阅 并
  • Servlet 包含 Tomcat 中的 HTTP 标头

    我有一个 servlet 它的请求调度程序包含另一个 servlet 包含的 servlet 设置了我想在包括小服务程序 因此 我在 include 方法中传入一个自定义 HTTPResponse 对象 该对象捕获来自 servlet 的所
  • Java 中修剪字符串的可能前缀

    I have String str 我想从中提取不包括可能的前缀的子字符串 abc 我想到的第一个解决方案是 if str startsWith abc return str substring abc length return str
  • Java心跳设计

    我需要在我的 Java 项目上实现一个心跳系统 3 5 个客户端和 1 个服务器 但我有一些问题 1 客户端需要有 2 个套接字吗 1 用于心跳 1 用于接收我的软件的正常消息 2 我看到在特定情况下 当客户端滞后时 客户端不会收到消息 如
  • Swing 是否支持 Windows 7 风格的文件选择器?

    我刚刚添加了一个标准 打开文件 与我正在编写的一个小型桌面应用程序的对话 基于JFileChooserSwing 教程的入口 http download oracle com javase tutorial uiswing componen
  • Vagrant 提供,无法启动 grunt

    我正在尝试让 vagrant 安装 nodejs 正常运行所需的所有内容 然后在节点项目的根文件夹上执行 nohup grunt server 之后 我期望服务器在端口 3030 上侦听 但事实并非如此 如果在配置后我这样做 流浪者 ssh
  • Selenium 2:中断页面加载

    我在使用 FirefoxDriver 使用 Selenium 2 0b3 Java API 单击按钮时遇到问题 单击该按钮会将表单发送到网络服务器 然后浏览器会因表单提交而进入新页面 当使用 element click 单击某个元素时 se
  • XmlAdapter 到 JAXB 绑定 Joda 的时间间隔?

    我已经被 Web 服务的 JAXB 绑定问题困扰了几个小时 为了准备一个必须返回 Joda Time 类实例 即时 持续时间 间隔等 的更大的 Web 服务 我从一个只有一个返回 Interval 的方法的 Web 服务开始 package
  • Java中的字符算术

    在玩的过程中 我遇到了一些对我来说似乎很奇怪的事情 以下不是有效的 Java 代码 char x A x x 1 possible loss of precision 因为其中一个操作数是整数 所以另一个操作数被转换为整数 结果无法分配给字
  • Sails.js 升级到 v1 反向区分大小写查询

    升级到 sails v1 后 控制器中的所有请求都变得区分大小写 尽管这是预料之中的 但在这里评论道 https sailsjs com documentation concepts models and orm models case s
  • 如果表不存在,如何使用 Derby Db 创建表

    我是新来的apache derby我似乎无法工作 CREATE TABLE IF NOT EXISTS table1 可以实现MySql等等我得到了 Syntax error Encountered NOT at line 1 column
  • 如何从java程序中编译.java文件[重复]

    这个问题在这里已经有答案了 可能的重复 从 Java 内部编译外部 java 文件 https stackoverflow com questions 10889186 compiling external java files from
  • 使用java服务中的Zxing库从单个图像文件中读取多个条形码

    您好 我已经创建了一个java服务 用于从此处的图像中读取条形码 我使用Zxing库来解码此处的文本 挑战是 如果一个带有单个条形码的文件工作正常 如果有多个条形码 它会产生不相关的结果 我在下面给出了我的代码 pom xml
  • 如何在 Selenium 中定位具有特定文本的跨度? (使用Java)

    我在使用 java 查找 Selenium 中的 span 元素时遇到问题 HTML 看起来像 div class settings padding span Settings span div 我尝试了以下方法但没有成功 By xpath
  • 尝试将过滤器添加到 Grizzly+Jersey 应用程序时出现问题

    我有这个服务器初始化类 package magic app main import org glassfish grizzly http server HttpServer import org glassfish jersey grizz
  • Java:如何复制对象数组?

    现在 我有一个 Point 对象数组 我想制作一个COPY该数组的 我尝试过以下方法 1 Point temp mypointarray 2 Point temp Point mypointarray clone 3 Point temp
  • 将 csv 解析输出保存到变量

    我是使用 csv parse 的新手 项目 github 中的这个示例满足了我的需要 但有一个例外 我不想通过 console log 输出 而是想将数据存储在变量中 我尝试将 fs 行分配给变量然后返回data而不是记录它 但这只是返回了
  • Android:如何获取小数点后的两位数?不想截断值

    如何获取小数点后仅两位数的双精度值 例如 如果 a 190253 80846153846 那么结果值应该像 a 190253 80 尝试 我尝试过这个 public static DecimalFormat twoDForm new Dec

随机推荐

  • Eclipse环境下通过Cygwin使用NDK编译jni程序

    一 认识Cygwin NDK和jni 首先来认识一下什么是Cygwin NDK和jni Cygwin Cygwin是一个在windows平台上运行的unix模拟环境 它对于学习unix linux操作环境 或者从unix到windows的应
  • java 动态生成 visio----aspose.diagram for java

    最近在鼓捣java 如何生成visio图表 苦于没有API 找到了aspose这个神器 下载试用版本之后 发现最多只能生成10个元素 而且有水印 下面尝试如何去掉水印与元素限制 本文章所涉及的软件均可从网上获取 但是只能用于学习之用 不能用
  • idea使用http客户端上传文件

    controller 文件上传 param file return PostMapping value fileUpload ResponseBody public String uploadSkuImage RequestParam fi
  • 初始C语言——从大到小排序

    三个数的排序 三个数之间两两比较类似于三个数中显示最大值 两两比较 但是有一个问题 最大值问题只需要输出最大值即可而排序问题则还要排序 那么我们是否可以确定三个位置x y z将最大值依次赋值给x y z确保输出时x y z的位置是从左到右输
  • 真二次元!动漫形象风格迁移

    点击上方 机器学习与生成对抗网络 关注星标 获取有趣 好玩的前沿干货 文章 机器之心 一张输入人脸图像 竟能生成多样化风格的动漫形象 伊利诺伊大学香槟分校的研究者做到了 他们提出的全新 GAN 迁移方法实现了 一对多 的生成效果 在 GAN
  • 【JVM】JVM-codecache内存区域介绍

    1 概述 转载 https leokongwq github io 2016 10 12 maven test html 2 JVM codecache内存区域介绍 大家都知道JVM在运行时会将频繁调用方法的字节码编译为本地机器码 这部分代
  • 网络层_数据平面_四(题目完成)

    网络 引入网络层学习 分组交换 虚电路VC 数据报网络 CIDR DHCP 路由器 IP数据报格式 IPv4 IPv6 过渡策略 双栈 隧道 特殊IP地址即内部IP地址 流表中匹配 动作 计算机自顶向下方法 第七版课后习题及答案 正在更新中
  • 论文解读:Investigating the Factual Knowledge Boundary of Large Language Models with Retrieval Augmentati

    论文解读 Investigating the Factual Knowledge Boundary of Large Language Models with Retrieval Augmentation 一 动机 Knowledge in
  • C++ 智能指针我得用用看

    文章目录 0 前言 0 1 使用智能指针的原因 0 2 智能指针和普通指针的区别 什么是智能指针 1 auto ptr 1 1 基本说明 1 2 例子 chestnut 1 3 使用建议 3 unique ptr 3 1 实现原理 3 2
  • [游戏开发]网络同步方式

    状态同步 优点 数据在服务器运算 客户端接收到的数据一定准确 防止数据作弊 角色数据在服务器 客户端只上传操作 想作弊没门 网络波动不敏感 多端表现可以不一致 重视数值准确 缺点 前后端数据包体大 服务器压力比较重 计算量 传输量 研发特点
  • java中冒号(:)的用法

    java中冒号的用法大概可以分为四种 用在for循环中 用来遍历数组 集合 中的元素 for x nums print x 用在三目运算符中 表达式 执行语句1 执行语句2 这里的冒号是用来根据前面表达式的值正确与否 选择后面对应执行语句的
  • 多线程实现的方式

    1 继承Thread类 通过继承Thread类 并重写run方法 public class MyThread extends Thread public static void main String args MyThread myThr
  • sudo vim找不到命令(Ubuntu16.04)

    在使用vim配置环境变量时 提示 sudo vim 找不到命令 原因是因为没有安装vim 下面我们就来在终端进行安装一下 前提是需要连上网了 没有联网不在此考虑范围 1 进入终端 Ctrl Alt T 出现终端窗口 2 输入命令 sudo
  • Linux:WSL 下 CTS 环境搭建及无法识别设备问题

    WSL Windows Subsystem for Linux 简称WSL 是一个在Windows 10上能够运行原生Linux二进制可执行文件 ELF格式 的兼容层 它是由微软与Canonical公司合作开发 其目标是使纯正的Ubuntu
  • mysql [Err] 1118 - Row size too large (> 8126).

    错误代码 1118 Row size too large gt 8126 Changing some columns to TEXT or BLOB may help In current row format BLOB prefix of
  • 获取服务器系统,获取服务器操作系统

    获取服务器操作系统 内容精选 换一换 服务器安装上架 服务器基础参数配置 安装操作系统等操作请参见 Atlas 500 Pro 智能边缘服务器 用户指南 型号 3000 安装操作系统完成后 配置业务网口IP地址 请参见配置网卡IP地址 At
  • arduinows2812灯条程序_Arduino 控制WS2812 LED灯条

    传统的LED限制总是很多 比如需要很多的引脚 所以有一种很好的解决方案是用灯条 理论上这种灯条可以通过通讯 用一根数据总线可以控制达到无上限个数的RGB LED灯珠 并且在数量在1024以下时 延迟是不可察觉的 使用手册可查 主要功能 通过
  • Day 3 Mastering the Interface Definition Language (IDL)

    Teach Yourself CORBA In 14 Days Day 3Mastering the Interface Definition Language IDL Overview IDL Ground Rules Case Sens
  • momentJS时间加减处理

    计算最近在使用JavaScript计算时间差的时候 发现很多问题需要处理 在查看momentJS之后 发现非常容易 console log moment format YYYY MM DD HH mm ss 当前时间 console log
  • 基于nodejs的在线跑腿管理系统

    末尾获取源码 开发语言 nodejs 框架 Express 数据库 MySQL5 7 数据库工具 Navicat 11 开发软件 Hbuilder VS code 浏览器 edge 谷歌 目录 一 项目简介 二 系统功能 三 系统项目截图