基于javaweb+mysql的ssm+maven零食超市商城系统(java+ssm+jsp+jquery+mysql)

基于javaweb+mysql的ssm+maven零食超市商城系统(java+ssm+jsp+jquery+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

基于javaweb+mysql的SSM+Maven零食超市商城系统(java+ssm+jsp+jquery+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/8.0版本均可; 6.是否Maven项目:是;

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+CSS+JavaScript+jQuery

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,前台地址:http://localhost:8080/snack/shop/index 注:tomcat中配置的路径必须为snack 后台地址:http://localhost:8080/snack/admin/login/adminLogin
	
	@Autowired
	private adminUserService adminUserService;
	
	@RequestMapping("mainToUserinfo")
	public String mainToUserinfo(){
		return "admin/user/adminUserinfo";
	}
	
	//加载用户
	@RequestMapping("adminUserinfoLimit")
	@ResponseBody
	public DataTables adminUserinfoLimit(HttpServletRequest request,int start,int length,Userinfo userinfo){
		Map<Object,Object> map=new HashMap<Object, Object>();
		map.put("pageStart",start);
		map.put("pageSize",length);
		PageHelp<Userinfo> pageHelp= adminUserService.selectAdminUserinfoLimit(map,userinfo);
		DataTables datatable=new DataTables();
		datatable.setData(pageHelp.getList());
		datatable.setRecordsFiltered(pageHelp.getRecord());
		datatable.setRecordsTotal(pageHelp.getRecord());
		return datatable;
	}
	
	//删除用户
	@RequestMapping("delUserinfoById")
	@ResponseBody
	public String delUserinfoById(int uId){
		return ResponseUtil.successToClient(adminUserService.delUserinfoById(uId));
	}
	
	//更新加载用户
	@RequestMapping("updateGoUserinfoById")
	@ResponseBody
	public String updateGoUserinfoById(int uId){
		return ResponseUtil.successToClient(adminUserService.updateGoUserinfoById(uId));
	}
	
	//更新用户
	@RequestMapping("updateUserinfoById")
	@ResponseBody
	public String updateUserinfoById(Userinfo userinfo){
		return ResponseUtil.successToClient(adminUserService.updateUserinfoById(userinfo));
	}
	
	@RequestMapping("mainToAdmin")
	public String mainToAdmin(){
		return "admin/user/adminAdmin";
	}
	
	//加载用户
	@RequestMapping("adminAdminLimit")
	@ResponseBody
	@RequestMapping("deleteOrderdetail")
	@ResponseBody
	public String deleteOrderdetail(int dId,String oId){
		List<Orderdetail> orderdetailList = adminOrderService.selectOrderdetailByoId(oId);
		if(orderdetailList.size()>=2){
			adminOrderService.deleteOrderdetailBydId(dId);
			return ResponseUtil.successToClient(1);
		}else{
			adminOrderService.deleteAdminOrder(oId);
			return ResponseUtil.successToClient(2);
		}
	}
	
	
	//导出订单详情
	@RequestMapping("outExcelOrder")
	@ResponseBody
	public void outExcelOrder(HttpServletResponse response,String oId){
		SXSSFWorkbook workbook = new SXSSFWorkbook();
        reportSheet(workbook,oId);
        outputExcel(response, workbook, "订单详情");
	}
	
	private void reportSheet(SXSSFWorkbook workbook,String oId) {
		List<DoExcelOrder> outExcelOrderDetail = adminOrderService.outExcelOrderDetail(oId);
		for (int i = 0; i < outExcelOrderDetail.size(); i++) {
			if(i!=0){
				outExcelOrderDetail.get(i).setOId("");
				outExcelOrderDetail.get(i).setOName("");
				outExcelOrderDetail.get(i).setOPhone("");
				outExcelOrderDetail.get(i).setOAddress("");
			}
			outExcelOrderDetail.get(i).setMoney(outExcelOrderDetail.get(i).getMoney()+"元");
		}
		ExcelUtil2 excelUtil=new ExcelUtil2();
		
        List<JSONObject> columns = new ArrayList<>();
        columns.add(excelUtil.defaultGetColumn("订单号", "oId", 15 * 256, false, false));
        columns.add(excelUtil.defaultGetColumn("收货人", "oName", 15 * 256, false, false));
        columns.add(excelUtil.defaultGetColumn("电话", "oPhone", 15 * 256, false, false));
        columns.add(excelUtil.defaultGetColumn("地址", "oAddress", 26 * 256, false, false));
        columns.add(excelUtil.defaultGetColumn("商品名", "sName", 15 * 256, false, false));
        columns.add(excelUtil.defaultGetColumn("数量", "num", 12 * 256, false, false));
        columns.add(excelUtil.defaultGetColumn("单价", "money", 12 * 256, false, false));

        excelUtil.createSheet(workbook, outExcelOrderDetail, columns, "订单详情");
    }


@Controller
@RequestMapping("/user/")
public class UserControll {
	
	@Autowired
	private userService userService;
	
	@Autowired
	private sorderService sorderService;
	
	@Autowired
	private adminOrderService adminOrderService;
	
	//跳转注册
	@RequestMapping("userRegisterGet")
	public String gotoRegister(){
		return "user/register";
	}	
	
	//注册判断用户名存在
	@RequestMapping("selectUserOne")
	@ResponseBody
	public AjaxResult getUserOne(Userinfo userinfo){
		AjaxResult aj=new AjaxResult();
		 Userinfo rs = userService.selectUserOne(userinfo);
		 aj.setTag(rs);
		 return aj;
	}
	
	//注册
	@RequestMapping("addUserRegister")
	@ResponseBody
	public AjaxResult addUserOne(Userinfo userinfo){
		 AjaxResult aj=new AjaxResult();
		 int rs = userService.addUserOne(userinfo);
		 aj.setTag(rs);
		 return aj;
	}
		DataTables datatable=new DataTables();
		datatable.setData(pageHelp.getList());
		datatable.setRecordsFiltered(pageHelp.getRecord());
		datatable.setRecordsTotal(pageHelp.getRecord());
		return datatable;
	}
	
	//删除订单
	@RequestMapping("deleteAdminOrder")
	@ResponseBody
	public String deleteAdminOrder(String oId){
		return ResponseUtil.successToClient(adminOrderService.deleteAdminOrder(oId));
	} 
	
	//update加载订单
	@RequestMapping("updateSelectAdminOrder")
	@ResponseBody
	public String updateSelectAdminOrder(int rId){
		return ResponseUtil.successToClient(adminOrderService.updateSelectAdminOrder(rId));
	} 
	
	//update订单
	@RequestMapping("updateAdminOrder")
	@ResponseBody
	public String updateAdminOrder(Receiptinfo receiptinfo){
		return ResponseUtil.successToClient(adminOrderService.updateAdminOrder(receiptinfo));
	} 
	
	//updateOrderDetial加载订单
	@RequestMapping("updateSelectAdminOrderDetial")
	@ResponseBody
	public String updateSelectAdminOrderDetial(int dId){
		return ResponseUtil.successToClient(adminOrderService.updateSelectAdminOrderDetial(dId));
	} 
	
	//updateOrderDetial订单
	@RequestMapping("updateOrderdetail")
	@ResponseBody
	public String updateOrderdetail(Orderdetail orderdetail){
		return ResponseUtil.successToClient(adminOrderService.updateOrderdetail(orderdetail));
	} 
	
	//删除OrderDetial
	@RequestMapping("deleteOrderdetail")
	@ResponseBody
	public String deleteOrderdetail(int dId,String oId){
		List<Orderdetail> orderdetailList = adminOrderService.selectOrderdetailByoId(oId);
		if(orderdetailList.size()>=2){
			adminOrderService.deleteOrderdetailBydId(dId);
			return ResponseUtil.successToClient(1);
		}else{
			adminOrderService.deleteAdminOrder(oId);
			return ResponseUtil.successToClient(2);
		}
	@RequestMapping("userIntegral")
	public String userIntegral(){
		return "user/integral";
	}
	
	//跳转个人图片
	@RequestMapping("userGerenImg")
	public String userGerenImg(){
		return "user/gerenImg";
	}
	
	//加载个人积分
	@RequestMapping("userIntegralLimit")
	@ResponseBody
	public DataTables userIntegralLimit(HttpServletRequest request,int start,int length){
		Map<Object,Object> map=new HashMap<Object, Object>();
		map.put("uId",request.getSession().getAttribute("frontuserId"));
		map.put("pageStart",start);
		map.put("pageSize",length);
		PageHelp<Integral> pageHelp= userService.selectIntegralLimit(map);
		DataTables datatable=new DataTables();
		datatable.setData(pageHelp.getList());
		datatable.setRecordsFiltered(pageHelp.getRecord());
		datatable.setRecordsTotal(pageHelp.getRecord());
		return datatable;
	}
	
	//跳转个人账户页面
	@RequestMapping("userAccount")
	public String userAccount(){
		return "user/account";
	}
	
	//加载个人积分
	@RequestMapping("userAccountLimit")
	@ResponseBody
	public DataTables userAccountLimit(HttpServletRequest request,int start,int length){
		Map<Object,Object> map=new HashMap<Object, Object>();
		map.put("uId",request.getSession().getAttribute("frontuserId"));
		map.put("pageStart",start);
		map.put("pageSize",length);
		PageHelp<Account> pageHelp= userService.selectAccountLimit(map);
		DataTables datatable=new DataTables();
		datatable.setData(pageHelp.getList());
		datatable.setRecordsFiltered(pageHelp.getRecord());
		datatable.setRecordsTotal(pageHelp.getRecord());
		return datatable;
	}
	
	//获得金额
	@RequestMapping("getMoneyAcount")
	@ResponseBody
	public Object getMoneyAcount(HttpServletRequest request){
		 AjaxResult aj=new AjaxResult();
		 int rs = userService.addUserOne(userinfo);
		 aj.setTag(rs);
		 return aj;
	}
	
	//查登陆的用户
	@RequestMapping("readUserinfo")
	@ResponseBody
	public AjaxResult readUserinfo(Userinfo userinfo,HttpServletRequest request){
		 AjaxResult aj=new AjaxResult();
		 Userinfo usr= userService.selectUserinfoById(userinfo);
		 if(usr!=null){
			 aj.setTag(usr);
		 }
		 return aj;
	}
	
	//修改个人信息
	@RequestMapping("editUserinfo")
	@ResponseBody
	public int editUserinfo(Userinfo userinfo){
		 int rs= userService.updateUserinfoById(userinfo);
		 return rs;
	}
	
	//跳转注册
	@RequestMapping("userPersonalInfo")
	public String gotoPersonalInfo(){
		return "user/personalInfo";
	}
	
	//加载个人信息界面
	@RequestMapping("userInfo")
	public String gotoUserInfo(){
		return "user/userInfo";
	}
	
	//跳转个人积分页面
	@RequestMapping("userIntegral")
	public String userIntegral(){
		return "user/integral";
	}
	
	//跳转个人图片
	@RequestMapping("userGerenImg")
	public String userGerenImg(){
		return "user/gerenImg";
	}
	
	
	@Autowired
	public shopService shopService=null;
	
	//主页
	@RequestMapping("index")
	public String gotoIndex(HttpServletRequest request){
		List<Snackinfo> HotSnackList = shopService.getHotSnack();
		List<Snackinfo> newSnackList = shopService.getNewSnack();
		request.setAttribute("HotSnackList",HotSnackList);
		request.setAttribute("newSnackList",newSnackList);
		System.out.println("00");
		return "user/index";
	}
	
	//登录
	@RequestMapping("userLoginGet")
	public String gotoUserLogin(){
		return "user/userLogin";
	}
	
	@RequestMapping("userLoginPost")
	public String gotoUserLogin(Userinfo userinfo,HttpServletRequest request){
		Userinfo exituser =  shopService.userLogin(userinfo);
		if(exituser ==null){
			request.setAttribute("msg","用户名或密码错误");
			return "user/userLogin";
		}
		request.getSession().setAttribute("exituser", exituser);
		request.getSession().setAttribute("frontuser", exituser.getuUsername());
		request.getSession().setAttribute("frontuserId", exituser.getuId());
		request.getSession().setAttribute("money", exituser.getuMoney());
		return "redirect:index";
	}
	
	//退出登录
	@RequestMapping("userlogout")
	public String showlogin(HttpServletRequest request){
		HttpSession session = request.getSession();
		session.removeAttribute("frontuser");
		session.removeAttribute("frontuserId");
		return "redirect:userLoginGet";
	}
	
	
	//商品详情
	@RequestMapping("proDatail")
	
	//更新加载用户
	@RequestMapping("updateGoAdminById")
	@ResponseBody
	public String updateGoAdminById(HttpServletRequest request,Admin admin){
		return ResponseUtil.successToClient(adminUserService.selectAdminByOne(admin));
	}
	
	//更新用户
	@RequestMapping("updateAdminById")
	@ResponseBody
	public String updateAdminById(Admin admin){
		return ResponseUtil.successToClient(adminUserService.updateAdmin(admin));
	}

}

@Controller
@RequestMapping("/admin/login/")
public class AdminLogin {
	
	@Autowired
	private adminLoginService adminLoginService;
	
	@Autowired
	private AccountMapper accountMapper;
	
	//登录login
	@RequestMapping("adminLogin")
	public String adminLogin(){
		System.out.println("存储过程相加:"+accountMapper.selectNum(4, 6));
		return "admin/adminLogin";
	}

@Controller
@RequestMapping("/admin/user/")
public class AdminUserControll {
	
	@Autowired
	private adminUserService adminUserService;
	
	@RequestMapping("mainToUserinfo")
	public String mainToUserinfo(){
		return "admin/user/adminUserinfo";
	}
	
	//加载用户
	@RequestMapping("adminUserinfoLimit")
	@ResponseBody
	public DataTables adminUserinfoLimit(HttpServletRequest request,int start,int length,Userinfo userinfo){
		Map<Object,Object> map=new HashMap<Object, Object>();
		map.put("pageStart",start);
		map.put("pageSize",length);
		PageHelp<Userinfo> pageHelp= adminUserService.selectAdminUserinfoLimit(map,userinfo);
		DataTables datatable=new DataTables();
		datatable.setData(pageHelp.getList());
		datatable.setRecordsFiltered(pageHelp.getRecord());
		datatable.setRecordsTotal(pageHelp.getRecord());
		return datatable;
	}
	
	//删除用户
	@RequestMapping("delUserinfoById")
	@ResponseBody
	@RequestMapping("adminGoMain")
	public String adminLogin(HttpServletRequest request){
		request.setAttribute("adminMenu",adminLoginService.selectAllAdminMenu());
		request.setAttribute("adminMenuChild",adminLoginService.selectAllAdminMenuChild());
		return "admin/adminMain";
	}
	
	//退出
	@RequestMapping("adminMainToLoginOut")
	@ResponseBody
	public String adminMainToLoginOut(HttpServletRequest request){
		request.getSession().removeAttribute("adminName");
		return ResponseUtil.successToClient();
	}
	

}

public class loginFilter implements Filter{

	@Override
	public void init(FilterConfig filterConfig) throws ServletException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void doFilter(ServletRequest request, ServletResponse response,
	}
	
	//登录Main
	@RequestMapping("adminGoMain")
	public String adminLogin(HttpServletRequest request){
		request.setAttribute("adminMenu",adminLoginService.selectAllAdminMenu());
		request.setAttribute("adminMenuChild",adminLoginService.selectAllAdminMenuChild());
		return "admin/adminMain";
	}
	
	//退出
	@RequestMapping("adminMainToLoginOut")
	@ResponseBody
	public String adminMainToLoginOut(HttpServletRequest request){
		request.getSession().removeAttribute("adminName");
		return ResponseUtil.successToClient();
	}
	

}

public class loginFilter implements Filter{

	@Override
	public void init(FilterConfig filterConfig) throws ServletException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain chain) throws IOException, ServletException {

@Controller
@RequestMapping("/shop/")
public class ShopControll {
	
	@Autowired
	public shopService shopService=null;
	
	//主页
	@RequestMapping("index")
	public String gotoIndex(HttpServletRequest request){
		List<Snackinfo> HotSnackList = shopService.getHotSnack();
		List<Snackinfo> newSnackList = shopService.getNewSnack();
		request.setAttribute("HotSnackList",HotSnackList);
		request.setAttribute("newSnackList",newSnackList);
		System.out.println("00");
		return "user/index";
	}
	
	//登录
	@RequestMapping("userLoginGet")
	public String gotoUserLogin(){
		return "user/userLogin";
	}
	
	@RequestMapping("userLoginPost")
	public String gotoUserLogin(Userinfo userinfo,HttpServletRequest request){
		Userinfo exituser =  shopService.userLogin(userinfo);
		if(exituser ==null){
			request.setAttribute("msg","用户名或密码错误");
			return "user/userLogin";
		}
		request.getSession().setAttribute("exituser", exituser);
		request.getSession().setAttribute("frontuser", exituser.getuUsername());
		request.getSession().setAttribute("frontuserId", exituser.getuId());
		request.getSession().setAttribute("money", exituser.getuMoney());
		return "redirect:index";
	}
	
	//退出登录
	@RequestMapping("userlogout")
	public String showlogin(HttpServletRequest request){
			}
			Receiptinfo receiptinfo = (Receiptinfo)session.getAttribute("receiptinfo");
			
			//3:把商品信息转化为sorder,并且添加到购物车中(判断购物车是否重复)
			receiptinfo = sorderService.addSorder(receiptinfo, findSnackinfo);
			receiptinfo.setoPhone(cluTotal(receiptinfo));
			return "redirect:gotocar";
		}
	
	
	    @RequestMapping("gotocar")
	    public String gotocar() {
			return "product/car";
		}
	
	  	//计算总金额
		public String cluTotal(Receiptinfo receiptinfo) {
				
				double tal=0.0;
				for(Orderdetail temp : receiptinfo.getOrderdetailSet()){
					
					tal+=temp.getoMoney()*temp.getoNum();
				}
				
				return String.valueOf(tal);
		}
		
		
		@RequestMapping(value="/delete",method=RequestMethod.GET)
		public String deleteSorder(Snackinfo snackinfo,HttpSession session) {
			
			Receiptinfo receiptinfo = (Receiptinfo)session.getAttribute("receiptinfo");
			
			Set<Orderdetail> set = receiptinfo.getOrderdetailSet();
			
			
			 Iterator<Orderdetail> iterator = set.iterator();
			
			 while(iterator.hasNext()){
				 Orderdetail orderdetail = iterator.next();
				 if(orderdetail.getSnackinfo().getsId()==snackinfo.getsId()){
					iterator.remove();
					receiptinfo.setoPhone(String.valueOf((Double.parseDouble(receiptinfo.getoPhone())-orderdetail.getoMoney()*orderdetail.getoNum())));	 
				}
		     }

@Controller
@RequestMapping("/admin/user/")
public class AdminUserControll {
	
	@Autowired
	private adminUserService adminUserService;
	
	@RequestMapping("mainToUserinfo")
	public String mainToUserinfo(){
		return "admin/user/adminUserinfo";
	}
	
	//加载用户
	@RequestMapping("adminUserinfoLimit")
	@ResponseBody
	public DataTables adminUserinfoLimit(HttpServletRequest request,int start,int length,Userinfo userinfo){
		Map<Object,Object> map=new HashMap<Object, Object>();
		map.put("pageStart",start);
		map.put("pageSize",length);
		PageHelp<Userinfo> pageHelp= adminUserService.selectAdminUserinfoLimit(map,userinfo);
		DataTables datatable=new DataTables();
		datatable.setData(pageHelp.getList());
		datatable.setRecordsFiltered(pageHelp.getRecord());
		datatable.setRecordsTotal(pageHelp.getRecord());
		return datatable;
	}
	
	//删除用户
	@RequestMapping("delUserinfoById")
	@ResponseBody
	public String delUserinfoById(int uId){
		return ResponseUtil.successToClient(adminUserService.delUserinfoById(uId));
	}
	
	//更新加载用户
	@RequestMapping("updateGoUserinfoById")
	@ResponseBody
	public String updateGoUserinfoById(int uId){
		return ResponseUtil.successToClient(adminUserService.updateGoUserinfoById(uId));
	}
	public String gotoProDatail(HttpServletRequest request,Snackinfo snack){
		Snackinfo sck = shopService.selectById(snack);
		request.setAttribute("sck", sck);
		return "product/proDetail";
	}
	
	//查询订单
	@RequestMapping("selectOrderSnack")
	@ResponseBody
	public DataTables selectOrderSnack(String oId,int start,int length){
		Map<Object,Object> map=new HashMap<Object, Object>();
		map.put("oId", oId);
		map.put("pageStart",start);
		map.put("pageSize",length);
		PageHelp<DoSnack> pageHelp = shopService.selectOrderSnack(map);
		DataTables datatable=new DataTables();
		datatable.setData(pageHelp.getList());
		datatable.setRecordsFiltered(pageHelp.getRecord());
		datatable.setRecordsTotal(pageHelp.getRecord());
		return datatable;
	}
	
	//type页面
	@RequestMapping("puffingType")
	public String puffing(HttpServletRequest request,DoSnackType doSnackType){
		List<Snackinfo> TypeSnackList=shopService.selectPuffing(doSnackType.getType(),doSnackType.getSnackName());
		if(doSnackType.getType()==1){
			request.setAttribute("TypeSnackTitle","膨化类");
		}else if(doSnackType.getType()==2){
			request.setAttribute("TypeSnackTitle","肉制类");
		}else if(doSnackType.getType()==3){
			request.setAttribute("TypeSnackTitle","饮料类");
		}else if(doSnackType.getType()==4){
			request.setAttribute("TypeSnackTitle","其他");
		}else if(doSnackType.getType()==5){
			request.setAttribute("TypeSnackTitle","搜索结果");
		}else if(doSnackType.getType()==6){
			request.setAttribute("TypeSnackTitle","进口类");
		}
		request.setAttribute("TypeNum",doSnackType.getType());
		request.setAttribute("TypeSnackList",TypeSnackList);
		return "user/typePage";
	}
	
}

	@ResponseBody
	public DataTables adminOrderLimit(int start,int length,
			String oId,String oTimeStart,String oTimeEnd,String adUserName){
		Map<Object,Object> map=new HashMap<Object, Object>();
			map.put("pageStart",start);
			map.put("pageSize",length);
			map.put("oId",oId);
			map.put("oTimeStart",oTimeStart);
			map.put("oTimeEnd",oTimeEnd);
			map.put("adUserName",adUserName);
		PageHelp<DoAdminOrder> pageHelp= adminOrderService.selectAdminOrderLimit(map);
		DataTables datatable=new DataTables();
		datatable.setData(pageHelp.getList());
		datatable.setRecordsFiltered(pageHelp.getRecord());
		datatable.setRecordsTotal(pageHelp.getRecord());
		return datatable;
	}
	
	//删除订单
	@RequestMapping("deleteAdminOrder")
	@ResponseBody
	public String deleteAdminOrder(String oId){
		return ResponseUtil.successToClient(adminOrderService.deleteAdminOrder(oId));
	} 
	
	//update加载订单
	@RequestMapping("updateSelectAdminOrder")
	@ResponseBody
	public String updateSelectAdminOrder(int rId){
		return ResponseUtil.successToClient(adminOrderService.updateSelectAdminOrder(rId));
	} 
	
	//update订单
	@RequestMapping("updateAdminOrder")
	@ResponseBody
	public String updateAdminOrder(Receiptinfo receiptinfo){
		return ResponseUtil.successToClient(adminOrderService.updateAdminOrder(receiptinfo));
	} 
	
	//updateOrderDetial加载订单
	@RequestMapping("updateSelectAdminOrderDetial")
	@ResponseBody
	public String updateSelectAdminOrderDetial(int dId){
		return ResponseUtil.successToClient(adminOrderService.updateSelectAdminOrderDetial(dId));
	} 
	
	//updateOrderDetial订单
	@RequestMapping("updateOrderdetail")
	@ResponseBody
	public String updateOrderdetail(Orderdetail orderdetail){
		return ResponseUtil.successToClient(adminOrderService.updateOrderdetail(orderdetail));
			DoMoneyFK dfk=new DoMoneyFK();
			Receiptinfo receiptinfoSession = (Receiptinfo)session.getAttribute("receiptinfo");
			Date day=new Date();    
			SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd"); 
			String oId=df.format(day).toString()+String.valueOf((int)(Math.random()*9000+1000));
			receiptinfo.setoId(oId);
			receiptinfo.setOrderdetailSet(receiptinfoSession.getOrderdetailSet());
			sorderService.addReceiptinfo(receiptinfo);
			
			Order order=new Order();
			order.setoId(oId);
			order.setuId((int)session.getAttribute("frontuserId"));
			order.setoTime(DateUtil.getCurrentTime());
			order.setoType(-1);
			sorderService.addOrder(order);
			
			Orderdetail orderdetail=new Orderdetail();
			orderdetail.setoId(oId);
			for (Orderdetail orderdetailSession : receiptinfoSession.getOrderdetailSet()) {
				orderdetail.setoNum(orderdetailSession.getoNum());
				orderdetail.setoMoney(orderdetailSession.getoMoney());
				orderdetail.setsId(orderdetailSession.getsId());
				sorderService.addOrderdetail(orderdetail);
			}
			Userinfo selectUserinfoMoney = userService.selectUserinfoMoney((int)request.getSession().getAttribute("frontuserId"));
			Double selectOrderdetailPayMoney = sorderService.selectOrderdetailPayMoney(oId);
			dfk.setoId(oId);
			dfk.setPayMoney(selectOrderdetailPayMoney.toString());
			dfk.setuMoney(selectUserinfoMoney.getuMoney());
			session.removeAttribute("receiptinfo");
			return ResponseUtil.successToClientStr(dfk);
		}
}

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值