基于javaweb+mysql的springboot前台+后台精品水果商城系统设计和实现(java+springboot+ssm+mysql+html+maven)

基于javaweb+mysql的springboot前台+后台精品水果商城系统设计和实现(java+springboot+ssm+mysql+html+maven)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb+mysql的SpringBoot前台+后台精品水果商城系统设计和实现(java+springboot+ssm+mysql+html+maven)

一、项目简述

本系统主要实现的功能有: 前台用户的登录注册,水果商品的展示,水果的购物车, 购物车新增结算等等,银行卡的支付绑定,收货地址的维护,密码修改等等功能 后台管理的用户管理,商品管理,分类管理,订单管理等等。

二、项目运行

1运行环境

环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)

项目技术: Springboot+ SpringMVC + MyBatis + HTML + ThymeLeaf + JavaScript + JQuery + Ajax + maven等等

			Map<String, Object> param = new HashMap<String, Object>();
			List<ClassifyEntity> classifyEntities = classifyDao.listByMap(param);
			mv.addObject("classifys",classifyEntities);
			mv.addObject("product",product);
		} catch (Exception e) {
			e.printStackTrace();
		}
		mv.setViewName("/customer/single");
		return mv;
	}
}
package com.zou.application.controller.admin;

@Controller
@RequestMapping("/admin/product")
public class ProductController {
	
	@Autowired
	private ProductEntityMapper productDao;
	
	@RequestMapping("/addProductPage")
	public String addProductPage(){
		return "/admin/product/product_add";
	}
		if(StringUtils.isEmpty(username)){
			mv.addObject("code","100");
			mv.addObject("message","用户名不能为空");
			mv.setViewName("/admin/admin_login");
			return mv;
		}else if(StringUtils.isEmpty(password)){
			mv.addObject("code","100");
			mv.addObject("message","用户名不能为空");
			mv.setViewName("/admin/admin_login");
			return mv;
		}else if(!adminUsername.equals(username)){
			mv.addObject("code","100");
			mv.addObject("message","用户名不正确");
			mv.setViewName("/admin/admin_login");
			return mv;
		}else if(!adminPassword.equals(password)){
			mv.addObject("code","100");
			mv.addObject("message","密码 不正确");
			mv.setViewName("/admin/admin_login");
			return mv;
		}
		Map<String, Object> param = new HashMap<String, Object>();
		List<UserEntity> userEntities = userEntityMapper.listByMap(param);
		mv.addObject("username",username);
		mv.addObject("users",userEntities);
		mv.setViewName("/admin/user/user_list");
		return mv;
	}
	
	
}
package com.zou.application.controller.admin;

			request.setAttribute("code", "301");
			request.setAttribute("msg", "请先登陆");
			return false;
		}
		return true;
	}

	@Override
	public void postHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler,
			ModelAndView modelAndView) throws Exception {
		Integer userId = (Integer) request.getSession().getAttribute("userId");
		if(userId == null){
			response.sendRedirect("/user/login");
			request.setAttribute("code", "301");
			request.setAttribute("msg", "请先登陆");
		}
	}

	@Override
	public void afterCompletion(HttpServletRequest request,
			HttpServletResponse response, Object handler, Exception ex)
			throws Exception {
	}
}
package com.zou.application.controller.admin;

@Controller(value="manageUser")
@RequestMapping("/admin/user")
public class UserController {
	
	@Autowired
	private UserEntityMapper userEntityMapper;
	
