🙊作者简介:多年编程开发经验,专注java技术领域和毕业设计项目实战,系统定制、远程部署调试、代码讲解、代码修改
🍅擅长语言:springboot、ssm、vue、html、jsp、php、python、爬虫、小程序、安卓app
⬇️源码获取:文末可以获取源码+数据库+文档⚡感兴趣的可以先收藏+关注,后续会更新更多项目资料,所有项目均配有开发文档和安装配置教程
系统介绍
如今社会上各行各业,都喜欢用自己行业的专属软件工作,互联网发展到这个时候,人们已经发现离不开了互联网。新技术的产生,往往能解决一些老技术的弊端问题。因为传统新能源充电系统信息管理难度大,容错率低,管理人员处理数据费工费时,所以专门为解决这个难题开发了一个新能源充电系统管理系统,可以解决许多问题。
新能源充电系统管理系统按照操作主体分为管理员和用户。管理员的功能包括反馈管理、客服聊天管理、充电桩管理、充电桩预约管理、字典管理、新能源公告管理、用户管理、管理员管理等,可以管理报修。用户的功能包括管理部门以及部门岗位信息,管理充电桩信息,培训信息,薪资信息等。该系统采用了Mysql数据库,Java语言,Spring Boot框架等技术进行编程实现。
新能源充电系统管理系统可以提高新能源充电系统信息管理问题的解决效率,优化新能源充电系统信息处理流程,保证新能源充电系统信息数据的安全,它是一个非常可靠,非常安全的应用程序。
系统主要技术
开发语言:Java
使用框架:SpringBoot
系统架构:B/S
前端技术:Vue、JavaScript
数据库 :Mysql 5.7/8.0
编译工具:idea或者eclipse,jdk1.8,maven
系统功能结构设计
图4.1即为设计的管理员功能结构,管理员权限操作的功能包括反馈管理、客服聊天管理、充电桩管理、充电桩预约管理、字典管理、新能源公告管理、用户管理、管理员管理等,可以管理报修。
图4.1 管理员功能结构
系统功能实现
5.1 管理员功能实现
5.1.1 充电桩管理
图5.1 即为编码实现的充电桩管理界面,管理员在充电桩管理界面中可以对界面中显示的所有数据进行,可以对充电桩信息的充电桩状态进行查看,可以添加新的充电桩信息等。
图5.1 充电桩管理界面
5.1.2 充电桩预约管理
图5.2 即为编码实现的充电桩预约管理界面,管理员在充电桩预约管理界面中查看奖罚种类信息,奖罚描述信息,可以导出充电桩预约信息,新增充电桩预约信息等。
图5.2 充电桩预约管理界面
5.1.3 报修管理
图5.3 即为编码实现的报修管理界面,管理员在报修管理界面中新增报修,并设置报修的角色,可以删除报修。
图5.3 报修管理界面
5.1.4 公告管理
图5.4 即为编码实现的公告管理界面,管理员在公告管理界面查看公告的工作状态为正式公告还是实习公告,可以对公告的数据进行导出,可以添加新公告的信息,可以编辑公告信息,删除公告信息。
图5.4 公告管理界面
5.2 用户功能实现
5.2.1 充电桩
图5.5 即为编码实现的充电桩界面。
图5.5 充电桩界面
5.2.2 在线客服
图5.6 即为编码实现的在线客服界面。
图5.6 在线客服界面
5.2.3 报修
图5.7 即为编码实现的报修界面。
图5.7 报修界面
论文参考
核心代码
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("/chongdianzhuang")
public class ChongdianzhuangController {
private static final Logger logger = LoggerFactory.getLogger(ChongdianzhuangController.class);
private static final String TABLE_NAME = "chongdianzhuang";
@Autowired
private ChongdianzhuangService chongdianzhuangService;
@Autowired
private TokenService tokenService;
@Autowired
private BaoxuiService baoxuiService;//反馈
@Autowired
private ChatService chatService;//客服聊天
@Autowired
private ChongdianzhuangOrderService chongdianzhuangOrderService;//充电桩预约
@Autowired
private DictionaryService dictionaryService;//字典
@Autowired
private GonggaoService gonggaoService;//新能源公告
@Autowired
private YonghuService yonghuService;//用户
@Autowired
private 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("yonghuId",request.getSession().getAttribute("userId"));
params.put("chongdianzhuangDeleteStart",1);params.put("chongdianzhuangDeleteEnd",1);
CommonUtil.checkMap(params);
PageUtils page = chongdianzhuangService.queryPage(params);
//字典表数据转换
List<ChongdianzhuangView> list =(List<ChongdianzhuangView>)page.getList();
for(ChongdianzhuangView 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);
ChongdianzhuangEntity chongdianzhuang = chongdianzhuangService.selectById(id);
if(chongdianzhuang !=null){
//entity转view
ChongdianzhuangView view = new ChongdianzhuangView();
BeanUtils.copyProperties( chongdianzhuang , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ChongdianzhuangEntity chongdianzhuang, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,chongdianzhuang:{}",this.getClass().getName(),chongdianzhuang.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
Wrapper<ChongdianzhuangEntity> queryWrapper = new EntityWrapper<ChongdianzhuangEntity>()
.eq("chongdianzhuang_name", chongdianzhuang.getChongdianzhuangName())
.eq("chongdianzhuang_types", chongdianzhuang.getChongdianzhuangTypes())
.eq("chongdianzhuang_zhuangtai_types", chongdianzhuang.getChongdianzhuangZhuangtaiTypes())
.eq("chongdianzhuang_kucun_number", chongdianzhuang.getChongdianzhuangKucunNumber())
.eq("shangxia_types", chongdianzhuang.getShangxiaTypes())
.eq("chongdianzhuang_delete", chongdianzhuang.getChongdianzhuangDelete())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ChongdianzhuangEntity chongdianzhuangEntity = chongdianzhuangService.selectOne(queryWrapper);
if(chongdianzhuangEntity==null){
chongdianzhuang.setShangxiaTypes(1);
chongdianzhuang.setChongdianzhuangDelete(1);
chongdianzhuang.setInsertTime(new Date());
chongdianzhuang.setCreateTime(new Date());
chongdianzhuangService.insert(chongdianzhuang);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody ChongdianzhuangEntity chongdianzhuang, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
logger.debug("update方法:,,Controller:{},,chongdianzhuang:{}",this.getClass().getName(),chongdianzhuang.toString());
ChongdianzhuangEntity oldChongdianzhuangEntity = chongdianzhuangService.selectById(chongdianzhuang.getId());//查询原先数据
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
if("".equals(chongdianzhuang.getChongdianzhuangPhoto()) || "null".equals(chongdianzhuang.getChongdianzhuangPhoto())){
chongdianzhuang.setChongdianzhuangPhoto(null);
}
chongdianzhuangService.updateById(chongdianzhuang);//根据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<ChongdianzhuangEntity> oldChongdianzhuangList =chongdianzhuangService.selectBatchIds(Arrays.asList(ids));//要删除的数据
ArrayList<ChongdianzhuangEntity> list = new ArrayList<>();
for(Integer id:ids){
ChongdianzhuangEntity chongdianzhuangEntity = new ChongdianzhuangEntity();
chongdianzhuangEntity.setId(id);
chongdianzhuangEntity.setChongdianzhuangDelete(2);
list.add(chongdianzhuangEntity);
}
if(list != null && list.size() >0){
chongdianzhuangService.updateBatchById(list);
}
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<ChongdianzhuangEntity> chongdianzhuangList = 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){
//循环
ChongdianzhuangEntity chongdianzhuangEntity = new ChongdianzhuangEntity();
// chongdianzhuangEntity.setChongdianzhuangName(data.get(0)); //充电桩名称 要改的
// chongdianzhuangEntity.setChongdianzhuangUuidNumber(data.get(0)); //充电桩编号 要改的
// chongdianzhuangEntity.setChongdianzhuangPhoto("");//详情和图片
// chongdianzhuangEntity.setChongdianzhuangTypes(Integer.valueOf(data.get(0))); //充电桩类型 要改的
// chongdianzhuangEntity.setChongdianzhuangZhuangtaiTypes(Integer.valueOf(data.get(0))); //充电桩状态 要改的
// chongdianzhuangEntity.setChongdianzhuangKucunNumber(Integer.valueOf(data.get(0))); //可充时长 要改的
// chongdianzhuangEntity.setChongdianzhuangNewMoney(data.get(0)); //金额/小时 要改的
// chongdianzhuangEntity.setChongdianzhuangContent("");//详情和图片
// chongdianzhuangEntity.setShangxiaTypes(Integer.valueOf(data.get(0))); //是否上架 要改的
// chongdianzhuangEntity.setChongdianzhuangDelete(1);//逻辑删除字段
// chongdianzhuangEntity.setInsertTime(date);//时间
// chongdianzhuangEntity.setCreateTime(date);//时间
chongdianzhuangList.add(chongdianzhuangEntity);
//把要查询是否重复的字段放入map中
//充电桩编号
if(seachFields.containsKey("chongdianzhuangUuidNumber")){
List<String> chongdianzhuangUuidNumber = seachFields.get("chongdianzhuangUuidNumber");
chongdianzhuangUuidNumber.add(data.get(0));//要改的
}else{
List<String> chongdianzhuangUuidNumber = new ArrayList<>();
chongdianzhuangUuidNumber.add(data.get(0));//要改的
seachFields.put("chongdianzhuangUuidNumber",chongdianzhuangUuidNumber);
}
}
//查询是否重复
//充电桩编号
List<ChongdianzhuangEntity> chongdianzhuangEntities_chongdianzhuangUuidNumber = chongdianzhuangService.selectList(new EntityWrapper<ChongdianzhuangEntity>().in("chongdianzhuang_uuid_number", seachFields.get("chongdianzhuangUuidNumber")).eq("chongdianzhuang_delete", 1));
if(chongdianzhuangEntities_chongdianzhuangUuidNumber.size() >0 ){
ArrayList<String> repeatFields = new ArrayList<>();
for(ChongdianzhuangEntity s:chongdianzhuangEntities_chongdianzhuangUuidNumber){
repeatFields.add(s.getChongdianzhuangUuidNumber());
}
return R.error(511,"数据库的该表中的 [充电桩编号] 字段已经存在 存在数据为:"+repeatFields.toString());
}
chongdianzhuangService.insertBatch(chongdianzhuangList);
return R.ok();
}
}
}
}catch (Exception e){
e.printStackTrace();
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
* 个性推荐
*/
@IgnoreAuth
@RequestMapping("/gexingtuijian")
public R gexingtuijian(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("gexingtuijian方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
CommonUtil.checkMap(params);
List<ChongdianzhuangView> returnChongdianzhuangViewList = new ArrayList<>();
//查询订单
Map<String, Object> params1 = new HashMap<>(params);params1.put("sort","id");params1.put("yonghuId",request.getSession().getAttribute("userId"));
PageUtils pageUtils = chongdianzhuangOrderService.queryPage(params1);
List<ChongdianzhuangOrderView> orderViewsList =(List<ChongdianzhuangOrderView>)pageUtils.getList();
Map<Integer,Integer> typeMap=new HashMap<>();//购买的类型list
for(ChongdianzhuangOrderView orderView:orderViewsList){
Integer chongdianzhuangTypes = orderView.getChongdianzhuangTypes();
if(typeMap.containsKey(chongdianzhuangTypes)){
typeMap.put(chongdianzhuangTypes,typeMap.get(chongdianzhuangTypes)+1);
}else{
typeMap.put(chongdianzhuangTypes,1);
}
}
List<Integer> typeList = new ArrayList<>();//排序后的有序的类型 按最多到最少
typeMap.entrySet().stream().sorted((o1, o2) -> o2.getValue() - o1.getValue()).forEach(e -> typeList.add(e.getKey()));//排序
Integer limit = Integer.valueOf(String.valueOf(params.get("limit")));
for(Integer type:typeList){
Map<String, Object> params2 = new HashMap<>(params);params2.put("chongdianzhuangTypes",type);
PageUtils pageUtils1 = chongdianzhuangService.queryPage(params2);
List<ChongdianzhuangView> chongdianzhuangViewList =(List<ChongdianzhuangView>)pageUtils1.getList();
returnChongdianzhuangViewList.addAll(chongdianzhuangViewList);
if(returnChongdianzhuangViewList.size()>= limit) break;//返回的推荐数量大于要的数量 跳出循环
}
//正常查询出来商品,用于补全推荐缺少的数据
PageUtils page = chongdianzhuangService.queryPage(params);
if(returnChongdianzhuangViewList.size()<limit){//返回数量还是小于要求数量
int toAddNum = limit - returnChongdianzhuangViewList.size();//要添加的数量
List<ChongdianzhuangView> chongdianzhuangViewList =(List<ChongdianzhuangView>)page.getList();
for(ChongdianzhuangView chongdianzhuangView:chongdianzhuangViewList){
Boolean addFlag = true;
for(ChongdianzhuangView returnChongdianzhuangView:returnChongdianzhuangViewList){
if(returnChongdianzhuangView.getId().intValue() ==chongdianzhuangView.getId().intValue()) addFlag=false;//返回的数据中已存在此商品
}
if(addFlag){
toAddNum=toAddNum-1;
returnChongdianzhuangViewList.add(chongdianzhuangView);
if(toAddNum==0) break;//够数量了
}
}
}else {
returnChongdianzhuangViewList = returnChongdianzhuangViewList.subList(0, limit);
}
for(ChongdianzhuangView c:returnChongdianzhuangViewList)
dictionaryService.dictionaryConvert(c, request);
page.setList(returnChongdianzhuangViewList);
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@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 = chongdianzhuangService.queryPage(params);
//字典表数据转换
List<ChongdianzhuangView> list =(List<ChongdianzhuangView>)page.getList();
for(ChongdianzhuangView 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);
ChongdianzhuangEntity chongdianzhuang = chongdianzhuangService.selectById(id);
if(chongdianzhuang !=null){
//entity转view
ChongdianzhuangView view = new ChongdianzhuangView();
BeanUtils.copyProperties( chongdianzhuang , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ChongdianzhuangEntity chongdianzhuang, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,chongdianzhuang:{}",this.getClass().getName(),chongdianzhuang.toString());
Wrapper<ChongdianzhuangEntity> queryWrapper = new EntityWrapper<ChongdianzhuangEntity>()
.eq("chongdianzhuang_name", chongdianzhuang.getChongdianzhuangName())
.eq("chongdianzhuang_uuid_number", chongdianzhuang.getChongdianzhuangUuidNumber())
.eq("chongdianzhuang_types", chongdianzhuang.getChongdianzhuangTypes())
.eq("chongdianzhuang_zhuangtai_types", chongdianzhuang.getChongdianzhuangZhuangtaiTypes())
.eq("chongdianzhuang_kucun_number", chongdianzhuang.getChongdianzhuangKucunNumber())
.eq("shangxia_types", chongdianzhuang.getShangxiaTypes())
.eq("chongdianzhuang_delete", chongdianzhuang.getChongdianzhuangDelete())
// .notIn("chongdianzhuang_types", new Integer[]{102})
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ChongdianzhuangEntity chongdianzhuangEntity = chongdianzhuangService.selectOne(queryWrapper);
if(chongdianzhuangEntity==null){
chongdianzhuang.setChongdianzhuangDelete(1);
chongdianzhuang.setInsertTime(new Date());
chongdianzhuang.setCreateTime(new Date());
chongdianzhuangService.insert(chongdianzhuang);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
}