package com.dxhy.extend.controller;

import com.dxhy.api.model.config.Tax;
import com.dxhy.common.aspect.SysLog;
import com.dxhy.common.constant.CommonConstants;
import com.dxhy.common.controller.AbstractController;
import com.dxhy.common.util.StringHelper;
import com.dxhy.common.util.UserInfoUtil;
import com.dxhy.common.utils.DateUtils;
import com.dxhy.common.utils.R;
import com.dxhy.extend.service.bb.*;
import com.dxhy.extend.service.invoicelog.ExtInvoiceLogService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * 发票综合查询入口
 *
 * @author kangzq
 * @date 2019年5月13日
 * @version 1.0
 */

@SuppressWarnings("AlibabaUndefineMagicConstant")
@RestController
@Slf4j
public class ExtFpzhcxController extends AbstractController {

    /**
     * 发票综合查询
     */
    @Resource
    private ExtFpzhcxService fpzhcxService;

    /**
     * 逾期发票查询
     */
    @Resource
    private ExtYqfpcxService yqfpcxService;

    /**
     * 异常发票查询
     */
    @Resource
    private ExtYcfpcxService ycfpcxService;

    /**
     * 异常发票报表
     */
    @Resource
    private ExtYcfpbbcxService ycfpbbcxService;

    /**
     * 认证日报
     */
    @Resource
    private ExtRzrbcxService rzrbcxService;
    /**
     * 进项税额
     */
    @Resource
    private ExtJxsebbcxService jxsebbcxService;
    /**
     * 进项税额明细
     */
    @Resource
    private ExtJxsemxbbcxService jxsemxbbcxService;

    @Resource
    private ExtInvoiceLogService extInvoiceLogService;
    @Resource
    private ViolationLogService violationLogService;

    @Resource
    private ExtFpmxcxService fpmxcxService;

    /**
     * 发票综合查询编辑
     */
    @Resource
    private ExtFpzhbjService fpzhbjService;