	/**
	 * 管理员账号登陆控制层
			mv.setViewName("/admin/admin_login");
			return mv;
		}else if(!adminPassword.equals(password)){
			mv.addObject("code","100");
			mv.addObject("message","密码 不正确");
			mv.setViewName("/admin/admin_login");
			return mv;
		}
		Map<String, Object> param = new HashMap<String, Object>();
		List<UserEntity> userEntities = userEntityMapper.listByMap(param);
		mv.addObject("username",username);
		mv.addObject("users",userEntities);
		mv.setViewName("/admin/user/user_list");
		return mv;
	}
	
	
}
package com.zou.application.controller.admin;

@Controller
		mv.setViewName("/admin/user/user_list");
		return mv;
	}
}
package com.zou.application.controller.admin;

@Controller
@RequestMapping("/admin/orders")
public class OrdersController {
	
	@Autowired
	private OrderEntityMapper orderDao;
	
	
	@RequestMapping("/ordersList")
	public ModelAndView classifyList(HttpServletRequest request){
		ModelAndView mv = new ModelAndView();
		Map<String, Object> param = new HashMap<String, Object>();
		List<OrderEntity> orders = orderDao.listByMap(param);
		mv.addObject("orders",orders);
		mv.setViewName("/admin/order/order_list");
		return mv;
	}
}
package com.zou.application.controller.customer;

@RequestMapping("/system")
@Controller
public class SystemController {
	
	@RequestMapping("/contactus")
	public String contactus(){
		return "/customer/contact";
	}
}
package com.zou.application.controller.customer;

@Controller
@RequestMapping("/shopcar")
public class ShopCarController {
	
	@Autowired
	private ShopCarEntityMapper shopCarDao;
	@Autowired
	private UserEntityMapper userDao;
	@Autowired
	private ProductEntityMapper productDao;
	
	@RequestMapping("/addCar")
	@ResponseBody
	public JSONObject addCar(HttpServletRequest request,HttpSession session){
		JSONObject result = new JSONObject();
		Integer userId = (Integer) session.getAttribute("userId");
		if(userId == null){

@Controller
@RequestMapping("/shopcar")
public class ShopCarController {
	
	@Autowired
	private ShopCarEntityMapper shopCarDao;
	@Autowired
	private UserEntityMapper userDao;
	@Autowired
	private ProductEntityMapper productDao;
	
	@RequestMapping("/addCar")
	@ResponseBody
	public JSONObject addCar(HttpServletRequest request,HttpSession session){
		JSONObject result = new JSONObject();
		Integer userId = (Integer) session.getAttribute("userId");
		if(userId == null){
			result.put("msg", "请先登陆");
			result.put("code", "301");
			return result;
		}
		try {
			UserEntity userEntity = userDao.selectById(userId);
			String productId = request.getParameter("productId");
			ShopCarEntity shopCar = shopCarDao.selectProId(Integer.parseInt(productId));
			if(shopCar!=null){
				shopCar.setProductNum(shopCar.getProductNum()+1);
				shopCar.setModifyTime(new Date());
				shopCarDao.update(shopCar);
			}else{
				ProductEntity productEntity = productDao.selectById(Integer.valueOf(productId));
				ShopCarEntity shopCarEntity = new ShopCarEntity();
				shopCarEntity.setUserId(userId);
				shopCarEntity.setProductId(Integer.valueOf(productId));
				shopCarEntity.setProductName(productEntity.getName());
				shopCarEntity.setProductImg(productEntity.getImg());
				shopCarEntity.setCreateTime(new Date());
				shopCarEntity.setProductNum(1);
				shopCarEntity.setCreater(userEntity.getName());
				shopCarEntity.setSkuName(productEntity.getSku());
				shopCarEntity.setRelPrice(productEntity.getRelPrice());
			mv.addObject("product",product);
		} catch (Exception e) {
			e.printStackTrace();
		}
		mv.setViewName("/customer/single");
		return mv;
	}
}
package com.zou.application.controller.admin;

@Controller
@RequestMapping("/admin/product")
public class ProductController {
	
	@Autowired
	private ProductEntityMapper productDao;
	
	@RequestMapping("/addProductPage")
	public String addProductPage(){
		return "/admin/product/product_add";
	}
	
	@RequestMapping("/addProduct")
	@RequestMapping("/loginout")
	public String indexPage(HttpSession session){
		return "/admin/admin_login";
	}
	
	/**
	 * 管理员账号登陆控制层
	 * @param request
	 * @return
	 */
	@RequestMapping("/checkPassWord")
	public ModelAndView adminLogin(HttpServletRequest request){
		ModelAndView mv = new ModelAndView();
		String username = request.getParameter("username");
		String password = request.getParameter("password");
		if(StringUtils.isEmpty(username)){
			mv.addObject("code","100");
			mv.addObject("message","用户名不能为空");
			mv.setViewName("/admin/admin_login");
			return mv;
		}else if(StringUtils.isEmpty(password)){
			mv.addObject("code","100");
			mv.addObject("message","用户名不能为空");
			mv.setViewName("/admin/admin_login");
			return mv;
		}else if(!adminUsername.equals(username)){
			mv.addObject("code","100");
			mv.addObject("message","用户名不正确");
			mv.setViewName("/admin/admin_login");
			return mv;
		}else if(!adminPassword.equals(password)){
			mv.addObject("code","100");
			mv.addObject("message","密码 不正确");
			mv.setViewName("/admin/admin_login");
			return mv;
		}
		Map<String, Object> param = new HashMap<String, Object>();
		List<UserEntity> userEntities = userEntityMapper.listByMap(param);
		mv.addObject("username",username);
		mv.addObject("users",userEntities);
		mv.setViewName("/admin/user/user_list");
		return mv;
	private UserEntityMapper userEntityMapper;
	
	/**
	 * 管理员账号登陆控制层
	 * @param request
	 * @return
	 */
	@RequestMapping("/userList")
	public ModelAndView userList(HttpServletRequest request){
		ModelAndView mv = new ModelAndView();
		Map<String, Object> param = new HashMap<String, Object>();
		try {
			List<UserEntity> userEntities = userEntityMapper.listByMap(param);
			mv.addObject("users",userEntities);
		} catch (Exception e) {
			e.printStackTrace();
		}
		mv.setViewName("/admin/user/user_list");
		return mv;
	}
}
package com.zou.application.controller.admin;

@Controller
@RequestMapping("/admin/orders")
public class OrdersController {
	
