Order serial number writing and sending

1. orderStart= defines the order number starting with the current year, month, and day. According to business requirements, it may also be the order number of the year, month, day, hour, minute, and second.

Second, orderEnd= specifies that the last few digits are the incremental order number, plus the preceding orderStart to form an order number.

3. Do a fuzzy query based on the current date to see if there is an order for today. If there is no order number for today, orderStart+“***001” is the first item. If it takes so long, intercept the orderEnd, and then convert it to a number type (remove the 0 in front of orderEnd) orderEnd (number type) + 1, at this time, orderEnd is still a number, and then add 0 in front of the specified number of orderEnd to form a string . Complete the effect of mantissa + 1. Finally orderEnd+orderStart form a complete order number.
    code show as below:
 
 
//Define the completed order number String orderNo = null; SimpleDateFormat curDate = new SimpleDateFormat("yyyyMMdd"); // Get the current date
String dateString = curDate.format(new Date());
//Query the database, do a fuzzy query based on the current date to see if there is an order for today
String sql = "select max(BO_ACT_RWGL0.BIANHAO) from BO_ACT_RWGL0 where BO_ACT_RWGL0.BIANHAO like ?";
//Get the order number with complete data String id = DBSql.getString(sql, new Object[] { "%"+dateString+"%" });
//Check if the string is empty
if(id ==null || id =="" || id.equals("")){ orderNo = curDate + "0001"; }else{ String serialNo = id.substring(id.length() - 5); //最后的结果
orderNo = dateString + String.format( "%05d", Integer.decode(serialNo) + 1);
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324884877&siteId=291194637