    /**
     * 报表发票综合查询
     *
     * @param pramsMap
     *            入参
     * @return 返回
     */
    @RequestMapping("/bb/fpzhcx")
    @ResponseBody
    @SysLog("发票综合查询列表查询")
    public Object listFpzhcx(@RequestBody Map<String, Object> pramsMap) {

        pramsMap.put("business", getUserInfo().getBusiness());
        pramsMap.put("dbName", getUserInfo().getDbName());

        List<String> gfshList = new ArrayList<>();
        if (!"99".equals(pramsMap.get("gfsh")) && pramsMap.get("gfsh") != null && !"".equals(pramsMap.get("gfsh"))) {
            gfshList.add(pramsMap.get("gfsh").toString());
        } else {
            gfshList = UserInfoUtil.getGfshAll(getUserInfo().getOrg());
            if (gfshList.size() == 0) {
                return ResponseEntity.ok(R.ok().put("data", ""));
            }
        }
        pramsMap.put("gfsh", gfshList);

        if (pramsMap.get("kpksrq") != null && !"".equals(pramsMap.get("kpksrq"))) {
            pramsMap.put("kpksrq", DateUtils.getMorning(DateUtils.strToDate(pramsMap.get("kpksrq").toString())));
        }

        if (pramsMap.get("kpjsrq") != null && !"".equals(pramsMap.get("kpjsrq"))) {
            pramsMap.put("kpjsrq", DateUtils.getNight(DateUtils.strToDate(pramsMap.get("kpjsrq").toString())));
        }

        if (pramsMap.get("skssq") != null && !"".equals(pramsMap.get("skssq")) && !"1".equals(pramsMap.get("rzzt"))
            && !"2".equals(pramsMap.get("rzzt")) && !"3".equals(pramsMap.get("rzzt"))) {
            pramsMap.put("skssq", "");
        }
        List<String> l = Arrays.asList("1", "2", "3");
        if (pramsMap.get("rzksrq") != null && !"".equals(pramsMap.get("rzksrq"))
            && l.contains(pramsMap.get("rzzt").toString())) {
            pramsMap.put("rzksrq", DateUtils.getMorning(DateUtils.strToDate(pramsMap.get("rzksrq").toString())));
        } else {
            pramsMap.put("rzksrq", "");
        }
        if (pramsMap.get("rzjsrq") != null && !"".equals(pramsMap.get("rzjsrq"))
            && l.contains(pramsMap.get("rzzt").toString())) {
            pramsMap.put("rzjsrq", DateUtils.getNight(DateUtils.strToDate(pramsMap.get("rzjsrq").toString())));
        } else {
            pramsMap.put("rzjsrq", "");
        }

        if (pramsMap.get("qsksrq") != null && !"".equals(pramsMap.get("qsksrq")) && "1".equals(pramsMap.get("qszt"))) {
            pramsMap.put("qsksrq", DateUtils.getMorning(DateUtils.strToDate(pramsMap.get("qsksrq").toString())));
        } else {
            pramsMap.put("qsksrq", "");
        }
        if (pramsMap.get("qsjsrq") != null && !"".equals(pramsMap.get("qsjsrq")) && "1".equals(pramsMap.get("qszt"))) {
            pramsMap.put("qsjsrq", DateUtils.getNight(DateUtils.strToDate(pramsMap.get("qsjsrq").toString())));
        } else {
            pramsMap.put("qsjsrq", "");
        }
        if (!"1".equals(pramsMap.get("qszt"))) {
            pramsMap.put("businessCode", null);
        } else {
            if ("99".equals(pramsMap.get("qszt"))) {
                pramsMap.put("businessCode", null);
            }
        }

        String invoiceNo = pramsMap.get("invoiceNo").toString();
        if (!StringHelper.isBlank(invoiceNo)) {
            if(invoiceNo.length()==8){
                pramsMap.put("invoiceNo", invoiceNo);
            }else {
                pramsMap.put("eleInvoiceNo", invoiceNo);
                pramsMap.put("invoiceNo", "");
            }
        }

        /*//特定要素代码
        //tdyslxDm直接用
        if(StringUtils.isNotBlank(pramsMap.get("tdyslxDm").toString())&&"99".equals(pramsMap.get("tdyslxDm").toString())){
            pramsMap.put("tdyslxDm", "");
        }

        //fprzAuthStatus 局端入账状态   未入账0 已入账1
        if(StringUtils.isNotBlank(pramsMap.get("fprzAuthStatus").toString())&&"99".equals(pramsMap.get("fprzAuthStatus").toString())){
            pramsMap.put("fprzAuthStatus", "");
        }*/

        //入账属期
        if(ObjectUtils.isNotEmpty(pramsMap.get("fprzsq"))){
            pramsMap.put("fprzsq", pramsMap.get("fprzsq").toString().replace("-", ""));
        }

        int curr = (int)pramsMap.get("curr");

        int size = (int)pramsMap.get("size");
        try {
            return ResponseEntity.ok(R.ok().put("data", fpzhcxService.selectByPramsMap(pramsMap, curr, size)));
        } catch (Exception e) {
           log.info("业务处理异常：{}", e);
            log.error("", e);
            return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
        }

    }

