更新IAM用户控制器,调整接口文档格式,修改请求方式为POST
This commit is contained in:
@ -17,10 +17,10 @@ import java.util.List;
|
||||
* 参考:IAM系统组织架构同步接口标准.docx
|
||||
* 提供给IAM的同步人员的接口
|
||||
* 人员管理接口
|
||||
* - 获取人员列表接口
|
||||
* - 新增人员接口
|
||||
* - 更新人员接口
|
||||
* - 删除/停用人员接口
|
||||
* - 获取人员列表接口
|
||||
* - 新增人员接口
|
||||
* - 更新人员接口
|
||||
* - 删除/停用人员接口
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "IAM同步人员接口")
|
||||
@ -51,35 +51,34 @@ public class IamUserController {
|
||||
* 请求方式:GET
|
||||
* 请求地址:
|
||||
* {url}/users?pageIndex={pageIndex}&pageSize={pageSize}&startTime={startTime}&endTime={endTime}
|
||||
*
|
||||
* @param userRequestDTO 人员列表请求参数实体
|
||||
* 名称 格式 描述
|
||||
* url string 合作方应用接口地址,例如 <a href="https://iam.com/api/">文档样例</a> <a href="http://localhost:18018/iam/api/users">本地接口</a>
|
||||
* pageIndex number 分页索引(从0开始)
|
||||
* pageSize number 分页大小(支持至少300)
|
||||
* startTime number 最近变更时间的起始时间(unix毫秒时间戳,用于增量)
|
||||
* endTime number 最近变更时间的终止时间(unix毫秒时间戳,用于增量)
|
||||
* 名称 格式 描述
|
||||
* url string 合作方应用接口地址,例如 <a href="https://iam.com/api/">文档样例</a> <a href="http://localhost:18018/iam/api/users">本地接口</a>
|
||||
* pageIndex number 分页索引(从0开始)
|
||||
* pageSize number 分页大小(支持至少300)
|
||||
* startTime number 最近变更时间的起始时间(unix毫秒时间戳,用于增量)
|
||||
* endTime number 最近变更时间的终止时间(unix毫秒时间戳,用于增量)
|
||||
* @return 人员列表信息 样例:
|
||||
* {
|
||||
* "errorCode": 0, // success
|
||||
* "total":1000,//人员总数
|
||||
* "data":[
|
||||
* {
|
||||
* "id":"xxx",
|
||||
* "name":"xxx",
|
||||
* "email":"xxx",
|
||||
* "mobile":"xxx",
|
||||
* "departmentId":"xxx"//所在组织架构的 ID
|
||||
* "status":"xxx"//标识人员的停启用
|
||||
* },
|
||||
* ……
|
||||
* ]
|
||||
* "errorCode": 0, // success
|
||||
* "total":1000,//人员总数
|
||||
* "data":[
|
||||
* {
|
||||
* "id":"xxx",
|
||||
* "name":"xxx",
|
||||
* "email":"xxx",
|
||||
* "mobile":"xxx",
|
||||
* "departmentId":"xxx"//所在组织架构的 ID
|
||||
* "status":"xxx"//标识人员的停启用
|
||||
* },
|
||||
* ……
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
@ApiOperation("获取人员列表接口")
|
||||
@GetMapping("/users")
|
||||
public IamApiResponseDTO getUsers(
|
||||
IamApiRequestDTO userRequestDTO,
|
||||
@RequestHeader(value = "Authorization", required = false) String authorization) {
|
||||
@PostMapping("/users")
|
||||
public IamApiResponseDTO getUsers(@RequestBody IamApiRequestDTO userRequestDTO) {
|
||||
// 鉴权校验
|
||||
// if (authorization == null || !authorization.startsWith("Bearer ")) {
|
||||
// return IamApiResponseDTO.fail(401, "Missing or invalid Authorization header");
|
||||
@ -102,25 +101,26 @@ public class IamUserController {
|
||||
* 请求方式:POST
|
||||
* 请求地址:
|
||||
* {url}/user
|
||||
*
|
||||
* @param iamApiUser 人员请求参数实体
|
||||
* 请求体(Request Body)
|
||||
* {
|
||||
* "name":"xxx",
|
||||
* "email":"xxx",
|
||||
* "mobile":"xxx",
|
||||
* "departmentId":"xxx"//所在组织架构的ID
|
||||
* }
|
||||
* 请求体(Request Body)
|
||||
* {
|
||||
* "name":"xxx",
|
||||
* "email":"xxx",
|
||||
* "mobile":"xxx",
|
||||
* "departmentId":"xxx"//所在组织架构的ID
|
||||
* }
|
||||
* @return 新增人员ID 样例:
|
||||
* 请求返回体(Response Body)
|
||||
* {
|
||||
* "errorCode": 0, // success
|
||||
* "errorMsg":null,//若errorCode不为0,此处应有错误描述
|
||||
* "id":"xxx"//返回新增的人员的id(必须)
|
||||
* "errorCode": 0, // success
|
||||
* "errorMsg":null,//若errorCode不为0,此处应有错误描述
|
||||
* "id":"xxx"//返回新增的人员的id(必须)
|
||||
* }
|
||||
*/
|
||||
@ApiOperation("新增人员接口")
|
||||
@PostMapping("/user")
|
||||
public IamApiResponseDTO<String> saveUser(@RequestBody IamApiUser iamApiUser){
|
||||
public IamApiResponseDTO<String> saveUser(@RequestBody IamApiUser iamApiUser) {
|
||||
log.debug("saveUser请求参数:{}", iamApiUser);
|
||||
Boolean saveResult = iamUserService.save(iamApiUser);
|
||||
log.debug("saveUser返回结果:{}, {}", saveResult, iamApiUser);
|
||||
@ -132,18 +132,19 @@ public class IamUserController {
|
||||
* 请求方式:PUT
|
||||
* 请求地址:
|
||||
* {url}/user/{id}
|
||||
*
|
||||
* @param iamApiUser 人员请求参数实体
|
||||
* 请求体(Request Body)
|
||||
* {
|
||||
* "name":"xxx",
|
||||
* "email":"xxx",
|
||||
* "mobile":"xxx",
|
||||
* "departmentId":"xxx"//所在组织架构的ID
|
||||
* }
|
||||
* 请求体(Request Body)
|
||||
* {
|
||||
* "name":"xxx",
|
||||
* "email":"xxx",
|
||||
* "mobile":"xxx",
|
||||
* "departmentId":"xxx"//所在组织架构的ID
|
||||
* }
|
||||
* @return 更新结果 样例:
|
||||
* {
|
||||
* "errorCode": 0, // success
|
||||
* "errorMsg":null,//若errorCode不为0,此处应有错误描述
|
||||
* "errorCode": 0, // success
|
||||
* "errorMsg":null,//若errorCode不为0,此处应有错误描述
|
||||
* }
|
||||
*/
|
||||
@ApiOperation("更新人员接口")
|
||||
@ -161,11 +162,12 @@ public class IamUserController {
|
||||
* 请求方式:DELETE
|
||||
* 请求地址:
|
||||
* {url}/user/{id}
|
||||
*
|
||||
* @param id 人员ID
|
||||
* @return 删除/停用结果 样例:
|
||||
* {
|
||||
* "errorCode": 0, // success
|
||||
* "errorMsg":null//若errorCode不为0,此处应有错误描述
|
||||
* "errorCode": 0, // success
|
||||
* "errorMsg":null//若errorCode不为0,此处应有错误描述
|
||||
* }
|
||||
*/
|
||||
@ApiOperation("删除/停用人员接口")
|
||||
@ -178,4 +180,4 @@ public class IamUserController {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ public class IamUserServiceImpl extends ServiceImpl<IamUserMapper, IamApiUser> i
|
||||
int pageSize = iamUserRequestDTO.getPageSize() != null ? iamUserRequestDTO.getPageSize() : 10;
|
||||
Page<IamApiUser> page = new Page<>(pageIndex + 1, pageSize); // MyBatis-Plus页码从1开始,接口从0开始
|
||||
QueryWrapper<IamApiUser> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
// 可根据startTime、endTime等条件添加查询条件
|
||||
if (iamUserRequestDTO.getStartTime() != null) {
|
||||
queryWrapper.ge("update_time", iamUserRequestDTO.getStartTime());
|
||||
@ -59,4 +60,4 @@ public class IamUserServiceImpl extends ServiceImpl<IamUserMapper, IamApiUser> i
|
||||
// 这里只做演示,假设所有生成的token都有效
|
||||
return token != null && token.length() == 32;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.mail.controller;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.extend.mail.entity.MailRequest;
|
||||
import com.chinaunicom.mall.ebtp.common.mail.entity.MailRequest;
|
||||
import com.chinaunicom.mall.ebtp.extend.mail.service.IMailService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -1,19 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.mail.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel("邮件请求参数")
|
||||
public class MailRequest {
|
||||
@ApiModelProperty(value = "收件人邮箱", required = true, example = "recipient@example.com")
|
||||
private String to;
|
||||
|
||||
@ApiModelProperty(value = "邮件主题", required = true, example = "测试邮件")
|
||||
private String subject;
|
||||
|
||||
@ApiModelProperty(value = "邮件内容", required = true,
|
||||
example = "这是一封测试邮件")
|
||||
private String content;
|
||||
}
|
@ -25,8 +25,9 @@ public class TimeServiceConstant {
|
||||
|
||||
private static TSAClient client;
|
||||
|
||||
@Value("${spring.redis.sentinel.master}")
|
||||
private String redis;
|
||||
// @Value("${spring.redis.sentinel.master}")
|
||||
// private String redis;
|
||||
private String redis = "master";
|
||||
|
||||
static {
|
||||
try {
|
||||
|
Reference in New Issue
Block a user