x-www-form-urlencoded 方法调用application/json 的方法

写如下这个就行
@RequestMapping(value = “/rx”, method = RequestMethod.POST, consumes = {“application/x-www-form-urlencoded”, “application/json”}, produces = “application/json”)

@ApiOperation(value = "通讯录接口统一调用地址", notes = "通讯录接口统一调用地址")
    @RequestMapping(value = "/rx", method = RequestMethod.POST, consumes = {"application/x-www-form-urlencoded", "application/json"}, produces = "application/json")
    @ResponseBody
    public Map<String, Object> ruiXin(@RequestParam String request_data) {
        try {
            return this.mapUserAndOrg(JSONArray.parseObject(request_data, UserRichfitDto.class));
        } catch (Exception e) {
            Map<String, Object> result = new LinkedHashMap<>();
            result.put("success", false);
            result.put("err_code", "x10200000003");
            result.put("err_msg", "参数不合法");
            result.put("result_data", null);
            return result;
        }
    }
    /*
     *
     * @Author 
     * @Date 10:11 2019-10-26
     * @Paramc UserRichfitDto dto
     * @Description:通讯录接口统一调用地址
     * @return
     **/
    @RequestMapping(value = "/rxx", method = RequestMethod.POST, produces = "application/json")
    @ResponseBody
    @ApiOperation(value = "通讯录接口统一调用地址", notes = "通讯录接口统一调用地址")
    public Map<String, Object> mapUserAndOrg(UserRichfitDto userRichfitDto) {
        Map<String, Object> result = new LinkedHashMap<>();
        try {
            checkPermit(userRichfitDto.getAdminKey(), userRichfitDto.getCurrentUserId());
        } catch (BusinessException e) {
            result.put("success", false);
            result.put("err_code", e.getCode());
            result.put("err_msg", e.getMessage());
            result.put("result_data", null);
            return result;
        }
        String interfaceName = StringUtils.trim(userRichfitDto.getInterfaceName());
        //查询用户信息
        if (StringUtils.equalsIgnoreCase(interfaceName, "get_user_info")) {
            result = getUserInfo(userRichfitDto);
        }
        //查询组织机构信息
        else if (StringUtils.equalsIgnoreCase(interfaceName, "get_org_info")) {
            result = sysOrgAPIController.getOrganizations(userRichfitDto.getAdminKey(),userRichfitDto.getCurrentUserId(),userRichfitDto.getSearchType(),userRichfitDto.getSearchValue());
        }
        //获取子机构列表
        else if (StringUtils.equalsIgnoreCase(interfaceName, "get_sub_orgs")) {
            result = sysOrgAPIController.getSubOrganizations(userRichfitDto.getAdminKey(),userRichfitDto.getCurrentUserId(),userRichfitDto.getOrgId());
        }
        //获取父机构列表
        else if (StringUtils.equalsIgnoreCase(interfaceName, "get_all_parent_org")) {
            result = sysOrgAPIController.getParentOrganizations(userRichfitDto.getAdminKey(),userRichfitDto.getCurrentUserId(),userRichfitDto.getOrgId());
        }
        //更新用户访问级别
       /* if (StringUtils.equalsIgnoreCase(interfaceName, "event_report")) {
            userInfo = getUserInfo(userRichfitDto);
        }*/
        //设置用户好友权限(目前返回空Map)
        else if (StringUtils.equalsIgnoreCase(interfaceName, "set_friend_permit")) {
            result = modifyFriendPermit(userRichfitDto.getCurrentUserId());
        }
        //获取用户缺省组织列表
        else if (StringUtils.equalsIgnoreCase(interfaceName, "get_default_org")) {
            result = getDefaultOrg(userRichfitDto.getCurrentUserId());
        }
        //获取所有租户的根机构列表
        else if (StringUtils.equalsIgnoreCase(interfaceName, "get_top_orgs")) {
            result = getTopOrgs(userRichfitDto.getAdminKey());
        } else {
            result.put("success", false);
            result.put("err_code", "x10100000001");
            result.put("err_msg", "未找到接口");
            result.put("result_data", null);
        }
        return result;
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值