mirror of
https://gitee.com/incloudcode/yexuejc-springboot.git
synced 2025-10-15 06:21:19 +08:00
2.x 合并到master(方便后续分支)
This commit is contained in:
@@ -9,27 +9,19 @@
|
||||
<parent>
|
||||
<groupId>com.yexuejc.springboot</groupId>
|
||||
<artifactId>yexuejc-springboot-parent</artifactId>
|
||||
<version>2.1.0</version>
|
||||
<version>2.1.3</version>
|
||||
<!-- 本地打包:使用相对关联路径 -->
|
||||
<!--<relativePath>../</relativePath>-->
|
||||
</parent>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
|
||||
<!--<properties>-->
|
||||
<!--<main.basedir>${basedir}/..</main.basedir>-->
|
||||
<!--</properties>-->
|
||||
|
||||
<dependencies>
|
||||
<!--基础包-->
|
||||
<dependency>
|
||||
<groupId>top.yexuejc</groupId>
|
||||
<artifactId>yexuejc-base</artifactId>
|
||||
</dependency>
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>com.github.yexuejc</groupId>-->
|
||||
<!--<artifactId>yexuejc-base</artifactId>-->
|
||||
<!--</dependency>-->
|
||||
|
||||
<!-- 使用springMVC -->
|
||||
<dependency>
|
||||
@@ -65,7 +57,7 @@
|
||||
<!-- JJWT -->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<artifactId>jjwt-api</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- 使用Redis -->
|
||||
|
@@ -73,6 +73,7 @@ public class MutiRedisAutoConfiguration {
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnClass(GenericObjectPool.class)
|
||||
@ConditionalOnProperty(name = "yexuejc.autoconfigure.redis.enable", matchIfMissing = false)
|
||||
protected static class RedisConnectionConfiguration {
|
||||
|
||||
private final RedisProperties properties;
|
||||
@@ -163,6 +164,7 @@ public class MutiRedisAutoConfiguration {
|
||||
* Standard Redis configuration.
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnProperty(name = "yexuejc.autoconfigure.redis.enable", matchIfMissing = false)
|
||||
protected static class RedisConfiguration {
|
||||
|
||||
@Primary
|
||||
|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.yexuejc.base.util.JsonUtil;
|
||||
import com.yexuejc.springboot.base.mapper.handler.JsonTypeHandler;
|
||||
import com.yexuejc.springboot.base.security.inte.User;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -27,7 +28,7 @@ public class Consumer extends Model<Consumer> implements User {
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableId(value = "consumer_id", type = IdType.UUID)
|
||||
@TableId(value = "consumer_id", type = IdType.ASSIGN_UUID)
|
||||
private String consumerId;
|
||||
/**
|
||||
* 手机号
|
||||
@@ -92,7 +93,7 @@ public class Consumer extends Model<Consumer> implements User {
|
||||
/**
|
||||
* 角色、权限
|
||||
*/
|
||||
@TableField(value = "roles", el = "roles,typeHandler=com.yexuejc.guansc.core.mybatis.handler.JsonTypeHandler")
|
||||
@TableField(value = "roles", typeHandler = JsonTypeHandler.class)
|
||||
private List<String> roles;
|
||||
/**
|
||||
* 支付密码
|
||||
@@ -157,19 +158,16 @@ public class Consumer extends Model<Consumer> implements User {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Consumer setEnable(boolean enable) {
|
||||
this.enable = enable;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Consumer setNonExpire(boolean nonExpire) {
|
||||
this.nonExpire = nonExpire;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Consumer setNonLock(boolean nonLock) {
|
||||
this.nonLock = nonLock;
|
||||
return this;
|
||||
@@ -276,7 +274,7 @@ public class Consumer extends Model<Consumer> implements User {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
public Serializable pkVal() {
|
||||
return this.consumerId;
|
||||
}
|
||||
}
|
||||
|
@@ -7,11 +7,9 @@ import com.yexuejc.base.util.JsonUtil;
|
||||
import com.yexuejc.base.util.StrUtil;
|
||||
import com.yexuejc.springboot.base.ApplicationRun;
|
||||
import com.yexuejc.springboot.base.filter.RsaProperties;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.KeyStoreException;
|
||||
@@ -19,14 +17,12 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = ApplicationRun.class)
|
||||
public class ApplicationTest {
|
||||
@Autowired
|
||||
@@ -76,10 +72,8 @@ public class ApplicationTest {
|
||||
// String strData = "HgTMgxEEFSr6zRLvZQ3U5CAKjJqwKf0lfruZTi32iWObkbJA5mHuOTKU4rXYkej4UsPfArYUA45GfxatwFoB4Q";
|
||||
String strData = "K9Zyg82WDvIApFmXTxPwjQw_VA041jfBcxMIP6jpMM6xWe1XajGf3__7DqSLrS9MwCra9cYkidcjVJAKZn9cmQ";
|
||||
|
||||
|
||||
String mapData = "cEPfMp7-rim76XFdbNDSIzDRXyHySpz0VOZP6HC8U-JPl-ZxNZKp6ethEQWWITcuUPzIhp4fHiGKNsHA7F6OxCxibpMLj5-ZsgJJvcczw8Liens5kYgciRF1UziR3LFy6vybN9H1CJnqXaddbl3t_41P-_1l5Ev7YYa8woWp7ulaRPeTCDjohEpmx2V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Q36ZQBQ2RcFB3TiHKHGin0gfn6T6A80orYD7i-Bdc0rh_pBEdLwGt1wWY_C8QuxeBmMWh0jmLVfpa3ZZOXVc9I7wIxzc1taQ7f-8Om9SNfXc";
|
||||
String listData = "Sf_FO8YC9EUNTeM0n9EVuDzwvLz3DcxOuG4-5UZ9486lLHAx7IOuAhPgVHpQGsQiqJ7Y3fTaWFr6rRFPL12rVg";
|
||||
|
||||
@@ -107,7 +101,6 @@ public class ApplicationTest {
|
||||
)
|
||||
).isEqualTo("f721e7b0d5415302f5fe7dc5beb2938a");
|
||||
|
||||
|
||||
//list
|
||||
assertThat(
|
||||
StrUtil.toMD5(
|
||||
@@ -120,7 +113,6 @@ public class ApplicationTest {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 证书操作
|
||||
*
|
||||
@@ -142,15 +134,13 @@ public class ApplicationTest {
|
||||
// String dataStr = "{\"ret\":\"0\",\"expireTime\":\"2015/10/28 23:59:59\",\"rettxt\":\"OK\",\"token\":\"69296128A59798E2D423D3B1A9F766F4\"}";
|
||||
String dataStr = "{\"foodsCode\":\"49\",\"latlng\":\"22.5,114.0\",\"pageIndex\":1,\"pageSize\":10}";
|
||||
|
||||
|
||||
|
||||
/***************************************************************************************************************************************************************************************************************************************/
|
||||
//客户端公钥加密
|
||||
// String publicEncryptResult = RSA.publicEncrypt(dataStr, RSA2.getPublicKey(publicKey));
|
||||
// System.out.println(publicEncryptResult);
|
||||
// System.out.println(StrUtil.toMD5(dataStr));
|
||||
|
||||
String publicEncryptResult="KHAtNzGkT/Mn7d/Ei6aoZ8KCA04mYJi5b/sxt/Jgzq76jNi0O/EMACDsipgQuwZTJrrys5xOPyy4\n1Gf8LMEldZE3GeY3i92A5jnH7IeWnLojYhNaKdIuLuf4l5uJmFgpzxhoxqSkp2JJ5Vbt8j5Hy4ov\n7tfxPDBwnT6FSfDqGLU\u003d\n";
|
||||
String publicEncryptResult = "KHAtNzGkT/Mn7d/Ei6aoZ8KCA04mYJi5b/sxt/Jgzq76jNi0O/EMACDsipgQuwZTJrrys5xOPyy4\n1Gf8LMEldZE3GeY3i92A5jnH7IeWnLojYhNaKdIuLuf4l5uJmFgpzxhoxqSkp2JJ5Vbt8j5Hy4ov\n7tfxPDBwnT6FSfDqGLU\u003d\n";
|
||||
|
||||
//服务器私钥解密
|
||||
String privateDecryptResult = RSA.privateDecrypt(publicEncryptResult, RSA2.getPrivateKey(privateKey, privateAlias, privatePwd));
|
||||
@@ -168,9 +158,9 @@ public class ApplicationTest {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* key加解密
|
||||
*
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @throws InvalidKeySpecException
|
||||
*/
|
||||
@@ -179,7 +169,6 @@ public class ApplicationTest {
|
||||
String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCX9uSsfJeIDIPzxCtwwFh5vrIKar69i3DPUTDEiKPRdtmADa8Ls6KAsPVpzgtQYoYVpYBoMbBtp0cGRoQULO83NWIAhmsU2cvd0nmGlB2xPRz+uGYW1rsYyCM8RSvfAwCVNsJD10A9voLhRQuYHPIDmay1sBA/casvEvYwMqDZtQIDAQAB";
|
||||
System.out.println(publicKey.length());
|
||||
|
||||
|
||||
// String privateKey = "MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAiSo5blJ9-QJ0_QElcy5AaRTq-3oO4lJ8PvIOIt-Xr5SUFODVj3DUbiy6_0bxQYO3NiYHlXPb37UVV3jjlXJsXwIDAQABAkBE0WOJH2hGs93gRl_0vwLf9ffDfkTTdlER_73p70aad3QZRslEkinQH7G5aE_DgBm5m72TCeH-PD2FZ2lwtavBAiEAvnRown5Lpqbl0tN_OUxr_e1u9d_-8dNL_JEETO7BZCECIQC4XtY-18j0bVVLxaXPjKQ00D59yntwObihDNyRK0nAfwIgHPHEGgrnpGQo-Wl7JFIg925mNqfcLxRVsAS6CpcefQECIQCUsLdsmy6QIhTmNRJSXoSXq1KatE_05DhIekzwLs8eFQIgfMawMiu52ZxBI5_pZ7ancQZ6Dsxl45utFqJShzV1pio";
|
||||
//// String publicKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIkqOW5SffkCdP0BJXMuQGkU6vt6DuJSfD7yDiLfl6-UlBTg1Y9w1G4suv9G8UGDtzYmB5Vz29-1FVd445VybF8CAwEAAQ";
|
||||
// String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCX9uSsfJeIDIPzxCtwwFh5vrIKar69i3DPUTDEiKPRdtmADa8Ls6KAsPVpzgtQYoYVpYBoMbBtp0cGRoQULO83NWIAhmsU2cvd0nmGlB2xPRz+uGYW1rsYyCM8RSvfAwCVNsJD10A9voLhRQuYHPIDmay1sBA/casvEvYwMqDZtQIDAQAB";
|
||||
|
@@ -1,7 +1,5 @@
|
||||
package com.yexuejc.springboot.base.test;
|
||||
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
import java.io.*;
|
||||
import java.security.KeyStore;
|
||||
import java.security.PrivateKey;
|
||||
@@ -9,8 +7,11 @@ import java.security.PublicKey;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* 生成公钥工具; http://bijian1013.iteye.com/blog/2339874
|
||||
*
|
||||
* @ClassName: KeyStoreHelper
|
||||
* @Description:
|
||||
* @author: maxf
|
||||
@@ -33,7 +34,7 @@ public class KeyStoreHelper {
|
||||
byte[] publicKeyBytes = publicKey.getEncoded();
|
||||
// byte[] privateKeyBytes = privateKey.getEncoded();
|
||||
|
||||
String publicKeyBase64 = new BASE64Encoder().encode(publicKeyBytes);
|
||||
String publicKeyBase64 = Base64.getEncoder().encodeToString(publicKeyBytes);
|
||||
// String privateKeyBase64 = new BASE64Encoder().encode(privateKeyBytes);
|
||||
|
||||
System.out.println("publicKeyBase64.length():" + publicKeyBase64.length());
|
||||
|
@@ -4,11 +4,9 @@ import com.aliyun.mns.model.Message;
|
||||
import com.yexuejc.base.util.JsonUtil;
|
||||
import com.yexuejc.base.util.StrUtil;
|
||||
import com.yexuejc.springboot.base.autoconfigure.MnsFacade;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -20,7 +18,6 @@ import java.util.Map;
|
||||
* @Description
|
||||
* @date 2018/11/1 14:25
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class MnsTest {
|
||||
|
||||
|
@@ -6,11 +6,9 @@ import com.yexuejc.base.util.StrUtil;
|
||||
import com.yexuejc.springboot.base.autoconfigure.OssFacade;
|
||||
import com.yexuejc.springboot.base.exception.ImageException;
|
||||
import com.yexuejc.springboot.base.util.LogUtil;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
@@ -23,7 +21,6 @@ import java.io.InputStream;
|
||||
* @Description
|
||||
* @date 2018/11/1 14:58
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class OssTest {
|
||||
@Autowired
|
||||
@@ -32,11 +29,11 @@ public class OssTest {
|
||||
/**
|
||||
* 上传图片到oss
|
||||
* <p>
|
||||
* 这里是模拟微信登录时,获取到微信头像地址,缓存到base64,然后上传到OSS
|
||||
* 这里是模拟微信登录时,获取到微信头像地址,缓存到base64,然后上传到OSS
|
||||
* </p>
|
||||
*/
|
||||
@Test
|
||||
public void put(){
|
||||
public void put() {
|
||||
putOss4Head(null, "https://avatar.csdn.net/7/8/1/3_wulex.jpg");
|
||||
}
|
||||
|
||||
|
@@ -3,8 +3,7 @@ package com.yexuejc.springboot.base.test;
|
||||
import com.yexuejc.base.util.JsonUtil;
|
||||
import com.yexuejc.base.util.StrUtil;
|
||||
import com.yexuejc.springboot.base.autoconfigure.MutiRedisAutoConfiguration;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
@@ -24,7 +23,6 @@ import java.util.concurrent.TimeUnit;
|
||||
* @Description
|
||||
* @date 2018/11/1 11:16
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class RedisTest {
|
||||
/**
|
||||
|
@@ -73,9 +73,9 @@ yexuejc.redis.db1=true
|
||||
spring.redis.jedis.pool.max-active=100
|
||||
spring.redis.jedis.pool.max-idle=10
|
||||
spring.redis.jedis.pool.min-idle=3
|
||||
spring.redis.host=121.42.165.89
|
||||
spring.redis.password=
|
||||
spring.redis.port=16379
|
||||
spring.redis.host=192.168.0.107
|
||||
spring.redis.password=yexuejc2022
|
||||
spring.redis.port=6379
|
||||
|
||||
|
||||
#db
|
||||
|
Reference in New Issue
Block a user