diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-api/src/main/java/com/schisandra/auth/api/SchisandraAuthFeignService.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-api/src/main/java/com/schisandra/auth/api/SchisandraAuthFeignService.java index 0e0b5d0..40e275f 100644 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-api/src/main/java/com/schisandra/auth/api/SchisandraAuthFeignService.java +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-api/src/main/java/com/schisandra/auth/api/SchisandraAuthFeignService.java @@ -1,12 +1,8 @@ package com.schisandra.auth.api; -import com.schisandra.auth.entity.Result; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestParam; @FeignClient("schisandra-cloud-storage-auth") public interface SchisandraAuthFeignService { - @PostMapping("/auth/user/wechatLogin") - Result wechatLogin(@RequestParam(value = "openId") String openId); + } diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/SchisandraAuthUserController.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/SchisandraAuthUserController.java index 332e9f7..20d170e 100644 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/SchisandraAuthUserController.java +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/SchisandraAuthUserController.java @@ -298,25 +298,4 @@ public class SchisandraAuthUserController { } } - /** - * @description: 微信登录 - * @param: [authUser] - * @return: com.schisandra.auth.common.entity.Result - * @author: landaiqing - * @date: 2024/6/20 下午9:27 - */ - @PostMapping("wechatLogin") - public Result wechatLogin(@RequestParam(value = "openId") String openId) { - log.info("UserController.wechatLogin.openId:{}", openId); - Preconditions.checkNotNull(openId, "openId 不能为空"); - Boolean result = schisandraAuthUserDomainService.wechatLogin(openId); - if (result) { - return Result.ok("登录成功"); - } else { - return Result.fail("登录失败"); - } - - } - - } diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/convert/SchisandraSocialUserAuthDTOConverter.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/convert/SchisandraSocialUserAuthDTOConverter.java new file mode 100644 index 0000000..2f60b01 --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/convert/SchisandraSocialUserAuthDTOConverter.java @@ -0,0 +1,22 @@ +package com.schisandra.auth.application.convert; + +import com.schisandra.auth.application.dto.SchisandraSocialUserAuthDTO; +import com.schisandra.auth.domain.bo.SchisandraSocialUserAuthBO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * dto转换器 + * + * @author landaiqing + * @since 2024-06-24 11:10:08 + */ +@Mapper +public interface SchisandraSocialUserAuthDTOConverter { + + SchisandraSocialUserAuthDTOConverter INSTANCE = Mappers.getMapper(SchisandraSocialUserAuthDTOConverter.class); + + SchisandraSocialUserAuthBO convertDTOToBO(SchisandraSocialUserAuthDTO schisandraSocialUserAuthDTO); + SchisandraSocialUserAuthDTO convertBOToDTO(SchisandraSocialUserAuthBO schisandraSocialUserAuthBO); + +} diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/convert/SchisandraSocialUserDTOConverter.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/convert/SchisandraSocialUserDTOConverter.java new file mode 100644 index 0000000..cd132c6 --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/convert/SchisandraSocialUserDTOConverter.java @@ -0,0 +1,22 @@ +package com.schisandra.auth.application.convert; + +import com.schisandra.auth.application.dto.SchisandraSocialUserDTO; +import com.schisandra.auth.domain.bo.SchisandraSocialUserBO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * dto转换器 + * + * @author landaiqing + * @since 2024-06-24 11:07:49 + */ +@Mapper +public interface SchisandraSocialUserDTOConverter { + + SchisandraSocialUserDTOConverter INSTANCE = Mappers.getMapper(SchisandraSocialUserDTOConverter.class); + + SchisandraSocialUserBO convertDTOToBO(SchisandraSocialUserDTO schisandraSocialUserDTO); + SchisandraSocialUserDTO convertBOToDTO(SchisandraSocialUserBO schisandraSocialUserBO); + +} diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/dto/SchisandraSocialUserAuthDTO.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/dto/SchisandraSocialUserAuthDTO.java new file mode 100644 index 0000000..0a832b4 --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/dto/SchisandraSocialUserAuthDTO.java @@ -0,0 +1,58 @@ +package com.schisandra.auth.application.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * dto + * + * @author landaiqing + * @since 2024-06-24 11:10:08 + */ +@Data +public class SchisandraSocialUserAuthDTO implements Serializable { + + /** + * + */ + private Long id; + + /** + * + */ + private Long userId; + + /** + * + */ + private Long socialUserId; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updateBy; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * + */ + private Integer isDeleted; + +} + diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/dto/SchisandraSocialUserDTO.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/dto/SchisandraSocialUserDTO.java new file mode 100644 index 0000000..23340e3 --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/dto/SchisandraSocialUserDTO.java @@ -0,0 +1,143 @@ +package com.schisandra.auth.application.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * dto + * + * @author landaiqing + * @since 2024-06-24 11:07:49 + */ +@Data +public class SchisandraSocialUserDTO implements Serializable { + + /** + * + */ + private Long id; + + /** + * 第三方系统的唯一ID + */ + private String uuid; + + /** + * 第三方用户来源 + */ + private String source; + + /** + * 用户的授权令牌 + */ + private String accessToken; + + /** + * 第三方用户的授权令牌的有效期 + */ + private Integer expireIn; + + /** + * 刷新令牌 + */ + private String refreshToken; + + /** + * 第三方用户的 open id + */ + private String openId; + + /** + * 第三方用户的 ID + */ + private String uid; + + /** + * 个别平台的授权信息 + */ + private String accessCode; + + /** + * 第三方用户的 union id + */ + private String unionId; + + /** + * 第三方用户授予的权限 + */ + private String scope; + + /** + * 个别平台的授权信息 + */ + private String tokenType; + + /** + * id token + */ + private String idToken; + + /** + * 小米平台用户的附带属性 + */ + private String macAlgorithm; + + /** + * 小米平台用户的附带属性 + */ + private String macKey; + + /** + * 用户的授权code + */ + private String code; + + /** + * Twitter平台用户的附带属性 + */ + private String oauthToken; + + /** + * Twitter平台用户的附带属性 + */ + private String oauthTokenSecret; + + /** + * 状态 + */ + private String status; + + /** + * + */ + private String extJson; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updateBy; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * + */ + private Integer isDeleted; + +} + diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/src/main/java/com/schisandra/auth/common/utils/AESUtils.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/src/main/java/com/schisandra/auth/common/utils/AESUtils.java deleted file mode 100644 index e5bd78c..0000000 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/src/main/java/com/schisandra/auth/common/utils/AESUtils.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.schisandra.auth.common.utils; - -import org.apache.commons.codec.binary.Base64; - -import javax.crypto.Cipher; -import javax.crypto.spec.SecretKeySpec; -import java.nio.charset.StandardCharsets; -import java.security.SecureRandom; -import java.util.Random; - -/** - * @ClassName AESUtils 一定要选择16位密钥长度,也就是KEY_LENGTH=16*8,36的话就需要修改环境的jar包。 - * @Description TODO - * @Author L - * @Date 2024/1/26 17:27 - */ -public class AESUtils { - /** - * 加密算法AES - */ - private static final String KEY_ALGORITHM = "AES"; - - /** - * key的长度,Wrong key size: must be equal to 128, 192 or 256 - * 传入时需要16、24、36 - */ - private static final int KEY_LENGTH = 16 * 8; - - /** - * 算法名称/加密模式/数据填充方式 - * 默认:AES/ECB/PKCS5Padding - */ - private static final String ALGORITHMS = "AES/ECB/PKCS5Padding"; - - /** - * 后端AES的key,由静态代码块赋值 - */ - public static String key; - - - static { - key = getKey(); - } - - /** - * 获取key - */ - public static String getKey() { - int length = KEY_LENGTH / 8; - StringBuilder uid = new StringBuilder(length); - //产生32位的强随机数 - Random rd = new SecureRandom(); - for (int i = 0; i < length; i++) { - //产生0-2的3位随机数 - switch (rd.nextInt(3)) { - case 0: - //0-9的随机数 - uid.append(rd.nextInt(10)); - break; - case 1: - //ASCII在65-90之间为大写,获取大写随机 - uid.append((char) (rd.nextInt(26) + 65)); - break; - case 2: - //ASCII在97-122之间为小写,获取小写随机 - uid.append((char) (rd.nextInt(26) + 97)); - break; - default: - break; - } - } - return uid.toString(); - } - - /** - * AES 加密 - * - * @param content 加密的字符串 - * @param encryptKey key值 - */ - public static String encrypt(String content, String encryptKey) throws Exception { - //设置Cipher对象 - Cipher cipher = Cipher.getInstance(ALGORITHMS); - cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(encryptKey.getBytes(), KEY_ALGORITHM)); - - //调用doFinal - // 转base64 - return Base64.encodeBase64String(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8))); - - } - - /** - * AES 解密 - * - * @param encryptStr 解密的字符串 - * @param decryptKey 解密的key值 - */ - public static String decrypt(String encryptStr, String decryptKey) throws Exception { - //base64格式的key字符串转byte - byte[] decodeBase64 = Base64.decodeBase64(encryptStr); - - - //设置Cipher对象 - Cipher cipher = Cipher.getInstance(ALGORITHMS); - cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(decryptKey.getBytes(), KEY_ALGORITHM)); - //调用doFinal解密 - return new String(cipher.doFinal(decodeBase64)); - - } -} diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/src/main/java/com/schisandra/auth/common/utils/MD5Util.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/src/main/java/com/schisandra/auth/common/utils/MD5Util.java deleted file mode 100644 index 9a21050..0000000 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/src/main/java/com/schisandra/auth/common/utils/MD5Util.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.schisandra.auth.common.utils; - -import java.security.MessageDigest; - -public class MD5Util { - //十六进制下数字到字符的映射数组 - private final static String[] hexDigits = {"0", "1", "2", "3", "4", - "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"}; - - - /** - * 把inputString加密 - */ - public static String md5(String inputString) { - return encodeByMD5(inputString); - } - /** - * 对字符串进行MD5加密 - */ - private static String encodeByMD5(String originString) { - if (originString != null) { - try { - //创建具有指定算法名称的信息摘要 - MessageDigest md = MessageDigest.getInstance("MD5"); - //使用指定的字节数组对摘要进行最后更新,然后完成摘要计算 - byte[] results = md.digest(originString.getBytes("utf-8")); - //将得到的字节数组变成字符串返回 - String resultString = byteArrayToHexString(results); - return resultString.toUpperCase(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - return null; - } - /** - * 转换字节数组为十六进制字符串 - * - * @param - * @return 十六进制字符串 - */ - private static String byteArrayToHexString(byte[] b) { - StringBuffer resultSb = new StringBuffer(); - for (int i = 0; i < b.length; i++) { - resultSb.append(byteToHexString(b[i])); - } - return resultSb.toString(); - } - - private static String byteToHexString(byte b) { - int n = b; - if (n < 0) { - n += 256; - } - int d1 = n / 16; - int d2 = n % 16; - return hexDigits[d1] + hexDigits[d2]; - } - -} - diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/src/main/java/com/schisandra/auth/common/utils/RSAUtils.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/src/main/java/com/schisandra/auth/common/utils/RSAUtils.java deleted file mode 100644 index acdf56c..0000000 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/src/main/java/com/schisandra/auth/common/utils/RSAUtils.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.schisandra.auth.common.utils; - -import org.apache.commons.codec.binary.Base64; -import javax.crypto.Cipher; -import java.io.ByteArrayOutputStream; -import java.security.Key; -import java.security.KeyFactory; -import java.security.KeyPair; -import java.security.KeyPairGenerator; -import java.security.interfaces.RSAPrivateKey; -import java.security.interfaces.RSAPublicKey; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * @ClassName RSAUtils - * @Description TODO - * @Author L - * @Date 2024/1/26 17:28 - */ -public class RSAUtils { - - /** - * 加密算法RSA - */ - private static final String KEY_ALGORITHM = "RSA"; - - /** - * 算法名称/加密模式/数据填充方式 - * 默认:RSA/ECB/PKCS1Padding - */ - private static final String ALGORITHMS = "RSA/ECB/PKCS1Padding"; - - /** - * RSA最大加密明文大小 - */ - private static final int MAX_ENCRYPT_BLOCK = 245; - - /** - * RSA最大解密密文大小 - */ - private static final int MAX_DECRYPT_BLOCK = 256; - - /** - * RSA 位数 如果采用2048 上面最大加密和最大解密则须填写: 245 256 - */ - private static final int INITIALIZE_LENGTH = 2048; - - /** - * 后端RSA的密钥对(公钥和私钥)Map,由静态代码块赋值 - */ - private static final Map map = new LinkedHashMap<>(2); - - /** - * 生成密钥对(公钥和私钥) - */ - - public static Map genKeyPair() throws Exception { - KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM); - keyPairGen.initialize(INITIALIZE_LENGTH); - KeyPair keyPair = keyPairGen.generateKeyPair(); - // 获取公钥 - RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); - // 获取私钥 - RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); - // 得到公钥字符串 - String publicKeyString = Base64.encodeBase64String(publicKey.getEncoded()); - // 得到私钥字符串 - String privateKeyString = Base64.encodeBase64String((privateKey.getEncoded())); - map.put("publicKey",publicKeyString); - map.put("privateKey",privateKeyString); - return map; - } - public static String getPrivateKey(){ - return map.get("privateKey"); - } - public static String getPublicKey(){ - return map.get("publicKey"); - } - /** - * RSA私钥解密 - * @param data BASE64编码过的密文 - * @param privateKey 私钥(BASE64编码) - * @return utf-8编码的明文 - */ - public static byte[] decryptByPrivateKey(byte[] data, String privateKey) throws Exception { - //base64格式的key字符串转Key对象 - Key privateK = KeyFactory.getInstance(KEY_ALGORITHM).generatePrivate(new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKey))); - Cipher cipher = Cipher.getInstance(ALGORITHMS); - cipher.init(Cipher.DECRYPT_MODE, privateK); - - //分段进行解密操作 - return encryptAndDecryptOfSubsection(data, cipher, MAX_DECRYPT_BLOCK); - } - - /** - * RSA公钥加密 - * @param data BASE64编码过的密文 - * @param publicKey 公钥(BASE64编码) - * @return utf-8编码的明文 - */ - public static byte[] encryptByPublicKey(byte[] data, String publicKey) throws Exception { - //base64格式的key字符串转Key对象 - Key publicK = KeyFactory.getInstance(KEY_ALGORITHM).generatePublic(new X509EncodedKeySpec(Base64.decodeBase64(publicKey))); - Cipher cipher = Cipher.getInstance(ALGORITHMS); - cipher.init(Cipher.ENCRYPT_MODE, publicK); - //分段进行加密操作 - return encryptAndDecryptOfSubsection(data, cipher, MAX_ENCRYPT_BLOCK); - } - - /** - * RSA公钥解密 - * @param data BASE64编码过的密文 - * @param publicKey RSA公钥 - * @return utf-8编码的明文 - */ - public static byte[] pubKeyDec(byte[] data, String publicKey) throws Exception { - //base64格式的key字符串转Key对象 - Key privateK = KeyFactory.getInstance(KEY_ALGORITHM).generatePublic(new X509EncodedKeySpec(Base64.decodeBase64(publicKey))); - Cipher cipher = Cipher.getInstance(ALGORITHMS); - cipher.init(Cipher.DECRYPT_MODE, privateK); - - //分段进行解密操作 - return encryptAndDecryptOfSubsection(data, cipher, MAX_DECRYPT_BLOCK); - } - - - /** - * RSA私钥加密 - * @param data 待加密的明文 - * @param privateKey RSA私钥 - * @return 经BASE64编码后的密文 - */ - public static byte[] privKeyEnc(byte[] data, String privateKey) throws Exception { - - //base64格式的key字符串转Key对象 - Key publicK = KeyFactory.getInstance(KEY_ALGORITHM).generatePrivate(new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKey))); - Cipher cipher = Cipher.getInstance(ALGORITHMS); - cipher.init(Cipher.ENCRYPT_MODE, publicK); - - //分段进行加密操作 - return encryptAndDecryptOfSubsection(data, cipher, MAX_ENCRYPT_BLOCK); - } - - /** - * 分段进行加密、解密操作 - */ - private static byte[] encryptAndDecryptOfSubsection(byte[] data, Cipher cipher, int encryptBlock) throws Exception { - int inputLen = data.length; - ByteArrayOutputStream out = new ByteArrayOutputStream(); - int offSet = 0; - byte[] cache; - int i = 0; - // 对数据分段加密 - while (inputLen - offSet > 0) { - if (inputLen - offSet > encryptBlock) { - cache = cipher.doFinal(data, offSet, encryptBlock); - } else { - cache = cipher.doFinal(data, offSet, inputLen - offSet); - } - out.write(cache, 0, cache.length); - i++; - offSet = i * encryptBlock; - } - out.close(); - return out.toByteArray(); - } - -} diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/src/main/java/com/schisandra/auth/common/utils/SmsCodeUtils.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/src/main/java/com/schisandra/auth/common/utils/SmsCodeUtils.java deleted file mode 100644 index c7f0b49..0000000 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/src/main/java/com/schisandra/auth/common/utils/SmsCodeUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.schisandra.auth.common.utils; - -import java.util.Random; - -public class SmsCodeUtils { - public static Integer generateValidateCode(int length){ - Integer code =null; - - //长度为4 - if(length == 4){ - //生成随机数,最大为9999 - code = new Random().nextInt(9999); - if(code < 1000){ - //保证随机数为4位数字 - code = code + 1000; - } - //长度为6 - }else if(length == 6){ - //生成随机数,最大为999999 - code = new Random().nextInt(999999); - if(code < 100000){ - //保证随机数为6位数字 - code = code + 100000; - } - //其他情况 - }else{ - throw new RuntimeException("只能生成4位或6位数字验证码"); - } - return code; - } - -} diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/bo/SchisandraSocialUserAuthBO.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/bo/SchisandraSocialUserAuthBO.java new file mode 100644 index 0000000..d9ccf63 --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/bo/SchisandraSocialUserAuthBO.java @@ -0,0 +1,57 @@ +package com.schisandra.auth.domain.bo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +/** + * bo + * + * @author landaiqing + * @since 2024-06-24 11:10:08 + */ +@Data +public class SchisandraSocialUserAuthBO implements Serializable { + + /** + * + */ + private Long id; + + /** + * + */ + private Long userId; + + /** + * + */ + private Long socialUserId; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updateBy; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * + */ + private Integer isDeleted; + +} + diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/bo/SchisandraSocialUserBO.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/bo/SchisandraSocialUserBO.java new file mode 100644 index 0000000..6a8c21b --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/bo/SchisandraSocialUserBO.java @@ -0,0 +1,142 @@ +package com.schisandra.auth.domain.bo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +/** + * bo + * + * @author landaiqing + * @since 2024-06-24 11:07:49 + */ +@Data +public class SchisandraSocialUserBO implements Serializable { + + /** + * + */ + private Long id; + + /** + * 第三方系统的唯一ID + */ + private String uuid; + + /** + * 第三方用户来源 + */ + private String source; + + /** + * 用户的授权令牌 + */ + private String accessToken; + + /** + * 第三方用户的授权令牌的有效期 + */ + private Integer expireIn; + + /** + * 刷新令牌 + */ + private String refreshToken; + + /** + * 第三方用户的 open id + */ + private String openId; + + /** + * 第三方用户的 ID + */ + private String uid; + + /** + * 个别平台的授权信息 + */ + private String accessCode; + + /** + * 第三方用户的 union id + */ + private String unionId; + + /** + * 第三方用户授予的权限 + */ + private String scope; + + /** + * 个别平台的授权信息 + */ + private String tokenType; + + /** + * id token + */ + private String idToken; + + /** + * 小米平台用户的附带属性 + */ + private String macAlgorithm; + + /** + * 小米平台用户的附带属性 + */ + private String macKey; + + /** + * 用户的授权code + */ + private String code; + + /** + * Twitter平台用户的附带属性 + */ + private String oauthToken; + + /** + * Twitter平台用户的附带属性 + */ + private String oauthTokenSecret; + + /** + * 状态 + */ + private String status; + + /** + * + */ + private String extJson; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updateBy; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * + */ + private Integer isDeleted; + +} + diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/convert/SchisandraSocialUserAuthBOConverter.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/convert/SchisandraSocialUserAuthBOConverter.java new file mode 100644 index 0000000..7e8eeb0 --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/convert/SchisandraSocialUserAuthBOConverter.java @@ -0,0 +1,22 @@ +package com.schisandra.auth.domain.convert; + +import com.schisandra.auth.domain.bo.SchisandraSocialUserAuthBO; +import com.schisandra.auth.infra.basic.entity.SchisandraSocialUserAuth; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * bo转换器 + * + * @author landaiqing + * @since 2024-06-24 11:10:08 + */ +@Mapper +public interface SchisandraSocialUserAuthBOConverter { + + SchisandraSocialUserAuthBOConverter INSTANCE = Mappers.getMapper(SchisandraSocialUserAuthBOConverter.class); + + SchisandraSocialUserAuth convertBOToEntity(SchisandraSocialUserAuthBO schisandraSocialUserAuthBO); + SchisandraSocialUserAuthBO convertEntityToBO(SchisandraSocialUserAuth schisandraSocialUserAuth); + +} diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/convert/SchisandraSocialUserBOConverter.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/convert/SchisandraSocialUserBOConverter.java new file mode 100644 index 0000000..6959b18 --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/convert/SchisandraSocialUserBOConverter.java @@ -0,0 +1,22 @@ +package com.schisandra.auth.domain.convert; + +import com.schisandra.auth.domain.bo.SchisandraSocialUserBO; +import com.schisandra.auth.infra.basic.entity.SchisandraSocialUser; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * bo转换器 + * + * @author landaiqing + * @since 2024-06-24 11:07:49 + */ +@Mapper +public interface SchisandraSocialUserBOConverter { + + SchisandraSocialUserBOConverter INSTANCE = Mappers.getMapper(SchisandraSocialUserBOConverter.class); + + SchisandraSocialUser convertBOToEntity(SchisandraSocialUserBO schisandraSocialUserBO); + SchisandraSocialUserBO convertEntityToBO(SchisandraSocialUser schisandraSocialUser); + +} diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/SchisandraAuthUserDomainService.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/SchisandraAuthUserDomainService.java index f6f5219..8a6b699 100644 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/SchisandraAuthUserDomainService.java +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/SchisandraAuthUserDomainService.java @@ -93,7 +93,5 @@ public interface SchisandraAuthUserDomainService { Object deleteById(Long id); SchisandraAuthUser queryByPhone(String phone); - - Boolean wechatLogin(String openId); } diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/SchisandraSocialUserAuthDomainService.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/SchisandraSocialUserAuthDomainService.java new file mode 100644 index 0000000..6b6f7fd --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/SchisandraSocialUserAuthDomainService.java @@ -0,0 +1,28 @@ +package com.schisandra.auth.domain.service; + +import com.schisandra.auth.domain.bo.SchisandraSocialUserAuthBO; + +/** + * 领域service + * + * @author landaiqing + * @since 2024-06-24 11:10:08 + */ +public interface SchisandraSocialUserAuthDomainService { + + /** + * 添加 信息 + */ + Boolean add(SchisandraSocialUserAuthBO schisandraSocialUserAuthBO); + + /** + * 更新 信息 + */ + Boolean update(SchisandraSocialUserAuthBO schisandraSocialUserAuthBO); + + /** + * 删除 信息 + */ + Boolean delete(SchisandraSocialUserAuthBO schisandraSocialUserAuthBO); + +} diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/SchisandraSocialUserDomainService.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/SchisandraSocialUserDomainService.java new file mode 100644 index 0000000..90dc9b6 --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/SchisandraSocialUserDomainService.java @@ -0,0 +1,28 @@ +package com.schisandra.auth.domain.service; + +import com.schisandra.auth.domain.bo.SchisandraSocialUserBO; + +/** + * 领域service + * + * @author landaiqing + * @since 2024-06-24 11:07:49 + */ +public interface SchisandraSocialUserDomainService { + + /** + * 添加 信息 + */ + Boolean add(SchisandraSocialUserBO schisandraSocialUserBO); + + /** + * 更新 信息 + */ + Boolean update(SchisandraSocialUserBO schisandraSocialUserBO); + + /** + * 删除 信息 + */ + Boolean delete(SchisandraSocialUserBO schisandraSocialUserBO); + +} diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/impl/SchisandraAuthUserDomainServiceImpl.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/impl/SchisandraAuthUserDomainServiceImpl.java index fcb71ee..546b308 100644 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/impl/SchisandraAuthUserDomainServiceImpl.java +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/impl/SchisandraAuthUserDomainServiceImpl.java @@ -9,12 +9,15 @@ import com.schisandra.auth.common.entity.Result; import com.schisandra.auth.common.enums.IsDeletedFlagEnum; import com.schisandra.auth.common.enums.OauthType; import com.schisandra.auth.common.enums.UserRoleEnum; -import com.schisandra.auth.common.enums.UserStatusEnum; import com.schisandra.auth.common.redis.RedisUtil; import com.schisandra.auth.domain.bo.SchisandraAuthUserBO; import com.schisandra.auth.domain.bo.SchisandraAuthUserRoleBO; +import com.schisandra.auth.domain.bo.SchisandraSocialUserAuthBO; +import com.schisandra.auth.domain.bo.SchisandraSocialUserBO; import com.schisandra.auth.domain.convert.SchisandraAuthUserBOConverter; import com.schisandra.auth.domain.convert.SchisandraAuthUserRoleBOConverter; +import com.schisandra.auth.domain.convert.SchisandraSocialUserAuthBOConverter; +import com.schisandra.auth.domain.convert.SchisandraSocialUserBOConverter; import com.schisandra.auth.domain.service.SchisandraAuthUserDomainService; import com.schisandra.auth.infra.basic.entity.*; import com.schisandra.auth.infra.basic.service.*; @@ -48,6 +51,11 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo @Resource private SchisandraAuthRoleService schisandraAuthRoleService; + @Resource + private SchisandraSocialUserService schisandraSocialUserService; + + @Resource + private SchisandraSocialUserAuthService schisandraSocialUserAuthService; private final String AUTH_PERMISSION_PREFIX = "auth.permission"; @@ -210,60 +218,9 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo return schisandraAuthUserService.queryByPhone(phone); } - /** - * @description: 微信登陆 - * @param: [schisandraAuthUserBO] - * @return: java.lang.Boolean - * @author: landaiqing - * @date: 2024/6/20 下午9:32 - */ - @Override - public Boolean wechatLogin(String openId) { - SchisandraAuthUser schisandraAuthUser = schisandraAuthUserService.selectByUuidAndType(openId, OauthType.WECHAT.getType()); - if (ObjectUtils.isNotEmpty(schisandraAuthUser)) { - Long userId = schisandraAuthUser.getId(); - // redis存储用户角色与权限信息 - userInfoPersistence(userId); - StpUtil.login(userId); - return true; - } else { - // 插入用户信息表 - SchisandraAuthUserBO schisandraAuthUserBO = new SchisandraAuthUserBO(); - schisandraAuthUserBO.setUuid(openId); - schisandraAuthUserBO.setSource(OauthType.WECHAT.getType()); - schisandraAuthUserBO.setStatus(UserStatusEnum.NORMAL.getCode()); - schisandraAuthUserBO.setUserName(openId); - SchisandraAuthUser AuthUser = SchisandraAuthUserBOConverter.INSTANCE.convertBOToEntity(schisandraAuthUserBO); - int result = schisandraAuthUserService.insertAuthUserByOauth(AuthUser); - if (result <= 0) { - if (log.isInfoEnabled()) { - log.error("insertAuthUserByOauth fail, param:{}", JSONObject.toJSONString(AuthUser)); - } - return false; - } - Long authUserId = AuthUser.getId(); - // 建立用户与角色映射关系 - SchisandraAuthUserRoleBO schisandraAuthUserRoleBO = new SchisandraAuthUserRoleBO(); - schisandraAuthUserRoleBO.setUserId(authUserId); - schisandraAuthUserRoleBO.setRoleId(UserRoleEnum.NORMAL_USER.getCode()); - schisandraAuthUserRoleBO.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode()); - SchisandraAuthUserRole schisandraAuthUserRole = SchisandraAuthUserRoleBOConverter.INSTANCE.convertBOToEntity(schisandraAuthUserRoleBO); - int insert = schisandraAuthUserRoleService.insert(schisandraAuthUserRole); - if (insert <= 0) { - if (log.isInfoEnabled()) { - log.error("insertUserRole fail, param:{}", JSONObject.toJSONString(schisandraAuthUserRole)); - } - return false; - } - // redis存储用户角色与权限信息 - userInfoPersistence(authUserId); - StpUtil.login(authUserId); - return true; - } - } /** - * @description: 根据第三方用户信息添加用户信息 + * @description: 根据第三方用户信息添加用户 * @param: [data, type] * @return: void * @author: landaiqing @@ -274,39 +231,98 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo public Result insertAuthUserByOauth(AuthUser data, String type) { String uuid = data.getUuid(); AuthToken token = data.getToken(); - SchisandraAuthUser AuthUser = schisandraAuthUserService.selectByUuidAndType(uuid, type); - if (ObjectUtils.isNotEmpty(AuthUser)) { - Long userId = AuthUser.getId(); + SchisandraSocialUser socialUser = schisandraSocialUserService.selectByUuidAndType(uuid, type); + if (ObjectUtils.isNotEmpty(socialUser)) { + // 更新用户信息 + SchisandraSocialUserBO socialUserBO = new SchisandraSocialUserBO(); + socialUserBO.setAccessToken(token.getAccessToken()); + socialUserBO.setSource(data.getSource()); + socialUserBO.setUid(token.getUid()); + socialUserBO.setOpenId(token.getOpenId()); + socialUserBO.setCode(token.getCode()); + socialUserBO.setAccessCode(token.getAccessCode()); + socialUserBO.setExpireIn(token.getExpireIn()); + socialUserBO.setIdToken(token.getIdToken()); + socialUserBO.setMacAlgorithm(token.getMacAlgorithm()); + socialUserBO.setMacKey(token.getMacKey()); + socialUserBO.setOauthToken(token.getOauthToken()); + socialUserBO.setOauthTokenSecret(token.getOauthTokenSecret()); + socialUserBO.setRefreshToken(token.getRefreshToken()); + socialUserBO.setId(socialUser.getId()); + SchisandraSocialUser schisandraSocialUser = SchisandraSocialUserBOConverter.INSTANCE.convertBOToEntity(socialUserBO); + int update = schisandraSocialUserService.updateById(schisandraSocialUser); + if (update <= 0) { + if (log.isInfoEnabled()) { + log.error("schisandraAuthSocialUserService.update fail, param:{}", JSONObject.toJSONString(schisandraSocialUser)); + } + return Result.fail("Social User update fail"); + } + Long userId = socialUser.getId(); // redis存储用户角色与权限信息 userInfoPersistence(userId); StpUtil.login(userId, SaLoginConfig.setToken(token.getAccessToken())); return Result.ok(); } else { - // 插入用户信息表 - SchisandraAuthUserBO schisandraAuthUserBO = new SchisandraAuthUserBO(); - schisandraAuthUserBO.setUuid(data.getUuid()); - schisandraAuthUserBO.setSource(data.getSource()); - schisandraAuthUserBO.setAvatar(data.getAvatar()); - schisandraAuthUserBO.setBlog(data.getBlog()); - schisandraAuthUserBO.setEmail(data.getEmail()); - schisandraAuthUserBO.setCompany(data.getCompany()); - schisandraAuthUserBO.setGender(String.valueOf(data.getGender())); - schisandraAuthUserBO.setIntroduce(data.getRemark()); - schisandraAuthUserBO.setLocation(data.getLocation()); - schisandraAuthUserBO.setNickName(data.getNickname()); - schisandraAuthUserBO.setUserName(data.getUsername()); - schisandraAuthUserBO.setStatus(UserStatusEnum.NORMAL.getCode()); - schisandraAuthUserBO.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode()); - SchisandraAuthUser schisandraAuthUser = SchisandraAuthUserBOConverter.INSTANCE.convertBOToEntity(schisandraAuthUserBO); - int result = schisandraAuthUserService.insertAuthUserByOauth(schisandraAuthUser); + // 插入社会用户信息表 + SchisandraSocialUserBO socialUserBO = new SchisandraSocialUserBO(); + socialUserBO.setAccessToken(token.getAccessToken()); + socialUserBO.setSource(data.getSource()); + socialUserBO.setUuid(uuid); + socialUserBO.setUid(token.getUid()); + socialUserBO.setOpenId(token.getOpenId()); + socialUserBO.setCode(token.getCode()); + socialUserBO.setAccessCode(token.getAccessCode()); + socialUserBO.setExpireIn(token.getExpireIn()); + socialUserBO.setIdToken(token.getIdToken()); + socialUserBO.setMacAlgorithm(token.getMacAlgorithm()); + socialUserBO.setMacKey(token.getMacKey()); + socialUserBO.setOauthToken(token.getOauthToken()); + socialUserBO.setOauthTokenSecret(token.getOauthTokenSecret()); + socialUserBO.setRefreshToken(token.getRefreshToken()); + SchisandraSocialUser schisandraSocialUser = SchisandraSocialUserBOConverter.INSTANCE.convertBOToEntity(socialUserBO); + int result = schisandraSocialUserService.insertSocialUser(schisandraSocialUser); if (result <= 0) { if (log.isInfoEnabled()) { - log.error("insertAuthUserByOauth fail, param:{}", JSONObject.toJSONString(schisandraAuthUser)); + log.error("insertSocialUser fail, param:{}", JSONObject.toJSONString(schisandraSocialUser)); } - return Result.fail("insertAuthUserByOauth.insertAuthUserByOauth fail"); + return Result.fail("insertSocialUser fail"); } + // 插入用户信息表 + SchisandraAuthUserBO authUserBO=new SchisandraAuthUserBO(); + authUserBO.setUserName(data.getUsername()); + authUserBO.setNickName(data.getNickname()); + authUserBO.setAvatar(data.getAvatar()); + authUserBO.setEmail(data.getEmail()); + authUserBO.setBlog(data.getBlog()); + authUserBO.setCompany(data.getCompany()); + authUserBO.setGender(String.valueOf(data.getGender())); + authUserBO.setLocation(data.getLocation()); + authUserBO.setIntroduce(data.getRemark()); + SchisandraAuthUser schisandraAuthUser = SchisandraAuthUserBOConverter.INSTANCE.convertBOToEntity(authUserBO); + int insertAuthUser = schisandraAuthUserService.insertAuthUserByOauth(schisandraAuthUser); + if (insertAuthUser <= 0) { + if (log.isInfoEnabled()) { + log.error("insertAuthUser fail, param:{}", JSONObject.toJSONString(schisandraAuthUser)); + } + return Result.fail("insertAuthUser fail"); + } Long authUserId = schisandraAuthUser.getId(); + Long socialUserId = schisandraSocialUser.getId(); + + // 建立社会用户与用户信息映射 + SchisandraSocialUserAuthBO socialUserAuthBO = new SchisandraSocialUserAuthBO(); + socialUserAuthBO.setUserId(authUserId); + socialUserAuthBO.setSocialUserId(socialUserId); + SchisandraSocialUserAuth schisandraSocialUserAuth = SchisandraSocialUserAuthBOConverter.INSTANCE.convertBOToEntity(socialUserAuthBO); + int insertMapper = schisandraSocialUserAuthService.insert(schisandraSocialUserAuth); + if (insertMapper <= 0) { + if (log.isInfoEnabled()) { + log.error("insertAuthUserMapper fail, param:{}", JSONObject.toJSONString(schisandraSocialUserAuth)); + } + return Result.fail("insertAuthUserMapper fail"); + } + // 建立用户与角色映射关系 SchisandraAuthUserRoleBO schisandraAuthUserRoleBO = new SchisandraAuthUserRoleBO(); schisandraAuthUserRoleBO.setUserId(authUserId); diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/impl/SchisandraSocialUserAuthDomainServiceImpl.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/impl/SchisandraSocialUserAuthDomainServiceImpl.java new file mode 100644 index 0000000..47f39d2 --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/impl/SchisandraSocialUserAuthDomainServiceImpl.java @@ -0,0 +1,48 @@ +package com.schisandra.auth.domain.service.impl; + +import com.schisandra.auth.common.enums.IsDeletedFlagEnum; +import com.schisandra.auth.domain.convert.SchisandraSocialUserAuthBOConverter; +import com.schisandra.auth.domain.bo.SchisandraSocialUserAuthBO; +import com.schisandra.auth.domain.service.SchisandraSocialUserAuthDomainService; +import com.schisandra.auth.infra.basic.entity.SchisandraSocialUserAuth; +import com.schisandra.auth.infra.basic.service.SchisandraSocialUserAuthService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +/** + * 领域service实现了 + * + * @author landaiqing + * @since 2024-06-24 11:10:08 + */ +@Service +@Slf4j +public class SchisandraSocialUserAuthDomainServiceImpl implements SchisandraSocialUserAuthDomainService { + + @Resource + private SchisandraSocialUserAuthService schisandraSocialUserAuthService; + + @Override + public Boolean add(SchisandraSocialUserAuthBO schisandraSocialUserAuthBO) { + SchisandraSocialUserAuth schisandraSocialUserAuth = SchisandraSocialUserAuthBOConverter.INSTANCE.convertBOToEntity(schisandraSocialUserAuthBO); + schisandraSocialUserAuth.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode()); + return schisandraSocialUserAuthService.insert(schisandraSocialUserAuth) > 0; + } + + @Override + public Boolean update(SchisandraSocialUserAuthBO schisandraSocialUserAuthBO) { + SchisandraSocialUserAuth schisandraSocialUserAuth = SchisandraSocialUserAuthBOConverter.INSTANCE.convertBOToEntity(schisandraSocialUserAuthBO); + return schisandraSocialUserAuthService.update(schisandraSocialUserAuth) > 0; + } + + @Override + public Boolean delete(SchisandraSocialUserAuthBO schisandraSocialUserAuthBO) { + SchisandraSocialUserAuth schisandraSocialUserAuth = new SchisandraSocialUserAuth(); + schisandraSocialUserAuth.setId(schisandraSocialUserAuthBO.getId()); + schisandraSocialUserAuth.setIsDeleted(IsDeletedFlagEnum.DELETED.getCode()); + return schisandraSocialUserAuthService.update(schisandraSocialUserAuth) > 0; + } + +} diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/impl/SchisandraSocialUserDomainServiceImpl.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/impl/SchisandraSocialUserDomainServiceImpl.java new file mode 100644 index 0000000..4756a98 --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-domain/src/main/java/com/schisandra/auth/domain/service/impl/SchisandraSocialUserDomainServiceImpl.java @@ -0,0 +1,48 @@ +package com.schisandra.auth.domain.service.impl; + +import com.schisandra.auth.common.enums.IsDeletedFlagEnum; +import com.schisandra.auth.domain.convert.SchisandraSocialUserBOConverter; +import com.schisandra.auth.domain.bo.SchisandraSocialUserBO; +import com.schisandra.auth.domain.service.SchisandraSocialUserDomainService; +import com.schisandra.auth.infra.basic.entity.SchisandraSocialUser; +import com.schisandra.auth.infra.basic.service.SchisandraSocialUserService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +/** + * 领域service实现了 + * + * @author landaiqing + * @since 2024-06-24 11:07:49 + */ +@Service +@Slf4j +public class SchisandraSocialUserDomainServiceImpl implements SchisandraSocialUserDomainService { + + @Resource + private SchisandraSocialUserService schisandraSocialUserService; + + @Override + public Boolean add(SchisandraSocialUserBO schisandraSocialUserBO) { + SchisandraSocialUser schisandraSocialUser = SchisandraSocialUserBOConverter.INSTANCE.convertBOToEntity(schisandraSocialUserBO); + schisandraSocialUser.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode()); + return schisandraSocialUserService.insert(schisandraSocialUser) > 0; + } + + @Override + public Boolean update(SchisandraSocialUserBO schisandraSocialUserBO) { + SchisandraSocialUser schisandraSocialUser = SchisandraSocialUserBOConverter.INSTANCE.convertBOToEntity(schisandraSocialUserBO); + return schisandraSocialUserService.update(schisandraSocialUser) > 0; + } + + @Override + public Boolean delete(SchisandraSocialUserBO schisandraSocialUserBO) { + SchisandraSocialUser schisandraSocialUser = new SchisandraSocialUser(); + schisandraSocialUser.setId(schisandraSocialUserBO.getId()); + schisandraSocialUser.setIsDeleted(IsDeletedFlagEnum.DELETED.getCode()); + return schisandraSocialUserService.update(schisandraSocialUser) > 0; + } + +} diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/dao/SchisandraSocialUserAuthDao.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/dao/SchisandraSocialUserAuthDao.java new file mode 100644 index 0000000..4b1b7d3 --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/dao/SchisandraSocialUserAuthDao.java @@ -0,0 +1,17 @@ +package com.schisandra.auth.infra.basic.dao; + +import com.schisandra.auth.infra.basic.entity.SchisandraSocialUserAuth; +import com.mybatisflex.core.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + * 表数据库访问层 + * + * @author landaiqing + * @since 2024-06-24 11:10:08 + */ +@Repository +public interface SchisandraSocialUserAuthDao extends BaseMapper { + +} + diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/dao/SchisandraSocialUserDao.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/dao/SchisandraSocialUserDao.java new file mode 100644 index 0000000..c502a9e --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/dao/SchisandraSocialUserDao.java @@ -0,0 +1,17 @@ +package com.schisandra.auth.infra.basic.dao; + +import com.schisandra.auth.infra.basic.entity.SchisandraSocialUser; +import com.mybatisflex.core.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + * 表数据库访问层 + * + * @author landaiqing + * @since 2024-06-24 11:07:49 + */ +@Repository +public interface SchisandraSocialUserDao extends BaseMapper { + +} + diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/entity/SchisandraSocialUser.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/entity/SchisandraSocialUser.java new file mode 100644 index 0000000..3e3ea9e --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/entity/SchisandraSocialUser.java @@ -0,0 +1,173 @@ +package com.schisandra.auth.infra.basic.entity; + +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.KeyType; +import com.mybatisflex.annotation.Table; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 实体类 + * + * @author landaiqing + * @since 2024-06-24 11:07:49 + */ +@Data +@Table("schisandra_social_user") +public class SchisandraSocialUser implements Serializable { + + /** + * + */ + @Id(value = "id", keyType = KeyType.Auto) + private Long id; + + /** + * 第三方系统的唯一ID + */ + @Column("uuid") + private String uuid; + + /** + * 第三方用户来源 + */ + @Column("source") + private String source; + + /** + * 用户的授权令牌 + */ + @Column("access_token") + private String accessToken; + + /** + * 第三方用户的授权令牌的有效期 + */ + @Column("expire_in") + private Integer expireIn; + + /** + * 刷新令牌 + */ + @Column("refresh_token") + private String refreshToken; + + /** + * 第三方用户的 open id + */ + @Column("open_id") + private String openId; + + /** + * 第三方用户的 ID + */ + @Column("uid") + private String uid; + + /** + * 个别平台的授权信息 + */ + @Column("access_code") + private String accessCode; + + /** + * 第三方用户的 union id + */ + @Column("union_id") + private String unionId; + + /** + * 第三方用户授予的权限 + */ + @Column("scope") + private String scope; + + /** + * 个别平台的授权信息 + */ + @Column("token_type") + private String tokenType; + + /** + * id token + */ + @Column("id_token") + private String idToken; + + /** + * 小米平台用户的附带属性 + */ + @Column("mac_algorithm") + private String macAlgorithm; + + /** + * 小米平台用户的附带属性 + */ + @Column("mac_key") + private String macKey; + + /** + * 用户的授权code + */ + @Column("code") + private String code; + + /** + * Twitter平台用户的附带属性 + */ + @Column("oauth_token") + private String oauthToken; + + /** + * Twitter平台用户的附带属性 + */ + @Column("oauth_token_secret") + private String oauthTokenSecret; + + /** + * 状态 + */ + @Column("status") + private String status; + + /** + * + */ + @Column("ext_json") + private String extJson; + + /** + * 创建人 + */ + @Column("created_by") + private String createdBy; + + /** + * 创建时间 + */ + @Column("created_time") + private Date createdTime; + + /** + * 更新人 + */ + @Column("update_by") + private String updateBy; + + /** + * 更新时间 + */ + @Column("update_time") + private Date updateTime; + + /** + * + */ + @Column(value = "is_deleted",isLogicDelete = true) + private Integer isDeleted; + +} + diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/entity/SchisandraSocialUserAuth.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/entity/SchisandraSocialUserAuth.java new file mode 100644 index 0000000..c9af4a8 --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/entity/SchisandraSocialUserAuth.java @@ -0,0 +1,71 @@ +package com.schisandra.auth.infra.basic.entity; + +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.KeyType; +import com.mybatisflex.annotation.Table; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 实体类 + * + * @author landaiqing + * @since 2024-06-24 11:10:08 + */ +@Data +@Table("schisandra_social_user_auth") +public class SchisandraSocialUserAuth implements Serializable { + + /** + * + */ + @Id(value = "id", keyType = KeyType.Auto) + private Long id; + + /** + * + */ + @Column("user_id") + private Long userId; + + /** + * + */ + @Column("social_user_id") + private Long socialUserId; + + /** + * 创建人 + */ + @Column("created_by") + private String createdBy; + + /** + * 创建时间 + */ + @Column("created_time") + private Date createdTime; + + /** + * 更新人 + */ + @Column("update_by") + private String updateBy; + + /** + * 更新时间 + */ + @Column("update_time") + private Date updateTime; + + /** + * + */ + @Column("is_deleted") + private Integer isDeleted; + +} + diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/SchisandraAuthUserService.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/SchisandraAuthUserService.java index 3a38441..5d3a67a 100644 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/SchisandraAuthUserService.java +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/SchisandraAuthUserService.java @@ -53,5 +53,5 @@ public interface SchisandraAuthUserService { boolean updateUserPasswordByPhone(SchisandraAuthUser schisandraAuthUser); - SchisandraAuthUser selectByUuidAndType(String uuid, String type); + } diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/SchisandraSocialUserAuthService.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/SchisandraSocialUserAuthService.java new file mode 100644 index 0000000..63b6b0b --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/SchisandraSocialUserAuthService.java @@ -0,0 +1,46 @@ +package com.schisandra.auth.infra.basic.service; + +import com.schisandra.auth.infra.basic.entity.SchisandraSocialUserAuth; + +/** + * 表服务接口 + * + * @author landaiqing + * @since 2024-06-24 11:10:08 + */ +public interface SchisandraSocialUserAuthService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + SchisandraSocialUserAuth queryById(Long id); + + /** + * 新增数据 + * + * @param schisandraSocialUserAuth 实例对象 + * @return 实例对象 + */ + int insert(SchisandraSocialUserAuth schisandraSocialUserAuth); + + /** + * 修改数据 + * + * @param schisandraSocialUserAuth 实例对象 + * @return 实例对象 + */ + int update(SchisandraSocialUserAuth schisandraSocialUserAuth); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + boolean deleteById(Long id); + + +} diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/SchisandraSocialUserService.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/SchisandraSocialUserService.java new file mode 100644 index 0000000..4808e51 --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/SchisandraSocialUserService.java @@ -0,0 +1,51 @@ +package com.schisandra.auth.infra.basic.service; + +import com.schisandra.auth.infra.basic.entity.SchisandraSocialUser; + +/** + * 表服务接口 + * + * @author landaiqing + * @since 2024-06-24 11:07:49 + */ +public interface SchisandraSocialUserService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + SchisandraSocialUser queryById(Long id); + + /** + * 新增数据 + * + * @param schisandraSocialUser 实例对象 + * @return 实例对象 + */ + int insert(SchisandraSocialUser schisandraSocialUser); + + /** + * 修改数据 + * + * @param schisandraSocialUser 实例对象 + * @return 实例对象 + */ + int update(SchisandraSocialUser schisandraSocialUser); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + boolean deleteById(Long id); + + + SchisandraSocialUser selectByUuidAndType(String uuid, String type); + + int updateById(SchisandraSocialUser schisandraSocialUser); + + int insertSocialUser(SchisandraSocialUser schisandraSocialUser); +} diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/impl/SchisandraAuthUserServiceImpl.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/impl/SchisandraAuthUserServiceImpl.java index 0bf6b55..e4cdf14 100644 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/impl/SchisandraAuthUserServiceImpl.java +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/impl/SchisandraAuthUserServiceImpl.java @@ -54,7 +54,7 @@ public class SchisandraAuthUserServiceImpl implements SchisandraAuthUserService @Override public Boolean insert(SchisandraAuthUser schisandraAuthUser) { - return this.schisandraAuthUserDao.insert(schisandraAuthUser,true) > 0; + return this.schisandraAuthUserDao.insert(schisandraAuthUser, true) > 0; } /** @@ -82,7 +82,7 @@ public class SchisandraAuthUserServiceImpl implements SchisandraAuthUserService @Override public int insertAuthUserByOauth(SchisandraAuthUser schisandraAuthUser) { - return schisandraAuthUserDao.insert(schisandraAuthUser); + return schisandraAuthUserDao.insertSelective(schisandraAuthUser); } @Override @@ -94,10 +94,5 @@ public class SchisandraAuthUserServiceImpl implements SchisandraAuthUserService } - @Override - public SchisandraAuthUser selectByUuidAndType(String uuid, String type) { - return schisandraAuthUserDao.selectOneByCondition(SchisandraAuthUserTableDef.SCHISANDRA_AUTH_USER.UUID.eq(uuid) - .and(SchisandraAuthUserTableDef.SCHISANDRA_AUTH_USER.SOURCE.eq(type))); - } } diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/impl/SchisandraSocialUserAuthServiceImpl.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/impl/SchisandraSocialUserAuthServiceImpl.java new file mode 100644 index 0000000..76745c7 --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/impl/SchisandraSocialUserAuthServiceImpl.java @@ -0,0 +1,67 @@ +package com.schisandra.auth.infra.basic.service.impl; + +import com.schisandra.auth.infra.basic.entity.SchisandraSocialUserAuth; +import com.schisandra.auth.infra.basic.dao.SchisandraSocialUserAuthDao; +import com.schisandra.auth.infra.basic.service.SchisandraSocialUserAuthService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +/** + * 表服务实现类 + * + * @author landaiqing + * @since 2024-06-24 11:10:08 + */ +@Service("SchisandraSocialUserAuthService") +public class SchisandraSocialUserAuthServiceImpl implements SchisandraSocialUserAuthService { + + @Resource + private SchisandraSocialUserAuthDao schisandraSocialUserAuthDao; + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public SchisandraSocialUserAuth queryById(Long id) { + return this.schisandraSocialUserAuthDao.selectOneById(id); + } + + /** + * 新增数据 + * + * @param schisandraSocialUserAuth 实例对象 + * @return 实例对象 + */ + @Override + public int insert(SchisandraSocialUserAuth schisandraSocialUserAuth) { + return this.schisandraSocialUserAuthDao.insertSelective(schisandraSocialUserAuth); + } + + /** + * 修改数据 + * + * @param schisandraSocialUserAuth 实例对象 + * @return 实例对象 + */ + @Override + public int update(SchisandraSocialUserAuth schisandraSocialUserAuth) { + return this.schisandraSocialUserAuthDao.update(schisandraSocialUserAuth,true); + } + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Long id) { + return this.schisandraSocialUserAuthDao.deleteById(id) > 0; + } + + +} diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/impl/SchisandraSocialUserServiceImpl.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/impl/SchisandraSocialUserServiceImpl.java new file mode 100644 index 0000000..f03e1ba --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/java/com/schisandra/auth/infra/basic/service/impl/SchisandraSocialUserServiceImpl.java @@ -0,0 +1,98 @@ +package com.schisandra.auth.infra.basic.service.impl; + +import com.schisandra.auth.infra.basic.dao.SchisandraSocialUserDao; +import com.schisandra.auth.infra.basic.entity.SchisandraSocialUser; +import com.schisandra.auth.infra.basic.entity.table.SchisandraSocialUserTableDef; +import com.schisandra.auth.infra.basic.service.SchisandraSocialUserService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +/** + * 表服务实现类 + * + * @author landaiqing + * @since 2024-06-24 11:07:49 + */ +@Service("SchisandraSocialUserService") +public class SchisandraSocialUserServiceImpl implements SchisandraSocialUserService { + + @Resource + private SchisandraSocialUserDao schisandraSocialUserDao; + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public SchisandraSocialUser queryById(Long id) { + return this.schisandraSocialUserDao.selectOneById(id); + } + + /** + * 新增数据 + * + * @param schisandraSocialUser 实例对象 + * @return 实例对象 + */ + @Override + public int insert(SchisandraSocialUser schisandraSocialUser) { + return this.schisandraSocialUserDao.insertSelective(schisandraSocialUser); + } + + /** + * 修改数据 + * + * @param schisandraSocialUser 实例对象 + * @return 实例对象 + */ + @Override + public int update(SchisandraSocialUser schisandraSocialUser) { + return this.schisandraSocialUserDao.update(schisandraSocialUser, true); + } + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Long id) { + return this.schisandraSocialUserDao.deleteById(id) > 0; + } + + /** + * @description: 根据uuid和type查询用户 + * @param: [uuid, type] + * @return: com.schisandra.auth.infra.basic.entity.SchisandraSocialUser + * @author: landaiqing + * @date: 2024/6/24 上午11:17 + */ + @Override + public SchisandraSocialUser selectByUuidAndType(String uuid, String type) { + return schisandraSocialUserDao.selectOneByCondition(SchisandraSocialUserTableDef.SCHISANDRA_SOCIAL_USER.UUID.eq(uuid) + .and(SchisandraSocialUserTableDef.SCHISANDRA_SOCIAL_USER.SOURCE.eq(type))); + } + + /** + * @description: 根据id更新社会用户信息 + * @param: [schisandraSocialUser] + * @return: int + * @author: landaiqing + * @date: 2024/6/24 上午11:23 + */ + @Override + public int updateById(SchisandraSocialUser schisandraSocialUser) { + return schisandraSocialUserDao.update(schisandraSocialUser, true); + } + + @Override + public int insertSocialUser(SchisandraSocialUser schisandraSocialUser) { + return schisandraSocialUserDao.insertSelective(schisandraSocialUser); + } + + +} diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/resources/mapper/SchisandraSocialUserAuthDao.xml b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/resources/mapper/SchisandraSocialUserAuthDao.xml new file mode 100644 index 0000000..5083e22 --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/resources/mapper/SchisandraSocialUserAuthDao.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/resources/mapper/SchisandraSocialUserDao.xml b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/resources/mapper/SchisandraSocialUserDao.xml new file mode 100644 index 0000000..477217b --- /dev/null +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-infra/src/main/resources/mapper/SchisandraSocialUserDao.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/schisandra-cloud-storage-gen/src/main/resources/genCode/gen.yml b/schisandra-cloud-storage-gen/src/main/resources/genCode/gen.yml index a7551e3..c917e7a 100644 --- a/schisandra-cloud-storage-gen/src/main/resources/genCode/gen.yml +++ b/schisandra-cloud-storage-gen/src/main/resources/genCode/gen.yml @@ -8,7 +8,7 @@ # 数据库连接信息 jdbc: dbName: schisandra-cloud-storage - tableName: schisandra_sms_config + tableName: schisandra_social_user_auth url: jdbc:mysql://1.95.0.111:3306/ username: root password: LDQ20020618xxx @@ -22,9 +22,9 @@ params: # 作者 author: landaiqing # 模块 - module: system + module: auth # controller 通用前缀 - api: /system/sms + api: /auth/social # 生成对象是否移除前缀 removePre: false # 使用内置函数赋值给变量 FunctionUtils 中替换 diff --git a/schisandra-cloud-storage-oss/schisandra-cloud-storage-oss-common/src/main/java/com/schisandra/oss/common/utils/AESUtils.java b/schisandra-cloud-storage-oss/schisandra-cloud-storage-oss-common/src/main/java/com/schisandra/oss/common/utils/AESUtils.java deleted file mode 100644 index 9e3d5e9..0000000 --- a/schisandra-cloud-storage-oss/schisandra-cloud-storage-oss-common/src/main/java/com/schisandra/oss/common/utils/AESUtils.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.schisandra.oss.common.utils; - -import org.apache.commons.codec.binary.Base64; - -import javax.crypto.Cipher; -import javax.crypto.spec.SecretKeySpec; -import java.nio.charset.StandardCharsets; -import java.security.SecureRandom; -import java.util.Random; - -/** - * @ClassName AESUtils 一定要选择16位密钥长度,也就是KEY_LENGTH=16*8,36的话就需要修改环境的jar包。 - * @Description TODO - * @Author L - * @Date 2024/1/26 17:27 - */ -public class AESUtils { - /** - * 加密算法AES - */ - private static final String KEY_ALGORITHM = "AES"; - - /** - * key的长度,Wrong key size: must be equal to 128, 192 or 256 - * 传入时需要16、24、36 - */ - private static final int KEY_LENGTH = 16 * 8; - - /** - * 算法名称/加密模式/数据填充方式 - * 默认:AES/ECB/PKCS5Padding - */ - private static final String ALGORITHMS = "AES/ECB/PKCS5Padding"; - - /** - * 后端AES的key,由静态代码块赋值 - */ - public static String key; - - - static { - key = getKey(); - } - - /** - * 获取key - */ - public static String getKey() { - int length = KEY_LENGTH / 8; - StringBuilder uid = new StringBuilder(length); - //产生32位的强随机数 - Random rd = new SecureRandom(); - for (int i = 0; i < length; i++) { - //产生0-2的3位随机数 - switch (rd.nextInt(3)) { - case 0: - //0-9的随机数 - uid.append(rd.nextInt(10)); - break; - case 1: - //ASCII在65-90之间为大写,获取大写随机 - uid.append((char) (rd.nextInt(26) + 65)); - break; - case 2: - //ASCII在97-122之间为小写,获取小写随机 - uid.append((char) (rd.nextInt(26) + 97)); - break; - default: - break; - } - } - return uid.toString(); - } - - /** - * AES 加密 - * - * @param content 加密的字符串 - * @param encryptKey key值 - */ - public static String encrypt(String content, String encryptKey) throws Exception { - //设置Cipher对象 - Cipher cipher = Cipher.getInstance(ALGORITHMS); - cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(encryptKey.getBytes(), KEY_ALGORITHM)); - - //调用doFinal - // 转base64 - return Base64.encodeBase64String(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8))); - - } - - /** - * AES 解密 - * - * @param encryptStr 解密的字符串 - * @param decryptKey 解密的key值 - */ - public static String decrypt(String encryptStr, String decryptKey) throws Exception { - //base64格式的key字符串转byte - byte[] decodeBase64 = Base64.decodeBase64(encryptStr); - - - //设置Cipher对象 - Cipher cipher = Cipher.getInstance(ALGORITHMS); - cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(decryptKey.getBytes(), KEY_ALGORITHM)); - //调用doFinal解密 - return new String(cipher.doFinal(decodeBase64)); - - } -} diff --git a/schisandra-cloud-storage-oss/schisandra-cloud-storage-oss-common/src/main/java/com/schisandra/oss/common/utils/MD5Util.java b/schisandra-cloud-storage-oss/schisandra-cloud-storage-oss-common/src/main/java/com/schisandra/oss/common/utils/MD5Util.java deleted file mode 100644 index 7d6cae8..0000000 --- a/schisandra-cloud-storage-oss/schisandra-cloud-storage-oss-common/src/main/java/com/schisandra/oss/common/utils/MD5Util.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.schisandra.oss.common.utils; - -import java.security.MessageDigest; - -public class MD5Util { - //十六进制下数字到字符的映射数组 - private final static String[] hexDigits = {"0", "1", "2", "3", "4", - "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"}; - - - /** - * 把inputString加密 - */ - public static String md5(String inputString) { - return encodeByMD5(inputString); - } - /** - * 对字符串进行MD5加密 - */ - private static String encodeByMD5(String originString) { - if (originString != null) { - try { - //创建具有指定算法名称的信息摘要 - MessageDigest md = MessageDigest.getInstance("MD5"); - //使用指定的字节数组对摘要进行最后更新,然后完成摘要计算 - byte[] results = md.digest(originString.getBytes("utf-8")); - //将得到的字节数组变成字符串返回 - String resultString = byteArrayToHexString(results); - return resultString.toUpperCase(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - return null; - } - /** - * 转换字节数组为十六进制字符串 - * - * @param - * @return 十六进制字符串 - */ - private static String byteArrayToHexString(byte[] b) { - StringBuffer resultSb = new StringBuffer(); - for (int i = 0; i < b.length; i++) { - resultSb.append(byteToHexString(b[i])); - } - return resultSb.toString(); - } - - private static String byteToHexString(byte b) { - int n = b; - if (n < 0) { - n += 256; - } - int d1 = n / 16; - int d2 = n % 16; - return hexDigits[d1] + hexDigits[d2]; - } - -} - diff --git a/schisandra-cloud-storage-oss/schisandra-cloud-storage-oss-common/src/main/java/com/schisandra/oss/common/utils/RSAUtils.java b/schisandra-cloud-storage-oss/schisandra-cloud-storage-oss-common/src/main/java/com/schisandra/oss/common/utils/RSAUtils.java deleted file mode 100644 index 9cbb1ba..0000000 --- a/schisandra-cloud-storage-oss/schisandra-cloud-storage-oss-common/src/main/java/com/schisandra/oss/common/utils/RSAUtils.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.schisandra.oss.common.utils; - -import cn.hutool.crypto.SecureUtil; -import cn.hutool.crypto.asymmetric.AsymmetricAlgorithm; -import cn.hutool.crypto.asymmetric.KeyType; -import cn.hutool.crypto.asymmetric.RSA; -import org.apache.commons.codec.binary.Base64; - -import java.security.KeyPair; -import java.util.HashMap; - -/** - * @ClassName RSAUtils - * @Description TODO - * @Author L - * @Date 2024/1/26 17:28 - */ -public class RSAUtils { - - /** - * 公钥加密(解密就要用到对应的私钥) - * - * @param msg 明文信息 - * @param pubKey 公钥,用来加密明文 - * @return - */ - public static String encryptByPublic(String msg, String pubKey) { - RSA rsa = new RSA(AsymmetricAlgorithm.RSA_ECB_PKCS1.getValue(), null, pubKey); - return rsa.encryptBase64(msg, KeyType.PublicKey); - } - - /** - * 私钥解密 - * - * @param encryptMsg 公钥加密的密文 - * @param priKey 私钥,用来解密密文 - * @return - */ - public static String decryptByPrivate(String encryptMsg, String priKey) { - RSA rsa = new RSA(AsymmetricAlgorithm.RSA_ECB_PKCS1.getValue(), priKey, null); - return rsa.decryptStr(encryptMsg, KeyType.PrivateKey); - } - - /** - * 私钥加密(解密就要用到对应的公钥) - * - * @param msg 明文信息 - * @param priKey 私钥,用来加密明文 - * @return - */ - public static String encryptByPrivate(String msg, String priKey) { - RSA rsa = new RSA(AsymmetricAlgorithm.RSA_ECB_PKCS1.getValue(), priKey, null); - return rsa.encryptBase64(msg, KeyType.PrivateKey); - } - - - /** - * 公钥解密 - * - * @param encryptMsg 密文 - * @param pubKey 公钥,用来解密 - * @return - */ - public static String decryptByPublic(String encryptMsg, String pubKey) { - RSA rsa = new RSA(AsymmetricAlgorithm.RSA_ECB_PKCS1.getValue(), null, pubKey); - return rsa.decryptStr(encryptMsg, KeyType.PublicKey); - } - - /** - * 获取公私钥集合 - * - * @return - */ - public static HashMap getPriKeyAndPubKey() { - KeyPair pair = SecureUtil.generateKeyPair("RSA"); - String privateKey = Base64.encodeBase64String(pair.getPrivate().getEncoded()); - String publicKey = Base64.encodeBase64String(pair.getPublic().getEncoded()); - HashMap keys = new HashMap<>(); - keys.put("privateKey",privateKey); - keys.put("publicKey",publicKey); - return keys; - } - - -} diff --git a/schisandra-cloud-storage-system/schisandra-cloud-storage-system-common/src/main/java/com/schisandra/system/common/utils/AESUtils.java b/schisandra-cloud-storage-system/schisandra-cloud-storage-system-common/src/main/java/com/schisandra/system/common/utils/AESUtils.java deleted file mode 100644 index c534a75..0000000 --- a/schisandra-cloud-storage-system/schisandra-cloud-storage-system-common/src/main/java/com/schisandra/system/common/utils/AESUtils.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.schisandra.system.common.utils; - -import org.apache.commons.codec.binary.Base64; - -import javax.crypto.Cipher; -import javax.crypto.spec.SecretKeySpec; -import java.nio.charset.StandardCharsets; -import java.security.SecureRandom; -import java.util.Random; - -/** - * @ClassName AESUtils 一定要选择16位密钥长度,也就是KEY_LENGTH=16*8,36的话就需要修改环境的jar包。 - * @Description TODO - * @Author L - * @Date 2024/1/26 17:27 - */ -public class AESUtils { - /** - * 加密算法AES - */ - private static final String KEY_ALGORITHM = "AES"; - - /** - * key的长度,Wrong key size: must be equal to 128, 192 or 256 - * 传入时需要16、24、36 - */ - private static final int KEY_LENGTH = 16 * 8; - - /** - * 算法名称/加密模式/数据填充方式 - * 默认:AES/ECB/PKCS5Padding - */ - private static final String ALGORITHMS = "AES/ECB/PKCS5Padding"; - - /** - * 后端AES的key,由静态代码块赋值 - */ - public static String key; - - - static { - key = getKey(); - } - - /** - * 获取key - */ - public static String getKey() { - int length = KEY_LENGTH / 8; - StringBuilder uid = new StringBuilder(length); - //产生32位的强随机数 - Random rd = new SecureRandom(); - for (int i = 0; i < length; i++) { - //产生0-2的3位随机数 - switch (rd.nextInt(3)) { - case 0: - //0-9的随机数 - uid.append(rd.nextInt(10)); - break; - case 1: - //ASCII在65-90之间为大写,获取大写随机 - uid.append((char) (rd.nextInt(26) + 65)); - break; - case 2: - //ASCII在97-122之间为小写,获取小写随机 - uid.append((char) (rd.nextInt(26) + 97)); - break; - default: - break; - } - } - return uid.toString(); - } - - /** - * AES 加密 - * - * @param content 加密的字符串 - * @param encryptKey key值 - */ - public static String encrypt(String content, String encryptKey) throws Exception { - //设置Cipher对象 - Cipher cipher = Cipher.getInstance(ALGORITHMS); - cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(encryptKey.getBytes(), KEY_ALGORITHM)); - - //调用doFinal - // 转base64 - return Base64.encodeBase64String(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8))); - - } - - /** - * AES 解密 - * - * @param encryptStr 解密的字符串 - * @param decryptKey 解密的key值 - */ - public static String decrypt(String encryptStr, String decryptKey) throws Exception { - //base64格式的key字符串转byte - byte[] decodeBase64 = Base64.decodeBase64(encryptStr); - - - //设置Cipher对象 - Cipher cipher = Cipher.getInstance(ALGORITHMS); - cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(decryptKey.getBytes(), KEY_ALGORITHM)); - //调用doFinal解密 - return new String(cipher.doFinal(decodeBase64)); - - } -} diff --git a/schisandra-cloud-storage-system/schisandra-cloud-storage-system-common/src/main/java/com/schisandra/system/common/utils/MD5Util.java b/schisandra-cloud-storage-system/schisandra-cloud-storage-system-common/src/main/java/com/schisandra/system/common/utils/MD5Util.java deleted file mode 100644 index 2d0158f..0000000 --- a/schisandra-cloud-storage-system/schisandra-cloud-storage-system-common/src/main/java/com/schisandra/system/common/utils/MD5Util.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.schisandra.system.common.utils; - -import java.security.MessageDigest; - -public class MD5Util { - //十六进制下数字到字符的映射数组 - private final static String[] hexDigits = {"0", "1", "2", "3", "4", - "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"}; - - - /** - * 把inputString加密 - */ - public static String md5(String inputString) { - return encodeByMD5(inputString); - } - /** - * 对字符串进行MD5加密 - */ - private static String encodeByMD5(String originString) { - if (originString != null) { - try { - //创建具有指定算法名称的信息摘要 - MessageDigest md = MessageDigest.getInstance("MD5"); - //使用指定的字节数组对摘要进行最后更新,然后完成摘要计算 - byte[] results = md.digest(originString.getBytes("utf-8")); - //将得到的字节数组变成字符串返回 - String resultString = byteArrayToHexString(results); - return resultString.toUpperCase(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - return null; - } - /** - * 转换字节数组为十六进制字符串 - * - * @param - * @return 十六进制字符串 - */ - private static String byteArrayToHexString(byte[] b) { - StringBuffer resultSb = new StringBuffer(); - for (int i = 0; i < b.length; i++) { - resultSb.append(byteToHexString(b[i])); - } - return resultSb.toString(); - } - - private static String byteToHexString(byte b) { - int n = b; - if (n < 0) { - n += 256; - } - int d1 = n / 16; - int d2 = n % 16; - return hexDigits[d1] + hexDigits[d2]; - } - -} - diff --git a/schisandra-cloud-storage-system/schisandra-cloud-storage-system-common/src/main/java/com/schisandra/system/common/utils/RSAUtils.java b/schisandra-cloud-storage-system/schisandra-cloud-storage-system-common/src/main/java/com/schisandra/system/common/utils/RSAUtils.java deleted file mode 100644 index b19eba5..0000000 --- a/schisandra-cloud-storage-system/schisandra-cloud-storage-system-common/src/main/java/com/schisandra/system/common/utils/RSAUtils.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.schisandra.system.common.utils; - -import org.apache.commons.codec.binary.Base64; - -import javax.crypto.Cipher; -import java.io.ByteArrayOutputStream; -import java.security.Key; -import java.security.KeyFactory; -import java.security.KeyPair; -import java.security.KeyPairGenerator; -import java.security.interfaces.RSAPrivateKey; -import java.security.interfaces.RSAPublicKey; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * @ClassName RSAUtils - * @Description TODO - * @Author L - * @Date 2024/1/26 17:28 - */ -public class RSAUtils { - - /** - * 加密算法RSA - */ - private static final String KEY_ALGORITHM = "RSA"; - - /** - * 算法名称/加密模式/数据填充方式 - * 默认:RSA/ECB/PKCS1Padding - */ - private static final String ALGORITHMS = "RSA/ECB/PKCS1Padding"; - - /** - * RSA最大加密明文大小 - */ - private static final int MAX_ENCRYPT_BLOCK = 245; - - /** - * RSA最大解密密文大小 - */ - private static final int MAX_DECRYPT_BLOCK = 256; - - /** - * RSA 位数 如果采用2048 上面最大加密和最大解密则须填写: 245 256 - */ - private static final int INITIALIZE_LENGTH = 2048; - - /** - * 后端RSA的密钥对(公钥和私钥)Map,由静态代码块赋值 - */ - private static final Map map = new LinkedHashMap<>(2); - - /** - * 生成密钥对(公钥和私钥) - */ - - public static Map genKeyPair() throws Exception { - KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM); - keyPairGen.initialize(INITIALIZE_LENGTH); - KeyPair keyPair = keyPairGen.generateKeyPair(); - // 获取公钥 - RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); - // 获取私钥 - RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); - // 得到公钥字符串 - String publicKeyString = Base64.encodeBase64String(publicKey.getEncoded()); - // 得到私钥字符串 - String privateKeyString = Base64.encodeBase64String((privateKey.getEncoded())); - map.put("publicKey",publicKeyString); - map.put("privateKey",privateKeyString); - return map; - } - public static String getPrivateKey(){ - return map.get("privateKey"); - } - public static String getPublicKey(){ - return map.get("publicKey"); - } - /** - * RSA私钥解密 - * @param data BASE64编码过的密文 - * @param privateKey 私钥(BASE64编码) - * @return utf-8编码的明文 - */ - public static byte[] decryptByPrivateKey(byte[] data, String privateKey) throws Exception { - //base64格式的key字符串转Key对象 - Key privateK = KeyFactory.getInstance(KEY_ALGORITHM).generatePrivate(new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKey))); - Cipher cipher = Cipher.getInstance(ALGORITHMS); - cipher.init(Cipher.DECRYPT_MODE, privateK); - - //分段进行解密操作 - return encryptAndDecryptOfSubsection(data, cipher, MAX_DECRYPT_BLOCK); - } - - /** - * RSA公钥加密 - * @param data BASE64编码过的密文 - * @param publicKey 公钥(BASE64编码) - * @return utf-8编码的明文 - */ - public static byte[] encryptByPublicKey(byte[] data, String publicKey) throws Exception { - //base64格式的key字符串转Key对象 - Key publicK = KeyFactory.getInstance(KEY_ALGORITHM).generatePublic(new X509EncodedKeySpec(Base64.decodeBase64(publicKey))); - Cipher cipher = Cipher.getInstance(ALGORITHMS); - cipher.init(Cipher.ENCRYPT_MODE, publicK); - //分段进行加密操作 - return encryptAndDecryptOfSubsection(data, cipher, MAX_ENCRYPT_BLOCK); - } - - /** - * RSA公钥解密 - * @param data BASE64编码过的密文 - * @param publicKey RSA公钥 - * @return utf-8编码的明文 - */ - public static byte[] pubKeyDec(byte[] data, String publicKey) throws Exception { - //base64格式的key字符串转Key对象 - Key privateK = KeyFactory.getInstance(KEY_ALGORITHM).generatePublic(new X509EncodedKeySpec(Base64.decodeBase64(publicKey))); - Cipher cipher = Cipher.getInstance(ALGORITHMS); - cipher.init(Cipher.DECRYPT_MODE, privateK); - - //分段进行解密操作 - return encryptAndDecryptOfSubsection(data, cipher, MAX_DECRYPT_BLOCK); - } - - - /** - * RSA私钥加密 - * @param data 待加密的明文 - * @param privateKey RSA私钥 - * @return 经BASE64编码后的密文 - */ - public static byte[] privKeyEnc(byte[] data, String privateKey) throws Exception { - - //base64格式的key字符串转Key对象 - Key publicK = KeyFactory.getInstance(KEY_ALGORITHM).generatePrivate(new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKey))); - Cipher cipher = Cipher.getInstance(ALGORITHMS); - cipher.init(Cipher.ENCRYPT_MODE, publicK); - - //分段进行加密操作 - return encryptAndDecryptOfSubsection(data, cipher, MAX_ENCRYPT_BLOCK); - } - - /** - * 分段进行加密、解密操作 - */ - private static byte[] encryptAndDecryptOfSubsection(byte[] data, Cipher cipher, int encryptBlock) throws Exception { - int inputLen = data.length; - ByteArrayOutputStream out = new ByteArrayOutputStream(); - int offSet = 0; - byte[] cache; - int i = 0; - // 对数据分段加密 - while (inputLen - offSet > 0) { - if (inputLen - offSet > encryptBlock) { - cache = cipher.doFinal(data, offSet, encryptBlock); - } else { - cache = cipher.doFinal(data, offSet, inputLen - offSet); - } - out.write(cache, 0, cache.length); - i++; - offSet = i * encryptBlock; - } - out.close(); - return out.toByteArray(); - } - -} diff --git a/schisandra-cloud-storage-wechat/src/main/java/com/schisandra/wechat/controller/CallBackController.java b/schisandra-cloud-storage-wechat/src/main/java/com/schisandra/wechat/controller/CallBackController.java index e8321d1..46c3ea2 100644 --- a/schisandra-cloud-storage-wechat/src/main/java/com/schisandra/wechat/controller/CallBackController.java +++ b/schisandra-cloud-storage-wechat/src/main/java/com/schisandra/wechat/controller/CallBackController.java @@ -60,11 +60,11 @@ public class CallBackController { @RequestParam("timestamp") String timestamp, @RequestParam("nonce") String nonce, @RequestParam(value = "msg_signature", required = false) String msgSignature) { -// log.info("接收到微信消息:requestBody:{}", requestBody); + log.info("接收到微信消息:requestBody:{}", requestBody); Map messageMap = MessageUtil.parseXml(requestBody); String msgType = messageMap.get("MsgType"); String event = messageMap.get("Event") == null ? "" : messageMap.get("Event"); -// log.info("msgType:{},event:{}", msgType, event); + log.info("msgType:{},event:{}", msgType, event); StringBuilder sb = new StringBuilder(); sb.append(msgType); @@ -78,7 +78,7 @@ public class CallBackController { return "unknown"; } String replyContent = weChatMsgHandler.dealMsg(messageMap); -// log.info("replyContent:{}", replyContent); + log.info("replyContent:{}", replyContent); return replyContent; } } diff --git a/schisandra-cloud-storage-wechat/src/main/java/com/schisandra/wechat/handler/ReceiveTextMsgHandler.java b/schisandra-cloud-storage-wechat/src/main/java/com/schisandra/wechat/handler/ReceiveTextMsgHandler.java index cd8bde8..25f0196 100644 --- a/schisandra-cloud-storage-wechat/src/main/java/com/schisandra/wechat/handler/ReceiveTextMsgHandler.java +++ b/schisandra-cloud-storage-wechat/src/main/java/com/schisandra/wechat/handler/ReceiveTextMsgHandler.java @@ -1,7 +1,6 @@ package com.schisandra.wechat.handler; import com.schisandra.wechat.redis.RedisUtil; -import com.schisandra.wechat.rpc.AuthRpc; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -22,9 +21,6 @@ public class ReceiveTextMsgHandler implements WeChatMsgHandler { @Resource private RedisUtil redisUtil; - @Resource - private AuthRpc authRpc; - @Override public WeChatMsgTypeEnum getMsgType() { return WeChatMsgTypeEnum.TEXT_MSG; @@ -53,29 +49,6 @@ public class ReceiveTextMsgHandler implements WeChatMsgHandler { ""; return replyContent; - }else if (LOGIN_KEY_WORD.equals(content)) { - Boolean result = authRpc.wechatLogin(toUserName); - if (result) { - String replyContent = "\n" + - " \n" + - " \n" + - " 12345678\n" + - " \n" + - " \n" + - ""; - return replyContent; - } else { - String replyContent = "\n" + - " \n" + - " \n" + - " 12345678\n" + - " \n" + - " \n" + - ""; - return replyContent; - - } - } return null; diff --git a/schisandra-cloud-storage-wechat/src/main/java/com/schisandra/wechat/rpc/AuthRpc.java b/schisandra-cloud-storage-wechat/src/main/java/com/schisandra/wechat/rpc/AuthRpc.java deleted file mode 100644 index d66c89b..0000000 --- a/schisandra-cloud-storage-wechat/src/main/java/com/schisandra/wechat/rpc/AuthRpc.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.schisandra.wechat.rpc; - -import com.schisandra.auth.api.SchisandraAuthFeignService; -import com.schisandra.auth.entity.Result; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; - -/** - * @Classname AuthRpc - * @BelongsProject: schisandra-cloud-storage - * @BelongsPackage: com.schisandra.wechat.rpc - * @Author: landaiqing - * @CreateTime: 2024-06-20 22:59 - * @Description: TODO - * @Version: 1.0 - */ -@Component -public class AuthRpc { - @Resource - private SchisandraAuthFeignService schisandraAuthFeignService; - - public Boolean wechatLogin(String openId) { - Result result = schisandraAuthFeignService.wechatLogin(openId); - if (result.getSuccess()) { - return true; - } else { - return false; - } - } -}