1:方法代码
public String getOrderCode(String companyId) {
//当天第一单以 “00001” 开始
String orderCode = "00001";
//查询公司主题今日最大单据号
Map<String, Object> map = new HashMap<>();
map.put("companyId", companyId);
map.put("date", DateUtil.date());
String maxOrderCode = orderHeadMapper.getOrderCode(map);
log.info("------------maxOrderCode-------------------:{}", maxOrderCode);
if (StrUtil.isNotBlank(maxOrderCode)) {
//截取后5位 CG20230512
maxOrderCode = maxOrderCode.substring(10);
int count;
do {
int i = Integer.parseInt(maxOrderCode) + IntegerPool.ONE;
//年月日0001自增 多个公司各用各的
//%nd 输出的整型宽度至少为n位,右对齐,%5d即宽度至少为5位,位数大于5则输出实际位数,0表示用0补齐