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.CwGlTransfer;
import com.dhcc.finance.main.domain.CwGlTransferdetail;
import com.dhcc.finance.main.domain.CwGlVoucher;
import com.dhcc.finance.main.model.CwGlTransferdetailAndSubName;
import com.dhcc.finance.main.service.CwGlTransferdetailService;
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 + CwGlTransferdetailController.API_PREFIX, produces = {MediaType.APPLICATION_JSON_UTF8_VALUE }, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE })
@Api(value = "转账定义详情controller", tags = { "转账定义详情操作接口" })
public class CwGlTransferdetailController {
	// 会计期间操作接口地址前缀
		public static final String API_PREFIX = "/cw_gl_transferdetail";
		
		@Autowired
		CwGlTransferdetailService cwGlTransferdetailService;
		/**
		 * 根据结案方案主键查询
		 * @param pkTransfer
		 * @param pageNum
		 * @param pageSize
		 * @param navigatePages
		 * @return RestfulResponse<PageInfo<CwGlTransferdetail>,CurrencyMeta>
		 *@author huangpeng
		 *@date 2019年3月27日 下午1:56:03
		 *@修改日志：
		 */
		@ApiOperation(value = "根据结案方案主键查询",notes = "",produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.ALL_VALUE)
		@ApiImplicitParams({
			@ApiImplicitParam(name = "pkTransfer", value = "结案方案主键", required = false, dataType = "String", paramType="query"),
			@ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "String", paramType="query"),
		    @ApiImplicitParam(name = "pageSize", value = "每页显示数量", required = false, dataType = "String", paramType="query"),
		    @ApiImplicitParam(name = "navigatePages", value = "需要连续显示的页码数量", required = false, dataType = "String", paramType="query")
		})
		@RequestMapping(value = "/searchCwGlTransferdetailBypkTransfer", method = RequestMethod.GET,consumes = MediaType.ALL_VALUE)
		public RestfulResponse<PageInfo<CwGlTransferdetailAndSubName>, CurrencyMeta> searchCwGlTransferdetailBypkTransfer(@RequestParam("pkTransfer") String pkTransfer,
				@RequestParam("pageNum") int pageNum,
				@RequestParam("pageSize") int pageSize,
				@RequestParam("navigatePages") int navigatePages){
			return cwGlTransferdetailService.searchCwGlTransferByNameLike(pkTransfer,pageNum, pageSize, navigatePages);
		}
		/**
		 * 逻辑删除转账定义详情表
		 * @param pkTransferdetail
		 * @return RestfulResponse<Object,CurrencyMeta>
		 *@author huangpeng
		 *@date 2019年3月27日 下午1:56:16
		 *@修改日志：
		 */
		@ApiOperation(value="删除转账定义详情表", notes="结转方案详情表", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.ALL_VALUE)
	    @ApiImplicitParam(name = "pkTransferdetail", value = "删除(单个)", required = true, dataType = "String")
	    @RequestMapping(value="/deleteCwGlTransferdetail", method=RequestMethod.DELETE, consumes = MediaType.ALL_VALUE)
		public RestfulResponse<Object, CurrencyMeta> deleteCwGlTransferdetailBypkTransferdetail(@RequestParam("pkTransferdetail") String pkTransferdetail){
			return cwGlTransferdetailService.deleteCwGlTransferdetail(pkTransferdetail);
		}
		/**
		 * 增加结转方案详情
		 * @param cwGlTransferdetail
		 * @param pkTransfer
		 * @return RestfulResponse<Object,CurrencyMeta>
		 *@author huangpeng
		 *@date 2019年3月27日 下午1:56:28
		 *@修改日志：
		 */
		@ApiOperation(value="增加结转方案详情", notes="结转方案表详情", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
		@ApiImplicitParams({
		@ApiImplicitParam(name = "cwGlTransferdetail", value = "结转方案详情", required = true, dataType = "CwGlTransferdetail"),
		@ApiImplicitParam(name = "pkTransfer", value = "结案方案主键", required = false, dataType = "String", paramType="query"),
		})
	    @RequestMapping(value="/addCwGlTransferdetail", method=RequestMethod.POST)
		public RestfulResponse<Object, CurrencyMeta> addCwGlTransferdetail (@RequestBody CwGlTransferdetail cwGlTransferdetail,@RequestParam("pkTransfer") String pkTransfer) {
			return cwGlTransferdetailService.addCwGlTransfer(cwGlTransferdetail,pkTransfer);
		}
		/**
		 * 修改结转方案详情
		 * @param cwGlTransferdetail
		 * @return RestfulResponse<Object,CurrencyMeta>
		 *@author huangpeng
		 *@date 2019年3月27日 下午1:56:37
		 *@修改日志：
		 */
		@ApiOperation(value="修改结转方案详情", notes="更新放结转方案详情", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
		@ApiImplicitParam(name = "cwGlTransferdetail", value = "结转方案详情", required = true, dataType = "CwGlTransferdetail") 
	    @RequestMapping(value="/updateCwGlTransferdetail", method=RequestMethod.PUT)
		public RestfulResponse<Object, CurrencyMeta> updateCwGlTransferdetail (@RequestBody CwGlTransferdetail cwGlTransferdetail) {
			return cwGlTransferdetailService.updateCwGlTransfer(cwGlTransferdetail);
		}
		/**
		 * 功能描述:查询转账详情所有信息
		 * @return RestfulResponse<List<CwGlTransferdetail>,CurrencyMeta>
		 *@author baiyc
		 *@date 2019年4月12日 上午10:05:31
		 *@修改日志:
		 */
		 @ApiOperation(value = "获取转账详情全部数据", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
		 @ApiImplicitParam(name = "pkTransfer", value = "结转方案主键", required = true, dataType = "String", paramType="query")
		 @RequestMapping(value = { "/searchCwGlTransferdetail" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	       public   RestfulResponse<List<CwGlTransferdetail>, CurrencyMeta> searchCwGlTransferdetail(@RequestParam("pkTransfer") String pkTransfer){
	             return cwGlTransferdetailService.searchCwGlTransferdetail(pkTransfer);
	     }
		 /**
		  * 功能描述 批量删除结转明细
		  *@param pkDetailList
		  *@return RestfulResponse<Object,CurrencyMeta>
		  *@author huangpeng
		  *@date 2019年8月24日 下午2:58:17
		  *修改日志:
		  */
		@ApiOperation(value = "批量删除结转明细", notes = "批量删除结转明细", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
		@ApiImplicitParam(name = "List", value = "主键名list", required = true, dataType = "List")
		@RequestMapping(value = "/updateCwGlTransferByPkForBatch", method = RequestMethod.PUT)
		public RestfulResponse<Object, CurrencyMeta> updateCwGlTransferByPkForBatch(@RequestBody List<String> pkDetailList ) {
			return cwGlTransferdetailService.updateCwGlTransferByPkForBatch(pkDetailList);
		}
}
