欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

快速解决code唯一码(java)的简便方法

程序员文章站 2024-02-12 20:17:04
如下所示: public string next() { long appboottimes = systemvariableservice.getappbo...

如下所示:

public string next() {
 long appboottimes = systemvariableservice.getappboottimes();
 return long.tostring(appboottimes * 10000000000000000l + seq.incrementandget(), character.max_radix);
}

解释:找数据库中的最近新增的账号

public string nextno() {
  return long.tostring(seq.incrementandget());
}
 
public string nexttradeno() {
  return "t" + localdate.now().format(datetimeformatter.ofpattern("uuuummdd")) + next();
 }
  
public string nextfilename(string suffix) {
  return localdate.now().format(datetimeformatter.ofpattern("uuuummdd")) + "/" + uuid.randomuuid() + (stringutils.isnotblank(suffix) ? ("." + suffix) : "");
 }
public string nextpurchaseno(){
  return "po"+localdate.now().format(datetimeformatter.ofpattern("yyyymmdd")) + "-" + systemvariableservice.getpurchasenumbers("po");
 } 
public string nextsalesno(){
  system.out.println(systemvariableservice.getsalesnumbers("so"));
  return "so"+localdate.now().format(datetimeformatter.ofpattern("yyyymmdd")) + "-" + systemvariableservice.getsalesnumbers("so");
 } 
public string nextreceiptno(){
  return "si"+localdate.now().format(datetimeformatter.ofpattern("yyyymmdd")) + "-" + systemvariableservice.getreceiptnumbers("si");
 } 
public string nextloadinglistno(){
  return "ll"+localdate.now().format(datetimeformatter.ofpattern("yyyymmdd")) + "-" + systemvariableservice.getloadinglistnumbers("ll");
 } 
public string nextdeliverno(){
  return "dl"+localdate.now().format(datetimeformatter.ofpattern("yyyymmdd")) + "-" + systemvariableservice.getdelivernumbers("dl");
 } 
public string nextotherinno(){
  return "oi"+localdate.now().format(datetimeformatter.ofpattern("yyyymmdd")) + "-" + systemvariableservice.getotherinnumbers("oi");
 }
public string nextotheroutno(){
  return "oo"+localdate.now().format(datetimeformatter.ofpattern("yyyymmdd")) + "-" + systemvariableservice.getotheroutnumbers("oo");
 } 
public string nextpromotionno(){
  return "hd"+localdate.now().format(datetimeformatter.ofpattern("yyyymmdd")) + "-" + systemvariableservice.nextpromotionno("hd");
 }  
public string nextbalancefeeno() {
  return "ft" + systemvariableservice.getbalancefeenumbers();
 }

以上的方法,都比较的好用和方便。其实这些我都要百度,是同事写的,真强!

这篇快速解决code唯一码(java)的简便方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。