基于springboot的4S店车辆管理系统源码和论文

随着信息技术和网络技术的飞速发展,人类已进入全新信息化时代,传统管理技术已无法高效,便捷地管理信息。为了迎合时代需求,优化管理效率,各种各样的管理系统应运而生,各行各业相继进入信息管理时代,4S店车辆系统就是信息时代变革中的产物之一。

任何系统都要遵循系统设计的基本流程,本系统也不例外,同样需要经过市场调研,需求分析,概要设计,详细设计,编码,测试这些步骤,基于java语言设计并实现了4S店车辆系统。该系统基于B/S即所谓浏览器/服务器模式,应用java技术,选择MySQL作为后台数据库。系统主要包括首页、个人中心、销售员管理、维修员管理、客户管理、供应商信息管理、保险公司管理、车辆信息管理、物资信息管理、车辆销售管理、车辆维修管理、营业统计管理、销售统计管理等功能模块。

本文首先介绍了4S店车辆管理的技术发展背景与发展现状,然后遵循软件常规开发流程,首先针对系统选取适用的语言和开发平台,根据需求分析制定模块并设计数据库结构,再根据系统总体功能模块的设计绘制系统的功能模块图,流程图以及E-R图。然后,设计框架并根据设计的框架编写代码以实现系统的各个功能模块。最后,对初步完成的系统进行测试,主要是功能测试、单元测试和性能测试。测试结果表明,该系统能够实现所需的功能,运行状况尚可并无明显缺点

关键词:4S店车辆管理;java;MySQL数据库

基于springboot的4S店车辆管理系统源码和论文393

演示视频:

基于springboot的4S店车辆管理系统源码和论文


Abstract

With the rapid development of information technology and network technology, human beings have entered a new information age, traditional management technology has been unable to efficiently and conveniently manage information. In order to meet the needs of The Times and optimize management efficiency, a variety of management systems have emerged. All walks of life have entered the information management era. The vehicle system of 4S shop is one of the products in the information era.

Any system must follow the basic process of system design, this system is no exception, also need to go through market research, demand analysis, outline design, detailed design, coding, testing these steps, based on Java language design and implementation of 4S shop vehicle system. The system is based on B/S browser/server mode, the application of Java technology, MySQL as the background database. The system mainly includes home page, personal center, sales management, maintenance staff management, customer management, supplier information management, insurance company management, vehicle information management, material information management, vehicle sales management, vehicle maintenance management, business statistics management, sales statistics management and other functional modules.

This paper first introduces the 4 s store traffic management technology development background and current situation of the development, and then follow the routine software development process, first of all, in view of the system and the selection of suitable language development platform, according to the requirement analysis module and database structure design, and then based on the system's overall function module design rendering system function module chart, flow diagram and e-r diagram. Then, design the framework and write code according to the designed framework to achieve each functional module of the system. Finally, the preliminary completed system is tested, mainly functional test, unit test and performance test. The test results show that the system can achieve the required functions, and the running condition is fair and there is no obvious defect.

