Commit 03b738f0 by zhangxingmin

Merge remote-tracking branch 'origin/dev' into prod

parents da0e4741 5af1ef9b
......@@ -68,6 +68,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/swagger-ui/**",
"/v3/api-docs/**",
"/sysUser/body/detail",
"/ossFile/list",
"/sysDict/type/item/list/**",
"/clientUser/clientUserBizIdList",
"/scrm/test",
"/doc.html",
"/webjars/**",
......
......@@ -75,6 +75,8 @@ public enum CommonEnum {
UID_TYPE_PREMIUM_RECONCILIATION("premium_reconciliation","保费对账记录表"),
UID_TYPE_PREMIUM_REMITTANCE("premium_remittance","保费对账-汇款记录表"),
UID_TYPE_PREMIUM_REMITTANCE_FILE("premium_remittance_file","保费对账-汇款记录附件表"),
UID_TYPE_REL_OBJECT_CERTIFICATE("rel_object_certificate","对象证件关系表"),
UID_TYPE_CALM_TASK("calm_task","保单冷静期定时任务表"),
//作用域枚举
SCOPE_SYS("1","系统级(全局)"),
......
......@@ -54,6 +54,6 @@ public class ChineseTextConverter {
}
public static void main(String[] args) {
System.out.println(traditionalToSimplified("大學或以上"));
System.out.println(simplifiedToTraditional("联络电话"));
}
}
\ No newline at end of file
......@@ -7,24 +7,89 @@ import com.fasterxml.jackson.databind.JsonDeserializer;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.temporal.ChronoField;
public class CustomLocalDateTimeDeserializer extends JsonDeserializer<LocalDateTime> {
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 定义多种可能的格式
private static final DateTimeFormatter[] FORMATTERS = {
// ISO 格式: yyyy-MM-dd'T'HH:mm:ss
DateTimeFormatter.ISO_LOCAL_DATE_TIME,
// 标准格式: yyyy-MM-dd HH:mm:ss
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"),
// 只有日期: yyyy-MM-dd
DateTimeFormatter.ofPattern("yyyy-MM-dd"),
// 其他可能的格式
DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"),
DateTimeFormatter.ofPattern("yyyy/MM/dd"),
DateTimeFormatter.ofPattern("yyyy.MM.dd HH:mm:ss"),
DateTimeFormatter.ofPattern("yyyy.MM.dd")
};
@Override
public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
String text = p.getText();
if (text == null || text.isEmpty()) {
if (text == null || text.trim().isEmpty()) {
return null;
}
// 如果字符串长度只有10(即"yyyy-MM-dd"),则拼接" 00:00:00"
if (text.length() == 10) {
text = text + " 00:00:00";
text = text.trim();
// 尝试用所有格式解析
for (DateTimeFormatter formatter : FORMATTERS) {
try {
// 如果是日期格式,转换为 LocalDateTime
if (formatter.toString().contains("yyyy-MM-dd") &&
!formatter.toString().contains("HH:mm:ss")) {
// 这是纯日期格式,需要转换为 LocalDateTime
return LocalDateTime.parse(text + "T00:00:00", DateTimeFormatter.ISO_LOCAL_DATE_TIME);
}
return LocalDateTime.parse(text, formatter);
} catch (Exception e) {
// 继续尝试下一个格式
continue;
}
}
// 如果所有格式都失败,尝试更灵活的解析
return parseFlexible(text);
}
private LocalDateTime parseFlexible(String text) throws IOException {
try {
// 尝试处理带T的日期时间
if (text.contains("T")) {
// 移除可能的多余空格
text = text.replace(" ", "");
// 确保T后面有时间部分
if (text.indexOf('T') + 1 < text.length()) {
String timePart = text.substring(text.indexOf('T') + 1);
if (timePart.isEmpty()) {
text = text + "00:00:00";
} else if (timePart.split(":").length == 2) {
text = text + ":00";
}
return LocalDateTime.parse(text, DateTimeFormatter.ISO_LOCAL_DATE_TIME);
}
}
// 尝试处理只有日期的格式
if (text.length() == 10 && text.charAt(4) == '-' && text.charAt(7) == '-') {
return LocalDateTime.parse(text + "T00:00:00", DateTimeFormatter.ISO_LOCAL_DATE_TIME);
}
// 尝试处理包含空格的日期时间
if (text.length() >= 10 && text.charAt(4) == '-' && text.charAt(7) == '-') {
if (text.length() > 10 && text.charAt(10) == ' ') {
// 格式: yyyy-MM-dd HH:mm:ss
return LocalDateTime.parse(text, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
}
}
throw new IOException("无法解析日期时间: " + text);
} catch (Exception e) {
throw new IOException("无法解析日期时间: " + text, e);
}
return LocalDateTime.parse(text, DATE_TIME_FORMATTER);
}
}
\ No newline at end of file
......@@ -60,8 +60,8 @@ public class RandomStringGenerator {
// String random32 = generate(32, false);
// System.out.println("32位: " + random32);
for (int i = 0; i < 6; i++) {
System.out.println(generateBizId16("client_user"));
for (int i = 0; i < 9; i++) {
System.out.println(generateBizId16("user_sign"));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment