|
|
|
@ -69,39 +69,39 @@ public class DeviceSyncService {
|
|
|
|
|
}
|
|
|
|
|
int insertCount = deviceSaveService.DeviceSave(result.getData(), DateUtil.parseDate(rangeValue), dlType);
|
|
|
|
|
//2.下载历史记录
|
|
|
|
|
List<String> keyList = new ArrayList<String>();
|
|
|
|
|
for (DataSetResult.DataSet ds : result.getData()) {
|
|
|
|
|
List<DataSetResult.DeviceInfo> list = ds.getDeviceInfo();
|
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
|
for (DataSetResult.DeviceInfo deviceInfo : list)
|
|
|
|
|
keyList.add(deviceInfo.getDeviceRecordKey());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (keyList.size() > 0) {
|
|
|
|
|
DataSetTotalResult res = deviceDownloadService.getHistoryData2(keyList);
|
|
|
|
|
if (res.getCode() == 1) {
|
|
|
|
|
if (res.getData() != null && res.getData().size() > 0) {
|
|
|
|
|
int count = result.getTotalRecordCount();
|
|
|
|
|
count = count + res.getTotalRecordCount();
|
|
|
|
|
result.setTotalRecordCount(count);
|
|
|
|
|
List<DataSetResult.DataSet> data = result.getData();
|
|
|
|
|
data.addAll(res.getData());
|
|
|
|
|
result.setData(data);
|
|
|
|
|
int hisInsertCount = deviceSaveService.DeviceSave(res.getData(), null, dlType);
|
|
|
|
|
insertCount = insertCount + hisInsertCount;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
JobLog jobLog = new JobLog();
|
|
|
|
|
jobLog.setDownloadType(downloadType);
|
|
|
|
|
jobLog.setTaskType(Constant.JOB_TASK_TYPE_DOWNLOAD);
|
|
|
|
|
jobLog.setDownloadDate(DateUtil.parseDate(rangeValue));
|
|
|
|
|
jobLog.setType(Constant.LOG_TYPE_ERROR);
|
|
|
|
|
jobLog.setMsg("下载历史记录出错:" + res.getMsg());
|
|
|
|
|
jobLog.setCreateTime(new Date());
|
|
|
|
|
jobLogService.insert(jobLog);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// List<String> keyList = new ArrayList<String>();
|
|
|
|
|
// for (DataSetResult.DataSet ds : result.getData()) {
|
|
|
|
|
// List<DataSetResult.DeviceInfo> list = ds.getDeviceInfo();
|
|
|
|
|
// if (list != null && list.size() > 0) {
|
|
|
|
|
// for (DataSetResult.DeviceInfo deviceInfo : list)
|
|
|
|
|
// keyList.add(deviceInfo.getDeviceRecordKey());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// if (keyList.size() > 0) {
|
|
|
|
|
// DataSetTotalResult res = deviceDownloadService.getHistoryData2(keyList);
|
|
|
|
|
// if (res.getCode() == 1) {
|
|
|
|
|
// if (res.getData() != null && res.getData().size() > 0) {
|
|
|
|
|
// int count = result.getTotalRecordCount();
|
|
|
|
|
// count = count + res.getTotalRecordCount();
|
|
|
|
|
// result.setTotalRecordCount(count);
|
|
|
|
|
// List<DataSetResult.DataSet> data = result.getData();
|
|
|
|
|
// data.addAll(res.getData());
|
|
|
|
|
// result.setData(data);
|
|
|
|
|
// int hisInsertCount = deviceSaveService.DeviceSave(res.getData(), null, dlType);
|
|
|
|
|
// insertCount = insertCount + hisInsertCount;
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// JobLog jobLog = new JobLog();
|
|
|
|
|
// jobLog.setDownloadType(downloadType);
|
|
|
|
|
// jobLog.setTaskType(Constant.JOB_TASK_TYPE_DOWNLOAD);
|
|
|
|
|
// jobLog.setDownloadDate(DateUtil.parseDate(rangeValue));
|
|
|
|
|
// jobLog.setType(Constant.LOG_TYPE_ERROR);
|
|
|
|
|
// jobLog.setMsg("下载历史记录出错:" + res.getMsg());
|
|
|
|
|
// jobLog.setCreateTime(new Date());
|
|
|
|
|
// jobLogService.insert(jobLog);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
JobLog jobLog = new JobLog();
|
|
|
|
|
jobLog.setDownloadType(downloadType);
|
|
|
|
@ -201,18 +201,18 @@ public class DeviceSyncService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void dlHistory(DataSetSingleResult result1) {
|
|
|
|
|
|
|
|
|
|
DataSetSingleHistoryResult result = new DataSetSingleHistoryResult();
|
|
|
|
|
result.setDataSet(result1.getDataSet());
|
|
|
|
|
if (result1.getDataSet().getDeviceInfo() != null && result1.getDataSet().getDeviceInfo().size() > 0) {
|
|
|
|
|
List<String> keyList = deviceDownloadService.getKeyList(result1.getDataSet());
|
|
|
|
|
if (keyList.size() > 0) {
|
|
|
|
|
DataSetTotalResult result2 = deviceDownloadService.getHistoryData(keyList);
|
|
|
|
|
result.setDataList(result2.getData());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// public void dlHistory(DataSetSingleResult result1) {
|
|
|
|
|
//
|
|
|
|
|
// DataSetSingleHistoryResult result = new DataSetSingleHistoryResult();
|
|
|
|
|
// result.setDataSet(result1.getDataSet());
|
|
|
|
|
// if (result1.getDataSet().getDeviceInfo() != null && result1.getDataSet().getDeviceInfo().size() > 0) {
|
|
|
|
|
// List<String> keyList = deviceDownloadService.getKeyList(result1.getDataSet());
|
|
|
|
|
// if (keyList.size() > 0) {
|
|
|
|
|
// DataSetTotalResult result2 = deviceDownloadService.getHistoryData(keyList);
|
|
|
|
|
// result.setDataList(result2.getData());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
public BaseResponse downloadByDi(String deviceId) {
|
|
|
|
|
DataSetSingleResult result1 = deviceDownloadService.downloadByDi(deviceId);
|
|
|
|
@ -220,13 +220,13 @@ public class DeviceSyncService {
|
|
|
|
|
return ResultVOUtils.error(-1, result1.getReturnMsg());
|
|
|
|
|
DataSetSingleHistoryResult result = new DataSetSingleHistoryResult();
|
|
|
|
|
result.setDataSet(result1.getDataSet());
|
|
|
|
|
if (result1.getDataSet().getDeviceInfo() != null && result1.getDataSet().getDeviceInfo().size() > 0) {
|
|
|
|
|
List<String> keyList = deviceDownloadService.getKeyList(result1.getDataSet());
|
|
|
|
|
if (keyList.size() > 0) {
|
|
|
|
|
DataSetTotalResult result2 = deviceDownloadService.getHistoryData(keyList);
|
|
|
|
|
result.setDataList(result2.getData());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// if (result1.getDataSet().getDeviceInfo() != null && result1.getDataSet().getDeviceInfo().size() > 0) {
|
|
|
|
|
// List<String> keyList = deviceDownloadService.getKeyList(result1.getDataSet());
|
|
|
|
|
// if (keyList.size() > 0) {
|
|
|
|
|
// DataSetTotalResult result2 = deviceDownloadService.getHistoryData(keyList);
|
|
|
|
|
// result.setDataList(result2.getData());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
List<DataSetResult.DataSet> dataSets = new ArrayList<>();
|
|
|
|
|
dataSets.add(result1.getDataSet());
|
|
|
|
|
deviceSaveService.DeviceSave(dataSets, new Date(), Constant.DL_TYPE_UPDATE);
|
|
|
|
@ -280,7 +280,7 @@ public class DeviceSyncService {
|
|
|
|
|
public BaseResponse downloadHistory(String key) {
|
|
|
|
|
List<String> keyList = new ArrayList<>();
|
|
|
|
|
keyList.add(key);
|
|
|
|
|
DataSetTotalResult res = deviceDownloadService.getHistoryData(keyList);
|
|
|
|
|
DataSetTotalResult res = deviceDownloadService.getHistoryData1(keyList);
|
|
|
|
|
if (res.getCode() != 1)
|
|
|
|
|
return ResultVOUtils.error(-1, res.getMsg());
|
|
|
|
|
List<DeviceEntity> result = new ArrayList<>();
|
|
|
|
|