This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.seatone.digitaltwins.twins.datamiddleplatform; | |
import java.io.ByteArrayOutputStream; | |
import java.io.FileInputStream; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import java.net.HttpURLConnection; | |
import java.net.URL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 字符缓冲输入流 | |
* | |
* @author chenghao.li | |
*/ | |
public class BufferedInputStreamTest { | |
public static void main(String[] args) { | |
String path = "/Users/lichenghao/logs/nacos/config.log"; | |
StringBuilder stringBuilder = new StringBuilder(); | |
FileInputStream fis = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package util; | |
import org.apache.commons.lang3.StringUtils; | |
import java.time.LocalDate; | |
import java.time.LocalDateTime; | |
import java.time.ZoneId; | |
import java.time.format.DateTimeFormatter; | |
import java.time.format.DateTimeFormatterBuilder; | |
import java.util.Date; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 文件夹内的文件列表压缩为zip,不包括子文件夹 | |
* | |
* @author chenghao.li | |
*/ | |
public class ZipUtils { | |
private static final int BUFFER_SIZE = 2 * 1024; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @Description: 数据权限基类 | |
*/ | |
public abstract class BaseEsAccess implements EsAccess{ | |
private RoleManageDao roleManageDao = SpringContextUtil.getBean(RoleManageDao.class); | |
@Override | |
public void getAccessBoolQueryBuilder(BoolQueryBuilder boolQueryBuilder,SocUserInfoDO userInfoDO){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 利用正则匹配出 yyyy-MM-dd HH:mm:ss的日期 | |
* | |
* @param str 日期字符串例如:2022-01-01 12:12:12.0 | |
* @return 2022-01-01 12:12:12 | |
*/ | |
public String parseDatetime(String str) { | |
final String regex = "^([1-9]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\\s+(20|21|22|23|[0-1]\\d):[0-5]\\d:[0-5]\\d)"; | |
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); | |
final Matcher matcher = pattern.matcher(str); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 实体转MAP | |
* 同时格式化日期显示 | |
* | |
* @param obj 实体对象 | |
* @return Map<String, Object> | |
*/ | |
private static Map<String, Object> object2Map(Object obj) { | |
Map<String, Object> map = new HashMap<>(27); | |
if (obj == null) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RequestParamToMapUtil { | |
/** | |
* 从request中获得参数Map,并返回可读的Map | |
* | |
* @param request | |
* @return | |
*/ | |
@SuppressWarnings({ "unchecked", "rawtypes" }) | |
public static Map getParameterMap(HttpServletRequest request) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- 设置log4j2的自身log级别为warn --> | |
<!-- OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL --> | |
<configuration status="WARN" monitorInterval="30"> | |
<!--定义变量--> | |
<properties> | |
<property name="LOGS_BASE">${sys:user.home}/logs/java</property> | |
</properties> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration scan="true" scanPeriod="60 seconds" debug="false"> | |
<contextName>logback</contextName> | |
<property name="log.path" value="D:\\JAVA_LOGS\\transferservice_Logs\\"/> | |
<!--输出到控制台--> | |
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> | |
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> | |
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | |
<level>debug</level> | |
</filter> |
NewerOlder