~
This commit is contained in:
30
mjkf-xinke-plugin-api/mjkf-xinke-plugin-auth-api/pom.xml
Normal file
30
mjkf-xinke-plugin-api/mjkf-xinke-plugin-auth-api/pom.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-plugin-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mjkf-xinke-plugin-auth-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>登录鉴权插件api接口</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 每个插件接口都要引入common -->
|
||||
<dependency>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- sa-token-core -->
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,113 @@
|
||||
|
||||
package mjkf.xinke.auth.api;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import mjkf.xinke.auth.core.pojo.SaBaseClientLoginUser;
|
||||
import mjkf.xinke.auth.core.pojo.SaBaseLoginUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 登录用户API,由其他模块实现
|
||||
*
|
||||
*
|
||||
* @date 2021/12/23 21:48
|
||||
*/
|
||||
public interface SaBaseLoginUserApi {
|
||||
|
||||
/**
|
||||
* 根据id获取B端用户信息,查不到则返回null
|
||||
*
|
||||
*
|
||||
* @date 2022/3/10 16:14
|
||||
**/
|
||||
SaBaseLoginUser getUserById(String id);
|
||||
|
||||
/**
|
||||
* 根据id获取C端用户信息,查不到则返回null
|
||||
*
|
||||
*
|
||||
* @date 2022/3/10 16:14
|
||||
**/
|
||||
SaBaseClientLoginUser getClientUserById(String id);
|
||||
|
||||
/**
|
||||
* 根据账号获取B端用户信息,查不到则返回null
|
||||
*
|
||||
*
|
||||
* @date 2022/3/10 16:14
|
||||
**/
|
||||
SaBaseLoginUser getUserByAccount(String account);
|
||||
|
||||
/**
|
||||
* 根据账号获取C端用户信息,查不到则返回null
|
||||
*
|
||||
*
|
||||
* @date 2022/3/10 16:14
|
||||
**/
|
||||
SaBaseClientLoginUser getClientUserByAccount(String account);
|
||||
|
||||
/**
|
||||
* 根据手机号获取B端用户信息,查不到则返回null
|
||||
*
|
||||
*
|
||||
* @date 2022/3/10 16:14
|
||||
**/
|
||||
SaBaseLoginUser getUserByPhone(String phone);
|
||||
|
||||
/**
|
||||
* 根据手机号获取C端用户信息,查不到则返回null
|
||||
*
|
||||
*
|
||||
* @date 2022/3/10 16:14
|
||||
**/
|
||||
SaBaseClientLoginUser getClientUserByPhone(String phone);
|
||||
|
||||
/**
|
||||
* 根据用户id获取用户集合
|
||||
*
|
||||
*
|
||||
* @date 2022/4/27 22:53
|
||||
*/
|
||||
List<JSONObject> listUserByUserIdList(List<String> userIdList);
|
||||
|
||||
/**
|
||||
* 根据用户id获取角色集合
|
||||
*
|
||||
*
|
||||
* @date 2022/4/27 22:53
|
||||
*/
|
||||
List<JSONObject> getRoleListByUserId(String userId);
|
||||
|
||||
/**
|
||||
* 根据角色id和用户id集合获取按钮码集合
|
||||
*
|
||||
*
|
||||
* @date 2022/4/27 22:54
|
||||
*/
|
||||
List<String> getButtonCodeListListByUserAndRoleIdList(List<String> userAndRoleIdList);
|
||||
|
||||
/**
|
||||
* 根据角色id和用户id集合获取移动端按钮码集合
|
||||
*
|
||||
*
|
||||
* @date 2022/4/27 22:54
|
||||
*/
|
||||
List<String> getMobileButtonCodeListListByUserIdAndRoleIdList(List<String> userAndRoleIdList);
|
||||
|
||||
/**
|
||||
* 根据角色id和用户id集合获取权限集合
|
||||
*
|
||||
*
|
||||
* @date 2022/4/27 22:54
|
||||
*/
|
||||
List<JSONObject> getPermissionListByUserIdAndRoleIdList(List<String> userAndRoleIdList, String orgId);
|
||||
|
||||
/**
|
||||
* 更新用户的登录时间和登录ip等信息
|
||||
*
|
||||
*
|
||||
* @date 2022/4/27 22:57
|
||||
*/
|
||||
void updateUserLoginInfo(String userId, String device);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
package mjkf.xinke.auth.core.annotation;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import mjkf.xinke.auth.core.util.StpClientUtil;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 登录认证(前台User版):只有登录之后才能进入该方法
|
||||
* 可标注在函数、类上(效果等同于标注在此类的所有方法上)
|
||||
*
|
||||
*
|
||||
* @date 2022/3/10 10:39
|
||||
**/
|
||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE})
|
||||
public @interface SaClientCheckLogin {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
|
||||
package mjkf.xinke.auth.core.annotation;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
import mjkf.xinke.auth.core.util.StpClientUtil;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 权限认证(前台User版):必须具有指定权限才能进入该方法
|
||||
* 可标注在函数、类上(效果等同于标注在此类的所有方法上)
|
||||
*
|
||||
*
|
||||
* @date 2022/3/10 10:40
|
||||
**/
|
||||
@SaCheckPermission(type = StpClientUtil.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE})
|
||||
public @interface SaClientCheckPermission {
|
||||
|
||||
/**
|
||||
* 需要校验的权限码
|
||||
* @return 需要校验的权限码
|
||||
*/
|
||||
@AliasFor(annotation = SaCheckPermission.class)
|
||||
String [] value() default {};
|
||||
|
||||
/**
|
||||
* 验证模式:AND | OR,默认AND
|
||||
* @return 验证模式
|
||||
*/
|
||||
@AliasFor(annotation = SaCheckPermission.class)
|
||||
SaMode mode() default SaMode.AND;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
package mjkf.xinke.auth.core.annotation;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckRole;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
import mjkf.xinke.auth.core.util.StpClientUtil;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 角色认证(前台User版):必须具有指定角色标识才能进入该方法
|
||||
* 可标注在函数、类上(效果等同于标注在此类的所有方法上)
|
||||
*
|
||||
*
|
||||
* @date 2022/3/10 10:41
|
||||
**/
|
||||
@SaCheckRole(type = StpClientUtil.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE})
|
||||
public @interface SaClientCheckRole {
|
||||
|
||||
/**
|
||||
* 需要校验的角色标识
|
||||
* @return 需要校验的角色标识
|
||||
*/
|
||||
@AliasFor(annotation = SaCheckRole.class)
|
||||
String [] value() default {};
|
||||
|
||||
/**
|
||||
* 验证模式:AND | OR,默认AND
|
||||
* @return 验证模式
|
||||
*/
|
||||
@AliasFor(annotation = SaCheckRole.class)
|
||||
SaMode mode() default SaMode.AND;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
package mjkf.xinke.auth.core.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import mjkf.xinke.common.exception.CommonException;
|
||||
|
||||
/**
|
||||
* 登录端类型枚举
|
||||
*
|
||||
*
|
||||
* @date 2021/10/11 14:02
|
||||
**/
|
||||
@Getter
|
||||
public enum SaClientTypeEnum {
|
||||
|
||||
/**
|
||||
* B端用户
|
||||
*/
|
||||
B("B"),
|
||||
|
||||
/**
|
||||
* C端用户
|
||||
*/
|
||||
C("C");
|
||||
|
||||
private final String value;
|
||||
|
||||
SaClientTypeEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static void validate(String value) {
|
||||
boolean flag = B.getValue().equals(value) || C.getValue().equals(value);
|
||||
if(!flag) {
|
||||
throw new CommonException("不支持的登录端类型:{}", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
|
||||
package mjkf.xinke.auth.core.pojo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 基础的C端登录用户对象,可继承此类扩展更多属性
|
||||
*
|
||||
*
|
||||
* @date 2021/12/23 21:49
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public abstract class SaBaseClientLoginUser {
|
||||
|
||||
/** id */
|
||||
@ApiModelProperty(value = "id", position = 1)
|
||||
private String id;
|
||||
|
||||
/** 租户id */
|
||||
@ApiModelProperty(value = "租户id", position = 2)
|
||||
private String tenantId;
|
||||
|
||||
/** 头像 */
|
||||
@ApiModelProperty(value = "头像,图片base64", position = 3)
|
||||
private String avatar;
|
||||
|
||||
/** 签名 */
|
||||
@ApiModelProperty(value = "签名,图片base64", position = 4)
|
||||
private String signature;
|
||||
|
||||
/** 账号 */
|
||||
@ApiModelProperty(value = "账号", position = 5)
|
||||
private String account;
|
||||
|
||||
/** 姓名 */
|
||||
@ApiModelProperty(value = "姓名", position = 6)
|
||||
private String name;
|
||||
|
||||
/** 昵称 */
|
||||
@ApiModelProperty(value = "昵称", position = 7)
|
||||
private String nickname;
|
||||
|
||||
/** 性别 */
|
||||
@ApiModelProperty(value = "性别", position = 8)
|
||||
private String gender;
|
||||
|
||||
/** 年龄 */
|
||||
@ApiModelProperty(value = "年龄", position = 9)
|
||||
private String age;
|
||||
|
||||
/** 出生日期 */
|
||||
@ApiModelProperty(value = "出生日期", position = 10)
|
||||
private String birthday;
|
||||
|
||||
/** 民族 */
|
||||
@ApiModelProperty(value = "民族", position = 11)
|
||||
private String nation;
|
||||
|
||||
/** 籍贯 */
|
||||
@ApiModelProperty(value = "籍贯", position = 12)
|
||||
private String nativePlace;
|
||||
|
||||
/** 家庭住址 */
|
||||
@ApiModelProperty(value = "家庭住址", position = 13)
|
||||
private String homeAddress;
|
||||
|
||||
/** 通信地址 */
|
||||
@ApiModelProperty(value = "通信地址", position = 14)
|
||||
private String mailingAddress;
|
||||
|
||||
/** 证件类型 */
|
||||
@ApiModelProperty(value = "证件类型", position = 15)
|
||||
private String idCardType;
|
||||
|
||||
/** 证件号码 */
|
||||
@ApiModelProperty(value = "证件号码", position = 16)
|
||||
private String idCardNumber;
|
||||
|
||||
/** 文化程度 */
|
||||
@ApiModelProperty(value = "文化程度", position = 17)
|
||||
private String cultureLevel;
|
||||
|
||||
/** 政治面貌 */
|
||||
@ApiModelProperty(value = "政治面貌", position = 18)
|
||||
private String politicalOutlook;
|
||||
|
||||
/** 毕业院校 */
|
||||
@ApiModelProperty(value = "毕业院校", position = 19)
|
||||
private String college;
|
||||
|
||||
/** 学历 */
|
||||
@ApiModelProperty(value = "学历", position = 20)
|
||||
private String education;
|
||||
|
||||
/** 学制 */
|
||||
@ApiModelProperty(value = "学制", position = 21)
|
||||
private String eduLength;
|
||||
|
||||
/** 学位 */
|
||||
@ApiModelProperty(value = "学位", position = 22)
|
||||
private String degree;
|
||||
|
||||
/** 手机 */
|
||||
@ApiModelProperty(value = "手机", position = 23)
|
||||
private String phone;
|
||||
|
||||
/** 邮箱 */
|
||||
@ApiModelProperty(value = "邮箱", position = 24)
|
||||
private String email;
|
||||
|
||||
/** 家庭电话 */
|
||||
@ApiModelProperty(value = "家庭电话", position = 25)
|
||||
private String homeTel;
|
||||
|
||||
/** 办公电话 */
|
||||
@ApiModelProperty(value = "办公电话", position = 26)
|
||||
private String officeTel;
|
||||
|
||||
/** 紧急联系人 */
|
||||
@ApiModelProperty(value = "紧急联系人", position = 27)
|
||||
private String emergencyContact;
|
||||
|
||||
/** 紧急联系人电话 */
|
||||
@ApiModelProperty(value = "紧急联系人电话", position = 28)
|
||||
private String emergencyPhone;
|
||||
|
||||
/** 紧急联系人地址 */
|
||||
@ApiModelProperty(value = "紧急联系人地址", position = 29)
|
||||
private String emergencyAddress;
|
||||
|
||||
/** 上次登录ip */
|
||||
@ApiModelProperty(value = "上次登录ip", position = 30)
|
||||
private String lastLoginIp;
|
||||
|
||||
/** 上次登录地点 */
|
||||
@ApiModelProperty(value = "上次登录地点", position = 31)
|
||||
private String lastLoginAddress;
|
||||
|
||||
/** 上次登录时间 */
|
||||
@ApiModelProperty(value = "上次登录时间", position = 32)
|
||||
private Date lastLoginTime;
|
||||
|
||||
/** 上次登录设备 */
|
||||
@ApiModelProperty(value = "上次登录设备", position = 33)
|
||||
private String lastLoginDevice;
|
||||
|
||||
/** 最新登录ip */
|
||||
@ApiModelProperty(value = "最新登录ip", position = 34)
|
||||
private String latestLoginIp;
|
||||
|
||||
/** 最新登录地点 */
|
||||
@ApiModelProperty(value = "最新登录地点", position = 35)
|
||||
private String latestLoginAddress;
|
||||
|
||||
/** 最新登录时间 */
|
||||
@ApiModelProperty(value = "最新登录时间", position = 36)
|
||||
private Date latestLoginTime;
|
||||
|
||||
/** 最新登录设备 */
|
||||
@ApiModelProperty(value = "最新登录设备", position = 37)
|
||||
private String latestLoginDevice;
|
||||
|
||||
/** 用户状态 */
|
||||
@ApiModelProperty(value = "用户状态", position = 38)
|
||||
private String userStatus;
|
||||
|
||||
/** 排序码 */
|
||||
@ApiModelProperty(value = "排序码", position = 39)
|
||||
private Integer sortCode;
|
||||
|
||||
/** 扩展信息 */
|
||||
@ApiModelProperty(value = "扩展信息", position = 40)
|
||||
private String extJson;
|
||||
|
||||
/** 按钮码集合 */
|
||||
@ApiModelProperty(value = "按钮码集合", position = 41)
|
||||
private List<String> buttonCodeList;
|
||||
|
||||
/** 移动端按钮码集合 */
|
||||
@ApiModelProperty(value = "移动端按钮码集合", position = 42)
|
||||
private List<String> mobileButtonCodeList;
|
||||
|
||||
/** 权限码集合 */
|
||||
@ApiModelProperty(value = "权限码集合", position = 43, hidden = true)
|
||||
private List<String> permissionCodeList;
|
||||
|
||||
/** 角色码集合 */
|
||||
@ApiModelProperty(value = "角色码集合", position = 44, hidden = true)
|
||||
private List<String> roleCodeList;
|
||||
|
||||
/** 数据范围集合 */
|
||||
@ApiModelProperty(value = "数据范围集合", position = 45, hidden = true)
|
||||
private List<SaBaseClientLoginUser.DataScope> dataScopeList;
|
||||
|
||||
/** 用户密码hash值 */
|
||||
@ApiModelProperty(value = "用户密码hash值", position = 46)
|
||||
private String password;
|
||||
|
||||
/** 是否可登录,由继承类实现 */
|
||||
public abstract Boolean getEnabled();
|
||||
|
||||
/**
|
||||
* 数据范围类
|
||||
*
|
||||
*
|
||||
* @date 2022/8/15 13:57
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
public static class DataScope {
|
||||
|
||||
/** API接口 */
|
||||
@ApiModelProperty(value = "API接口", position = 1)
|
||||
private String apiUrl;
|
||||
|
||||
/** 数据范围 */
|
||||
@ApiModelProperty(value = "数据范围", position = 2)
|
||||
private List<String> dataScope;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
|
||||
package mjkf.xinke.auth.core.pojo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 基础的B端登录用户对象,可继承此类扩展更多属性
|
||||
*
|
||||
*
|
||||
* @date 2021/12/23 21:49
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public abstract class SaBaseLoginUser {
|
||||
|
||||
/** id */
|
||||
@ApiModelProperty(value = "id", position = 1)
|
||||
private String id;
|
||||
|
||||
/** 租户id */
|
||||
@ApiModelProperty(value = "租户id", position = 2)
|
||||
private String tenantId;
|
||||
|
||||
/** 头像 */
|
||||
@ApiModelProperty(value = "头像", position = 3)
|
||||
private String avatar;
|
||||
|
||||
/** 签名 */
|
||||
@ApiModelProperty(value = "签名", position = 4)
|
||||
private String signature;
|
||||
|
||||
/** 账号 */
|
||||
@ApiModelProperty(value = "账号", position = 5)
|
||||
private String account;
|
||||
|
||||
/** 姓名 */
|
||||
@ApiModelProperty(value = "姓名", position = 6)
|
||||
private String name;
|
||||
|
||||
/** 昵称 */
|
||||
@ApiModelProperty(value = "昵称", position = 7)
|
||||
private String nickname;
|
||||
|
||||
/** 性别 */
|
||||
@ApiModelProperty(value = "性别", position = 8)
|
||||
private String gender;
|
||||
|
||||
/** 年龄 */
|
||||
@ApiModelProperty(value = "年龄", position = 9)
|
||||
private String age;
|
||||
|
||||
/** 出生日期 */
|
||||
@ApiModelProperty(value = "出生日期", position = 10)
|
||||
private String birthday;
|
||||
|
||||
/** 民族 */
|
||||
@ApiModelProperty(value = "民族", position = 11)
|
||||
private String nation;
|
||||
|
||||
/** 籍贯 */
|
||||
@ApiModelProperty(value = "籍贯", position = 12)
|
||||
private String nativePlace;
|
||||
|
||||
/** 家庭住址 */
|
||||
@ApiModelProperty(value = "家庭住址", position = 13)
|
||||
private String homeAddress;
|
||||
|
||||
/** 通信地址 */
|
||||
@ApiModelProperty(value = "通信地址", position = 14)
|
||||
private String mailingAddress;
|
||||
|
||||
/** 证件类型 */
|
||||
@ApiModelProperty(value = "证件类型", position = 15)
|
||||
private String idCardType;
|
||||
|
||||
/** 证件号码 */
|
||||
@ApiModelProperty(value = "证件号码", position = 16)
|
||||
private String idCardNumber;
|
||||
|
||||
/** 文化程度 */
|
||||
@ApiModelProperty(value = "文化程度", position = 17)
|
||||
private String cultureLevel;
|
||||
|
||||
/** 政治面貌 */
|
||||
@ApiModelProperty(value = "政治面貌", position = 18)
|
||||
private String politicalOutlook;
|
||||
|
||||
/** 毕业院校 */
|
||||
@ApiModelProperty(value = "毕业院校", position = 19)
|
||||
private String college;
|
||||
|
||||
/** 学历 */
|
||||
@ApiModelProperty(value = "学历", position = 20)
|
||||
private String education;
|
||||
|
||||
/** 学制 */
|
||||
@ApiModelProperty(value = "学制", position = 21)
|
||||
private String eduLength;
|
||||
|
||||
/** 学位 */
|
||||
@ApiModelProperty(value = "学位", position = 22)
|
||||
private String degree;
|
||||
|
||||
/** 手机 */
|
||||
@ApiModelProperty(value = "手机", position = 23)
|
||||
private String phone;
|
||||
|
||||
/** 邮箱 */
|
||||
@ApiModelProperty(value = "邮箱", position = 24)
|
||||
private String email;
|
||||
|
||||
/** 家庭电话 */
|
||||
@ApiModelProperty(value = "家庭电话", position = 25)
|
||||
private String homeTel;
|
||||
|
||||
/** 办公电话 */
|
||||
@ApiModelProperty(value = "办公电话", position = 26)
|
||||
private String officeTel;
|
||||
|
||||
/** 紧急联系人 */
|
||||
@ApiModelProperty(value = "紧急联系人", position = 27)
|
||||
private String emergencyContact;
|
||||
|
||||
/** 紧急联系人电话 */
|
||||
@ApiModelProperty(value = "紧急联系人电话", position = 28)
|
||||
private String emergencyPhone;
|
||||
|
||||
/** 紧急联系人地址 */
|
||||
@ApiModelProperty(value = "紧急联系人地址", position = 29)
|
||||
private String emergencyAddress;
|
||||
|
||||
/** 员工编号 */
|
||||
@ApiModelProperty(value = "员工编号", position = 30)
|
||||
private String empNo;
|
||||
|
||||
/** 入职日期 */
|
||||
@ApiModelProperty(value = "入职日期", position = 31)
|
||||
private String entryDate;
|
||||
|
||||
/** 组织id */
|
||||
@ApiModelProperty(value = "组织id", position = 32)
|
||||
private String orgId;
|
||||
|
||||
/** 组织名称 */
|
||||
@ApiModelProperty(value = "组织名称", position = 33)
|
||||
private String orgName;
|
||||
|
||||
/** 职位id */
|
||||
@ApiModelProperty(value = "职位id", position = 34)
|
||||
private String positionId;
|
||||
|
||||
/** 职位名称 */
|
||||
@ApiModelProperty(value = "职位名称", position = 35)
|
||||
private String positionName;
|
||||
|
||||
/** 职级 */
|
||||
@ApiModelProperty(value = "职级", position = 36)
|
||||
private String positionLevel;
|
||||
|
||||
/** 主管id */
|
||||
@ApiModelProperty(value = "主管id", position = 37)
|
||||
private String directorId;
|
||||
|
||||
/** 兼任信息 */
|
||||
@ApiModelProperty(value = "兼任信息", position = 38)
|
||||
private String positionJson;
|
||||
|
||||
/** 上次登录ip */
|
||||
@ApiModelProperty(value = "上次登录ip", position = 39)
|
||||
private String lastLoginIp;
|
||||
|
||||
/** 上次登录地点 */
|
||||
@ApiModelProperty(value = "上次登录地点", position = 40)
|
||||
private String lastLoginAddress;
|
||||
|
||||
/** 上次登录时间 */
|
||||
@ApiModelProperty(value = "上次登录时间", position = 41)
|
||||
private Date lastLoginTime;
|
||||
|
||||
/** 上次登录设备 */
|
||||
@ApiModelProperty(value = "上次登录设备", position = 42)
|
||||
private String lastLoginDevice;
|
||||
|
||||
/** 最新登录ip */
|
||||
@ApiModelProperty(value = "最新登录ip", position = 43)
|
||||
private String latestLoginIp;
|
||||
|
||||
/** 最新登录地点 */
|
||||
@ApiModelProperty(value = "最新登录地点", position = 44)
|
||||
private String latestLoginAddress;
|
||||
|
||||
/** 最新登录时间 */
|
||||
@ApiModelProperty(value = "最新登录时间", position = 45)
|
||||
private Date latestLoginTime;
|
||||
|
||||
/** 最新登录设备 */
|
||||
@ApiModelProperty(value = "最新登录设备", position = 46)
|
||||
private String latestLoginDevice;
|
||||
|
||||
/** 用户状态 */
|
||||
@ApiModelProperty(value = "用户状态", position = 47)
|
||||
private String userStatus;
|
||||
|
||||
/** 排序码 */
|
||||
@ApiModelProperty(value = "排序码", position = 48)
|
||||
private Integer sortCode;
|
||||
|
||||
/** 扩展信息 */
|
||||
@ApiModelProperty(value = "扩展信息", position = 49)
|
||||
private String extJson;
|
||||
|
||||
/** 按钮码集合 */
|
||||
@ApiModelProperty(value = "按钮码集合", position = 50)
|
||||
private List<String> buttonCodeList;
|
||||
|
||||
/** 移动端按钮码集合 */
|
||||
@ApiModelProperty(value = "移动端按钮码集合", position = 51)
|
||||
private List<String> mobileButtonCodeList;
|
||||
|
||||
/** 权限码集合 */
|
||||
@ApiModelProperty(value = "权限码集合", position = 52, hidden = true)
|
||||
private List<String> permissionCodeList;
|
||||
|
||||
/** 角色码集合 */
|
||||
@ApiModelProperty(value = "角色码集合", position = 53, hidden = true)
|
||||
private List<String> roleCodeList;
|
||||
|
||||
/** 数据范围集合 */
|
||||
@ApiModelProperty(value = "数据范围集合", position = 54, hidden = true)
|
||||
private List<DataScope> dataScopeList;
|
||||
|
||||
/** 用户密码hash值 */
|
||||
@ApiModelProperty(value = "用户密码hash值", position = 55)
|
||||
private String password;
|
||||
|
||||
/** 是否可登录,由继承类实现 */
|
||||
public abstract Boolean getEnabled();
|
||||
|
||||
/**
|
||||
* 数据范围类
|
||||
*
|
||||
*
|
||||
* @date 2022/8/15 13:57
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
public static class DataScope {
|
||||
|
||||
/** API接口 */
|
||||
@ApiModelProperty(value = "API接口", position = 1)
|
||||
private String apiUrl;
|
||||
|
||||
/** 数据范围 */
|
||||
@ApiModelProperty(value = "数据范围", position = 2)
|
||||
private List<String> dataScope;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
package mjkf.xinke.auth.core.util;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import mjkf.xinke.auth.core.pojo.SaBaseClientLoginUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* C端登录用户工具类
|
||||
*
|
||||
*
|
||||
* @date 2022/7/8 10:40
|
||||
**/
|
||||
public class StpClientLoginUserUtil {
|
||||
|
||||
/**
|
||||
* 获取当前C端登录用户
|
||||
*
|
||||
*
|
||||
* @date 2022/7/8 10:41
|
||||
**/
|
||||
public static SaBaseClientLoginUser getClientLoginUser() {
|
||||
return (SaBaseClientLoginUser) StpClientUtil.getTokenSession().get("loginUser");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前C端登录用户的当前请求接口的数据范围(暂无数据范围)
|
||||
*
|
||||
*
|
||||
* @date 2022/7/8 10:41
|
||||
**/
|
||||
public static List<String> getLoginUserDataScope() {
|
||||
return CollectionUtil.newArrayList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,925 @@
|
||||
|
||||
package mjkf.xinke.auth.core.util;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.fun.SaFunction;
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||
import cn.dev33.satoken.stp.StpLogic;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Sa-Token 权限认证工具类 (C端用户版)
|
||||
*
|
||||
*
|
||||
* @date 2022/3/10 10:43
|
||||
**/
|
||||
public class StpClientUtil {
|
||||
|
||||
/**
|
||||
* 账号类型标识
|
||||
*/
|
||||
public static final String TYPE = "C";
|
||||
|
||||
/**
|
||||
* 底层的 StpLogic 对象,使用匿名子类 重写`stpLogic对象`的一些方法
|
||||
*/
|
||||
public static StpLogic stpLogic = new StpLogic(TYPE) {
|
||||
|
||||
/**
|
||||
* 重写 StpLogic 类下的 `splicingKeyTokenName` 函数,返回一个与 `StpUtil` 相同的token名称
|
||||
*/
|
||||
@Override
|
||||
public String splicingKeyTokenName() {
|
||||
return super.splicingKeyTokenName();
|
||||
}
|
||||
|
||||
// 此处可以根据需求重写其他方法
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取当前 StpLogic 的账号类型
|
||||
* @return See Note
|
||||
*/
|
||||
public static String getLoginType() {
|
||||
return stpLogic.getLoginType();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置 StpLogic 对象
|
||||
* @param stpLogic /
|
||||
*/
|
||||
public static void setStpLogic(StpLogic stpLogic) {
|
||||
StpUtil.stpLogic = stpLogic;
|
||||
// 防止自定义 stpLogic 被覆盖
|
||||
SaManager.putStpLogic(stpLogic);
|
||||
}
|
||||
|
||||
|
||||
// =================== 获取token 相关 ===================
|
||||
|
||||
/**
|
||||
* 返回token名称
|
||||
* @return 此StpLogic的token名称
|
||||
*/
|
||||
public static String getTokenName() {
|
||||
return stpLogic.getTokenName();
|
||||
}
|
||||
|
||||
/**
|
||||
* 在当前会话写入当前TokenValue
|
||||
* @param tokenValue token值
|
||||
*/
|
||||
public static void setTokenValue(String tokenValue) {
|
||||
stpLogic.setTokenValue(tokenValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 在当前会话写入当前TokenValue
|
||||
* @param tokenValue token值
|
||||
* @param cookieTimeout Cookie存活时间(秒)
|
||||
*/
|
||||
public static void setTokenValue(String tokenValue, int cookieTimeout) {
|
||||
stpLogic.setTokenValue(tokenValue, cookieTimeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前TokenValue
|
||||
* @return 当前tokenValue
|
||||
*/
|
||||
public static String getTokenValue() {
|
||||
return stpLogic.getTokenValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前TokenValue (不裁剪前缀)
|
||||
* @return /
|
||||
*/
|
||||
public static String getTokenValueNotCut() {
|
||||
return stpLogic.getTokenValueNotCut();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前会话的Token信息
|
||||
* @return token信息
|
||||
*/
|
||||
public static SaTokenInfo getTokenInfo() {
|
||||
return stpLogic.getTokenInfo();
|
||||
}
|
||||
|
||||
|
||||
// =================== 登录相关操作 ===================
|
||||
|
||||
// --- 登录
|
||||
|
||||
/**
|
||||
* 会话登录
|
||||
* @param id 账号id,建议的类型:(long | int | String)
|
||||
*/
|
||||
public static void login(Object id) {
|
||||
stpLogic.login(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 会话登录,并指定登录设备
|
||||
* @param id 账号id,建议的类型:(long | int | String)
|
||||
* @param device 设备标识
|
||||
*/
|
||||
public static void login(Object id, String device) {
|
||||
stpLogic.login(id, device);
|
||||
}
|
||||
|
||||
/**
|
||||
* 会话登录,并指定是否 [记住我]
|
||||
* @param id 账号id,建议的类型:(long | int | String)
|
||||
* @param isLastingCookie 是否为持久Cookie
|
||||
*/
|
||||
public static void login(Object id, boolean isLastingCookie) {
|
||||
stpLogic.login(id, isLastingCookie);
|
||||
}
|
||||
|
||||
/**
|
||||
* 会话登录,并指定所有登录参数Model
|
||||
* @param id 登录id,建议的类型:(long | int | String)
|
||||
* @param loginModel 此次登录的参数Model
|
||||
*/
|
||||
public static void login(Object id, SaLoginModel loginModel) {
|
||||
stpLogic.login(id, loginModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建指定账号id的登录会话
|
||||
* @param id 登录id,建议的类型:(long | int | String)
|
||||
* @return 返回会话令牌
|
||||
*/
|
||||
public static String createLoginSession(Object id) {
|
||||
return stpLogic.createLoginSession(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建指定账号id的登录会话
|
||||
* @param id 登录id,建议的类型:(long | int | String)
|
||||
* @param loginModel 此次登录的参数Model
|
||||
* @return 返回会话令牌
|
||||
*/
|
||||
public static String createLoginSession(Object id, SaLoginModel loginModel) {
|
||||
return stpLogic.createLoginSession(id, loginModel);
|
||||
}
|
||||
|
||||
// --- 注销
|
||||
|
||||
/**
|
||||
* 会话注销
|
||||
*/
|
||||
public static void logout() {
|
||||
stpLogic.logout();
|
||||
}
|
||||
|
||||
/**
|
||||
* 会话注销,根据账号id
|
||||
* @param loginId 账号id
|
||||
*/
|
||||
public static void logout(Object loginId) {
|
||||
stpLogic.logout(loginId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 会话注销,根据账号id 和 设备标识
|
||||
*
|
||||
* @param loginId 账号id
|
||||
* @param device 设备标识 (填null代表所有注销设备)
|
||||
*/
|
||||
public static void logout(Object loginId, String device) {
|
||||
stpLogic.logout(loginId, device);
|
||||
}
|
||||
|
||||
/**
|
||||
* 会话注销,根据指定 Token
|
||||
*
|
||||
* @param tokenValue 指定token
|
||||
*/
|
||||
public static void logoutByTokenValue(String tokenValue) {
|
||||
stpLogic.logoutByTokenValue(tokenValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 踢人下线,根据账号id
|
||||
* <p> 当对方再次访问系统时,会抛出NotLoginException异常,场景值=-5 </p>
|
||||
*
|
||||
* @param loginId 账号id
|
||||
*/
|
||||
public static void kickout(Object loginId) {
|
||||
stpLogic.kickout(loginId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 踢人下线,根据账号id 和 设备标识
|
||||
* <p> 当对方再次访问系统时,会抛出NotLoginException异常,场景值=-5 </p>
|
||||
*
|
||||
* @param loginId 账号id
|
||||
* @param device 设备标识 (填null代表踢出所有设备)
|
||||
*/
|
||||
public static void kickout(Object loginId, String device) {
|
||||
stpLogic.kickout(loginId, device);
|
||||
}
|
||||
|
||||
/**
|
||||
* 踢人下线,根据指定 Token
|
||||
* <p> 当对方再次访问系统时,会抛出NotLoginException异常,场景值=-5 </p>
|
||||
*
|
||||
* @param tokenValue 指定token
|
||||
*/
|
||||
public static void kickoutByTokenValue(String tokenValue) {
|
||||
stpLogic.kickoutByTokenValue(tokenValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 顶人下线,根据账号id 和 设备标识
|
||||
* <p> 当对方再次访问系统时,会抛出NotLoginException异常,场景值=-4 </p>
|
||||
*
|
||||
* @param loginId 账号id
|
||||
* @param device 设备标识 (填null代表顶替所有设备)
|
||||
*/
|
||||
public static void replaced(Object loginId, String device) {
|
||||
stpLogic.replaced(loginId, device);
|
||||
}
|
||||
|
||||
|
||||
// 查询相关
|
||||
|
||||
/**
|
||||
* 当前会话是否已经登录
|
||||
* @return 是否已登录
|
||||
*/
|
||||
public static boolean isLogin() {
|
||||
return stpLogic.isLogin();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检验当前会话是否已经登录,如未登录,则抛出异常
|
||||
*/
|
||||
public static void checkLogin() {
|
||||
stpLogic.checkLogin();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前会话账号id, 如果未登录,则抛出异常
|
||||
* @return 账号id
|
||||
*/
|
||||
public static Object getLoginId() {
|
||||
return stpLogic.getLoginId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前会话账号id, 如果未登录,则返回默认值
|
||||
* @param <T> 返回类型
|
||||
* @param defaultValue 默认值
|
||||
* @return 登录id
|
||||
*/
|
||||
public static <T> T getLoginId(T defaultValue) {
|
||||
return stpLogic.getLoginId(defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前会话账号id, 如果未登录,则返回null
|
||||
* @return 账号id
|
||||
*/
|
||||
public static Object getLoginIdDefaultNull() {
|
||||
return stpLogic.getLoginIdDefaultNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前会话账号id, 并转换为String类型
|
||||
* @return 账号id
|
||||
*/
|
||||
public static String getLoginIdAsString() {
|
||||
return stpLogic.getLoginIdAsString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前会话账号id, 并转换为int类型
|
||||
* @return 账号id
|
||||
*/
|
||||
public static int getLoginIdAsInt() {
|
||||
return stpLogic.getLoginIdAsInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前会话账号id, 并转换为long类型
|
||||
* @return 账号id
|
||||
*/
|
||||
public static long getLoginIdAsLong() {
|
||||
return stpLogic.getLoginIdAsLong();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定Token对应的账号id,如果未登录,则返回 null
|
||||
* @param tokenValue token
|
||||
* @return 账号id
|
||||
*/
|
||||
public static Object getLoginIdByToken(String tokenValue) {
|
||||
return stpLogic.getLoginIdByToken(tokenValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Token扩展信息(只在jwt模式下有效)
|
||||
* @param key 键值
|
||||
* @return 对应的扩展数据
|
||||
*/
|
||||
public static Object getExtra(String key) {
|
||||
return stpLogic.getExtra(key);
|
||||
}
|
||||
|
||||
|
||||
// =================== User-Session 相关 ===================
|
||||
|
||||
/**
|
||||
* 获取指定账号id的Session, 如果Session尚未创建,isCreate=是否新建并返回
|
||||
* @param loginId 账号id
|
||||
* @param isCreate 是否新建
|
||||
* @return Session对象
|
||||
*/
|
||||
public static SaSession getSessionByLoginId(Object loginId, boolean isCreate) {
|
||||
return stpLogic.getSessionByLoginId(loginId, isCreate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定key的Session, 如果Session尚未创建,则返回null
|
||||
* @param sessionId SessionId
|
||||
* @return Session对象
|
||||
*/
|
||||
public static SaSession getSessionBySessionId(String sessionId) {
|
||||
return stpLogic.getSessionBySessionId(sessionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定账号id的Session,如果Session尚未创建,则新建并返回
|
||||
* @param loginId 账号id
|
||||
* @return Session对象
|
||||
*/
|
||||
public static SaSession getSessionByLoginId(Object loginId) {
|
||||
return stpLogic.getSessionByLoginId(loginId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前会话的Session, 如果Session尚未创建,isCreate=是否新建并返回
|
||||
* @param isCreate 是否新建
|
||||
* @return Session对象
|
||||
*/
|
||||
public static SaSession getSession(boolean isCreate) {
|
||||
return stpLogic.getSession(isCreate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前会话的Session,如果Session尚未创建,则新建并返回
|
||||
* @return Session对象
|
||||
*/
|
||||
public static SaSession getSession() {
|
||||
return stpLogic.getSession();
|
||||
}
|
||||
|
||||
|
||||
// =================== Token-Session 相关 ===================
|
||||
|
||||
/**
|
||||
* 获取指定Token-Session,如果Session尚未创建,则新建并返回
|
||||
* @param tokenValue Token值
|
||||
* @return Session对象
|
||||
*/
|
||||
public static SaSession getTokenSessionByToken(String tokenValue) {
|
||||
return stpLogic.getTokenSessionByToken(tokenValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前Token-Session,如果Session尚未创建,则新建并返回
|
||||
* @return Session对象
|
||||
*/
|
||||
public static SaSession getTokenSession() {
|
||||
return stpLogic.getTokenSession();
|
||||
}
|
||||
|
||||
|
||||
// =================== [临时有效期] 验证相关 ===================
|
||||
|
||||
/**
|
||||
* 检查当前token 是否已经[临时过期],如果已经过期则抛出异常
|
||||
*/
|
||||
public static void checkActivityTimeout() {
|
||||
stpLogic.checkActivityTimeout();
|
||||
}
|
||||
|
||||
/**
|
||||
* 续签当前token:(将 [最后操作时间] 更新为当前时间戳)
|
||||
* <h1>请注意: 即时token已经 [临时过期] 也可续签成功,
|
||||
* 如果此场景下需要提示续签失败,可在此之前调用 checkActivityTimeout() 强制检查是否过期即可 </h1>
|
||||
*/
|
||||
public static void updateLastActivityToNow() {
|
||||
stpLogic.updateLastActivityToNow();
|
||||
}
|
||||
|
||||
|
||||
// =================== 过期时间相关 ===================
|
||||
|
||||
/**
|
||||
* 获取当前登录者的 token 剩余有效时间 (单位: 秒)
|
||||
* @return token剩余有效时间
|
||||
*/
|
||||
public static long getTokenTimeout() {
|
||||
return stpLogic.getTokenTimeout();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录者的 User-Session 剩余有效时间 (单位: 秒)
|
||||
* @return token剩余有效时间
|
||||
*/
|
||||
public static long getSessionTimeout() {
|
||||
return stpLogic.getSessionTimeout();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前 Token-Session 剩余有效时间 (单位: 秒)
|
||||
* @return token剩余有效时间
|
||||
*/
|
||||
public static long getTokenSessionTimeout() {
|
||||
return stpLogic.getTokenSessionTimeout();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前 token [临时过期] 剩余有效时间 (单位: 秒)
|
||||
* @return token [临时过期] 剩余有效时间
|
||||
*/
|
||||
public static long getTokenActivityTimeout() {
|
||||
return stpLogic.getTokenActivityTimeout();
|
||||
}
|
||||
|
||||
/**
|
||||
* 对当前 Token 的 timeout 值进行续期
|
||||
* @param timeout 要修改成为的有效时间 (单位: 秒)
|
||||
*/
|
||||
public static void renewTimeout(long timeout) {
|
||||
stpLogic.renewTimeout(timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对指定 Token 的 timeout 值进行续期
|
||||
* @param tokenValue 指定token
|
||||
* @param timeout 要修改成为的有效时间 (单位: 秒)
|
||||
*/
|
||||
public static void renewTimeout(String tokenValue, long timeout) {
|
||||
stpLogic.renewTimeout(tokenValue, timeout);
|
||||
}
|
||||
|
||||
// =================== 角色验证操作 ===================
|
||||
|
||||
/**
|
||||
* 获取:当前账号的角色集合
|
||||
* @return /
|
||||
*/
|
||||
public static List<String> getRoleList() {
|
||||
return stpLogic.getRoleList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取:指定账号的角色集合
|
||||
* @param loginId 指定账号id
|
||||
* @return /
|
||||
*/
|
||||
public static List<String> getRoleList(Object loginId) {
|
||||
return stpLogic.getRoleList(loginId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断:当前账号是否拥有指定角色, 返回true或false
|
||||
* @param role 角色标识
|
||||
* @return 是否含有指定角色标识
|
||||
*/
|
||||
public static boolean hasRole(String role) {
|
||||
return stpLogic.hasRole(role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断:指定账号是否含有指定角色标识, 返回true或false
|
||||
* @param loginId 账号id
|
||||
* @param role 角色标识
|
||||
* @return 是否含有指定角色标识
|
||||
*/
|
||||
public static boolean hasRole(Object loginId, String role) {
|
||||
return stpLogic.hasRole(loginId, role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断:当前账号是否含有指定角色标识 [指定多个,必须全部验证通过]
|
||||
* @param roleArray 角色标识数组
|
||||
* @return true或false
|
||||
*/
|
||||
public static boolean hasRoleAnd(String... roleArray) {
|
||||
return stpLogic.hasRoleAnd(roleArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断:当前账号是否含有指定角色标识 [指定多个,只要其一验证通过即可]
|
||||
* @param roleArray 角色标识数组
|
||||
* @return true或false
|
||||
*/
|
||||
public static boolean hasRoleOr(String... roleArray) {
|
||||
return stpLogic.hasRoleOr(roleArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验:当前账号是否含有指定角色标识, 如果验证未通过,则抛出异常: NotRoleException
|
||||
* @param role 角色标识
|
||||
*/
|
||||
public static void checkRole(String role) {
|
||||
stpLogic.checkRole(role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验:当前账号是否含有指定角色标识 [指定多个,必须全部验证通过]
|
||||
* @param roleArray 角色标识数组
|
||||
*/
|
||||
public static void checkRoleAnd(String... roleArray) {
|
||||
stpLogic.checkRoleAnd(roleArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验:当前账号是否含有指定角色标识 [指定多个,只要其一验证通过即可]
|
||||
* @param roleArray 角色标识数组
|
||||
*/
|
||||
public static void checkRoleOr(String... roleArray) {
|
||||
stpLogic.checkRoleOr(roleArray);
|
||||
}
|
||||
|
||||
|
||||
// =================== 权限验证操作 ===================
|
||||
|
||||
/**
|
||||
* 获取:当前账号的权限码集合
|
||||
* @return /
|
||||
*/
|
||||
public static List<String> getPermissionList() {
|
||||
return stpLogic.getPermissionList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取:指定账号的权限码集合
|
||||
* @param loginId 指定账号id
|
||||
* @return /
|
||||
*/
|
||||
public static List<String> getPermissionList(Object loginId) {
|
||||
return stpLogic.getPermissionList(loginId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断:当前账号是否含有指定权限, 返回true或false
|
||||
* @param permission 权限码
|
||||
* @return 是否含有指定权限
|
||||
*/
|
||||
public static boolean hasPermission(String permission) {
|
||||
return stpLogic.hasPermission(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断:指定账号id是否含有指定权限, 返回true或false
|
||||
* @param loginId 账号id
|
||||
* @param permission 权限码
|
||||
* @return 是否含有指定权限
|
||||
*/
|
||||
public static boolean hasPermission(Object loginId, String permission) {
|
||||
return stpLogic.hasPermission(loginId, permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断:当前账号是否含有指定权限, [指定多个,必须全部具有]
|
||||
* @param permissionArray 权限码数组
|
||||
* @return true 或 false
|
||||
*/
|
||||
public static boolean hasPermissionAnd(String... permissionArray) {
|
||||
return stpLogic.hasPermissionAnd(permissionArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断:当前账号是否含有指定权限 [指定多个,只要其一验证通过即可]
|
||||
* @param permissionArray 权限码数组
|
||||
* @return true 或 false
|
||||
*/
|
||||
public static boolean hasPermissionOr(String... permissionArray) {
|
||||
return stpLogic.hasPermissionOr(permissionArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验:当前账号是否含有指定权限, 如果验证未通过,则抛出异常: NotPermissionException
|
||||
* @param permission 权限码
|
||||
*/
|
||||
public static void checkPermission(String permission) {
|
||||
stpLogic.checkPermission(permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验:当前账号是否含有指定权限 [指定多个,必须全部验证通过]
|
||||
* @param permissionArray 权限码数组
|
||||
*/
|
||||
public static void checkPermissionAnd(String... permissionArray) {
|
||||
stpLogic.checkPermissionAnd(permissionArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验:当前账号是否含有指定权限 [指定多个,只要其一验证通过即可]
|
||||
* @param permissionArray 权限码数组
|
||||
*/
|
||||
public static void checkPermissionOr(String... permissionArray) {
|
||||
stpLogic.checkPermissionOr(permissionArray);
|
||||
}
|
||||
|
||||
|
||||
// =================== id 反查token 相关操作 ===================
|
||||
|
||||
/**
|
||||
* 获取指定账号id的tokenValue
|
||||
* <p> 在配置为允许并发登录时,此方法只会返回队列的最后一个token,
|
||||
* 如果你需要返回此账号id的所有token,请调用 getTokenValueListByLoginId
|
||||
* @param loginId 账号id
|
||||
* @return token值
|
||||
*/
|
||||
public static String getTokenValueByLoginId(Object loginId) {
|
||||
return stpLogic.getTokenValueByLoginId(loginId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定账号id指定设备端的tokenValue
|
||||
* <p> 在配置为允许并发登录时,此方法只会返回队列的最后一个token,
|
||||
* 如果你需要返回此账号id的所有token,请调用 getTokenValueListByLoginId
|
||||
* @param loginId 账号id
|
||||
* @param device 设备标识
|
||||
* @return token值
|
||||
*/
|
||||
public static String getTokenValueByLoginId(Object loginId, String device) {
|
||||
return stpLogic.getTokenValueByLoginId(loginId, device);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定账号id的tokenValue集合
|
||||
* @param loginId 账号id
|
||||
* @return 此loginId的所有相关token
|
||||
*/
|
||||
public static List<String> getTokenValueListByLoginId(Object loginId) {
|
||||
return stpLogic.getTokenValueListByLoginId(loginId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定账号id指定设备端的tokenValue 集合
|
||||
* @param loginId 账号id
|
||||
* @param device 设备标识
|
||||
* @return 此loginId的所有相关token
|
||||
*/
|
||||
public static List<String> getTokenValueListByLoginId(Object loginId, String device) {
|
||||
return stpLogic.getTokenValueListByLoginId(loginId, device);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回当前会话的登录设备
|
||||
* @return 当前令牌的登录设备
|
||||
*/
|
||||
public static String getLoginDevice() {
|
||||
return stpLogic.getLoginDevice();
|
||||
}
|
||||
|
||||
|
||||
// =================== 会话管理 ===================
|
||||
|
||||
/**
|
||||
* 根据条件查询Token
|
||||
* @param keyword 关键字
|
||||
* @param start 开始处索引 (-1代表查询所有)
|
||||
* @param size 获取数量
|
||||
* @return token集合
|
||||
*/
|
||||
public static List<String> searchTokenValue(String keyword, int start, int size, boolean sortType) {
|
||||
return stpLogic.searchTokenValue(keyword, start, size, sortType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询SessionId
|
||||
* @param keyword 关键字
|
||||
* @param start 开始处索引 (-1代表查询所有)
|
||||
* @param size 获取数量
|
||||
* @return sessionId集合
|
||||
*/
|
||||
public static List<String> searchSessionId(String keyword, int start, int size, boolean sortType) {
|
||||
return stpLogic.searchSessionId(keyword, start, size, sortType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询Token专属Session的Id
|
||||
* @param keyword 关键字
|
||||
* @param start 开始处索引 (-1代表查询所有)
|
||||
* @param size 获取数量
|
||||
* @return sessionId集合
|
||||
*/
|
||||
public static List<String> searchTokenSessionId(String keyword, int start, int size, boolean sortType) {
|
||||
return stpLogic.searchTokenSessionId(keyword, start, size, sortType);
|
||||
}
|
||||
|
||||
|
||||
// ------------------- 账号封禁 -------------------
|
||||
|
||||
/**
|
||||
* 封禁指定账号
|
||||
* <p> 此方法不会直接将此账号id踢下线,而是在对方再次登录时抛出`DisableLoginException`异常
|
||||
* @param loginId 指定账号id
|
||||
* @param disableTime 封禁时间, 单位: 秒 (-1=永久封禁)
|
||||
*/
|
||||
public static void disable(Object loginId, long disableTime) {
|
||||
stpLogic.disable(loginId, disableTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定账号是否已被封禁 (true=已被封禁, false=未被封禁)
|
||||
* @param loginId 账号id
|
||||
* @return see note
|
||||
*/
|
||||
public static boolean isDisable(Object loginId) {
|
||||
return stpLogic.isDisable(loginId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定账号剩余封禁时间,单位:秒(-1=永久封禁,-2=未被封禁)
|
||||
* @param loginId 账号id
|
||||
* @return see note
|
||||
*/
|
||||
public static long getDisableTime(Object loginId) {
|
||||
return stpLogic.getDisableTime(loginId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解封指定账号
|
||||
* @param loginId 账号id
|
||||
*/
|
||||
public static void untieDisable(Object loginId) {
|
||||
stpLogic.untieDisable(loginId);
|
||||
}
|
||||
|
||||
|
||||
// =================== 身份切换 ===================
|
||||
|
||||
/**
|
||||
* 临时切换身份为指定账号id
|
||||
* @param loginId 指定loginId
|
||||
*/
|
||||
public static void switchTo(Object loginId) {
|
||||
stpLogic.switchTo(loginId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束临时切换身份
|
||||
*/
|
||||
public static void endSwitch() {
|
||||
stpLogic.endSwitch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前是否正处于[身份临时切换]中
|
||||
* @return 是否正处于[身份临时切换]中
|
||||
*/
|
||||
public static boolean isSwitch() {
|
||||
return stpLogic.isSwitch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 在一个代码段里方法内,临时切换身份为指定账号id
|
||||
* @param loginId 指定账号id
|
||||
* @param function 要执行的方法
|
||||
*/
|
||||
public static void switchTo(Object loginId, SaFunction function) {
|
||||
stpLogic.switchTo(loginId, function);
|
||||
}
|
||||
|
||||
|
||||
// ------------------- 二级认证 -------------------
|
||||
|
||||
/**
|
||||
* 在当前会话 开启二级认证
|
||||
* @param safeTime 维持时间 (单位: 秒)
|
||||
*/
|
||||
public static void openSafe(long safeTime) {
|
||||
stpLogic.openSafe(safeTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前会话 是否处于二级认证时间内
|
||||
* @return true=二级认证已通过, false=尚未进行二级认证或认证已超时
|
||||
*/
|
||||
public static boolean isSafe() {
|
||||
return stpLogic.isSafe();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查当前会话是否已通过二级认证,如未通过则抛出异常
|
||||
*/
|
||||
public static void checkSafe() {
|
||||
stpLogic.checkSafe();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前会话的二级认证剩余有效时间 (单位: 秒, 返回-2代表尚未通过二级认证)
|
||||
* @return 剩余有效时间
|
||||
*/
|
||||
public static long getSafeTime() {
|
||||
return stpLogic.getSafeTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 在当前会话 结束二级认证
|
||||
*/
|
||||
public static void closeSafe() {
|
||||
stpLogic.closeSafe();
|
||||
}
|
||||
|
||||
|
||||
// =================== 历史API,兼容旧版本 ===================
|
||||
|
||||
/**
|
||||
* <h1> 本函数设计已过时,未来版本可能移除此函数,请及时更换为 StpUtil.getLoginType() ,使用方式保持不变 </h1>
|
||||
*
|
||||
* 获取当前StpLogin的loginKey
|
||||
* @return 当前StpLogin的loginKey
|
||||
*/
|
||||
@Deprecated
|
||||
public static String getLoginKey() {
|
||||
return stpLogic.getLoginType();
|
||||
}
|
||||
|
||||
/**
|
||||
* <h1> 本函数设计已过时,未来版本可能移除此函数,请及时更换为 StpUtil.login() ,使用方式保持不变 </h1>
|
||||
*
|
||||
* 在当前会话上登录id
|
||||
* @param loginId 登录id,建议的类型:(long | int | String)
|
||||
*/
|
||||
@Deprecated
|
||||
public static void setLoginId(Object loginId) {
|
||||
stpLogic.login(loginId);
|
||||
}
|
||||
|
||||
/**
|
||||
* <h1> 本函数设计已过时,未来版本可能移除此函数,请及时更换为 StpUtil.login() ,使用方式保持不变 </h1>
|
||||
*
|
||||
* 在当前会话上登录id, 并指定登录设备
|
||||
* @param loginId 登录id,建议的类型:(long | int | String)
|
||||
* @param device 设备标识
|
||||
*/
|
||||
@Deprecated
|
||||
public static void setLoginId(Object loginId, String device) {
|
||||
stpLogic.login(loginId, device);
|
||||
}
|
||||
|
||||
/**
|
||||
* <h1> 本函数设计已过时,未来版本可能移除此函数,请及时更换为 StpUtil.login() ,使用方式保持不变 </h1>
|
||||
*
|
||||
* 在当前会话上登录id, 并指定登录设备
|
||||
* @param loginId 登录id,建议的类型:(long | int | String)
|
||||
* @param isLastingCookie 是否为持久Cookie
|
||||
*/
|
||||
@Deprecated
|
||||
public static void setLoginId(Object loginId, boolean isLastingCookie) {
|
||||
stpLogic.login(loginId, isLastingCookie);
|
||||
}
|
||||
|
||||
/**
|
||||
* <h1> 本函数设计已过时,未来版本可能移除此函数,请及时更换为 StpUtil.login() ,使用方式保持不变 </h1>
|
||||
*
|
||||
* 在当前会话上登录id, 并指定所有登录参数Model
|
||||
* @param loginId 登录id,建议的类型:(long | int | String)
|
||||
* @param loginModel 此次登录的参数Model
|
||||
*/
|
||||
@Deprecated
|
||||
public static void setLoginId(Object loginId, SaLoginModel loginModel) {
|
||||
stpLogic.login(loginId, loginModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* <h1> 本函数设计已过时,未来版本可能移除此函数,请及时更换为 StpUtil.kickout() ,使用方式保持不变 </h1>
|
||||
*
|
||||
* 会话注销,根据账号id (踢人下线)
|
||||
* <p> 当对方再次访问系统时,会抛出NotLoginException异常,场景值=-2
|
||||
* @param loginId 账号id
|
||||
*/
|
||||
@Deprecated
|
||||
public static void logoutByLoginId(Object loginId) {
|
||||
stpLogic.kickout(loginId);
|
||||
}
|
||||
|
||||
/**
|
||||
* <h1> 本函数设计已过时,未来版本可能移除此函数,请及时更换为 StpUtil.kickout() ,使用方式保持不变 </h1>
|
||||
*
|
||||
* 会话注销,根据账号id and 设备标识 (踢人下线)
|
||||
* <p> 当对方再次访问系统时,会抛出NotLoginException异常,场景值=-2 </p>
|
||||
* @param loginId 账号id
|
||||
* @param device 设备标识 (填null代表所有注销设备)
|
||||
*/
|
||||
@Deprecated
|
||||
public static void logoutByLoginId(Object loginId, String device) {
|
||||
stpLogic.kickout(loginId, device);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
|
||||
package mjkf.xinke.auth.core.util;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import mjkf.xinke.auth.core.pojo.SaBaseLoginUser;
|
||||
import mjkf.xinke.common.util.CommonServletUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* B端登录用户工具类
|
||||
*
|
||||
*
|
||||
* @date 2022/7/8 10:40
|
||||
**/
|
||||
public class StpLoginUserUtil {
|
||||
|
||||
/**
|
||||
* 获取当前B端登录用户
|
||||
*
|
||||
*
|
||||
* @date 2022/7/8 10:41
|
||||
**/
|
||||
public static SaBaseLoginUser getLoginUser() {
|
||||
return (SaBaseLoginUser) StpUtil.getTokenSession().get("loginUser");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前B端登录用户的当前请求接口的数据范围
|
||||
*
|
||||
*
|
||||
* @date 2022/7/8 10:41
|
||||
**/
|
||||
public static List<String> getLoginUserDataScope() {
|
||||
List<String> resultList = CollectionUtil.newArrayList();
|
||||
getLoginUser().getDataScopeList().forEach(dataScope -> {
|
||||
if(dataScope.getApiUrl().equals(CommonServletUtil.getRequest().getServletPath())) {
|
||||
resultList.addAll(dataScope.getDataScope());
|
||||
}
|
||||
});
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-biz-api/pom.xml
Normal file
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-biz-api/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-plugin-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mjkf-xinke-plugin-biz-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>业务功能插件api接口</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 每个插件接口都要引入common -->
|
||||
<dependency>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
package mjkf.xinke.biz;
|
||||
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-client-api/pom.xml
Normal file
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-client-api/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-plugin-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mjkf-xinke-plugin-client-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>C端功能插件api接口</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 每个插件接口都要引入common -->
|
||||
<dependency>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
package mjkf.xinke.client;
|
||||
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-dbs-api/pom.xml
Normal file
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-dbs-api/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-plugin-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mjkf-xinke-plugin-dbs-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>多数据源插件api接口</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 每个插件接口都要引入common -->
|
||||
<dependency>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.baomidou.dynamic.datasource.annotation;
|
||||
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 数据源切换注解
|
||||
*
|
||||
*
|
||||
* @date 2022/6/14 18:14
|
||||
**/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface DS {
|
||||
|
||||
/**
|
||||
* 组名称或特定的数据库名称或spring SPEL名称。
|
||||
*
|
||||
*
|
||||
* @date 2022/6/14 18:15
|
||||
**/
|
||||
String value();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.baomidou.dynamic.datasource.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* @date 2022/6/14 18:15
|
||||
**/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface DSTransactional {
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.baomidou.dynamic.datasource.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 主数据源
|
||||
*
|
||||
*
|
||||
* @date 2022/6/14 18:15
|
||||
**/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@DS("master")
|
||||
public @interface Master {
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.baomidou.dynamic.datasource.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 从数据源
|
||||
*
|
||||
*
|
||||
* @date 2022/6/14 18:15
|
||||
**/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@DS("slave")
|
||||
public @interface Slave {
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
|
||||
package mjkf.xinke.dbs.api;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据源API接口
|
||||
*
|
||||
*
|
||||
* @date 2022/3/8 16:30
|
||||
**/
|
||||
public interface DbsApi {
|
||||
|
||||
/**
|
||||
* 获取默认的数据源名称
|
||||
*
|
||||
*
|
||||
* @date 2022/3/11 14:25
|
||||
**/
|
||||
String getDefaultDataSourceName();
|
||||
|
||||
/**
|
||||
* 获取当前正在使用的数据源名称
|
||||
*
|
||||
*
|
||||
* @date 2022/3/8 16:31
|
||||
**/
|
||||
String getCurrentDataSourceName();
|
||||
|
||||
/**
|
||||
* 获取当前正在使用的数据源ID
|
||||
*
|
||||
*
|
||||
* @date 2022/8/5 14:01
|
||||
**/
|
||||
String getCurrentDataSourceId();
|
||||
|
||||
/**
|
||||
* 获取当前正在使用的数据源
|
||||
*
|
||||
*
|
||||
* @date 2022/3/8 16:31
|
||||
**/
|
||||
DataSource getCurrentDataSource();
|
||||
|
||||
/**
|
||||
* 切换数据源
|
||||
*
|
||||
* @param name 数据源名称
|
||||
*
|
||||
* @date 2022/3/8 16:31
|
||||
**/
|
||||
void changeDataSource(String name);
|
||||
|
||||
/**
|
||||
* 获取数据源详情
|
||||
*
|
||||
*
|
||||
* @date 2022/7/11 17:53
|
||||
*/
|
||||
JSONObject dbsDetail(String dbsId);
|
||||
|
||||
/**
|
||||
* 获取全部数据源列表
|
||||
*
|
||||
*
|
||||
* @date 2022/7/11 17:53
|
||||
*/
|
||||
List<JSONObject> dbsSelector();
|
||||
|
||||
/**
|
||||
* 获取租户数据源列表,只查询租户类型数据源
|
||||
*
|
||||
*
|
||||
* @date 2022/7/11 17:53
|
||||
*/
|
||||
List<JSONObject> tenDbsSelector();
|
||||
|
||||
/**
|
||||
* 根据表名称获取字段名称列表
|
||||
*
|
||||
*
|
||||
* @date 2022/7/19 18:47
|
||||
**/
|
||||
List<String> tableColumns(String tableName);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
package mjkf.xinke.dbs.core.consts;
|
||||
|
||||
/**
|
||||
* 数据源 plugin 常量
|
||||
*
|
||||
* @author : dongxiayu
|
||||
* @date : 2022/3/8 10:14
|
||||
*/
|
||||
public interface DbsConstant {
|
||||
|
||||
/**
|
||||
* 主数据源名称
|
||||
*/
|
||||
String MASTER_DATASOURCE_NAME = "MASTER";
|
||||
|
||||
}
|
||||
124
mjkf-xinke-plugin-api/mjkf-xinke-plugin-dev-api/pom.xml
Normal file
124
mjkf-xinke-plugin-api/mjkf-xinke-plugin-dev-api/pom.xml
Normal file
@@ -0,0 +1,124 @@
|
||||
<?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>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-plugin-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mjkf-xinke-plugin-dev-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>开发工具插件api接口</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 每个插件接口都要引入common -->
|
||||
<dependency>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--腾讯云上传文件客户端-->
|
||||
<dependency>
|
||||
<groupId>com.qcloud</groupId>
|
||||
<artifactId>cos_api</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>tencentcloud-sdk-java-common</artifactId>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<groupId>joda-time</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!--阿里云上传文件客户端-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>commons-logging</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.jettison</groupId>
|
||||
<artifactId>jettison</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- jettison -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jettison</groupId>
|
||||
<artifactId>jettison</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--minio上传文件客户端-->
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--java邮件发送-->
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>javax.mail</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--阿里云邮件发送-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-dm</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 腾讯云邮件发送 -->
|
||||
<dependency>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
<artifactId>tencentcloud-sdk-java-ses</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>okio-jvm</artifactId>
|
||||
<groupId>com.squareup.okio</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>commons-logging</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!--阿里云短信发送-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>dysmsapi20170525</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>org.jacoco.agent</artifactId>
|
||||
<groupId>org.jacoco</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!--腾讯云短信发送-->
|
||||
<dependency>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
<artifactId>tencentcloud-sdk-java-sms</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--系统硬件信息-->
|
||||
<dependency>
|
||||
<groupId>com.github.oshi</groupId>
|
||||
<artifactId>oshi-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
package mjkf.xinke.dev.api;
|
||||
|
||||
/**
|
||||
* 开发工具模块综合API
|
||||
*
|
||||
*
|
||||
* @date 2022/9/26 14:24
|
||||
**/
|
||||
public interface DevApi {
|
||||
|
||||
/**
|
||||
* 初始化ID类型的租户开发工具模块数据
|
||||
*
|
||||
*
|
||||
* @date 2022/9/26 14:25
|
||||
**/
|
||||
void initTenDataForCategoryId(String tenId, String tenName);
|
||||
|
||||
/**
|
||||
* 删除ID类型的租户开发工具模块数据
|
||||
*
|
||||
*
|
||||
* @date 2022/9/26 14:25
|
||||
**/
|
||||
void removeTenDataForCategoryId(String tenId);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
package mjkf.xinke.dev.api;
|
||||
|
||||
/**
|
||||
* 配置APi接口
|
||||
*
|
||||
*
|
||||
* @date 2022/6/17 10:37
|
||||
**/
|
||||
public interface DevConfigApi {
|
||||
|
||||
/**
|
||||
* 根据键获取值
|
||||
*
|
||||
*
|
||||
* @date 2022/6/17 11:11
|
||||
**/
|
||||
String getValueByKey(String key);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
package mjkf.xinke.dev.api;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 动态字段API
|
||||
*
|
||||
*
|
||||
* @date 2022/9/2 15:58
|
||||
*/
|
||||
public interface DevDfcApi {
|
||||
|
||||
/**
|
||||
* 获取动态字段配置
|
||||
*
|
||||
*
|
||||
* @date 2022/7/22 14:47
|
||||
**/
|
||||
List<JSONObject> getTableFieldList(String dbsId, String tableName);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
package mjkf.xinke.dev.api;
|
||||
|
||||
/**
|
||||
* 字典API
|
||||
*
|
||||
*
|
||||
* @date 2022/9/2 15:58
|
||||
*/
|
||||
public interface DevDictApi {
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
|
||||
package mjkf.xinke.dev.api;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 邮件API接口
|
||||
*
|
||||
*
|
||||
* @date 2022/6/22 15:21
|
||||
**/
|
||||
public interface DevEmailApi {
|
||||
|
||||
/* =========本地邮件========= */
|
||||
|
||||
/**
|
||||
* 发送纯文本邮件
|
||||
*
|
||||
* @param tos 收件人邮箱,逗号拼接
|
||||
* @param subject 邮件主题
|
||||
* @param content 邮件内容
|
||||
* @param files 附件列表
|
||||
*
|
||||
* @date 2022/2/7 22:29
|
||||
*/
|
||||
void sendTextEmailLocal(String tos, String subject, String content, List<File> files);
|
||||
|
||||
/**
|
||||
* 发送HTML邮件
|
||||
*
|
||||
* @param tos 收件人邮箱,逗号拼接
|
||||
* @param subject 邮件主题
|
||||
* @param content 邮件内容
|
||||
* @param imageMap – 图片与占位符,占位符格式为cid:$IMAGE_PLACEHOLDER
|
||||
* @param files 附件列表
|
||||
*
|
||||
* @date 2022/2/7 22:29
|
||||
*/
|
||||
void sendHtmlEmailLocal(String tos, String subject, String content, Map<String, InputStream> imageMap, List<File> files);
|
||||
|
||||
/* =========阿里云邮件========= */
|
||||
|
||||
/**
|
||||
* 发送纯文本邮件(不使用模板,频率限制100 QPS)
|
||||
*
|
||||
* @param from 管理控制台中配置的发信地址,必传且必须正确
|
||||
* @param user 发信人昵称,长度小于15个字符,可不传
|
||||
* @param tos 目标地址,多个 email 地址可以用逗号分隔,最多100个地址,必传且必须正确
|
||||
* @param subject 邮件主题,必传
|
||||
* @param content 邮件 txt 正文,限制28K,必传
|
||||
*
|
||||
* @date 2022/2/23 14:24
|
||||
**/
|
||||
void sendTextEmailAliyun(String from, String user, String tos, String subject, String content);
|
||||
|
||||
/**
|
||||
* 发送HTML邮件(不使用模板,频率限制100 QPS)
|
||||
*
|
||||
* @param from 管理控制台中配置的发信地址,必传且必须正确
|
||||
* @param user 发信人昵称,长度小于15个字符,可不传
|
||||
* @param tos 目标地址,多个 email 地址可以用逗号分隔,最多100个地址,必传且必须正确
|
||||
* @param subject 邮件主题,必传
|
||||
* @param content 邮件 html 正文,限制28K,必传
|
||||
*
|
||||
* @date 2022/2/23 14:24
|
||||
**/
|
||||
void sendHtmlEmailAliyun(String from, String user, String tos, String subject, String content);
|
||||
|
||||
/**
|
||||
* 使用模板发送邮件,国内频率限制是20/min;海外频率限制是10/min。
|
||||
*
|
||||
* @param from 管理控制台中配置的发信地址,必传且必须正确
|
||||
* @param tagName 控制台创建的邮件标签,可不传
|
||||
* @param toName 预先创建且上传了收件人的收件人列表名称,必传且必须正确
|
||||
* @param templateName 预先创建且通过审核的模板名称,必传且必须正确
|
||||
*
|
||||
* @date 2022/2/23 14:24
|
||||
**/
|
||||
void sendEmailWithTemplateAliyun(String from, String tagName, String toName, String templateName);
|
||||
|
||||
/* =========腾讯云邮件========= */
|
||||
|
||||
/**
|
||||
* 发送纯文本邮件(不使用模板,默认接口请求频率限制:20次/秒。)
|
||||
*
|
||||
* @param from 管理控制台中配置的发信地址,必传且必须正确
|
||||
* @param user 发信人昵称,可不传
|
||||
* @param tos 目标地址,多个 email 地址可以用逗号分隔,最多50个地址,必传且必须正确,非群发邮件请多次调用API发送
|
||||
* @param subject 邮件主题,必传
|
||||
* @param content 邮件 txt 正文,必传,注意:腾讯云api目前要求请求包大小不得超过8 MB。
|
||||
* @param attachmentList 需要发送附件时,填写附件相关参数,格式:[{"FileName": "xxxx", "Content": "xxx"}]
|
||||
* 支持的格式与说明见:https://cloud.tencent.com/document/api/1288/51053#Attachment
|
||||
*
|
||||
* @date 2022/2/23 14:24
|
||||
**/
|
||||
void sendTextEmailTencent(String from, String user, String tos, String subject, String content, List<JSONObject> attachmentList);
|
||||
|
||||
/**
|
||||
* 发送HTML邮件(不使用模板,默认接口请求频率限制:20次/秒。)
|
||||
*
|
||||
* @param from 管理控制台中配置的发信地址,必传且必须正确
|
||||
* @param user 发信人昵称,可不传
|
||||
* @param tos 目标地址,多个 email 地址可以用逗号分隔,最多50个地址,必传且必须正确,非群发邮件请多次调用API发送
|
||||
* @param subject 邮件主题,必传
|
||||
* @param content 邮件 txt 正文,必传,注意:腾讯云api目前要求请求包大小不得超过8 MB。
|
||||
* @param attachmentList 需要发送附件时,填写附件相关参数,格式:[{"FileName": "xxxx", "Content": "xxx"}]
|
||||
* 支持的格式与说明见:https://cloud.tencent.com/document/api/1288/51053#Attachment
|
||||
*
|
||||
* @date 2022/2/23 14:24
|
||||
**/
|
||||
void sendHtmlEmailTencent(String from, String user, String tos, String subject, String content, List<JSONObject> attachmentList);
|
||||
|
||||
/**
|
||||
* 使用模板发送邮件,默认接口请求频率限制:20次/秒。
|
||||
*
|
||||
* @param from 管理控制台中配置的发信地址,必传且必须正确
|
||||
* @param user 发信人昵称,可不传
|
||||
* @param toId 预先创建且上传了收件人的收件人列表id,必传且必须正确
|
||||
* @param templateId 预先创建且通过审核的模板Id,必传且必须正确
|
||||
* @param templateParam 预先创建且通过审核的模板的参数json,格式{"name":"张三"},可不传
|
||||
* @param subject 邮件主题,必传
|
||||
*
|
||||
* @date 2022/2/23 14:24
|
||||
**/
|
||||
void sendEmailWithTemplateTencent(String from, String user, String toId, String templateId, String templateParam, String subject, List<JSONObject> attachmentList);
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
|
||||
package mjkf.xinke.dev.api;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 文件API接口,可参考mjkf.xinke.dev.core.util.file包下的工具类扩展更多需要的方法
|
||||
*
|
||||
*
|
||||
* @date 2022/6/22 15:21
|
||||
**/
|
||||
public interface DevFileApi {
|
||||
|
||||
/* =========本地文件========= */
|
||||
|
||||
/**
|
||||
* 上传文件返回Url
|
||||
*
|
||||
* @param file 文件
|
||||
*
|
||||
* @date 2022/6/22 17:44
|
||||
**/
|
||||
String storageFileWithReturnUrlLocal(MultipartFile file);
|
||||
|
||||
/**
|
||||
* 上传文件返回Id
|
||||
*
|
||||
* @param file 文件
|
||||
*
|
||||
* @date 2022/6/22 17:44
|
||||
**/
|
||||
String storageFileWithReturnIdLocal(MultipartFile file);
|
||||
|
||||
/* =========阿里云文件========= */
|
||||
|
||||
/**
|
||||
* 上传文件返回Url
|
||||
*
|
||||
* @param file 文件
|
||||
*
|
||||
* @date 2022/6/22 17:44
|
||||
**/
|
||||
String storageFileWithReturnUrlAliyun(MultipartFile file);
|
||||
|
||||
/**
|
||||
* 上传文件返回Id
|
||||
*
|
||||
* @param file 文件
|
||||
*
|
||||
* @date 2022/6/22 17:44
|
||||
**/
|
||||
String storageFileWithReturnIdAliyun(MultipartFile file);
|
||||
|
||||
/* =========腾讯云件========= */
|
||||
|
||||
/**
|
||||
* 上传文件返回Url
|
||||
*
|
||||
* @param file 文件
|
||||
*
|
||||
* @date 2022/6/22 17:44
|
||||
**/
|
||||
String storageFileWithReturnUrlTencent(MultipartFile file);
|
||||
|
||||
/**
|
||||
* 上传文件返回Id
|
||||
*
|
||||
* @param file 文件
|
||||
*
|
||||
* @date 2022/6/22 17:44
|
||||
**/
|
||||
String storageFileWithReturnIdTencent(MultipartFile file);
|
||||
|
||||
/* =========MINIO件========= */
|
||||
|
||||
/**
|
||||
* 上传文件返回Url
|
||||
*
|
||||
* @param file 文件
|
||||
*
|
||||
* @date 2022/6/22 17:44
|
||||
**/
|
||||
String storageFileWithReturnUrlMinio(MultipartFile file);
|
||||
|
||||
/**
|
||||
* 上传文件返回Id
|
||||
*
|
||||
* @param file 文件
|
||||
*
|
||||
* @date 2022/6/22 17:44
|
||||
**/
|
||||
String storageFileWithReturnIdMinio(MultipartFile file);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
package mjkf.xinke.dev.api;
|
||||
|
||||
/**
|
||||
* 定时任务API
|
||||
*
|
||||
*
|
||||
* @date 2022/9/2 15:59
|
||||
*/
|
||||
public interface DevJobApi {
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
package mjkf.xinke.dev.api;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 日志API
|
||||
*
|
||||
*
|
||||
* @date 2022/9/2 15:59
|
||||
*/
|
||||
public interface DevLogApi {
|
||||
|
||||
/**
|
||||
* 记录登录日志
|
||||
*
|
||||
*
|
||||
* @date 2022/9/2 16:03
|
||||
*/
|
||||
void executeLoginLog(String userName);
|
||||
|
||||
/**
|
||||
* 记录登出日志
|
||||
*
|
||||
*
|
||||
* @date 2022/9/2 16:03
|
||||
*/
|
||||
void executeLogoutLog(String userName);
|
||||
|
||||
/**
|
||||
* 获取当前用户的访问日志列表
|
||||
*
|
||||
*
|
||||
* @date 2022/9/4 15:12
|
||||
*/
|
||||
List<JSONObject> currentUserVisLogList();
|
||||
|
||||
/**
|
||||
* 获取当前用户的操作日志列表
|
||||
*
|
||||
*
|
||||
* @date 2022/9/4 15:12
|
||||
*/
|
||||
List<JSONObject> currentUserOpLogList();
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
|
||||
package mjkf.xinke.dev.api;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 站内信API接口
|
||||
*
|
||||
*
|
||||
* @date 2022/6/22 17:33
|
||||
**/
|
||||
public interface DevMessageApi {
|
||||
|
||||
/**
|
||||
* 发送站内信,默认:分类系统通知
|
||||
*
|
||||
* @param receiverIdList 接收的用户id集合
|
||||
* @param subject 主题
|
||||
*
|
||||
* @date 2022/6/22 17:35
|
||||
**/
|
||||
void sendMessage(List<String> receiverIdList, String subject);
|
||||
|
||||
/**
|
||||
* 发送站内信指定分类
|
||||
*
|
||||
* @param receiverIdList 接收的用户id集合
|
||||
* @param subject 主题
|
||||
*
|
||||
* @date 2022/6/22 17:35
|
||||
**/
|
||||
void sendMessage(List<String> receiverIdList, String category, String subject);
|
||||
|
||||
/**
|
||||
* 发送站内信带内容,默认:分类系统通知
|
||||
*
|
||||
* @param receiverIdList 接收的用户id集合
|
||||
* @param subject 主题
|
||||
* @param content 站内信内容
|
||||
*
|
||||
* @date 2022/6/22 17:35
|
||||
**/
|
||||
void sendMessageWithContent(List<String> receiverIdList, String subject, String content);
|
||||
|
||||
/**
|
||||
* 发送站内信带内容,指定分类
|
||||
*
|
||||
* @param receiverIdList 接收的用户id集合
|
||||
* @param subject 主题
|
||||
* @param content 站内信内容
|
||||
*
|
||||
* @date 2022/6/22 17:35
|
||||
**/
|
||||
void sendMessageWithContent(List<String> receiverIdList, String category, String subject, String content);
|
||||
|
||||
/**
|
||||
* 获取未读站内信列表
|
||||
*
|
||||
*
|
||||
* @date 2022/9/2 11:48
|
||||
*/
|
||||
List<JSONObject> list(List<String> receiverIdList, Integer limit);
|
||||
|
||||
/**
|
||||
* 获取未读站内信数量
|
||||
*
|
||||
* @author diantu
|
||||
* @date 2023/7/10
|
||||
*/
|
||||
Long unreadCount(String loginId);
|
||||
|
||||
/**
|
||||
* 获取站内信分页
|
||||
*
|
||||
*
|
||||
* @date 2022/9/2 11:48
|
||||
*/
|
||||
Page<JSONObject> page(List<String> receiverIdList, String category);
|
||||
|
||||
/**
|
||||
* 获取站内信详情
|
||||
*
|
||||
* @param id 站内信id
|
||||
*
|
||||
* @date 2022/4/24 20:08
|
||||
*/
|
||||
JSONObject detail(String id);
|
||||
|
||||
/**
|
||||
* 站内信全部标记已读
|
||||
*
|
||||
* @author diantu
|
||||
* @date 2023/7/10
|
||||
*/
|
||||
void allMessageMarkRead();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
|
||||
package mjkf.xinke.dev.api;
|
||||
|
||||
/**
|
||||
* 短信API
|
||||
*
|
||||
*
|
||||
* @date 2022/6/22 15:22
|
||||
**/
|
||||
public interface DevSmsApi {
|
||||
|
||||
/* =========阿里云邮件========= */
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
*
|
||||
* @param phoneNumbers 手机号码,支持对多个手机号码发送短信,手机号码之间以半角逗号(,)分隔。
|
||||
* 上限为1000个手机号码。批量调用相对于单条调用及时性稍有延迟。
|
||||
* @param signName 短信服务控制台配置且审核通过的短信签名
|
||||
* @param templateCode 短信服务控制台配置且审核通过的模板编码
|
||||
* @param templateParam 短信模板变量对应的实际值,JSON格式。支持传入多个参数,示例:{"name":"张三","number":"15038****76"}
|
||||
*
|
||||
* @date 2022/2/24 13:42
|
||||
**/
|
||||
void sendSmsAliyun(String phoneNumbers, String signName, String templateCode, String templateParam);
|
||||
|
||||
/* =========腾讯云邮件========= */
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
*
|
||||
* @param sdkAppId 短信 SdkAppId,在 短信控制台 添加应用后生成的实际 SdkAppId,示例如1400006666。
|
||||
* 可前往 [短信控制台](https://console.cloud.tencent.com/smsv2/app-manage) 查看
|
||||
* @param phoneNumbers 手机号码,支持对多个手机号码发送短信,手机号码之间以半角逗号(,)分隔。
|
||||
* 上限为1000个手机号码。批量调用相对于单条调用及时性稍有延迟。
|
||||
* @param signName 短信服务控制台配置且审核通过的短信签名
|
||||
* @param templateCode 短信服务控制台配置且审核通过的模板编码
|
||||
* @param templateParam 短信模板变量对应的顺序。支持传入多个参数,逗号拼接,示例:"张三,15038****76,进行中"}
|
||||
*
|
||||
* @date 2022/2/24 13:42
|
||||
**/
|
||||
void sendSmsTencent(String sdkAppId, String phoneNumbers, String signName, String templateCode, String templateParam);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
|
||||
package mjkf.xinke.dev.api;
|
||||
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
import mjkf.xinke.common.sse.CommonSseParam;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* SSE API接口
|
||||
*
|
||||
* @author diantu
|
||||
* @date 2023/7/5
|
||||
**/
|
||||
public interface DevSseApi {
|
||||
|
||||
/**
|
||||
* 创建SSE连接
|
||||
*
|
||||
* @param clientId 客户端id,不传则自动生成
|
||||
* @param setHeartBeat 是否设置心跳定时任务,默认为false(true:设置 false:不设置)
|
||||
* @param defaultHeartbeat 是否使用默认心跳任务
|
||||
* @param consumer 自定义心跳任务,需要自定义实现Consumer接口中的accept方法(setHeartBeat必须为true,defaultHeartbeat为false才有意义)
|
||||
* @return 初次建立连接会推送客户端id,状态码为0
|
||||
* @author diantu
|
||||
* @date 2023/7/5
|
||||
**/
|
||||
public SseEmitter createSseConnect(String clientId, Boolean setHeartBeat, Boolean defaultHeartbeat, Consumer<CommonSseParam> consumer);
|
||||
|
||||
/**
|
||||
* 关闭连接
|
||||
*
|
||||
* @param clientId 客户端id
|
||||
* @author diantu
|
||||
* @date 2023/7/5
|
||||
**/
|
||||
public void closeSseConnect(String clientId);
|
||||
|
||||
/**
|
||||
* 推送消息到所有客户端
|
||||
*
|
||||
* @param msg 推送消息
|
||||
* @author diantu
|
||||
* @date 2023/7/5
|
||||
**/
|
||||
public void sendMessageToAllClient(String msg);
|
||||
|
||||
/**
|
||||
* 根据clientId发送消息给某一客户端
|
||||
*
|
||||
* @param clientId 客户端id
|
||||
* @param msg 推送消息
|
||||
* @author diantu
|
||||
* @date 2023/7/5
|
||||
**/
|
||||
public void sendMessageToOneClient(String clientId, String msg);
|
||||
|
||||
}
|
||||
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-exm-api/pom.xml
Normal file
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-exm-api/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-plugin-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mjkf-xinke-plugin-exm-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>功能案例插件api接口</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 每个插件接口都要引入common -->
|
||||
<dependency>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
package mjkf.xinke.exm;
|
||||
42
mjkf-xinke-plugin-api/mjkf-xinke-plugin-flw-api/pom.xml
Normal file
42
mjkf-xinke-plugin-api/mjkf-xinke-plugin-flw-api/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>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-plugin-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mjkf-xinke-plugin-flw-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>工作流程插件api接口</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 每个插件接口都要引入common -->
|
||||
<dependency>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- camunda工作流引擎 -->
|
||||
<dependency>
|
||||
<groupId>org.camunda.bpm.springboot</groupId>
|
||||
<artifactId>camunda-bpm-spring-boot-starter</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>camunda-commons-utils</artifactId>
|
||||
<groupId>org.camunda.commons</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- 单独引入camunda-commons-utils -->
|
||||
<dependency>
|
||||
<groupId>org.camunda.commons</groupId>
|
||||
<artifactId>camunda-commons-utils</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
package mjkf.xinke.flw;
|
||||
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-gen-api/pom.xml
Normal file
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-gen-api/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-plugin-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mjkf-xinke-plugin-gen-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>代码生成插件api接口</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 每个插件接口都要引入common -->
|
||||
<dependency>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
package mjkf.xinke.gen;
|
||||
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-mobile-api/pom.xml
Normal file
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-mobile-api/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-plugin-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mjkf-xinke-plugin-mobile-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>移动端管理插件api接口</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 每个插件接口都要引入common -->
|
||||
<dependency>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
package mjkf.xinke.mobile.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 移动端按钮API
|
||||
*
|
||||
*
|
||||
* @date 2023/2/1 9:52
|
||||
**/
|
||||
public interface MobileButtonApi {
|
||||
|
||||
/**
|
||||
* 根据按钮id集合获取按钮码列表
|
||||
*
|
||||
*
|
||||
* @date 2023/2/5 13:26
|
||||
**/
|
||||
List<String> listByIds(List<String> idList);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
package mjkf.xinke.mobile.api;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 移动端菜单API
|
||||
*
|
||||
*
|
||||
* @date 2023/1/31 10:09
|
||||
**/
|
||||
public interface MobileMenuApi {
|
||||
|
||||
/**
|
||||
* 获取移动端菜单授权树
|
||||
*
|
||||
*
|
||||
* @date 2023/1/31 10:10
|
||||
**/
|
||||
List<JSONObject> mobileMenuTreeSelector();
|
||||
|
||||
/**
|
||||
* 获取移动端登录菜单树
|
||||
*
|
||||
*
|
||||
* @date 2023/1/31 10:29
|
||||
**/
|
||||
List<Tree<String>> loginMobileMenuTree(List<String> menuIdList);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
package mjkf.xinke.mobile.api;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 移动端菜单API
|
||||
*
|
||||
*
|
||||
* @date 2023/1/31 10:09
|
||||
**/
|
||||
public interface MobileModuleApi {
|
||||
|
||||
/**
|
||||
* 获取移动端模块选择器
|
||||
*
|
||||
*
|
||||
* @date 2023/7/15 22:01
|
||||
**/
|
||||
List<JSONObject> mobileModuleSelector();
|
||||
}
|
||||
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-pay-api/pom.xml
Normal file
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-pay-api/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-plugin-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mjkf-xinke-plugin-pay-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>支付功能插件api接口</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 每个插件接口都要引入common -->
|
||||
<dependency>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
package mjkf.xinke.pay;
|
||||
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-sys-api/pom.xml
Normal file
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-sys-api/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-plugin-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mjkf-xinke-plugin-sys-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>系统功能插件api接口</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 每个插件接口都要引入common -->
|
||||
<dependency>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
package mjkf.xinke.sys.api;
|
||||
|
||||
/**
|
||||
* 系统模块综合API
|
||||
*
|
||||
*
|
||||
* @date 2022/9/26 14:24
|
||||
**/
|
||||
public interface SysApi {
|
||||
|
||||
/**
|
||||
* 初始化ID类型的租户系统模块数据
|
||||
*
|
||||
*
|
||||
* @date 2022/9/26 14:25
|
||||
**/
|
||||
void initTenDataForCategoryId(String tenId, String tenName);
|
||||
|
||||
/**
|
||||
* 删除ID类型的租户系统模块数据
|
||||
*
|
||||
*
|
||||
* @date 2022/9/26 14:25
|
||||
**/
|
||||
void removeTenDataForCategoryId(String tenId);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
package mjkf.xinke.sys.api;
|
||||
|
||||
/**
|
||||
* 按钮API
|
||||
*
|
||||
*
|
||||
* @date 2022/11/1 13:45
|
||||
**/
|
||||
public interface SysButtonApi {
|
||||
|
||||
/**
|
||||
* 代码生成按钮插入
|
||||
*
|
||||
*
|
||||
* @date 2022/11/1 13:48
|
||||
**/
|
||||
void addForGenButton(String menuId, String className, String functionName);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
package mjkf.xinke.sys.api;
|
||||
|
||||
/**
|
||||
* 菜单API
|
||||
*
|
||||
*
|
||||
* @date 2022/11/1 13:44
|
||||
**/
|
||||
public interface SysMenuApi {
|
||||
|
||||
/**
|
||||
* 代码生成菜单插入
|
||||
*
|
||||
*
|
||||
* @date 2022/11/1 13:48
|
||||
**/
|
||||
String addForGenMenu(String parentId, String busName, String module, String title, String path);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
|
||||
package mjkf.xinke.sys.api;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组织API
|
||||
*
|
||||
*
|
||||
* @date 2022/6/6 11:35
|
||||
**/
|
||||
public interface SysOrgApi {
|
||||
|
||||
/**
|
||||
* 根据id获取名称
|
||||
*
|
||||
*
|
||||
* @date 2022/8/4 10:12
|
||||
**/
|
||||
String getNameById(String orgId);
|
||||
|
||||
/**
|
||||
* 根据组织id获取部门主管id
|
||||
*
|
||||
*
|
||||
* @date 2022/6/6 14:50
|
||||
**/
|
||||
String getSupervisorIdByOrgId(String orgId);
|
||||
|
||||
/**
|
||||
* 获取组织树选择器
|
||||
*
|
||||
*
|
||||
* @date 2022/7/22 14:46
|
||||
**/
|
||||
List<Tree<String>> orgTreeSelector();
|
||||
|
||||
/**
|
||||
* 获取组织列表选择器
|
||||
*
|
||||
*
|
||||
* @date 2022/7/22 14:45
|
||||
**/
|
||||
Page<JSONObject> orgListSelector(String parentId);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
package mjkf.xinke.sys.api;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 职位API
|
||||
*
|
||||
*
|
||||
* @date 2022/6/6 11:35
|
||||
**/
|
||||
public interface SysPositionApi {
|
||||
|
||||
/**
|
||||
* 根据id获取名称
|
||||
*
|
||||
*
|
||||
* @date 2022/8/4 10:13
|
||||
**/
|
||||
String getNameById(String positionId);
|
||||
|
||||
/**
|
||||
* 获取职位选择器
|
||||
*
|
||||
*
|
||||
* @date 2022/7/22 14:47
|
||||
**/
|
||||
Page<JSONObject> positionSelector(String orgId, String searchKey);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
package mjkf.xinke.sys.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 关系API
|
||||
*
|
||||
*
|
||||
* @date 2022/6/6 11:41
|
||||
**/
|
||||
public interface SysRelationApi {
|
||||
|
||||
/**
|
||||
* 根据角色id集合获取角色下用户id集合
|
||||
*
|
||||
*
|
||||
* @date 2022/6/6 11:43
|
||||
**/
|
||||
List<String> getUserIdListByRoleIdList(List<String> roleIdList);
|
||||
|
||||
/**
|
||||
* 根据移动端菜单Id集合移除角色和移动端菜单关系
|
||||
*
|
||||
*
|
||||
* @date 2023/1/31 9:54
|
||||
**/
|
||||
void removeRoleHasMobileMenuRelation(List<String> targetIdList);
|
||||
|
||||
/**
|
||||
* 清除对应的角色与移动端菜单信息中的【授权的移动端按钮信息】
|
||||
*
|
||||
*
|
||||
* @date 2023/1/31 9:54
|
||||
**/
|
||||
void removeRoleHasMobileButtonRelation(List<String> targetIdList, List<String> buttonIdList);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
|
||||
package mjkf.xinke.sys.api;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色API
|
||||
*
|
||||
*
|
||||
* @date 2022/6/6 11:36
|
||||
**/
|
||||
public interface SysRoleApi {
|
||||
|
||||
/**
|
||||
* 判断组织下是否存在角色
|
||||
*
|
||||
*
|
||||
* @date 2022/8/2 11:16
|
||||
*/
|
||||
boolean orgHasRole(List<String> orgIdList);
|
||||
|
||||
/**
|
||||
* 获取角色选择器
|
||||
*
|
||||
*
|
||||
* @date 2022/7/22 14:49
|
||||
**/
|
||||
Page<JSONObject> roleSelector(String orgId, String category, String searchKey, List<String> dataScopeList, boolean excludeSuperAdmin);
|
||||
|
||||
/**
|
||||
* 代码生成菜单按钮授权
|
||||
*
|
||||
*
|
||||
* @date 2022/11/1 15:58
|
||||
**/
|
||||
void grantForGenMenuAndButton(String menuId);
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
|
||||
package mjkf.xinke.sys.api;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户Api
|
||||
*
|
||||
*
|
||||
* @date 2022/6/6 11:33
|
||||
**/
|
||||
public interface SysUserApi {
|
||||
|
||||
/**
|
||||
* 根据用户id获取用户对象,没有则返回null
|
||||
*
|
||||
*
|
||||
* @date 2022/6/20 18:19
|
||||
**/
|
||||
JSONObject getUserByIdWithoutException(String userId);
|
||||
|
||||
/**
|
||||
* 根据用户id获取用户对象列表,没有的则为空,都没有则返回空集合
|
||||
*
|
||||
*
|
||||
* @date 2022/6/20 18:19
|
||||
**/
|
||||
List<JSONObject> getUserListByIdListWithoutException(List<String> userIdList);
|
||||
|
||||
/**
|
||||
* 根据用户id获取用户对象,没有则抛出异常
|
||||
*
|
||||
*
|
||||
* @date 2022/6/20 18:19
|
||||
**/
|
||||
JSONObject getUserByIdWithException(String userId);
|
||||
|
||||
/**
|
||||
* 根据用户id获取用户对象列表,只要有一个没有则抛出异常
|
||||
*
|
||||
*
|
||||
* @date 2022/6/20 18:19
|
||||
**/
|
||||
List<JSONObject> getUserListByIdWithException(List<String> userIdList);
|
||||
|
||||
/**
|
||||
* 获取用户拥有角色
|
||||
*
|
||||
*
|
||||
* @date 2022/5/13 21:00
|
||||
*/
|
||||
List<String> ownRole(String userId);
|
||||
|
||||
/**
|
||||
* 给用户授权角色
|
||||
*
|
||||
*
|
||||
* @date 2022/8/1 18:28
|
||||
*/
|
||||
void grantRole(String userId, List<String> roleIdList);
|
||||
|
||||
/**
|
||||
* 根据组织id集合获取组织下用户id集合
|
||||
*
|
||||
*
|
||||
* @date 2022/6/6 11:40
|
||||
**/
|
||||
List<String> getUserIdListByOrgIdList(List<String> orgIdList);
|
||||
|
||||
/**
|
||||
* 根据职位id集合获取职位下用户id集合
|
||||
*
|
||||
*
|
||||
* @date 2022/6/6 11:44
|
||||
**/
|
||||
List<String> getUserIdListByPositionIdList(List<String> positionIdList);
|
||||
|
||||
/**
|
||||
* 根据用户id和组织id和职位id和主管层级获取上级主管id
|
||||
*
|
||||
*
|
||||
* @date 2022/6/6 14:50
|
||||
**/
|
||||
JSONObject getSupervisorIdBySupervisorLevel(List<String> userIdList, String userId, String orgId, String supervisorLevel);
|
||||
|
||||
/**
|
||||
* 根据用户id和组织id和职位id和终点主管层级获取上级主管id集合
|
||||
*
|
||||
*
|
||||
* @date 2022/6/6 14:50
|
||||
**/
|
||||
List<String> getMulSupervisorIdListByEndLevel(String userId, String orgId, String endLevel);
|
||||
|
||||
/**
|
||||
* 获取用户选择器
|
||||
*
|
||||
*
|
||||
* @date 2022/4/24 20:08
|
||||
*/
|
||||
Page<JSONObject> userSelector(String orgId, String searchKey);
|
||||
}
|
||||
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-ten-api/pom.xml
Normal file
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-ten-api/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-plugin-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mjkf-xinke-plugin-ten-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>动态租户插件api接口</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 每个插件接口都要引入common -->
|
||||
<dependency>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,51 @@
|
||||
|
||||
package mjkf.xinke.ten.api;
|
||||
|
||||
/**
|
||||
* 多租户API接口
|
||||
*
|
||||
*
|
||||
* @date 2022/3/10 18:54
|
||||
**/
|
||||
public interface TenApi {
|
||||
|
||||
/**
|
||||
* 获取是否开启多租户
|
||||
*
|
||||
*
|
||||
* @date 2022/7/19 18:34
|
||||
**/
|
||||
boolean getTenEnabled();
|
||||
|
||||
/**
|
||||
* 获取租户id隔离的租户模式下,租户字段名称
|
||||
*
|
||||
*
|
||||
* @date 2022/7/20 18:10
|
||||
**/
|
||||
String getDefaultTenColumnName();
|
||||
|
||||
/**
|
||||
* 获取默认租户id
|
||||
*
|
||||
*
|
||||
* @date 2022/7/19 19:30
|
||||
**/
|
||||
String getDefaultTenId();
|
||||
|
||||
/**
|
||||
* 获取当前的租户id
|
||||
*
|
||||
*
|
||||
* @date 2022/6/14 15:04
|
||||
**/
|
||||
String getCurrentTenId();
|
||||
|
||||
/**
|
||||
* 获取当前的租户域名
|
||||
*
|
||||
*
|
||||
* @date 2022/6/14 15:04
|
||||
**/
|
||||
String getCurrentTenDomain();
|
||||
}
|
||||
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-urp-api/pom.xml
Normal file
24
mjkf-xinke-plugin-api/mjkf-xinke-plugin-urp-api/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-plugin-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mjkf-xinke-plugin-urp-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>报表设计插件api接口</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 每个插件接口都要引入common -->
|
||||
<dependency>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
package mjkf.xinke.urp;
|
||||
57
mjkf-xinke-plugin-api/pom.xml
Normal file
57
mjkf-xinke-plugin-api/pom.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?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>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-boot</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mjkf-xinke-plugin-api</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<description>插件API接口模块</description>
|
||||
|
||||
<modules>
|
||||
<!-- 登录鉴权插件api接口 -->
|
||||
<module>mjkf-xinke-plugin-auth-api</module>
|
||||
|
||||
<!-- 业务功能插件api接口 -->
|
||||
<module>mjkf-xinke-plugin-biz-api</module>
|
||||
|
||||
<!-- C端功能插件api接口 -->
|
||||
<module>mjkf-xinke-plugin-client-api</module>
|
||||
|
||||
<!-- 多数据源插件api接口 -->
|
||||
<module>mjkf-xinke-plugin-dbs-api</module>
|
||||
|
||||
<!-- 开发工具插件api接口 -->
|
||||
<module>mjkf-xinke-plugin-dev-api</module>
|
||||
|
||||
<!-- 功能案例插件api接口 -->
|
||||
<module>mjkf-xinke-plugin-exm-api</module>
|
||||
|
||||
<!-- 工作流程插件api接口 -->
|
||||
<module>mjkf-xinke-plugin-flw-api</module>
|
||||
|
||||
<!-- 支付功能插件api接口 -->
|
||||
<module>mjkf-xinke-plugin-pay-api</module>
|
||||
|
||||
<!-- 代码生成插件api接口 -->
|
||||
<module>mjkf-xinke-plugin-gen-api</module>
|
||||
|
||||
<!-- 移动端管理插件api接口 -->
|
||||
<module>mjkf-xinke-plugin-mobile-api</module>
|
||||
|
||||
<!-- 系统功能插件api接口 -->
|
||||
<module>mjkf-xinke-plugin-sys-api</module>
|
||||
|
||||
<!-- 动态租户插件api接口 -->
|
||||
<module>mjkf-xinke-plugin-ten-api</module>
|
||||
|
||||
<!-- 报表设计插件api接口 -->
|
||||
<module>mjkf-xinke-plugin-urp-api</module>
|
||||
</modules>
|
||||
</project>
|
||||
Reference in New Issue
Block a user