Commit 916786f0 by wutong

修改同步采购流水为降序同步

parent 615d8c2b
...@@ -34,10 +34,8 @@ public class PurchaseDetailsServiceImpl { ...@@ -34,10 +34,8 @@ public class PurchaseDetailsServiceImpl {
map.put("end", DateTimeFormatter.ofPattern(CommonConstant.TIME_FORMAT).format(jobPointLog.getEndTime())); map.put("end", DateTimeFormatter.ofPattern(CommonConstant.TIME_FORMAT).format(jobPointLog.getEndTime()));
map.put("type", jobPointLog.getType()); map.put("type", jobPointLog.getType());
map.put("pagesize", jobPointLog.getPageSize()); map.put("pagesize", jobPointLog.getPageSize());
Integer page = 1;
Integer pagetotal = 0;
do { do {
map.put("page", page); map.put("page", jobPointLog.getPageIndex() > 0? jobPointLog.getPageIndex() : 1);
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(map)); RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(map));
String purchaseStr = null; String purchaseStr = null;
Response response = null; Response response = null;
...@@ -59,7 +57,9 @@ public class PurchaseDetailsServiceImpl { ...@@ -59,7 +57,9 @@ public class PurchaseDetailsServiceImpl {
if (StringUtils.isNotBlank(purchaseStr)) { if (StringUtils.isNotBlank(purchaseStr)) {
JSONObject jsonObject = JSON.parseObject(purchaseStr); JSONObject jsonObject = JSON.parseObject(purchaseStr);
if (jsonObject != null) { if (jsonObject != null) {
pagetotal = jsonObject.getInteger("pagetotal"); if (jobPointLog.getPageIndex() == 0) {
jobPointLog.setPageIndex(jsonObject.getInteger("pagetotal") + 1);
}
List<PurchaseDetailDTO> purchaseDetailDTOList = jsonObject.getObject("data", new TypeReference<List<PurchaseDetailDTO>>() { List<PurchaseDetailDTO> purchaseDetailDTOList = jsonObject.getObject("data", new TypeReference<List<PurchaseDetailDTO>>() {
}); });
if (purchaseDetailDTOList != null && purchaseDetailDTOList.size() > 0) { if (purchaseDetailDTOList != null && purchaseDetailDTOList.size() > 0) {
...@@ -207,8 +207,8 @@ public class PurchaseDetailsServiceImpl { ...@@ -207,8 +207,8 @@ public class PurchaseDetailsServiceImpl {
} else{ } else{
throw new RuntimeException("调用采购单sku流水接口失败"); throw new RuntimeException("调用采购单sku流水接口失败");
} }
page++; jobPointLog.setPageIndex(jobPointLog.getPageIndex() - 1);
} while (page <= pagetotal); } while (jobPointLog.getPageIndex() > 0);
jobPointLog.setStartTime(jobPointLog.getEndTime()); jobPointLog.setStartTime(jobPointLog.getEndTime());
jobPointLog.setEndTime(jobPointLog.getStartTime().plusDays(jobPointLog.getIntervalTime().longValue()).isAfter(LocalDateTime.now()) ? LocalDateTime.now() : jobPointLog.getStartTime().plusDays(jobPointLog.getIntervalTime().longValue())); 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