package com.iailab.module.model.mdk.sample; import com.iailab.module.model.mdk.common.exceptions.DataAccessException; import com.iailab.module.model.mdk.sample.dto.SampleData; import com.iailab.module.model.mdk.sample.dto.SampleInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.sql.Timestamp; import java.text.MessageFormat; import java.util.Date; import java.util.List; /** * 样本构造 * * @author PanZhibao * @Description * @createTime 2024年09月03日 */ @Component public class SampleConstructor { @Autowired private SampleFactory sampleFactory; public List constructSample(String typeA, String modelId, Date runTime) { try { SampleInfoConstructor sampleInfoConstructor = sampleFactory.createSampleInfo(typeA, modelId); SampleInfo sampleInfo = sampleInfoConstructor.prepareSampleInfo(modelId, runTime); SampleDataConstructor sampleDataConstructor = sampleFactory.createSampelData(typeA); return sampleDataConstructor.prepareSampleData(sampleInfo); } catch (Exception e) { DataAccessException exception = new DataAccessException(MessageFormat.format("{0},类名为{1}", DataAccessException.errorDataAccess, Thread.currentThread().getStackTrace()[1].getClassName())); System.out.println(exception); e.printStackTrace(); return null; } } }