package com.muchinfo.mtp3century.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.muchinfo.mtp3century.service.ICommonService;
import com.muchinfo.mtp3century.service.IOrganSonService;
import com.muchinfo.mtp3century.utils.RedisServiceUtil;
import com.muchinfo.mtp3common.enumtype.*;
import com.muchinfo.mtp3common.utils.*;
import com.muchinfo.mtp3century.utils.AjaxResult;
import com.muchinfo.mtp3interface.mapper.*;
import com.muchinfo.mtp3pojos.entity.*;
import com.muchinfo.mtp3pojos.vo.FileMetaVo;
import com.muchinfo.mtp3pojos.vo.bankcusbank.BankCusBankExtendResult;
import com.muchinfo.mtp3pojos.vo.common.*;
import com.muchinfo.mtp3pojos.vo.organ.UserAccountRspResult;
import com.muchinfo.mtp3pojos.vo.taaccount.TaAccountQueryResult;
import com.muchinfo.mtp3pojos.vo.taaccount.TaAccountReportParam;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.ExpiredJwtException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.apache.commons.beanutils.ConvertUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

/**
 * <p>
 * 公共控制器
 * </p>
 *
 * @author XKF
 * @since 2024-05-21
 */

@RestController
@RequestMapping("/common")
@Api(value = "公共API", description = "公共方法调用")
public class CommonController {

    private final Logger log = LoggerFactory.getLogger(this.getClass());
    private static final String NONCE_KEY = "x-nonce-";
    private static final String APP_SECRET = "muchinfo@86-755-82535618";
    @Resource
    private RedisServiceUtil redisServiceUtil;
    @Resource
    private ISystemmanagerMapper iSystemmanagerMapper;
    @Resource
    private ICommonService iCommonService;
    @Resource
    private IDivisionMapper iDivisionMapper;
    @Resource
    private IUseraccountMapper iUseraccountMapper;
    @Resource
    private IArearoleMapper iArearoleMapper;
    @Resource
    private IArearolemarketMapper iArearolemarketMapper;
    @Resource
    private IOrganSonService iOrganSonService;
    @Resource
    private IRoleuserMapper iRoleuserMapper;

    @ApiOperation("验证token是否有效")
    @RequestMapping(method = RequestMethod.POST, value = "/checkToken")
    private AjaxResult checkToken(HttpServletRequest request) {
        Claims claims = null;
        Integer code = Constants.Success_Code_Design;
        String message = MessageType.MESSAGE_CODE_SYSTEM001.getCode();
        try {
            claims = JwtUtil.parseToken(request.getHeader(JwtUtil.TOKEN_HEADER).substring(JwtUtil.TOKEN_PREFIX.length()));
            // 校验token是否过期
            if (JwtUtil.isExpiration(claims)) {
                code = Constants.Token_failure_code;
                message = MessageType.MESSAGE_ERROR_CODE_SYSTEM001.getCode();
            }
        } catch (ExpiredJwtException e) {
            code = Constants.Token_failure_code;
            message = MessageType.MESSAGE_ERROR_CODE_SYSTEM001.getCode();
        }
        return AjaxResult.success(code, message, request.getHeader("Accept-Language"));
    }

