提交 | 用户 | 时间
|
7fd198
|
1 |
package com.iailab.module.model.mdk.sample; |
潘 |
2 |
|
|
3 |
import com.iailab.module.model.mdk.common.exceptions.DataAccessException; |
|
4 |
import com.iailab.module.model.mdk.sample.dto.SampleData; |
|
5 |
import com.iailab.module.model.mdk.sample.dto.SampleInfo; |
|
6 |
import org.springframework.beans.factory.annotation.Autowired; |
|
7 |
import org.springframework.stereotype.Component; |
|
8 |
|
|
9 |
import java.sql.Timestamp; |
|
10 |
import java.text.MessageFormat; |
|
11 |
import java.util.Date; |
|
12 |
import java.util.List; |
|
13 |
|
|
14 |
/** |
|
15 |
* 样本构造 |
|
16 |
* |
|
17 |
* @author PanZhibao |
|
18 |
* @Description |
|
19 |
* @createTime 2024年09月03日 |
|
20 |
*/ |
|
21 |
@Component |
|
22 |
public class SampleConstructor { |
|
23 |
|
|
24 |
@Autowired |
|
25 |
private SampleFactory sampleFactory; |
|
26 |
|
|
27 |
public List<SampleData> constructSample(String typeA, String modelId, Date runTime) { |
|
28 |
try { |
|
29 |
SampleInfoConstructor sampleInfoConstructor = sampleFactory.createSampleInfo(typeA, modelId); |
|
30 |
SampleInfo sampleInfo = sampleInfoConstructor.prepareSampleInfo(modelId, runTime); |
|
31 |
SampleDataConstructor sampleDataConstructor = sampleFactory.createSampelData(typeA); |
|
32 |
return sampleDataConstructor.prepareSampleData(sampleInfo); |
|
33 |
} catch (Exception e) { |
|
34 |
DataAccessException exception = new DataAccessException(MessageFormat.format("{0},类名为{1}", |
|
35 |
DataAccessException.errorDataAccess, Thread.currentThread().getStackTrace()[1].getClassName())); |
|
36 |
System.out.println(exception); |
|
37 |
e.printStackTrace(); |
|
38 |
return null; |
|
39 |
} |
|
40 |
|
|
41 |
|
|
42 |
} |
|
43 |
} |