    /**
     * 报表异常发票查询
     *
     * @param pramsMap
     *            查询条件
     * @return 返回
     */
    @RequestMapping("/bb/ycfpcx")
    @ResponseBody
    @SysLog("异常发票查询")
    public Object listYcFpxx(@RequestBody Map<String, Object> pramsMap) {

        Map<String, Object> data = new HashMap<>(16);
        data.put("dbName", getUserInfo().getDbName());
        data.put("business", getUserInfo().getBusiness());
        List<String> gfshList = new ArrayList<>();
        if (!"99".equals(pramsMap.get("gfsh")) && pramsMap.get("gfsh") != null && !"".equals(pramsMap.get("gfsh"))) {
            gfshList.add(pramsMap.get("gfsh").toString());
        } else {
            gfshList = UserInfoUtil.getGfshAll(getUserInfo().getOrg());
            if (gfshList.size() == 0) {
                return ResponseEntity.ok(R.ok().put("data", ""));
            }
        }
        data.put("gfsh", gfshList);
        if (pramsMap.get("yczt") != null && !"".equals(pramsMap.get("yczt")) && !"99".equals(pramsMap.get("yczt"))) {
            data.put("yczt", pramsMap.get("yczt"));
        }
        data.put("businessCode", "99");
        if (pramsMap.get("qszt") != null && !"".equals(pramsMap.get("qszt")) && !"99".equals(pramsMap.get("qszt"))) {
            data.put("qszt", pramsMap.get("qszt"));
            if ("1".equals(pramsMap.get("qszt"))) {
                data.put("businessCode", pramsMap.get("businessCode"));
            }
        }
        if (pramsMap.get("rzzt") != null && !"".equals(pramsMap.get("rzzt")) && !"99".equals(pramsMap.get("rzzt"))) {
            data.put("rzzt", pramsMap.get("rzzt"));
        }

        if (pramsMap.get("kpksrq") != null && !"".equals(pramsMap.get("kpksrq"))) {
            data.put("kpksrq", DateUtils.getMorning(DateUtils.strToDate(pramsMap.get("kpksrq").toString())));
        } else {
            return ResponseEntity.ok(R.error("开票开始日期不能为空！"));
        }
        if (pramsMap.get("kpjsrq") != null && !"".equals(pramsMap.get("kpjsrq"))) {
            data.put("kpjsrq", DateUtils.getNight(DateUtils.strToDate(pramsMap.get("kpjsrq").toString())));
        } else {
            return ResponseEntity.ok(R.error("开票结束日期不能为空！"));
        }

        if (pramsMap.get("rzksrq") != null && !"".equals(pramsMap.get("rzksrq")) && "1".equals(pramsMap.get("rzzt"))) {
            data.put("rzksrq", DateUtils.getMorning(DateUtils.strToDate(pramsMap.get("rzksrq").toString())));
        }
        if (pramsMap.get("rzjsrq") != null && !"".equals(pramsMap.get("rzjsrq")) && "1".equals(pramsMap.get("rzzt"))) {
            data.put("rzjsrq", DateUtils.getNight(DateUtils.strToDate(pramsMap.get("rzjsrq").toString())));
        }
        String invoiceNo = pramsMap.get("invoiceNo").toString();
        if (!StringHelper.isBlank(invoiceNo)) {
            if(invoiceNo.length()==8){
                data.put("invoiceNo", invoiceNo);
            }else {
                data.put("eleInvoiceNo", invoiceNo);
            }
        }

        data.put("xfmc", pramsMap.get("xfmc"));
        int curr = (int)pramsMap.get("curr");
        int size = (int)pramsMap.get("size");

        data.put("company", pramsMap.get("company"));
        data.put("menuId", pramsMap.get("menuId"));
        try {
            return ResponseEntity.ok(R.ok().put("data", ycfpcxService.selectByPramsMap(data, curr, size)));
        } catch (Exception e) {
           log.info("业务处理异常：{}", e);
            log.error("", e);
            return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
        }

    }

    /**
     * 报表逾期发票查询
     *
     * @param pramsMap
     *            查询条件
     * @return 返回
     */
    @RequestMapping("/bb/yqfpcx")
    @ResponseBody
    @SysLog("逾期发票报表查询")
    public Object listYqFpxx(@RequestBody Map<String, Object> pramsMap) {

        Map<String, Object> data = new HashMap<>(16);
        data.put("dbName", getUserInfo().getDbName());

        List<String> gfshList = new ArrayList<>();
        if (!"99".equals(pramsMap.get("gfsh")) && pramsMap.get("gfsh") != null && !"".equals(pramsMap.get("gfsh"))) {
            gfshList.add(pramsMap.get("gfsh").toString());
        } else {
            gfshList = UserInfoUtil.getGfshAll(getUserInfo().getOrg());
            if (gfshList.size() == 0) {
                return ResponseEntity.ok(R.ok().put("data", ""));
            }
        }
        data.put("gfsh", gfshList);
        data.put("invoiceNo", pramsMap.get("invoiceNo"));
        data.put("xfmc", pramsMap.get("xfmc"));
        int curr = (int)pramsMap.get("curr");
        int size = (int)pramsMap.get("size");
        data.put("company", pramsMap.get("company"));
        data.put("menuId", pramsMap.get("menuId"));

        try {
            return ResponseEntity.ok(R.ok().put("data", yqfpcxService.selectByPramsMap(data, curr, size)));
        } catch (Exception e) {
           log.info("业务处理异常：{}", e);
            log.error("", e);
            return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
        }

    }

