Skip to content

Commit c544cdb

Browse files
Add<utils>: add some utils
1 parent 4876d6d commit c544cdb

6 files changed

Lines changed: 72 additions & 5 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111
<groupId>com.talex.frame</groupId>
1212
<artifactId>TalexFrame</artifactId>
13-
<version>6.4.0-SNAPSHOT</version>
13+
<version>7.0.0-SNAPSHOT</version>
1414
<name>TalexFrame</name>
1515
<description>TalexFrame</description>
1616
<properties>

src/main/java/com/talex/talexframe/frame/core/modules/schedule/FrameRunnable.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
public class FrameRunnable {
1717

1818
protected TFrame tFrame = TFrame.tframe;
19-
protected Mysql mysql = new DAOManager.ProcessorGetter<Mysql>().getProcessor();
19+
// protected
2020

2121
// private Runnable runnable;
2222
//
@@ -44,6 +44,8 @@ public class FrameRunnable {
4444
@Scheduled( cron = "0 0/15 0/1 * * ?")
4545
public void mysqlChecker() {
4646

47+
Mysql mysql = new DAOManager.ProcessorGetter<Mysql>().getProcessor();
48+
4749
mysql.checkStatus();
4850

4951
}

src/main/java/com/talex/talexframe/frame/core/pojo/dao/factory/DAOManager.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import cn.hutool.core.util.ClassUtil;
44
import com.talex.talexframe.frame.core.pojo.dao.interfaces.IDataProcessor;
5-
import com.talex.talexframe.frame.core.talex.TFrame;
65
import lombok.SneakyThrows;
76

87
import java.lang.reflect.ParameterizedType;
@@ -17,8 +16,6 @@
1716
*/
1817
public class DAOManager {
1918

20-
private final TFrame tframe = TFrame.tframe;
21-
2219
private static final Map<Class<?>, IDataProcessor> daoMap = new HashMap<>();
2320

2421
@SneakyThrows
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.talex.talexframe.frame.utils;
2+
3+
import java.util.Arrays;
4+
5+
/**
6+
* <br /> {@link com.talex.talexframe.frame.utils Package }
7+
*
8+
* @author TalexDreamSoul
9+
* @date 22/03/06 下午 12:58 <br /> Project: TalexFrame <br />
10+
*/
11+
public class FileUtil {
12+
13+
private static final String[] IMAGE_TYPE = new String[]{ "bmp", "jpg", "png", "tif", "gif", "pcx", "tga", "exif",
14+
"fpx", "svg", "psd", "cdr", "pcd", "dxf", "ufo", "eps", "ai", "raw", "WMF", "webp", "avif", "apng" };
15+
16+
/** 读取一个文件拓展名并判断文件是否为图片 */
17+
public static boolean isImage(String extension) {
18+
19+
return Arrays.stream(IMAGE_TYPE).anyMatch(s -> s.equalsIgnoreCase(extension) );
20+
21+
}
22+
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.talex.talexframe.frame.utils;
2+
3+
import cn.hutool.http.HttpUtil;
4+
5+
/**
6+
* <br /> {@link com.talex.frame.utils Package }
7+
*
8+
* @author TalexDreamSoul
9+
* @date 2022/1/25 23:37 <br /> Project: TFunction <br />
10+
*/
11+
public class IpLocalUtil {
12+
13+
public static String getLocal(String ip) {
14+
15+
String result = HttpUtil.get("http://pv.sohu.com/cityjson?ie=utf-8/ip=103.97.200.41");
16+
17+
int ind = result.indexOf("\"cname\": \"") + "\"cname\": \"".length();
18+
19+
return result.substring(ind, result.indexOf("\"}", ind));
20+
21+
}
22+
23+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.talex.talexframe.frame.utils;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Getter;
5+
6+
import java.sql.ResultSet;
7+
8+
/**
9+
* <br /> {@link com.talex.frame.utils Package }
10+
*
11+
* @author TalexDreamSoul
12+
* @date 22/02/08 下午 10:03 <br /> Project: TFunction <br />
13+
*/
14+
@AllArgsConstructor
15+
@Getter
16+
public class WrappedResultSet {
17+
18+
private ResultSet rs;
19+
20+
private int status;
21+
22+
}

0 commit comments

Comments
 (0)