package com.dhcc.finance.main.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.dhcc.common.model.CurrencyMeta;
import com.dhcc.common.model.response.RestfulResponse;
import com.dhcc.finance.constant.MsConfigConsts;
import com.dhcc.finance.main.domain.CwBdProductcell;
import com.dhcc.finance.main.domain.CwBdScenario;
import com.dhcc.finance.main.service.CwBdScenarioService;
import com.github.pagehelper.PageInfo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(value = MsConfigConsts.MS_API_PREFIX + CwBdScenarioController.API_PREFIX, 
  	          produces = {MediaType.APPLICATION_JSON_UTF8_VALUE }, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE })
@Api(value = "交易场景参数配置controller", tags = { "交易场景参数配置操作接口" })
public class CwBdScenarioController {
	// 交易场景参数配置接口地址前缀
	public static final String API_PREFIX = "/cw_bd_scenario";
	
	@Autowired
	CwBdScenarioService cwBdScenarioService;
	/**
	 * 功能描述
	 *@return RestfulResponse<List<CwBdScenario>,CurrencyMeta>
	 *@author huangpeng
	 *@date 2020年2月4日 下午2:11:17
	 *修改日志:
	 */
	@ApiOperation(value = "查询全部交易场景参数配置数据", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@RequestMapping(value = { "/searchCwBdScenarioAllData" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public 	RestfulResponse<List<CwBdScenario>, CurrencyMeta> searchCwBdScenarioAllData(){
		return cwBdScenarioService.searchCwBdScenarioAllData();
	}
	/**
	 * 功能描述  获取交易场景参数配置数据列表
	 *@param pageNum
	 *@param pageSize
	 *@param navigatePages
	 *@return RestfulResponse<PageInfo<CwBdScenario>,CurrencyMeta>
	 *@author huangpeng
	 *@date 2020年2月4日 上午9:25:33
	 *修改日志:
	 */
	@ApiOperation(value = "获取交易场景参数配置数据列表", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@ApiImplicitParams({
		@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pageSize", value = "每页显示数量", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "navigatePages", value = "需要连续显示的页码数量", required = true, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "jym", value = "交易码", required = true, dataType = "String", paramType="query"),
	    @ApiImplicitParam(name = "jycjmc", value = "交易场景名称", required = true, dataType = "String", paramType="query"),
	}) 
	@RequestMapping(value = { "/searchCwBdScenarioOfList" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public RestfulResponse<PageInfo<CwBdScenario>, CurrencyMeta> searchCwBdScenarioOfList(
			@RequestParam("pageNum") int pageNum,
    		@RequestParam("pageSize") int pageSize,
    		@RequestParam("navigatePages") int navigatePages,
    		@RequestParam(value="jym",required=false) String jym,
    		@RequestParam(value="jycjmc",required=false) String jycjmc){
		return cwBdScenarioService.searchCwBdScenarioOfList(pageNum, pageSize, navigatePages,jym,jycjmc);
	}
	/**
	 * 功能描述  删除交易场景参数配置
	 *@param idList
	 *@return RestfulResponse<Object,CurrencyMeta>
	 *@author huangpeng
	 *@date 2020年2月4日 上午9:26:57
	 *修改日志:
	 */
	@ApiOperation(value = "删除交易场景参数配置", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@RequestMapping(value = { "/deleteCwBdScenarioById" }, method = RequestMethod.PUT, consumes = MediaType.ALL_VALUE)
	public 	RestfulResponse<Object, CurrencyMeta> deleteCwBdScenarioById(@RequestBody List<String> idList){
		return cwBdScenarioService.deleteCwBdScenarioById(idList);
	}
	/**
	 * 功能描述 新增交易场景参数配置
	 *@param cwBdScenario
	 *@return RestfulResponse<Object,CurrencyMeta>
	 *@author huangpeng
	 *@date 2020年2月4日 上午9:28:43
	 *修改日志:
	 */
	@ApiOperation(value = "新增交易场景参数配置", notes = "新增交易场景参数配置", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "cwBdScenario", value = "交易场景参数配置对象实体", required = true, dataType = "CwBdScenario")
	@RequestMapping(value = "/addCwBdScenario", method = RequestMethod.POST)
	public RestfulResponse<Object, CurrencyMeta> addCwBdScenario(@RequestBody CwBdScenario cwBdScenario){
		return cwBdScenarioService.addCwBdScenario(cwBdScenario);
	}
	
	/**
	 * 功能描述  修改交易场景参数配置
	 *@param cwBdScenario
	 *@return RestfulResponse<Object,CurrencyMeta>
	 *@author huangpeng
	 *@date 2020年2月4日 上午9:30:01
	 *修改日志:
	 */
	@ApiOperation(value = "修改交易场景参数配置", notes = "修改交易场景参数配置", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "cwBdScenario", value = "交易场景参数配置对象实体", required = true, dataType = "CwBdScenario")
	@RequestMapping(value = "/updateCwBdScenario", method = RequestMethod.PUT)
	public RestfulResponse<Object, CurrencyMeta> updateCwBdScenario(@RequestBody CwBdScenario cwBdScenario){
		return cwBdScenarioService.updateCwBdScenario(cwBdScenario);
	}
}
