|
@ -12,6 +12,7 @@ import com.dreamworks.boditech.mapper.*; |
|
|
import com.dreamworks.boditech.utils.AppError; |
|
|
import com.dreamworks.boditech.utils.AppError; |
|
|
import com.dreamworks.boditech.utils.AppRuntimeException; |
|
|
import com.dreamworks.boditech.utils.AppRuntimeException; |
|
|
import com.dreamworks.boditech.utils.MyCommon; |
|
|
import com.dreamworks.boditech.utils.MyCommon; |
|
|
|
|
|
import jakarta.annotation.PostConstruct; |
|
|
import jakarta.annotation.Resource; |
|
|
import jakarta.annotation.Resource; |
|
|
import org.springframework.context.annotation.Lazy; |
|
|
import org.springframework.context.annotation.Lazy; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
@ -42,6 +43,13 @@ public class TestService { |
|
|
@Resource |
|
|
@Resource |
|
|
@Lazy |
|
|
@Lazy |
|
|
private DeviceService deviceService; |
|
|
private DeviceService deviceService; |
|
|
|
|
|
// batch id |
|
|
|
|
|
private Long batchId = null; |
|
|
|
|
|
|
|
|
|
|
|
@PostConstruct |
|
|
|
|
|
public void init() { |
|
|
|
|
|
this.batchId = System.currentTimeMillis(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// fetch task from database |
|
|
// fetch task from database |
|
|
public List<Task> fetchTask() { |
|
|
public List<Task> fetchTask() { |
|
@ -346,7 +354,10 @@ public class TestService { |
|
|
return this.testMapper.count(param); |
|
|
return this.testMapper.count(param); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// test list |
|
|
|
|
|
public List<MdbTest> testActiveBatchList() { |
|
|
|
|
|
return this.testMapper.activeBatchList(this.batchId); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -364,9 +375,8 @@ public class TestService { |
|
|
Long startTime = calendar.getTimeInMillis(); |
|
|
Long startTime = calendar.getTimeInMillis(); |
|
|
int count = this.testMapper.countByTimeRange(startTime, System.currentTimeMillis()); |
|
|
int count = this.testMapper.countByTimeRange(startTime, System.currentTimeMillis()); |
|
|
test.serialCode = String.format("%s_%03d", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMdd")), count + 1); |
|
|
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.batchId = this.batchId; |
|
|
|
|
|
test.startedBy = this.accountService.getCurrentAccountId(); |
|
|
test.startedAt = System.currentTimeMillis(); |
|
|
test.startedAt = System.currentTimeMillis(); |
|
|
this.testMapper.insert(test); |
|
|
this.testMapper.insert(test); |
|
|
} |
|
|
} |
|
|