product-server-data-center/src/main/java/com/product/data/center/service/MesExternalService.java
@@ -9,6 +9,8 @@
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.product.common.utils.spring.SpringUtils;
import com.product.core.config.CoreConst;
@@ -177,6 +179,23 @@
//      Set<String> productSnTableSet = QuerySqlParseUtil.getAllTableName(reportDao, reportDbName, "da_t_pm_product_sn");
//      HistoryEntity productSnData = historyBeforeDispose(getData(reportDao, productSnTableSet, "product_sn", serialNumber, new ErrorCode[]{ErrorCode.PRODUCT_SN_TABLE_NOT_EXISTS, ErrorCode.PRODUCT_SN_DATA_NOT_FOUND}), CmnConst.T_PM_PRODUCT_SN);
        // 请求历史返回数据日志打印
        List<HistoryEntity> historyEntityList = Lists.newArrayList(trackingData, keypData, detailData);
        historyEntityList.forEach(historyEntity -> {
            String primaryField = historyEntity.getPrimaryField();;
            String timeField = historyEntity.getTimeField();
            SpringMVCContextHolder.getSystemLogger().info(String.format("【当前表:%s】", historyEntity.getTableName()));
            SpringMVCContextHolder.getSystemLogger().info("【主库数据】");
            for (int i = 0; i < historyEntity.getMasterDataTable().getRows(); i++) {
                FieldSetEntity tempFse = historyEntity.getMasterDataTable().getFieldSetEntity(i);
                SpringMVCContextHolder.getSystemLogger().info(String.format("%s %s %s", tempFse.getString(primaryField), tempFse.getDate(timeField, "yyyy-MM-dd HH:mm:ss"), BaseUtil.fieldSetEntityToJson(tempFse)));
            }
            SpringMVCContextHolder.getSystemLogger().info("【子库数据】");
            for (int i = 0; i < historyEntity.getSubDataTable().getRows(); i++) {
                FieldSetEntity tempFse = historyEntity.getSubDataTable().getFieldSetEntity(i);
                SpringMVCContextHolder.getSystemLogger().info(String.format("%s %s %s", tempFse.getString(primaryField), tempFse.getDate(timeField, "yyyy-MM-dd HH:mm:ss"), BaseUtil.fieldSetEntityToJson(tempFse)));
            }
        });
        //主库数据源配置
        String masterDataSource = fs.getString("data_source");
@@ -383,6 +402,10 @@
                }
            }
        }
        // 若是存在主键相同,但是存储于不同分表中的数据,那么根据主键分组提取时间较新的数据
        dt = getNewTimeDt(dt, historyEntity);
        if (CmnConst.T_WIP_TRACKING.equalsIgnoreCase(targetTableName) && dt.getRows() > 1) {
            List<FieldSetEntity> data = dt.getData();
            FieldSetEntity newData = null;
@@ -441,6 +464,34 @@
        return historyEntity;
    }
    /**
     * 若是存在主键相同,但是存储于不同分表中的数据,那么根据主键分组提取时间较新的数据
     * @param dte
     * @return
     */
    private DataTableEntity getNewTimeDt(DataTableEntity dte, HistoryEntity historyEntity) {
        String primaryField = historyEntity.getPrimaryField();;
        String timeField = historyEntity.getTimeField();
        DataTableEntity newDte = new DataTableEntity();
        Map<Long, FieldSetEntity> fseMap = Maps.newHashMap();
        for (int i = 0; i < dte.getRows(); i++) {
            FieldSetEntity fse = dte.getFieldSetEntity(i);
            long curPrimaryValue = fse.getLong(primaryField);
            FieldSetEntity preFse = fseMap.get(curPrimaryValue);
            if (FieldSetEntity.isEmpty(preFse)) {
                fseMap.put(curPrimaryValue, fse);
            } else {
                Date curDate = fse.getDate(timeField);
                Date preDate = preFse.getDate(timeField);
                if (curDate.compareTo(preDate) > 0) {
                    fseMap.put(curPrimaryValue, fse);
                }
            }
        }
        fseMap.values().forEach(newDte::addFieldSetEntity);
        return newDte;
    }
    public DataTableEntity getData(Dao dao, Set<String> tableSet, String filterFieldName, String
            serialNumber, ErrorCode[] errorCodes) throws InterruptedException, ExecutionException {
        if (CollectionUtil.isEmpty(tableSet)) {