org.shoulder.batch.model.convert.BatchModelConvertImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shoulder-batch Show documentation
Show all versions of shoulder-batch Show documentation
Shoulder 扩展-批处理模块,提供批量数据导入、导出、异步校验、导入历史记录管理等能力。
package org.shoulder.batch.model.convert;
import javax.annotation.processing.Generated;
import org.shoulder.batch.dto.result.BatchProcessResult;
import org.shoulder.batch.dto.result.BatchRecordDetailResult;
import org.shoulder.batch.dto.result.BatchRecordResult;
import org.shoulder.batch.model.BatchProgressRecord;
import org.shoulder.batch.model.BatchRecord;
import org.shoulder.batch.model.BatchRecordDetail;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2023-10-02T13:33:21+0000",
comments = "version: 1.5.5.Final, compiler: javac, environment: Java 21 (Amazon.com Inc.)"
)
public class BatchModelConvertImpl implements BatchModelConvert {
@Override
public BatchProcessResult toDTO(BatchProgressRecord model) {
if ( model == null ) {
return null;
}
BatchProcessResult.BatchProcessResultBuilder batchProcessResult = BatchProcessResult.builder();
batchProcessResult.processed( model.getProcessed() );
batchProcessResult.successNum( model.getSuccessNum() );
batchProcessResult.failNum( model.getFailNum() );
batchProcessResult.status( model.getStatus() );
batchProcessResult.timeConsumed( (int) model.calculateProcessedTime() );
batchProcessResult.timeLeft( (int) model.calculateTimeLeft() );
batchProcessResult.finish( model.hasFinish() );
return batchProcessResult.build();
}
@Override
public BatchRecordResult toDTO(BatchRecord record) {
if ( record == null ) {
return null;
}
BatchRecordResult.BatchRecordResultBuilder batchRecordResult = BatchRecordResult.builder();
batchRecordResult.operator( record.getCreator() );
batchRecordResult.executedTime( record.getCreateTime() );
batchRecordResult.totalNum( record.getTotalNum() );
batchRecordResult.successNum( record.getSuccessNum() );
batchRecordResult.failNum( record.getFailNum() );
batchRecordResult.dataType( record.getDataType() );
batchRecordResult.operation( record.getOperation() );
batchRecordResult.detailList( org.apache.commons.collections4.CollectionUtils.emptyIfNull(record.getDetailList()).stream().map(org.shoulder.batch.model.convert.BatchModelConvert.CONVERT::toDTO).collect(java.util.stream.Collectors.toList()) );
return batchRecordResult.build();
}
@Override
public BatchRecordDetailResult toDTO(BatchRecordDetail model) {
if ( model == null ) {
return null;
}
BatchRecordDetailResult.BatchRecordDetailResultBuilder batchRecordDetailResult = BatchRecordDetailResult.builder();
batchRecordDetailResult.index( model.getIndex() );
batchRecordDetailResult.status( model.getStatus() );
batchRecordDetailResult.source( model.getSource() );
return batchRecordDetailResult.build();
}
}