feat(REQ-3282): api封装
This commit is contained in:
parent
76ddbe7636
commit
f3daa06ada
2
pom.xml
2
pom.xml
@ -28,9 +28,9 @@
|
||||
<modules>
|
||||
<module>riven-server</module>
|
||||
<module>riven-api</module>
|
||||
<!--<module>integration-test</module>-->
|
||||
<module>riven-third</module>
|
||||
<module>riven-dingtalk</module>
|
||||
<module>riven-api-v2</module>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
|
||||
42
riven-api-v2/pom.xml
Normal file
42
riven-api-v2/pom.xml
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>riven</artifactId>
|
||||
<groupId>cn.axzo</groupId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>riven-api-v2</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>riven-api-v2</name>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.axzo.foundation</groupId>
|
||||
<artifactId>common-lib</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -0,0 +1,14 @@
|
||||
package cn.axzo.riven.api.v2.config;
|
||||
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author : zhanghonghao@axzo.cn
|
||||
* @since : 2024/12/10
|
||||
*/
|
||||
@Configuration
|
||||
@EnableFeignClients(basePackages = "cn.axzo.riven.api.v2.**.feign")
|
||||
public class RivenApiV2Config {
|
||||
|
||||
}
|
||||
22
riven-api-v2/src/main/java/cn/axzo/riven/api/v2/thirdparty/feign/ThirdPartySyncV2Api.java
vendored
Normal file
22
riven-api-v2/src/main/java/cn/axzo/riven/api/v2/thirdparty/feign/ThirdPartySyncV2Api.java
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
package cn.axzo.riven.api.v2.thirdparty.feign;
|
||||
|
||||
import cn.axzo.foundation.result.ApiResult;
|
||||
import cn.axzo.riven.api.v2.thirdparty.resp.ThirdPartyDeptResp;
|
||||
import cn.axzo.riven.api.v2.thirdparty.resp.ThirdPartyUserResp;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
@FeignClient(
|
||||
value = "riven",
|
||||
url = "${axzo.service.riven:http://riven:8080}"
|
||||
)
|
||||
public interface ThirdPartySyncV2Api {
|
||||
|
||||
@GetMapping("api/riven/sync/getDept/{syncDataId}")
|
||||
ApiResult<ThirdPartyDeptResp> getDeptById(@PathVariable Long syncDataId);
|
||||
|
||||
@GetMapping("api/riven/sync/getUser/{syncDataId}")
|
||||
ApiResult<ThirdPartyUserResp> getUserById(@PathVariable Long syncDataId);
|
||||
|
||||
}
|
||||
75
riven-api-v2/src/main/java/cn/axzo/riven/api/v2/thirdparty/resp/ThirdPartyDeptResp.java
vendored
Normal file
75
riven-api-v2/src/main/java/cn/axzo/riven/api/v2/thirdparty/resp/ThirdPartyDeptResp.java
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
package cn.axzo.riven.api.v2.thirdparty.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 三方平台部门DTO
|
||||
*
|
||||
* @version V1.0
|
||||
* @author: ZhanSiHu
|
||||
* @date: 2023/11/29 15:44
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ThirdPartyDeptResp {
|
||||
|
||||
/** 主键ID **/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 系统企业ID
|
||||
*/
|
||||
private Long ouId;
|
||||
|
||||
/**
|
||||
* 三方平台渠道,钉钉: DING 企微: QW
|
||||
*/
|
||||
private String channel;
|
||||
|
||||
/**
|
||||
* 三方部门ID
|
||||
*/
|
||||
private String departmentId;
|
||||
|
||||
/**
|
||||
* 三方部门名称
|
||||
*/
|
||||
private String departmentName;
|
||||
|
||||
/**
|
||||
* 三方上级部门ID
|
||||
*/
|
||||
private String parentId;
|
||||
|
||||
/** 内部上级部门ID **/
|
||||
private Long innerParentId;
|
||||
|
||||
/**
|
||||
* 三方部门层级路径
|
||||
*/
|
||||
private String hierarchy;
|
||||
|
||||
/**
|
||||
* 部门主管ID
|
||||
*/
|
||||
private String managerId;
|
||||
|
||||
/**
|
||||
* 部门主管手机
|
||||
*/
|
||||
private String managerPhone;
|
||||
|
||||
/** 部门排序 **/
|
||||
private Integer sort;
|
||||
|
||||
/** 部门主管同步ID **/
|
||||
private List<Long> managerIds;
|
||||
|
||||
}
|
||||
78
riven-api-v2/src/main/java/cn/axzo/riven/api/v2/thirdparty/resp/ThirdPartyUserResp.java
vendored
Normal file
78
riven-api-v2/src/main/java/cn/axzo/riven/api/v2/thirdparty/resp/ThirdPartyUserResp.java
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
package cn.axzo.riven.api.v2.thirdparty.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 三方平台用户DTO
|
||||
*
|
||||
* @version V1.0
|
||||
* @author: ZhanSiHu
|
||||
* @date: 2023/11/29 15:44
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ThirdPartyUserResp {
|
||||
|
||||
/** ID **/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 系统企业ID
|
||||
*/
|
||||
private Long ouId;
|
||||
|
||||
/**
|
||||
* 三方平台渠道,钉钉: DING 企微: QW
|
||||
*/
|
||||
private String channel;
|
||||
|
||||
/**
|
||||
* 三方平台UID
|
||||
*/
|
||||
private String unionId;
|
||||
|
||||
/**
|
||||
* 三方用户ID
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 三方用户姓名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 三方用户手机号
|
||||
*/
|
||||
private String userPhone;
|
||||
|
||||
/** 三方用户邮箱 **/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 工号
|
||||
*/
|
||||
private String jobNumber;
|
||||
|
||||
/** 职位 **/
|
||||
private String title;
|
||||
|
||||
/** 直属主管ID **/
|
||||
private String managerId;
|
||||
|
||||
/**
|
||||
* 三方用户所在部门ID,多部门多记录
|
||||
*/
|
||||
private String departmentId;
|
||||
|
||||
/** 内部部门ID **/
|
||||
private Long innerDeptId;
|
||||
|
||||
/** 直属主管内部ID **/
|
||||
private Long managerInnerId;
|
||||
}
|
||||
@ -133,6 +133,11 @@
|
||||
<groupId>cn.axzo.trade</groupId>
|
||||
<artifactId>trade-data-security-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.axzo</groupId>
|
||||
<artifactId>riven-api-v2</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
package cn.axzo.riven.controller.v2;
|
||||
|
||||
import cn.axzo.foundation.result.ApiResult;
|
||||
import cn.axzo.riven.api.v2.thirdparty.feign.ThirdPartySyncV2Api;
|
||||
import cn.axzo.riven.api.v2.thirdparty.resp.ThirdPartyDeptResp;
|
||||
import cn.axzo.riven.api.v2.thirdparty.resp.ThirdPartyUserResp;
|
||||
import cn.axzo.riven.client.domain.ThirdPartyDeptDTO;
|
||||
import cn.axzo.riven.client.domain.ThirdPartyUserDTO;
|
||||
import cn.axzo.riven.service.ThirdPartySyncManageService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author : zhanghonghao@axzo.cn
|
||||
* @since : 2024/12/11
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class ThirdPartySyncV2ApiImpl implements ThirdPartySyncV2Api {
|
||||
|
||||
private final ThirdPartySyncManageService thirdPartySyncManageService;
|
||||
|
||||
@Override
|
||||
public ApiResult<ThirdPartyDeptResp> getDeptById(Long syncDataId) {
|
||||
ThirdPartyDeptDTO deptById = thirdPartySyncManageService.getDeptById(syncDataId);
|
||||
ThirdPartyDeptResp deptResp = new ThirdPartyDeptResp();
|
||||
BeanUtils.copyProperties(deptById, deptResp);
|
||||
return ApiResult.success(deptResp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResult<ThirdPartyUserResp> getUserById(Long syncDataId) {
|
||||
ThirdPartyUserDTO userById = thirdPartySyncManageService.getUserById(syncDataId);
|
||||
ThirdPartyUserResp userResp = new ThirdPartyUserResp();
|
||||
BeanUtils.copyProperties(userById, userResp);
|
||||
return ApiResult.success(userResp);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user