Java项目:56 ssm681基于Java的超市管理系统+jsp

作者主页:源码空间codegym

简介:Java领域优质创作者、Java项目、学习资料、技术互助

文中获取源码

项目介绍

功能包括:商品分类,供货商管理,库存管理,销售统计,用户及角色管理,等等功能。项目采用maven聚合的SSM框架。

环境要求

1.运行环境:最好是java jdk1.8,我们在这个平台上运行的。其他版本理论上也可以。

2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;

3.tomcat环境:Tomcat7.x,8.X,9.x版本均可

4.硬件环境:windows7/8/10 4G内存以上;或者Mac OS;

5.是否Maven项目:是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven.项目

6.数据库:MySql5.7/8.0等版本均可;

技术栈

运行环境:jdk8 + tomcat9 + mysql5.7 + windows

服务端技术:Spring Boot+ Mybatis +VUE

使用说明

1.使用Navicati或者其它工具,在mysql中创建对应sq文件名称的数据库,并导入项目的sql文件;

2.使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;

3.将项目中config-propertiesi配置文件中的数据库配置改为自己的配置,然后运行;

运行指导

idea导入源码空间站顶目教程说明(Vindows版)-ssm篇:

http://mtw.so/5MHvZq

源码地址:http://codegym.top

运行截图

文档截图微信截图_20240308155356

项目截图

图片47

图片48

图片49

代码


