基于javaweb和mysql的springboot宠物领养寄养商城系统(java+springboot+html+thymeleaf+bootstrap+mysql+maven)
·
基于javaweb和mysql的springboot宠物领养寄养商城系统(java+springboot+html+thymeleaf+bootstrap+mysql+maven)
私信源码获取及调试交流
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SpringBoot宠物领养寄养商城系统(java+springboot+html+thymeleaf+bootstrap+mysql+maven)
项目介绍
管理员角色: 用户管理、角色管理、菜单管理、宠物信息、视频管理、在线留言、宠物用品管理、 常见问题管理、购物车、商城订单、领养订单、寄养订单
用户角色: 领养宠物、寄养宠物、视频秀、买家秀、在线留言、加入购物车、 购买、商城订单、领养订单、寄养订单
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7版本;
技术栈
-
后端:SpringBoot+Mybatis
-
前端:HTML+CSS+Bootstrap+jQuery
使用说明
运行项目,登录地址:http://localhost:8089/login
管理员: admin/admin123
普通账户: liming/123456
User user = ShiroUtils.getSysUser();
sysParkpetOrder.setUserId(user.getUserId());
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmsss");
String number = format.format(new Date());
sysParkpetOrder.setOrderNumber(number);
sysParkpetOrderService.insertSysParkpetOrder(sysParkpetOrder);
return AjaxResult.success(number);
}
/**
* 修改寄养订单管理
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
SysParkpetOrder sysParkpetOrder = sysParkpetOrderService.selectSysParkpetOrderById(id);
mmap.put("sysParkpetOrder", sysParkpetOrder);
return prefix + "/edit";
}
/**
* 修改保存寄养订单管理
*/
@Log(title = "寄养订单管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysParkpetOrder sysParkpetOrder)
{
return toAjax(sysParkpetOrderService.updateSysParkpetOrder(sysParkpetOrder));
}
/**
* 删除寄养订单管理
*/
@Log(title = "寄养订单管理", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
product.setProductName(bookName);
List<Product> productList = productService.selectProductList(product);
mmap.put("productList", productList);
return prefix + "/index";
}
/**
* 进入我要领养界面
*
* @return
*/
@GetMapping("/visit_recycle")
public String visitRecycle(ModelMap mmap) {
// 获取当前登陆人信息
User user = ShiroUtils.getSysUser();
if (user == null) {
return "login";
}
mmap.put("userName", user.getUserName());
// 获取流浪宠物的信息
Product product = new Product();
product.setProductType("宠物信息");
product.setPetType("流浪");
List<Product> productList = productService.selectProductList(product);
mmap.put("productList", productList);
return prefix + "/visitRecycle";
}
/**
* 进入寄养宠物界面
* @param mmap
* @return
*/
@GetMapping("/parkPet")
public String parkPet(ModelMap mmap){
// 获取当前登陆人信息
User user = ShiroUtils.getSysUser();
if (user == null) {
{
return toAjax(roleService.insertAuthUsers(roleId, userIds));
}
}
/**
* 用户信息
*/
@Controller
@RequestMapping("/system/user")
public class UserController extends BaseController
{
private String prefix = "system/user";
@Autowired
public AjaxResult cancelAuthUserAll(Long roleId, String userIds)
{
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
}
/**
* 选择用户
*/
@GetMapping("/authUser/selectUser/{roleId}")
public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
{
mmap.put("role", roleService.selectRoleById(roleId));
return prefix + "/selectUser";
}
/**
* 查询未分配用户角色列表
*/
@RequiresPermissions("system:role:list")
@PostMapping("/authUser/unallocatedList")
@ResponseBody
public TableDataInfo unallocatedList(User user)
{
startPage();
List<User> list = userService.selectUnallocatedList(user);
return getDataTable(list);
}
/**
* 批量选择用户授权
*/
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PostMapping("/authUser/selectAll")
@ResponseBody
public AjaxResult selectAuthUserAll(Long roleId, String userIds)
{
return toAjax(roleService.insertAuthUsers(roleId, userIds));
}
}
{
WebUtils.issueRedirect(request, response, kickoutUrl);
}
return false;
}
public void setMaxSession(int maxSession)
{
this.maxSession = maxSession;
}
public void setKickoutAfter(boolean kickoutAfter)
{
this.kickoutAfter = kickoutAfter;
}
public void setKickoutUrl(String kickoutUrl)
{
this.kickoutUrl = kickoutUrl;
}
public void setSessionManager(SessionManager sessionManager)
{
this.sessionManager = sessionManager;
}
// 设置Cache的key的前缀
public void setCacheManager(CacheManager cacheManager)
{
// 必须和ehcache缓存配置中的缓存name一致
this.cache = cacheManager.getCache(ShiroConstants.SYS_USERCACHE);
}
}
}
case SECTION_5:
switch (b1)
{
case SECTION_6:
return true;
}
default:
return false;
}
}
/**
* 将IPv4地址转换成字节
*
* @param text IPv4地址
* @return byte 字节
*/
public static byte[] textToNumericFormatV4(String text)
{
if (text.length() == 0)
{
return null;
}
byte[] bytes = new byte[4];
String[] elements = text.split("\\.", -1);
try
{
long l;
int i;
switch (elements.length)
{
case 1:
l = Long.parseLong(elements[0]);
if ((l < 0L) || (l > 4294967295L))
return null;
bytes[0] = (byte) (int) (l >> 24 & 0xFF);
bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF);
bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
@GetMapping()
public String order(ModelMap mmap)
{
User user = ShiroUtils.getSysUser();
if(user.getRoles().get(0).getRoleId() == 2){
mmap.put("editFlag","hidden");
mmap.put("removeFlag","");
}else{
mmap.put("removeFlag","hidden");
mmap.put("editFlag","");
}
return prefix + "/order";
}
@GetMapping("/analyse")
public String analyse(){
return prefix + "/analyse";
}
/**
* 查询回收订单信息列表
*/
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysRecycleOrder sysRecycleOrder)
{
startPage();
User user = ShiroUtils.getSysUser();
if(user.getRoles().get(0).getRoleId() == 2){
sysRecycleOrder.setUserId(user.getUserId());
}
List<SysRecycleOrder> list = sysRecycleOrderService.selectSysRecycleOrderList(sysRecycleOrder);
return getDataTable(list);
}
/**
* 新增回收订单信息
*/
@GetMapping("/add")
public String add()
{
// 获取当前登陆人信息
User user = ShiroUtils.getSysUser();
if(user == null){
return "login";
}
private IProductService productService;
@Autowired
private IOrderService orderService;
@Autowired
private IMessageService messageService;
@Autowired
private ISysVideoService sysVideoService;
@GetMapping("")
public String front(ModelMap mmap,String productName) {
User user = ShiroUtils.getSysUser();
if (user != null) {
mmap.put("userName", user.getUserName());
} else {
return "login";
}
Type type = new Type();
type.setTypeStatus("0");
List<Type> typeList = typeService.selectTypeList(type);
mmap.put("typeList", typeList);
Product product = new Product();
product.setProductName(productName);
product.setProductType("宠物用品");
List<Product> petList = productService.selectProductList(product);
mmap.put("petList", petList);
product.setProductType("宠物信息");
product.setPetType("售卖");
List<Product> productList = productService.selectProductList(product);
mmap.put("productList", productList);
return prefix + "/index1";
}
@GetMapping("/index")
public String index(ModelMap mmap) {
User user = ShiroUtils.getSysUser();
/**
* 参数配置 信息操作处理
*/
@Controller
@RequestMapping("/system/config")
public class ConfigController extends BaseController
{
private String prefix = "system/config";
@Autowired
private IConfigService configService;
@RequiresPermissions("system:config:view")
@GetMapping()
public String config()
{
return prefix + "/config";
}
/**
* 查询参数配置列表
*/
@RequiresPermissions("system:config:list")
/**
* 购物车Controller
*/
@Controller
@RequestMapping("/system/cart")
public class CartController extends BaseController
{
private String prefix = "system/cart";
@Autowired
private ICartService cartService;
@RequiresPermissions("system:cart:view")
@GetMapping()
public String cart()
{
return prefix + "/cart";
}
/**
* 查询购物车列表
*/
@RequiresPermissions("system:cart:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(Cart cart)
{
Long userId = ShiroUtils.getSysUser().getUserId();
cart.setUserId(userId);
startPage();
List<Cart> list = cartService.selectCartList(cart);
return getDataTable(list);
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));
}
}
/**
* 角色信息
*/
@Controller
public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap)
{
mmap.put("menu", menuService.selectMenuById(menuId));
return prefix + "/edit";
}
/**
* 修改保存菜单
*/
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:menu:edit")
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated Menu menu)
{
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
{
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
}
return toAjax(menuService.updateMenu(menu));
}
/**
* 选择菜单图标
*/
@GetMapping("/icon")
public String icon()
{
return prefix + "/icon";
}
/**
* 校验菜单名称
*/
@PostMapping("/checkMenuNameUnique")
@ResponseBody
public String checkMenuNameUnique(Menu menu)
{
return menuService.checkMenuNameUnique(menu);
}
/**
* 加载角色菜单列表树
*/
@GetMapping("/roleMenuTreeData")
@ResponseBody
public List<Ztree> roleMenuTreeData(Role role)
{
List<Ztree> ztrees = menuService.roleMenuTreeData(role);
return ztrees;
}
/**
* 查询购物车列表
*/
@RequiresPermissions("system:cart:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(Cart cart)
{
Long userId = ShiroUtils.getSysUser().getUserId();
cart.setUserId(userId);
startPage();
List<Cart> list = cartService.selectCartList(cart);
return getDataTable(list);
}
/**
* 导出购物车列表
*/
@RequiresPermissions("system:cart:export")
@Log(title = "购物车", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(Cart cart)
{
List<Cart> list = cartService.selectCartList(cart);
ExcelUtil<Cart> util = new ExcelUtil<Cart>(Cart.class);
return util.exportExcel(list, "cart");
}
/**
* 新增购物车
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存购物车
*/
@RequiresPermissions("system:cart:add")
@Log(title = "购物车", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(Cart cart)
{
return toAjax(cartService.insertCart(cart));
}
/**
public String add()
{
return prefix + "/add";
}
/**
* 新增保存字典类型
*/
@Log(title = "字典类型", businessType = BusinessType.INSERT)
@RequiresPermissions("system:dict:add")
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated DictType dict)
{
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
{
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
return toAjax(dictTypeService.insertDictType(dict));
}
/**
* 修改字典类型
*/
@GetMapping("/edit/{dictId}")
public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap)
{
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
return prefix + "/edit";
}
/**
* 修改保存字典类型
*/
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:dict:edit")
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated DictType dict)
{
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
{
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
return toAjax(dictTypeService.updateDictType(dict));
}
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@RequiresPermissions("system:dict:remove")
@PostMapping("/remove")
@ResponseBody
@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");
}
@Controller
@RequestMapping("/system/dict")
public class DictTypeController extends BaseController
{
private String prefix = "system/dict/type";
@Autowired
private IDictTypeService dictTypeService;
@RequiresPermissions("system:dict:view")
@GetMapping()
public String dictType()
{
return prefix + "/type";
}
@PostMapping("/list")
@RequiresPermissions("system:dict:list")
@ResponseBody
public TableDataInfo list(DictType dictType)
{
startPage();
List<DictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
}
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:dict:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(DictType dictType)
{
List<DictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<DictType> util = new ExcelUtil<DictType>(DictType.class);
return util.exportExcel(list, "字典类型");
}
/**
* 新增字典类型
* 修改用户
*/
@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";
}
}
return error();
}
@RequiresPermissions("system:role:remove")
@Log(title = "角色管理", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
try
{
return toAjax(roleService.deleteRoleByIds(ids));
}
catch (Exception e)
{
return error(e.getMessage());
}
}
/**
* 校验角色名称
*/
@PostMapping("/checkRoleNameUnique")
@ResponseBody
public String checkRoleNameUnique(Role role)
{
return roleService.checkRoleNameUnique(role);
}
/**
* 校验角色权限
*/
@PostMapping("/checkRoleKeyUnique")
@ResponseBody
public String checkRoleKeyUnique(Role role)
{
return roleService.checkRoleKeyUnique(role);
}
/**
* 选择菜单树
*/
@GetMapping("/selectMenuTree")
public String selectMenuTree()
{
return prefix + "/tree";
}
/**
* 角色状态修改







更多推荐



所有评论(0)