fix: 合并

This commit is contained in:
huchuansai
2025-09-01 10:03:13 +08:00
624 changed files with 74207 additions and 6595 deletions

View File

@@ -6,7 +6,6 @@ import com.starry.common.constant.CacheConstants;
import com.starry.common.redis.RedisCache;
import com.starry.common.utils.SpringUtils;
import com.starry.common.utils.StringUtils;
import java.util.Collection;
import java.util.List;
@@ -18,7 +17,8 @@ public class DictUtils {
/**
* 获取 cache key
*
* @param key 参数键
* @param key
* 参数键
* @return 缓存键key
*/
public static String getCacheKey(String key) {
@@ -28,7 +28,8 @@ public class DictUtils {
/**
* 获取字典缓存
*
* @param key 参数键
* @param key
* 参数键
* @return dictDatas 字典数据列表
*/
public static List<SysDictDataEntity> getDictCache(String key) {
@@ -42,8 +43,10 @@ public class DictUtils {
/**
* 设置字典缓存
*
* @param key 参数键
* @param dataList 字典数据列表
* @param key
* 参数键
* @param dataList
* 字典数据列表
*/
public static void setDictCache(String key, List<SysDictDataEntity> dataList) {
SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dataList);

View File

@@ -1,11 +1,10 @@
package com.starry.admin.utils;
import com.alibaba.excel.EasyExcel;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
/**
* @author admin
@@ -16,7 +15,8 @@ public class ExcelUtils {
return EasyExcel.read(is).head(pojoClass).sheet().doReadSync();
}
public static void exportEasyExcel(HttpServletResponse response, Class<?> pojoClass, List<?> list, String sheetName) {
public static void exportEasyExcel(HttpServletResponse response, Class<?> pojoClass, List<?> list,
String sheetName) {
try {
EasyExcel.write(response.getOutputStream(), pojoClass).sheet(sheetName).doWrite(list);
} catch (IOException e) {

View File

@@ -1,5 +1,16 @@
package com.starry.admin.utils;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
@@ -18,18 +29,6 @@ import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class HttpUtils {
/**
@@ -43,10 +42,8 @@ public class HttpUtils {
* @return
* @throws Exception
*/
public static HttpResponse doGet(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys)
throws Exception {
public static HttpResponse doGet(String host, String path, String method, Map<String, String> headers,
Map<String, String> querys) throws Exception {
HttpClient httpClient = wrapClient(host);
HttpGet request = new HttpGet(buildUrl(host, path, querys));
@@ -69,11 +66,8 @@ public class HttpUtils {
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
Map<String, String> bodys)
throws Exception {
public static HttpResponse doPost(String host, String path, String method, Map<String, String> headers,
Map<String, String> querys, Map<String, String> bodys) throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
@@ -107,11 +101,8 @@ public class HttpUtils {
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
String body)
throws Exception {
public static HttpResponse doPost(String host, String path, String method, Map<String, String> headers,
Map<String, String> querys, String body) throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
@@ -138,11 +129,8 @@ public class HttpUtils {
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
byte[] body)
throws Exception {
public static HttpResponse doPost(String host, String path, String method, Map<String, String> headers,
Map<String, String> querys, byte[] body) throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
@@ -169,11 +157,8 @@ public class HttpUtils {
* @return
* @throws Exception
*/
public static HttpResponse doPut(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
String body)
throws Exception {
public static HttpResponse doPut(String host, String path, String method, Map<String, String> headers,
Map<String, String> querys, String body) throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPut request = new HttpPut(buildUrl(host, path, querys));
@@ -200,11 +185,8 @@ public class HttpUtils {
* @return
* @throws Exception
*/
public static HttpResponse doPut(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
byte[] body)
throws Exception {
public static HttpResponse doPut(String host, String path, String method, Map<String, String> headers,
Map<String, String> querys, byte[] body) throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPut request = new HttpPut(buildUrl(host, path, querys));
@@ -230,10 +212,8 @@ public class HttpUtils {
* @return
* @throws Exception
*/
public static HttpResponse doDelete(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys)
throws Exception {
public static HttpResponse doDelete(String host, String path, String method, Map<String, String> headers,
Map<String, String> querys) throws Exception {
HttpClient httpClient = wrapClient(host);
HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
@@ -244,7 +224,8 @@ public class HttpUtils {
return httpClient.execute(request);
}
private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
private static String buildUrl(String host, String path, Map<String, String> querys)
throws UnsupportedEncodingException {
StringBuilder sbUrl = new StringBuilder();
sbUrl.append(host);
if (!StringUtils.isBlank(path)) {
@@ -312,4 +293,4 @@ public class HttpUtils {
throw new RuntimeException(ex);
}
}
}
}

View File

@@ -8,27 +8,26 @@ package com.starry.admin.utils;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
/**
* List<Integer> ==> string
* List<Integer> ==> string
*
* @Date 2022-10-08
*/
public class ListToStringHandle extends BaseTypeHandler<List> {
@Override
public void setNonNullParameter(PreparedStatement preparedStatement, int i, List list, JdbcType jdbcType) throws SQLException {
public void setNonNullParameter(PreparedStatement preparedStatement, int i, List list, JdbcType jdbcType)
throws SQLException {
if (CollectionUtils.isNotEmpty(list)) {
preparedStatement.setString(i, JSON.toJSONString(list));
} else {
@@ -55,4 +54,3 @@ public class ListToStringHandle extends BaseTypeHandler<List> {
return result == null ? new ArrayList<>() : JSONArray.parseArray(result);
}
}

View File

@@ -1,19 +1,19 @@
package com.starry.admin.utils;
import com.starry.admin.common.exception.CustomException;
/**
* 金额辅助类
*
* @author admin
*/
public class MoneyUtils {
/**
* 校验金钱值是否正常
*
* @param money 金钱值
* @param money
* 金钱值
*/
public static void verificationTypeIsNormal(String money) {
if (money == null || money.isEmpty()) {
@@ -33,5 +33,4 @@ public class MoneyUtils {
}
}
}

View File

@@ -1,6 +1,5 @@
package com.starry.admin.utils;
import com.starry.admin.common.domain.LoginUser;
import com.starry.admin.common.security.entity.JwtUser;
import com.starry.admin.modules.system.module.entity.SysUserEntity;
@@ -80,7 +79,8 @@ public class SecurityUtils {
/**
* 生成BCryptPasswordEncoder密码
*
* @param password 密码
* @param password
* 密码
* @return 加密字符串
*/
public static String encryptPassword(String password) {
@@ -91,8 +91,10 @@ public class SecurityUtils {
/**
* 判断密码是否相同
*
* @param rawPassword 真实密码
* @param encodedPassword 加密后字符
* @param rawPassword
* 真实密码
* @param encodedPassword
* 加密后字符
* @return 结果
*/
public static boolean matchesPassword(String rawPassword, String encodedPassword) {