首页 > 分享 > Java项目:宠物领养寄养商城系统(java+Springboot+HTML+bootstrap+mysql)

Java项目:宠物领养寄养商城系统(java+Springboot+HTML+bootstrap+mysql)

源码获取:俺的博客首页 "资源" 里下载!

项目介绍

管理员角色:
用户管理、角色管理、菜单管理、宠物信息、视频管理、在线留言、宠物用品管理、
常见问题管理、购物车、商城订单、领养订单、寄养订单

用户角色:
领养宠物、寄养宠物、视频秀、买家秀、在线留言、加入购物车、
购买、商城订单、领养订单、寄养订单

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;

6.是否Maven项目:是;

技术栈

1. 后端:SpringBoot+Mybatis

2. 前端:HTML+CSS+Bootstrap+jQuery

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;

3. 将项目中application.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,登录地址:http://localhost:8089/login

管理员: admin/admin123

普通账户: liming/123456

 

 

 

 

 

用户信息管理控制层:

@Controller

@RequestMapping("/system/user")

public class UserController extends BaseController

{

private String prefix = "system/user";

@Autowired

private IUserService userService;

@Autowired

private IRoleService roleService;

@Autowired

private IPostService postService;

@RequiresPermissions("system:user:view")

@GetMapping()

public String user()

{

return prefix + "/user";

}

@RequiresPermissions("system:user:list")

@PostMapping("/list")

@ResponseBody

public TableDataInfo list(User user)

{

startPage();

List<User> list = userService.selectUserList(user);

return getDataTable(list);

}

@Log(title = "用户管理", businessType = BusinessType.EXPORT)

@RequiresPermissions("system:user:export")

@PostMapping("/export")

@ResponseBody

public AjaxResult export(User user)

{

List<User> list = userService.selectUserList(user);

ExcelUtil<User> util = new ExcelUtil<User>(User.class);

return util.exportExcel(list, "用户数据");

}

@Log(title = "用户管理", businessType = BusinessType.IMPORT)

@RequiresPermissions("system:user:import")

@PostMapping("/importData")

@ResponseBody

public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception

{

ExcelUtil<User> util = new ExcelUtil<User>(User.class);

List<User> userList = util.importExcel(file.getInputStream());

String message = userService.importUser(userList, updateSupport);

return AjaxResult.success(message);

}

@RequiresPermissions("system:user:view")

@GetMapping("/importTemplate")

@ResponseBody

public AjaxResult importTemplate()

{

ExcelUtil<User> util = new ExcelUtil<User>(User.class);

return util.importTemplateExcel("用户数据");

}

@GetMapping("/add")

public String add(ModelMap mmap)

{

mmap.put("roles", roleService.selectRoleAll());

mmap.put("posts", postService.selectPostAll());

return prefix + "/add";

}

@RequiresPermissions("system:user:add")

@Log(title = "用户管理", businessType = BusinessType.INSERT)

@PostMapping("/add")

@ResponseBody

public AjaxResult addSave(@Validated User user)

{

if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName())))

{

return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");

}

else if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))

{

return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");

}

else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))

{

return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");

}

return toAjax(userService.insertUser(user));

}

@GetMapping("/edit/{userId}")

public String edit(@PathVariable("userId") Long userId, ModelMap mmap)

{

mmap.put("user", userService.selectUserById(userId));

mmap.put("roles", roleService.selectRolesByUserId(userId));

mmap.put("posts", postService.selectPostsByUserId(userId));

return prefix + "/edit";

}

@RequiresPermissions("system:user:edit")

@Log(title = "用户管理", businessType = BusinessType.UPDATE)

@PostMapping("/edit")

@ResponseBody

public AjaxResult editSave(@Validated User user)

{

userService.checkUserAllowed(user);

if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))

{

return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");

}

else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))

{

return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");

}

return toAjax(userService.updateUser(user));

}

@RequiresPermissions("system:user:resetPwd")

@Log(title = "重置密码", businessType = BusinessType.UPDATE)

@GetMapping("/resetPwd/{userId}")

public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)

{

mmap.put("user", userService.selectUserById(userId));

return prefix + "/resetPwd";

}

