package com.liquidnet.service.goblin.controller.manage;

import com.github.pagehelper.PageInfo;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.GoblinOrderLogVo;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMoneyService;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


@ApiSupport(order = 149002)
@Api(tags = "店铺资金模块")
@Slf4j
@Validated
@RestController
@RequestMapping("store/money")
public class GoblinStoreMoneyController {
    @Autowired
    IGoblinStoreMoneyService goblinStoreMoneyService;

    @GetMapping("spu/list")
    @ApiOperation("商品资金列表")
    @ApiResponse(code = 200, message = "接口返回对象参数")
    @ApiImplicitParams({
            @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "spuName", value = "商品名称"),
            @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "st", value = "起始时间"),
            @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "et", value = "终止时间"),
            @ApiImplicitParam(type = "form", required = true, dataType = "Integer", name = "page", value = "页数"),
    })
    public ResponseDto<PageInfo<GoblinOrderLogVo>> getSpuList(@RequestParam(value = "spuName", required = false) String spuName,
                                                              @RequestParam(value = "st", required = false) String st,
                                                              @RequestParam(value = "et", required = false) String et,
                                                              @RequestParam(value = "page") Integer page) {
        return goblinStoreMoneyService.getSpuList(spuName, st, et, page);
    }

    @GetMapping("orderOpera/list")
    @ApiOperation("商品订单操作日志列表")
    @ApiResponse(code = 200, message = "接口返回对象参数")
    @ApiImplicitParams({
            @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "spuId", value = "spuId"),
            @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "orderCode", value = "订单号"),
            @ApiImplicitParam(type = "form", required = true, dataType = "Integer", name = "type", value = "交易类型[1-订单交易，2-订单退款，3-正在下单[订单交易]，4-正在下单[订单退款]]"),
            @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "st", value = "起始时间"),
            @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "et", value = "终止时间"),
            @ApiImplicitParam(type = "form", required = true, dataType = "Integer", name = "page", value = "页数"),
    })
    public ResponseDto<PageInfo<GoblinOrderLogVo>> getOrderOperaList(@RequestParam(value = "spuId", required = false) String spuId,
                                                                     @RequestParam(value = "orderCode", required = false) String orderCode,
                                                                     @RequestParam(value = "type", required = false) Integer type,
                                                                     @RequestParam(value = "st", required = false) String st,
                                                                     @RequestParam(value = "et", required = false) String et,
                                                                     @RequestParam(value = "page") Integer page) {
        return goblinStoreMoneyService.getOrderOperaList(spuId, orderCode, type, st, et, page);
    }

}
