1
This commit is contained in:
@@ -35,7 +35,7 @@ public class MessageConsumerService implements RocketMQListener<JSONObject> {
|
||||
// 处理消息
|
||||
try {
|
||||
rateLimiter.acquire(); // 请求许可。如果超过速率,则此方法会阻塞
|
||||
logger.info("消费到消息:{}", jsonObject);
|
||||
//logger.info("消费到消息:{}", jsonObject);
|
||||
String body = jsonObject.getString("body");
|
||||
byte[] decodedBody = Base64.getDecoder().decode(body);
|
||||
String decodedBodyStr = new String(decodedBody, StandardCharsets.UTF_8);
|
||||
@@ -51,13 +51,12 @@ public class MessageConsumerService implements RocketMQListener<JSONObject> {
|
||||
// TODO: 如果需要处理错误,您可以在这里添加逻辑
|
||||
throw new RuntimeException("消息发送失败: " + responseStr);
|
||||
}
|
||||
logger.info("消息成功发送并得到响应:{}", response);
|
||||
//logger.info("消息成功发送并得到响应:{}", response);
|
||||
} else {
|
||||
throw new RuntimeException("消息发送失败,没有收到响应");
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("处理消息时发生错误", e);
|
||||
//logger.error("处理消息时发生错误", e);
|
||||
throw e; // 重抛异常使得 RocketMQ 可以捕获到这个异常
|
||||
}
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ public class JDUtils {
|
||||
*/
|
||||
@Scheduled(cron = "*/10 * * * * ?")
|
||||
public void sendOrderToWx() {
|
||||
long start = System.currentTimeMillis();
|
||||
//long start = System.currentTimeMillis();
|
||||
int[] parm = {-1};
|
||||
List<OrderRow> orderRows = orderRowRepository.findByValidCodeNotInOrderByOrderTimeDesc(parm);
|
||||
|
||||
@@ -226,7 +226,7 @@ public class JDUtils {
|
||||
|
||||
}
|
||||
|
||||
logger.info("扫描订单发送到微信耗时:{} ms, 订单数:{} ", System.currentTimeMillis() - start, orderRows.size());
|
||||
//logger.info("扫描订单发送到微信耗时:{} ms, 订单数:{} ", System.currentTimeMillis() - start, orderRows.size());
|
||||
|
||||
}
|
||||
|
||||
@@ -236,9 +236,9 @@ public class JDUtils {
|
||||
*/
|
||||
@Scheduled(cron = "0 0 * * * ?")
|
||||
public void fetchHistoricalOrders() {
|
||||
System.out.println("开始拉取历史订单");
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
logger.info("拉取历史订单---> , {} 点", now.getHour());
|
||||
LocalDateTime lastHour = now.truncatedTo(ChronoUnit.HOURS);
|
||||
LocalDateTime startDate = lastHour.minusMonths(2).truncatedTo(ChronoUnit.HOURS);
|
||||
|
||||
@@ -312,7 +312,7 @@ public class JDUtils {
|
||||
}
|
||||
// 打印方法调用和开始结束时间
|
||||
|
||||
logger.info("拉取订单:开始时间:{}---结束时间:{}", startTime.format(DATE_TIME_FORMATTER), endTime.format(DATE_TIME_FORMATTER));
|
||||
logger.info("拉取订单---> ,类型 {} , 开始时间:{} --- 结束时间:{}", hourMinuteTag, startTime.format(DATE_TIME_FORMATTER), endTime.format(DATE_TIME_FORMATTER));
|
||||
return unionOpenOrderRowQueryResponse;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public class WXUtil {
|
||||
}
|
||||
|
||||
// 发送文本消息 msgType 1:私聊 2:群发
|
||||
public void sendTextMessage(String wxid, String content, Integer msgType, String fromwxid) {
|
||||
public synchronized void sendTextMessage(String wxid, String content, Integer msgType, String fromwxid) {
|
||||
// 全部打印
|
||||
logger.info("发送文本消息 msgType: {} wxid: {} fromwxid: {} content: {}", msgType, wxid, fromwxid, content);
|
||||
List<String> strings = splitStringByLength(content, 3072);
|
||||
|
||||
Reference in New Issue
Block a user