@RequiresPermissions("system:user:resetPwd")

@Log(title = "重置密码", businessType = BusinessType.UPDATE)

@PostMapping("/resetPwd")

@ResponseBody

public AjaxResult resetPwdSave(User user)

{

userService.checkUserAllowed(user);

if (userService.resetUserPwd(user) > 0)

{

if (ShiroUtils.getUserId() == user.getUserId())

{

setSysUser(userService.selectUserById(user.getUserId()));

}

return success();

}

return error();

}

@RequiresPermissions("system:user:remove")

@Log(title = "用户管理", businessType = BusinessType.DELETE)

@PostMapping("/remove")

@ResponseBody

public AjaxResult remove(String ids)

{

try

{

return toAjax(userService.deleteUserByIds(ids));

}

catch (Exception e)

{

return error(e.getMessage());

}

}

@PostMapping("/checkLoginNameUnique")

@ResponseBody

public String checkLoginNameUnique(User user)

{

return userService.checkLoginNameUnique(user.getLoginName());

}

@PostMapping("/checkPhoneUnique")

@ResponseBody

public String checkPhoneUnique(User user)

{

return userService.checkPhoneUnique(user);

}

@PostMapping("/checkEmailUnique")

@ResponseBody

public String checkEmailUnique(User user)

{

return userService.checkEmailUnique(user);

}

@Log(title = "用户管理", businessType = BusinessType.UPDATE)

@RequiresPermissions("system:user:edit")

@PostMapping("/changeStatus")

@ResponseBody

public AjaxResult changeStatus(User user)

{

userService.checkUserAllowed(user);

return toAjax(userService.changeStatus(user));

}

}

商品管理Controller:

@Controller

@RequestMapping("/system/product")

public class ProductController extends BaseController

{

private String prefix = "system/product";

@Autowired

private IProductService productService;

@Autowired

private ITypeService typeService;

@RequiresPermissions("system:product:view")

@GetMapping()

public String product()

{

return prefix + "/product";

}

@GetMapping("/pet")

public String pet(){

return "system/pet/pet";

}

@PostMapping("/petList")

@ResponseBody

public TableDataInfo petList(Product product)

{

startPage();

product.setProductType("宠物信息");

List<Product> list = productService.selectProductList(product);

return getDataTable(list);

}

@RequiresPermissions("system:product:list")

@PostMapping("/list")

@ResponseBody

public TableDataInfo list(Product product)

{

startPage();

product.setProductType("宠物用品");

List<Product> list = productService.selectProductList(product);

return getDataTable(list);

}

@RequiresPermissions("system:product:export")

@Log(title = "商品管理", businessType = BusinessType.EXPORT)

@PostMapping("/export")

@ResponseBody

public AjaxResult export(Product product)

{

List<Product> list = productService.selectProductList(product);

ExcelUtil<Product> util = new ExcelUtil<Product>(Product.class);

return util.exportExcel(list, "product");

}

@GetMapping("/add")

public String add( ModelMap mmap)

{

return prefix + "/add";

}

@GetMapping("/petAdd")

public String petAdd( ModelMap mmap)

{

return "system/pet/add";

}

@RequiresPermissions("system:product:add")

@Log(title = "商品管理", businessType = BusinessType.INSERT)

@PostMapping("/add")

@ResponseBody

public AjaxResult addSave(Product product) throws IOException

{

User user = ShiroUtils.getSysUser();

product.setUserId(user.getUserId());

return toAjax(productService.insertProduct(product));

}

@GetMapping("/edit/{productId}")

public String edit(@PathVariable("productId") Long productId, ModelMap mmap)

{

Product product = productService.selectProductById(productId);

mmap.put("product", product);

return prefix + "/edit";

}

@GetMapping("/petEdit/{productId}")

public String petAdit(@PathVariable("productId") Long productId, ModelMap mmap)

{

Product product = productService.selectProductById(productId);

mmap.put("product", product);

return prefix + "/edit";

}

@RequiresPermissions("system:product:edit")

@Log(title = "商品管理", businessType = BusinessType.UPDATE)

@PostMapping("/edit")

@ResponseBody

public AjaxResult editSave(Product product)

{

return toAjax(productService.updateProduct(product));

}

@RequiresPermissions("system:product:remove")

@Log(title = "商品管理", businessType = BusinessType.DELETE)

@PostMapping( "/remove")

@ResponseBody

public AjaxResult remove(String ids)

{

return toAjax(productService.deleteProductByIds(ids));

}

}

订单管理Controller:

@Controller

@RequestMapping("/system/order")

public class OrderController extends BaseController

{

private String prefix = "system/order";

@Autowired

private IOrderService orderService;

@Autowired

private IRoleService roleService;

@Autowired

private IProductService productService;

@Autowired

private IUserService userService;

@Autowired

private ICartService cartService;

@RequiresPermissions("system:order:view")

@GetMapping()

public String order(ModelMap mmap)

{

User user = ShiroUtils.getSysUser();

String roleString = roleService.selectRoleKeys(user.getUserId()).toString();

if(roleString.contains("admin")){

mmap.put("loginRole", "admin");

}elseif(roleString.contains("seller")){

mmap.put("loginRole", "seller");

}else{

mmap.put("loginRole", "buyer");

}

return prefix + "/order";

}

@RequiresPermissions("system:order:list")

@PostMapping("/list")

@ResponseBody

public TableDataInfo list(Order order)

{

User user = ShiroUtils.getSysUser();

String roleString = roleService.selectRoleKeys(user.getUserId()).toString();

startPage();

List<Order> list;

if(roleString.contains("admin")){

list = orderService.selectOrderList(order);

}elseif(roleString.contains("seller")){

list = orderService.selectOrderBySellerId(user.getUserId());

List<Order> queryList = new ArrayList<Order>();

if(StringUtils.isNotEmpty(order.getOrderStatus())){

for(int i = 0 ; i < list.size();i++){

if(list.get(i).getOrderStatus().equals(order.getOrderStatus())){

queryList.add(list.get(i));

}

}

list = queryList;

}

}else{

order.setUserId(user.getUserId());

list = orderService.selectOrderList(order);

}

return getDataTable(list);

}

@RequiresPermissions("system:order:export")

@Log(title = "订单管理", businessType = BusinessType.EXPORT)

@PostMapping("/export")

@ResponseBody

public AjaxResult export(Order order)

{

List<Order> list = orderService.selectOrderList(order);

ExcelUtil<Order> util = new ExcelUtil<Order>(Order.class);

return util.exportExcel(list, "order");

}

@GetMapping("/add")

public String add()

{

return prefix + "/add";

}

@RequiresPermissions("system:order:add")

@Log(title = "订单管理", businessType = BusinessType.INSERT)

@PostMapping("/add")

@ResponseBody

public AjaxResult addSave(Order order)

{

return toAjax(orderService.insertOrder(order));

}

@Log(title = "订单管理", businessType = BusinessType.INSERT)

@PostMapping("/create")

@ResponseBody

public AjaxResult create(Order order)

{

User user = userService.selectUserById(ShiroUtils.getSysUser().getUserId());

order.setOrderStatus("0");

order.setUserId(user.getUserId());

order.setOrderTime(new Date());

order.setPayWay("0");

orderService.insertOrder(order);

Cart cart = new Cart();

cart.setUserId(order.getUserId());

cart.setProductId(order.getProductId());

List<Cart> carts = cartService.selectCartList(cart);

for(Cart item : carts){

cartService.deleteCartById(item.getCartId());

}

return AjaxResult.success(order.getOrderId());

}

@Log(title = "订单管理", businessType = BusinessType.INSERT)

@GetMapping("/createorder/{productId}")

public String createorder(@PathVariable("productId") Long productId , ModelMap mmap)

{

Product product = productService.selectProductById(productId);

mmap.put("productId", productId);

mmap.put("orderPrice", product.getProductPrice());

return "front/createorder";

}

@GetMapping("/edit/{orderId}")

public String edit(@PathVariable("orderId") Long orderId, ModelMap mmap)

{

Order order = orderService.selectOrderById(orderId);

mmap.put("order", order);

return prefix + "/edit";

}

@GetMapping("/pay/{orderId}")

public String pay(@PathVariable("orderId") Long orderId, ModelMap mmap)

{

Order order = orderService.selectOrderById(orderId);

mmap.put("order", order);

return prefix + "/pay";

}

@GetMapping("/comment/{orderId}")

public String comment(@PathVariable("orderId") Long orderId, ModelMap mmap)

{

Order order = orderService.selectOrderById(orderId);

mmap.put("order", order);

return prefix + "/comment";

}

@Log(title = "订单管理", businessType = BusinessType.UPDATE)

@PostMapping("/comment")

@ResponseBody

public AjaxResult commentSave(Order order)

{

Order saveOrder = orderService.selectOrderById(order.getOrderId());

saveOrder.setOrderComment(order.getOrderComment());

saveOrder.setOrderCommentTime(new Date());

saveOrder.setOrderStatus("5");

saveOrder.setCommentUrl(order.getCommentUrl());

return toAjax(orderService.updateOrder(saveOrder));

}

@GetMapping("/payOrder/{orderId}")

@ResponseBody

public AjaxResult payOrder(@PathVariable("orderId") Long orderId, ModelMap mmap)

{

Order order = orderService.selectOrderById(orderId);

order.setOrderStatus("1");

return toAjax(orderService.updateOrder(order));

}

@PostMapping("/payOrder")

@ResponseBody

public AjaxResult payOrder(Order order, ModelMap mmap)

{

order.setOrderStatus("1");

return toAjax(orderService.updateOrder(order));

}

@GetMapping("/confirmStatus/{orderId}")

@ResponseBody

public AjaxResult confirmStatus(@PathVariable("orderId") Long orderId, ModelMap mmap)

{

Order order = orderService.selectOrderById(orderId);

order.setOrderStatus("2");

return toAjax(orderService.updateOrder(order));

}

@GetMapping("/sendStatus/{orderId}")

@ResponseBody

public AjaxResult sendStatus(@PathVariable("orderId") Long orderId, ModelMap mmap)

{

Order order = orderService.selectOrderById(orderId);

order.setOrderStatus("3");

return toAjax(orderService.updateOrder(order));

}

@GetMapping("/receiveStatus/{orderId}")

@ResponseBody

public AjaxResult receiveStatus(@PathVariable("orderId") Long orderId, ModelMap mmap)

{

Order order = orderService.selectOrderById(orderId);

order.setOrderStatus("4");

return toAjax(orderService.updateOrder(order));

}

@RequiresPermissions("system:order:edit")

@Log(title = "订单管理", businessType = BusinessType.UPDATE)

@PostMapping("/edit")

@ResponseBody

public AjaxResult editSave(Order order)

{

return toAjax(orderService.updateOrder(order));

}

@RequiresPermissions("system:order:remove")

@Log(title = "订单管理", businessType = BusinessType.DELETE)

@PostMapping( "/remove")

@ResponseBody

public AjaxResult remove(String ids)

{

return toAjax(orderService.deleteOrderByIds(ids));

}

}

 源码获取:俺的博客首页 "资源" 里下载!

相关知识

【Java项目】java实战宠物领养系统项目
SSM宠物领养系统:Java项目实战
【源码及课件分享】Java实战项目之宠物领养系统
springboot+vue宠物领养寄养系统【开题+程序+论文】
Java计算机毕业设计宠物寄养系统(开题+源码+论文)
java毕业设计宠物寄养预约系统Mybatis+系统+数据库+调试部署
java宠物商城源码
宠物用品商城领养寄养医疗挂号系统uniapp 微信小程序
Java项目:108 springboot宠物领养系统的设计与实现
Java基于JAVA语言的宠物寄养管理(开题+源码)

网址: Java项目:宠物领养寄养商城系统(java+Springboot+HTML+bootstrap+mysql) https://m.mcbbbk.com/newsview543241.html

所属分类:萌宠日常
上一篇: 免费零撸新体验》《只有战斗》在线
下一篇: 各地领养宠物渠道合辑,持续更新i