1、收支明细流水号生成方式修正,新增yyyyMMddHHmmss+7位顺序号的流水号的公用生成方式;2、管理端分析页组织总数/用户总数/用户活跃数迁移到system;3、组织管理查询首购记录不展示问题恢复;

This commit is contained in:
gaoqr
2025-09-29 15:32:53 +08:00
parent 00d58afeb1
commit cd466f2777
24 changed files with 258 additions and 205 deletions
@@ -22,4 +22,8 @@ public class MinuteCounter {
atom.set(newValue & MASK);
}
public boolean compareAndSet(int expect, int update) {
return atom.compareAndSet(expect, update & MASK);
}
}
@@ -4,6 +4,9 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.concurrent.atomic.AtomicReference;
/**
* @ClassName: SnowflakeIdWorker3rd
@@ -36,6 +39,10 @@ public class SnowflakeIdWorker3rd {
private final MinuteCounter counter = new MinuteCounter();
/** 预支时间标志 */
boolean isAdvance = false;
/** 时间格式 */
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyMMddHHmmss");
/** 上次时间格式 */
private final AtomicReference<String> lastTimestampStr = new AtomicReference<>("");
// ==============================Constructors=====================================
@@ -127,4 +134,36 @@ public class SnowflakeIdWorker3rd {
return Integer.valueOf(timestamp);
}
/**
* 获取下一个流水号
*
* @return SerialNo
*/
public String nextSerialNo() {
String now = LocalDateTime.now().format(FORMATTER);
// 跨秒重置序列号
String last = lastTimestampStr.get();
if (!now.equals(last)) {
// 仅在跨秒时重置序列号
if (lastTimestampStr.compareAndSet(last, now)) {
counter.set(0);
}
}
// 原子递增序列号
int seq = counter.incrementAndGet();
// 序列号1000005位)以内
if (seq > 9999) {
if (counter.compareAndSet(seq, 1)) {
seq = 1;
} else {
seq = counter.incrementAndGet();
}
}
// 拼接时间 + 序列号
return String.format("%s%05d", now, seq);
}
}