Key words: 4S shop vehicle management; Java; The MySQL database


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("/yonghu")
public class YonghuController {private static final Logger logger = LoggerFactory.getLogger(YonghuController.class);private static final String TABLE_NAME = "yonghu";@Autowiredprivate YonghuService yonghuService;@Autowiredprivate TokenService tokenService;@Autowiredprivate DictionaryService dictionaryService;//字典@Autowiredprivate ForumService forumService;//交流论坛@Autowiredprivate GonggaoService gonggaoService;//公告资讯@Autowiredprivate HanfuService hanfuService;//汉服信息@Autowiredprivate HanfuCollectionService hanfuCollectionService;//汉服收藏@Autowiredprivate HanfuCommentbackService hanfuCommentbackService;//汉服评价@Autowiredprivate HanfuOrderService hanfuOrderService;//汉服租赁@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("yonghuId",request.getSession().getAttribute("userId"));CommonUtil.checkMap(params);PageUtils page = yonghuService.queryPage(params);//字典表数据转换List<YonghuView> list =(List<YonghuView>)page.getList();for(YonghuView 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);YonghuEntity yonghu = yonghuService.selectById(id);if(yonghu !=null){//entity转viewYonghuView view = new YonghuView();BeanUtils.copyProperties( yonghu , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永远不会进入");Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>().eq("username", yonghu.getUsername()).or().eq("yonghu_phone", yonghu.getYonghuPhone()).or().eq("yonghu_id_number", yonghu.getYonghuIdNumber());logger.info("sql语句:"+queryWrapper.getSqlSegment());YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);if(yonghuEntity==null){yonghu.setCreateTime(new Date());yonghu.setPassword("123456");yonghuService.insert(yonghu);return R.ok();}else {return R.error(511,"账户或者用户手机号或者用户身份证号已经被使用");}}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {logger.debug("update方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());YonghuEntity oldYonghuEntity = yonghuService.selectById(yonghu.getId());//查询原先数据String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");if("".equals(yonghu.getYonghuPhoto()) || "null".equals(yonghu.getYonghuPhoto())){yonghu.setYonghuPhoto(null);}yonghuService.updateById(yonghu);//根据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<YonghuEntity> oldYonghuList =yonghuService.selectBatchIds(Arrays.asList(ids));//要删除的数据yonghuService.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");//.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))try {List<YonghuEntity> yonghuList = 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){//循环YonghuEntity yonghuEntity = new YonghuEntity();
//                            yonghuEntity.setUsername(data.get(0));                    //账户 要改的
//                            yonghuEntity.setPassword("123456");//密码
//                            yonghuEntity.setYonghuUuidNumber(data.get(0));                    //用户编号 要改的
//                            yonghuEntity.setYonghuName(data.get(0));                    //用户姓名 要改的
//                            yonghuEntity.setYonghuPhone(data.get(0));                    //用户手机号 要改的
//                            yonghuEntity.setYonghuIdNumber(data.get(0));                    //用户身份证号 要改的
//                            yonghuEntity.setYonghuPhoto("");//详情和图片
//                            yonghuEntity.setSexTypes(Integer.valueOf(data.get(0)));   //性别 要改的
//                            yonghuEntity.setNewMoney(data.get(0));                    //余额 要改的
//                            yonghuEntity.setYonghuEmail(data.get(0));                    //用户邮箱 要改的
//                            yonghuEntity.setCreateTime(date);//时间yonghuList.add(yonghuEntity);//把要查询是否重复的字段放入map中//账户if(seachFields.containsKey("username")){List<String> username = seachFields.get("username");username.add(data.get(0));//要改的}else{List<String> username = new ArrayList<>();username.add(data.get(0));//要改的seachFields.put("username",username);}//用户编号if(seachFields.containsKey("yonghuUuidNumber")){List<String> yonghuUuidNumber = seachFields.get("yonghuUuidNumber");yonghuUuidNumber.add(data.get(0));//要改的}else{List<String> yonghuUuidNumber = new ArrayList<>();yonghuUuidNumber.add(data.get(0));//要改的seachFields.put("yonghuUuidNumber",yonghuUuidNumber);}//用户手机号if(seachFields.containsKey("yonghuPhone")){List<String> yonghuPhone = seachFields.get("yonghuPhone");yonghuPhone.add(data.get(0));//要改的}else{List<String> yonghuPhone = new ArrayList<>();yonghuPhone.add(data.get(0));//要改的seachFields.put("yonghuPhone",yonghuPhone);}//用户身份证号if(seachFields.containsKey("yonghuIdNumber")){List<String> yonghuIdNumber = seachFields.get("yonghuIdNumber");yonghuIdNumber.add(data.get(0));//要改的}else{List<String> yonghuIdNumber = new ArrayList<>();yonghuIdNumber.add(data.get(0));//要改的seachFields.put("yonghuIdNumber",yonghuIdNumber);}}//查询是否重复//账户List<YonghuEntity> yonghuEntities_username = yonghuService.selectList(new EntityWrapper<YonghuEntity>().in("username", seachFields.get("username")));if(yonghuEntities_username.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(YonghuEntity s:yonghuEntities_username){repeatFields.add(s.getUsername());}return R.error(511,"数据库的该表中的 [账户] 字段已经存在 存在数据为:"+repeatFields.toString());}//用户编号List<YonghuEntity> yonghuEntities_yonghuUuidNumber = yonghuService.selectList(new EntityWrapper<YonghuEntity>().in("yonghu_uuid_number", seachFields.get("yonghuUuidNumber")));if(yonghuEntities_yonghuUuidNumber.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(YonghuEntity s:yonghuEntities_yonghuUuidNumber){repeatFields.add(s.getYonghuUuidNumber());}return R.error(511,"数据库的该表中的 [用户编号] 字段已经存在 存在数据为:"+repeatFields.toString());}//用户手机号List<YonghuEntity> yonghuEntities_yonghuPhone = yonghuService.selectList(new EntityWrapper<YonghuEntity>().in("yonghu_phone", seachFields.get("yonghuPhone")));if(yonghuEntities_yonghuPhone.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(YonghuEntity s:yonghuEntities_yonghuPhone){repeatFields.add(s.getYonghuPhone());}return R.error(511,"数据库的该表中的 [用户手机号] 字段已经存在 存在数据为:"+repeatFields.toString());}//用户身份证号List<YonghuEntity> yonghuEntities_yonghuIdNumber = yonghuService.selectList(new EntityWrapper<YonghuEntity>().in("yonghu_id_number", seachFields.get("yonghuIdNumber")));if(yonghuEntities_yonghuIdNumber.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(YonghuEntity s:yonghuEntities_yonghuIdNumber){repeatFields.add(s.getYonghuIdNumber());}return R.error(511,"数据库的该表中的 [用户身份证号] 字段已经存在 存在数据为:"+repeatFields.toString());}yonghuService.insertBatch(yonghuList);return R.ok();}}}}catch (Exception e){e.printStackTrace();return R.error(511,"批量插入数据异常,请联系管理员");}}/*** 登录*/@IgnoreAuth@RequestMapping(value = "/login")public R login(String username, String password, String captcha, HttpServletRequest request) {YonghuEntity yonghu = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("username", username));if(yonghu==null || !yonghu.getPassword().equals(password))return R.error("账号或密码不正确");String token = tokenService.generateToken(yonghu.getId(),username, "yonghu", "用户");R r = R.ok();r.put("token", token);r.put("role","用户");r.put("username",yonghu.getYonghuName());r.put("tableName","yonghu");r.put("userId",yonghu.getId());return r;}/*** 注册*/@IgnoreAuth@PostMapping(value = "/register")public R register(@RequestBody YonghuEntity yonghu, HttpServletRequest request) {
//    	ValidatorUtils.validateEntity(user);Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>().eq("username", yonghu.getUsername()).or().eq("yonghu_phone", yonghu.getYonghuPhone()).or().eq("yonghu_id_number", yonghu.getYonghuIdNumber());YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);if(yonghuEntity != null)return R.error("账户或者用户手机号或者用户身份证号已经被使用");yonghu.setYonghuUuidNumber(String.valueOf(new Date().getTime()));yonghu.setNewMoney(0.0);yonghu.setCreateTime(new Date());yonghuService.insert(yonghu);return R.ok();}/*** 重置密码*/@GetMapping(value = "/resetPassword")public R resetPassword(Integer  id, HttpServletRequest request) {YonghuEntity yonghu = yonghuService.selectById(id);yonghu.setPassword("123456");yonghuService.updateById(yonghu);return R.ok();}/*** 修改密码*/@GetMapping(value = "/updatePassword")public R updatePassword(String  oldPassword, String  newPassword, HttpServletRequest request) {YonghuEntity yonghu = yonghuService.selectById((Integer)request.getSession().getAttribute("userId"));if(newPassword == null){return R.error("新密码不能为空") ;}if(!oldPassword.equals(yonghu.getPassword())){return R.error("原密码输入错误");}if(newPassword.equals(yonghu.getPassword())){return R.error("新密码不能和原密码一致") ;}yonghu.setPassword(newPassword);yonghuService.updateById(yonghu);return R.ok();}/*** 忘记密码*/@IgnoreAuth@RequestMapping(value = "/resetPass")public R resetPass(String username, HttpServletRequest request) {YonghuEntity yonghu = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("username", username));if(yonghu!=null){yonghu.setPassword("123456");yonghuService.updateById(yonghu);return R.ok();}else{return R.error("账号不存在");}}/*** 获取用户的session用户信息*/@RequestMapping("/session")public R getCurrYonghu(HttpServletRequest request){Integer id = (Integer)request.getSession().getAttribute("userId");YonghuEntity yonghu = yonghuService.selectById(id);if(yonghu !=null){//entity转viewYonghuView view = new YonghuView();BeanUtils.copyProperties( yonghu , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 退出*/@GetMapping(value = "logout")public R logout(HttpServletRequest request) {request.getSession().invalidate();return R.ok("退出成功");}/*** 前端列表*/@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 = yonghuService.queryPage(params);//字典表数据转换List<YonghuView> list =(List<YonghuView>)page.getList();for(YonghuView c:list)dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段return R.ok().put("data", page);}/*** 前端详情*/@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Integer id, HttpServletRequest request){logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);YonghuEntity yonghu = yonghuService.selectById(id);if(yonghu !=null){//entity转viewYonghuView view = new YonghuView();BeanUtils.copyProperties( yonghu , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody YonghuEntity yonghu, HttpServletRequest request){logger.debug("add方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>().eq("username", yonghu.getUsername()).or().eq("yonghu_phone", yonghu.getYonghuPhone()).or().eq("yonghu_id_number", yonghu.getYonghuIdNumber())
//            .notIn("yonghu_types", new Integer[]{102});logger.info("sql语句:"+queryWrapper.getSqlSegment());YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);if(yonghuEntity==null){yonghu.setCreateTime(new Date());yonghu.setPassword("123456");yonghuService.insert(yonghu);return R.ok();}else {return R.error(511,"账户或者用户手机号或者用户身份证号已经被使用");}}}


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("/chat")
public class ChatController {private static final Logger logger = LoggerFactory.getLogger(ChatController.class);private static final String TABLE_NAME = "chat";@Autowiredprivate ChatService chatService;@Autowiredprivate TokenService tokenService;@Autowiredprivate DictionaryService dictionaryService;//字典@Autowiredprivate ForumService forumService;//论坛@Autowiredprivate NewsService newsService;//扶贫公告@Autowiredprivate RenwuService renwuService;//任务信息@Autowiredprivate RenwuYuyueService renwuYuyueService;//任务报名@Autowiredprivate XinwenService xinwenService;//新闻信息@Autowiredprivate XinwenCollectionService xinwenCollectionService;//新闻收藏@Autowiredprivate XinwenLiuyanService xinwenLiuyanService;//新闻留言@Autowiredprivate YonghuService yonghuService;//用户@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("yonghuId",request.getSession().getAttribute("userId"));CommonUtil.checkMap(params);PageUtils page = chatService.queryPage(params);//字典表数据转换List<ChatView> list =(List<ChatView>)page.getList();for(ChatView 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);ChatEntity chat = chatService.selectById(id);if(chat !=null){//entity转viewChatView view = new ChatView();BeanUtils.copyProperties( chat , view );//把实体数据重构到view中//级联表 用户//级联表YonghuEntity yonghu = yonghuService.selectById(chat.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 ChatEntity chat, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString());String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永远不会进入");else if("用户".equals(role))chat.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));Wrapper<ChatEntity> queryWrapper = new EntityWrapper<ChatEntity>().eq("yonghu_id", chat.getYonghuId()).eq("chat_issue", chat.getChatIssue()).eq("chat_reply", chat.getChatReply()).eq("zhuangtai_types", chat.getZhuangtaiTypes()).eq("chat_types", chat.getChatTypes());logger.info("sql语句:"+queryWrapper.getSqlSegment());ChatEntity chatEntity = chatService.selectOne(queryWrapper);if(chatEntity==null){chat.setInsertTime(new Date());chatService.insert(chat);return R.ok();}else {return R.error(511,"表中有相同数据");}}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody ChatEntity chat, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {logger.debug("update方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString());ChatEntity oldChatEntity = chatService.selectById(chat.getId());//查询原先数据String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
//        else if("用户".equals(role))
//            chat.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));chatService.updateById(chat);//根据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<ChatEntity> oldChatList =chatService.selectBatchIds(Arrays.asList(ids));//要删除的数据chatService.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");//.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))try {List<ChatEntity> chatList = 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){//循环ChatEntity chatEntity = new ChatEntity();
//                            chatEntity.setYonghuId(Integer.valueOf(data.get(0)));   //提问用户 要改的
//                            chatEntity.setChatIssue(data.get(0));                    //问题 要改的
//                            chatEntity.setIssueTime(sdf.parse(data.get(0)));          //问题时间 要改的
//                            chatEntity.setChatReply(data.get(0));                    //回复 要改的
//                            chatEntity.setReplyTime(sdf.parse(data.get(0)));          //回复时间 要改的
//                            chatEntity.setZhuangtaiTypes(Integer.valueOf(data.get(0)));   //状态 要改的
//                            chatEntity.setChatTypes(Integer.valueOf(data.get(0)));   //数据类型 要改的
//                            chatEntity.setInsertTime(date);//时间chatList.add(chatEntity);//把要查询是否重复的字段放入map中}//查询是否重复chatService.insertBatch(chatList);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 = chatService.queryPage(params);//字典表数据转换List<ChatView> list =(List<ChatView>)page.getList();for(ChatView 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);ChatEntity chat = chatService.selectById(id);if(chat !=null){//entity转viewChatView view = new ChatView();BeanUtils.copyProperties( chat , view );//把实体数据重构到view中//级联表YonghuEntity yonghu = yonghuService.selectById(chat.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 ChatEntity chat, HttpServletRequest request){logger.debug("add方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString());Wrapper<ChatEntity> queryWrapper = new EntityWrapper<ChatEntity>().eq("yonghu_id", chat.getYonghuId()).eq("chat_issue", chat.getChatIssue()).eq("chat_reply", chat.getChatReply()).eq("zhuangtai_types", chat.getZhuangtaiTypes()).eq("chat_types", chat.getChatTypes())
//            .notIn("chat_types", new Integer[]{102});logger.info("sql语句:"+queryWrapper.getSqlSegment());ChatEntity chatEntity = chatService.selectOne(queryWrapper);if(chatEntity==null){chat.setInsertTime(new Date());chatService.insert(chat);return R.ok();}else {return R.error(511,"表中有相同数据");}}}

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

如若内容造成侵权/违法违规/事实不符,请联系瞎胡闹网进行投诉反馈,一经查实,立即删除!

相关文章

使用 gregwar/captcha 生成固定字符的验证码

图片验证码生成失败 $captcha new CaptchaBuilder("58 ?"); $code $captcha->getPhrase();\Cache::put($key, [phone > $phone, code > $captcha->getPhrase()], $expiredAt);$captcha->build(); $result [captcha_key > $key,expired_at >…

海量物理刚体 高性能物理引擎Unity Physics和Havok Physics的简单性能对比

之前的博客中我们为了绕过ECS架构&#xff0c;相当于单独用Batch Renderer Group实现了一个精简版的Entities Graphics&#xff0c;又使用Jobs版RVO2实现了10w人同屏避障移动。 万人同屏对抗割草 性能测试 PC 手机端 性能表现 弹幕游戏 海量单位同屏渲染 锁敌 避障 非ECS 那么有…

深入浅出JVM(十六)之三色标记法与并发可达性分析

上篇文章深入浅出JVM&#xff08;十五&#xff09;之垃圾回收器&#xff08;上篇&#xff09;介绍性能指标吞吐量和延迟、串行收集器、并行收集器以及吞吐量优先收集器 为了更好的描述并发垃圾收集器&#xff0c;本篇文章将先深入浅出的介绍三色标记法以及并发可达性分析遇到的…

批量获取图片(中)

1.图片标签 img是图片标签&#xff1b;alt是对图片标签的描述 2.获取网页内容 接下来&#xff0c;使用requests模块和BeautifulSoup模块请求并解析网页内容。 在爬取新的网页内容前&#xff0c;我们需要导入requests模块&#xff0c;请求并查看状态码。 拿到网页源代码后&am…

账户名密码是怎样被窃取的,简单模拟攻击者权限维持流程。

前言 在我们进行渗透测试的时候&#xff0c;常常需要进行权限维持&#xff0c;常见的 Javascript窃取用户凭证是一种常见的攻击手法。之前我们可能学习过钓鱼网页的使用&#xff0c;如果我们通过渗透测试进入到用户的服务器&#xff0c;其实也可以通过在网页中植入Javascript代…

JavaEE:多线程(3):案例代码

目录 案例一&#xff1a;单例模式 饿汉模式 懒汉模式 思考&#xff1a;懒汉模式是否线程安全&#xff1f; 案例二&#xff1a;阻塞队列 可以实现生产者消费者模型 削峰填谷 接下来我们自己实现一个阻塞队列 1.先实现一个循环队列 2. 引入锁&#xff0c;实现线程安全 …

揭秘「 B 站最火的 RAG 应用」是如何炼成的

近日&#xff0c;bilibili 知名科技 UP 主“Ele 实验室”发布了一个视频&#xff0c;标题为“当我开发出史料检索 RAG 应用&#xff0c;正史怪又该如何应对&#xff1f;” 。 视频连续三天被平台打上“热门”标签&#xff0c;并迅速登上科技板块全区排行榜前列。截至目前&#…

尚硅谷webpack5笔记2

Loader 原理 loader 概念 帮助 webpack 将不同类型的文件转换为 webpack 可识别的模块。 loader 执行顺序 分类pre: 前置 loadernormal: 普通 loaderinline: 内联 loaderpost: 后置 loader执行顺序4 类 loader 的执行优级为:pre > normal > inline > post 。相…

Springboot+vue图书管理系统(小白)

图书管理系统 简介&#xff1a;一个最简约的图书管理系统&#xff0c;适用于小白用来练手 前端&#xff1a;VueElementUIechars 后端&#xff1a;SpringbootMybatisMySQL 功能模块&#xff1a; 信息管理&#xff1a;公告信息 操作日志 用户管理&#xff1a;用户信息 图书…

IntelliJ IDEA下Spring Boot多环境配置教程

&#x1f31f;&#x1f30c; 欢迎来到知识与创意的殿堂 — 远见阁小民的世界&#xff01;&#x1f680; &#x1f31f;&#x1f9ed; 在这里&#xff0c;我们一起探索技术的奥秘&#xff0c;一起在知识的海洋中遨游。 &#x1f31f;&#x1f9ed; 在这里&#xff0c;每个错误都…

基于51单片机烟雾报警器数码管显示( proteus仿真+程序+设计报告+讲解视频)

基于51单片机烟雾报警器数码管显示( proteus仿真程序设计报告讲解视频&#xff09; 仿真图proteus7.8及以上 程序编译器&#xff1a;keil 4/keil 5 编程语言&#xff1a;C语言 设计编号&#xff1a;S0067 1. 主要功能&#xff1a; 基于51单片机的烟雾报警器proteus仿真设…

Spring中 Unsupported class file major version 61 报错

初学Spring时遇到的一个错误&#xff1a;Unsupported class file major version 61 &#xff0c;如图所示&#xff1a; 网上查了一下大概是JDK的版本与Spring的版本不一致导致的错误&#xff1b;刚开始我用的Spring版本是&#xff1a; <dependencies><dependency>…

PostgreSQL教程(十一):SQL语言(四)之数据类型

一、数值类型 数值类型由 2 字节、4 字节或 8 字节的整数以及 4 字节或 8 字节的浮点数和可选精度的十进制数组成。 下表列出了所有可用类型。 数值类型 名字存储长度描述范围smallint2 字节小范围整数-32768 到 32767integer4 字节常用的整数-2147483648 到 2147483647bigi…

个人建站前端篇(七)vite + vue3企业级项目模板

一、vite命令行创建项目 npm create vitelatest根据提示选择模板&#xff0c;选择vite vue3 ts即可。 二、项目连接远程仓库 git init git remote add origin https://gitee.com/niech_project/vite-vue3-template.git git pull origin master git checkout -b dev三、项目…

【GPU驱动开发】-mesa简介

前言 不必害怕未知&#xff0c;无需恐惧犯错&#xff0c;做一个Creator&#xff01; 一、mesa介绍 Mesa是OpenGL、Vulkan和其他图形API规范的开源实现。主要由Intel和AMD为其各自的硬件开发和资助。 AMD 在已弃用的AMD Catalyst上推广其 Mesa 驱动程序 Radeon 和 RadeonSI &…

C# 学习第四弹——字符串

一、char类型的使用 字符使用单引号&#xff0c;单个字符 转义字符是一种特殊的字符变量&#xff0c;以反斜线开头&#xff0c;后跟一个或多个字符。 输出多级目录可以使用 二、字符串的声明和初始化 1、引用字符串常量 引用字符串常量初始化——字符使用单引号&#xff0…

【达梦8】达梦8不支持联机恢复数据库和表空间

达梦8不支持联机恢复数据库和表空间&#xff0c;只支持联机恢复表。 恢复数据库和表空间仅支持脱机恢复。 各备份工具功能如下&#xff1a;

统计分析笔记3

文章目录 统计检验选择正确的统计检验统计检验是做什么的&#xff1f;何时进行统计检验选择参数化测试&#xff1a;回归、比较或相关性选择非参数检验 假设检验的假设条件skewness什么是零偏度right skewleft skew计算skewnesswhat to do if your data is skewed kurtosis怎么计…

移动Web系统中无监督KPI异常检测的监督式微调

简介 本文介绍由清华大学、南开大学、中国移动研究院与必示科技共同合作的论文&#xff1a;移动Web系统中无监督KPI异常检测的监督式微调。该论文已被The Web Conference 2024&#xff08;International World Wide Web Conference&#xff09;会议录用&#xff0c;论文标题为&…

VUE3搭载到服务器

1.搭建服务器 使用 Windows 自带的 IIS 作为服务器。 步骤如下&#xff1a;https://blog.csdn.net/qq_62464995/article/details/130140673 同时&#xff0c;上面的步骤中&#xff0c;还使用了 cpolar 将 IIS 本地网址映射到公共网址。 注&#xff1a; cpolar客户端&#xf…