|
@@ -7,6 +7,7 @@ import com.txz.mall.business.OrderServiceBusiness;
|
|
import com.txz.mall.core.AuthService;
|
|
import com.txz.mall.core.AuthService;
|
|
import com.txz.mall.core.Result;
|
|
import com.txz.mall.core.Result;
|
|
import com.txz.mall.core.ResultCode;
|
|
import com.txz.mall.core.ResultCode;
|
|
|
|
+import com.txz.mall.enums.PinkOrderStatusEnum;
|
|
import com.txz.mall.model.StoreOrder;
|
|
import com.txz.mall.model.StoreOrder;
|
|
import com.txz.mall.service.StoreOrderService;
|
|
import com.txz.mall.service.StoreOrderService;
|
|
import dto.*;
|
|
import dto.*;
|
|
@@ -33,19 +34,19 @@ import java.util.List;
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/order")
|
|
@RequestMapping("/order")
|
|
public class OrderController {
|
|
public class OrderController {
|
|
-
|
|
|
|
|
|
+
|
|
private static Logger log = LoggerFactory.getLogger(OrderController.class);
|
|
private static Logger log = LoggerFactory.getLogger(OrderController.class);
|
|
-
|
|
|
|
|
|
+
|
|
@Resource
|
|
@Resource
|
|
private StoreOrderService storeOrderService;
|
|
private StoreOrderService storeOrderService;
|
|
@Resource
|
|
@Resource
|
|
private OrderServiceBusiness orderServiceBusiness;
|
|
private OrderServiceBusiness orderServiceBusiness;
|
|
-
|
|
|
|
|
|
+
|
|
@PostMapping("/add")
|
|
@PostMapping("/add")
|
|
@ApiOperation(value = "创建订单")
|
|
@ApiOperation(value = "创建订单")
|
|
public Result add(@Validated @RequestBody CreateOrderRequest orderRequest) {
|
|
public Result add(@Validated @RequestBody CreateOrderRequest orderRequest) {
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
if (orderRequest == null) {
|
|
if (orderRequest == null) {
|
|
return Result.fail(ResultCode.OBJECT_IS_NULL);
|
|
return Result.fail(ResultCode.OBJECT_IS_NULL);
|
|
}
|
|
}
|
|
@@ -54,7 +55,7 @@ public class OrderController {
|
|
MyRecord record = storeOrderService.createOrder(orderRequest);
|
|
MyRecord record = storeOrderService.createOrder(orderRequest);
|
|
return Result.success(record);
|
|
return Result.success(record);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@DeleteMapping("/delete")
|
|
@DeleteMapping("/delete")
|
|
@ApiOperation(value = "订单删除")
|
|
@ApiOperation(value = "订单删除")
|
|
public Result delete(@RequestParam Long id) {
|
|
public Result delete(@RequestParam Long id) {
|
|
@@ -72,7 +73,7 @@ public class OrderController {
|
|
}
|
|
}
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@PutMapping("/update")
|
|
@PutMapping("/update")
|
|
@ApiOperation(value = "订单更新")
|
|
@ApiOperation(value = "订单更新")
|
|
public Result update(@RequestBody StoreOrder storeOrder) {
|
|
public Result update(@RequestBody StoreOrder storeOrder) {
|
|
@@ -84,7 +85,7 @@ public class OrderController {
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
storeOrder.setUpdateTime(new Date());
|
|
storeOrder.setUpdateTime(new Date());
|
|
-// storeOrder.setUpdateUserId(userId);
|
|
|
|
|
|
+ // storeOrder.setUpdateUserId(userId);
|
|
storeOrderService.update(storeOrder);
|
|
storeOrderService.update(storeOrder);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error("更新对象操作异常e:{}", e);
|
|
log.error("更新对象操作异常e:{}", e);
|
|
@@ -92,7 +93,7 @@ public class OrderController {
|
|
}
|
|
}
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@GetMapping("/detail")
|
|
@GetMapping("/detail")
|
|
@ApiOperation(value = "订单获取详情")
|
|
@ApiOperation(value = "订单获取详情")
|
|
public Result<StoreOrderVO> detail(@RequestParam Long id) {
|
|
public Result<StoreOrderVO> detail(@RequestParam Long id) {
|
|
@@ -102,7 +103,7 @@ public class OrderController {
|
|
StoreOrderVO vo = orderServiceBusiness.orderDetail(id);
|
|
StoreOrderVO vo = orderServiceBusiness.orderDetail(id);
|
|
return Result.success(vo);
|
|
return Result.success(vo);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@PostMapping("/list")
|
|
@PostMapping("/list")
|
|
@ApiOperation(value = "订单获取列表")
|
|
@ApiOperation(value = "订单获取列表")
|
|
public Result<List<StoreOrderVO>> list(@RequestBody StoreOrderDTO dto) {
|
|
public Result<List<StoreOrderVO>> list(@RequestBody StoreOrderDTO dto) {
|
|
@@ -113,119 +114,119 @@ public class OrderController {
|
|
return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
|
|
return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
-// @PostMapping("/app/list")
|
|
|
|
-// @ApiOperation(value = "订单获取列表")
|
|
|
|
-// public Result<List<StoreOrderVO>> appList(@RequestBody StoreOrderAppDTO dto) {
|
|
|
|
-//
|
|
|
|
-// Long tokenUserId = AuthService.getTokenUserId(null);
|
|
|
|
-// dto.setUserId(tokenUserId);
|
|
|
|
-// PageHelper.startPage(dto.getPage(), dto.getSize());
|
|
|
|
-// PageInfo pageInfo = null;
|
|
|
|
-// try {
|
|
|
|
-// List<StoreOrderVO> arrayList = storeOrderService.appList(dto);
|
|
|
|
-// pageInfo = new PageInfo(arrayList);
|
|
|
|
-// } catch (Exception e) {
|
|
|
|
-// log.error("查询对象操作异常e:{}", e);
|
|
|
|
-// return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
|
-// }
|
|
|
|
-// return Result.success(pageInfo);
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ // @PostMapping("/app/list")
|
|
|
|
+ // @ApiOperation(value = "订单获取列表")
|
|
|
|
+ // public Result<List<StoreOrderVO>> appList(@RequestBody StoreOrderAppDTO dto) {
|
|
|
|
+ //
|
|
|
|
+ // Long tokenUserId = AuthService.getTokenUserId(null);
|
|
|
|
+ // dto.setUserId(tokenUserId);
|
|
|
|
+ // PageHelper.startPage(dto.getPage(), dto.getSize());
|
|
|
|
+ // PageInfo pageInfo = null;
|
|
|
|
+ // try {
|
|
|
|
+ // List<StoreOrderVO> arrayList = storeOrderService.appList(dto);
|
|
|
|
+ // pageInfo = new PageInfo(arrayList);
|
|
|
|
+ // } catch (Exception e) {
|
|
|
|
+ // log.error("查询对象操作异常e:{}", e);
|
|
|
|
+ // return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
|
+ // }
|
|
|
|
+ // return Result.success(pageInfo);
|
|
|
|
+ // }
|
|
|
|
+
|
|
@ApiOperation(value = "获取订单各状态数量")
|
|
@ApiOperation(value = "获取订单各状态数量")
|
|
@GetMapping(value = "/status/num")
|
|
@GetMapping(value = "/status/num")
|
|
public Result<StoreOrderCountItemVO> getOrderStatusNum() {
|
|
public Result<StoreOrderCountItemVO> getOrderStatusNum() {
|
|
return Result.success(storeOrderService.getOrderStatusNum());
|
|
return Result.success(storeOrderService.getOrderStatusNum());
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@ApiOperation("导出订单")
|
|
@ApiOperation("导出订单")
|
|
@PostMapping("/export")
|
|
@PostMapping("/export")
|
|
- public Result exportFile(@RequestBody StoreOrderDTO dto, HttpServletResponse response) {
|
|
|
|
|
|
+ public void exportFile(@RequestBody StoreOrderDTO dto, HttpServletResponse response) {
|
|
storeOrderService.exportFile(dto, response);
|
|
storeOrderService.exportFile(dto, response);
|
|
- return Result.success();
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ @ApiOperation("导出发货单")
|
|
|
|
+ @PostMapping("/exportDelivery")
|
|
|
|
+ public void exportDelivery(@RequestBody StoreOrderDTO dto, HttpServletResponse response) {
|
|
|
|
+ // dto.setPaid(1);
|
|
|
|
+ dto.setStatus(PinkOrderStatusEnum.GROUP_ORDER_TO_SHIP.getKey());
|
|
|
|
+ storeOrderService.exportFile(dto, response);
|
|
|
|
+ }
|
|
|
|
+
|
|
@ApiOperation("退款")
|
|
@ApiOperation("退款")
|
|
@PostMapping("/refund")
|
|
@PostMapping("/refund")
|
|
public Result refund(@RequestParam("id") Long id) {
|
|
public Result refund(@RequestParam("id") Long id) {
|
|
storeOrderService.refund(id);
|
|
storeOrderService.refund(id);
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@ApiOperation("关闭订单")
|
|
@ApiOperation("关闭订单")
|
|
@PostMapping("/close")
|
|
@PostMapping("/close")
|
|
public Result close(@RequestParam("id") Long id) {
|
|
public Result close(@RequestParam("id") Long id) {
|
|
storeOrderService.close(id);
|
|
storeOrderService.close(id);
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@ApiOperation("取消订单")
|
|
@ApiOperation("取消订单")
|
|
@PostMapping("/cancel")
|
|
@PostMapping("/cancel")
|
|
public Result cancel(@RequestParam("id") Long id) {
|
|
public Result cancel(@RequestParam("id") Long id) {
|
|
storeOrderService.cancel(id);
|
|
storeOrderService.cancel(id);
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@ApiOperation("联系用户")
|
|
@ApiOperation("联系用户")
|
|
@PostMapping("/contactUser")
|
|
@PostMapping("/contactUser")
|
|
public Result contactUser(@RequestParam("userId") Long userId) {
|
|
public Result contactUser(@RequestParam("userId") Long userId) {
|
|
-// storeOrderService.contactUser(userId);
|
|
|
|
|
|
+ // storeOrderService.contactUser(userId);
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@ApiOperation("批量发货")
|
|
@ApiOperation("批量发货")
|
|
@PostMapping("/batchDelivery")
|
|
@PostMapping("/batchDelivery")
|
|
public Result batchDelivery(@RequestBody List<StoreOrderDeliveryDTO> list) {
|
|
public Result batchDelivery(@RequestBody List<StoreOrderDeliveryDTO> list) {
|
|
storeOrderService.batchDelivery(list);
|
|
storeOrderService.batchDelivery(list);
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
-
|
|
|
|
-// @ApiOperation(value = "预下单")
|
|
|
|
-// @PostMapping(value = "/pre/order")
|
|
|
|
-// public Result preOrder(@RequestBody @Validated PreOrderRequest request) {
|
|
|
|
-// Long tokenUserId = AuthService.getTokenUserId(null);
|
|
|
|
-// request.setUserId(tokenUserId);
|
|
|
|
-// return Result.success(storeOrderService.preOrder(request));
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-// @ApiOperation(value = "加载预下单")
|
|
|
|
-// @PostMapping(value = "load/pre")
|
|
|
|
-// public Result<PreOrderResponse> loadPreOrder(@RequestParam String preOrderNo) {
|
|
|
|
-//
|
|
|
|
-// Long tokenUserId = AuthService.getTokenUserId(null);
|
|
|
|
-// return Result.success(storeOrderService.loadPreOrder(preOrderNo));
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-// @ApiOperation(value = "计算订单价格")
|
|
|
|
-// @PostMapping(value = "/computed/price")
|
|
|
|
-// public Result<ComputedOrderPriceResponse> computedPrice(@Validated @RequestBody OrderComputedPriceRequest request) {
|
|
|
|
-//
|
|
|
|
-// Long tokenUserId = AuthService.getTokenUserId(null);
|
|
|
|
-// request.setUserId(tokenUserId);
|
|
|
|
-// return Result.success(storeOrderService.computedOrderPrice(request));
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-// @ApiOperation(value = "去支付")
|
|
|
|
-// @PostMapping(value = "/goPay")
|
|
|
|
-// public Result getPayResult(@RequestBody GoPinkDTO dto) {
|
|
|
|
-//
|
|
|
|
-// Long tokenUserId = AuthService.getTokenUserId(null);
|
|
|
|
-// dto.setUserId(tokenUserId);
|
|
|
|
-// Boolean result = storeOrderService.goPay(dto);
|
|
|
|
-// return Result.success(result);
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
- @ApiOperation("导出发货单")
|
|
|
|
- @PostMapping("/exportDelivery")
|
|
|
|
- public Result exportDelivery(HttpServletResponse response) {
|
|
|
|
- storeOrderService.exportDelivery(response);
|
|
|
|
- return Result.success();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ // @ApiOperation(value = "预下单")
|
|
|
|
+ // @PostMapping(value = "/pre/order")
|
|
|
|
+ // public Result preOrder(@RequestBody @Validated PreOrderRequest request) {
|
|
|
|
+ // Long tokenUserId = AuthService.getTokenUserId(null);
|
|
|
|
+ // request.setUserId(tokenUserId);
|
|
|
|
+ // return Result.success(storeOrderService.preOrder(request));
|
|
|
|
+ //
|
|
|
|
+ // }
|
|
|
|
+ // @ApiOperation(value = "加载预下单")
|
|
|
|
+ // @PostMapping(value = "load/pre")
|
|
|
|
+ // public Result<PreOrderResponse> loadPreOrder(@RequestParam String preOrderNo) {
|
|
|
|
+ //
|
|
|
|
+ // Long tokenUserId = AuthService.getTokenUserId(null);
|
|
|
|
+ // return Result.success(storeOrderService.loadPreOrder(preOrderNo));
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // @ApiOperation(value = "计算订单价格")
|
|
|
|
+ // @PostMapping(value = "/computed/price")
|
|
|
|
+ // public Result<ComputedOrderPriceResponse> computedPrice(@Validated @RequestBody OrderComputedPriceRequest request) {
|
|
|
|
+ //
|
|
|
|
+ // Long tokenUserId = AuthService.getTokenUserId(null);
|
|
|
|
+ // request.setUserId(tokenUserId);
|
|
|
|
+ // return Result.success(storeOrderService.computedOrderPrice(request));
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // @ApiOperation(value = "去支付")
|
|
|
|
+ // @PostMapping(value = "/goPay")
|
|
|
|
+ // public Result getPayResult(@RequestBody GoPinkDTO dto) {
|
|
|
|
+ //
|
|
|
|
+ // Long tokenUserId = AuthService.getTokenUserId(null);
|
|
|
|
+ // dto.setUserId(tokenUserId);
|
|
|
|
+ // Boolean result = storeOrderService.goPay(dto);
|
|
|
|
+ // return Result.success(result);
|
|
|
|
+ // }
|
|
|
|
+
|
|
@ApiOperation("导入发货单")
|
|
@ApiOperation("导入发货单")
|
|
@PostMapping("/importDelivery")
|
|
@PostMapping("/importDelivery")
|
|
- public Result importDelivery(@JSONField(serialize = false) @RequestParam("file") MultipartFile file) {
|
|
|
|
- storeOrderService.importDelivery(file);
|
|
|
|
|
|
+ public Result importDelivery(@JSONField(serialize = false) @RequestParam("file") MultipartFile file, HttpServletResponse response) {
|
|
|
|
+ storeOrderService.importDelivery(file, response);
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
}
|
|
}
|