管理端:
取消订单 拒单 接单 派送订单 完成订单
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
package com.sky.controller.admin;
|
||||
|
||||
import com.sky.dto.OrdersPageQueryDTO;
|
||||
import com.sky.dto.*;
|
||||
import com.sky.result.PageResult;
|
||||
import com.sky.result.Result;
|
||||
import com.sky.service.OrderService;
|
||||
import com.sky.vo.OrderOverViewVO;
|
||||
import com.sky.vo.OrderStatisticsVO;
|
||||
import com.sky.vo.OrderVO;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -39,4 +38,39 @@ public class OrderController {
|
||||
OrderVO orderVO = orderService.details(id);
|
||||
return Result.success(orderVO);
|
||||
}
|
||||
|
||||
@PutMapping("/confirm")
|
||||
public Result confirm(@RequestBody OrdersConfirmDTO ordersConfirmDTO){
|
||||
log.info("order confirm: {}",ordersConfirmDTO);
|
||||
orderService.confirm(ordersConfirmDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping("/rejection")
|
||||
public Result rejection(@RequestBody OrdersRejectionDTO ordersRejectionDTO){
|
||||
log.info("order rejection: {}",ordersRejectionDTO);
|
||||
orderService.rejection(ordersRejectionDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping("/complete/{id}")
|
||||
public Result complete(@PathVariable Long id){
|
||||
log.info("complete order: {}",id);
|
||||
orderService.complete(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping("/cancel")
|
||||
public Result cancel(@RequestBody OrdersCancelDTO ordersCancelDTO){
|
||||
log.info("order cancel: {}",ordersCancelDTO);
|
||||
orderService.cancelFromAdmin(ordersCancelDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping("/delivery/{id}")
|
||||
public Result delivery(@PathVariable Long id){
|
||||
log.info("order delivery: {}",id);
|
||||
orderService.delivery(id);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.sky.controller.user;
|
||||
|
||||
import com.sky.dto.OrdersDTO;
|
||||
import com.sky.dto.OrdersPaymentDTO;
|
||||
import com.sky.dto.OrdersSubmitDTO;
|
||||
import com.sky.result.PageResult;
|
||||
@@ -63,7 +62,7 @@ public class OrderController {
|
||||
@PutMapping("/cancel/{id}")
|
||||
public Result cancel(@PathVariable Long id) {
|
||||
log.info("cancel order: {}", id);
|
||||
orderService.cancel(id);
|
||||
orderService.cancelByUser(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.sky.service;
|
||||
|
||||
import com.sky.dto.OrdersPageQueryDTO;
|
||||
import com.sky.dto.OrdersPaymentDTO;
|
||||
import com.sky.dto.OrdersSubmitDTO;
|
||||
import com.sky.dto.*;
|
||||
import com.sky.result.PageResult;
|
||||
import com.sky.vo.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -48,10 +46,10 @@ public interface OrderService {
|
||||
OrderVO getOrderDetailById(Long id);
|
||||
|
||||
/**
|
||||
* cancel order
|
||||
* cancel order by user
|
||||
* @param id
|
||||
*/
|
||||
void cancel(Long id);
|
||||
void cancelByUser(Long id);
|
||||
|
||||
/**
|
||||
* repeat order by order id
|
||||
@@ -79,4 +77,34 @@ public interface OrderService {
|
||||
* @return
|
||||
*/
|
||||
OrderVO details(Long id);
|
||||
|
||||
/**
|
||||
* confirm order
|
||||
* @param ordersConfirmDTO
|
||||
*/
|
||||
void confirm(OrdersConfirmDTO ordersConfirmDTO);
|
||||
|
||||
/**
|
||||
* reject order
|
||||
* @param ordersRejectionDTO
|
||||
*/
|
||||
void rejection(OrdersRejectionDTO ordersRejectionDTO);
|
||||
|
||||
/**
|
||||
* cancel order by admin
|
||||
* @param ordersCancelDTO
|
||||
*/
|
||||
void cancelFromAdmin(OrdersCancelDTO ordersCancelDTO);
|
||||
|
||||
/**
|
||||
* delivery order
|
||||
* @param id
|
||||
*/
|
||||
void delivery(Long id);
|
||||
|
||||
/**
|
||||
* complete order
|
||||
* @param id
|
||||
*/
|
||||
void complete(Long id);
|
||||
}
|
||||
|
||||
@@ -5,9 +5,7 @@ import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.sky.constant.MessageConstant;
|
||||
import com.sky.context.BaseContext;
|
||||
import com.sky.dto.OrdersPageQueryDTO;
|
||||
import com.sky.dto.OrdersPaymentDTO;
|
||||
import com.sky.dto.OrdersSubmitDTO;
|
||||
import com.sky.dto.*;
|
||||
import com.sky.entity.*;
|
||||
import com.sky.exception.AddressBookBusinessException;
|
||||
import com.sky.exception.ShoppingCartBusinessException;
|
||||
@@ -199,11 +197,12 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(Long id) {
|
||||
public void cancelByUser(Long id) {
|
||||
Orders orders = new Orders();
|
||||
orders.setId(id);
|
||||
orders.setStatus(Orders.CANCELLED);
|
||||
orders.setCancelTime(LocalDateTime.now());
|
||||
orders.setPayStatus(Orders.REFUND);
|
||||
orderMapper.update(orders);
|
||||
}
|
||||
|
||||
@@ -275,4 +274,54 @@ public class OrderServiceImpl implements OrderService {
|
||||
return orderVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirm(OrdersConfirmDTO ordersConfirmDTO) {
|
||||
Orders orders = Orders.builder()
|
||||
.id(ordersConfirmDTO.getId())
|
||||
.status(Orders.CONFIRMED)
|
||||
.build();
|
||||
orderMapper.update(orders);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rejection(OrdersRejectionDTO ordersRejectionDTO) {
|
||||
Orders orders = Orders.builder()
|
||||
.id(ordersRejectionDTO.getId())
|
||||
.rejectionReason(ordersRejectionDTO.getRejectionReason())
|
||||
.payStatus(Orders.REFUND)
|
||||
.build();
|
||||
orderMapper.update(orders);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelFromAdmin(OrdersCancelDTO ordersCancelDTO) {
|
||||
Orders orders = Orders.builder()
|
||||
.id(ordersCancelDTO.getId())
|
||||
.cancelReason(ordersCancelDTO.getCancelReason())
|
||||
.cancelTime(LocalDateTime.now())
|
||||
.status(Orders.CANCELLED)
|
||||
.payStatus(Orders.REFUND)
|
||||
.build();
|
||||
orderMapper.update(orders);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delivery(Long id) {
|
||||
Orders orders = Orders.builder()
|
||||
.id(id)
|
||||
.status(Orders.DELIVERY_IN_PROGRESS)
|
||||
.build();
|
||||
orderMapper.update(orders);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(Long id) {
|
||||
Orders orders = Orders.builder()
|
||||
.id(id)
|
||||
.status(Orders.COMPLETED)
|
||||
.build();
|
||||
orderMapper.update(orders);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user