|
|
|
@ -308,13 +308,33 @@ public class DlAllDataService {
|
|
|
|
|
if (lastUpdateTime.equals("1949-01-01 00:00:00")) {
|
|
|
|
|
lastUpdateTime = DateUtil.getBeforeDay(1);
|
|
|
|
|
}
|
|
|
|
|
List<ProductInfoEntity> mProductInfoEntities = new ArrayList<>();
|
|
|
|
|
//更新产品信息
|
|
|
|
|
int page = 1;
|
|
|
|
|
int limit = 300;
|
|
|
|
|
int limit = 2000;
|
|
|
|
|
while (true) {
|
|
|
|
|
List<ProductInfoEntity> productInfoEntityList = asyncDiDlHelper.dlByTime(page, limit, lastUpdateTime);
|
|
|
|
|
if (productInfoEntityList != null && productInfoEntityList.size() > 0) {
|
|
|
|
|
mProductInfoEntities.addAll(productInfoEntityList);
|
|
|
|
|
SpSyncUdiResponse spSyncUdiResponse = new SpSyncUdiResponse();
|
|
|
|
|
spSyncUdiResponse.setProductInfoEntityList(productInfoEntityList);
|
|
|
|
|
if (CollUtil.isNotEmpty(spSyncUdiResponse.getProductInfoEntityList()) || CollUtil.isNotEmpty(spSyncUdiResponse.getUdiCompanyEntities())) {
|
|
|
|
|
String key = "UdiPrdoucts" + System.currentTimeMillis();
|
|
|
|
|
if (downstream.getParamValue().equals("1")) {
|
|
|
|
|
String datas = JSON.toJSON(spSyncUdiResponse).toString();
|
|
|
|
|
redisUtil.set(key, datas);
|
|
|
|
|
BasicExportStatusEntity myEntity = new BasicExportStatusEntity();
|
|
|
|
|
myEntity.setId(key);
|
|
|
|
|
myEntity.setStatus(0);
|
|
|
|
|
myEntity.setUpdateTime(new Date());
|
|
|
|
|
myEntity.setType(BasicProcessStatus.NEW_ALL_UDIS);
|
|
|
|
|
basicExportService.insertExportStatus(myEntity);
|
|
|
|
|
} else {
|
|
|
|
|
String path = getPath();
|
|
|
|
|
String fileName = path + FileConstant.upWaitCopy_products + "UdiPrdoucts_" + key + ".LowerIn";
|
|
|
|
|
String datas = JSON.toJSON(spSyncUdiResponse).toString();
|
|
|
|
|
FileUtils.SaveFileAs(datas, fileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (productInfoEntityList.size() < limit) {
|
|
|
|
|
break;
|
|
|
|
|
} else {
|
|
|
|
@ -324,14 +344,36 @@ public class DlAllDataService {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//更新企业信息
|
|
|
|
|
List<UdiCompanyEntity> mUdiCompanyEntities = new ArrayList<>();
|
|
|
|
|
int page1 = 1;
|
|
|
|
|
int limit1 = 300;
|
|
|
|
|
int limit1 = 2000;
|
|
|
|
|
while (true) {
|
|
|
|
|
List<UdiCompanyEntity> udiCompanyEntities = asyncDiDlHelper.dlCompanyByTime(page1, limit1, lastUpdateTime);
|
|
|
|
|
if (udiCompanyEntities != null && udiCompanyEntities.size() > 0) {
|
|
|
|
|
mUdiCompanyEntities.addAll(udiCompanyEntities);
|
|
|
|
|
|
|
|
|
|
SpSyncUdiResponse spSyncUdiResponse = new SpSyncUdiResponse();
|
|
|
|
|
spSyncUdiResponse.setUdiCompanyEntities(udiCompanyEntities);
|
|
|
|
|
if (CollUtil.isNotEmpty(spSyncUdiResponse.getUdiCompanyEntities()) || CollUtil.isNotEmpty(spSyncUdiResponse.getUdiCompanyEntities())) {
|
|
|
|
|
String key = "UdiPrdoucts" + System.currentTimeMillis();
|
|
|
|
|
if (downstream.getParamValue().equals("1")) {
|
|
|
|
|
String datas = JSON.toJSON(spSyncUdiResponse).toString();
|
|
|
|
|
redisUtil.set(key, datas);
|
|
|
|
|
BasicExportStatusEntity myEntity = new BasicExportStatusEntity();
|
|
|
|
|
myEntity.setId(key);
|
|
|
|
|
myEntity.setStatus(0);
|
|
|
|
|
myEntity.setUpdateTime(new Date());
|
|
|
|
|
myEntity.setType(BasicProcessStatus.NEW_ALL_UDIS);
|
|
|
|
|
basicExportService.insertExportStatus(myEntity);
|
|
|
|
|
} else {
|
|
|
|
|
String path = getPath();
|
|
|
|
|
String fileName = path + FileConstant.upWaitCopy_products + "UdiPrdoucts_" + key + ".LowerIn";
|
|
|
|
|
String datas = JSON.toJSON(spSyncUdiResponse).toString();
|
|
|
|
|
FileUtils.SaveFileAs(datas, fileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (udiCompanyEntities.size() < limit1) {
|
|
|
|
|
break;
|
|
|
|
|
} else {
|
|
|
|
@ -343,25 +385,6 @@ public class DlAllDataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SpSyncUdiResponse spSyncUdiResponse = new SpSyncUdiResponse();
|
|
|
|
|
spSyncUdiResponse.setUdiCompanyEntities(mUdiCompanyEntities);
|
|
|
|
|
spSyncUdiResponse.setProductInfoEntityList(mProductInfoEntities);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(spSyncUdiResponse.getProductInfoEntityList()) || CollUtil.isNotEmpty(spSyncUdiResponse.getUdiCompanyEntities())) {
|
|
|
|
|
String key = "UdiPrdoucts" + System.currentTimeMillis();
|
|
|
|
|
String datas = JSON.toJSON(spSyncUdiResponse).toString();
|
|
|
|
|
if (downstream.getParamValue().equals("1")) {
|
|
|
|
|
redisUtil.set(key, datas);
|
|
|
|
|
BasicExportStatusEntity myEntity = new BasicExportStatusEntity();
|
|
|
|
|
myEntity.setId(key);
|
|
|
|
|
basicExportService.insertExportStatus(myEntity);
|
|
|
|
|
} else {
|
|
|
|
|
String path = getPath();
|
|
|
|
|
String fileName = path + FileConstant.upWaitCopy_products + "UdiPrdoucts_" + key + ".LowerIn";
|
|
|
|
|
FileUtils.SaveFileAs(datas, fileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
BasicExportStatusEntity basicExportStatusEntity1 = basicExportStatusEntities.get(0);
|
|
|
|
|
basicExportStatusEntity1.setStatus(1);
|
|
|
|
|
spGetHttp.postUpdateBasicStatus(basicExportStatusEntity1);
|
|
|
|
@ -386,7 +409,6 @@ public class DlAllDataService {
|
|
|
|
|
String fileName = path + FileConstant.upWaitCopy_products + "UdiPrdoucts_" + DateUtil.formatDate(new Date(), "yyyyMMddHHmmss") + ".LowerIn";
|
|
|
|
|
String datas = JSON.toJSONString(baseResponse.getData());
|
|
|
|
|
FileUtils.SaveFileAs(datas, fileName);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
spGetHttp.postDeleteBasicStatus(basicExportStatusEntity.getId());
|
|
|
|
|