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.CwHsGlorgbook;
import com.dhcc.finance.main.domain.CwHsSubcodemap;
import com.dhcc.finance.main.service.CwHsGlorgbookService;
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 + CwHsGlorgbookController.API_PREFIX, produces = {
		MediaType.APPLICATION_JSON_UTF8_VALUE }, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE })
@Api(value = "恒生估值账套操作controller", tags = { "恒生估值账套操作接口" })
public class CwHsGlorgbookController {
	
		public static final String API_PREFIX = "/cw_hs_glorgbook";
		
		@Autowired
		CwHsGlorgbookService cwHsGlorgbookService;
		
		/**
		 * 功能描述：查询全部凭证信息
		 * @param pageNum
		 * @param pageSize
		 * @param navigatePages
		 * @return RestfulResponse<PageInfo<CwGlVoucher>,CurrencyMeta>
		 * @author dml
		 * @date 2019年3月28日 下午4:51:57
		 * @修改日志：
		 */
		@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 = "glorgbookCode", value = "账套编码", required = false, dataType = "String", paramType="query")
	    }) 
		@RequestMapping(value = { "/searchCwHsGlorgbookAllData" }, method = RequestMethod.GET,consumes = MediaType.ALL_VALUE)
		public RestfulResponse<PageInfo<CwHsGlorgbook>, CurrencyMeta> searchCwHsGlorgbookAllData(
				@RequestParam("pageNum") int pageNum,
	    		@RequestParam("pageSize") int pageSize,
	    		@RequestParam("navigatePages") int navigatePages,@RequestParam(value="glorgbookCode",required=false) String glorgbookCode){
			return cwHsGlorgbookService.searchCwHsGlorgbookAllData(pageNum, pageSize, navigatePages,glorgbookCode);
		}
		/**
		 * 功能描述
		 * @return RestfulResponse<List<CwHsGlorgbook>,CurrencyMeta>
		 * @author huangpeng
		 * @date 2019年7月26日 下午10:05:43
		 * 修改日志
		 */
		@ApiOperation(value = "获取所有账套信息", notes = "获取所有账套信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
		@RequestMapping(value = { "/searchAllData" }, method = RequestMethod.GET,consumes = MediaType.ALL_VALUE)
		public RestfulResponse<List<CwHsGlorgbook>, CurrencyMeta> searchAllData(){
			return cwHsGlorgbookService.searchAllData();
		}
		

		/**
		 * Title: deletCwHsGlorgbookinfo <br/>  
		 * Description: TODO按照科目id删除账套信息 <br/>
		 * @author lipeng 
		 * @return RestfulResponse<Map<String,List<String>>,CurrencyMeta>
		 * @date 2019年7月27日 上午10:31:44
		 */
		@ApiOperation(value = "按照科目id删除账套信息", notes = "按照科目id删除账套信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
		@ApiImplicitParam(name = "IdList", required = true, dataType = "List")
		@RequestMapping(value = { "/deletCwHsGlorgbookinfo" }, method = RequestMethod.PUT)
		public RestfulResponse<Object, CurrencyMeta> deletCwHsGlorgbookinfo(@RequestBody List<String>  IdList){
			return cwHsGlorgbookService.deletCwHsGlorgbookinfo(IdList);
		}
		/**
		 * Title: addcwHsGlorgbook <br/>  
		 * Description: TODO 新增账套信息<br/>
		 * @author lipeng 
		 * @param addcwHsGlorgbook
		 * @return RestfulResponse<Object,CurrencyMeta>
		 * @date 2019年7月27日 下午3:31:00
		 */
		@ApiOperation(value = "新增账套信息", notes = "新增账套信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	    @ApiImplicitParam(name = "cwHsGlorgbook", value = "账套信息实体类",required = false, dataType = "CwHsGlorgbook")
		@RequestMapping(value = { "/addcwHsGlorgbook" }, method = RequestMethod.POST)
		public RestfulResponse<Object, CurrencyMeta> addcwHsGlorgbook(@RequestBody CwHsGlorgbook cwHsGlorgbook){
			return cwHsGlorgbookService.addcwHsGlorgbook(cwHsGlorgbook);
		}
		/**
		 * Title: addCwHsSubcodemapInfo <br/>  
		 * Description: TODO 修改账套信息<br/>
		 * @author lipeng 
		 * @param cwHsSubcodemap
		 * @return RestfulResponse<Object,CurrencyMeta>
		 * @date 2019年7月27日 下午3:31:00
		 */
		@ApiOperation(value = "修改账套信息", notes = "修改账套信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	    @ApiImplicitParam(name = "cwHsGlorgbook", value = "账套信息实体类",required = false, dataType = "CwHsGlorgbook")
		@RequestMapping(value = { "/updatacwHsGlorgbook" }, method = RequestMethod.POST)
		public RestfulResponse<Object, CurrencyMeta> updatacwHsGlorgbook(@RequestBody CwHsGlorgbook cwHsGlorgbook){
			return cwHsGlorgbookService.updatacwHsGlorgbook(cwHsGlorgbook);
		}
		/**
		 * Title: searchCwHsSubcodemapAllData <br/>  
		 * Description: TODO按照productId查询帐套对应的科目信息 <br/>
		 * @author lipeng 
		 * @param pageNum
		 * @param pageSize
		 * @param navigatePages
		 * @param cwHsSubcodemap
		 * @return RestfulResponse<PageInfo<CwHsSubcodemap>,CurrencyMeta>
		 * @date 2019年7月28日 下午4:18:16
		 */
		@ApiOperation(value = "按照productId查询帐套对应的科目信息", notes = "按照productId查询帐套对应的科目信息", produces = MediaType.APPLICATION_JSON_UTF8_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 = "productId", value = "productId", required = true, dataType = "String", paramType="query"),
	        @ApiImplicitParam(name = "subCode", value = "科目代码", required = true, dataType = "String", paramType="query"),
	        @ApiImplicitParam(name = "subCodeV", value = "估值科目代码", required = true, dataType = "String", paramType="query"),
		}) 
		@RequestMapping(value = { "/selectCwHsGlorgbookAndCwHsSub" }, method = RequestMethod.GET,consumes = MediaType.ALL_VALUE)
		public RestfulResponse<PageInfo<CwHsSubcodemap>, CurrencyMeta> selectCwHsGlorgbookAndCwHsSub(
				@RequestParam("pageNum") int pageNum,
	    		@RequestParam("pageSize") int pageSize,
	    		@RequestParam("navigatePages") int navigatePages,
	    		@RequestParam("productId") String productId,
	    		@RequestParam("subCode") String subCode,
	    		@RequestParam("subCodeV") String subCodeV){
			return cwHsGlorgbookService.selectCwHsGlorgbookAndCwHsSub(pageNum, pageSize, navigatePages, productId, subCode, subCodeV);
		}
		/**
		 * Title: searchCwHsSubcodemapAllData <br/>  
		 * Description: TODO批量插入帐套科目信息 <br/>
		 * @author lipeng 
		 * @param pageNum
		 * @param pageSize
		 * @param navigatePages
		 * @param cwHsSubcodemap
		 * @return RestfulResponse<PageInfo<CwHsSubcodemap>,CurrencyMeta>
		 * @date 2019年7月28日 下午4:18:16
		 */
		@ApiOperation(value = "批量插入帐套科目信息", notes = "批量插入帐套科目信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	    @ApiImplicitParam(name = "productId", value = "productId", required = true, dataType = "String", paramType="query")
		@RequestMapping(value = { "/insertForBatch" }, method = RequestMethod.GET,consumes = MediaType.ALL_VALUE)
		public RestfulResponse<Object, CurrencyMeta> insertForBatch(
	    		@RequestParam("productId") String productId){
			return cwHsGlorgbookService.insertForBatch(productId);
		}
		/**
		 * Title: selectCwHsGlorgbookCount <br/>  
		 * Description: TODO 按照producId查询帐套对应的科目数<br/>
		 * @author lipeng 
		 * @param productId
		 * @return RestfulResponse<Object,CurrencyMeta>
		 * @date 2019年7月29日 上午10:35:12
		 */
		@ApiOperation(value = "按照producId查询帐套对应的科目数", notes = "按照producId查询帐套对应的科目数", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	    @ApiImplicitParam(name = "productId", value = "productId", required = true, dataType = "String", paramType="query")
		@RequestMapping(value = { "/selectCwHsGlorgbookCount" }, method = RequestMethod.GET,consumes = MediaType.ALL_VALUE)
		public RestfulResponse<Object, CurrencyMeta> selectCwHsGlorgbookCount(
	    		@RequestParam("productId") String productId){
			return cwHsGlorgbookService.selectCwHsGlorgbookCount(productId);
		}
}
