package com.red.circle.console.adapter.app.order;

import com.red.circle.console.app.service.app.order.IOrderAbnormalLogService;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.order.inner.model.cmd.inapp.OrderAbnormalPageQryCmd;
import com.red.circle.order.inner.model.dto.inapp.OrderAbnormalLogDTO;
import com.red.circle.order.inner.model.enums.inapp.OrderAbnormalStatusEnum;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 存在丢失订单日志记录 前端控制器.
 *
 * @author pengliang
 * @since 2020-11-24
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/order/abnormal/log")
public class OrderAbnormalLogRestController extends BaseController {

  private final IOrderAbnormalLogService orderAbnormalLogService;

  /**
   * 异常日志列表.
   */
  @GetMapping("/page")
  public PageResult<OrderAbnormalLogDTO> pageOps(OrderAbnormalPageQryCmd qryCmd) {
    return orderAbnormalLogService.pageOps(qryCmd);
  }

  /**
   * 凭证.
   */
  @GetMapping("/certificate")
  public String getCertificateById(@RequestParam Long id) {
    return orderAbnormalLogService.getCertificateById(id);
  }

  /**
   * 修改状态.
   */
  @PutMapping("/status")
  public void updateStatus(@RequestParam Long id, @RequestParam OrderAbnormalStatusEnum status) {
    orderAbnormalLogService.updateStatus(id, status);
  }

}
