@Test public void testDatePart() throws Exception { final LocalDateTime lastCheck = DateUtils.ldtParseSDT("2017-01-01 00:00:00"); final DefaultOrderNumberGeneratorImpl defaultOrderNumberGenerator = new DefaultOrderNumberGeneratorImpl(); defaultOrderNumberGenerator.setLastCheck(lastCheck); assertEquals("170205140434", defaultOrderNumberGenerator.datePart(DateUtils.ldtParseSDT("2017-02-05 14:04:34"))); assertEquals("170131044300", defaultOrderNumberGenerator.datePart(DateUtils.ldtParseSDT("2017-01-31 04:43:00"))); assertEquals("171231235959", defaultOrderNumberGenerator.datePart(DateUtils.ldtParseSDT("2017-12-31 23:59:59"))); assertEquals("170101000000", defaultOrderNumberGenerator.datePart(DateUtils.ldtParseSDT("2017-01-01 00:00:00"))); }
String datePart(final LocalDateTime dateTime) { final long year = dateTime.getYear(); final long mth = dateTime.getMonthValue(); final long day = dateTime.getDayOfMonth(); final long hour = dateTime.getHour(); final long min = dateTime.getMinute(); final long sec = dateTime.getSecond(); final long time = (year % 100) * 10000000000L + mth * 100000000L + day * 1000000L + hour * 10000L + min * 100 + sec; return String.valueOf(time); }
DefaultOrderNumberGeneratorImpl implements OrderNumberGenerator { String datePart(final LocalDateTime dateTime) { final long year = dateTime.getYear(); final long mth = dateTime.getMonthValue(); final long day = dateTime.getDayOfMonth(); final long hour = dateTime.getHour(); final long min = dateTime.getMinute(); final long sec = dateTime.getSecond(); final long time = (year % 100) * 10000000000L + mth * 100000000L + day * 1000000L + hour * 10000L + min * 100 + sec; return String.valueOf(time); } }
DefaultOrderNumberGeneratorImpl implements OrderNumberGenerator { String datePart(final LocalDateTime dateTime) { final long year = dateTime.getYear(); final long mth = dateTime.getMonthValue(); final long day = dateTime.getDayOfMonth(); final long hour = dateTime.getHour(); final long min = dateTime.getMinute(); final long sec = dateTime.getSecond(); final long time = (year % 100) * 10000000000L + mth * 100000000L + day * 1000000L + hour * 10000L + min * 100 + sec; return String.valueOf(time); } DefaultOrderNumberGeneratorImpl(final GenericDAO<CustomerOrder, Long> customerOrderDao);   DefaultOrderNumberGeneratorImpl(); }
DefaultOrderNumberGeneratorImpl implements OrderNumberGenerator { String datePart(final LocalDateTime dateTime) { final long year = dateTime.getYear(); final long mth = dateTime.getMonthValue(); final long day = dateTime.getDayOfMonth(); final long hour = dateTime.getHour(); final long min = dateTime.getMinute(); final long sec = dateTime.getSecond(); final long time = (year % 100) * 10000000000L + mth * 100000000L + day * 1000000L + hour * 10000L + min * 100 + sec; return String.valueOf(time); } DefaultOrderNumberGeneratorImpl(final GenericDAO<CustomerOrder, Long> customerOrderDao);   DefaultOrderNumberGeneratorImpl(); @Override synchronized String getNextOrderNumber(); }
DefaultOrderNumberGeneratorImpl implements OrderNumberGenerator { String datePart(final LocalDateTime dateTime) { final long year = dateTime.getYear(); final long mth = dateTime.getMonthValue(); final long day = dateTime.getDayOfMonth(); final long hour = dateTime.getHour(); final long min = dateTime.getMinute(); final long sec = dateTime.getSecond(); final long time = (year % 100) * 10000000000L + mth * 100000000L + day * 1000000L + hour * 10000L + min * 100 + sec; return String.valueOf(time); } DefaultOrderNumberGeneratorImpl(final GenericDAO<CustomerOrder, Long> customerOrderDao);   DefaultOrderNumberGeneratorImpl(); @Override synchronized String getNextOrderNumber();  }