package com.shop.controller; import com.shop.annotation.IsLogin; import com.shop.base.BaseController; import com.shop.constant.Constant; import com.shop.constant.MessageModel; import com.shop.gto.OrderDto; import com.shop.model.DeliveryCode; import com.shop.model.ProductUpdate; import com.shop.model.ReceiveAddress; import com.shop.service.OrderService; import com.shop.util.MessageModelUtil; import com.shop.vo.LoginIdentity; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpSession; import java.math.BigDecimal; import java.util.List; /** * 后台登录..... *商家后台登录 * @author DY * @create 2018-03-06 12:03 **/ @RestController @RequestMapping("order") public class OrderController extends BaseController { @Autowired private OrderService orderService; /** *@author DY *@create 2018/3/13 18:20 *订单总数,销售总额,昨日销售总额,近七天销售总额接口接口 */ @IsLogin @RequestMapping("order_total_amount") public MessageModel order_total_amount(HttpSession session) throws Exception { LoginIdentity loginIdentity = (LoginIdentity)session.getAttribute(Constant.LOGIN_USER_KEY); MessageModel messageModel=orderService.order_total_amount(loginIdentity); return messageModel; } /** *@author DY *@create 2018/3/13 18:20 *统计待付款,待发货,已发货,已完成(这里的订单总数不包含退款订单 即实际订单总数=这里的totalCount+退款订单总数) */ @IsLogin @RequestMapping("query_order_status") public MessageModel query_order_status(HttpSession session) throws Exception { LoginIdentity loginIdentity = (LoginIdentity)session.getAttribute(Constant.LOGIN_USER_KEY); MessageModel messageModel=orderService.query_order_status(loginIdentity); return messageModel; } /** *@author DY *@create 2018/3/13 18:20 *统计确认退款退货申请 */ @IsLogin @RequestMapping("query_order_refund_status") public MessageModel query_order_refund_status(HttpSession session) throws Exception { LoginIdentity loginIdentity = (LoginIdentity)session.getAttribute(Constant.LOGIN_USER_KEY); Integer refundCount=orderService.query_order_refund_status(loginIdentity); return MessageModelUtil.getSuccessMessageModel(refundCount); } /** *@author DY *@create 2018/1/8 18:16 *查看订单状态 * */ @IsLogin @RequestMapping("showObligationOrder") public MessageModel showObligationOrder(OrderDto orderDto,HttpSession session) throws Exception { LoginIdentity loginIdentity = (LoginIdentity)session.getAttribute(Constant.LOGIN_USER_KEY); MessageModel messageModel = orderService.showObligationOrder(orderDto,loginIdentity); return messageModel; } /** *@author DY *@create 2018/1/8 18:16 *查看订单详情- - 修改收货地址 * 传入父订单ID * */ @IsLogin @RequestMapping("update_receive_address") public MessageModel update_receive_address(ReceiveAddress receiveAddress) throws Exception { orderService.update_receive_address(receiveAddress); return MessageModelUtil.getSuccessMessageModel(); } /** *@author DY *@create 2018/1/8 18:16 *查看订单详情--修改订单属性,数量 * 传入父订单ID(待修改....) * */ @RequestMapping("update_order_property") @IsLogin public MessageModel update_order_property(ProductUpdate productUpdate) throws Exception { MessageModel messageModel = orderService.update_order_property(productUpdate); return messageModel; } /** *@author DY *@create 2018/1/8 18:16 *查看订单详情--修改订单总价 * 传入父订单ID * */ @RequestMapping("update_order_totalPrice") @IsLogin public MessageModel update_order_totalPrice(BigDecimal totalPrice,Integer orderId) throws Exception { orderService.update_order_totalPrice(totalPrice,orderId); return MessageModelUtil.getSuccessMessageModel(); } /** *@author DY *@create 2018/3/29 16:30 *查询快递公司编码号 */ @IsLogin @RequestMapping("query_delivery_code") public MessageModel query_delivery_code() throws Exception { List deliveryCodes=orderService.query_delivery_code(); return MessageModelUtil.getSuccessMessageModel(deliveryCodes); } /** *@author DY *@create 2018/3/29 16:30 *批量发货 */ @IsLogin @RequestMapping("send_goods_all") public MessageModel getOrderTracesByJson(String deliverySend) throws Exception { orderService.updateOrderStatusToSend(deliverySend); return MessageModelUtil.getSuccessMessageModel(); } /** *@author DY *@create 2018/3/29 17:53 *处理退款申请 * orderItemId:子订单Id,isAgree是否同意,refundCodeF:refundCode值 */ @IsLogin @RequestMapping("deal_with_return_order") public MessageModel deal_with_return_order(Integer orderItemId,Boolean isAgree,Integer refundCodeF) throws Exception { orderService.deal_with_return_order(orderItemId,isAgree,refundCodeF); return MessageModelUtil.getSuccessMessageModel(); } /** *@author DY *@create 2018/3/29 17:53 *处理退款申请--确认打款 * orderId:父订单id, orderItemId:子订单Id,isAgree:1 同意 2拒绝 */ @IsLogin @RequestMapping("return_order_to_last") public MessageModel return_order_to_last(Integer orderId,Integer orderItemId,Integer isAgree) throws Exception { orderService.return_order_to_last(orderId,orderItemId,isAgree); return MessageModelUtil.getSuccessMessageModel(); } /** *@author DY *@create 2018/3/29 17:53 *处理退款申请任务 */ @IsLogin @RequestMapping("task") public void task() throws Exception { orderService.updateOrderStatusToAgree(); } }