当前位置: 首页 > news >正文

Java项目:94 springboot大学城水电管理系统

作者主页:源码空间codegym

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

文中获取源码

项目介绍

本管理系统有管理员和用户。

本大学城水电管理系统管理员功能有个人中心,用户管理,领用设备管理,消耗设备管理,设备申请管理,设备派发管理,状体汇报管理,领用报表管理,消耗报表管理,班组报表管理,个人报表管理,用户反馈管理,维护保养管理,设备检测管理,设备维修管理,报修信息管理,定期修复管理,修理计划管理。

用户功能有个人中心,领用设备管理,消耗设备管理,设备申请管理,设备派发管理,状态汇报管理,用户反馈管理,报修信息管理。因而具有一定的实用性。

环境要求

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 + windows10

服务端技术:SpringBoot + MyBatis + Vue + Bootstrap + jQuery

使用说明

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

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

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

运行指导

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

http://mtw.so/5MHvZq

源码看好后直接在网站付款下单即可,付款成功会自动弹出百度网盘链接,网站地址:http://codegym.top

其它问题请关注公众号:IT小舟,关注后发送消息即可,都会给您回复的。若没有及时回复请耐心等待,通常当天会有回复

运行截图

文档截图

springboot106大学城水电管理系统9

springboot106大学城水电管理系统10

springboot106大学城水电管理系统11

springboot106大学城水电管理系统12

springboot106大学城水电管理系统13

springboot106大学城水电管理系统14

后台

springboot106大学城水电管理系统0

springboot106大学城水电管理系统1

springboot106大学城水电管理系统2

springboot106大学城水电管理系统3

springboot106大学城水电管理系统4

springboot106大学城水电管理系统5

springboot106大学城水电管理系统6

springboot106大学城水电管理系统7

springboot106大学城水电管理系统8


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("/dictionary")
public class DictionaryController {private static final Logger logger = LoggerFactory.getLogger(DictionaryController.class);@Autowiredprivate DictionaryService dictionaryService;@Autowiredprivate TokenService tokenService;//级联表service@Autowiredprivate YonghuService yonghuService;@Autowiredprivate YishengService yishengService;/*** 后端列表*/@RequestMapping("/page")@IgnoreAuthpublic R page(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));if(params.get("orderBy")==null || params.get("orderBy")==""){params.put("orderBy","id");}PageUtils page = dictionaryService.queryPage(params);//字典表数据转换List<DictionaryView> list =(List<DictionaryView>)page.getList();for(DictionaryView 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);DictionaryEntity dictionary = dictionaryService.selectById(id);if(dictionary !=null){//entity转viewDictionaryView view = new DictionaryView();BeanUtils.copyProperties( dictionary , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody DictionaryEntity dictionary, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,dictionary:{}",this.getClass().getName(),dictionary.toString());String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永远不会进入");Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>().eq("dic_code", dictionary.getDicCode()).eq("index_name", dictionary.getIndexName());if(dictionary.getDicCode().contains("_erji_types")){queryWrapper.eq("super_id",dictionary.getSuperId());}logger.info("sql语句:"+queryWrapper.getSqlSegment());DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper);if(dictionaryEntity==null){dictionary.setCreateTime(new Date());dictionaryService.insert(dictionary);//字典表新增数据,把数据再重新查出,放入监听器中List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>());ServletContext servletContext = request.getServletContext();Map<String, Map<Integer,String>> map = new HashMap<>();for(DictionaryEntity d :dictionaryEntities){Map<Integer, String> m = map.get(d.getDicCode());if(m ==null || m.isEmpty()){m = new HashMap<>();}m.put(d.getCodeIndex(),d.getIndexName());map.put(d.getDicCode(),m);}servletContext.setAttribute("dictionaryMap",map);return R.ok();}else {return R.error(511,"表中有相同数据");}}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody DictionaryEntity dictionary, HttpServletRequest request){logger.debug("update方法:,,Controller:{},,dictionary:{}",this.getClass().getName(),dictionary.toString());String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");//根据字段查询是否有相同数据Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>().notIn("id",dictionary.getId()).eq("dic_code", dictionary.getDicCode()).eq("index_name", dictionary.getIndexName());if(dictionary.getDicCode().contains("_erji_types")){queryWrapper.eq("super_id",dictionary.getSuperId());}logger.info("sql语句:"+queryWrapper.getSqlSegment());DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper);if(dictionaryEntity==null){dictionaryService.updateById(dictionary);//根据id更新//如果字典表修改数据的话,把数据再重新查出,放入监听器中List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>());ServletContext servletContext = request.getServletContext();Map<String, Map<Integer,String>> map = new HashMap<>();for(DictionaryEntity d :dictionaryEntities){Map<Integer, String> m = map.get(d.getDicCode());if(m ==null || m.isEmpty()){m = new HashMap<>();}m.put(d.getCodeIndex(),d.getIndexName());map.put(d.getDicCode(),m);}servletContext.setAttribute("dictionaryMap",map);return R.ok();}else {return R.error(511,"表中有相同数据");}}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Integer[] ids){logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());dictionaryService.deleteBatchIds(Arrays.asList(ids));return R.ok();}/*** 最大值*/@RequestMapping("/maxCodeIndex")public R maxCodeIndex(@RequestBody DictionaryEntity dictionary){logger.debug("maxCodeIndex:,,Controller:{},,dictionary:{}",this.getClass().getName(),dictionary.toString());List<String> descs = new ArrayList<>();descs.add("code_index");Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>().eq("dic_code", dictionary.getDicCode()).orderDesc(descs);logger.info("sql语句:"+queryWrapper.getSqlSegment());List<DictionaryEntity> dictionaryEntityList = dictionaryService.selectList(queryWrapper);if(dictionaryEntityList != null ){return R.ok().put("maxCodeIndex",dictionaryEntityList.get(0).getCodeIndex()+1);}else{return R.ok().put("maxCodeIndex",1);}}/*** 批量上传*/@RequestMapping("/batchInsert")public R save( String fileName){logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);try {List<DictionaryEntity> dictionaryList = 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){//循环DictionaryEntity dictionaryEntity = new DictionaryEntity();
//                            dictionaryEntity.setDicCode(data.get(0));                    //字段 要改的
//                            dictionaryEntity.setDicName(data.get(0));                    //字段名 要改的
//                            dictionaryEntity.setCodeIndex(Integer.valueOf(data.get(0)));   //编码 要改的
//                            dictionaryEntity.setIndexName(data.get(0));                    //编码名字 要改的
//                            dictionaryEntity.setSuperId(Integer.valueOf(data.get(0)));   //父字段id 要改的
//                            dictionaryEntity.setBeizhu(data.get(0));                    //备注 要改的
//                            dictionaryEntity.setCreateTime(date);//时间dictionaryList.add(dictionaryEntity);//把要查询是否重复的字段放入map中}//查询是否重复dictionaryService.insertBatch(dictionaryList);return R.ok();}}}}catch (Exception e){return R.error(511,"批量插入数据异常,请联系管理员");}}}

相关文章:

