基于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://www.mzph.cn/news/706283.shtml

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

相关文章

win10开机黑屏,只有鼠标,解决方案

问题描述 win10进不去桌面&#xff0c;可以进去锁屏&#xff0c;只有鼠标&#xff0c;也能进去任务管理器&#xff08;ctrlwindelete&#xff09;, 问题分析 进入任务管理器->文件->运行新任务 然后输入 explorer.exe 发现找不到了 原因&#xff1a;误删explorer.exe …

Linux系统---nginx(1)服务

目录 一.Nginx概述 1.定义 2.Nginx模块作用 &#xff08;1&#xff09;main模块 &#xff08;2&#xff09;stream服务模块 &#xff08;3&#xff09;邮件服务模块 &#xff08;4&#xff09;第三方模块 &#xff08;5&#xff09;events模块 &#xff08;6&#xff0…

300分钟吃透分布式缓存-16讲:常用的缓存组件Redis是如何运行的?

Redis 基本原理 Redis 简介 Redis 是一款基于 ANSI C 语言编写的&#xff0c;BSD 许可的&#xff0c;日志型 key-value 存储组件&#xff0c;它的所有数据结构都存在内存中&#xff0c;可以用作缓存、数据库和消息中间件。 Redis 是 Remote dictionary server 即远程字典服务…

SpringCloud有哪些组件

什么是SpringCloud&#xff1f; Spring Cloud是基于Spring Boot的分布式系统开发工具&#xff0c;它提供了一系列开箱即用的、针对分布式系统开发的特性和组件&#xff0c;用于帮助开发人员快速构建和管理云原生应用程序。 Spring Cloud的主要目标是解决分布式系统中的常见问题…

代码随想录算法训练营第二十七天补|39. 组合总和 ● 40.组合总和II ● 131.分割回文串

组合问题&#xff1a;集合内元素的组合&#xff0c;不同集合内元素的组合 分割问题&#xff1a;本质还是组合问题&#xff0c;注意一下如何分割字符串 回溯模板伪代码 void backtracking(参数) {if (终止条件) {存放结果;return;}for (选择&#xff1a;本层集合中元素&#xf…

【Maven】Maven 基础教程(一):基础介绍、开发环境配置

Maven 基础教程&#xff08;一&#xff09;&#xff1a;基础介绍、开发环境配置 1.Maven 是什么1.1 构建1.2 依赖 2.Maven 开发环境配置2.1 下载安装2.2 指定本地仓库2.3 配置阿里云提供的镜像仓库2.4 配置基础 JDK 版本2.5 配置环境变量 1.Maven 是什么 Maven 是 Apache 软件…

N个数中寻找前K个最大的数

文章目录 一、先把这N个数的前K个建立一个小堆二、再把这K个数与剩下的N-K个数进行比较交换三、最后用向下调整算法就可以得到这N个数中最大的前K个 一、先把这N个数的前K个建立一个小堆 先创建一个文本文件&#xff0c;然后向里面写数据&#xff0c;这里N我设置的是1000 int n…

【web APIs】1、(学习笔记)有案例!

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 前言一、概念二、使用步骤1.获取DOM对象2.操作元素内容3.属性修改3.1.常用属性修改3.2.控制样式属性3.3.操作类名(className) 操作CSS3.4.操作表单元素属性3.5.自定…

【LeetCode每日一题】938. 二叉搜索树的范围和

