Java tutorial
/* * Copyright 2005-2013 shopxx.net. All rights reserved. * Support: http://www.shopxx.net * License: http://www.shopxx.net/license */ package net.groupbuy.controller.admin; import javax.annotation.Resource; import net.groupbuy.entity.DeliveryCenter; import net.groupbuy.entity.DeliveryTemplate; import net.groupbuy.service.DeliveryCenterService; import net.groupbuy.service.DeliveryTemplateService; import net.groupbuy.service.OrderService; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; /** * Controller - ? * * @author SHOP++ Team * @version 3.0 */ @Controller("adminPrintController") @RequestMapping("/admin/print") public class PrintController extends BaseController { @Resource(name = "orderServiceImpl") private OrderService orderService; @Resource(name = "deliveryTemplateServiceImpl") private DeliveryTemplateService deliveryTemplateService; @Resource(name = "deliveryCenterServiceImpl") private DeliveryCenterService deliveryCenterService; /** * ?? */ @RequestMapping(value = "/order", method = RequestMethod.GET) public String order(Long id, ModelMap model) { model.addAttribute("order", orderService.find(id)); return "/admin/print/order"; } /** * ?? */ @RequestMapping(value = "/product", method = RequestMethod.GET) public String product(Long id, ModelMap model) { model.addAttribute("order", orderService.find(id)); return "/admin/print/product"; } /** * ???? */ @RequestMapping(value = "/shipping", method = RequestMethod.GET) public String shipping(Long id, ModelMap model) { model.addAttribute("order", orderService.find(id)); return "/admin/print/shipping"; } /** * ?? */ @RequestMapping(value = "/delivery", method = RequestMethod.GET) public String delivery(Long orderId, Long deliveryTemplateId, Long deliveryCenterId, ModelMap model) { DeliveryTemplate deliveryTemplate = deliveryTemplateService.find(deliveryTemplateId); DeliveryCenter deliveryCenter = deliveryCenterService.find(deliveryCenterId); if (deliveryTemplate == null) { deliveryTemplate = deliveryTemplateService.findDefault(); } if (deliveryCenter == null) { deliveryCenter = deliveryCenterService.findDefault(); } model.addAttribute("deliveryTemplates", deliveryTemplateService.findAll()); model.addAttribute("deliveryCenters", deliveryCenterService.findAll()); model.addAttribute("order", orderService.find(orderId)); model.addAttribute("deliveryTemplate", deliveryTemplate); model.addAttribute("deliveryCenter", deliveryCenter); return "/admin/print/delivery"; } }