mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-12 21:53:48 +08:00
v3.0.0 【优化】登录日志回显、版本号改为3.0、文件下载
This commit is contained in:
@@ -4,12 +4,12 @@
|
||||
<parent>
|
||||
<groupId>net.1024lab</groupId>
|
||||
<artifactId>sa-parent</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>3.0.0</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>sa-base</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>3.0.0</version>
|
||||
|
||||
<name>sa-base</name>
|
||||
<description>sa-base project</description>
|
||||
@@ -248,12 +248,17 @@
|
||||
<artifactId>poi-scratchpad</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.1024lab</groupId>
|
||||
<artifactId>smartdb</artifactId>
|
||||
<version>${smartdb.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import net.lab1024.sa.base.common.constant.StringConst;
|
||||
import org.lionsoul.ip2region.xdb.Searcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -46,21 +47,19 @@ public class SmartIpUtil {
|
||||
* @return 返回结果例 [河南省, 洛阳市, 洛龙区]
|
||||
*/
|
||||
public static List<String> getRegionList(String ipStr) {
|
||||
List<String> regionList = new ArrayList<>();
|
||||
try {
|
||||
List<String> regionList = new ArrayList<>();
|
||||
if (SmartStringUtil.isEmpty(ipStr)) {
|
||||
return regionList;
|
||||
}
|
||||
ipStr = ipStr.trim();
|
||||
String region = IP_SEARCHER.search(ipStr);
|
||||
String[] split = region.split("\\|");
|
||||
for (String str : split) {
|
||||
regionList.add(str);
|
||||
}
|
||||
return regionList;
|
||||
regionList.addAll(Arrays.asList(split));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
log.error("解析ip地址出错", e);
|
||||
}
|
||||
return regionList;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,7 +76,8 @@ public class SmartIpUtil {
|
||||
ipStr = ipStr.trim();
|
||||
return IP_SEARCHER.search(ipStr);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
log.error("解析ip地址出错", e);
|
||||
return StringConst.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,8 @@ public class FileConfig implements WebMvcConfigurer {
|
||||
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey)))
|
||||
.withClientConfiguration(clientConfig)
|
||||
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpoint, region))
|
||||
.withPathStyleAccessEnabled(true)
|
||||
.withPathStyleAccessEnabled(false)
|
||||
.withChunkedEncodingDisabled(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.lab1024.sa.base.module.support.file.service;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.amazonaws.services.s3.AmazonS3;
|
||||
import com.amazonaws.services.s3.model.CannedAccessControlList;
|
||||
import com.amazonaws.services.s3.model.ObjectMetadata;
|
||||
@@ -30,6 +32,7 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -84,7 +87,8 @@ public class FileStorageCloudServiceImpl implements IFileStorageService {
|
||||
|
||||
String fileType = FilenameUtils.getExtension(originalFileName);
|
||||
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
String fileKey = path + uuid + "." + fileType;
|
||||
String time = LocalDateTimeUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_FORMATTER);
|
||||
String fileKey = path + uuid + "_" + time+ "." + fileType;
|
||||
|
||||
// 文件名称 URL 编码
|
||||
String urlEncoderFilename;
|
||||
|
||||
@@ -40,7 +40,7 @@ public interface LoginLogDao extends BaseMapper<LoginLogEntity> {
|
||||
* @param userType
|
||||
* @return LoginLogVO
|
||||
*/
|
||||
LoginLogVO queryLastByUserId(@Param("userId") Long userId,@Param("userType") Integer userType);
|
||||
LoginLogVO queryLastByUserId(@Param("userId") Long userId,@Param("userType") Integer userType, @Param("loginLogResult")Integer loginLogResult);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@ public class LoginLogService {
|
||||
* @author 卓大
|
||||
* @description 查询上一个登录记录
|
||||
*/
|
||||
public LoginLogVO queryLastByUserId(Long userId, UserTypeEnum userTypeEnum) {
|
||||
return loginLogDao.queryLastByUserId(userId,userTypeEnum.getValue());
|
||||
public LoginLogVO queryLastByUserId(Long userId, UserTypeEnum userTypeEnum, LoginLogResultEnum loginLogResultEnum) {
|
||||
return loginLogDao.queryLastByUserId(userId,userTypeEnum.getValue(), loginLogResultEnum.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class ProtectPasswordService {
|
||||
* @param encryptedPassword
|
||||
* @return
|
||||
*/
|
||||
public String decryptSm2Password(String encryptedPassword) {
|
||||
public String decryptPassword(String encryptedPassword) {
|
||||
return apiEncryptService.decrypt(encryptedPassword);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
spring:
|
||||
# 数据库连接信息
|
||||
datasource:
|
||||
url: jdbc:p6spy:mysql://127.0.0.1:3306/smart_admin_v3?autoReconnect=true&useServerPreparedStmts=false&rewriteBatchedStatements=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:p6spy:mysql://127.0.0.1/smart_admin_v3?autoReconnect=true&useServerPreparedStmts=false&rewriteBatchedStatements=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: Java@1024
|
||||
password: Zhuoda.666
|
||||
initial-size: 2
|
||||
min-idle: 2
|
||||
max-active: 10
|
||||
@@ -65,6 +65,22 @@ server:
|
||||
pattern: "%t %{X-Forwarded-For}i %a %r %s (%D ms) %I (%B byte)"
|
||||
|
||||
|
||||
# 文件上传 配置
|
||||
#file:
|
||||
# storage:
|
||||
# mode: local
|
||||
# local:
|
||||
# upload-path: /home/smart_admin_v3/upload/ #文件上传目录
|
||||
# url-prefix:
|
||||
# cloud:
|
||||
# region: oss-cn-qingdao
|
||||
# endpoint: oss-cn-qingdao.aliyuncs.com
|
||||
# bucket-name: common
|
||||
# access-key:
|
||||
# secret-key:
|
||||
# url-prefix: https://${file.storage.cloud.bucket-name}.${file.storage.cloud.endpoint}/
|
||||
# private-url-expire-seconds: 3600
|
||||
|
||||
# 文件上传 配置
|
||||
file:
|
||||
storage:
|
||||
@@ -73,15 +89,14 @@ file:
|
||||
upload-path: /home/smart_admin_v3/upload/ #文件上传目录
|
||||
url-prefix:
|
||||
cloud:
|
||||
region: oss-cn-qingdao
|
||||
endpoint: oss-cn-qingdao.aliyuncs.com
|
||||
bucket-name: common
|
||||
region: oss-cn-hangzhou
|
||||
endpoint: oss-cn-hangzhou.aliyuncs.com
|
||||
bucket-name: smart-admin
|
||||
access-key:
|
||||
secret-key:
|
||||
url-prefix: https://${file.storage.cloud.bucket-name}.${file.storage.cloud.endpoint}/
|
||||
private-url-expire-seconds: 3600
|
||||
|
||||
|
||||
# open api配置
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
where
|
||||
user_id = #{userId}
|
||||
and user_type = #{userType}
|
||||
order by create_time desc
|
||||
and login_result = #{loginLogResult}
|
||||
order by login_log_id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user