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.CwBdAccounting;
import com.dhcc.finance.main.service.CwBdAccountingService;
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;
import lombok.extern.slf4j.Slf4j;

/** 功能描述：人员设置相关功能
 * @author hezewei
 * @date 2019年6月13日 下午7:50:25
 * @修改日志：
 */
@Slf4j
@RestController
@RequestMapping(value = MsConfigConsts.MS_API_PREFIX + CwBdAccountingController.API_PREFIX, produces = {
        MediaType.APPLICATION_JSON_UTF8_VALUE }, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE })
@Api(value = "人员设置controller", tags = { "人员设置信息操作接口" })
public class CwBdAccountingController
{
 // 凭证信息操作接口地址前缀
    public static final String API_PREFIX = "/cw_bd_accounting";
    
    @Autowired
    CwBdAccountingService cwBdAccountingService;
    
    /**
     * 功能描述：查询人员设置信息
     * @param pageNum
     * @param pageSize
     * @param navigatePages
     * @param cwGlVoucherAndLike
     * @return RestfulResponse<PageInfo<CwGlVoucher>,CurrencyMeta>
     * @author hezewei
     * @date 2019年6月13日 下午7:54:22
     * @修改日志：
     */
    @ApiOperation(value = "获取全部人员设置信息", notes = "获取全部人员设置信息", 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 = "pkPrepared", value = "制单人",required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pkAudit", value = "审核人",required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pkSign", value = "记账人",required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pkAccounting", value = "人员ID",required = false, dataType = "String", paramType="query")
    }) 
    @RequestMapping(value = { "/searchCwBdAccountingAllData" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<PageInfo<CwBdAccounting>, CurrencyMeta> searchCwBdAccountingAllData(
            @RequestParam("pageNum") int pageNum,
            @RequestParam("pageSize") int pageSize,
            @RequestParam("navigatePages") int navigatePages,
            @RequestParam(value="pkPrepared",required=false) String pkPrepared,
            @RequestParam(value="pkAudit",required=false) String pkAudit,
            @RequestParam(value="pkSign",required=false) String pkSign,
            @RequestParam(value="pkAccounting",required=false) String pkAccounting ){
        return cwBdAccountingService.searchCwBdAccountingAllData(pageNum, pageSize, navigatePages,pkPrepared,pkAudit,pkSign,pkAccounting);
    }
    
    /**
     * 功能描述：新增人员设置信息
     * @param cwGlTransferdetail
     * @param pkTransfer
     * @return RestfulResponse<Object,CurrencyMeta>
     * @author hezewei
     * @date 2019年6月14日 上午10:48:22
     * @修改日志：
     */
    @ApiOperation(value="新增人员设置信息", notes="人员设置信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
    @ApiImplicitParam(name = "cwBdAccounting", value = "人员设置信息", required = true, dataType = "CwBdAccounting"),
    })
    @RequestMapping(value="/addCwBdAccounting", method=RequestMethod.POST)
    public RestfulResponse<Object, CurrencyMeta> addCwBdAccounting (@RequestBody CwBdAccounting cwBdAccounting) {
        return cwBdAccountingService.addCwBdAccounting(cwBdAccounting);
    }
    
    /**
     * 功能描述：删除人员设置信息
     * @param pkTransferdetail
     * @return RestfulResponse<Object,CurrencyMeta>
     * @author hezewei
     * @date 2019年6月15日 上午10:56:12
     * @修改日志：
     */
    @ApiOperation(value="删除人员设置信息", notes="人员设置信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.ALL_VALUE)
    @ApiImplicitParam(name = "pkAccounting", value = "删除(单个)", required = true, dataType = "String")
    @RequestMapping(value="/deleteCwBdAccounting", method=RequestMethod.DELETE, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<Object, CurrencyMeta> deleteCwBdAccounting(@RequestParam("pkAccounting") String pkAccounting){
        return cwBdAccountingService.deleteCwBdAccounting(pkAccounting);
    }
    
    /**
     * 功能描述：启用，禁用人员设置信息
     * @param pkAccounting
     * @return RestfulResponse<Object,CurrencyMeta>
     * @author hezewei
     * @date 2019年6月15日 下午3:17:18
     * @修改日志：
     */
    @ApiOperation(value="启用，禁用人员设置信息", notes="人员设置信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
        @ApiImplicitParam(name = "enablestate", value = "启用，禁用状态", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pkAccounting", value = "启用，禁用主键(单个)", required = true, dataType = "String", paramType="query"),
    })
    @RequestMapping(value="/updateCwBdAccounting", method=RequestMethod.PUT)
    public RestfulResponse<Object, CurrencyMeta> updateCwBdAccounting(
            @RequestParam(value="enablestate",required=true) String enablestate,
            @RequestParam(value="pkAccounting",required=true) String pkAccounting){
        return cwBdAccountingService.updateCwBdAccounting(enablestate,pkAccounting);
    }

    /**
     * 功能描述：修改人员设置
     * @param pkAccounting
     * @return RestfulResponse<Object,CurrencyMeta>
     * @author hezewei
     * @date 2019年6月17日 上午10:43:40
     * @修改日志：
     */
    @ApiOperation(value="修改人员设置", notes="人员设置信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.ALL_VALUE)
    @ApiImplicitParams({
        @ApiImplicitParam(name = "pkPrepared", value = "制单人",required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pkAudit", value = "审核人",required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pkSign", value = "记账人",required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "remark", value = "备注",required = false, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "enablestate", value = "启用状态", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pkAccounting", value = "人员ID",required = false, dataType = "String", paramType="query")
    }) 
    @RequestMapping(value="/updatePersonnelSettings", method=RequestMethod.PUT, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<Object, CurrencyMeta> updatePersonnelSettings(
            @RequestParam(value="pkPrepared",required=false) String pkPrepared,
            @RequestParam(value="pkAudit",required=false) String pkAudit,
            @RequestParam(value="pkSign",required=false) String pkSign,
            @RequestParam(value="remark",required=false) String remark,
            @RequestParam(value="enablestate",required=false) String enablestate,
            @RequestParam(value="pkAccounting",required=false) String pkAccounting ){
        return cwBdAccountingService.updatePersonnelSettings(pkPrepared,pkAudit,pkSign,remark,enablestate,pkAccounting);
    }
}