package com.controller;import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;/*** 绩效* 后端接口* @author* @email
*/
@RestController
@Controller
@RequestMapping("/jixiao")
public class JixiaoController {private static final Logger logger = LoggerFactory.getLogger(JixiaoController.class);private static final String TABLE_NAME = "jixiao";@Autowiredprivate JixiaoService jixiaoService;@Autowiredprivate TokenService tokenService;@Autowiredprivate DictionaryService dictionaryService;//字典表@Autowiredprivate GonggaoService gonggaoService;//公告@Autowiredprivate JintieService jintieService;//津贴@Autowiredprivate XinziService xinziService;//套账@Autowiredprivate YuangongService yuangongService;//用户@Autowiredprivate YuangongKaoqinService yuangongKaoqinService;//员工考勤@Autowiredprivate YuangongKaoqinListService yuangongKaoqinListService;//员工考勤详情@Autowiredprivate UsersService usersService;//管理员/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永不会进入");else if("用户".equals(role))params.put("yuangongId",request.getSession().getAttribute("userId"));CommonUtil.checkMap(params);PageUtils page = jixiaoService.queryPage(params);//字典表数据转换List<JixiaoView> list =(List<JixiaoView>)page.getList();for(JixiaoView c:list){//修改对应字典表字段dictionaryService.dictionaryConvert(c, request);}return R.ok().put("data", page);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id, HttpServletRequest request){logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);JixiaoEntity jixiao = jixiaoService.selectById(id);if(jixiao !=null){//entity转viewJixiaoView view = new JixiaoView();BeanUtils.copyProperties( jixiao , view );//把实体数据重构到view中//级联表 用户//级联表YuangongEntity yuangong = yuangongService.selectById(jixiao.getYuangongId());if(yuangong != null){BeanUtils.copyProperties( yuangong , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "username", "password", "newMoney", "yuangongId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表view.setYuangongId(yuangong.getId());}//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody JixiaoEntity jixiao, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,jixiao:{}",this.getClass().getName(),jixiao.toString());String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永远不会进入");else if("用户".equals(role))jixiao.setYuangongId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));Wrapper<JixiaoEntity> queryWrapper = new EntityWrapper<JixiaoEntity>().eq("yuangong_id", jixiao.getYuangongId()).eq("jixiao_name", jixiao.getJixiaoName()).eq("jixiao_types", jixiao.getJixiaoTypes());logger.info("sql语句:"+queryWrapper.getSqlSegment());JixiaoEntity jixiaoEntity = jixiaoService.selectOne(queryWrapper);if(jixiaoEntity==null){jixiao.setInsertTime(new Date());jixiao.setCreateTime(new Date());jixiaoService.insert(jixiao);return R.ok();}else {return R.error(511,"表中有相同数据");}}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody JixiaoEntity jixiao, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {logger.debug("update方法:,,Controller:{},,jixiao:{}",this.getClass().getName(),jixiao.toString());JixiaoEntity oldJixiaoEntity = jixiaoService.selectById(jixiao.getId());//查询原先数据String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
//        else if("用户".equals(role))
//            jixiao.setYuangongId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));if("".equals(jixiao.getJixiaoFile()) || "null".equals(jixiao.getJixiaoFile())){jixiao.setJixiaoFile(null);}if("".equals(jixiao.getJixiaoContent()) || "null".equals(jixiao.getJixiaoContent())){jixiao.setJixiaoContent(null);}jixiaoService.updateById(jixiao);//根据id更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Integer[] ids, HttpServletRequest request){logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());List<JixiaoEntity> oldJixiaoList =jixiaoService.selectBatchIds(Arrays.asList(ids));//要删除的数据jixiaoService.deleteBatchIds(Arrays.asList(ids));return R.ok();}/*** 批量上传*/@RequestMapping("/batchInsert")public R save( String fileName, HttpServletRequest request){logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);Integer yuangongId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))try {List<JixiaoEntity> jixiaoList = new ArrayList<>();//上传的东西Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段Date date = new Date();int lastIndexOf = fileName.lastIndexOf(".");if(lastIndexOf == -1){return R.error(511,"该文件没有后缀");}else{String suffix = fileName.substring(lastIndexOf);if(!".xls".equals(suffix)){return R.error(511,"只支持后缀为xls的excel文件");}else{URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径File file = new File(resource.getFile());if(!file.exists()){return R.error(511,"找不到上传文件,请联系管理员");}else{List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件dataList.remove(0);//删除第一行,因为第一行是提示for(List<String> data:dataList){//循环JixiaoEntity jixiaoEntity = new JixiaoEntity();
//                            jixiaoEntity.setYuangongId(Integer.valueOf(data.get(0)));   //员工 要改的
//                            jixiaoEntity.setJixiaoUuidNumber(data.get(0));                    //绩效编号 要改的
//                            jixiaoEntity.setJixiaoName(data.get(0));                    //绩效标题 要改的
//                            jixiaoEntity.setJixiaoFile(data.get(0));                    //附件 要改的
//                            jixiaoEntity.setJixiaoTypes(Integer.valueOf(data.get(0)));   //绩效类型 要改的
//                            jixiaoEntity.setJixiaoDafen(data.get(0));                    //绩效打分 要改的
//                            jixiaoEntity.setPingguTime(sdf.parse(data.get(0)));          //评估时间 要改的
//                            jixiaoEntity.setJixiaoContent("");//详情和图片
//                            jixiaoEntity.setInsertTime(date);//时间
//                            jixiaoEntity.setCreateTime(date);//时间jixiaoList.add(jixiaoEntity);//把要查询是否重复的字段放入map中//绩效编号if(seachFields.containsKey("jixiaoUuidNumber")){List<String> jixiaoUuidNumber = seachFields.get("jixiaoUuidNumber");jixiaoUuidNumber.add(data.get(0));//要改的}else{List<String> jixiaoUuidNumber = new ArrayList<>();jixiaoUuidNumber.add(data.get(0));//要改的seachFields.put("jixiaoUuidNumber",jixiaoUuidNumber);}}//查询是否重复//绩效编号List<JixiaoEntity> jixiaoEntities_jixiaoUuidNumber = jixiaoService.selectList(new EntityWrapper<JixiaoEntity>().in("jixiao_uuid_number", seachFields.get("jixiaoUuidNumber")));if(jixiaoEntities_jixiaoUuidNumber.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(JixiaoEntity s:jixiaoEntities_jixiaoUuidNumber){repeatFields.add(s.getJixiaoUuidNumber());}return R.error(511,"数据库的该表中的 [绩效编号] 字段已经存在 存在数据为:"+repeatFields.toString());}jixiaoService.insertBatch(jixiaoList);return R.ok();}}}}catch (Exception e){e.printStackTrace();return R.error(511,"批量插入数据异常,请联系管理员");}}}

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

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

SpringBoot(异常处理)

SpringBoot&#xff08;异常处理&#xff09; 1.基本介绍 2.debug异常处理机制 1.找到 DefaultErrorViewResolver 2.下断点 3.debug启动&#xff0c;浏览器输出一个不存在的页面 4.第一次查找 error/404 1.查看目前要找的视图名 2.准备去查找资源 3.准备从四个默认存放静态资…

【Linux进程信号】信号的发送与保存

【Linux进程信号】信号的发送与保存 目录 【Linux进程信号】信号的发送与保存阻塞信号1. 信号其他相关常见概念2. 在内核中的表示3. sigset_t4. 信号集操作函数sigprocmasksigpendingsignal测试这几个系统调用接口 进程地址空间第三讲捕捉信号1. 内核如何实现信号的捕捉2. siga…

Java八股文(Git)

Java八股文のGit Git Git Git 是什么&#xff1f;它有什么作用&#xff1f; Git 是一种分布式版本控制系统&#xff0c;用于管理源代码的变更和追踪。 它可以记录文件更改的历史&#xff0c;帮助多人协同开发&#xff0c;并提供了回滚、分支管理等功能。 Git 和 SVN&#xff0…

下载指定版本的pytorch

下载网址&#xff1a;https://download.pytorch.org/whl/torch_stable.html 参考博客网址&#xff1a;https://blog.csdn.net/wusuoweiieq/article/details/132773977

jetson nano——编译一些包的网址导航,pyside2,qt(持续更新)

目录 1.PySide2下载地址2.tesserocr下载地址3.Qt下载地址4.OpenSSL官网5.latex编译器下载地址5.1MikTex5.2TeX Live 1.PySide2下载地址 https://download.qt.io/official_releases/QtForPython/pyside2/ 如下图&#xff1a; 2.tesserocr下载地址 https://github.com/simonflue…

基于SSM+Vue的家居商城系统(源码+部署说明+演示视频)

您好&#xff0c;我是码农飞哥&#xff08;wei158556&#xff09;&#xff0c;感谢您阅读本文&#xff0c;欢迎一键三连哦。&#x1f4aa;&#x1f3fb; 1. Python基础专栏&#xff0c;基础知识一网打尽&#xff0c;9.9元买不了吃亏&#xff0c;买不了上当。 Python从入门到精通…

CIDR网络地址、广播地址、网段区间计算说明与计算工具

文章目录 开始问题参考答案 答案解析计算工具测试 开始 好久没有看计算网络&#xff0c;感觉已经完全返给老师了。 最近&#xff0c;有同事遇到个问题&#xff0c;网络一直不对&#xff0c;又开始重新看一下。 相信很多朋友长时间不看也忘了&#xff0c;所以&#xff0c;这里…

详解(实现)堆的接口函数

文章目录 堆堆的顺序存储 准备工作创建头文件Heap.h创建源文件Heap.c头文件的包含定义保存堆数据的结构体 初始化销毁堆插入数据向上调整算法图解算法代码 删除堆顶向下调整算法图解代码 取出堆顶数据求堆的数据个数判断堆是否为空全部代码Heap.hHeap.c 再了解堆之前我们先要了…

云备份项目2

云备份项目 文章目录 云备份项目4. 服务端代码设计4.1 服务端工具类实现4.1.1 文件实用工具类设计4.1.2 Json实用工具类设计 4.2 服务端配置信息模块实现4.2.1 系统配置信息4.2.2 单例文件配置类设计 4.3 服务端数据管理模块实现4.3.1 备份数据类的实现4.3.2 数据管理类的设计 …

[BJDCTF2020]Cookie is so stable

hint提示查看cookies flag.php页面我们先随便输入一个名字 输入后我们重新进一次flag.php&#xff0c;发现cookie里存储了刚刚登陆时输入的用户名&#xff0c;直接猜是ssti 尝试后根据ssti特征判断是twig模板 {{_self.env.registerUndefinedFilterCallback("exec")…

论文阅读——RemoteCLIP

RemoteCLIP: A Vision Language Foundation Model for Remote Sensing 摘要——通用基础模型在人工智能领域变得越来越重要。虽然自监督学习&#xff08;SSL&#xff09;和掩蔽图像建模&#xff08;MIM&#xff09;在构建此类遥感基础模型方面取得了有希望的结果&#xff0c;但…