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

网友投稿 381 2023-04-23


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

如下所示:

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() {

returISTProFxhdn "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();

}

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


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:如何设计json接口(怎么写json数据接口)
下一篇:接口和实现分离(接口分离原则有哪些表现)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~