潘志宝
2 天以前 bab43330bf6f48bdb7bfb258611f51bb05ef56fe
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleConstructor.java
@@ -28,21 +28,11 @@
    @Autowired
    private SampleFactory sampleFactory;
    public List<SampleData> constructSample(String typeA, String modelId, Date runTime,String itemName, Map<Integer, Integer> dynamicDataLength) throws ModelInvokeException {
    public List<SampleData> constructSample(String typeA, String modelId, Date runTime,String itemName,
                                            Map<Integer, Integer> dynamicDataLength) throws ModelInvokeException {
        try {
            SampleInfoConstructor sampleInfoConstructor = sampleFactory.createSampleInfo(typeA, modelId);
            SampleInfo sampleInfo = sampleInfoConstructor.prepareSampleInfo(modelId, runTime);
            if (!CollectionUtils.isEmpty(dynamicDataLength) && sampleInfo.getColumnInfo() != null) {
                 for(ColumnItemPort columnInfo : sampleInfo.getColumnInfo()) {
                     if (!dynamicDataLength.containsKey(columnInfo.getPortOrder())) {
                         continue;
                     }
                     columnInfo.setDataLength(dynamicDataLength.get(columnInfo.getPortOrder()));
                     columnInfo.getColumnItemList().forEach(columnItem -> {
                         columnItem.setDataLength(columnInfo.getDataLength());
                     });
                 }
            }
            SampleInfo sampleInfo = sampleInfoConstructor.prepareSampleInfo(modelId, runTime, dynamicDataLength);
            SampleDataConstructor sampleDataConstructor = sampleFactory.createSampleData(typeA);
            return sampleDataConstructor.prepareSampleData(sampleInfo);
        } catch (Exception e) {