| package com.mzl.flower.web.payment; | 
|   | 
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
| import com.mzl.flower.base.BaseController; | 
| import com.mzl.flower.base.R; | 
| import com.mzl.flower.base.ReturnDataDTO; | 
| import com.mzl.flower.constant.Constants; | 
| import com.mzl.flower.dto.request.payment.OrderDeliveryNoDTO; | 
| import com.mzl.flower.dto.request.payment.OrderQueryDTO; | 
| import com.mzl.flower.dto.request.payment.OrderReduceDTO; | 
| import com.mzl.flower.dto.response.payment.*; | 
| import com.mzl.flower.service.payment.DeliveryOrderService; | 
| import com.mzl.flower.service.payment.OrderService; | 
| import com.mzl.flower.service.payment.UserPaymentV3Service; | 
| import io.swagger.annotations.Api; | 
| import io.swagger.annotations.ApiImplicitParam; | 
| import io.swagger.annotations.ApiImplicitParams; | 
| import io.swagger.annotations.ApiOperation; | 
| import lombok.extern.slf4j.Slf4j; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.http.ResponseEntity; | 
| import org.springframework.validation.annotation.Validated; | 
| import org.springframework.web.bind.annotation.*; | 
|   | 
| import java.util.List; | 
|   | 
| @RestController | 
| @RequestMapping("/api/order") | 
| @Api(value = "订单管理-运营人员", tags = "订单管理-运营人员") | 
| @Validated | 
| @Slf4j | 
| public class OrderController extends BaseController { | 
|   | 
|     @Autowired | 
|     private OrderService orderService; | 
|   | 
|     @Autowired | 
|     private UserPaymentV3Service paymentV3Service; | 
|   | 
|     @Autowired | 
|     private DeliveryOrderService deliveryOrderService; | 
|   | 
|     @GetMapping("/status/count") | 
|     @ApiOperation(value = "获取订单状态数量") | 
|     public ResponseEntity<ReturnDataDTO<List<OrderStatusCountDTO>>> getOrderStatusCount(OrderQueryDTO dto){ | 
|         return returnData(R.SUCCESS.getCode(), orderService.getOrderStatusCount(dto)); | 
|     } | 
|   | 
|     @GetMapping("/list") | 
|     @ApiOperation(value = "查询订单列表") | 
|     public ResponseEntity<ReturnDataDTO<Page<OrderPlatformListDTO>>> selectOrderList(Page page, OrderQueryDTO dto){ | 
|         return returnData(R.SUCCESS.getCode(), orderService.selectOrderPlatformList(page, dto)); | 
|     } | 
|   | 
|     @GetMapping("/list/view") | 
|     @ApiOperation(value = "订单详情") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(name = "id", value = "订单id", required = true, dataType = "String", paramType = "query") | 
|     }) | 
|     public ResponseEntity<ReturnDataDTO<OrderDTO>> getOrderInfo(String id){ | 
|         return returnData(R.SUCCESS.getCode(), orderService.getOrderInfo(id)); | 
|     } | 
|   | 
|     @GetMapping("/item/list") | 
|     @ApiOperation(value = "订单商品明细") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(name = "id", value = "订单id", required = true, dataType = "String", paramType = "query") | 
|     }) | 
|     public ResponseEntity<ReturnDataDTO<List<OrderItemPlatformListDTO>>> getPlatformOrderItems(String id){ | 
|         return returnData(R.SUCCESS.getCode(), orderService.getPlatformOrderItems(id)); | 
|     } | 
|   | 
|     @PostMapping("/list/send") | 
|     @ApiOperation(value = "没有合伙人的花店上传快递号发货") | 
|     public ResponseEntity<ReturnDataDTO> saveDeliveryNo(@RequestBody OrderDeliveryNoDTO dto) { | 
|         orderService.saveDeliveryNo(dto); | 
|         return returnData(R.SUCCESS.getCode(), null); | 
|     } | 
|   | 
|     @GetMapping("/list/abnormal/details") | 
|     @ApiOperation(value = "异常订单明细") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(name = "id", value = "订单id", required = true, dataType = "String", paramType = "query") | 
|     }) | 
|     public ResponseEntity<ReturnDataDTO<AbnormalOrderDTO>> getAbnormalOrderDetails(String id){ | 
|         return returnData(R.SUCCESS.getCode(), orderService.getAbnormalOrderDetails(id)); | 
|     } | 
|   | 
|     @GetMapping("/list/abnormal/process") | 
|     @ApiOperation(value = "异常订单处理(不管有没有退款金额,建议都要处理)") | 
|     public ResponseEntity<ReturnDataDTO> processLevelDown(String id) { | 
|         orderService.processAbnormalOrder(id); | 
|         return returnData(R.SUCCESS.getCode(), null); | 
|     } | 
|   | 
|     @GetMapping("/list/check/info/reduce") | 
|     @ApiOperation(value = "降级操作详情") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(name = "orderItemId", value = "订单商品id", required = true, dataType = "String", paramType = "query") | 
|     }) | 
|     public ResponseEntity<ReturnDataDTO<OrderItemCheckReduceDTO>> getReduceCheck(String orderItemId){ | 
|         return returnData(R.SUCCESS.getCode(), deliveryOrderService.getReduceCheck(orderItemId)); | 
|     } | 
|   | 
|     @GetMapping("/list/check/info/replace") | 
|     @ApiOperation(value = "补货操作详情") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(name = "orderItemId", value = "订单商品id", required = true, dataType = "String", paramType = "query") | 
|     }) | 
|     public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getReplaceCheck(String orderItemId){ | 
|         return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId | 
|                 , Constants.CHECK_TYPE.replace.name(), false)); | 
|     } | 
|   | 
|     @GetMapping("/list/check/info/lack") | 
|     @ApiOperation(value = "缺货操作详情") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(name = "orderItemId", value = "订单商品id", required = true, dataType = "String", paramType = "query") | 
|     }) | 
|     public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getLackCheck(String orderItemId){ | 
|         return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId | 
|                 , Constants.CHECK_TYPE.lack.name(), false)); | 
|     } | 
|   | 
|     @GetMapping("/list/check/info/agree") | 
|     @ApiOperation(value = "审核通过") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(name = "id", value = "质检操作id", required = true, dataType = "String", paramType = "query") | 
|     }) | 
|     public ResponseEntity<ReturnDataDTO<?>> agreeCheck(String id){ | 
|         String orderItemId = deliveryOrderService.setCheckAuditStatus(id, Constants.CHECK_AUDIT_STATUS.AGREED.name()); | 
|         deliveryOrderService.doAfterCheckAudit(orderItemId); | 
|         return returnData(R.SUCCESS.getCode(), null); | 
|     } | 
|   | 
|     @GetMapping("/list/check/info/reject") | 
|     @ApiOperation(value = "审核不通过") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(name = "id", value = "质检操作id", required = true, dataType = "String", paramType = "query") | 
|     }) | 
|     public ResponseEntity<ReturnDataDTO<?>> rejectCheck(String id){ | 
|         String orderItemId = deliveryOrderService.setCheckAuditStatus(id, Constants.CHECK_AUDIT_STATUS.REJECTED.name()); | 
|         deliveryOrderService.doAfterCheckAudit(orderItemId); | 
|         return returnData(R.SUCCESS.getCode(), null); | 
|     } | 
|   | 
|     /*@PostMapping("/list/level/process") | 
|     @ApiOperation(value = "处理降级商品订单打款") | 
|     public ResponseEntity<ReturnDataDTO> processLevelDown(@RequestBody OrderReduceDTO dto) { | 
|         orderService.processLevelDown(dto); | 
|         return returnData(R.SUCCESS.getCode(), null); | 
|     }*/ | 
|   | 
|     @GetMapping("/check/list") | 
|     @ApiOperation(value = "查询订单清单列表") | 
|     public ResponseEntity<ReturnDataDTO<List<OrderCheckListDTO>>> selectOrderCheckList(OrderQueryDTO dto){ | 
|         return returnData(R.SUCCESS.getCode(), orderService.selectOrderCheckList(dto)); | 
|     } | 
|   | 
|     @PostMapping("/check/list") | 
|     @ApiOperation(value = "查询订单清单列表") | 
|     public ResponseEntity<ReturnDataDTO<List<OrderCheckListDTO>>> postOrderCheckList(@RequestBody OrderQueryDTO dto){ | 
|         return returnData(R.SUCCESS.getCode(), orderService.selectOrderCheckList(dto)); | 
|     } | 
|   | 
|     @PostMapping("/check/location/list") | 
|     @ApiOperation(value = "查询订单清单列表-按库位分商品") | 
|     public ResponseEntity<ReturnDataDTO<List<OrderCheckLocationListDTO>>> selectOrderCheckLocationList( | 
|             @RequestBody OrderQueryDTO dto){ | 
|         return returnData(R.SUCCESS.getCode(), orderService.selectOrderCheckLocationList(dto)); | 
|     } | 
|   | 
|     @GetMapping(value = "/refund") | 
|     @ApiImplicitParams({ | 
|             @ApiImplicitParam(name = "id", value = "订单id", required = true, dataType = "String", paramType = "query"), | 
|     }) | 
|     @ApiOperation(value = "退款") | 
|     public ResponseEntity<ReturnDataDTO> refundOrder(String id) { | 
|         orderService.refundCheckAdmin(id); | 
|         paymentV3Service.refundOrder(id); | 
|         return returnData(R.SUCCESS.getCode(), null); | 
|     } | 
|   | 
| } |