统一权限和单点登录基础实体类
This commit is contained in:
@@ -101,6 +101,13 @@
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--统一门户解密-->
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk18on</artifactId>
|
||||
<version>1.77</version>
|
||||
</dependency>
|
||||
|
||||
<!-- pool 对象池 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.ruoyi.common.core.domain.entity.tymh.authority;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QxRegister {
|
||||
|
||||
@ApiModelProperty("用户名 String(40)")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty("登录名 String(100)")
|
||||
private String loginName;
|
||||
|
||||
@ApiModelProperty("密码 String(100) 经过一次md5")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty("证件类型 String(2) 固定01")
|
||||
private String certType;
|
||||
|
||||
@ApiModelProperty("证件号码 String(40) 身份证号码")
|
||||
private String certNum;
|
||||
|
||||
@ApiModelProperty("联系电话 String(40)")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty("地址 String(200)")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty("邮箱 String(100)")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty("隶属机构id String(100)")
|
||||
private String organizationSubordinated;
|
||||
|
||||
@ApiModelProperty("用户类型 String(2) 固定1")
|
||||
private String userType;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.ruoyi.common.core.domain.entity.tymh.authority;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QxRole {
|
||||
@ApiModelProperty("权限id")
|
||||
private String pathId;
|
||||
|
||||
@ApiModelProperty("权限名称")
|
||||
private String pathName;
|
||||
|
||||
@ApiModelProperty("应用id")
|
||||
private String appid;
|
||||
|
||||
@ApiModelProperty("上级权限id")
|
||||
private String superiorPathId;
|
||||
|
||||
@ApiModelProperty("序号")
|
||||
private String displayOrder;
|
||||
|
||||
@ApiModelProperty("显示名称")
|
||||
private String showName;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.common.core.domain.entity.tymh.authority;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QxUnit {
|
||||
@ApiModelProperty("机构 ID")
|
||||
private String organizationId;
|
||||
|
||||
@ApiModelProperty("机构名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("机构类型")
|
||||
private String organizationType;
|
||||
|
||||
@ApiModelProperty("所属行政区划")
|
||||
private String regionCode;
|
||||
|
||||
@ApiModelProperty("上级机构 ID")
|
||||
private String superiorOrganizationId;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.ruoyi.common.core.domain.entity.tymh.authority;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QxUserInfo {
|
||||
@ApiModelProperty("用户id")
|
||||
private String userid;
|
||||
|
||||
@ApiModelProperty("用户名称")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty("登录名称")
|
||||
private String loginName;
|
||||
|
||||
@ApiModelProperty("性别 1男性,2女性")
|
||||
private String gender;
|
||||
|
||||
@ApiModelProperty("证件号码")
|
||||
private String certNum;
|
||||
|
||||
@ApiModelProperty("电话号码")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty("邮件")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty("隶属机构id")
|
||||
private String organizationSubordinated;
|
||||
|
||||
@ApiModelProperty("隶属机构名称")
|
||||
private String organizationName;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.common.core.domain.entity.tymh.authority;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QxUserRoleList {
|
||||
|
||||
@ApiModelProperty("角色ID")
|
||||
private String roleId;
|
||||
|
||||
@ApiModelProperty("角色名称")
|
||||
private String roleName;
|
||||
|
||||
@ApiModelProperty("角色类型 0管理角色,1经办角色")
|
||||
private String roleType;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.common.core.domain.entity.tymh.authority;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QxUserSystemList {
|
||||
@ApiModelProperty("系统id")
|
||||
private String appId;
|
||||
|
||||
@ApiModelProperty("系统名称")
|
||||
private String appName;
|
||||
|
||||
@ApiModelProperty("应用简称")
|
||||
private String appNameAlias;
|
||||
|
||||
@ApiModelProperty("应用地址")
|
||||
private String appPath;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.common.core.domain.entity.tymh.nwToken;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class NwTokenResult {
|
||||
|
||||
@ApiModelProperty("错误标识(1错误0正常)")
|
||||
private String errflag;
|
||||
|
||||
@ApiModelProperty("错误标识(1错误0正常)")
|
||||
private String errtext;
|
||||
|
||||
@JsonProperty("Access-Token")
|
||||
@ApiModelProperty("错误标识(1错误0正常)")
|
||||
private String accessToken;
|
||||
|
||||
@ApiModelProperty("错误标识(1错误0正常)")
|
||||
private Long expiresIn;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.common.core.domain.entity.tymh.nwToken;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class NwUserInfoResult {
|
||||
|
||||
@ApiModelProperty("错误标识(1错误0正常)")
|
||||
private String errflag;
|
||||
|
||||
@ApiModelProperty("错误文本")
|
||||
private String errtext;
|
||||
|
||||
@ApiModelProperty("身份证号码")
|
||||
private String idcardno;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private String userid;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.ruoyi.common.core.domain.entity.tymh.wwToken;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 统一认证-注册
|
||||
*/
|
||||
@Data
|
||||
public class WwRegister {
|
||||
@ApiModelProperty("身份证号 个人注册必填,单位注册不填")
|
||||
private String idno;
|
||||
|
||||
@ApiModelProperty("姓名 个人注册必填,单位注册不填")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("单位统一社会信用代码 单位注册必填,个人注册不填")
|
||||
private String enterprisecode;
|
||||
|
||||
@ApiModelProperty("单位名称 单位注册必填,个人注册不填")
|
||||
private String enterprisename;
|
||||
|
||||
@ApiModelProperty("单位联系人 单位注册必填,个人注册不填")
|
||||
private String contactperson;
|
||||
|
||||
@ApiModelProperty("单位联系电话 单位注册必填,个人注册不填")
|
||||
private String contactphone;
|
||||
|
||||
@ApiModelProperty("用户类型 1:个人 2:单位")
|
||||
private String usertype;
|
||||
|
||||
@ApiModelProperty("渠道 1:门户 2:小程序 3:终端")
|
||||
private String channel;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.ruoyi.common.core.domain.entity.tymh.wwToken;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 统一认证-返回
|
||||
*/
|
||||
@Data
|
||||
public class WwResult {
|
||||
@ApiModelProperty("错误标识(1错误0正常)")
|
||||
private String errflag;
|
||||
|
||||
@ApiModelProperty("错误文本")
|
||||
private String errtext;
|
||||
|
||||
@JsonProperty("Access-Token")
|
||||
@ApiModelProperty("访问令牌 Access-Token")
|
||||
private String accessToken;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
private String idno;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String name;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.ruoyi.common.core.domain.entity.tymh.wwToken;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 统一认证-单位信息
|
||||
*/
|
||||
@Data
|
||||
public class WwUnitInfoResult {
|
||||
@ApiModelProperty("错误标识(1错误0正常)")
|
||||
private String errflag;
|
||||
|
||||
@ApiModelProperty("错误文本")
|
||||
private String errtext;
|
||||
|
||||
@ApiModelProperty("统一社会信用代码")
|
||||
private String enterprisecode;
|
||||
|
||||
@ApiModelProperty("单位名称")
|
||||
private String enterprisename;
|
||||
|
||||
@ApiModelProperty("联系人")
|
||||
private String contactperson;
|
||||
|
||||
@ApiModelProperty("联系电话")
|
||||
private String contactphone;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.common.core.domain.entity.tymh.wwToken;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 统一认证-个人信息
|
||||
*/
|
||||
@Data
|
||||
public class WwUserInfoResult {
|
||||
@ApiModelProperty("错误标识(1错误0正常)")
|
||||
private String errflag;
|
||||
|
||||
@ApiModelProperty("错误文本")
|
||||
private String errtext;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
private String idno;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String name;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.common.core.domain.entity.tymh.wwToken;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 统一认证-登录
|
||||
*/
|
||||
@Data
|
||||
public class WwUserLogin {
|
||||
@ApiModelProperty("身份证号或统一社会信用代码")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty("1:个人 2:单位")
|
||||
private String usertype;
|
||||
|
||||
@ApiModelProperty("1:账号、短信验证码 2:电子社保卡 3:政务网")
|
||||
private String logontype;
|
||||
|
||||
@ApiModelProperty("1:门户 2:小程序 3:终端")
|
||||
private String logonchannel;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.ruoyi.common.utils.crypto;
|
||||
|
||||
import org.bouncycastle.crypto.InvalidCipherTextException;
|
||||
import org.bouncycastle.crypto.engines.SM2Engine;
|
||||
import org.bouncycastle.crypto.params.ECDomainParameters;
|
||||
import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
|
||||
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
|
||||
import org.bouncycastle.crypto.params.ParametersWithRandom;
|
||||
import org.bouncycastle.math.ec.ECCurve;
|
||||
import org.bouncycastle.math.ec.ECPoint;
|
||||
import org.bouncycastle.util.encoders.Hex;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
public class CryptoUtil {
|
||||
public static final int SM3_DIGEST_LENGTH = 32;
|
||||
private static final BigInteger SM2_ECC_P = new BigInteger("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF", 16);
|
||||
private static final BigInteger SM2_ECC_A = new BigInteger("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC", 16);
|
||||
private static final BigInteger SM2_ECC_B = new BigInteger("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93", 16);
|
||||
private static final BigInteger SM2_ECC_N = new BigInteger("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123", 16);
|
||||
private static final BigInteger SM2_ECC_GX = new BigInteger("32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7", 16);
|
||||
private static final BigInteger SM2_ECC_GY = new BigInteger("BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0", 16);
|
||||
private static final ECCurve CURVE;
|
||||
private static final ECPoint G_POINT;
|
||||
private static final ECDomainParameters DOMAIN_PARAMS;
|
||||
|
||||
static {
|
||||
CURVE = new ECCurve.Fp(SM2_ECC_P, SM2_ECC_A, SM2_ECC_B, (BigInteger)null, (BigInteger)null);
|
||||
G_POINT = CURVE.createPoint(SM2_ECC_GX, SM2_ECC_GY);
|
||||
DOMAIN_PARAMS = new ECDomainParameters(CURVE, G_POINT, SM2_ECC_N, BigInteger.ONE);
|
||||
}
|
||||
|
||||
public static ECPublicKeyParameters importPublicKeyFromHex(String publicKeyStr) throws Exception{
|
||||
ECPoint pubKey = null;
|
||||
|
||||
try {
|
||||
pubKey = CURVE.decodePoint(org.apache.commons.codec.binary.Hex.decodeHex(publicKeyStr));
|
||||
} catch (Exception var3) {
|
||||
throw new Exception("读取公钥失败:" + var3.getMessage());
|
||||
}
|
||||
|
||||
return new ECPublicKeyParameters(pubKey, DOMAIN_PARAMS);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 方法描述:sm2加密
|
||||
*/
|
||||
public static String sm2Encrypt(String signature, String plainText) throws Exception {
|
||||
ECPublicKeyParameters ecPublicKeyParameters = importPublicKeyFromHex(signature);
|
||||
byte[] srcData = plainText.getBytes(StandardCharsets.UTF_8);
|
||||
byte[] bodyBytes;
|
||||
try {
|
||||
SM2Engine engine = new SM2Engine();
|
||||
ParametersWithRandom pwr = new ParametersWithRandom(ecPublicKeyParameters, new SecureRandom());
|
||||
engine.init(true, pwr);
|
||||
bodyBytes = engine.processBlock(srcData, 0, srcData.length);
|
||||
} catch (InvalidCipherTextException var4) {
|
||||
throw new Exception("加密失败:" + var4.getMessage());
|
||||
}
|
||||
return Hex.toHexString(bodyBytes);
|
||||
}
|
||||
|
||||
public static ECPrivateKeyParameters importPrivateKey(String privateKeyHex) {
|
||||
BigInteger privateKey = new BigInteger(privateKeyHex, 16);
|
||||
return new ECPrivateKeyParameters(privateKey, DOMAIN_PARAMS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法描述:sm2解密
|
||||
*/
|
||||
public static String sm2Decrypt(String signature, String cipherText) throws Exception {
|
||||
ECPrivateKeyParameters ecPrivateKeyParameters = importPrivateKey(signature);
|
||||
byte[] bodyBytes;
|
||||
try {
|
||||
SM2Engine engine = new SM2Engine();
|
||||
byte[] sm2CipherText = Hex.decode(cipherText.getBytes(StandardCharsets.UTF_8));
|
||||
engine.init(false, ecPrivateKeyParameters);
|
||||
bodyBytes = engine.processBlock(sm2CipherText, 0, sm2CipherText.length);
|
||||
} catch (InvalidCipherTextException var3) {
|
||||
throw new Exception("解密失败:" + var3.getMessage());
|
||||
}
|
||||
return new String(bodyBytes, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user