Compare commits

..

3 Commits

Author SHA1 Message Date
雷欧(林平凡)
442bca0b3e 1 2024-12-06 16:56:06 +08:00
雷欧(林平凡)
2c6cabba15 Merge remote-tracking branch '群晖/master' 2024-12-06 16:38:34 +08:00
雷欧(林平凡)
b6f1bd8253 1 2024-12-06 16:38:29 +08:00

View File

@@ -221,6 +221,12 @@ public class JDUtils {
@Scheduled(cron = "0 0 */12 * * ?")
public void fetchHistoricalOrders3060() {
fetchHistoricalOrders3060Do();
}
private int fetchHistoricalOrders3060Do() {
int count = 0;
LocalDateTime now = LocalDateTime.now();
//logger.info("拉取历史订单---> , {} 点,{} 分", now.getHour(), now.getMinute());
@@ -243,6 +249,7 @@ public class JDUtils {
OrderRow orderRow = createOrderRow(orderRowResp);
if (orderRow != null) { // Ensure orderRow is not null after creation
orderRowRepository.save(orderRow);
count++;
}
}
}
@@ -261,6 +268,7 @@ public class JDUtils {
}
startDate = startDate.plusHours(1);
}
return count;
}
/**
@@ -269,6 +277,11 @@ public class JDUtils {
@Scheduled(cron = "0 0 */4 * * ?")
public void fetchHistoricalOrders1430() {
fetchHistoricalOrders1430Do();
}
private int fetchHistoricalOrders1430Do() {
int count = 0;
LocalDateTime now = LocalDateTime.now();
//logger.info("拉取历史订单---> , {} 点,{} 分", now.getHour(), now.getMinute());
@@ -291,6 +304,7 @@ public class JDUtils {
OrderRow orderRow = createOrderRow(orderRowResp);
if (orderRow != null) { // Ensure orderRow is not null after creation
orderRowRepository.save(orderRow);
count++;
}
}
}
@@ -309,6 +323,7 @@ public class JDUtils {
}
startDate = startDate.plusMinutes(10);
}
return count;
}
/**
@@ -317,6 +332,11 @@ public class JDUtils {
@Scheduled(cron = "0 */10 * * * ?")
public void fetchHistoricalOrders0714() {
fetchHistoricalOrders0714Do();
}
private int fetchHistoricalOrders0714Do() {
int count = 0;
LocalDateTime now = LocalDateTime.now();
//logger.info("拉取历史订单---> , {} 点,{} 分", now.getHour(), now.getMinute());
LocalDateTime lastHour = now.truncatedTo(ChronoUnit.HOURS).minusDays(7);
@@ -338,6 +358,7 @@ public class JDUtils {
OrderRow orderRow = createOrderRow(orderRowResp);
if (orderRow != null) { // Ensure orderRow is not null after creation
orderRowRepository.save(orderRow);
count++;
}
}
}
@@ -356,10 +377,19 @@ public class JDUtils {
}
startDate = startDate.plusMinutes(10);
}
return count;
}
@Scheduled(cron = "0 */2 * * * ?")
public void fetchHistoricalOrders0007() {
fetchHistoricalOrders0007Do();
}
private int fetchHistoricalOrders0007Do() {
int count = 0;
LocalDateTime now = LocalDateTime.now();
//logger.info("拉取历史订单---> , {} 点,{} 分", now.getHour(), now.getMinute());
LocalDateTime lastHour = now.truncatedTo(ChronoUnit.HOURS);
@@ -381,6 +411,7 @@ public class JDUtils {
OrderRow orderRow = createOrderRow(orderRowResp);
if (orderRow != null) { // Ensure orderRow is not null after creation
orderRowRepository.save(orderRow);
count++;
}
}
}
@@ -399,6 +430,7 @@ public class JDUtils {
}
startDate = startDate.plusMinutes(10);
}
return count;
}
/**
@@ -438,8 +470,8 @@ public class JDUtils {
* 接收京粉指令指令
*/
public void sendOrderToWxByOrderJD(String order) throws Exception {
int[] parm = {-1};
List<OrderRow> orderRows = orderRowRepository.findByValidCodeNotInOrderByOrderTimeDesc(parm);
int[] param = {-1};
List<OrderRow> orderRows = orderRowRepository.findByValidCodeNotInOrderByOrderTimeDesc(param);
/**
* 菜单:
* 今日统计
@@ -465,9 +497,9 @@ public class JDUtils {
content.append("今日订单\r");
content.append("昨日订单\r");
content.append("刷新三天\r");
content.append("刷新3060\r\n");
content.append("刷新1430\r\n");
content.append("刷新0714\r\n");
content.append("刷新3060\r");
content.append("刷新1430\r");
content.append("刷新0714\r");
content.append("\n");
content.append(":::高级菜单:::\r");
@@ -666,7 +698,7 @@ public class JDUtils {
LocalDateTime lastHour = LocalDateTime.now().minusHours(1).withMinute(0).withSecond(0).withNano(0);
while (!startDate.isEqual(lastHour)) {
startDate = startDate.plusHours(1);
UnionOpenOrderRowQueryResponse response = fetchOrdersForDateTime(startDate, false, 1,false);
UnionOpenOrderRowQueryResponse response = fetchOrdersForDateTime(startDate, false, 1, false);
if (response != null) {
int code = response.getQueryResult().getCode();
@@ -693,24 +725,25 @@ public class JDUtils {
}
case "刷新3060": {
long start = System.currentTimeMillis();
fetchHistoricalOrders3060();
int count = fetchHistoricalOrders3060Do();
long time = System.currentTimeMillis() - start;
content.append("刷新3060,耗时: ").append(time).append("ms, ").append((time) / 1000).append(" s\r");
content.append("订单行:").append(count).append("耗时: ").append(time).append("ms, ").append((time) / 1000).append(" s\r");
break;
}
case "刷新1430": {
long start = System.currentTimeMillis();
fetchHistoricalOrders1430();
int count = fetchHistoricalOrders1430Do();
long time = System.currentTimeMillis() - start;
content.append("刷新1430,耗时: ").append(time).append("ms, ").append((time) / 1000).append(" s\r");
content.append("订单行:").append(count).append("耗时: ").append(time).append("ms, ").append((time) / 1000).append(" s\r");
break;
}
case "刷新0714": {
long start = System.currentTimeMillis();
fetchHistoricalOrders0714();
int count = fetchHistoricalOrders0714Do();
long time = System.currentTimeMillis() - start;
content.append("刷新0014,耗时: ").append(time).append("ms, ").append((time) / 1000).append(" s\r");
content.append("订单行:").append(count).append("耗时: ").append(time).append("ms, ").append((time) / 1000).append(" s\r");
break;
}
@@ -875,15 +908,15 @@ public class JDUtils {
//
// String jsonString = JSON.toJSONString(response);
// System.out.println(jsonString);
//
//System.out.println(request.getAppJsonParams());
//System.out.println(request.getPromotionCodeReq());
//
//System.out.println("--------");
//System.out.println(response.getGetResult().getCode());
//System.out.println(response.getGetResult().getMessage());
//System.out.println(response.getGetResult().getData().getClickURL());
//System.out.println(response.getGetResult().getData().getJCommand());
//
//System.out.println(request.getAppJsonParams());
//System.out.println(request.getPromotionCodeReq());
//
//System.out.println("--------");
//System.out.println(response.getGetResult().getCode());
//System.out.println(response.getGetResult().getMessage());
//System.out.println(response.getGetResult().getData().getClickURL());
//System.out.println(response.getGetResult().getData().getJCommand());
// return response.getGetResult().getData().getClickURL();
//}