🎨 注释更新

This commit is contained in:
fuhouyin 2023-12-04 10:03:07 +08:00
parent d056570243
commit 851bd8a9db
7 changed files with 21 additions and 28 deletions

View File

@ -21,8 +21,6 @@ public class Base64Utils {
/**
* BASE64字符串解码为二进制数据
* @param base64
* @throws Exception
*/
public static byte[] decode(String base64) throws Exception {
return Base64.decodeBase64(base64.getBytes());
@ -31,8 +29,6 @@ public class Base64Utils {
/**
* 二进制数据编码为BASE64字符串
* @param bytes
* @throws Exception
*/
public static String encode(byte[] bytes) throws Exception {
return new String(Base64.encodeBase64(bytes));
@ -44,7 +40,6 @@ public class Base64Utils {
* 大文件慎用可能会导致内存溢出
*
* @param filePath 文件绝对路径
* @throws Exception
*/
public static String encodeFile(String filePath) throws Exception {
byte[] bytes = fileToByte(filePath);
@ -55,7 +50,6 @@ public class Base64Utils {
* BASE64字符串转回文件
* @param filePath 文件绝对路径
* @param base64 编码字符串
* @throws Exception
*/
public static void decodeToFile(String filePath, String base64) throws Exception {
byte[] bytes = decode(base64);
@ -65,8 +59,6 @@ public class Base64Utils {
/**
* 文件转换为二进制数组
* @param filePath 文件路径
* @return
* @throws Exception
*/
public static byte[] fileToByte(String filePath) throws Exception {
byte[] data = new byte[0];

View File

@ -11,10 +11,6 @@ import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.Security;
/**
* @author fuhouyin
* @time 2023/2/1 11:53
*/
public class CryptoUtils {
static {

View File

@ -10,17 +10,13 @@ import java.util.Calendar;
import java.util.Date;
import java.util.Objects;
/**
* @author fuhouyin
*/
public class DateTimeUtils {
/**
* 计算两个日期之间相差的天数
* @param smdate
* @param bdate
* @return
* @throws ParseException
*/
public static int daysBetween(Date smdate, Date bdate) throws ParseException {
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
@ -41,7 +37,6 @@ public class DateTimeUtils {
* 超期 不包括今天
* @param endDate 截至时间
* @param finishDate 完成时间
* @return
*/
public static TimeOverdueAdventPojo overdueAdvent(Date endDate, Date finishDate) throws ParseException {

View File

@ -1,5 +1,9 @@
package utils;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
@ -8,6 +12,9 @@ import java.util.Map;
public class EntityUtil {
/**
* 实体类转Map<String,Object>
*/
public static Map<String, Object> entityToMap(Object entity) {
Map<String, Object> result = new HashMap<>();
Field[] fields = entity.getClass().getDeclaredFields();
@ -51,4 +58,17 @@ public class EntityUtil {
field.setAccessible(true);
return field.get(obj);
}
/**
* 解析json字符串为MultiValueMap
*/
public static MultiValueMap<String, Object> getMultiValueMap(String json) throws Exception {
ObjectMapper objectMapper = new ObjectMapper();
Map<String, Object> map = objectMapper.readValue(json, Map.class);
MultiValueMap<String, Object> multiValueMap = new LinkedMultiValueMap<>();
for (Map.Entry<String, Object> entry : map.entrySet()) {
multiValueMap.add(entry.getKey(), entry.getValue());
}
return multiValueMap;
}
}

View File

@ -56,7 +56,6 @@ public class FileUtils {
* 保存文件
* @param path 文件地址
* @param multipartFile 文件
* @throws Exception
*/
public static void saveFile(String path, MultipartFile multipartFile) throws Exception {
File dest = new File(path);
@ -68,7 +67,6 @@ public class FileUtils {
* 将InputStream写入本地文件
* @param destination 写入本地目录 指定到文件名
* @param input 输入流
* @throws IOException
*/
public static void writeToLocal(String destination, InputStream input)
throws IOException {
@ -86,8 +84,6 @@ public class FileUtils {
/**
* 网络文件转File
* @param url
* @return File
* @throws Exception
*/
public static File getFile(String url) throws Exception {
//对本地文件命名

View File

@ -11,9 +11,6 @@ import java.io.PrintWriter;
import java.security.MessageDigest;
import java.util.Arrays;
/**
* @author fuhouyin
*/
@RestController
@RequestMapping("/wxRequest")
public class WxRequestController {

View File

@ -9,9 +9,6 @@ import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.Map;
/**
* @author fuhouyin
*/
@RestController
@RequestMapping("/wxSendMsg")
public class WxSendMsgController {