args2 = new HashMap<>();
48 | args2.put("x-dead-letter-exchange", DLX_EXCHANGE_NAME);
49 | args2.put("x-dead-letter-routing-key", "boss");
50 | channel.queueDeclare(queueName2, true, false, false, args2);
51 | channel.queueBind(queueName2, EXCHANGE_NAME, "小李", null);
52 |
53 | Scanner sc = new Scanner(System.in);
54 | while (sc.hasNext()) {
55 | String userInput = sc.nextLine();
56 | String[] strings = userInput.split(" ");
57 | if (strings.length < 1) {
58 | continue;
59 | }
60 | String routingKey = strings[0];
61 | String message = strings[1];
62 | channel.basicPublish(EXCHANGE_NAME, routingKey, null, message.getBytes("UTF-8"));
63 | System.out.println(" [x] Sent routingKey'" + routingKey + "' message:'" + message + "'");
64 | }
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/src/main/java/com/leikooo/yubi/utils/ChartDataUtil.java:
--------------------------------------------------------------------------------
1 | package com.leikooo.yubi.utils;
2 |
3 | import cn.hutool.core.util.ObjectUtil;
4 | import com.leikooo.yubi.common.ErrorCode;
5 | import com.leikooo.yubi.exception.ThrowUtils;
6 | import com.leikooo.yubi.manager.AIManager;
7 | import com.leikooo.yubi.model.dto.chart.ChartGenResult;
8 | import lombok.extern.slf4j.Slf4j;
9 | import org.springframework.stereotype.Component;
10 |
11 | import java.util.List;
12 | import java.util.Map;
13 | import java.util.Set;
14 | import java.util.StringJoiner;
15 | import java.util.stream.Collectors;
16 |
17 | /**
18 | * @author leikooo
19 | * @description 把查询到的数据转换成字符串
20 | *
21 | * 用户id, 用户数据, 用户增量
22 | * 1, 200, 10
23 | * 2, 200, 20
24 | * 3, 800, 10
25 | */
26 | @Component
27 | @Slf4j
28 | public class ChartDataUtil {
29 |
30 | public static String changeDataToCSV(List