|
|
@@ -1,6 +1,5 @@
|
|
|
package com.oms.controller;
|
|
|
|
|
|
-import com.oms.common.ApiResponse;
|
|
|
import com.oms.dto.OrdersDTO;
|
|
|
import com.oms.entity.Orders;
|
|
|
import com.oms.service.OrdersService;
|
|
|
@@ -17,101 +16,90 @@ public class OrdersController {
|
|
|
private final OrdersService ordersService;
|
|
|
|
|
|
@GetMapping
|
|
|
- public ApiResponse<List<Orders>> getOrders(
|
|
|
+ public List<Orders> getOrders(
|
|
|
@RequestParam(defaultValue = "1") int page,
|
|
|
@RequestParam(defaultValue = "20") int size) {
|
|
|
- return ApiResponse.success(ordersService.getPage(page, size).getRecords());
|
|
|
+ return ordersService.getPage(page, size).getRecords();
|
|
|
}
|
|
|
|
|
|
@GetMapping("/all")
|
|
|
- public ApiResponse<List<Orders>> getAll() {
|
|
|
- return ApiResponse.success(ordersService.getAll());
|
|
|
+ public List<Orders> getAll() {
|
|
|
+ return ordersService.getAll();
|
|
|
}
|
|
|
|
|
|
@GetMapping("/{id}")
|
|
|
- public ApiResponse<OrdersDTO> getById(@PathVariable Long id) {
|
|
|
- return ApiResponse.success(ordersService.getDtoById(id));
|
|
|
+ public OrdersDTO getById(@PathVariable Long id) {
|
|
|
+ return ordersService.getDtoById(id);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/order-no/{orderNo}")
|
|
|
- public ApiResponse<Orders> getByOrderNo(@PathVariable String orderNo) {
|
|
|
- return ApiResponse.success(ordersService.getByOrderNo(orderNo));
|
|
|
+ public Orders getByOrderNo(@PathVariable String orderNo) {
|
|
|
+ return ordersService.getByOrderNo(orderNo);
|
|
|
}
|
|
|
|
|
|
@PostMapping
|
|
|
- public ApiResponse<Long> create(@RequestBody Orders order) {
|
|
|
- return ApiResponse.success(ordersService.save(order));
|
|
|
+ public Long create(@RequestBody Orders order) {
|
|
|
+ return ordersService.save(order);
|
|
|
}
|
|
|
|
|
|
@PutMapping("/{id}")
|
|
|
- public ApiResponse<Void> update(@PathVariable Long id, @RequestBody Orders order) {
|
|
|
+ public void update(@PathVariable Long id, @RequestBody Orders order) {
|
|
|
order.setId(id);
|
|
|
ordersService.update(order);
|
|
|
- return ApiResponse.success(null);
|
|
|
}
|
|
|
|
|
|
@DeleteMapping("/{id}")
|
|
|
- public ApiResponse<Void> delete(@PathVariable Long id) {
|
|
|
+ public void delete(@PathVariable Long id) {
|
|
|
ordersService.delete(id);
|
|
|
- return ApiResponse.success(null);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/{id}/confirm-payment")
|
|
|
- public ApiResponse<Void> confirmPayment(@PathVariable Long id) {
|
|
|
+ public void confirmPayment(@PathVariable Long id) {
|
|
|
ordersService.confirmPayment(id, "SYSTEM");
|
|
|
- return ApiResponse.success(null);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/{id}/allocate")
|
|
|
- public ApiResponse<Void> allocateOrder(@PathVariable Long id) {
|
|
|
+ public void allocateOrder(@PathVariable Long id) {
|
|
|
ordersService.allocateOrder(id, "SYSTEM");
|
|
|
- return ApiResponse.success(null);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/{id}/cancel")
|
|
|
- public ApiResponse<Void> cancelOrder(@PathVariable Long id, @RequestParam String reason) {
|
|
|
+ public void cancelOrder(@PathVariable Long id, @RequestParam String reason) {
|
|
|
ordersService.cancelOrder(id, reason, "SYSTEM");
|
|
|
- return ApiResponse.success(null);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/{id}/confirm-shipped")
|
|
|
- public ApiResponse<Void> confirmShipped(@PathVariable Long id) {
|
|
|
+ public void confirmShipped(@PathVariable Long id) {
|
|
|
ordersService.confirmShipped(id, "SYSTEM");
|
|
|
- return ApiResponse.success(null);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/{id}/confirm-delivered")
|
|
|
- public ApiResponse<Void> confirmDelivered(@PathVariable Long id) {
|
|
|
+ public void confirmDelivered(@PathVariable Long id) {
|
|
|
ordersService.confirmDelivered(id, "SYSTEM");
|
|
|
- return ApiResponse.success(null);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/{id}/complete")
|
|
|
- public ApiResponse<Void> completeOrder(@PathVariable Long id) {
|
|
|
+ public void completeOrder(@PathVariable Long id) {
|
|
|
ordersService.completeOrder(id, "SYSTEM");
|
|
|
- return ApiResponse.success(null);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/{id}/split")
|
|
|
- public ApiResponse<Long> splitOrder(@PathVariable Long id, @RequestBody java.util.List<java.util.Map<String, Object>> splits) {
|
|
|
- return ApiResponse.success(ordersService.splitOrder(id, splits, "SYSTEM"));
|
|
|
+ public Long splitOrder(@PathVariable Long id, @RequestBody List<java.util.Map<String, Object>> splits) {
|
|
|
+ return ordersService.splitOrder(id, splits, "SYSTEM");
|
|
|
}
|
|
|
|
|
|
@PostMapping("/{sourceId}/merge/{targetId}")
|
|
|
- public ApiResponse<Void> mergeOrders(@PathVariable Long sourceId, @PathVariable Long targetId) {
|
|
|
+ public void mergeOrders(@PathVariable Long sourceId, @PathVariable Long targetId) {
|
|
|
ordersService.mergeOrders(sourceId, targetId, "SYSTEM");
|
|
|
- return ApiResponse.success(null);
|
|
|
}
|
|
|
|
|
|
@PutMapping("/{id}/handler")
|
|
|
- public ApiResponse<Void> assignHandler(@PathVariable Long id, @RequestParam Long handlerId, @RequestParam String handlerName) {
|
|
|
+ public void assignHandler(@PathVariable Long id, @RequestParam Long handlerId, @RequestParam String handlerName) {
|
|
|
ordersService.assignHandler(id, handlerId, handlerName);
|
|
|
- return ApiResponse.success(null);
|
|
|
}
|
|
|
|
|
|
@PutMapping("/{id}/warehouse")
|
|
|
- public ApiResponse<Void> assignWarehouse(@PathVariable Long id, @RequestParam Long warehouseId) {
|
|
|
+ public void assignWarehouse(@PathVariable Long id, @RequestParam Long warehouseId) {
|
|
|
ordersService.assignWarehouse(id, warehouseId);
|
|
|
- return ApiResponse.success(null);
|
|
|
}
|
|
|
}
|