2024-2-26 文章目录 [938. 二叉搜索树的范围和](https://leetcode.cn/problems/range-sum-of-bst/)思路&#xff1a;写法一&#xff1a;在中间累加写法二&#xff1a;在最后累加 938. 二叉搜索树的范围和 思路&#xff1a; 1.在二叉搜索树中&#xff1a;左子树的结点都小于根节…

小甲鱼Python06 序列字典集合

一、序列 1.id函数 is运算符 我们首先思考下字符串、元组、列表的共同点&#xff1a; 都有很多共同的运算符。都可以通过索引来获取元素&#xff0c;第一个元素索引都是0&#xff0c;都可以通过切片的方法获取某个范围内元素的集合。 以上三种统称为序列。序列分为可变序列…

抖音视频评论采集软件|抖音数据抓取工具

抖音视频评论采集软件是一款基于C#开发的高效、便捷的工具&#xff0c;旨在为用户提供全面的数据采集和分析服务。该软件不仅支持通过关键词进行搜索抓取&#xff0c;还能够通过分享链接进行单个视频的抓取和下载&#xff0c;让用户轻松获取抖音视频评论数据。 其中&#xff0c…

JSP实现数据传递与保存(一)

一、Web开发步骤 1.1两类模式 后端——————前端 先有前端&#xff0c;前端用的时候直接调用 后端已实现注册接口&#xff0c;接口名为doRegister.jsp 前端此时&#xff1a; 前端的form表单中的action提交地址就只能填doRegister.jsp&#xff0c;即&#xff1a; <f…

10.网络游戏逆向分析与漏洞攻防-游戏网络架构逆向分析-接管游戏发送数据的操作

内容参考于&#xff1a;易道云信息技术研究院VIP课 上一个内容&#xff1a;接管游戏连接服务器的操作 码云地址&#xff08;master 分支&#xff09;&#xff1a;染指/titan 码云版本号&#xff1a;00820853d5492fa7b6e32407d46b5f9c01930ec6 代码下载地址&#xff0c;在 ti…

Doris——荔枝微课统一实时数仓建设实践

目录 一、业务介绍 二、早期架构及痛点 2.1 早期架构 2.2 架构痛点 三、技术选型 四、新的架构及方案 五、搭建经验 5.1 数据建模 5.2 数据开发 5.3 库表设计 5.4 数据管理 5.4.1 监控告警 5.4.2 数据备份与恢复 六、收益总结 七、未来规划 原文大佬这篇Doris腾…

适配器模式(Adapter Pattern) C++

上一节&#xff1a;原型模式&#xff08;Prototype Pattern&#xff09; C 文章目录 0.理论1.组件2.类型3.什么时候使用 1.实践1.基础接口和类2.类适配器实现3.对象适配器实现 0.理论 适配器模式&#xff08;Adapter Pattern&#xff09;是一种结构型设计模式&#xff0c;它允…

日更【系统架构设计师知识总结3】存储系统

【原创精华总结】自己一点点手打、总结的脑图&#xff0c;把散落在课本以及老师讲授的知识点合并汇总&#xff0c;反复提炼语言&#xff0c;形成知识框架。希望能给同样在学习的伙伴一点帮助&#xff01;

《TCP/IP详解 卷一》第9章 广播和本地组播

目录 9.1 引言 9.2 广播 9.2.1 使用广播地址 9.2.2 发送广播数据报 9.3 组播 9.3.1 将组播IP地址转换为组播MAC地址 9.3.2 例子 9.3.3 发送组播数据报 9.3.4 接收组播数据报 9.3.5 主机地址过滤 9.4 IGMP协议和MLD协议 9.4.1 组成员的IGMP和MLD处理 9.4.2 组播路由…

基于微信小程序的垃圾分类系统,附源码

博主介绍&#xff1a;✌程序员徐师兄、7年大厂程序员经历。全网粉丝12w、csdn博客专家、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌ &#x1f345;文末获取源码联系&#x1f345; &#x1f447;&#x1f3fb; 精彩专栏推荐订阅&#x1f447;…

vue2 day6 7

1、vuex简介&#xff1a;共享数据 &#xff08;数据在组件中传递 组件通信&#xff09; 2、创建仓库 js中&#xff1a;this.$store 让我们可以在别的组件中访问仓库对象 3、state状态&#xff1a;提供公共数据&#xff08;data只提供当前组件数据&#xff09; 4、mutati…

YOLOv9-Openvino和ONNXRuntime推理【CPU】

1 环境&#xff1a; CPU&#xff1a;i5-12500 Python&#xff1a;3.8.18 2 安装Openvino和ONNXRuntime 2.1 Openvino简介 Openvino是由Intel开发的专门用于优化和部署人工智能推理的半开源的工具包&#xff0c;主要用于对深度推理做优化。 Openvino内部集成了Opencv、Tens…