package com.unis.base.app.controller;

import com.github.pagehelper.PageInfo;
import com.unis.base.client.FacilityFeign;
import com.unis.base.common.vo.*;
import com.unis.common.utils.ResponseWrapper;
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.HttpStatus;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author ChenKai
 * @Date 2019/9/25 14:25
 * @Version 1.0
 */
@RestController
@Api(value = "机械台账", tags = "机械台账")
@Slf4j
public class FacilityController {

    @Autowired
    private FacilityFeign facilityFeign;

    //设备报废记录
    @ApiOperation(value = "设备报废记录(分页)", notes = "参数：")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "起始页", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页展示行数", required = true),
            @ApiImplicitParam(name = "lx", value = "1：设备，2：设施，3：仪器", required = true)})

    @PostMapping(value = "/findFacility")
    public ResponseWrapper findFacility(@RequestBody DSbxxsjyQueryVO vo,
                                        @RequestParam(value = "pageNum") Integer pageNum,
                                        @RequestParam(value = "pageSize") Integer pageSize,
                                        @RequestParam(value = "lx") Integer lx){
            return facilityFeign.findFacility(vo,pageNum,pageSize,lx);
    }

    //设备报废记录详情
    @ApiOperation(value = "设备报废记录详情", notes = "参数：")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "起始页", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页展示行数", required = true)})
    @PostMapping(value = "/findFacilityById")
    public ResponseWrapper findFacilityById(@RequestBody DSbxxsjyQueryVO vo,
                                            @RequestParam(value = "pageNum") Integer pageNum,
                                            @RequestParam(value = "pageSize") Integer pageSize){
           return facilityFeign.findFacilityById(vo,pageNum,pageSize);

    }

    //设备维护分页
    @ApiOperation(value = "设备维护分页", notes = "参数：")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "起始页", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页展示行数", required = true),
            @ApiImplicitParam(name = "lx", value = "1：设备，2：设施，3：仪器", required = true)})
    @PostMapping(value = "/findVindicate")
    public ResponseWrapper findVindicate(@RequestBody DSbxxsjyQueryVO vo,
                                         @RequestParam(value = "pageNum") Integer pageNum,
                                         @RequestParam(value = "pageSize") Integer pageSize,
                                         @RequestParam(value = "lx") Integer lx){
            return facilityFeign.findVindicate(vo,pageNum,pageSize,lx);
    }

    //设备维护详情
    @ApiOperation(value = "设备维护详情", notes = "参数：")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "起始页", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页展示行数", required = true)})
    @PostMapping(value = "/findVindicateById")
    public ResponseWrapper findVindicateById(@RequestBody DSbxxsjyQueryVO vo,
                                             @RequestParam(value = "pageNum") Integer pageNum,
                                             @RequestParam(value = "pageSize") Integer pageSize){
            return facilityFeign.findVindicateById(vo,pageNum,pageSize);
    }

    //设备维修分页
    @ApiOperation(value = "设备维修分页", notes = "参数：")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "起始页", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页展示行数", required = true),
            @ApiImplicitParam(name = "lx", value = "1：设备，2：设施，3：仪器", required = true)})
    @PostMapping(value = "/findMaintain")
    public ResponseWrapper findMaintain(@RequestBody DSbxxsjyQueryVO vo,
                                        @RequestParam(value = "pageNum") Integer pageNum,
                                        @RequestParam(value = "pageSize") Integer pageSize,
                                        @RequestParam(value = "lx") Integer lx){
            return facilityFeign.findMaintain(vo,pageNum,pageSize,lx);
    }

    //设备维修详情
    @ApiOperation(value = "设备维修详情", notes = "参数：")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "起始页", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页展示行数", required = true)})
    @PostMapping(value = "/findMaintainById")
    public ResponseWrapper findMaintainById(@RequestBody DSbxxsjyQueryVO vo,
                                            @RequestParam(value = "pageNum") Integer pageNum,
                                            @RequestParam(value = "pageSize") Integer pageSize){
            return facilityFeign.findMaintainById(vo,pageNum,pageSize);
    }

    //设备领用分页
    @ApiOperation(value = "设备领用分页", notes = "参数：")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "起始页", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页展示行数", required = true)})
    @PostMapping(value = "/findReceive")
    public ResponseWrapper findReceive(@RequestBody DSbxxsjyQueryVO vo,
                                       @RequestParam(value = "pageNum") Integer pageNum,
                                       @RequestParam(value = "pageSize") Integer pageSize,
                                       @RequestParam(value = "lx") Integer lx){
            return facilityFeign.findReceive(vo,pageNum,pageSize,lx);
    }

    //设备领用详情
    @ApiOperation(value = "设备领用详情", notes = "参数：设备编号(sbbh)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "起始页", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页展示行数", required = true)})
    @PostMapping(value = "/findReceiveById")
    public ResponseWrapper findReceiveById(@RequestBody DSbxxsjyQueryVO vo,
                                           @RequestParam(value = "pageNum") Integer pageNum,
                                           @RequestParam(value = "pageSize") Integer pageSize){
            return facilityFeign.findReceiveById(vo,pageNum,pageSize);
    }

    //设备入库分页
    @ApiOperation(value = "设备入库分页", notes = "参数：")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "起始页", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页展示行数", required = true),
            @ApiImplicitParam(name = "lx", value = "1：设备，2：设施，3：仪器", required = true)})
    @PostMapping(value = "/findStorage")
    public ResponseWrapper findStorage(@RequestBody DSbxxsjyQueryVO vo,
                                       @RequestParam(value = "pageNum") Integer pageNum,
                                       @RequestParam(value = "pageSize") Integer pageSize,
                                       @RequestParam(value = "lx") Integer lx){
            return facilityFeign.findStorage(vo,pageNum,pageSize,lx);
    }

    //设备入库详情
    @ApiOperation(value = "设备入库详情", notes = "参数：")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "起始页", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页展示行数", required = true)})
    @PostMapping(value = "/findStorageById")
    public ResponseWrapper findStorageById(@RequestBody DSbxxsjyQueryVO vo,
                                           @RequestParam(value = "pageNum") Integer pageNum,
                                           @RequestParam(value = "pageSize") Integer pageSize){
            return facilityFeign.findStorageById(vo,pageNum,pageSize);
    }

    //设备申购分页
    @ApiOperation(value = "设备申购分页", notes = "参数：")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "起始页", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页展示行数", required = true)})
    @PostMapping(value = "/findPurchase")
    public ResponseWrapper findPurchase(@RequestBody DSbxxsjyQueryVO vo,
                                        @RequestParam(value = "pageNum") Integer pageNum,
                                        @RequestParam(value = "pageSize") Integer pageSize,
                                        @RequestParam(value = "lx") Integer lx){
            return facilityFeign.findPurchase(vo,pageNum,pageSize,lx);
    }

    //设备申购详情
    @ApiOperation(value = "设备申购详情", notes = "参数：")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "起始页", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页展示行数", required = true)})
    @PostMapping(value = "/findPurchaseById")
    public ResponseWrapper findPurchaseById(@RequestBody DSbxxsjyQueryVO vo,
                                            @RequestParam(value = "pageNum") Integer pageNum,
                                            @RequestParam(value = "pageSize") Integer pageSize){
            return facilityFeign.findPurchaseById(vo,pageNum,pageSize);
    }

    //机械设备统计
    @ApiOperation(value = "机械设备统计", notes = "参数：")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "起始页", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页展示行数", required = true)})
    @PostMapping(value = "/findSbtjfx")
    public ResponseWrapper findSbtjfx(@RequestBody DSbtjfxVO vo,
                                      @RequestParam(value = "pageNum") Integer pageNum,
                                      @RequestParam(value = "pageSize") Integer pageSize,
                                      @RequestParam(value = "lx") Integer lx){
        return facilityFeign.findSbtjfx(vo, pageNum, pageSize, lx);
    }
}
