package com.dhcc.finance.main.controller;

import com.dhcc.common.constant.SysConstants;
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.CwGlDetail;
import com.dhcc.finance.main.domain.CwGlVoucher;
import com.dhcc.finance.main.model.CwGlVoucherAndLike;
import com.dhcc.finance.main.model.CwGlVoucherAndName;
import com.dhcc.finance.main.model.CwGlVoucherRequest;
import com.dhcc.finance.main.model.CwGlVoucherWeb;
import com.dhcc.finance.main.service.CwGlVoucherService;
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;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * 功能描述：凭证信息Controller
 *
 * @author dml
 * @date 2019年3月28日 下午4:44:58
 * @修改日志：
 */
@Slf4j
@RestController
@RequestMapping(value = MsConfigConsts.MS_API_PREFIX + CwGlVoucherController.API_PREFIX, produces = {
        MediaType.APPLICATION_JSON_UTF8_VALUE}, consumes = {MediaType.APPLICATION_JSON_UTF8_VALUE})
@Api(value = "凭证信息controller", tags = {"凭证信息操作接口"})
public class CwGlVoucherController {

    // 凭证信息操作接口地址前缀
    public static final String API_PREFIX = "/cw_gl_voucher";

    @Autowired
    CwGlVoucherService cwGlVoucherService;

    // 批量循环最大条数
    private static final int SIZE = 800;// 每次循环最大条数

