mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-16 07:33:49 +08:00
v3.0.0 【优化】登录日志回显、版本号改为3.0、文件下载
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user