写如下这个就行
@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;
}