1
This commit is contained in:
@@ -241,6 +241,7 @@ public class JDUtils {
|
|||||||
|
|
||||||
while (hasMore) {
|
while (hasMore) {
|
||||||
try {
|
try {
|
||||||
|
// 30-60 天 ,非实时,非分钟
|
||||||
UnionOpenOrderRowQueryResponse response = fetchOrdersForDateTime(startDate, false, pageIndex, false);
|
UnionOpenOrderRowQueryResponse response = fetchOrdersForDateTime(startDate, false, pageIndex, false);
|
||||||
if (response != null && response.getQueryResult() != null) {
|
if (response != null && response.getQueryResult() != null) {
|
||||||
if (response.getQueryResult().getCode() == 200) {
|
if (response.getQueryResult().getCode() == 200) {
|
||||||
@@ -296,6 +297,7 @@ public class JDUtils {
|
|||||||
|
|
||||||
while (hasMore) {
|
while (hasMore) {
|
||||||
try {
|
try {
|
||||||
|
// 14 - 30 天 ,非实时,非分钟
|
||||||
UnionOpenOrderRowQueryResponse response = fetchOrdersForDateTime(startDate, false, pageIndex, false);
|
UnionOpenOrderRowQueryResponse response = fetchOrdersForDateTime(startDate, false, pageIndex, false);
|
||||||
if (response != null && response.getQueryResult() != null) {
|
if (response != null && response.getQueryResult() != null) {
|
||||||
if (response.getQueryResult().getCode() == 200) {
|
if (response.getQueryResult().getCode() == 200) {
|
||||||
@@ -323,7 +325,7 @@ public class JDUtils {
|
|||||||
}
|
}
|
||||||
if (hasMore) pageIndex++;
|
if (hasMore) pageIndex++;
|
||||||
}
|
}
|
||||||
startDate = startDate.plusMinutes(10);
|
startDate = startDate.plusHours(1);
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@@ -331,7 +333,7 @@ public class JDUtils {
|
|||||||
/**
|
/**
|
||||||
* 每10分钟拉取07-14天的订单
|
* 每10分钟拉取07-14天的订单
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 */10 * * * ?")
|
@Scheduled(cron = "0 0 */2 * * ?")
|
||||||
public void fetchHistoricalOrders0714() {
|
public void fetchHistoricalOrders0714() {
|
||||||
|
|
||||||
fetchHistoricalOrders0714Do();
|
fetchHistoricalOrders0714Do();
|
||||||
@@ -350,7 +352,8 @@ public class JDUtils {
|
|||||||
|
|
||||||
while (hasMore) {
|
while (hasMore) {
|
||||||
try {
|
try {
|
||||||
UnionOpenOrderRowQueryResponse response = fetchOrdersForDateTime(startDate, false, pageIndex, true);
|
// 7 - 14 天 ,非实时,非分钟
|
||||||
|
UnionOpenOrderRowQueryResponse response = fetchOrdersForDateTime(startDate, false, pageIndex, false);
|
||||||
if (response != null && response.getQueryResult() != null) {
|
if (response != null && response.getQueryResult() != null) {
|
||||||
if (response.getQueryResult().getCode() == 200) {
|
if (response.getQueryResult().getCode() == 200) {
|
||||||
OrderRowResp[] orderRowResps = response.getQueryResult().getData();
|
OrderRowResp[] orderRowResps = response.getQueryResult().getData();
|
||||||
@@ -377,15 +380,13 @@ public class JDUtils {
|
|||||||
}
|
}
|
||||||
if (hasMore) pageIndex++;
|
if (hasMore) pageIndex++;
|
||||||
}
|
}
|
||||||
startDate = startDate.plusMinutes(10);
|
startDate = startDate.plusHours(1);
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 */2 * * * ?")
|
@Scheduled(cron = "0 0 * * * ?")
|
||||||
public void fetchHistoricalOrders0007() {
|
public void fetchHistoricalOrders0007() {
|
||||||
|
|
||||||
|
|
||||||
fetchHistoricalOrders0007Do();
|
fetchHistoricalOrders0007Do();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,7 +404,8 @@ public class JDUtils {
|
|||||||
|
|
||||||
while (hasMore) {
|
while (hasMore) {
|
||||||
try {
|
try {
|
||||||
UnionOpenOrderRowQueryResponse response = fetchOrdersForDateTime(startDate, false, pageIndex, true);
|
// 0 - 7 天 ,非实时,非分钟
|
||||||
|
UnionOpenOrderRowQueryResponse response = fetchOrdersForDateTime(startDate, false, pageIndex, false);
|
||||||
if (response != null && response.getQueryResult() != null) {
|
if (response != null && response.getQueryResult() != null) {
|
||||||
if (response.getQueryResult().getCode() == 200) {
|
if (response.getQueryResult().getCode() == 200) {
|
||||||
OrderRowResp[] orderRowResps = response.getQueryResult().getData();
|
OrderRowResp[] orderRowResps = response.getQueryResult().getData();
|
||||||
@@ -430,17 +432,21 @@ public class JDUtils {
|
|||||||
}
|
}
|
||||||
if (hasMore) pageIndex++;
|
if (hasMore) pageIndex++;
|
||||||
}
|
}
|
||||||
startDate = startDate.plusMinutes(10);
|
startDate = startDate.plusHours(1);
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据指定的日期时间拉取订单
|
* 根据指定的日期时间拉取订单
|
||||||
|
* @param startTime 开始时间
|
||||||
|
* isRealTime 是否是实时订单 是的话不会判断是否拉取过
|
||||||
|
* page 分页页码
|
||||||
|
* isMinutes 是否是分钟级订单 分钟的每次加10分钟,小时每小时加1小时
|
||||||
*/
|
*/
|
||||||
public UnionOpenOrderRowQueryResponse fetchOrdersForDateTime(LocalDateTime startTime, boolean isRealTime, Integer page, boolean isMinutes) throws Exception {
|
public UnionOpenOrderRowQueryResponse fetchOrdersForDateTime(LocalDateTime startTime, boolean isRealTime, Integer page, boolean isMinutes) {
|
||||||
|
|
||||||
LocalDateTime endTime = isMinutes ? startTime.plusMinutes(10) : startTime.plusHours(1);
|
LocalDateTime endTime = isMinutes ? startTime.plusMinutes(30) : startTime.plusHours(1);
|
||||||
String hourMinuteTag = isRealTime ? "minute" : "hour";
|
String hourMinuteTag = isRealTime ? "minute" : "hour";
|
||||||
String timeTag = JD_REFRESH_TAG + startTime.format(DATE_TIME_FORMATTER);
|
String timeTag = JD_REFRESH_TAG + startTime.format(DATE_TIME_FORMATTER);
|
||||||
|
|
||||||
@@ -454,20 +460,25 @@ public class JDUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 调用 API 以拉取订单
|
// 调用 API 以拉取订单
|
||||||
UnionOpenOrderRowQueryResponse unionOpenOrderRowQueryResponse = getUnionOpenOrderRowQueryResponse(startTime, endTime, page);
|
try {
|
||||||
|
UnionOpenOrderRowQueryResponse unionOpenOrderRowQueryResponse = getUnionOpenOrderRowQueryResponse(startTime, endTime, page);
|
||||||
|
// 历史的订单才进行标记为已拉取,小时分钟的都进行拉取并且标记
|
||||||
|
if (!isRealTime) {
|
||||||
|
// 只有没有订单的才进行标记为已拉取
|
||||||
|
if (unionOpenOrderRowQueryResponse != null && unionOpenOrderRowQueryResponse.getQueryResult() != null && unionOpenOrderRowQueryResponse.getQueryResult().getData() == null) {
|
||||||
|
hashOps.put(timeTag, hourMinuteTag, "done");
|
||||||
|
}
|
||||||
|
|
||||||
// 历史的订单才进行标记为已拉取,小时分钟的都进行拉取并且标记
|
|
||||||
if (!isRealTime) {
|
|
||||||
// 只有没有订单的才进行标记为已拉取
|
|
||||||
if (unionOpenOrderRowQueryResponse != null && unionOpenOrderRowQueryResponse.getQueryResult() != null && unionOpenOrderRowQueryResponse.getQueryResult().getData() == null) {
|
|
||||||
hashOps.put(timeTag, hourMinuteTag, "done");
|
|
||||||
}
|
}
|
||||||
|
// 打印方法调用和开始结束时间
|
||||||
|
|
||||||
|
//logger.info("拉取订单---> ,类型 {} , 开始时间:{} --- 结束时间:{}", hourMinuteTag, startTime.format(DATE_TIME_FORMATTER), endTime.format(DATE_TIME_FORMATTER));
|
||||||
|
return unionOpenOrderRowQueryResponse;
|
||||||
|
}catch ( Exception e){
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
// 打印方法调用和开始结束时间
|
|
||||||
|
|
||||||
//logger.info("拉取订单---> ,类型 {} , 开始时间:{} --- 结束时间:{}", hourMinuteTag, startTime.format(DATE_TIME_FORMATTER), endTime.format(DATE_TIME_FORMATTER));
|
|
||||||
return unionOpenOrderRowQueryResponse;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -500,7 +511,7 @@ public class JDUtils {
|
|||||||
content.append("上个月统计\r");
|
content.append("上个月统计\r");
|
||||||
content.append("今日订单\r");
|
content.append("今日订单\r");
|
||||||
content.append("昨日订单\r");
|
content.append("昨日订单\r");
|
||||||
content.append("刷新三天\r");
|
content.append("刷新7天\r");
|
||||||
content.append("刷新3060\r");
|
content.append("刷新3060\r");
|
||||||
content.append("刷新1430\r");
|
content.append("刷新1430\r");
|
||||||
content.append("刷新0714\r");
|
content.append("刷新0714\r");
|
||||||
@@ -705,7 +716,7 @@ public class JDUtils {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "刷新三天": {
|
case "刷新7天": {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
LocalDateTime startDate = LocalDateTime.now().minusDays(3).withMinute(0).withSecond(0).withNano(0);
|
LocalDateTime startDate = LocalDateTime.now().minusDays(3).withMinute(0).withSecond(0).withNano(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user