Commit c91d5915 by yinyong

采购详情--循环判断修改、记录页码

parent 0299e65c
......@@ -40,6 +40,7 @@ public class SyncPurchaseDetailsJob extends PointJob {
map.put("pagesize", jobPointLog.getPageSize());
List<PurchaseDetailDTO> purchaseDetailDTOList = null;
do {
long startTime = System.currentTimeMillis();
map.put("page", jobPointLog.getPageIndex());
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(map));
String purchaseStr = null;
......@@ -61,6 +62,8 @@ public class SyncPurchaseDetailsJob extends PointJob {
response.close();
}
}
long endTime = System.currentTimeMillis();
System.out.println("调用数据时间:"+(endTime - startTime)+"ms");
if (StringUtils.isNotBlank(purchaseStr)) {
JSONObject jsonObject = JSON.parseObject(purchaseStr);
if (jsonObject != null) {
......@@ -69,10 +72,8 @@ public class SyncPurchaseDetailsJob extends PointJob {
if (purchaseDetailDTOList != null && purchaseDetailDTOList.size() > 0) {
try {
DcBasePurchaseDetailsMapper mapper = SessionUtil.getSession().getMapper(DcBasePurchaseDetailsMapper.class);
if (jobPointLog.getPageIndex() % 10 == 0) {
JobPointLogMapper pointLogMapper = SessionUtil.getSession().getMapper(JobPointLogMapper.class);
pointLogMapper.upsertSelective(jobPointLog);
}
JobPointLogMapper pointLogMapper = SessionUtil.getSession().getMapper(JobPointLogMapper.class);
pointLogMapper.upsertSelective(jobPointLog);
purchaseDetailDTOList.forEach(purchaseDetail -> {
log.warn(purchaseDetail.getBailunSku() + "&" + purchaseDetail.getPurchaseId());
DcBasePurchaseDetails dcBasePurchaseDetails = new DcBasePurchaseDetails();
......@@ -105,7 +106,7 @@ public class SyncPurchaseDetailsJob extends PointJob {
throw new RuntimeException("调用采购单sku详细信息接口失败");
}
jobPointLog.setPageIndex(jobPointLog.getPageIndex() + 1);
} while (purchaseDetailDTOList != null && purchaseDetailDTOList.size() == jobPointLog.getPageSize());
} while (purchaseDetailDTOList != null && purchaseDetailDTOList.size() != 0);
jobPointLog.setPageIndex(1);
jobPointLog.setStartTime(jobPointLog.getEndTime());
jobPointLog.setEndTime(jobPointLog.getStartTime().plusDays(jobPointLog.getIntervalTime().longValue()).isAfter(LocalDateTime.now()) ? LocalDateTime.now() : jobPointLog.getStartTime().plusDays(jobPointLog.getIntervalTime().longValue()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment