# Edc2MyspcConverter.java

    package com.mycim.server.edcmyspc.myspc;

    import com.mycim.framework.utils.lang.collections.CollectionUtils;
    import com.mycim.framework.utils.msg.model.Request;
    import com.mycim.server.edcmyspc.manager.Edc2MyspcManager;
    import com.mycim.server.spc.BaseEdc2SpcConverter;
    import com.mycim.valueobject.edcspc.dto.SpcDataCollectionDto;
    import com.mycim.valueobject.wip.Lot;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Component;

    import java.util.Arrays;
    import java.util.List;
    import java.util.Map;

    /**
     * @author Johnson.Wang
     * @version 6.0.0
     * @date 2019/11/8
     **/
    @Component
    public class Edc2MyspcConverter extends BaseEdc2SpcConverter<Request> {
        @Autowired
        private Edc2MyspcManager edc2MyspcManager;

        @Override
        public List<Request> convert(List<Map> dcolStepInfos, Boolean rtFlag) {
            Request request = new Request();
            if (rtFlag) {
                List<SpcDataCollectionDto> dataCollections = edc2MyspcManager.buildRTSpcDataForMeasure(dcolStepInfos);
                if (CollectionUtils.isNotEmpty(dataCollections)) {
                    request.setBody(dataCollections);
                }
            }
            return Arrays.asList(request);
        }

        @Override
        public List<Request> convert(List<Lot> lots) {
            Request request = new Request();

            List<SpcDataCollectionDto> dataCollections = edc2MyspcManager.buildSpcDataForProcess(lots);

            if (CollectionUtils.isNotEmpty(dataCollections)) {
                request.setBody(dataCollections);
            }

            return Arrays.asList(request);
        }

    }