	@Autowired
	private OrderEntityMapper orderDao;
	
	
	@RequestMapping("/ordersList")
	public ModelAndView classifyList(HttpServletRequest request){
		ModelAndView mv = new ModelAndView();
		Map<String, Object> param = new HashMap<String, Object>();

@Controller
@RequestMapping("/admin/orders")
public class OrdersController {
	
	@Autowired
	private OrderEntityMapper orderDao;
	
	
	@RequestMapping("/ordersList")
	public ModelAndView classifyList(HttpServletRequest request){
		ModelAndView mv = new ModelAndView();
		Map<String, Object> param = new HashMap<String, Object>();
		List<OrderEntity> orders = orderDao.listByMap(param);
		mv.addObject("orders",orders);
		mv.setViewName("/admin/order/order_list");
		return mv;
	}
}
package com.zou.application.controller.customer;

@RequestMapping("/system")
@Controller
public class SystemController {
	
	@RequestMapping("/contactus")
	public String contactus(){
		return "/customer/contact";
	}
	
	@RequestMapping("/codes")
	public String codes(){
		return "/customer/codes";
	}
	
	@RequestMapping("/testLayer")
	public String testLayer(){
		return "/test/testLayer";
			
			ShopCarEntity shopCarEntity = shopCarDao.selectById(Integer.parseInt(carId));
			ProductEntity productEntity = productDao.selectById(shopCarEntity.getProductId());
//			if(productEntity.getProductNum() < Integer.parseInt(number)){
//				result.put("code","100");
//				result.put("msg","库存不足");
//				return result;
//			}
			shopCarEntity.setProductNum(Integer.parseInt(number));
			shopCarEntity.setId(Integer.parseInt(carId));
			shopCarDao.update(shopCarEntity);
			result.put("code","200");
			result.put("msg","删除成功");
		} catch (Exception e) {
			e.printStackTrace();
			result.put("code","100");
			result.put("msg","系统异常");
		}
		return result;
	}
}
package com.zou.application.controller.customer;

@Controller
@RequestMapping("/bankcar")
public class BankCarController {
	
