mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-08-13 17:53:45 +08:00
96 lines
2.2 KiB
Java
96 lines
2.2 KiB
Java
|
|
package com.jsowell.pile.config;
|
|||
|
|
|
|||
|
|
import lombok.Data;
|
|||
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|||
|
|
import org.springframework.stereotype.Component;
|
|||
|
|
|
|||
|
|
import java.util.List;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 无交易记录自动结算配置类
|
|||
|
|
*
|
|||
|
|
* @author jsowell
|
|||
|
|
*/
|
|||
|
|
@Data
|
|||
|
|
@Component
|
|||
|
|
@ConfigurationProperties(prefix = "auto-settle")
|
|||
|
|
public class AutoSettleConfig {
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 功能总开关
|
|||
|
|
* 默认:false(关闭)
|
|||
|
|
*/
|
|||
|
|
private Boolean enabled = false;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 停止超时阈值(分钟)
|
|||
|
|
* 订单停止超过该时间才触发自动结算
|
|||
|
|
* 默认:10分钟
|
|||
|
|
*/
|
|||
|
|
private Integer timeoutMinutes = 10;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 定时任务执行间隔(cron表达式)
|
|||
|
|
* 默认:每10分钟执行一次
|
|||
|
|
*/
|
|||
|
|
private String interval = "0 */10 * * * ?";
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 灰度站点ID列表
|
|||
|
|
* 为空表示全量上线
|
|||
|
|
*/
|
|||
|
|
private List<Long> grayscaleStationIds;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 单次扫描订单数量上限
|
|||
|
|
* 防止一次性处理过多订单
|
|||
|
|
* 默认:100
|
|||
|
|
*/
|
|||
|
|
private Integer batchSize = 100;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 异常金额阈值比例
|
|||
|
|
* chargingAmount > payAmount * 该比例时告警跳过
|
|||
|
|
* 默认:1.5倍
|
|||
|
|
*/
|
|||
|
|
private Double amountThresholdRatio = 1.5;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 实时数据新鲜度阈值(分钟)
|
|||
|
|
* 最后一条实时数据距当前时间超过该阈值则认为桩"假在线"
|
|||
|
|
* 默认:30分钟
|
|||
|
|
*/
|
|||
|
|
private Integer dataFreshnessMinutes = 30;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 告警开关
|
|||
|
|
* 异常情况是否发送告警
|
|||
|
|
* 默认:true
|
|||
|
|
*/
|
|||
|
|
private Boolean alertEnabled = true;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Redis锁超时时间(秒)
|
|||
|
|
* 防止分布式锁死锁
|
|||
|
|
* 默认:300秒(5分钟)
|
|||
|
|
*/
|
|||
|
|
private Long lockTimeout = 300L;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 是否启用灰度(根据灰度站点列表判断)
|
|||
|
|
*/
|
|||
|
|
public boolean isGrayscaleEnabled() {
|
|||
|
|
return grayscaleStationIds != null && !grayscaleStationIds.isEmpty();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 判断站点是否在灰度范围内
|
|||
|
|
*/
|
|||
|
|
public boolean isStationInGrayscale(Long stationId) {
|
|||
|
|
if (!isGrayscaleEnabled()) {
|
|||
|
|
return true; // 未启用灰度,所有站点都算在范围内
|
|||
|
|
}
|
|||
|
|
return grayscaleStationIds.contains(stationId);
|
|||
|
|
}
|
|||
|
|
}
|