1
This commit is contained in:
1056
src/main/java/cn/van/business/util/DateUtil.java
Normal file
1056
src/main/java/cn/van/business/util/DateUtil.java
Normal file
File diff suppressed because it is too large
Load Diff
118
src/main/java/cn/van/business/util/StringsUtil.java
Normal file
118
src/main/java/cn/van/business/util/StringsUtil.java
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
package cn.van.business.util;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字符串常量集
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class StringsUtil {
|
||||||
|
/**
|
||||||
|
* 空字符串
|
||||||
|
*/
|
||||||
|
public static final String EMPTY = "";
|
||||||
|
/**
|
||||||
|
* 逗号
|
||||||
|
*/
|
||||||
|
public static final String COMMA = ",";
|
||||||
|
/**
|
||||||
|
* 句点
|
||||||
|
*/
|
||||||
|
public static final String DOT = ".";
|
||||||
|
/**
|
||||||
|
* 下划线
|
||||||
|
*/
|
||||||
|
public static final String UNDERLINE = "_";
|
||||||
|
/**
|
||||||
|
* 空格
|
||||||
|
*/
|
||||||
|
public static final String SPACE = " ";
|
||||||
|
/**
|
||||||
|
* 等于
|
||||||
|
*/
|
||||||
|
public static final String EQUAL = "=";
|
||||||
|
/**
|
||||||
|
* 星号
|
||||||
|
*/
|
||||||
|
public static final String ASTERISK = "*";
|
||||||
|
/**
|
||||||
|
* 双引号
|
||||||
|
*/
|
||||||
|
public static final String DOUBLE_QUOTES = "\"";
|
||||||
|
/**
|
||||||
|
* 单引号
|
||||||
|
*/
|
||||||
|
public static final String SINGLE_QUOTES = "'";
|
||||||
|
/**
|
||||||
|
* 回车符
|
||||||
|
*/
|
||||||
|
public static final String ENTER = "\n";
|
||||||
|
/**
|
||||||
|
* 左括弧
|
||||||
|
*/
|
||||||
|
public static final String LEFT_BRACKET = "(";
|
||||||
|
/**
|
||||||
|
* 右括弧
|
||||||
|
*/
|
||||||
|
public static final String RIGHT_BRACKET = ")";
|
||||||
|
/**
|
||||||
|
* 冒号
|
||||||
|
*/
|
||||||
|
public static final String COLON = ":";
|
||||||
|
/**
|
||||||
|
* 分号
|
||||||
|
*/
|
||||||
|
public static final String SEMICOLON = ";";
|
||||||
|
/**
|
||||||
|
* 斜杠
|
||||||
|
*/
|
||||||
|
public static final String SLASH = "/";
|
||||||
|
/**
|
||||||
|
* 反斜杠
|
||||||
|
*/
|
||||||
|
public static final String BACKSLASH = "\\";
|
||||||
|
/**
|
||||||
|
* 百分号
|
||||||
|
*/
|
||||||
|
public static final String PERCENT = "%";
|
||||||
|
/**
|
||||||
|
* 减号
|
||||||
|
*/
|
||||||
|
public static final String MINUS = "-";
|
||||||
|
/**
|
||||||
|
* 加号
|
||||||
|
*/
|
||||||
|
public static final String PLUS = "+";
|
||||||
|
/**
|
||||||
|
* 与号
|
||||||
|
*/
|
||||||
|
public static final String AND = "&";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @
|
||||||
|
*/
|
||||||
|
public static final String AT = "@";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 井号
|
||||||
|
*/
|
||||||
|
public static final String WELL = "#";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字符编码:UTF-8
|
||||||
|
*/
|
||||||
|
public static final String ENCODING_UTF8 = "UTF-8";
|
||||||
|
/**
|
||||||
|
* 字符编码:GBK
|
||||||
|
*/
|
||||||
|
public static final String ENCODING_GBK = "GBK";
|
||||||
|
/**
|
||||||
|
* 默认字符编码
|
||||||
|
*/
|
||||||
|
public static final String DEFAULT_ENCODING = StringsUtil.ENCODING_UTF8;
|
||||||
|
|
||||||
|
public static String randomUUID() {
|
||||||
|
return UUID.randomUUID().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -17,6 +16,7 @@ import org.springframework.core.env.Environment;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -103,6 +103,8 @@ public class WXUtil {
|
|||||||
List<String> strings = splitStringByLength(content, 3072);
|
List<String> strings = splitStringByLength(content, 3072);
|
||||||
int count = 1;
|
int count = 1;
|
||||||
for (String string : strings) {
|
for (String string : strings) {
|
||||||
|
// 因为引入了消息队列,所以在每条消息都加上时间戳 格式化成 yyyy-MM-dd HH:mm:ss
|
||||||
|
string = "[" + DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss") + "] \r" + string;
|
||||||
if (strings.size() > 1) {
|
if (strings.size() > 1) {
|
||||||
string = "---长消息---第:" + count + "条 " + "\r" + string;
|
string = "---长消息---第:" + count + "条 " + "\r" + string;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user