|
|
@ -14,6 +14,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Calendar; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
@Service |
|
|
@ -277,6 +278,15 @@ public class TestService { |
|
|
|
|
|
|
|
// create test |
|
|
|
public void insert(MdbTest test) { |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
calendar.set(Calendar.HOUR_OF_DAY, 0); |
|
|
|
calendar.set(Calendar.MINUTE, 0); |
|
|
|
calendar.set(Calendar.SECOND, 0); |
|
|
|
calendar.set(Calendar.MILLISECOND, 0); |
|
|
|
Long startTime = calendar.getTimeInMillis(); |
|
|
|
int count = this.testMapper.countByTimeRange(startTime, System.currentTimeMillis()); |
|
|
|
test.serialCode = String.format("%s_%03d", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMdd")), count + 1); |
|
|
|
|
|
|
|
// @TODO : startedBy should be set to the current user |
|
|
|
test.startedBy = 0; |
|
|
|
test.startedAt = System.currentTimeMillis(); |
|
|
|