gongchunyi
4 天以前 e9b4ceeea014f9d81263672f3d9c46a567c39591
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package com.ruoyi.energymeter.config;
 
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
 
/**
 * 水电表接入配置。
 *
 * <p>授权码只从环境变量或安全配置读取,禁止写入源码、前端与数据库业务表。</p>
 */
@Data
@Component
@ConfigurationProperties(prefix = "energy-meter")
public class EnergyMeterProperties {
 
    /** 第三方供应商配置。 */
    private Provider provider = new Provider();
 
    /** 每天自动同步时回查的天数(含昨天)。 */
    private int lookbackDays = 3;
 
    /** 历史补采单个分片的最大自然日。 */
    private int maxShardDays = 30;
 
    /** 示值接口单个分片的最大自然日:集社云 GetWaterRawData 限制查询跨度不超过 15 天。 */
    private int maxReadingShardDays = 15;
 
    /** 第三方请求最大并发数。 */
    private int concurrency = 3;
 
    /** 失败任务最大尝试次数。 */
    private int maxAttempts = 3;
 
    /** RUNNING 任务超时阈值(分钟),超时后进入重试。 */
    private int runningTimeoutMinutes = 30;
 
    /** 是否启用原始示值任务(水表分页能力未确认时可关闭)。 */
    private boolean rawReadingEnabled = true;
 
    /** 是否注册 Quartz 作业。 */
    private boolean schedulerEnabled = true;
 
    /** 每天同步 Cron,固定北京时间 08:00。 */
    private String syncCron = "0 0 8 * * ?";
 
    /** 恢复任务 Cron,每 10 分钟。 */
    private String recoveryCron = "0 0/10 * * * ?";
 
    /** 绑定时默认补采起点:上一自然年 1 月 1 日。 */
    private boolean backfillFromLastYear = true;
 
    @Data
    public static class Provider {
 
        /** 正式环境基础地址,部署前须确认 HTTPS 或安全代理方案。 */
        private String baseUrl = "http://nhapi.yunjichaobiao.com/WebApi";
 
        /** 第三方授权码,只允许通过环境变量注入。 */
        private String apiKey = "";
 
        /** 演示数据模式:未配置授权码时自动开启,仅在本地联调使用。 */
        private boolean mockEnabled = false;
 
        /** 两次第三方请求之间的最小间隔(毫秒),用于规避供应商限流(429)。 */
        private long minIntervalMs = 500;
 
        private int connectTimeoutSeconds = 5;
 
        private int readTimeoutSeconds = 30;
    }
}