    /**
     * 异常发票报表查询
     *
     * @param pramsMap
     *            查询条件
     * @return 返回
     */
    @RequestMapping("/bb/ycfpbbcx")
    @ResponseBody
    @SysLog("异常发票报表查询")
    public Object listYcBbFpxx(@RequestBody Map<String, Object> pramsMap) {

        Map<String, Object> data = new HashMap<>(16);
        data.put("dbName", getUserInfo().getDbName());
        List<String> gfshList = new ArrayList<>();
        if (!"99".equals(pramsMap.get("gfsh")) && pramsMap.get("gfsh") != null && !"".equals(pramsMap.get("gfsh"))) {
            gfshList.add(pramsMap.get("gfsh").toString());
        } else {
            gfshList = UserInfoUtil.getGfshAll(getUserInfo().getOrg());
            if (gfshList.size() == 0) {
                return ResponseEntity.ok(R.ok().put("data", ""));
            }
        }
        data.put("gfsh", gfshList);
        if (pramsMap.get("yczt") != null && !"".equals(pramsMap.get("yczt")) && !"99".equals(pramsMap.get("yczt"))) {
            data.put("yczt", pramsMap.get("yczt"));
        }

        if (pramsMap.get("kpksrq") != null && !"".equals(pramsMap.get("kpksrq"))) {
            data.put("kpksrq", DateUtils.getMorning(DateUtils.strToDate(pramsMap.get("kpksrq").toString())));
        } else {
            return ResponseEntity.ok(R.error("开票开始日期不能为空！"));
        }
        if (pramsMap.get("kpjsrq") != null && !"".equals(pramsMap.get("kpjsrq"))) {
            data.put("kpjsrq", DateUtils.getNight(DateUtils.strToDate(pramsMap.get("kpjsrq").toString())));
        } else {
            return ResponseEntity.ok(R.error("开票结束日期不能为空！"));
        }
        int curr = (int)pramsMap.get("curr");
        int size = (int)pramsMap.get("size");

        data.put("company", pramsMap.get("company"));
        data.put("menuId", pramsMap.get("menuId"));
        try {
            return ResponseEntity.ok(R.ok().put("data", ycfpbbcxService.selectByPramsMap(data, curr, size)));
        } catch (Exception e) {
           log.info("业务处理异常：{}", e);
            log.error("", e);
            return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
        }

    }

    /**
     * 进项税额报表查询
     *
     * @param pramsMap
     *            查询条件
     * @return 返回
     */
    @RequestMapping("/bb/jxsebbcx")
    @ResponseBody
    @SysLog("进项税额报表查询")
    public Object jxsebbcx(@RequestBody Map<String, Object> pramsMap) {

        Map<String, Object> data = new HashMap<>(16);
        data.put("dbName", getUserInfo().getDbName());
        String gfmc = "";
        data.put("userid", getUserId());
        if (!"99".equals(pramsMap.get("gfsh")) && pramsMap.get("gfsh") != null && !"".equals(pramsMap.get("gfsh"))) {
            data.put("gfsh", pramsMap.get("gfsh"));
            List<Tax> org = getUserInfo().getOrg();
            if (org != null && org.size() > 0) {
                for (Tax tax : org) {
                    if (tax.getTaxno().equals(pramsMap.get("gfsh"))) {
                        gfmc = tax.getTaxname();
                    }
                }
            }
            data.put("gfmc", gfmc);
        } else {
            return ResponseEntity.ok(R.error("请选择对应的购方税号！"));
        }
        if (pramsMap.get("skssq") != null && !"".equals(pramsMap.get("skssq"))) {
            data.put("skssq", pramsMap.get("skssq"));
        } else {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMM");
            data.put("skssq", dateFormat.format(new Date()));
        }

        try {
            return ResponseEntity.ok(R.ok().put("data", jxsebbcxService.selectByPramsMap(data)));
        } catch (Exception e) {
           log.info("业务处理异常：{}", e);
            log.error("", e);
            return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
        }

    }

