码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2017-08-03 21:56:18      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:int   number   variables   数据库   解释   and   character   rac   方便   

	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)简便方法

标签:int   number   variables   数据库   解释   and   character   rac   方便   

原文地址:http://www.cnblogs.com/historylyt/p/7281773.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!