    /**
     * 功能描述 获取全部凭证信息
     *
     * @param pageNum
     * @param pageSize
     * @param navigatePages
     * @param cwGlVoucherAndLike
     * @return RestfulResponse<PageInfo < CwGlVoucherAndName>,CurrencyMeta>
     * @author huangpeng
     * @date 2019年10月15日 下午6:22:11
     * 修改日志:
     */
    @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 = "cwGlVoucherAndLike", value = "凭证信息筛选实体类", required = false, dataType = "CwGlVoucherAndLike")
    })
    @RequestMapping(value = {"/searchCwGlVoucherAllData"}, method = RequestMethod.PUT)
    public RestfulResponse<PageInfo<CwGlVoucherAndName>, CurrencyMeta> searchCwGlVoucherAllData(
            @RequestParam("pageNum") int pageNum,
            @RequestParam("pageSize") int pageSize,
            @RequestParam("navigatePages") int navigatePages,
            @RequestBody CwGlVoucherAndLike cwGlVoucherAndLike) {
        return cwGlVoucherService.searchCwGlVoucherAllData(pageNum, pageSize, navigatePages, cwGlVoucherAndLike);
    }

    /**
     * 功能描述：新增凭证信息
     *
     * @param cwGlVoucher
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author dml
     * @date 2019年3月28日 下午5:15:50
     * @修改日志：
     */
    @ApiOperation(value = "新增制单-传递复杂对象", notes = "新增制单信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParam(name = "cwGlVoucherWeb", value = "凭证信息Web对象实体", required = true, dataType = "CwGlVoucherWeb")
    @RequestMapping(value = "/addCwGlVoucher", method = RequestMethod.POST)
    public RestfulResponse<Object, CurrencyMeta> addCwGlVoucher(@RequestBody CwGlVoucherWeb cwGlVoucherWeb) {
        log.info(cwGlVoucherWeb.toString());
        return cwGlVoucherService.addCwGlVoucher(cwGlVoucherWeb);
    }

    /**
     * 功能描述：修改凭证信息
     *
     * @param cwGlVoucher
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author dml
     * @date 2019年3月28日 下午5:17:25
     * @修改日志：
     */
    @ApiOperation(value = "修改凭证信息-传递复杂对象", notes = "修改凭证信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParam(name = "cwGlVoucher", value = "凭证信息对象实体", required = true, dataType = "CwGlVoucher")
    @RequestMapping(value = "/updateCwGlVoucherByPk", method = RequestMethod.PUT)
    public RestfulResponse<Object, CurrencyMeta> updateCwGlVoucherByPk(@RequestBody CwGlVoucher cwGlVoucher) {
        return cwGlVoucherService.updateCwGlVoucherByPk(cwGlVoucher);
    }

    /**
     * 功能描述：逻辑删除凭证信息
     *
     * @param pkVoucher
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author dml
     * @date 2019年3月28日 下午5:19:03
     * @修改日志：
     */
    @ApiOperation(value = "逻辑删除凭证信息", notes = "删除凭证信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParam(name = "pkVoucher", value = "凭证信息主键", required = true, dataType = "String")
    @RequestMapping(value = "/deleteCwGlVoucherByPk", method = RequestMethod.DELETE, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<Object, CurrencyMeta> deleteCwGlVoucherByPk(@RequestParam("pkVoucher") String pkVoucher) {
        return cwGlVoucherService.deleteCwGlVoucherByPk(pkVoucher);
    }

    /**
     * 批量审核凭证信息
     *
     * @param cwGlVouchers
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author huangpeng
     * @date 2019年4月1日 下午4:15:32
     * @修改日志：
     */
    @ApiOperation(value = "审核凭证信息", notes = "批量审核凭证信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParam(name = "CwGlVoucher", value = "数据表名", required = true, dataType = "List")
    @RequestMapping(value = "/updateCwGlVoucherByPkForBatch", method = RequestMethod.PUT)
    public RestfulResponse<Object, CurrencyMeta> updateCwGlVoucherByPkForBatch(@RequestBody List<CwGlVoucher> cwGlVouchers) {
        return cwGlVoucherService.updateCwGlVoucherByPkForBatch(cwGlVouchers);
    }

    /**
     * 功能描述 批量审核凭证信息
     *
     * @param cwGlVouchers
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author huangpeng
     * @date 2019年12月25日 上午9:51:37
     * 修改日志:
     */
    @ApiOperation(value = "批量审核凭证信息", notes = "批量审核凭证信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParam(name = "CwGlVoucher", value = "数据表名", required = true, dataType = "List")
    @RequestMapping(value = "/updateCwGlVoucherByAuditForBatch", method = RequestMethod.PUT)
    public RestfulResponse<Object, CurrencyMeta> updateCwGlVoucherByAuditForBatch(@RequestBody List<CwGlVoucher> cwGlVouchers) {
        RestfulResponse<Object, CurrencyMeta> res = new RestfulResponse<Object, CurrencyMeta>
                (SysConstants.CODE.FAIL, SysConstants.DEFAULT_MESSAGE.OPERATION_SUCCESS);
        for (int i = 0; i <= cwGlVouchers.size() / SIZE && i * SIZE < cwGlVouchers.size(); i++) {
            List<CwGlVoucher> subList = new ArrayList<>();
            if (SIZE * (1 + i) < cwGlVouchers.size()) {
                subList = cwGlVouchers.subList(i * SIZE, SIZE * (1 + i));
            } else {
                subList = cwGlVouchers.subList(i * SIZE, cwGlVouchers.size());
            }
            res = cwGlVoucherService.updateCwGlVoucherByAuditForBatch(subList);
            if (SysConstants.CODE.FAIL == res.getCode().intValue()) {
                break;
            }
        }
        return res;
    }

    /**
     * 单个反审核凭证信息
     *
     * @param cwGlVouchers
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author huangpeng
     * @date 2019年4月5日 上午9:44:37
     * @修改日志：
     */
    @ApiOperation(value = "单个反审核凭证信息", notes = "批量反审核凭证信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParam(name = "CwGlVoucher", value = "数据表名", required = true, dataType = "List")
    @RequestMapping(value = "/updateCwGlVoucherForReverseAudit", method = RequestMethod.PUT)
    public RestfulResponse<Object, CurrencyMeta> updateCwGlVoucherForReverse(@RequestBody List<CwGlVoucher> cwGlVouchers) {
        return cwGlVoucherService.updateCwGlVoucherForReverse(cwGlVouchers);
    }

    /**
     * 批量反审核凭证信息
     *
     * @param cwGlVouchers
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author huangpeng
     * @date 2019年4月5日 上午9:44:37
     * @修改日志：
     */
    @ApiOperation(value = "批量反审核凭证信息", notes = "批量反审核凭证信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParam(name = "CwGlVoucher", value = "数据表名", required = true, dataType = "List")
    @RequestMapping(value = "/updateCwGlVoucherForReverseByAudit", method = RequestMethod.PUT)
    public RestfulResponse<Object, CurrencyMeta> updateCwGlVoucherForReverseByAudit(@RequestBody List<CwGlVoucher> cwGlVouchers) {
        RestfulResponse<Object, CurrencyMeta> res = new RestfulResponse<Object, CurrencyMeta>
                (SysConstants.CODE.FAIL, SysConstants.DEFAULT_MESSAGE.OPERATION_SUCCESS);
        for (int i = 0; i <= cwGlVouchers.size() / SIZE && i * SIZE < cwGlVouchers.size(); i++) {
            List<CwGlVoucher> subList = new ArrayList<>();
            if (SIZE * (1 + i) < cwGlVouchers.size()) {
                subList = cwGlVouchers.subList(i * SIZE, SIZE * (1 + i));
            } else {
                subList = cwGlVouchers.subList(i * SIZE, cwGlVouchers.size());
            }
            res = cwGlVoucherService.updateCwGlVoucherForReverseByAudit(subList);
            if (SysConstants.CODE.FAIL == res.getCode().intValue()) {
                break;
            }
        }
        return res;
    }

    /**
     * 单个更新记账凭证信息
     *
     * @param cwGlVouchers
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author huangpeng
     * @date 2019年4月1日 下午5:42:33
     * @修改日志：
     */
    @ApiOperation(value = "单个更新记账凭证信息", notes = "批量记账凭证信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParam(name = "CwGlVoucher", value = "数据表名", required = true, dataType = "List")
    @RequestMapping(value = "/updateCwGlVoucherForBookingBatch", method = RequestMethod.PUT)
    public RestfulResponse<Object, CurrencyMeta> updateCwGlVoucherForBookingBatch(@RequestBody List<CwGlVoucher> cwGlVouchers) {
        return cwGlVoucherService.updateCwGlVoucherForBookingBatch(cwGlVouchers);
    }

    /**
     * 功能描述 批量记账凭证信息
     *
     * @param cwGlVouchers
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author huangpeng
     * @date 2019年12月25日 上午9:51:59
     * 修改日志:
     */
    @ApiOperation(value = "批量记账凭证信息", notes = "批量记账凭证信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParam(name = "CwGlVoucher", value = "数据表名", required = true, dataType = "List")
    @RequestMapping(value = "/updateCwGlVoucherByChargeForBatch", method = RequestMethod.PUT)
    public RestfulResponse<Object, CurrencyMeta> updateCwGlVoucherByChargeForBatch(@RequestBody List<CwGlVoucher> cwGlVouchers) {
        RestfulResponse<Object, CurrencyMeta> res = null;
        RestfulResponse<Object, CurrencyMeta> res2 = null;
        int flag = 0;
        try {
            for (int i = 0; i <= cwGlVouchers.size() / SIZE && i * SIZE < cwGlVouchers.size(); i++) {
                flag = i;
                List<CwGlVoucher> subList = new ArrayList<>();
                if (SIZE * (1 + i) < cwGlVouchers.size()) {
                    subList = cwGlVouchers.subList(i * SIZE, SIZE * (1 + i));
                } else {
                    subList = cwGlVouchers.subList(i * SIZE, cwGlVouchers.size());
                }
                res = cwGlVoucherService.updateCwGlVoucherByChargeForBatch(subList);
                if (SysConstants.CODE.FAIL == res.getCode().intValue()) {
                    break;
                }
            }
        } catch (Exception e) {
            return new RestfulResponse<Object, CurrencyMeta>(SysConstants.CODE.FAIL, SysConstants.DEFAULT_MESSAGE.OPERATION_SUCCESS);
        } finally {
            if (res != null && !(SysConstants.CODE.FAIL == res.getCode().intValue() && flag < 1)) {
                res2 = cwGlVoucherService.refreshBalance(cwGlVouchers);
            }
        }
        if (SysConstants.CODE.FAIL == res.getCode().intValue()) {
            return res;
        } else {
            return res2;
        }
    }

    /**
     * 单个反记账凭证信息
     *
     * @param cwGlVouchers
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author huangpeng
     * @date 2019年4月5日 上午9:48:32
     * @修改日志：
     */
    @ApiOperation(value = "单个反记账凭证信息", notes = "单个反记账凭证信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParam(name = "CwGlVoucher", value = "数据表名", required = true, dataType = "List")
    @RequestMapping(value = "/updateCwGlVoucherForReverseBooking", method = RequestMethod.PUT)
    public RestfulResponse<Object, CurrencyMeta> updateCwGlVoucherForReverseBooking(@RequestBody List<CwGlVoucher> cwGlVouchers) {
        return cwGlVoucherService.updateCwGlVoucherForReverseBooking(cwGlVouchers);
    }

    /**
     * 功能描述 批量反记账凭证信息
     *
     * @param cwGlVouchers
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author huangpeng
     * @date 2019年12月27日 上午9:34:07
     * 修改日志:
     */
    @ApiOperation(value = "批量反记账凭证信息", notes = "批量反记账凭证信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParam(name = "CwGlVoucher", value = "数据表名", required = true, dataType = "List")
    @RequestMapping(value = "/updateCwGlVoucherForReverseBookingToBatch", method = RequestMethod.PUT)
    public RestfulResponse<Object, CurrencyMeta> updateCwGlVoucherForReverseBookingToBatch(@RequestBody List<CwGlVoucher> cwGlVouchers) {

        RestfulResponse<Object, CurrencyMeta> res = null;
        RestfulResponse<Object, CurrencyMeta> res2 = null;
        int flag = 0;
        try {
            for (int i = 0; i <= cwGlVouchers.size() / SIZE && i * SIZE < cwGlVouchers.size(); i++) {
                flag = i;
                List<CwGlVoucher> subList = new ArrayList<>();
                if (SIZE * (1 + i) < cwGlVouchers.size()) {
                    subList = cwGlVouchers.subList(i * SIZE, SIZE * (1 + i));
                } else {
                    subList = cwGlVouchers.subList(i * SIZE, cwGlVouchers.size());
                }
                res = cwGlVoucherService.updateCwGlVoucherForReverseBookingToBatch(subList);
                if (SysConstants.CODE.FAIL == res.getCode().intValue()) {
                    break;
                }
            }
        } catch (Exception e) {
            return new RestfulResponse<Object, CurrencyMeta>(SysConstants.CODE.FAIL, SysConstants.DEFAULT_MESSAGE.OPERATION_SUCCESS);
        } finally {
            if (res != null && !(SysConstants.CODE.FAIL == res.getCode().intValue() && flag < 1)) {
                res2 = cwGlVoucherService.refreshBalance(cwGlVouchers);
            }
        }
        if (SysConstants.CODE.FAIL == res.getCode().intValue()) {
            return res;
        } else {
            return res2;
        }
    }

    /**
     * 查询审议列表数据兼模糊查询
     *
     * @param vouchernoLike
     * @param pageNum
     * @param pageSize
     * @param navigatePages
     * @return RestfulResponse<PageInfo < CwGlVoucher>,CurrencyMeta>
     * @author huangpeng
     * @date 2019年4月1日 下午4:55:33
     * @修改日志：
     */
    @ApiOperation(value = "获取审核列表信息", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cwGlVoucherAndLike", value = "凭证信息筛选实体类", required = false, dataType = "CwGlVoucherAndLike"),
            @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")
    })
    @RequestMapping(value = {"/searchCwGlVoucherForAudit"}, method = RequestMethod.PUT, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<PageInfo<CwGlVoucherAndName>, CurrencyMeta> searchCwGlVoucherForAudit(
            @RequestParam("pageNum") int pageNum,
            @RequestParam("pageSize") int pageSize,
            @RequestParam("navigatePages") int navigatePages,
            @RequestBody CwGlVoucherAndLike cwGlVoucherAndLike) {
        return cwGlVoucherService.searchCwGlVoucherForAudit(pageNum, pageSize, navigatePages, cwGlVoucherAndLike);
    }

    /**
     * 查询记账列表数据兼模糊查询
     *
     * @param vouchernoLike
     * @param pageNum
     * @param pageSize
     * @param navigatePages
     * @return RestfulResponse<PageInfo < CwGlVoucher>,CurrencyMeta>
     * @author huangpeng
     * @date 2019年4月1日 下午5:35:23
     * @修改日志：
     */
    @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 = "cwGlVoucherAndLike", value = "凭证信息筛选实体类", required = false, dataType = "CwGlVoucherAndLike")
    })
    @RequestMapping(value = {"/searchCwGlVoucherForBooking"}, method = RequestMethod.PUT, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<PageInfo<CwGlVoucherAndName>, CurrencyMeta> searchCwGlVoucherForBooking(
            @RequestParam("pageNum") int pageNum,
            @RequestParam("pageSize") int pageSize,
            @RequestParam("navigatePages") int navigatePages, @RequestBody CwGlVoucherAndLike cwGlVoucherAndLike) {
        return cwGlVoucherService.searchCwGlVoucherForBooking(pageNum, pageSize, navigatePages, cwGlVoucherAndLike);
    }

    /**
     * 功能描述：批量删除凭证信息（制单）
     *
     * @param cwGlVoucherList
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author dml
     * @date 2019年4月8日 上午11:15:11
     * @修改日志：
     */
    @ApiOperation(value = "批量删除凭证信息（制单）", notes = "批量删除凭证信息（制单）", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParam(name = "cwGlVoucherList", required = true, dataType = "List")
    @RequestMapping(value = "/deleteOrderMakingBatch", method = RequestMethod.PUT)
    public RestfulResponse<Object, CurrencyMeta> deleteOrderMakingBatch(@RequestBody List<CwGlVoucher> cwGlVoucherList) {
        return cwGlVoucherService.deleteOrderMakingBatch(cwGlVoucherList);
    }

    /**
     * 功能描述 获取反记账信息列表
     *
     * @param pageNum
     * @param pageSize
     * @param navigatePages
     * @param cwGlVoucherAndLike
     * @return RestfulResponse<PageInfo < CwGlVoucherAndName>,CurrencyMeta>
     * @author huangpeng
     * @date 2019年10月15日 下午4:23:19
     * 修改日志:
     */
    @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 = "cwGlVoucherAndLike", value = "凭证信息筛选实体类", required = false, dataType = "CwGlVoucherAndLike")
    })
    @RequestMapping(value = {"/searchCwGlVoucherForRerverseBooking"}, method = RequestMethod.PUT, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<PageInfo<CwGlVoucherAndName>, CurrencyMeta> searchCwGlVoucherForRerverseBooking(
            @RequestParam("pageNum") int pageNum,
            @RequestParam("pageSize") int pageSize,
            @RequestParam("navigatePages") int navigatePages,
            @RequestBody CwGlVoucherAndLike cwGlVoucherAndLike) {
        return cwGlVoucherService.searchCwGlVoucherForRerverseBooking(pageNum, pageSize, navigatePages, cwGlVoucherAndLike);
    }

    /**
     * 功能描述：查询制单详情
     *
     * @param pkVoucher
     * @return RestfulResponse<CwGlVoucherWeb, CurrencyMeta>
     * @author dml
     * @date 2019年4月15日 下午1:48:08
     * @修改日志：
     */
    @ApiOperation(value = "查询制单详情", notes = "查询制单详情", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pkVoucher", value = "凭证主键", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "useState", value = "使用状态", required = true, dataType = "String", paramType = "query")
    })
    @RequestMapping(value = {"/selectOrderMakingDetil"}, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<CwGlVoucherWeb, CurrencyMeta> selectOrderMakingDetil(
            @RequestParam(value = "pkVoucher", required = true) String pkVoucher, @RequestParam(value = "useState", required = true) String useState) {
        return cwGlVoucherService.selectOrderMakingDetil(pkVoucher, useState);
    }

    /**
     * 功能描述：查询制单详情
     *
     * @param pkVoucher
     * @return RestfulResponse<CwGlVoucherWeb, CurrencyMeta>
     * @author dml
     * @date 2019年4月15日 下午1:48:08
     * @修改日志：
     */
    @ApiOperation(value = "打印查询制单详情", notes = "打印查询制单详情", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pkVoucher", value = "凭证主键", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "useState", value = "使用状态", required = true, dataType = "String", paramType = "query")
    })
    @RequestMapping(value = {"/selectOrderMakingPrint"}, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<CwGlVoucherWeb, CurrencyMeta> selectOrderMakingPrint(
            @RequestParam(value = "pkVoucher", required = true) String pkVoucher, @RequestParam(value = "useState", required = true) String useState) {
        return cwGlVoucherService.selectOrderMakingPrint(pkVoucher, useState);
    }

    /**
     * 功能描述：修改制单详情
     *
     * @param cwGlVoucherWeb
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author dml
     * @date 2019年4月15日 下午8:29:26
     * @修改日志：
     */
    @ApiOperation(value = "修改制单详情信息-传递复杂对象", notes = "修改制单详情信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParam(name = "cwGlVoucherWeb", value = "制单信息Web对象实体", required = true, dataType = "CwGlVoucherWeb")
    @RequestMapping(value = "/updateOrderMakingDetil", method = RequestMethod.PUT)
    public RestfulResponse<Object, CurrencyMeta> updateOrderMakingDetil(@RequestBody CwGlVoucherWeb cwGlVoucherWeb) {
        log.info(cwGlVoucherWeb.toString());
        return cwGlVoucherService.updateOrderMakingDetil(cwGlVoucherWeb);
    }

    /**
     * 查询结转凭证接口
     *
     * @param nameLike
     * @param pkAccperiodLike
     * @return RestfulResponse<PageInfo < CwGlVoucherAndName>,CurrencyMeta>
     * @author huangpeng
     * @date 2019年6月5日 下午3:14:14
     * @修改日志：
     */
    @ApiOperation(value = "查询结转凭证接口", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pkGlorgbook", value = "账套", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "period", value = "期间", required = true, dataType = "String", paramType = "query")
    })
    @RequestMapping(value = {"/searchCwGlVoucherForTransfer"}, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<List<CwGlVoucherWeb>, CurrencyMeta> searchCwGlVoucherForTransfer(
            @RequestParam(value = "pkGlorgbook") String pkGlorgbook,
            @RequestParam(value = "period") String period) {
        return cwGlVoucherService.searchCwGlVoucherForTransfer(pkGlorgbook, period);
    }

    /**
     * 功能描述：恢复已删除的凭证信息
     *
     * @param cwGlVoucherList
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author dml
     * @date 2019年6月14日 下午1:54:56
     * @修改日志：
     */
    @ApiOperation(value = "恢复已删除的凭证信息", notes = "恢复已删除的凭证信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParam(name = "cwGlVoucherList", required = true, dataType = "List")
    @RequestMapping(value = "/reverseVoucher", method = RequestMethod.PUT)
    public RestfulResponse<Object, CurrencyMeta> reverseVoucher(@RequestBody List<CwGlVoucher> cwGlVoucherList) {
        return cwGlVoucherService.reverseVoucher(cwGlVoucherList);
    }

    /**
     * 功能描述
     *
     * @return RestfulResponse<String, CurrencyMeta>
     * @author huangpeng
     * @date 2019年7月5日 上午9:54:07
     * 修改日志
     */
    @ApiOperation(value = "查询凭证数量", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "useState", value = "使用状态", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "vouchertype", value = "凭证状态", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "falg", value = "标记", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "pkGlorgbook", value = "账套", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "period", value = "期间", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "fqmc", value = "分期名称", required = false, dataType = "String", paramType = "query")
    })
    @RequestMapping(value = {"/searchCwGlVoucherCount"}, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<Object, CurrencyMeta> searchCwGlVoucherCount(
            @RequestParam(value = "useState") String useState,
            @RequestParam(value = "vouchertype", required = false) String vouchertype,
            @RequestParam(value = "falg", required = false) String falg,
            @RequestParam(value = "pkGlorgbook", required = false) String pkGlorgbook,
            @RequestParam(value = "period", required = false) String period,
            @RequestParam(value = "fqmc", required = false) String fqmc) {
        return cwGlVoucherService.searchCwGlVoucherCount(useState, vouchertype, falg, pkGlorgbook, period, fqmc);
    }

    /**
     * 功能描述    根据流水号查询凭证信息
     *
     * @param serialNo
     * @return RestfulResponse<List < CwGlVoucherAndName>,CurrencyMeta>
     * @author huangpeng
     * @date 2019年7月18日 下午2:25:17
     * 修改日志
     */
    @ApiOperation(value = "根据流水号查询凭证信息", notes = "根据流水号查询凭证信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "serialNoList", value = "流水号List", required = true, dataType = "List"),
            @ApiImplicitParam(name = "tradeCode", value = "交易码", required = false, dataType = "String", paramType = "query"),
    })
    @RequestMapping(value = "/searchVoucherDetailForSerialNo", method = RequestMethod.PUT)
    public RestfulResponse<Object, CurrencyMeta> searchVoucherDetailForSerialNo(
            @RequestBody List<String> serialNoList,
            @RequestParam(value = "tradeCode", required = false) String tradeCode) {
        return cwGlVoucherService.searchVoucherDetailForSerialNo(serialNoList, tradeCode);
    }

    /**
     * 功能描述    查看贷方合计总和和借放合计总和
     *
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author lipeng
     * @date 2019年7月26日 下午1:25:17
     * 修改日志
     */
    @ApiOperation(value = "制单下查看贷方合计总和和借放合计总和", notes = "制单下查看贷方合计总和和借放合计总和", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cwGlVoucherAndLike", value = "凭证信息筛选实体类", required = false, dataType = "CwGlVoucherAndLike")
    })
    @RequestMapping(value = "/searchDebitANdCredit", method = RequestMethod.PUT, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<Object, CurrencyMeta> searchDebitANdCredit(
            @RequestBody CwGlVoucherAndLike cwGlVoucherAndLike) {
        return cwGlVoucherService.searchDebitANdCredit(cwGlVoucherAndLike);
    }

    /**
     * 功能描述    审核下查看贷方合计总和和借放合计总和
     *
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author xxx
     * @date 2019年7月29日 下午1:25:17
     * 修改日志
     */
    @ApiOperation(value = " 审核下查看贷方合计总和和借放合计总和", notes = " 审核下查看贷方合计总和和借放合计总和", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cwGlVoucherAndLike", value = "凭证信息筛选实体类", required = false, dataType = "CwGlVoucherAndLike")
    })
    @RequestMapping(value = "/sumDebitANdCredit", method = RequestMethod.PUT, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<Object, CurrencyMeta> sumDebitANdCredit(
            @RequestBody CwGlVoucherAndLike cwGlVoucherAndLike) {
        return cwGlVoucherService.sumDebitANdCredit(cwGlVoucherAndLike);
    }

    /**
     * 功能描述    记账下查看贷方合计总和和借放合计总和
     *
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author xxx
     * @date 2019年7月29日 下午1:25:17
     * 修改日志
     */
    @ApiOperation(value = " 记账下查看贷方合计总和和借放合计总和", notes = " 记账下查看贷方合计总和和借放合计总和", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cwGlVoucherAndLike", value = "凭证信息筛选实体类", required = false, dataType = "CwGlVoucherAndLike")
    })
    @RequestMapping(value = "/sumDebitANdCreditByLike", method = RequestMethod.PUT, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<Object, CurrencyMeta> sumDebitANdCreditByLike(
            @RequestBody CwGlVoucherAndLike cwGlVoucherAndLike) {
        return cwGlVoucherService.sumDebitANdCreditByLike(cwGlVoucherAndLike);
    }

    /**
     * Title: selectCwGlDetailInfoByPkVoucher <br/>
     * Description: TODO根据凭证主键查询凭证分录信息 <br/>
     *
     * @param PkVoucher
     * @return RestfulResponse<List < CwBdVouchtempB>,CurrencyMeta>
     * @author lipeng
     * @date 2019年8月1日 下午3:35:40
     */
    @ApiOperation(value = "根据凭证主键查询凭证分录信息", notes = "根据凭证主键查询凭证分录信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParam(name = "PkVoucher", value = "凭证主键", required = false, dataType = "String", paramType = "query")
    @RequestMapping(value = "/selectCwGlDetailInfoByPkVoucher", method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<List<CwGlDetail>, CurrencyMeta> selectCwGlDetailInfoByPkVoucher(
            @RequestParam(value = "PkVoucher", required = false) String PkVoucher) {
        return cwGlVoucherService.selectCwGlDetailInfoByPkVoucher(PkVoucher);
    }

    /**
     * 功能描述
     *
     * @param batchNo
     * @return RestfulResponse<Object, CurrencyMeta>
     * @author huangpeng
     * @date 2019年12月17日 上午9:13:45
     * 修改日志:
     */
    @ApiOperation(value = "查询凭证号的接口，费用报销使用", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "batchNo", value = "批次号", required = true, dataType = "String", paramType = "query"),
    })
    @RequestMapping(value = "/searchVoucherNoByBatchno", method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<Object, CurrencyMeta> searchVoucherNoByBatchno(
            @RequestParam("batchNo") String batchNo) {
        return cwGlVoucherService.searchVoucherNoByBatchno(batchNo);
    }

    /**
     * @param [cwGlVoucherRequests]
     * @return com.dhcc.common.model.response.RestfulResponse<java.lang.Object, com.dhcc.common.model.CurrencyMeta>
     * @description: 费用报销代垫凭证推送NC系统
     * @author liuxianjv
     * @date 2020-05-20 14:24
     */
    @ApiOperation(value = "费用报销代垫凭证推送NC系统", notes = "费用报销代垫凭证推送NC系统", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParam(name = "cwGlVoucherRequests", value = "推送参数", required = true, dataType = "List")
    @RequestMapping(value = "/pushVoucherToNC", method = RequestMethod.POST)
    public RestfulResponse<Object, CurrencyMeta> pushVoucherToNC(@RequestBody List<CwGlVoucherRequest> cwGlVoucherRequests) {
        return cwGlVoucherService.pushVoucherToNC(cwGlVoucherRequests);
    }
    
    @ApiOperation(value = "根据子项目编号和制单日期查询凭证详情（每日计提）", notes = "根据子项目编号和制单日期查询凭证详情", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "xtzxmbh", value = "信托子项目编号", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "dateTime", value = "制单日期", required = false, dataType = "String", paramType = "query"),
    })
    @RequestMapping(value = "/searchVoucherDetailForXtzxmbh", method = RequestMethod.PUT, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<Object, CurrencyMeta> searchVoucherDetailForXtzxmbh(
    		@RequestParam(value = "xtzxmbh", required = false) String xtzxmbh,
            @RequestParam(value = "dateTime", required = false) String dateTime) {
        return cwGlVoucherService.searchVoucherDetailForXtzxmbh(xtzxmbh, dateTime);
    }
}