    /**
     * 进项税额明细报表查询
     *
     * @param pramsMap
     *            查询条件
     * @return 返回
     */
    @RequestMapping("/bb/jxsemxbbcx")
    @ResponseBody
    @SysLog("进项税额明细报表查询")
    public Object jxsemxbbcx(@RequestBody Map<String, Object> pramsMap) {

        Map<String, Object> data = new HashMap<>(16);
        data.put("dbName", getUserInfo().getDbName());

        data.put("userid", getUserId());
        List<String> gfshList = new ArrayList<>();
        if (!"99".equals(pramsMap.get("gfsh")) && pramsMap.get("gfsh") != null && !"".equals(pramsMap.get("gfsh"))) {
            gfshList.add(pramsMap.get("gfsh").toString());
        } else {
            gfshList = UserInfoUtil.getGfshAll(getUserInfo().getOrg());
            if (gfshList.size() == 0) {
                return ResponseEntity.ok(R.ok().put("data", ""));
            }
        }
        data.put("gfsh", gfshList);
        if (pramsMap.get("skssq") != null && !"".equals(pramsMap.get("skssq"))) {
            data.put("skssq", pramsMap.get("skssq"));
        } else {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMM");
            data.put("skssq", dateFormat.format(new Date()));
        }

        try {
            return ResponseEntity.ok(R.ok().put("data", jxsemxbbcxService.selectByPramsMap(data)));
        } catch (Exception e) {
           log.info("业务处理异常：{}", e);
            log.error("", e);
            return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
        }

    }

    /**
     * 认证日报报表查询
     *
     * @param pramsMap
     *            查询条件
     * @return 返回
     */
    @RequestMapping("/bb/rzrbcx")
    @ResponseBody
    @SysLog("认证日报报表查询")
    public Object rzrbcx(@RequestBody Map<String, Object> pramsMap) {

        Map<String, Object> data = new HashMap<>(16);
        data.put("dbName", getUserInfo().getDbName());
        String gfmc = "";
        if (!"99".equals(pramsMap.get("gfsh")) && pramsMap.get("gfsh") != null && !"".equals(pramsMap.get("gfsh"))) {
            data.put("gfsh", pramsMap.get("gfsh"));
            List<Tax> org = getUserInfo().getOrg();
            if (org != null && org.size() > 0) {
                for (Tax tax : org) {
                    if (tax.getTaxno().equals(pramsMap.get("gfsh"))) {
                        gfmc = tax.getTaxname();
                    }
                }
            }
            data.put("gfmc", gfmc);
        } else {
            return ResponseEntity.ok(R.error("请选择对应的购方税号！"));
        }
        if (pramsMap.get("skssq") != null && !"".equals(pramsMap.get("skssq"))) {
            data.put("skssq", pramsMap.get("skssq"));
        } else {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMM");
            data.put("skssq", dateFormat.format(new Date()));
        }
        int curr = (int)pramsMap.get("curr");
        int size = (int)pramsMap.get("size");
        data.put("company", pramsMap.get("company"));
        data.put("menuId", pramsMap.get("menuId"));
        data.put("dklx", pramsMap.get("dklx"));

        try {
            return ResponseEntity.ok(R.ok().put("data", rzrbcxService.selectByPramsMap(data, curr, size)));
        } catch (Exception e) {
           log.info("业务处理异常：{}", e);
            log.error("", e);
            return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
        }

    }

    @RequestMapping("/bb/getInvoiceLog")
    @ResponseBody
    @SysLog("发票操作记录查询")
    public Object getInvoiceLog(@RequestBody Map<String, String> params) {
        try {
            return ResponseEntity.ok(R.ok().put("data", extInvoiceLogService.getInvoiceLog(params)));
        } catch (Exception e) {
           log.info("业务处理异常：{}", e);
            log.error("", e);
            return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
        }
    }

    @RequestMapping("/violation/list")
    @SysLog("违规信息查询")
    public Object getViolationLog(@RequestBody Map<String, Object> params) {
        try {
            params.put("dbName", getUserInfo().getDbName());
            int curr = (int)params.get("curr");
            int size = (int)params.get("size");
            return ResponseEntity.ok(R.ok().put("data", violationLogService.selectByPramsMap(params, curr, size)));
        } catch (Exception e) {
           log.info("业务处理异常：{}", e);
            log.error("", e);
            return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
        }
    }

    /**
     *  发票明细查询
     * @param pramsMap
     * @return 返回
     */
    @RequestMapping("/bb/fpmx")
    @ResponseBody
    @SysLog("发票明细查询")
    public Object listFpmx(@RequestBody Map<String, Object> pramsMap) {

        pramsMap.put("business", getUserInfo().getBusiness());
        pramsMap.put("dbName", getUserInfo().getDbName());

        List<String> gfshList = new ArrayList<>();
        if (!"99".equals(pramsMap.get("gfsh")) && pramsMap.get("gfsh") != null && !"".equals(pramsMap.get("gfsh"))) {
            gfshList.add(pramsMap.get("gfsh").toString());
        } else {
            gfshList = UserInfoUtil.getGfshAll(getUserInfo().getOrg());
            if (gfshList.size() == 0) {
                return ResponseEntity.ok(R.ok().put("data", ""));
            }
        }
        pramsMap.put("gfsh", gfshList);

        if (pramsMap.get("kpksrq") != null && !"".equals(pramsMap.get("kpksrq"))) {
            pramsMap.put("kpksrq", DateUtils.getMorning(DateUtils.strToDate(pramsMap.get("kpksrq").toString())));
        }

        if (pramsMap.get("kpjsrq") != null && !"".equals(pramsMap.get("kpjsrq"))) {
            pramsMap.put("kpjsrq", DateUtils.getNight(DateUtils.strToDate(pramsMap.get("kpjsrq").toString())));
        }

        String invoiceNo = pramsMap.get("invoiceNo").toString();
        if (!StringHelper.isBlank(invoiceNo)) {
            if(invoiceNo.length()==8){
                pramsMap.put("invoiceNo", invoiceNo);
            }else {
                pramsMap.put("eleInvoiceNo", invoiceNo);
                pramsMap.put("invoiceNo", "");
            }
        }

        int curr = (int) pramsMap.get("curr");
        int size = (int) pramsMap.get("size");

        try {
            return ResponseEntity.ok(R.ok().put("data", fpmxcxService.selectByPramsMap(pramsMap, curr, size)));
        } catch (Exception e) {
           log.info("业务处理异常：{}", e);
            return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
        }
    }

    @RequestMapping("/bb/editorVoucherNumber")
    @SysLog("发票综合查询发票编辑凭证号")
    @ResponseBody
    public Object refundInvoice(@RequestBody Map<String, Object> pramsMap){
        pramsMap.put("dbName",getUserInfo().getDbName());
        String uuids = (String)pramsMap.get("uuids");
        if(StringUtils.isBlank(uuids)){
            return ResponseEntity.ok(R.error("请选择需要编辑的发票信息！"));
        }
        String voucherNumber =(String) pramsMap.get("voucherNumber");
        if(StringUtils.isBlank(voucherNumber)){
            return ResponseEntity.ok(R.error("请添加凭证号信息"));
        }
        try{
            return ResponseEntity.ok(R.ok().put("data",fpzhbjService.editorVoucherNumber(pramsMap)));
        }catch (Exception e){
            log.error("",e);
            return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
        }
    }
}
