商城源码java_java⽹上商城平台源码(含数据库脚本)【实例简介】管理员后台管理商品以及对留⾔订单的处理,⽤户对订单的购买及留⾔
【实例截图】
【核⼼代码】
package ller;
import java.util.Date;
import java.util.Map;
import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.shop.Utils.PageBean;
import com.shop.po.Cart;
import com.shop.po.CartItem;
import com.shop.po.Orderitem;
import com.shop.po.Orders;
import com.shop.po.User;
import com.shop.service.OrderService;
@Controller
public class orderController {
@Autowired
private OrderService orderService;
@RequestMapping("/toOrder")
public String toOrder(HttpServletRequest request,Model model) throws Exception { Orders orders = new Orders();
Cart cart = (Cart) Session().getAttribute("cart");
User loginUser = (User) Session().getAttribute("loginUser");
if(loginUser==null){
model.addAttribute("message", "对不起您还没有登录");
return "msg";
}
h5源码交易平台// 0表⽰没有付款、1表⽰已付款即将发货 2表⽰确认收货 3表⽰交易成功
orders.setState(0);
orders.setOrderTime(new Date());
orders.Uid());
orders.Totale());
Map cartItems = CartItem();
for (Entry entry : Set()) {
CartItem cartItem = Value();
Orderitem orderitem = new Orderitem();
orderitem.Product());
orderitem.Count());
orderitem.Product().getPid());
orderitem.Subtotle());
orderitem.Oid());
}
cart.clearCart();
return "order";
}
/
/ 为定单付款
@RequestMapping("/payOrder")
public String payOrder(Orders orders,@RequestParam String receiveInfo,@RequestParam String phoNum,@RequestParam String accepter) throws Exception {
orders.setReceiveinfo(receiveInfo);
orders.setPhonum(phoNum);
orders.setAccepter(accepter);
orderService.payOrder(orders);
return "redirect:myOrder.action?page=1";
}
//payOrderAganin
@RequestMapping("/payOrderAganin")
public String payOrderAganin(@RequestParam int oid,HttpServletRequest request){
Orders noPayOrder = orderService.findOrderByOid(oid);
return "order";
}
// 查询myOrder
@RequestMapping("/myOrder")
public String myOrder(@RequestParam int page, Model model,
HttpServletRequest request) throws Exception {
User loginUser = (User) Session().getAttribute("loginUser");
PageBean pageBean = orderService.findOrderByUidAndPage(Uid());
model.addAttribute("pageBean", pageBean);
return "orderList";
}
// 确认收货
@RequestMapping("/updateState")
public String updateState(@RequestParam int oid ) throws Exception { orderService.updateOrderStatus(oid, 3);
return "redirect:myOrder.action?page=1";
}
}
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论