package com.muchinfo.mtp3century.controller;

import com.muchinfo.mtp3century.service.IGoodsSetUpService;
import com.muchinfo.mtp3century.utils.AjaxResult;
import com.muchinfo.mtp3common.vo.PageResult;
import com.muchinfo.mtp3pojos.entity.Goods;
import com.muchinfo.mtp3pojos.entity.Goodsgroup;
import com.muchinfo.mtp3pojos.entity.Market;
import com.muchinfo.mtp3pojos.vo.tradingmarket.TradingMarketQuoterFirstAddParam;
import com.muchinfo.mtp3pojos.vo.tradingmarket.goodssetup.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/goodsSetUp")
@Api(value = "商品设置管理API", description = "交易市场管理->商品管理")
public class GoodsSetUpController {

    @Resource
    private IGoodsSetUpService iGoodsSetUpService;

    @RequestMapping(method = RequestMethod.POST, value = "/listAllInit")
    @ApiOperation("交易市场管理-->商品管理 --> 初始化市场下拉列表")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<Market> listAllInit(HttpServletRequest request, String orgztypes, String filterTrademodeList) {
        return iGoodsSetUpService.listAllInit(request, orgztypes, filterTrademodeList);
    }

    @ApiOperation("交易市场管理-->商品管理--> 商品组设置--> 获取列表")
    @RequestMapping(method = RequestMethod.GET, value = "/groupSetQuery")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    public PageResult<GoodsGroupSetQueryResult> groupSetQuery(GoodsGroupSetQueryParam dealerQueryParam, HttpServletRequest request) {
        return iGoodsSetUpService.groupSetQuery(dealerQueryParam, request);
    }

    @ApiOperation("交易市场管理-->商品管理--> 商品组设置--> 详情")
    @RequestMapping(method = RequestMethod.GET, value = "/groupSetDetail")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<GoodsGroupSetDetailResult> groupSetDetail(Long goodsgroupid, HttpServletRequest request) {
        return iGoodsSetUpService.groupSetDetail(goodsgroupid, request);
    }

    @ApiOperation("交易市场管理-->商品管理--> 商品组设置--> 注销")
    @RequestMapping(method = RequestMethod.GET, value = "/groupDel")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult groupDel(Long goodsgroupid, HttpServletRequest request) {
        return iGoodsSetUpService.groupDel(goodsgroupid, request);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/groupsave")
    @ApiOperation("交易市场管理-->商品管理 --> 商品组设置 --> 新增、修改")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult groupsave(@RequestBody GoodsGroupSetDetailResult param, HttpServletRequest request) {
        return iGoodsSetUpService.groupsave(param, request);
    }

    @ApiOperation("交易市场管理-->商品管理--> 商品设置--> 获取列表")
    @RequestMapping(method = RequestMethod.GET, value = "/goodsQuery")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    public PageResult<GoodsQueryResult> goodsQuery(GoodsQueryParam param, HttpServletRequest request) {
        return iGoodsSetUpService.goodsQuery(param, request);
    }

    @ApiOperation("交易市场管理-->商品管理--> 商品设置--> 详情")
    @RequestMapping(method = RequestMethod.GET, value = "/goodsview")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    public AjaxResult<GoodsQueryDetailResult> goodsview(Long goodsid, HttpServletRequest request) {
        return iGoodsSetUpService.goodsview(goodsid, request);
    }

    @ApiOperation("交易市场管理-->商品管理--> 商品停牌管理--> 获取列表(初始化页面)")
    @RequestMapping(method = RequestMethod.GET, value = "/goodsuspended")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<GoodsUspendedQueryResult> goodsuspended(GoodsUspendedQueryParam param, HttpServletRequest request) {
        return iGoodsSetUpService.goodsuspended(param, request);
    }

    @ApiOperation("交易市场管理-->商品管理--> 商品停牌管理--> 获取列表(确定某日日期)")
    @RequestMapping(method = RequestMethod.GET, value = "/sreach")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    public PageResult<GoodsSearchQueryResult> sreach(GoodsSearchQueryParam param, HttpServletRequest request) {
        return iGoodsSetUpService.sreach(param, request);
    }

    @ApiOperation("交易市场管理-->商品管理--> 商品停牌管理--> 新增获取商品组")
    @RequestMapping(method = RequestMethod.GET, value = "/goodsGroupList")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<Goodsgroup> goodsGroupList(Long goodsgroupstatus, Long marketid, HttpServletRequest request) {
        return iGoodsSetUpService.goodsGroupList(goodsgroupstatus, marketid, request);
    }

    @ApiOperation("交易市场管理-->商品管理--> 商品停牌管理--> 新增获取商品")
    @RequestMapping(method = RequestMethod.GET, value = "/queryByGoodsgroupId")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<Goods> queryByGoodsgroupId(Long goodsgroupid, Integer goodsstatus, Long marketid, HttpServletRequest request) {
        return iGoodsSetUpService.queryByGoodsgroupId(goodsgroupid, goodsstatus,marketid, request);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/goodsuspendedadd")
    @ApiOperation("交易市场管理-->商品管理 --> 商品组设置 --> 新增、修改")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult goodsuspendedadd(@RequestBody GoodsUspendedAddQueryParam param, HttpServletRequest request) {
        return iGoodsSetUpService.goodsuspendedadd(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/goodsuspendeddel")
    @ApiOperation("交易市场管理-->商品管理 --> 商品组设置 --> 删除")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult goodsuspendeddel(Long autoid, HttpServletRequest request) {
        return iGoodsSetUpService.goodsuspendeddel(autoid, request);
    }

    @ApiOperation("交易市场管理-->商品管理--> 商品退市管理--> 获取列表")
    @RequestMapping(method = RequestMethod.GET, value = "/queryDelistGoods")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    public PageResult<DelistGoodsInfoResult> queryDelistGoodsInfo(DelistGoodsInfoParam param, HttpServletRequest request) {
        return iGoodsSetUpService.queryDelistGoodsInfo(param, request);
    }
}