	@Autowired
	private UserEntityMapper userEntityMapper;
	@Autowired
	private BankCarEntityMapper bankDao;
	
	
	@RequestMapping("/bankcarPage")
	public ModelAndView contactusPage(HttpServletRequest request){
	 * @param session
	 * @return
	 */
	@RequestMapping("/shopcarList")
	public ModelAndView shopcarList(HttpServletRequest request,HttpSession session){
		ModelAndView mv = new ModelAndView();
		Integer userId = (Integer) session.getAttribute("userId");
		try {
			Map<String, Object> param = new HashMap<String, Object>();
			param.put("userId", userId);
			param.put("status", 1);
			List<ShopCarEntity> shopCarEntities = shopCarDao.listByMap(param);
			mv.addObject("shopCars",shopCarEntities);
			mv.setViewName("/customer/shop_car");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return mv;
	}
	
	/**
	 * 删除购物车信息
	 * @param request
	 * @param session
	 * @return
	 */
	@RequestMapping("/deleShopCar")
	@ResponseBody
	public JSONObject deleShopCar(HttpServletRequest request,HttpSession session){
		JSONObject result = new JSONObject();
		try {
			Integer userId = (Integer) session.getAttribute("userId");
			String carId = request.getParameter("carId");
			UserEntity userEntity = userDao.selectById(userId);
			if(userEntity != null){
				shopCarDao.delete(Integer.valueOf(carId));
			}
			result.put("msg", "删除购物车成功");
			result.put("code", "200");
		} catch (Exception e) {
			e.printStackTrace();
			result.put("msg", "系统异常");
			result.put("code", "500");
		}
		return result;
	}
	
	@RequestMapping("/delete")
	@ResponseBody
	public JSONObject delete(HttpServletRequest request){
		JSONObject result = new JSONObject();
		String carId = request.getParameter("carId");
			result.put("code","100");
			result.put("message","用户名不能为空");
			return result;
		}
		String orderId = request.getParameter("orderId");
		try {
			orderDao.delete(Integer.valueOf(orderId));
			result.put("code", "200");
			result.put("msg", "删除成功");
		} catch (Exception e) {
			e.printStackTrace();
			result.put("code", "100");
			result.put("msg", "删除失败");
		}
		return result;
	}
	
	@RequestMapping("/cancleOrder")
	@ResponseBody
	public JSONObject cancleOrder(HttpSession session,HttpServletRequest request){
		JSONObject result = new JSONObject();
		Integer userId = (Integer) session.getAttribute("userId");
		if(userId == null){
			result.put("code","100");
			result.put("message","用户名不能为空");
		}
		String orderId = request.getParameter("orderId");
		try {
			UserEntity userEntity = new UserEntity();
			userEntity=userEntityMapper.selectById(userId);
			OrderEntity orderEntity =new OrderEntity();
			orderEntity.setId(Integer.valueOf(orderId));
			orderEntity.setModifier(userEntity.getUserName());
			orderEntity.setModifyTime(new Date());
			orderEntity.setStatus((short)3);
			orderDao.update(orderEntity);
			result.put("code", "200");
			result.put("msg", "取消成功");
		} catch (Exception e) {
			e.printStackTrace();
			result.put("code", "100");
			result.put("msg", "删除失败");
		}
		return result;
	}
	
	
	@RequestMapping("/addProductPage")
	public String addProductPage(){
		return "/admin/product/product_add";
	}
	
	@RequestMapping("/addProduct")
	public String addProduct(HttpServletRequest request,ProductEntity product){
		try {
			if(product != null){
				product.setCreater("admin");
				product.setCreateTime(new Date());
				product.setStatus((short)1);
				product.setIsDelete((short)0);
				productDao.insert(product);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "redirect:/admin/product/productList";
	}
	
	@RequestMapping("/productList")
	public ModelAndView productList(HttpServletRequest request){
		ModelAndView mv = new ModelAndView();
		Map<String, Object> param = new HashMap<String, Object>();
		List<ProductEntity> productEntities = productDao.listByMap(param);
		mv.addObject("products",productEntities);
		mv.setViewName("/admin/product/product_list");
		return mv;
	}
	
	@RequestMapping("/delete")
	@ResponseBody
	public JSONObject delete(HttpServletRequest request){
		JSONObject result = new JSONObject();
		String productId = request.getParameter("productId");
		if(StringUtils.isEmpty(productId)){
			result.put("code","100");
			result.put("msg","");
			return result;
		}
		try {
			productDao.delete(Integer.parseInt(productId));
			result.put("code","200");
			result.put("msg","删除成功");
		} catch (Exception e) {
			e.printStackTrace();

@Controller
@RequestMapping("/bankcar")
public class BankCarController {
	
	@Autowired
	private UserEntityMapper userEntityMapper;
	@Autowired
	private BankCarEntityMapper bankDao;
	
	
	@RequestMapping("/bankcarPage")
	public ModelAndView contactusPage(HttpServletRequest request){
		ModelAndView mv = new ModelAndView("/customer/add_bank_car");
		return mv;
	}
	
	@RequestMapping("/bankcarInfo")
	public ModelAndView bankcarInfo(HttpServletRequest request,HttpSession session){
		ModelAndView mv = new ModelAndView("/customer/bank_car");
		Integer userId = (Integer) session.getAttribute("userId");
		try {
			BankCarEntity bankCar = bankDao.selectByUserId(userId);
			if(bankCar == null){
				mv.setViewName("/customer/add_bank_car");
			}
			mv.addObject("bankCar",bankCar);
		} catch (Exception e) {
			e.printStackTrace();
		return true;
	}

	@Override
	public void postHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler,
			ModelAndView modelAndView) throws Exception {
		Integer userId = (Integer) request.getSession().getAttribute("userId");
		if(userId == null){
			response.sendRedirect("/user/login");
			request.setAttribute("code", "301");
			request.setAttribute("msg", "请先登陆");
		}
	}

	@Override
	public void afterCompletion(HttpServletRequest request,
			HttpServletResponse response, Object handler, Exception ex)
			throws Exception {
	}
}
package com.zou.application.controller.admin;

@Controller(value="manageUser")
@RequestMapping("/admin/user")
public class UserController {
	
	@Autowired
	private UserEntityMapper userEntityMapper;
	
	/**
			e.printStackTrace();
		}
		mv.setViewName("/customer/products");
		return mv;
	}
	
	
	/**
	 * 查看商品详情
	 * @param request
	 * @return
	 */
	@RequestMapping("/signle")
	public ModelAndView productList(HttpServletRequest request){
		ModelAndView mv = new ModelAndView();
		String id = request.getParameter("id");
		try {
			ProductEntity product = productDao.selectById(Integer.parseInt(id));
			Map<String, Object> param = new HashMap<String, Object>();
			List<ClassifyEntity> classifyEntities = classifyDao.listByMap(param);
			mv.addObject("classifys",classifyEntities);
			mv.addObject("product",product);
		} catch (Exception e) {
			e.printStackTrace();
		}
		mv.setViewName("/customer/single");
		return mv;
	}
}
package com.zou.application.controller.admin;

		return mv;
	}
	
	@RequestMapping("/updateCar")
	public ModelAndView updateCar(HttpServletRequest request,HttpSession session){
		ModelAndView mv = new ModelAndView();
		Integer userId = (Integer) session.getAttribute("userId");
		BankCarEntity bankCarEntity = new BankCarEntity();
		bankCarEntity.setCarType(request.getParameter("carType"));
		bankCarEntity.setCarPhone(request.getParameter("carPhone"));
		bankCarEntity.setBankAddress(request.getParameter("bankAddress"));
		bankCarEntity.setBankMoney(new BigDecimal(request.getParameter("bankMoney")));
		bankCarEntity.setBankName(request.getParameter("bankName"));
		bankCarEntity.setBankPassword(request.getParameter("bankPassword"));
		bankCarEntity.setCarNumber(request.getParameter("carNumber"));
		try {
			UserEntity user = new UserEntity();
			user = userEntityMapper.selectById(userId);
			bankCarEntity.setModifier(user.getUserName());
			bankCarEntity.setModifyTime(new Date());
			bankDao.update(bankCarEntity);
			mv.addObject("bankCar",bankCarEntity);
			mv.setViewName("/customer/bank_car");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return mv;
	}
}
package com.zou.application.controller.admin;

@Controller
	@Transactional(propagation=Propagation.REQUIRED)
	public JSONObject payOrder(HttpSession session,HttpServletRequest request){
		JSONObject result = new JSONObject();
		Integer userId = (Integer) session.getAttribute("userId");
		if(userId == null){
			result.put("code","100");
			result.put("message","用户名不能为空");
		}
		String orderId = request.getParameter("orderId");
		UserEntity userEntity = new UserEntity();
		userEntity=userEntityMapper.selectById(userId);
		OrderEntity orderEntity = orderDao.selectById(Integer.valueOf(orderId));
		orderEntity.setId(Integer.valueOf(orderId));
		orderEntity.setModifier(userEntity.getUserName());
		orderEntity.setModifyTime(new Date());
		orderEntity.setStatus((short)2);
		orderDao.update(orderEntity);
		BankCarEntity bankCar = bankDao.selectByUserId(userId);
		bankCar.setBankMoney(bankCar.getBankMoney().subtract(orderEntity.getCountMoney()));
		bankDao.update(bankCar);
		TranstacRecordEntity transtacRecor = new TranstacRecordEntity();
		transtacRecor.setOrderCode(orderEntity.getOrderCode());
		transtacRecor.setOrderId(orderEntity.getId());
		transtacRecor.setPayMoney(orderEntity.getCountMoney());
		transtacRecor.setProductMoney(orderEntity.getOrderMoney());
		transtacRecor.setCreater(userEntity.getUserName());
		transtacRecor.setCreateTime(new Date());
		int id = transtacDao.insert(transtacRecor);
		result.put("code", "200");
		result.put("msg", "支付成功");
		if(id == 0){
			result.put("code", "100");
			result.put("msg", "删除失败");
		}
		return result;
	}
	
	@RequestMapping("/orderList")
	public ModelAndView orderList(HttpServletRequest request,HttpSession session){
		ModelAndView mv = new ModelAndView();
		Integer userId = (Integer) session.getAttribute("userId");
		if(userId == null){
			mv.addObject("code","100");
		orderEntity.setModifier(userEntity.getUserName());
		orderEntity.setModifyTime(new Date());
		orderEntity.setStatus((short)2);
		orderDao.update(orderEntity);
		BankCarEntity bankCar = bankDao.selectByUserId(userId);
		bankCar.setBankMoney(bankCar.getBankMoney().subtract(orderEntity.getCountMoney()));
		bankDao.update(bankCar);
		TranstacRecordEntity transtacRecor = new TranstacRecordEntity();
		transtacRecor.setOrderCode(orderEntity.getOrderCode());
		transtacRecor.setOrderId(orderEntity.getId());
		transtacRecor.setPayMoney(orderEntity.getCountMoney());
		transtacRecor.setProductMoney(orderEntity.getOrderMoney());
		transtacRecor.setCreater(userEntity.getUserName());
		transtacRecor.setCreateTime(new Date());
		int id = transtacDao.insert(transtacRecor);
		result.put("code", "200");
		result.put("msg", "支付成功");
		if(id == 0){
			result.put("code", "100");
			result.put("msg", "删除失败");
		}
		return result;
	}
	
	@RequestMapping("/orderList")
	public ModelAndView orderList(HttpServletRequest request,HttpSession session){
		ModelAndView mv = new ModelAndView();
		Integer userId = (Integer) session.getAttribute("userId");
		if(userId == null){
			mv.addObject("code","100");
			mv.addObject("message","用户名不能为空");
		}
		try {
			Map<String, Object> param = new HashMap<String, Object>();
			param.put("userId", userId);
			param.put("status", 1);
			List<OrderEntity> orderEntities = orderDao.listByMap(param);
			mv.addObject("orders",orderEntities);
			mv.setViewName("/customer/unpay_order_list");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return mv;
	}
	
	@RequestMapping("/payOrderList")
	public ModelAndView payOrderList(HttpServletRequest request,HttpSession session){
		ModelAndView mv = new ModelAndView();
		Integer userId = (Integer) session.getAttribute("userId");
		if(userId == null){
			result.put("code", "100");
			result.put("msg", "删除失败");
		}
		return result;
	}
	
	@RequestMapping("/orderList")
	public ModelAndView orderList(HttpServletRequest request,HttpSession session){
		ModelAndView mv = new ModelAndView();
		Integer userId = (Integer) session.getAttribute("userId");
		if(userId == null){
			mv.addObject("code","100");
			mv.addObject("message","用户名不能为空");
		}
		try {
			Map<String, Object> param = new HashMap<String, Object>();
			param.put("userId", userId);
			param.put("status", 1);
			List<OrderEntity> orderEntities = orderDao.listByMap(param);
			mv.addObject("orders",orderEntities);
			mv.setViewName("/customer/unpay_order_list");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return mv;
	}
	
	@RequestMapping("/payOrderList")
	public ModelAndView payOrderList(HttpServletRequest request,HttpSession session){
		ModelAndView mv = new ModelAndView();
		Integer userId = (Integer) session.getAttribute("userId");
		if(userId == null){
			mv.addObject("code","100");
			mv.addObject("message","用户名不能为空");
		}
		try {
			Map<String, Object> param = new HashMap<String, Object>();
			param.put("userId", userId);
			param.put("status", 2);
			List<OrderEntity> orderEntities = orderDao.listByMap(param);
			mv.addObject("orders",orderEntities);
			mv.setViewName("/customer/pay_order_list");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return mv;
	}
}
			result.put("msg","");
			return result;
		}
		try {
			
			ShopCarEntity shopCarEntity = shopCarDao.selectById(Integer.parseInt(carId));
			ProductEntity productEntity = productDao.selectById(shopCarEntity.getProductId());
//			if(productEntity.getProductNum() < Integer.parseInt(number)){
//				result.put("code","100");
//				result.put("msg","库存不足");
//				return result;
//			}
			shopCarEntity.setProductNum(Integer.parseInt(number));
			shopCarEntity.setId(Integer.parseInt(carId));
			shopCarDao.update(shopCarEntity);
			result.put("code","200");
			result.put("msg","删除成功");
		} catch (Exception e) {
			e.printStackTrace();
			result.put("code","100");
			result.put("msg","系统异常");
		}
		return result;
	}
}
package com.zou.application.controller.customer;

@Controller
@RequestMapping("/bankcar")
public class BankCarController {
	@RequestMapping("/userList")
	public ModelAndView userList(HttpServletRequest request){
		ModelAndView mv = new ModelAndView();
		Map<String, Object> param = new HashMap<String, Object>();
		try {
			List<UserEntity> userEntities = userEntityMapper.listByMap(param);
			mv.addObject("users",userEntities);
		} catch (Exception e) {
			e.printStackTrace();
		}
		mv.setViewName("/admin/user/user_list");
		return mv;
	}
}
package com.zou.application.controller.admin;

@Controller
@RequestMapping("/admin/orders")
public class OrdersController {
	
	@Autowired
	private OrderEntityMapper orderDao;
	
	
	@RequestMapping("/ordersList")
	public ModelAndView classifyList(HttpServletRequest request){
		ModelAndView mv = new ModelAndView();
		Map<String, Object> param = new HashMap<String, Object>();
		List<OrderEntity> orders = orderDao.listByMap(param);
		mv.addObject("orders",orders);
		mv.setViewName("/admin/order/order_list");
		return mv;
				JSONObject param = (JSONObject) item;
				ShopCarEntity shopCarEntity = shopCarDao.selectById(param.getInteger("carId"));
				UserEntity user = userEntityMapper.selectById(userId);
				orderEntity.setCreater(user.getName());
				orderEntity.setCreateTime(new Date());
				orderEntity.setOrderAddress(shopCarEntity.getReceiveAddress());
				orderEntity.setOrderCode(RandomUtils.randomString(5)+RandomUtils.randomNumber(8));
				orderEntity.setProductNumber(jsonCarIds.size());
				if(orderEntity.getCountMoney() != null){
					orderEntity.setOrderMoney(shopCarEntity.getRelPrice().add(orderEntity.getCountMoney()));
					orderEntity.setDiscountMoney(shopCarEntity.getDiscountPrice().add(orderEntity.getDiscountMoney()));
					orderEntity.setCountMoney(shopCarEntity.getCountProce().add(orderEntity.getOrderMoney()));
					orderEntity.setProductName(shopCarEntity.getProductName()+" , "+orderEntity.getProductName());
				}else{
					orderEntity.setOrderMoney(shopCarEntity.getRelPrice());
					orderEntity.setDiscountMoney(shopCarEntity.getDiscountPrice());
					orderEntity.setCountMoney(shopCarEntity.getCountProce());
					orderEntity.setProductName(shopCarEntity.getProductName());
				}
				orderEntity.setStatus((short)1);
				orderEntity.setIsDelete((short)0);
				orderEntity.setOrderUserId(userId);
				shopCarEntity.setStatus((short)2);
				shopCarDao.update(shopCarEntity);
			}
			orderDao.insert(orderEntity);
			result.put("code", "200");
			result.put("msg", "提交订单成功");
		} catch (Exception e) {
			e.printStackTrace();
			result.put("code", "200");
			result.put("msg", "提交订单失败");
		}
		return result;
	}
	
	/**
	 * 查看订单详情
	 * @param session
	 * @param request
	 * @return
		try {
			ProductEntity product = productDao.selectById(Integer.parseInt(id));
			Map<String, Object> param = new HashMap<String, Object>();
			List<ClassifyEntity> classifyEntities = classifyDao.listByMap(param);
			mv.addObject("classifys",classifyEntities);
			mv.addObject("product",product);
		} catch (Exception e) {
			e.printStackTrace();
		}
		mv.setViewName("/customer/single");
		return mv;
	}
}
package com.zou.application.controller.admin;

@Controller
@RequestMapping("/admin/product")
public class ProductController {
	
	@Autowired
	private ProductEntityMapper productDao;
	
	@RequestMapping("/addProductPage")

请添加图片描述

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值