作者主页:源码空间站2022
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
基于Springboot + vue实现的在线装修管理系统
系统包含用户、装修队、管理员三个角色
管理员:
管理员管理:管理其他管理员的账号和权限,确保系统管理的层次化和安全性。
装修队管理:审核装修队的资质,管理装修队的人员信息,监控工程进度,确保项目顺利进行。
基础数据管理:维护系统的基础数据,如材料信息、价格库、工艺标准等,为装修项目提供数据支持。
论坛管理:监管论坛内容,确保信息的合规性和健康性,回应用户的问题和建议。
公告信息管理:发布装修企业的最新动态、活动信息、优惠政策等,提升品牌知名度和用户黏性。
轮播图信息管理:更新前台门户或关键页面的轮播图信息,展示企业的最新装修案例、优惠活动等。
装修队成员:
装修管理:参与装修项目的立项、设计、施工到验收的全流程,确保项目按时按质完成。
进度报告:定期向系统提交工程进度报告,以便管理员和其他相关人员了解项目进展。
论坛参与:在论坛中分享装修经验、心得,与其他用户交流,提升个人技能和影响力。
客户(用户):
前台门户浏览:通过前台门户了解装修服务、查看案例、联系客服等。
用户管理:注册账号,登录系统,修改个人信息,享受个性化服务。
装修项目查看与参与:查看装修项目信息,与装修队沟通,参与项目进程。
论坛参与:在论坛中提问、交流装修经验,获取装修建议和帮助。
公告信息查看:查看企业发布的最新动态、活动信息、优惠政策等。
使用人群:
正在做毕设的学生,或者需要项目实战练习的Java学习者
由于本程序规模不大,可供课程设计,毕业设计学习演示之用
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7/8.0版本均可;
5.是否Maven项目:是;
技术栈
后端:SpringBoot+Mybaits
前端:Vue + elementui
使用说明
项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入地址:
前台地址:
http://localhost:8080/zaixianzhuangxiuguanli/front/index.html
用户账户:a1 密码:123456
后台登录页面
http://localhost:8080/zaixianzhuangxiuguanli/admin/dist/index.html#/login
管理员账户:admin 密码:admin
装修队账户:a1 密码:123456
用户账户:a1 密码:123456
运行截图
论文
前台界面
后台界面
相关代码
ZhuangxiuCollectionController
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("/zhuangxiuCollection")
public class ZhuangxiuCollectionController {
private static final Logger logger = LoggerFactory.getLogger(ZhuangxiuCollectionController.class);
private static final String TABLE_NAME = "zhuangxiuCollection";
@Autowired
private ZhuangxiuCollectionService zhuangxiuCollectionService;
@Autowired
private TokenService tokenService;
@Autowired
private DictionaryService dictionaryService;
//级联表非注册的service
@Autowired
private ZhuangxiuService zhuangxiuService;
//注册表service
@Autowired
private YonghuService yonghuService;
@Autowired
private TuanduiService tuanduiService;
/**
* 后端列表
*/
@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("yonghuId",request.getSession().getAttribute("userId"));
else if("装修队".equals(role))
params.put("tuanduiId",request.getSession().getAttribute("userId"));
CommonUtil.checkMap(params);
PageUtils page = zhuangxiuCollectionService.queryPage(params);
//字典表数据转换
List<ZhuangxiuCollectionView> list =(List<ZhuangxiuCollectionView>)page.getList();
for(ZhuangxiuCollectionView 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);
ZhuangxiuCollectionEntity zhuangxiuCollection = zhuangxiuCollectionService.selectById(id);
if(zhuangxiuCollection !=null){
//entity转view
ZhuangxiuCollectionView view = new ZhuangxiuCollectionView();
BeanUtils.copyProperties( zhuangxiuCollection , view );//把实体数据重构到view中
//级联表 装修
//级联表
ZhuangxiuEntity zhuangxiu = zhuangxiuService.selectById(zhuangxiuCollection.getZhuangxiuId());
if(zhuangxiu != null){
BeanUtils.copyProperties( zhuangxiu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
view.setZhuangxiuId(zhuangxiu.getId());
}
//级联表 用户
//级联表
YonghuEntity yonghu = yonghuService.selectById(zhuangxiuCollection.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ZhuangxiuCollectionEntity zhuangxiuCollection, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,zhuangxiuCollection:{}",this.getClass().getName(),zhuangxiuCollection.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
else if("用户".equals(role))
zhuangxiuCollection.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
Wrapper<ZhuangxiuCollectionEntity> queryWrapper = new EntityWrapper<ZhuangxiuCollectionEntity>()
.eq("zhuangxiu_id", zhuangxiuCollection.getZhuangxiuId())
.eq("yonghu_id", zhuangxiuCollection.getYonghuId())
.eq("zhuangxiu_collection_types", zhuangxiuCollection.getZhuangxiuCollectionTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ZhuangxiuCollectionEntity zhuangxiuCollectionEntity = zhuangxiuCollectionService.selectOne(queryWrapper);
if(zhuangxiuCollectionEntity==null){
zhuangxiuCollection.setInsertTime(new Date());
zhuangxiuCollection.setCreateTime(new Date());
zhuangxiuCollectionService.insert(zhuangxiuCollection);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody ZhuangxiuCollectionEntity zhuangxiuCollection, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
logger.debug("update方法:,,Controller:{},,zhuangxiuCollection:{}",this.getClass().getName(),zhuangxiuCollection.toString());
ZhuangxiuCollectionEntity oldZhuangxiuCollectionEntity = zhuangxiuCollectionService.selectById(zhuangxiuCollection.getId());//查询原先数据
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
// else if("用户".equals(role))
// zhuangxiuCollection.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
//根据字段查询是否有相同数据
Wrapper<ZhuangxiuCollectionEntity> queryWrapper = new EntityWrapper<ZhuangxiuCollectionEntity>()
.notIn("id",zhuangxiuCollection.getId())
.andNew()
.eq("zhuangxiu_id", zhuangxiuCollection.getZhuangxiuId())
.eq("yonghu_id", zhuangxiuCollection.getYonghuId())
.eq("zhuangxiu_collection_types", zhuangxiuCollection.getZhuangxiuCollectionTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ZhuangxiuCollectionEntity zhuangxiuCollectionEntity = zhuangxiuCollectionService.selectOne(queryWrapper);
if(zhuangxiuCollectionEntity==null){
zhuangxiuCollectionService.updateById(zhuangxiuCollection);//根据id更新
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
List<ZhuangxiuCollectionEntity> oldZhuangxiuCollectionList =zhuangxiuCollectionService.selectBatchIds(Arrays.asList(ids));//要删除的数据
zhuangxiuCollectionService.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 yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
List<ZhuangxiuCollectionEntity> zhuangxiuCollectionList = 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){
//循环
ZhuangxiuCollectionEntity zhuangxiuCollectionEntity = new ZhuangxiuCollectionEntity();
// zhuangxiuCollectionEntity.setZhuangxiuId(Integer.valueOf(data.get(0))); //装修 要改的
// zhuangxiuCollectionEntity.setYonghuId(Integer.valueOf(data.get(0))); //用户 要改的
// zhuangxiuCollectionEntity.setZhuangxiuCollectionTypes(Integer.valueOf(data.get(0))); //类型 要改的
// zhuangxiuCollectionEntity.setInsertTime(date);//时间
// zhuangxiuCollectionEntity.setCreateTime(date);//时间
zhuangxiuCollectionList.add(zhuangxiuCollectionEntity);
//把要查询是否重复的字段放入map中
}
//查询是否重复
zhuangxiuCollectionService.insertBatch(zhuangxiuCollectionList);
return R.ok();
}
}
}
}catch (Exception e){
e.printStackTrace();
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
CommonUtil.checkMap(params);
PageUtils page = zhuangxiuCollectionService.queryPage(params);
//字典表数据转换
List<ZhuangxiuCollectionView> list =(List<ZhuangxiuCollectionView>)page.getList();
for(ZhuangxiuCollectionView c:list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
return R.ok().put("data", page);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
ZhuangxiuCollectionEntity zhuangxiuCollection = zhuangxiuCollectionService.selectById(id);
if(zhuangxiuCollection !=null){
//entity转view
ZhuangxiuCollectionView view = new ZhuangxiuCollectionView();
BeanUtils.copyProperties( zhuangxiuCollection , view );//把实体数据重构到view中
//级联表
ZhuangxiuEntity zhuangxiu = zhuangxiuService.selectById(zhuangxiuCollection.getZhuangxiuId());
if(zhuangxiu != null){
BeanUtils.copyProperties( zhuangxiu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setZhuangxiuId(zhuangxiu.getId());
}
//级联表
YonghuEntity yonghu = yonghuService.selectById(zhuangxiuCollection.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ZhuangxiuCollectionEntity zhuangxiuCollection, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,zhuangxiuCollection:{}",this.getClass().getName(),zhuangxiuCollection.toString());
Wrapper<ZhuangxiuCollectionEntity> queryWrapper = new EntityWrapper<ZhuangxiuCollectionEntity>()
.eq("zhuangxiu_id", zhuangxiuCollection.getZhuangxiuId())
.eq("yonghu_id", zhuangxiuCollection.getYonghuId())
.eq("zhuangxiu_collection_types", zhuangxiuCollection.getZhuangxiuCollectionTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ZhuangxiuCollectionEntity zhuangxiuCollectionEntity = zhuangxiuCollectionService.selectOne(queryWrapper);
if(zhuangxiuCollectionEntity==null){
zhuangxiuCollection.setInsertTime(new Date());
zhuangxiuCollection.setCreateTime(new Date());
zhuangxiuCollectionService.insert(zhuangxiuCollection);
return R.ok();
}else {
return R.error(511,"您已经收藏过了");
}
}
}
如果也想学习本系统,下面领取。关注并回复:197springboot