This commit is contained in:
parent
e6c4ee735f
commit
6abd8d8fc1
|
@ -73,9 +73,13 @@ public class WorkFlowServiceImpl implements WorkFlowService {
|
||||||
// 查询id最大的那个订单号 然后截取最后四位,将其转换成数字,然后给这个数字加1
|
// 查询id最大的那个订单号 然后截取最后四位,将其转换成数字,然后给这个数字加1
|
||||||
QueryWrapper<WorkFlowEntity> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<WorkFlowEntity> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.orderByDesc("sid");
|
queryWrapper.orderByDesc("sid");
|
||||||
|
queryWrapper.ge("created_dt",new Date());
|
||||||
Page<WorkFlowEntity> page = new Page<>(1, 1);
|
Page<WorkFlowEntity> page = new Page<>(1, 1);
|
||||||
Page workFlow = workFlowMapper.selectPage(page, queryWrapper);
|
workFlowMapper.selectPage(page, queryWrapper);
|
||||||
List<WorkFlowEntity> list = workFlow.getRecords();
|
List<WorkFlowEntity> list = page.getRecords();
|
||||||
|
// 获取当前日期并格式化为YYYYmmdd
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
String currentDate = sdf.format(new Date());
|
||||||
if(list.size()>0) {
|
if(list.size()>0) {
|
||||||
String str = list.get(0).getWorkOrderNo();
|
String str = list.get(0).getWorkOrderNo();
|
||||||
// 截取最后四位
|
// 截取最后四位
|
||||||
|
@ -86,17 +90,12 @@ public class WorkFlowServiceImpl implements WorkFlowService {
|
||||||
String formattedNumber = String.format("%04d", number);
|
String formattedNumber = String.format("%04d", number);
|
||||||
System.out.println(formattedNumber);
|
System.out.println(formattedNumber);
|
||||||
|
|
||||||
if (formattedNumber.equals("10000")) {
|
|
||||||
formattedNumber = "0001";
|
|
||||||
}
|
|
||||||
// 获取当前日期并格式化为YYYYmmdd
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
||||||
String currentDate = sdf.format(new Date());
|
|
||||||
// 生成最终的字符串
|
// 生成最终的字符串
|
||||||
String finalString = "AS" + currentDate + formattedNumber;
|
String finalString = "AS" + currentDate + formattedNumber;
|
||||||
return finalString;
|
return finalString;
|
||||||
}else {
|
}else {
|
||||||
throw new BaseException("WorkFlowOrderId_FAILED", "未查询到订单号");
|
return "AS" + currentDate + "0001";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue