基于SSM的客户管理系统设计与实现

2023-11-18

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


目录

一、项目简介

二、系统设计

系统功能结构设计

三、系统项目截图

员工管理

考勤管理

客户管理

系统公告管理

四、核心代码

4.1登录相关

4.2文件上传

4.3封装


一、项目简介

现代经济快节奏发展以及不断完善升级的信息化技术,让传统数据信息的管理升级为软件存储,归纳,集中处理数据信息的管理方式。本客户管理系统就是在这样的大环境下诞生,其可以帮助管理者在短时间内处理完毕庞大的数据信息,使用这种软件工具可以帮助管理人员提高事务处理效率,达到事半功倍的效果。此客户管理系统利用当下成熟完善的SSM框架,使用跨平台的可开发大型商业网站的Java语言,以及最受欢迎的RDBMS应用软件之一的Mysql数据库进行程序开发。实现了客户基础数据的管理,员工管理,考勤管理,公告信息的发布等功能。客户管理系统的开发根据操作人员需要设计的界面简洁美观,在功能模块布局上跟同类型网站保持一致,程序在实现基本要求功能时,也为数据信息面临的安全问题提供了一些实用的解决方案。可以说该程序在帮助管理者高效率地处理工作事务的同时,也实现了数据信息的整体化,规范化与自动化。


二、系统设计

客户管理系统的设计方案比如功能框架的设计,比如数据库的设计的好坏也就决定了该系统在开发层面是否高效,以及在系统维护层面是否容易维护和升级,因为在系统实现阶段是需要考虑用户的所有需求,要是在设计阶段没有经过全方位考虑,那么系统实现的部分也就无从下手,所以系统设计部分也是至关重要的一个环节,只有根据用户需求进行细致全面的考虑,才有希望开发出功能健全稳定的程序软件。

系统功能结构设计

在分析并得出使用者对程序的功能要求时,就可以进行程序设计了。如下图展示的就是管理员功能结构图,管理员主要负责填充图和其标签类别和地区类别信息,并对已填充的数据进行维护,包括修改与删除,管理员也需要添加客户标签和客户地区等。



三、系统项目截图

员工管理

员工管理页面,此页面提供给管理员的功能有:添加员工,修改员工,删除员工。

考勤管理

员工管理页面,此页面提供给管理员的功能有:查看考勤记录。

 

客户管理

客户管理页面,此页面提供给管理员的功能有:新增客户,修改客户信息,删除客户信息,查看客户信息,根据性别统计客户,根据地区统计客户。

 

系统公告管理

系统公告管理页面,此页面提供给管理员的功能有:新增系统公告,查看系统公告,删除系统公告。

 


