feat:添加OA系统对接相关代码
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
package org.springblade.system.pojo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 数据同步记录表 实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2024-09-27
|
||||
*/
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
@TableName("blade_data_sync_record")
|
||||
@Schema(description = "DataSyncRecord对象")
|
||||
public class DataSyncRecord implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Schema(description = "主键")
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 系统编码
|
||||
*/
|
||||
@Schema(description = "系统编码")
|
||||
private String systemCode;
|
||||
/**
|
||||
* 数据类型
|
||||
*/
|
||||
@Schema(description = "数据类型")
|
||||
private String dataType;
|
||||
/**
|
||||
* 模式
|
||||
*/
|
||||
@Schema(description = "模式")
|
||||
private String mode;
|
||||
/**
|
||||
* 结果
|
||||
*/
|
||||
@Schema(description = "结果")
|
||||
private String result;
|
||||
/**
|
||||
* 同步时间
|
||||
*/
|
||||
@Schema(description = "同步时间")
|
||||
private Date syncTime;
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description = "租户ID")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String tenantId;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
|
||||
@JsonFormat(pattern = DateUtil.PATTERN_TIME_MINI)
|
||||
@Schema(description = "创建时间", hidden = true)
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
/**
|
||||
* 状态[0:未删除,1:删除]
|
||||
*/
|
||||
@TableLogic
|
||||
@Schema(description = "是否已删除", hidden = true)
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Integer isDeleted;
|
||||
}
|
||||
@@ -33,9 +33,11 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springblade.core.tenant.mp.TenantEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 实体类
|
||||
@@ -45,7 +47,7 @@ import java.io.Serializable;
|
||||
@Data
|
||||
@TableName("blade_dept")
|
||||
@Schema(description = "Dept对象")
|
||||
public class Dept implements Serializable {
|
||||
public class Dept extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -127,4 +129,30 @@ public class Dept implements Serializable {
|
||||
private Integer isDeleted;
|
||||
|
||||
|
||||
/**
|
||||
* 部门编码
|
||||
*/
|
||||
@Schema(description = "部门编码")
|
||||
private String deptCode;
|
||||
/**
|
||||
* 父部门编码
|
||||
*/
|
||||
@Schema(description = "父部门编码")
|
||||
private String parentCode;
|
||||
/**
|
||||
* 同步时间
|
||||
*/
|
||||
@Schema(description = "同步时间")
|
||||
private Date syncTime;
|
||||
/**
|
||||
* 所属公司编码
|
||||
*/
|
||||
@Schema(description = "所属公司编码")
|
||||
private String belongCompanyCode;
|
||||
/**
|
||||
* 是否是oa的部门
|
||||
*/
|
||||
@Schema(description = "是否是oa的部门")
|
||||
private Integer isOa;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package org.springblade.system.pojo.enums;
|
||||
|
||||
/**
|
||||
* 数据同步枚举类
|
||||
* @author bfhuange
|
||||
* @date 2024/9/27
|
||||
*/
|
||||
public class DataSync {
|
||||
|
||||
/**
|
||||
* 系统编码
|
||||
*/
|
||||
public enum SystemCode {
|
||||
/**
|
||||
* oa 系统
|
||||
*/
|
||||
OA,
|
||||
/**
|
||||
* mk 系统
|
||||
*/
|
||||
MK,
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据类型
|
||||
*/
|
||||
public enum DataType {
|
||||
/**
|
||||
* 组织,包含公司和部门
|
||||
*/
|
||||
ORG,
|
||||
/**
|
||||
* 人员
|
||||
*/
|
||||
PERSON,
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模式
|
||||
*/
|
||||
public enum Mode {
|
||||
/**
|
||||
* 获取
|
||||
*/
|
||||
FETCH,
|
||||
/**
|
||||
* 推送
|
||||
*/
|
||||
PUSH,
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* 结果
|
||||
*/
|
||||
public enum Result {
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
SUCCESS,
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
FAIL,
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.springblade.system.pojo.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 部门类型枚举
|
||||
* @author bfhuange
|
||||
* @date 2024/8/26
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum DeptCategory {
|
||||
/**
|
||||
* 公司
|
||||
*/
|
||||
COMPANY(1, "公司"),
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
DEPT(2, "部门"),
|
||||
;
|
||||
|
||||
/**
|
||||
* 部门类型编码
|
||||
*/
|
||||
private final Integer code;
|
||||
/**
|
||||
* 部门类型名称
|
||||
*/
|
||||
private final String name;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.springblade.system.pojo.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 用户性别枚举
|
||||
* @author bfhuange
|
||||
* @date 2024/8/27
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum UserSex {
|
||||
/**
|
||||
* 男
|
||||
*/
|
||||
MAN(1, "男"),
|
||||
/**
|
||||
* 女
|
||||
*/
|
||||
WOMAN(2, "女"),
|
||||
;
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private final Integer code;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
public static Integer getCodeByName(String name) {
|
||||
if (name == null || name.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return Stream.of(values())
|
||||
.filter(e -> e.getName().equals(name))
|
||||
.map(UserSex::getCode)
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package org.springblade.system.pojo.vo;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author bfhuange
|
||||
* @date 2024/8/27
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "DeptListVO")
|
||||
public class DeptListVO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Schema(description = "主键id")
|
||||
private Long id;
|
||||
/**
|
||||
* 部门编码
|
||||
*/
|
||||
@Schema(description = "部门编码")
|
||||
private String deptCode;
|
||||
/**
|
||||
* 机构名
|
||||
*/
|
||||
@Schema(description = "机构名")
|
||||
private String deptName;
|
||||
/**
|
||||
* 父主键
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Schema(description = "父主键")
|
||||
private Long parentId;
|
||||
/**
|
||||
* 父部门编码
|
||||
*/
|
||||
@Schema(description = "父部门编码")
|
||||
private String parentCode;
|
||||
/**
|
||||
* 部门类型
|
||||
*/
|
||||
@Schema(description = "部门类型")
|
||||
private Integer deptCategory;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.springblade.system.pojo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 用户部门id
|
||||
* @author bfhuange
|
||||
* @date 2024/9/12
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "UserDeptIdsVO对象")
|
||||
public class UserDeptIdsVO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 部门id,多个用逗号拼接
|
||||
*/
|
||||
@Schema(description = "部门id,多个用逗号拼接")
|
||||
private String deptIds;
|
||||
|
||||
/**
|
||||
* 部门编码,多个用逗号拼接
|
||||
*/
|
||||
@Schema(description = "部门编码,多个用逗号拼接")
|
||||
private String deptCodes;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package org.springblade.system.util;
|
||||
|
||||
import org.springblade.system.pojo.entity.DataSyncRecord;
|
||||
import org.springblade.system.pojo.enums.DataSync;
|
||||
|
||||
/**
|
||||
* 数据同步记录工具类
|
||||
* @author bfhuange
|
||||
* @date 2024/9/27
|
||||
*/
|
||||
public class DataSyncRecordUtils {
|
||||
private DataSyncRecordUtils() {}
|
||||
|
||||
/**
|
||||
* 创建获取oa组织的数据同步记录
|
||||
* @return
|
||||
*/
|
||||
public static DataSyncRecord createOAOrgFetch() {
|
||||
return DataSyncRecordUtils.createOAFetch()
|
||||
// 数据类型是组织
|
||||
.setDataType(DataSync.DataType.ORG.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建获取oa人员的数据同步记录
|
||||
* @return
|
||||
*/
|
||||
public static DataSyncRecord createOAPersonFetch() {
|
||||
return DataSyncRecordUtils.createOAFetch()
|
||||
// 数据类型是人员
|
||||
.setDataType(DataSync.DataType.PERSON.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建推送mk组织的数据同步记录
|
||||
* @return
|
||||
*/
|
||||
public static DataSyncRecord createMKOrgPush() {
|
||||
return DataSyncRecordUtils.createMKPush()
|
||||
// 数据类型是组织
|
||||
.setDataType(DataSync.DataType.ORG.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建推送mk人员的数据同步记录
|
||||
* @return
|
||||
*/
|
||||
public static DataSyncRecord createMKPersonPush() {
|
||||
return DataSyncRecordUtils.createMKPush()
|
||||
// 数据类型是人员
|
||||
.setDataType(DataSync.DataType.PERSON.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建oa 获取数据记录
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static DataSyncRecord createOAFetch() {
|
||||
return new DataSyncRecord()
|
||||
// oa 系统
|
||||
.setSystemCode(DataSync.SystemCode.OA.name())
|
||||
// 获取数据
|
||||
.setMode(DataSync.Mode.FETCH.name())
|
||||
// 默认结果是成功
|
||||
.setResult(DataSync.Result.SUCCESS.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建mk 推送数据记录
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static DataSyncRecord createMKPush() {
|
||||
return new DataSyncRecord()
|
||||
// mk 系统
|
||||
.setSystemCode(DataSync.SystemCode.MK.name())
|
||||
// 推送数据
|
||||
.setMode(DataSync.Mode.PUSH.name())
|
||||
// 默认结果是成功
|
||||
.setResult(DataSync.Result.SUCCESS.name());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.springblade.system.pojo.context;
|
||||
|
||||
/**
|
||||
* 获取设置手机号接口
|
||||
* @author bfhuange
|
||||
* @since 2026/4/1
|
||||
*/
|
||||
public interface IPhone {
|
||||
/**
|
||||
* 设置手机号
|
||||
* @return
|
||||
*/
|
||||
void setPhone(String phone);
|
||||
/**
|
||||
* 获取手机号
|
||||
* @return
|
||||
*/
|
||||
String getPhone();
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import lombok.EqualsAndHashCode;
|
||||
import org.springblade.core.tenant.mp.TenantEntity;
|
||||
import org.springblade.core.tool.jackson.Sensitive;
|
||||
import org.springblade.core.tool.sensitive.SensitiveType;
|
||||
import org.springblade.system.pojo.context.IPhone;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Date;
|
||||
@@ -43,7 +44,7 @@ import java.util.Date;
|
||||
@Data
|
||||
@TableName("blade_user")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class User extends TenantEntity {
|
||||
public class User extends TenantEntity implements IPhone {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -116,4 +117,22 @@ public class User extends TenantEntity {
|
||||
private Integer isLeader;
|
||||
|
||||
|
||||
/**
|
||||
* 部门编码
|
||||
*/
|
||||
private String deptCodes;
|
||||
/**
|
||||
* 同步时间
|
||||
*/
|
||||
private Date syncTime;
|
||||
/**
|
||||
* 是否是oa的账号
|
||||
*/
|
||||
private Integer isOa;
|
||||
/**
|
||||
* 是否推送mk
|
||||
*/
|
||||
private Integer isPushMk;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 实体类
|
||||
@@ -85,4 +86,45 @@ public class UserDept implements Serializable {
|
||||
@Schema(description = "是否已删除")
|
||||
private Integer isDeleted;
|
||||
|
||||
|
||||
/**
|
||||
* 公司编码
|
||||
*/
|
||||
@Schema(description = "公司编码")
|
||||
private String companyCode;
|
||||
/**
|
||||
* 公司名
|
||||
*/
|
||||
@Schema(description = "公司名")
|
||||
private String companyName;
|
||||
/**
|
||||
* 部门编码
|
||||
*/
|
||||
@Schema(description = "部门编码")
|
||||
private String deptCode;
|
||||
/**
|
||||
* 部门名
|
||||
*/
|
||||
@Schema(description = "部门名")
|
||||
private String deptName;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
/**
|
||||
* oaid
|
||||
*/
|
||||
@Schema(description = "oaid")
|
||||
private String oaId;
|
||||
/**
|
||||
* oa的loginId
|
||||
*/
|
||||
@Schema(description = "oa的loginId")
|
||||
private String oaLoginId;
|
||||
/**
|
||||
* 同步时间
|
||||
*/
|
||||
@Schema(description = "同步时间")
|
||||
private Date syncTime;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.springblade.system.pojo.vo;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author bfhuange
|
||||
* @date 2024/8/28
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "UserListVO对象")
|
||||
public class UserListVO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 手机
|
||||
*/
|
||||
private String phone;
|
||||
}
|
||||
Reference in New Issue
Block a user