  • (7)svelte 教程: Props(属性)
  • 【Linux系统编程】冯诺依曼体系、操作系统、进程的认识
  • 视频汇聚EasyCVR视频监控云平台对接GA/T 1400视图库对象和对象集合XMLSchema描述
  • selenium中, quit 和close的区别
  • 前端作用域冲突之快照沙箱和代理沙箱
  • leetcode:最近的请求次数
  • Vue可视化表单设计 FcDesigner v3.1.0 发布,新增 12 个组件,支持事件配置等
  • Java项目:96 springboot精品在线试题库系统
  • preventDefault()与stopPropagation()有什么区别?
  • IGraph使用实例——线性代数计算(blas)
  • 强达电路营收下滑净利润急剧放缓:周转率骤降,2次因环保被罚
  • 初识SDN(二)
  • 弘君资本:存储芯片概念强势,西测测试三连板,佰维存储涨超10%
  • 【C++】6-6 你好,输出的格式控制(对齐)
  • H6911 DC2.6-40V升压IC 升24V36V48V60V80V100V10A数转模无频闪LED芯片
  • [nginx文档翻译系列] 控制nginx
  • 【笔记】你不知道的JS读书笔记——Promise
  • 〔开发系列〕一次关于小程序开发的深度总结
  • dva中组件的懒加载
  • electron原来这么简单----打包你的react、VUE桌面应用程序
  • EOS是什么
  • Java 11 发布计划来了,已确定 3个 新特性!!
  • JavaScript 是如何工作的:WebRTC 和对等网络的机制!
  • Java比较器对数组,集合排序
  • jquery ajax学习笔记
  • Magento 1.x 中文订单打印乱码
  • maven工程打包jar以及java jar命令的classpath使用
  • MySQL QA
  • PHP 7 修改了什么呢 -- 2
  • python docx文档转html页面
  • Quartz实现数据同步 | 从0开始构建SpringCloud微服务(3)
  • React+TypeScript入门
  • SpringCloud集成分布式事务LCN (一)
  • Spring核心 Bean的高级装配
  • uni-app项目数字滚动
  • vue 配置sass、scss全局变量
  • 道格拉斯-普克 抽稀算法 附javascript实现
  • 多线程事务回滚
  • 检测对象或数组
  • 来,膜拜下android roadmap,强大的执行力
  • 类orAPI - 收藏集 - 掘金
  • 前端相关框架总和
  • 推荐一款sublime text 3 支持JSX和es201x 代码格式化的插件
  • 一个JAVA程序员成长之路分享
  • 移动互联网+智能运营体系搭建=你家有金矿啊!
  • 再次简单明了总结flex布局,一看就懂...
  • 从如何停掉 Promise 链说起
  • ​力扣解法汇总1802. 有界数组中指定下标处的最大值
  • #微信小程序(布局、渲染层基础知识)
  • #我与Java虚拟机的故事#连载13:有这本书就够了
  • $refs 、$nextTic、动态组件、name的使用
  • (11)MSP430F5529 定时器B
  • (20)docke容器
  • (二)Linux——Linux常用指令
  • (每日持续更新)jdk api之StringBufferInputStream基础、应用、实战