|
|
@@ -135,18 +135,24 @@ public class AlarmDataServiceImpl extends ServiceImpl<AlarmDataMapper, AlarmData
|
|
|
/**
|
|
|
* 生成案件编号:CS + 年月日时分秒 + 4位随机数
|
|
|
*/
|
|
|
- private static String generateCaseNo() {
|
|
|
+ public static String generateCaseNo() {
|
|
|
+ // 1. 获取当前时间,格式化为14位年月日时分秒
|
|
|
String currentDateTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
|
|
+ // 2. 生成4位随机数,不足补0
|
|
|
String randomNum = String.format("%04d", new Random().nextInt(10000));
|
|
|
+ // 3. 拼接完整编号
|
|
|
return "CS" + currentDateTime + randomNum;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 生成工单编号:WO + 年月日时分秒 + 4位随机数
|
|
|
*/
|
|
|
- private static String generateOrderNo() {
|
|
|
+ public static String generateOrderNo() {
|
|
|
+ // 1. 获取当前时间,格式化为14位年月日时分秒
|
|
|
String currentDateTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
|
|
+ // 2. 生成4位随机数,不足补0
|
|
|
String randomNum = String.format("%04d", new Random().nextInt(10000));
|
|
|
+ // 3. 拼接完整编号
|
|
|
return "WO" + currentDateTime + randomNum;
|
|
|
}
|
|
|
}
|