    @ApiOperation("获取签名sign")
    @RequestMapping(method = RequestMethod.GET, value = "/getCheckSign")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult getSign(HttpServletRequest request) {
        String sign = EncryptionUtils.encryptSHA(CommonUtil.getIpAddress(request) + APP_SECRET + NONCE_KEY + DateTimeUtils.getSysTimestamp());
        //存入redis
        redisServiceUtil.setCacheObject(request.getHeader("Sign-Id"), sign, RedisConstants.LOGIN_CODE_TTL, TimeUnit.DAYS);
        return AjaxResult.success(Constants.Success_Code_Design, MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language"), sign);
    }

    @ApiOperation("机构下拉查询加载 会员、经纪人")
    @RequestMapping(method = RequestMethod.GET, value = "/queryOrganSelect")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<OrganSelectResult> queryOrganSelect(OrganSelectParam vo, HttpServletRequest request) {
        try {
            Systemmanager systemmanager = iSystemmanagerMapper.selectOne(new QueryWrapper<Systemmanager>().eq("LOGINCODE", iCommonService.getUserLoginCode(request)));
            vo.setAccountname(vo.getSearchcode());
            if (StringUtils.isEmpty(vo.getUsertype())) {
                vo.setUsertype("2");
            }
            if (vo.getAllUsersButPlatform() == null || vo.getAllUsersButPlatform() == 0) {
                if (SysConstants.SYS_TYPE_CLIENT.equals(systemmanager.getReletype())) {
                    //机构管理员，可以查下级
                    vo.setParentuserid(systemmanager.getAreauserid());
                    if (("," + vo.getOrgztypes() + ",").contains(",3,"))
                        vo.setPlanformanceuserid(systemmanager.getAreauserid());
                    else
                        vo.setMemberuserid(systemmanager.getAreauserid());
                } else if (SysConstants.SYS_TYPE_MEMBER.equals(systemmanager.getReletype())) {
                    //子机构
                    vo.setParentuserid(systemmanager.getAreauserid());
                }
            }
            return iCommonService.queryOrganSelect(vo, request);
        } catch (Exception e) {
            log.error("机构下拉查询加载 会员、经纪人信息失败，失败原因：" + Arrays.toString(e.getStackTrace()));
            return AjaxResult.error(Constants.Error_Code_Design, MessageType.MESSAGE_ERROR_CODE_SYSTEM002.getCode(), request.getHeader("Accept-Language"));
        }
    }

    @ApiOperation("递归查询机构，用于交 易所子机构管理中添加子机构和经纪人")
    @RequestMapping(method = RequestMethod.GET, value = "/queryExchSonOrgin")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<OrganSelectResult> queryExchSonOrgin(OrganSelectParam vo, HttpServletRequest request) {
        log.debug("vo.parentuserid={}", vo.getParentuserid());
        return iCommonService.queryExchSonOrgin(vo, request);
    }

    @ApiOperation("获取省、市、县信息")
    @RequestMapping(method = RequestMethod.GET, value = "/getProvince")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<Division> getProvince(Long autoId, String divisionLevel, HttpServletRequest request) {
        List<Division> province = iDivisionMapper.getProvince(autoId, divisionLevel);
        return AjaxResult.success(Constants.Success_Code_Design, MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language"), province);
    }

    @ApiOperation("上传图片、文件")
    @RequestMapping(method = RequestMethod.POST, value = "/uploadFile")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<FileMetaVo> uploadFile(HttpServletRequest request) {
        return iCommonService.uploadFile(request);
    }

    @ApiOperation("获取枚举信息")
    @RequestMapping(method = RequestMethod.GET, value = "/enumType")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<Enumdicitem> getEnumType(String typeCode, HttpServletRequest request) {
        return iCommonService.getEnumType(typeCode, request);
    }

    @ApiOperation("子机构开户下拉查询推荐人 / 出入金（交易商列表查询）")
    @RequestMapping(method = RequestMethod.GET, value = "/queryInvestorSelect")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<InvestorSelectResult> queryInvestorSelect(HttpServletRequest request, InvestorSelectParam investorSelectParam) {
        Systemmanager systemmanager = iSystemmanagerMapper.selectOne(new QueryWrapper<Systemmanager>().eq("LOGINCODE", iCommonService.getUserLoginCode(request)));
        investorSelectParam.setAccountStatus(4);
        if (SysConstants.SYS_TYPE_MANAGE.equals(systemmanager.getReletype())) {
            //平台管理员 可以查询所有投资者
        } else if (SysConstants.SYS_TYPE_CLIENT.equals(systemmanager.getReletype())) {
            //会员管理员，可以查下属机构投资者
            if (("," + investorSelectParam.getOrgzTypes() + ",").contains(",3,")) {
                investorSelectParam.setRolesCount(3);//营销中心
            }
            investorSelectParam.setParentUserid(systemmanager.getAreauserid());
        } else {
            investorSelectParam.setAreaIds(systemmanager.getAreauserid().toString());
        }
        return iCommonService.queryInvestorSelect(investorSelectParam, request);
    }

    @ApiOperation("获取所有签约银行信息")
    @RequestMapping(method = RequestMethod.GET, value = "/getSignBank")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<BankAccountsign> getSignBank(HttpServletRequest request) {
        return iCommonService.getSignBank(request);
    }

    @ApiOperation("查询托管银行")
    @RequestMapping(method = RequestMethod.GET, value = "/getAllBankCus")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<BankCusbankinfo> getAllBankCus(HttpServletRequest request) {
        return iCommonService.getAllBankCus(request);
    }

    @ApiOperation("查询已签约银行")
    @RequestMapping(method = RequestMethod.GET, value = "/getBankAccountSign")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<BankAccountsign> getBankAccountSign(Long accountcode, Integer signstatus, HttpServletRequest request) {
        return iCommonService.getBankAccountSign(accountcode, signstatus, request);
    }

    @ApiOperation("查询托管银行支持银行")
    @RequestMapping(method = RequestMethod.GET, value = "/getBankInfoByCusBank")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<CusBankInfoResult> getBankInfoByCusBank(String cusBankId, String bankName, HttpServletRequest request) {
        return iCommonService.getBankInfoByCusBank(cusBankId, bankName, request);
    }

    @ApiOperation("资金账户下拉框 平台查所有，经纪会员/子机构查自己及下级，其它角色查自己")
    @RequestMapping(method = RequestMethod.GET, value = "/queryTAAccountChildren")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<TAAccountChildrenResult> queryTAAccountChildren(HttpServletRequest request, String searchCode) {
        Systemmanager systemmanager = iSystemmanagerMapper.selectOne(new QueryWrapper<Systemmanager>().eq("LOGINCODE", iCommonService.getUserLoginCode(request)));
        return iCommonService.queryTAAccountChildren(searchCode, systemmanager.getAreauserid(), request);
    }

    @ApiOperation("商品查询下拉框")
    @RequestMapping(method = RequestMethod.GET, value = "/queryGoodsSelect")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<GoodsSelectResult> queryGoodsSelect(GoodsSelectParam param, HttpServletRequest request) {
        return iCommonService.queryGoodsSelect(param, request);
    }

    @ApiOperation("下拉查询商品： 平台+运营机构同时有权限的菜单中过滤商品时使用")
    @RequestMapping(method = RequestMethod.GET, value = "/queryGoodsSelectYYJG")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<GoodsSelectResult> queryGoodsSelectYYJG(GoodsSelectParam param, HttpServletRequest request) {
        Systemmanager systemmanager = iSystemmanagerMapper.selectOne(new QueryWrapper<Systemmanager>().eq("LOGINCODE", iCommonService.getUserLoginCode(request)));
        // 运营机构(2) 只查自己的权限的商品 20240322
        // 获取权限
        List<Roleuser> ur = iRoleuserMapper.selectList(new QueryWrapper<Roleuser>().eq("managerid", systemmanager.getAutoid()));
        if (CollectionUtils.isNotEmpty(ur)) {
            boolean isYYFlag = false;
            for (Roleuser role : ur) {
                if (role.getRoleid().equals(2L)) {
                    isYYFlag = true;
                    break;
                }
            }
            if (isYYFlag) {
                param.setYyareauserid(systemmanager.getAreauserid());
            }
        }
        return iCommonService.queryGoodsSelect(param, request);
    }

    @ApiOperation("获取市场下拉列表")
    @RequestMapping(method = RequestMethod.GET, value = "orderListAll")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<Market> getOrderListAll(HttpServletRequest request, String orgztypes) {
        Systemmanager systemmanager = iSystemmanagerMapper.selectOne(new QueryWrapper<Systemmanager>().eq("LOGINCODE", iCommonService.getUserLoginCode(request)));
        List<Long> markets = null;
        if (!SysConstants.SYS_TYPE_MANAGE.equals(systemmanager.getReletype())) {
            if (systemmanager.getReletype() == 2 && ("," + orgztypes + ",").contains(",3,")) {

            } else {
                String[] roletyes = {};
                //如果是子机构登陆，查找其父机构角色，查询市场
                if (SysConstants.SYS_TYPE_MEMBER.equals(systemmanager.getReletype())) {
                    Useraccount useraccount = iUseraccountMapper.selectOne(new QueryWrapper<Useraccount>().eq("userid", systemmanager.getAreauserid()));
                    String roleids = iArearoleMapper.getRolesByAreaid(useraccount.getMemberuserid());
                    roletyes = roleids.split(",");
                } else {
                    roletyes = orgztypes.split(",");
                }
                for (String role : roletyes) {
                    if (SysEnums.OrganRole.broker.getCode().equals(Integer.parseInt(role)) || SysEnums.OrganRole.selfsupport.getCode().equals(Integer.parseInt(role))) {
                        //如果是自营会员,经纪会员，自身权限的市场
                        //获取市场id，
                        Integer[] types = (Integer[]) ConvertUtils.convert(roletyes, Integer.class);
                        markets = iArearolemarketMapper.getMarketsNameByUseridAndrole(systemmanager.getAreauserid(), types);
                    }
                }
            }
        }
        return iCommonService.getOrderListAll(markets, request);
    }

    @ApiOperation("获取机构下拉列表(查询管理专用)")
    @RequestMapping(method = RequestMethod.GET, value = "organListAll")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<InvestorSelectResult> getOrganListAll(String searchCode, String orgztypes, HttpServletRequest request) {
        Systemmanager systemmanager = iSystemmanagerMapper.selectOne(new QueryWrapper<Systemmanager>().eq("LOGINCODE", iCommonService.getUserLoginCode(request)));
        Long userId = 0L;
        if (systemmanager.getReletype() != 1) {
            userId = systemmanager.getAreauserid();
        }
        // 运营机构同平台可查所有
        if (("," + orgztypes + ",").contains(",2,")) {
            userId = 0L;
        }
        return iCommonService.getOrganListAll(userId, searchCode, request);
    }

    @ApiOperation("出入金、银行签约扩展信息是否展示")
    @RequestMapping(method = RequestMethod.GET, value = "/queryBooleanForAmount")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<BankCusBankExtendResult> queryBooleanForAmount(String cusbankid, Integer extendbiztype, Integer usabletype, HttpServletRequest request) {
        return iCommonService.queryBooleanForAmount(cusbankid, extendbiztype, usabletype, request);
    }

    @ApiOperation("菜单通用信息查询")
    @RequestMapping(method = RequestMethod.GET, value = "/queryCommonFlag")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<CommonResult> queryCommonFlag(CommonParam commonParam, HttpServletRequest request) {
        return iCommonService.queryCommonFlag(commonParam, request);
    }

    @ApiOperation("获取可用金额")
    @RequestMapping(method = RequestMethod.GET, value = "/queryMoney")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult queryMoney(Long accountid, Integer type, Integer mtype, HttpServletRequest request) {
        return iCommonService.queryMoney(accountid, type, mtype, request);
    }

    @ApiOperation("子机构管理-->获取机构及所有子机构")
    @RequestMapping(method = RequestMethod.GET, value = "/getAreaAndAllChilds")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<UserAccountRspResult> getAreaAndAllChilds(HttpServletRequest request, Long areauserid) {
        return iOrganSonService.getAreaAndAllChilds(request, areauserid);
    }

    @ApiOperation("子机构管理-->获取机构及所有子机构")
    @RequestMapping(method = RequestMethod.GET, value = "/queryOrganSelect2And3")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<OrganSelectResult> queryOrganSelect2And3(OrganSelectParam param, HttpServletRequest request) {
        Systemmanager systemmanager = iSystemmanagerMapper.selectOne(new QueryWrapper<Systemmanager>().eq("LOGINCODE", iCommonService.getUserLoginCode(request)));
        if (systemmanager.getReletype() != 1) {
            param.setUserid(systemmanager.getAreauserid());
        }
        // 运营机构同平台可查所有
        if (("," + param.getOrgztypes() + ",").contains(",2,")) {
            param.setUserid(null);
        }
        return iCommonService.queryOrganSelect2And3(param, request);
    }

    @ApiOperation("预售管理-->获取申请人(或者其他接口通用)")
    @RequestMapping(method = RequestMethod.GET, value = "queryOrganSelectP")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<OrganSelectResult> queryOrganSelectP(OrganSelectParam vo, HttpServletRequest request) {
        Systemmanager systemmanager = iSystemmanagerMapper.selectOne(new QueryWrapper<Systemmanager>().eq("LOGINCODE", iCommonService.getUserLoginCode(request)));
        log.info("vo.parentuserid={}", vo.getParentuserid());
        if (SysConstants.SYS_TYPE_MANAGE.equals(systemmanager.getReletype())) {
            //平台管理员 可以查询所有会员
            if (vo.getIsusertype() == null || vo.getIsusertype() != 1) {
                vo.setUsertype(null);
            }
        } else if (SysConstants.SYS_TYPE_CLIENT.equals(systemmanager.getReletype())) {
            //机构管理员，可以查下级
            if (("," + vo.getOrgztypes() + ",").contains(",3,")) {
                vo.setParentuseridfirst(systemmanager.getAreauserid());
            } else {
                vo.setMemberuserid(systemmanager.getAreauserid());
            }
        } else if (SysConstants.SYS_TYPE_MEMBER.equals(systemmanager.getReletype())) {
            //子机构
            vo.setParentuserid(systemmanager.getAreauserid());
        }
        return iCommonService.queryOrganSelect(vo, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "queryOrganSelectPAndC")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<OrganSelectResult> queryOrganSelectPAndC(OrganSelectParam vo, HttpServletRequest request) {
        Systemmanager systemmanager = iSystemmanagerMapper.selectOne(new QueryWrapper<Systemmanager>().eq("LOGINCODE", iCommonService.getUserLoginCode(request)));
        vo.setUsertype(null);
        List<OrganSelectResult> list = (List<OrganSelectResult>) this.queryOrganSelectP(vo, request);
        List<Useraccount> uaList = iUseraccountMapper.selectList(new QueryWrapper<Useraccount>()
                .eq("accountstatus", 4)
                .eq("hasauth", 1)
                .eq(StringUtils.isNotBlank(vo.getUsertype()), "usertype", vo.getUsertype())
                .eq(SysConstants.SYS_TYPE_CLIENT.equals(systemmanager.getReletype()), "memberuserid", systemmanager.getAreauserid()));
        list.addAll(uaList.stream().filter(x -> StringUtils.isBlank(vo.getSearchcode()) ||
                (StringUtils.isNotBlank(vo.getSearchcode()) && x.getAccountname().contains(vo.getSearchcode()) || x.getUserid().toString().contains(vo.getSearchcode()))).map(x -> {
            OrganSelectResult organSelectVo = new OrganSelectResult();
            organSelectVo.setUserid(x.getUserid());
            organSelectVo.setAccountname(x.getAccountname());
            organSelectVo.setMemberuserid(x.getMemberuserid());
            organSelectVo.setParentuserid(x.getParentuserid());
            organSelectVo.setUsertype(x.getUsertype() + "");
            return organSelectVo;
        }).collect(Collectors.toList()));
        list = list.stream().limit(10).collect(Collectors.toList());
        return AjaxResult.success(Constants.Success_Code_Design, MessageType.MESSAGE_CODE_SYSTEM001.getCode(), request.getHeader("Accept-Language"), list);
    }

    @RequestMapping(method = RequestMethod.GET, value = "queryAccountId")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    @ApiOperation("获取资金账户信息")
    public AjaxResult<Taaccount> queryAccountId(Long userid, HttpServletRequest request) {
        return iCommonService.queryAccountId(userid, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "queryAccountIdForMarket")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    @ApiOperation("做市会员获取资金账户信息")
    public AjaxResult<Taaccount> queryAccountIdForMarket(Long userid, HttpServletRequest request) {
        return iCommonService.queryAccountIdForMarket(userid, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "queryUserinfoByUserId")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    @ApiOperation("获取用户信息")
    public AjaxResult<Userinfo> queryUserinfoByUserId(Long userid, HttpServletRequest request) {
        return iCommonService.queryUserinfoUserId(userid, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "queryTAAccountList")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<TaAccountQueryResult> queryTAAccountList(TaAccountReportParam param, HttpServletRequest request) {
        return iCommonService.queryTAAccountList(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/common/queryOrganSelectRole")
    @ApiOperation("按角色加载机构")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<OrganSelectResult> queryOrganSelectRole(OrganSelectParam vo, HttpServletRequest request) {
        if (StringUtils.isNotBlank(vo.getSubarealevelpath())) {
            Useraccount userAccount = iUseraccountMapper.selectOne(new QueryWrapper<Useraccount>()
                    .eq("userid", Long.valueOf(vo.getSubarealevelpath().replace(",", ""))));
            vo.setSubarealevelpath(userAccount.getSubarealevelpath());
        }
        return iCommonService.queryOrganSelect(vo, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "queryConfig")
    @ApiOperation("根据配置id获取相关配置信息")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<WskhOpenaccountconfig> queryConfig(Long configid, HttpServletRequest request) {
        return iCommonService.queryConfig(configid, request);
    }
}
