优化注释

v1.4.1
hiparker 4 years ago
parent 7dbea53154
commit 04f5e7e68a

@ -11,11 +11,10 @@ import java.util.TreeSet;
import java.util.stream.Collectors;
/**
* @BelongsProject: think-bboss-parent
* @BelongsPackage: com.think.bboss.common.utils
* @Author: Parker
* @CreateTime: 2021-01-05 14:26
* @Description: List
* List
*
* @author Parker
* @date 2021-01-05 14:26
*/
@Slf4j
public final class ListDistinctUtil {

@ -12,11 +12,10 @@ import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
/**
* @BelongsProject: think-bboss-parent
* @BelongsPackage: com.think.bboss.common.utils
* @Author: Parker
* @CreateTime: 2021-01-05 14:26
* @Description: OutputStream
* OutputStream
*
* @author Parker
* @date 2021-01-05 14:26
*/
@Slf4j
public final class OutputStreamUtil {

@ -24,7 +24,9 @@ import java.util.jar.JarInputStream;
/**
*
*
* @author Parker
* @date 2020-09-19 23:21
*/
public final class PackageUtil {
/**

@ -44,10 +44,10 @@ import java.util.concurrent.ConcurrentHashMap;
* <version>1.8.3</version>
* </dependency>
*
*使
*eg:
* opsli:
* config:
* 使
* eg:
* opsli:
* config:
* key: value
* list:
* -
@ -58,15 +58,18 @@ import java.util.concurrent.ConcurrentHashMap;
* - name: map
* age: 121
*
*,"opsli.config" : new ConfigBean().prefix("opsli.config").getObj()
* ,"opsli.config" : new ConfigBean().prefix("opsli.config").getObj()
*
*list,"opsli.config.list.1" : new ConfigBean().prefix("opsli.config.list.1").getObj()
* list,"opsli.config.list.1" : new ConfigBean().prefix("opsli.config.list.1").getObj()
*
*list,"opsli.config.map.1.name" :new ConfigBean().prefix("opsli.config.list.1").getString()
* list,"opsli.config.map.1.name" :new ConfigBean().prefix("opsli.config.list.1").getString()
*
*
* hutool Props Yaml
*
*
* @author Parker
* @date 2021-01-05 14:26
*/
@Slf4j
public class Props {
@ -117,7 +120,7 @@ public class Props {
/**
* Obj
* @return
* @return Object
*/
public Object getObj(String key){
return this.getObj(key, null);
@ -125,7 +128,7 @@ public class Props {
/**
* Obj
* @return
* @return Object
*/
public Object getObj(String key, Object def){
if(key == null || "".equals(key) ){
@ -146,7 +149,7 @@ public class Props {
/**
*
* @return
* @return String
*/
public String getStr(String key){
return this.getStr(key, null);
@ -154,7 +157,9 @@ public class Props {
/**
*
* @return
* @param key
* @param def
* @return String
*/
public String getStr(String key, String def){
if(key == null || "".equals(key) ){
@ -171,7 +176,8 @@ public class Props {
/**
* Int
* @return
* @param key
* @return Integer
*/
public Integer getInt(String key){
return this.getInt(key, null);
@ -179,7 +185,9 @@ public class Props {
/**
* Int
* @return
* @param key
* @param def
* @return Integer
*/
public Integer getInt(String key, Integer def){
if(key == null || "".equals(key) ){
@ -196,7 +204,8 @@ public class Props {
/**
* Long
* @return
* @param key
* @return Long
*/
public Long getLong(String key){
return this.getLong(key, null);
@ -204,7 +213,9 @@ public class Props {
/**
* Long
* @return
* @param key
* @param def
* @return Long
*/
public Long getLong(String key, Long def){
if(key == null || "".equals(key) ){
@ -222,7 +233,8 @@ public class Props {
/**
* Double
* @return
* @param key
* @return Double
*/
public Double getDouble(String key){
return this.getDouble(key, null);
@ -230,7 +242,9 @@ public class Props {
/**
* Double
* @return
* @param key
* @param def
* @return Double
*/
public Double getDouble(String key, Double def){
if(key == null || "".equals(key) ){
@ -249,7 +263,8 @@ public class Props {
/**
* Float
* @return
* @param key
* @return Float
*/
public Float getFloat(String key){
return this.getFloat(key, null);
@ -257,7 +272,9 @@ public class Props {
/**
* Float
* @return
* @param key
* @param def
* @return Float
*/
public Float getFloat(String key, Float def){
if(key == null || "".equals(key) ){
@ -275,7 +292,8 @@ public class Props {
/**
* Char
* @return
* @param key
* @return Character
*/
public Character getChar(String key){
return this.getChar(key, null);
@ -283,7 +301,9 @@ public class Props {
/**
* Char
* @return
* @param key
* @param def
* @return Character
*/
public Character getChar(String key, Character def){
if(key == null || "".equals(key) ){
@ -300,7 +320,8 @@ public class Props {
/**
*
* @return
* @param key
* @return Boolean
*/
public Boolean getBool(String key){
return this.getBool(key, null);
@ -308,7 +329,9 @@ public class Props {
/**
*
* @return
* @param key
* @param def
* @return Boolean
*/
public Boolean getBool(String key, Boolean def){
if(key == null || "".equals(key) ){
@ -324,16 +347,19 @@ public class Props {
}
/**
*
* @return
* List
* @param key
* @return List
*/
public List<String> getList(String key){
return this.getList(key, null);
}
/**
*
* @return
* List
* @param key
* @param def
* @return List
*/
public List<String> getList(String key, List<String> def){
if(key == null || "".equals(key) ){
@ -354,8 +380,8 @@ public class Props {
/**
*
* @param keys
* @return
* @param keys
* @return Object
*/
private Object getObject(String[] keys){
// 循环查找

@ -15,11 +15,10 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
/**
* @BelongsProject: think-bboss-parent
* @BelongsPackage: com.think.bboss.common.utils
* @Author: Parker
* @CreateTime: 2021-01-05 16:06
* @Description:
*
*
* @author Parker
* @date 2021-01-05 16:06
*/
@Slf4j
public final class RateLimiterUtil {
@ -44,7 +43,7 @@ public final class RateLimiterUtil {
/**
* IP
* @param ip
* @param ip IP
*/
public static void removeIp(String ip) {
LFU_CACHE.invalidate(ip);
@ -52,8 +51,8 @@ public final class RateLimiterUtil {
/**
*
* @param request
* @return
* @param request request
* @return boolean
*/
public static boolean enter(HttpServletRequest request) {
// 获得IP
@ -65,8 +64,8 @@ public final class RateLimiterUtil {
/**
*
* @param request
* @return
* @param request request
* @return boolean
*/
public static boolean enter(HttpServletRequest request, Double dfQps) {
// 获得IP
@ -79,7 +78,7 @@ public final class RateLimiterUtil {
/**
*
* @param clientIpAddress IP
* @return
* @return boolean
*/
public static boolean enter(String clientIpAddress, String resource) {
return RateLimiterUtil.enter(clientIpAddress, resource, null);
@ -89,8 +88,9 @@ public final class RateLimiterUtil {
*
* @param clientIpAddress IP
* @param dfQps QPS
* @return
* @return boolean
*/
@SuppressWarnings("UnstableApiUsage")
public static boolean enter(String clientIpAddress, String resource, Double dfQps) {
// 计时器
long t1 = System.currentTimeMillis();
@ -151,6 +151,7 @@ public final class RateLimiterUtil {
*
*/
@Data
@SuppressWarnings("UnstableApiUsage")
public static class RateLimiterInner {
/** qps */
@ -166,9 +167,9 @@ public final class RateLimiterUtil {
public static void main(String[] args) {
int count = 500;
RateLimiterUtil.removeIp("127.0.0.1");
for (int i = 0; i < 500; i++) {
int j = i;
for (int i = 0; i < count; i++) {
AsyncProcessQueueReFuse.execute(()->{
boolean enter = RateLimiterUtil.enter("127.0.0.1","/api/v1", 2d);
System.out.println(enter);

@ -26,14 +26,11 @@ import java.util.List;
import java.util.stream.Collectors;
/**
* @BelongsProject: opsli-boot
* @BelongsPackage: org.opsli.common.utils
* @Author: Parker
* @CreateTime: 2020-09-19 00:08
* @Description:
*
*
* Wrapper Wrapper
*
* @author Parker
* @date 2020-09-19 00:08
*/
@Slf4j
public final class WrapperUtil {
@ -96,7 +93,7 @@ public final class WrapperUtil {
* @param source
* @param target
* @param isClone
* @param <M>
* @param <M> M
* @return List<M>
*/
public static <T,M> List<M> transformInstance(Collection<T> source, Class<M> target, boolean isClone){

@ -25,10 +25,10 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
*
*
* @author Parker
* @date 2020-01-07
* <p>
*
*/
public class ZipUtils {
/**
@ -90,10 +90,10 @@ public class ZipUtils {
public static void main(String[] args) throws Exception {
List<Map<String, String>> list = new ArrayList<>();
OutputStream outputStream = new FileOutputStream(new File("/Users/system/Documents/脚本/opsli/test.zip"));
Map<String,String> m1 = new HashMap<String,String>(){{put("path","/f1/f2/f3/");put("name","1.txt");put("data","abcdefg");}};
Map<String,String> m2 = new HashMap<String,String>(){{put("path","/f1/f2/f3/f4/");put("name","2.txt");put("data","abcdefg");}};
Map<String,String> m3 = new HashMap<String,String>(){{put("path","");put("name","3.txt");put("data","abcdefg");}};
OutputStream outputStream = new FileOutputStream("/Users/system/Documents/脚本/opsli/test.zip");
Map<String,String> m1 = new HashMap<String,String>(10){{put("path","/f1/f2/f3/");put("name","1.txt");put("data","abcdefg");}};
Map<String,String> m2 = new HashMap<String,String>(10){{put("path","/f1/f2/f3/f4/");put("name","2.txt");put("data","abcdefg");}};
Map<String,String> m3 = new HashMap<String,String>(10){{put("path","");put("name","3.txt");put("data","abcdefg");}};
list.add(m1);
list.add(m2);

@ -64,7 +64,6 @@ public class ApiCryptoAsymmetricAop {
* post
* @param point point
*/
@SuppressWarnings("unchecked")
@Around("encryptAndDecrypt()")
public Object encryptAndDecryptHandle(ProceedingJoinPoint point) throws Throwable {
// 获得请求参数
@ -158,6 +157,7 @@ public class ApiCryptoAsymmetricAop {
* @param cryptoModel
* @return Object
*/
@SuppressWarnings("unchecked")
private Object resultEncrypt(Object returnValue, CryptoAsymmetricService asymmetric, CryptoAsymmetric cryptoModel) {
if(returnValue != null){
try {
@ -168,7 +168,6 @@ public class ApiCryptoAsymmetricAop {
ret.setData(
asymmetric.encrypt(cryptoModel, ret.getData())
);
returnValue = ret;
}else {
returnValue = asymmetric.encrypt(cryptoModel, returnValue);
}

@ -153,7 +153,7 @@ public class Page<T extends BaseEntity,E extends ApiWrapper> extends PageSeriali
private Long total;
/** 行 */
private List rows;
private List<?> rows;
}

Loading…
Cancel
Save