新版本
This commit is contained in:
parent
c7f133c642
commit
106c3c9dcd
@ -154,6 +154,7 @@ public class FoundationProperties {
|
|||||||
private String clientSecret;
|
private String clientSecret;
|
||||||
private int pageSize = 500;
|
private int pageSize = 500;
|
||||||
private int maxPages = 1000;
|
private int maxPages = 1000;
|
||||||
|
private int maxResponseBytes = 10 * 1024 * 1024;
|
||||||
private int connectTimeoutMs = 10000;
|
private int connectTimeoutMs = 10000;
|
||||||
private int readTimeoutMs = 60000;
|
private int readTimeoutMs = 60000;
|
||||||
private int maxRetries = 2;
|
private int maxRetries = 2;
|
||||||
@ -173,6 +174,8 @@ public class FoundationProperties {
|
|||||||
public void setPageSize(int pageSize) { this.pageSize = pageSize; }
|
public void setPageSize(int pageSize) { this.pageSize = pageSize; }
|
||||||
public int getMaxPages() { return maxPages; }
|
public int getMaxPages() { return maxPages; }
|
||||||
public void setMaxPages(int maxPages) { this.maxPages = maxPages; }
|
public void setMaxPages(int maxPages) { this.maxPages = maxPages; }
|
||||||
|
public int getMaxResponseBytes() { return maxResponseBytes; }
|
||||||
|
public void setMaxResponseBytes(int maxResponseBytes) { this.maxResponseBytes = maxResponseBytes; }
|
||||||
public int getConnectTimeoutMs() { return connectTimeoutMs; }
|
public int getConnectTimeoutMs() { return connectTimeoutMs; }
|
||||||
public void setConnectTimeoutMs(int connectTimeoutMs) { this.connectTimeoutMs = connectTimeoutMs; }
|
public void setConnectTimeoutMs(int connectTimeoutMs) { this.connectTimeoutMs = connectTimeoutMs; }
|
||||||
public int getReadTimeoutMs() { return readTimeoutMs; }
|
public int getReadTimeoutMs() { return readTimeoutMs; }
|
||||||
|
|||||||
@ -115,12 +115,11 @@ public class CustomerDailyReportService {
|
|||||||
stage(funnel, "VISIT", "到店", visit, appointment);
|
stage(funnel, "VISIT", "到店", visit, appointment);
|
||||||
stage(funnel, "DEAL", "成交", deal, visit);
|
stage(funnel, "DEAL", "成交", deal, visit);
|
||||||
|
|
||||||
Map<String, Object> allCustomerParams = new LinkedHashMap<>();
|
LocalDateTime alertAsOf = endDate.isBefore(today)
|
||||||
allCustomerParams.put("createTimeEnd", API_TIME.format(endExclusive));
|
? endExclusive : LocalDateTime.now(BUSINESS_ZONE);
|
||||||
addSelfParameter(allCustomerParams, scope, "deliverTargetIds");
|
List<JsonNode> activeCustomers = reportCustomers.stream()
|
||||||
List<JsonNode> activeCustomers = distinct(fetchScoped(CUSTOMER, allCustomerParams, "blSchoolId", scope), "customerId")
|
.filter(row -> "1".equals(text(row, "status")) && present(row, "deliverTime")).toList();
|
||||||
.stream().filter(row -> "1".equals(text(row, "status")) && present(row, "deliverTime")).toList();
|
List<Map<String, Object>> alerts = alerts(activeCustomers, followups, alertAsOf);
|
||||||
List<Map<String, Object>> alerts = alerts(activeCustomers, followups, endExclusive);
|
|
||||||
long over24Hours = alerts.stream().mapToLong(row -> number(row.get("customerCount"))).sum();
|
long over24Hours = alerts.stream().mapToLong(row -> number(row.get("customerCount"))).sum();
|
||||||
long over3Days = alerts.stream().mapToLong(row -> number(row.get("over3DaysCount"))).sum();
|
long over3Days = alerts.stream().mapToLong(row -> number(row.get("over3DaysCount"))).sum();
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,8 @@ public class XuebangHttpTransport {
|
|||||||
this.webClient = builder.clone()
|
this.webClient = builder.clone()
|
||||||
.baseUrl(config.getBaseUrl())
|
.baseUrl(config.getBaseUrl())
|
||||||
.clientConnector(new ReactorClientHttpConnector(httpClient))
|
.clientConnector(new ReactorClientHttpConnector(httpClient))
|
||||||
|
.codecs(codecs -> codecs.defaultCodecs()
|
||||||
|
.maxInMemorySize(Math.max(config.getMaxResponseBytes(), 256 * 1024)))
|
||||||
.build();
|
.build();
|
||||||
this.readTimeout = Duration.ofMillis(Math.max(config.getReadTimeoutMs(), 1));
|
this.readTimeout = Duration.ofMillis(Math.max(config.getReadTimeoutMs(), 1));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,7 @@ foundation:
|
|||||||
coze:
|
coze:
|
||||||
base-url: https://api.coze.cn
|
base-url: https://api.coze.cn
|
||||||
chat-path: /v1/workflows/chat
|
chat-path: /v1/workflows/chat
|
||||||
api-key: cztei_q8DKvlTaGtfA4tOAij6f9EexaRlwRiDP5XvESFauvBDzJXsz1VcPPEMetmYSd5wGA
|
api-key: cztei_loBGQ9Xrhq70zquw89ZM6wnBFuHXV7traCchSpfEJOTiMIytf7n7RIKVC7vp1Fq0S
|
||||||
default-workflow: wecom-default
|
default-workflow: wecom-default
|
||||||
workflows:
|
workflows:
|
||||||
wecom-default:
|
wecom-default:
|
||||||
@ -80,6 +80,7 @@ foundation:
|
|||||||
client-secret: "RkDSYCNXD0eBF09ofNfxWMmSZzIWF9QzGWu8GUKAUH5d1sQeXE6JxfScDGFx2Q5EisYRL7IZqij56CqbICeI9pC/EbSdNh8QRgV00S+e6sYbmQImMcRipLsH1t/Bnr1pKRwSBIcj8y8UQThyVT1Ve4Zl/p4J295J4rbLcSo29W0="
|
client-secret: "RkDSYCNXD0eBF09ofNfxWMmSZzIWF9QzGWu8GUKAUH5d1sQeXE6JxfScDGFx2Q5EisYRL7IZqij56CqbICeI9pC/EbSdNh8QRgV00S+e6sYbmQImMcRipLsH1t/Bnr1pKRwSBIcj8y8UQThyVT1Ve4Zl/p4J295J4rbLcSo29W0="
|
||||||
page-size: 500
|
page-size: 500
|
||||||
max-pages: 1000
|
max-pages: 1000
|
||||||
|
max-response-bytes: 10485760
|
||||||
connect-timeout-ms: 10000
|
connect-timeout-ms: 10000
|
||||||
read-timeout-ms: 60000
|
read-timeout-ms: 60000
|
||||||
max-retries: 2
|
max-retries: 2
|
||||||
|
|||||||
@ -30,7 +30,9 @@ class CustomerDailyReportServiceTest {
|
|||||||
|
|
||||||
List<JsonNode> reportCustomers = nodes(
|
List<JsonNode> reportCustomers = nodes(
|
||||||
"{\"customerId\":\"c1\",\"customerName\":\"A\",\"contact\":\"1\",\"cusOrgName\":\"web\",\"blSchoolName\":\"S\",\"intentionName\":\"high\",\"status\":\"1\",\"deliverTime\":\"2026-07-21 08:00:00\",\"deliverUserId\":\"u1\",\"deliverUserName\":\"Advisor\"}",
|
"{\"customerId\":\"c1\",\"customerName\":\"A\",\"contact\":\"1\",\"cusOrgName\":\"web\",\"blSchoolName\":\"S\",\"intentionName\":\"high\",\"status\":\"1\",\"deliverTime\":\"2026-07-21 08:00:00\",\"deliverUserId\":\"u1\",\"deliverUserName\":\"Advisor\"}",
|
||||||
"{\"customerId\":\"c2\",\"customerName\":\"B\",\"contact\":\"2\",\"cusTypeName\":\"walk-in\",\"blSchoolName\":\"S\",\"intentionName\":\"low\",\"status\":\"1\",\"deliverTime\":\"2026-07-21 09:00:00\",\"deliverUserId\":\"u1\",\"deliverUserName\":\"Advisor\"}");
|
"{\"customerId\":\"c2\",\"customerName\":\"B\",\"contact\":\"2\",\"cusTypeName\":\"walk-in\",\"blSchoolName\":\"S\",\"intentionName\":\"low\",\"status\":\"1\",\"deliverTime\":\"2026-07-21 09:00:00\",\"deliverUserId\":\"u1\",\"deliverUserName\":\"Advisor\"}",
|
||||||
|
"{\"customerId\":\"old1\",\"customerName\":\"C\",\"contact\":\"3\",\"cusOrgName\":\"web\",\"blSchoolName\":\"S\",\"intentionName\":\"high\",\"status\":\"1\",\"deliverTime\":\"2026-07-17 00:00:00\",\"deliverUserId\":\"u1\",\"deliverUserName\":\"Advisor\"}",
|
||||||
|
"{\"customerId\":\"old2\",\"customerName\":\"D\",\"contact\":\"4\",\"cusOrgName\":\"web\",\"blSchoolName\":\"S\",\"intentionName\":\"high\",\"status\":\"1\",\"deliverTime\":\"2026-07-20 00:00:00\",\"deliverUserId\":\"u1\",\"deliverUserName\":\"Advisor\"}");
|
||||||
List<JsonNode> activeCustomers = nodes(
|
List<JsonNode> activeCustomers = nodes(
|
||||||
"{\"customerId\":\"old1\",\"status\":\"1\",\"deliverTime\":\"2026-07-17 00:00:00\",\"deliverUserId\":\"u1\",\"deliverUserName\":\"Advisor\"}",
|
"{\"customerId\":\"old1\",\"status\":\"1\",\"deliverTime\":\"2026-07-17 00:00:00\",\"deliverUserId\":\"u1\",\"deliverUserName\":\"Advisor\"}",
|
||||||
"{\"customerId\":\"old2\",\"status\":\"1\",\"deliverTime\":\"2026-07-20 00:00:00\",\"deliverUserId\":\"u1\",\"deliverUserName\":\"Advisor\"}");
|
"{\"customerId\":\"old2\",\"status\":\"1\",\"deliverTime\":\"2026-07-20 00:00:00\",\"deliverUserId\":\"u1\",\"deliverUserName\":\"Advisor\"}");
|
||||||
@ -50,7 +52,7 @@ class CustomerDailyReportServiceTest {
|
|||||||
new CustomerDailyReportRequest(LocalDate.of(2026, 7, 21), LocalDate.of(2026, 7, 21), "admin"));
|
new CustomerDailyReportRequest(LocalDate.of(2026, 7, 21), LocalDate.of(2026, 7, 21), "admin"));
|
||||||
|
|
||||||
Map<?, ?> metrics = (Map<?, ?>) report.get("coreMetrics");
|
Map<?, ?> metrics = (Map<?, ?>) report.get("coreMetrics");
|
||||||
assertThat(metrics.get("added")).isEqualTo(2L);
|
assertThat(metrics.get("added")).isEqualTo(4L);
|
||||||
assertThat(metrics.get("followed")).isEqualTo(2L);
|
assertThat(metrics.get("followed")).isEqualTo(2L);
|
||||||
assertThat(metrics.get("firstCall")).isEqualTo(1L);
|
assertThat(metrics.get("firstCall")).isEqualTo(1L);
|
||||||
assertThat(metrics.get("converted")).isEqualTo(1L);
|
assertThat(metrics.get("converted")).isEqualTo(1L);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user