package com.dhcc.finance.main.controller;

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.CwBdSubjTransformation;
import com.dhcc.finance.main.service.CwBdSubjTransformationService;
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;
/**
 * @ClassName: CwBdSubjTransformationController 
 * @Description: TODO(科目转换接口)
 * @author lipeng 
 * @date 2019年9月16日 下午7:25:52
 * @see
 */
@RestController
@RequestMapping(value = MsConfigConsts.MS_API_PREFIX + CwBdSubjTransformationController.API_PREFIX, 
  	          produces = {MediaType.APPLICATION_JSON_UTF8_VALUE }, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE })
@Api(value = "科目转换接口controller", tags = { "科目转换接口操作接口" })
public class CwBdSubjTransformationController {
	
	    // 科目转换接口地址前缀
		public static final String API_PREFIX = "/cw_bd_subj_transformation";
		
		@Autowired
		CwBdSubjTransformationService cwBdSubjTransformationService;
		
		/**
		 * @Title: searchCwBdSubjschemeAllData
		 * @Description: TODO(按照账套主键和科目代码查询科目转换信息)
		 * @author lipeng
		 * @param @param pageNum
		 * @param @param pageSize
		 * @param @param navigatePages
		 * @param @param nameLike
		 * @param @return
		 * @return RestfulResponse<PageInfo<CwBdSubjscheme>,CurrencyMeta>
		 * @see
		 * @throws
		 */
		@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 = "subjcode", value = "科目代码", required = false, dataType = "String", paramType="query"),
	        @ApiImplicitParam(name = "pkGlorgbook", value = "科目代码", required = false, dataType = "String", paramType="query")
	    }) 
		@RequestMapping(value = { "/selectCwBdSubjTransformation" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
		public RestfulResponse<PageInfo<CwBdSubjTransformation>, CurrencyMeta> selectCwBdSubjTransformation(
				@RequestParam("pageNum") int pageNum,
	    		@RequestParam("pageSize") int pageSize,
	    		@RequestParam("navigatePages") int navigatePages,
	    		@RequestParam(value="subjcode",required=false) String subjcode,
	    		@RequestParam(value="pkGlorgbook",required=false) String pkGlorgbook ){
			return cwBdSubjTransformationService.selectCwBdSubjTransformation(pageNum, pageSize, navigatePages, subjcode, pkGlorgbook);
		}
		/**
		 * @Title: updateCwBdSubjschemeByPk
		 * @Description: TODO(根据账套编号和科目代码转换科目)
		 * @author lipeng
		 * @param @param pkGlorgbook
		 * @param @param pk_accsubj
		 * @param @param subjcodeN
		 * @param @param subjname
		 * @param @param subjcodeO
		 * @param @return
		 * @return RestfulResponse<Object,CurrencyMeta>
		 * @see
		 * @throws
		 */
		@ApiOperation(value = "科目转换", notes = "科目转换", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
		@ApiImplicitParams({
	        @ApiImplicitParam(name = "pkGlorgbook", value = "账套主键", required = true, dataType = "String", paramType="query"),
	        @ApiImplicitParam(name = "pk_accsubj", value = "科目主键", required = true, dataType = "String", paramType="query"),
	        @ApiImplicitParam(name = "subjcodeN", value = "新科目代码", required = true, dataType = "String", paramType="query"),
	        @ApiImplicitParam(name = "subjname", value = "科目名称", required = true, dataType = "String", paramType="query"),
	        @ApiImplicitParam(name = "subjcodeO", value = "旧科目代码", required = true, dataType = "String", paramType="query")
	    }) 
		@RequestMapping(value = { "/updatecwBdSubjTransformation" },method = RequestMethod.PUT)
		public RestfulResponse<Object, CurrencyMeta> updatecwBdSubjTransformation(
			@RequestBody  CwBdSubjTransformation  cwBdSubjTransformation){
			
			String pkGlorgbook=cwBdSubjTransformation.getPkGlorgbook();
    		String pk_accsubj=cwBdSubjTransformation.getPk_accsubj();
    		String subjcodeN=cwBdSubjTransformation.getSubjcodeN();
    		String subjname=cwBdSubjTransformation.getSubjname();
    		String subjcodeO=cwBdSubjTransformation.getSubjcodeO();
			return cwBdSubjTransformationService.updatecwBdSubjTransformation(pkGlorgbook, pk_accsubj, subjcodeN, subjname, subjcodeO);
	}		
}