四、核心代码

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(使用前将#替换为@)

基于SSM的客户管理系统设计与实现 的相关文章

随机推荐

  • APP漏洞挖掘(二)同开发商的多款APP存在通用漏洞

    0x01 前言 测某一APP时 根据信息收集 测试 发现APP的后台系统存在SQL注入 XSS 弱口令 信息泄漏等漏洞 此APP本身存在逻辑漏洞与SQL注入漏洞 再通过观察酷传搜索的结果发现此APP开发商开发了三十几个APP 猜测可能存在相
  • video-09-video音频视频 进度条无法正常使用问题

    开发过程中遇到了 进度条无法使用 吓我一跳 还以为是开发有问题呢 目录 一 现象 二 原因 三 解决 一 现象 网页播放器能够正常播放文件 但是播放器的进度条只能显示进度 没办法拖动 二 原因 视频url链接缺少响应头 三 解决 https
  • Allegro整体旋转

    1 激活MOVE命令 然后在Options栏Point选择User Pick 在Find栏勾上所有ALL ON 2 空白处 右击选中Temp Group 3 选中要旋转的部分 右击选中Complete 4 点击一点作为User Pick旋转
  • spi总线之通信原理及linux驱动读写实现

    一 SPI简介 1 SPI 全称SerialPerripheral Interface 也就是串行外围设备接口 是一种高速全双工穿的同步通信总线 SPI时钟频率相比I2C要高得多 最高可以达到上百MHz SPI以主从方式工作 通常是一个主设
  • CM4 启用SPI6(cs0)

    vim boot config txt dtparam spi on dtoverlay spi6 1cs cs0 pin 18
  • VS2022+PCL1.13.0配置保姆级教程

    文章目录 VS2022 PCL1 13 0配置保姆级教程 参考博客 1 VS和PCL的下载与安装 2 配置pcl环境变量 3 配置VS项目 属性 3 1 C C 常规 SDL检查 否 3 2 C C 语言 符合模式 否 3 3 C C 语言
  • 【blender】基础操作

    blender基础操作 相机视角跟随移动 n 打开右侧工具栏 视图 锁定相机到视图 进入四视图视角 ctrl alt q 选中物体进入合适观察视角 聚焦 物体回到世界中心 alt g 物体沿y轴移动6m g y 6 物体在xy平面上移动 g
  • Angular1.x规范

    原文地址 https github com johnpapa angular styleguide tree master a1 Angular规范 Angular Team Endorsed 非常感谢领导Angular团队的Igor Mi
  • python绘制混淆矩阵

    之前就了解过混淆矩阵 但是一直没有实践 今天刚好有数据实践一下 这里记录一下代码实现过程 方便以后查阅 python绘制混淆矩阵 matplotlib实现 sklearn实现 sklearn metrics ConfusionMatrixD
  • 我也来一个“羊了个羊”

    演示以及原理讲解 源码地址 https gitee com 13026118978 sheep asheep 实现 1 定义变量 动物数组 const animals export const configData animals 动物数组
  • JAVA中的权限限定修饰符

    今日份鼓励 改变世界的根本是在改变自己 目录 一 访问权限修饰符 二 public修饰符 三 protected修饰符 四 不使用修饰符 默认修饰符 五 private修饰符 六 类的访问修饰符不使用private与protected的原因
  • HTML5-单、多选框,按钮

    属性 说明 type 指定元素的类型 text password checkbox radio submit reset file hidden image和button 默认为text name 指定表单元素的名称 value 元素的初始
  • Qt的Line使用

    当使用Qt设计师拖动 Horizontal Line 或 Vertical Line 来作为widget的分割线时 如果要给分割线设置颜色并让其生效 必须设置 frameShadow 属性为 Plain 同时使用样式表设置该分割线的颜色为指
  • 培训Python三个月拿高薪?起底人工智能“速成班”忽悠大法

    python基础教程www pythonf com 学完Python 可以上天 零基础入门 小白三天也能学会 近期 社会上兴起了各种人工智能 速成 班 声称可以通过几个月的学习 实现 转行 和人生逆袭 记者调查发现 这类机构往往存在讲师资质
  • h5 canvas绘制网络图片并导出

    html部分
  • win11 安装arcgis 10.8 arcMap 发生错误无法启动

    今天安装arcgis 10 5与arcGIS 10 8 遇到 arcMap 无法启动 弹窗应用程序出现错误 无法启动 期间百度google了各种 从删文档模板 改python2 7注册名 删安装目录文件等各种操作均无效 后面根据GIS知乎的
  • 爬虫实战(二):Selenium 模拟登录并爬取信息

    前叙 系列文章 爬虫实战 一 爬取微博用户信息 爬虫实战 二 Selenium 模拟登录并爬取信息 爬虫实战 三 微博用户信息分析 该系列文章介绍了什么 1 爬虫分析和处理方法 2 Python中的数据库操作方法 3 Selenium浏览器
  • java 实现mysql 数据源 迁移_Java敏捷数据库迁移框架——Flyway

    看看自己的项目的那些SQL文件或者干脆连个建表语句都没有的同学是否会有想法把他们管理起来呢 向大家推荐一款非常轻量级的敏捷数据库迁移框架 Flyway 想知道她有什么魅力吗 Flyway为大家提供了如下的实现方式 Java API 命令行
  • OPT-IML:Scaling Language Model Instruction MetaLearning through the Lens of Generalization 论文阅读笔记

    OPT IML Scaling Language Model Instruction MetaLearning through the Lens of Generalization 从泛化的角度使用指令元学习扩展语言模型 开源模型 目前在h
  • 基于SSM的客户管理系统设计与实现

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