package com.diagbot.web;


import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.RespDTO;
import com.diagbot.entity.wrapper.OrderDetailsWapper;
import com.diagbot.facade.OrderDetailsFacade;
import com.diagbot.vo.AuditStatusVO;
import com.diagbot.vo.OrderDetialsVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description: 订单明细 前端控制器
 * @Author: wangyu
 * @Date: 15:46 2018/9/17
 */
@RestController
@RequestMapping("/diagOrderDetails")
@Api(value = "订单明细API", tags = { "订单明细API" })
@SuppressWarnings("unchecked")
public class DiagOrderDetailsController {
    @Autowired
    private OrderDetailsFacade orderDetailsFacade;

    @ApiOperation(value = "产品申请——显示[by:wangyu]",
            notes = "orderNum:订单编号<br>")
    @PostMapping("/getAllOrderDetials")
    @SysLogger("getAllOrderDetials")
    public RespDTO<List<OrderDetailsWapper>> getAllOrderDetials(@RequestBody OrderDetialsVO orderDetialsVO) {
        List<OrderDetailsWapper> list = orderDetailsFacade.getAllOrderDetials(orderDetialsVO);
        return RespDTO.onSuc(list);
    }

    @ApiOperation(value = "产品申请——审核[by:wangyu]",
            notes = "id:订单明细id，根据订单明细id修改审核状态，必填<br>" +
                    "auditStatus:审核状态（0.不通过1.通过）必填<br>" +
                    "startTime:开始时间（通过需填写不通过不用填）<br>" +
                    "endTime:结束时间（通过需填写不通过不用填）<br>" +
                    "rejectReason:不通过原因（不通过需填写通过不用填）<br>" +
                    "rejectType:不通过类型（不通过需填写 通过不用填）:"
                            )
    @PostMapping("/auditStatus")
    @SysLogger("auditStatus")
    public RespDTO<Boolean> auditStatus(@RequestBody AuditStatusVO auditStatusVO) {
        return RespDTO.onSuc(orderDetailsFacade.updateAuditStatus(auditStatusVO));
    }
}

