——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明







基于javaweb的SpringBoot宠物医院与商城一体系统(java+springboot+html+thymeleaf+maven+mysql)
项目运行
环境配置:
Jdk1.8 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
项目技术:
Springboot+ SpringMVC + MyBatis + Jsp + Html+ JavaScript + JQuery + Ajax + maven等等
宠物医院与商城一体的系统
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| care.setCustomerName(care.getCustomer().getContact()); care.setPetName(care.getPet().getName()); } resultMap.put("rows", fosterCareList); resultMap.put("total", fosterCareService.getCount(map)); logService.add(new Log(Log.SEARCH_ACTION, "查询寄养记录")); return resultMap; }
@RequestMapping("/save") @RequiresPermissions(value = "寄养记录管理") public Map<String, Object> save(FosterCare fosterCare) { Map<String, Object> resultMap = new HashMap<>(16); Customer customer = customerService.findByContact(fosterCare.getCustomerName()); Pet pet = petService.findByName(fosterCare.getPetName()); if (customer == null) { resultMap.put("success", false); resultMap.put("errorInfo", "该客户不存在,请核实!!"); return resultMap; } if (pet == null) { resultMap.put("success", false); resultMap.put("errorInfo", "该宠物不存在,请核实!!"); return resultMap; } else { Map<String,Object> map=new HashMap<>(16); map.put("customer", customer); List<Pet> petList = petService.list(map); boolean flag=false; for (Pet pet1 : petList) { if (pet1.getName().equals(pet.getName())) { flag = true; break; } } if (flag==false) { resultMap.put("success", false); resultMap.put("errorInfo", "该客户没有这个宠物,请核实!!"); return resultMap; } } int key; if (fosterCare.getId() == null) { logService.add(new Log(Log.ADD_ACTION, "添加寄养记录" + fosterCare)); fosterCare.setCustomer(customer); fosterCare.setPet(pet);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| saleListGoodsService.update(saleListGoods); returnApplyService.update(returnApply); } return mav; }
@RequestMapping("/myReturnApply/list/{id}") public ModelAndView myReturnApply(@PathVariable(value = "id", required = false) Integer page, HttpSession session) { ModelAndView mav = new ModelAndView(); Map<String, Object> map = new HashMap<>(16); int pageSize = 5; map.put("start", (page - 1) * pageSize); map.put("size", pageSize); Customer customer = (Customer) session.getAttribute("currentCustomer"); map.put("customerId", customer.getId()); List<ReturnApply> returnApplyList = returnApplyService.list(map); for (ReturnApply returnApply : returnApplyList) { returnApply.setSaleListGoods(saleListGoodsService.findById(returnApply.getSaleListGoodsId())); } Long total = returnApplyService.getCount(map); mav.addObject("returnApplyList", returnApplyList); mav.addObject("total", total); mav.addObject("pageCode", PageUtil.genPagination2("/returnApply/myReturnApply/list", total, page, pageSize)); mav.addObject("title", "我的预约"); mav.addObject("mainPage", "page/returnApply/myReturnApply"); mav.addObject("mainPageKey", "#b"); mav.setViewName("index"); return mav; }
@RequestMapping("/returnApplyDetails") public ModelAndView returnApplyDetails(Integer returnApplyId) { ModelAndView mav = new ModelAndView(); ReturnApply returnApply = returnApplyService.findById(returnApplyId); returnApply.setSaleListGoods(saleListGoodsService.findById(returnApply.getSaleListGoodsId()));
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| Map<String, Object> resultMap = new HashMap<>(16); if (!file.isEmpty()) { String fileName = file.getOriginalFilename(); String suffixName = fileName.substring(fileName.lastIndexOf(".")); String newFileName = DateUtil.getCurrentDateStr2() + suffixName; FileUtils.copyInputStreamToFile(file.getInputStream(), new File(userImageFilePath + newFileName)); if (user.getId() != null) { FileUtils.deleteQuietly(new File(userImageFilePath + userService.findById(user.getId()).getImageName())); } user.setImageName(newFileName); } int key; if (user.getId() == null) { key = userService.add(user); logService.add(new Log(Log.ADD_ACTION, "添加用户信息" + user)); } else { key = userService.update(user); logService.add(new Log(Log.UPDATE_ACTION, "修改用户信息" + user)); } if (key > 0) { resultMap.put("success", true); } else { resultMap.put("success", false); } return resultMap; }
@RequestMapping("/delete") @ResponseBody @RequiresPermissions(value = "用户管理") public Map<String, Object> delete(Integer id) { logService.add(new Log(Log.DELETE_ACTION, "删除用户信息" + userService.findById(id))); Map<String, Object> resultMap = new HashMap<>(16); userRoleService.deleteByUserId(id); userService.delete(id); resultMap.put("success", true); return resultMap; }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| * @param customer * @param bindingResult * @param session * @return */ @RequestMapping("/login") public ModelAndView login(@Valid Customer customer, BindingResult bindingResult, HttpSession session) { ModelAndView mav = new ModelAndView(); if (bindingResult.hasErrors()) { mav.addObject("customer", customer); mav.addObject("error", bindingResult.getFieldError().getDefaultMessage()); mav.addObject("title", "用户登录"); mav.addObject("mainPage", "page/login"); } else { List<Customer> customerList = customerService.findByUserName(customer.getUserName()); if (customerList.size() != 0) { Customer currentCustomer = customerService.findByUserName(customer.getUserName()).get(0); if (currentCustomer.getPassword().equals(customer.getPassword())) { session.setAttribute("currentCustomer", currentCustomer); mav.addObject("successLogin", true); mav.addObject("title", "首页"); mav.addObject("mainPage", "page/indexFirst"); } else { mav.addObject("successLogin", false); mav.addObject("title", "用户登录"); mav.addObject("mainPage", "page/login"); } } else { mav.addObject("successLogin", false); mav.addObject("title", "用户登录"); mav.addObject("mainPage", "page/login"); } } mav.addObject("mainPageKey", "#b"); mav.setViewName("index"); return mav; }
@RequestMapping("/logout") public ModelAndView logout(HttpSession session) { session.invalidate(); ModelAndView mav = new ModelAndView(""); mav.addObject("title", "用户登录"); mav.addObject("mainPage", "page/indexFirst"); mav.addObject("mainPageKey", "#b"); mav.setViewName("index"); return mav;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| private PetService petService;
@Resource private UserService userService;
@InitBinder public void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); dateFormat.setLenient(true); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); }
@RequestMapping("/save") public ModelAndView save(Reservation reservation, HttpSession session) { if (reservation.getId() == null) { ModelAndView mav = new ModelAndView("redirect:/reservation/reserveSuccess"); reservation.setCustomer((Customer) session.getAttribute("currentCustomer")); reservation.setPet(petService.findById(reservation.getPetId())); reservationService.add(reservation); return mav; } else { ModelAndView mav = new ModelAndView("redirect:/reservation/myReservation/list/1"); reservation.setCustomer((Customer) session.getAttribute("currentCustomer")); reservation.setStatus(1); reservation.setPet(petService.findById(reservation.getPetId())); reservationService.update(reservation); return mav; } }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
@RequestMapping("/petAdd") public ModelAndView petAdd() { ModelAndView mav = new ModelAndView(); mav.addObject("title", "添加宠物信息"); mav.addObject("mainPage", "page/customer/petAdd"); mav.addObject("mainPageKey", "#b"); mav.setViewName("index"); return mav; }
@RequestMapping("/petModify") public ModelAndView petModify(Integer petId) { Pet pet = petService.findById(petId); ModelAndView mav = new ModelAndView(); mav.addObject("pet", pet); mav.addObject("title", "修改宠物信息"); mav.addObject("mainPage", "page/customer/petModify"); mav.addObject("mainPageKey", "#b"); mav.setViewName("index"); return mav; }
@RequestMapping("/petDetails") public ModelAndView petDetails(Integer petId) { Pet pet = petService.findById(petId); ModelAndView mav = new ModelAndView(); mav.addObject("pet", pet); mav.addObject("title", "查看宠物信息"); mav.addObject("mainPage", "page/customer/petDetails"); mav.addObject("mainPageKey", "#b");
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=231422312105200id
https://javayms.pages.dev?id=231422312105200id