更新
This commit is contained in:
@@ -185,7 +185,7 @@ public class EmoneyRequestConfig implements IConfig<EmoneyRequestConfig> {
|
||||
* OkHttp 用于注入 User-Agent 规则的 id
|
||||
*/
|
||||
@JsonIgnore
|
||||
private Serializable userAgentPatchRuleId;
|
||||
private Integer userAgentPatchRuleId;
|
||||
|
||||
@Getter(AccessLevel.PRIVATE)
|
||||
@Autowired
|
||||
@@ -207,7 +207,7 @@ public class EmoneyRequestConfig implements IConfig<EmoneyRequestConfig> {
|
||||
chromeVersionsConfig = Objects.requireNonNullElseGet(chromeVersionsConfig, () -> SpringContextHolder.getBean(ChromeVersionsConfig.class));
|
||||
}
|
||||
catch (IllegalStateException e) {
|
||||
log.debug("SpringContext not ready");
|
||||
log.debug("试图从 SpringContextHolder 初始化 androidSdkLevelConfig, deviceInfoConfig 和 chromeVersionConfig, 但 SpringContextHolder 未准备好");
|
||||
}
|
||||
|
||||
if (ObjectUtils.anyNull(fingerprint, buildId, deviceName, androidVersion, androidSdkLevel, softwareType)) {
|
||||
@@ -219,7 +219,7 @@ public class EmoneyRequestConfig implements IConfig<EmoneyRequestConfig> {
|
||||
// model 和 softwareType 本应交由 deviceInfoConfig 检查以
|
||||
// 应对可能的通过修改本地 json 来进行攻击的方式,可是本身
|
||||
// deviceInfoConfig 对 model 和 softwareType 的信息也来源
|
||||
// 于本地,万一本地的 deviceInfo.(fallback.)json 也不值得信任?
|
||||
// 于本地,万一本地的 deviceInfo(.fallback).json 也不值得信任?
|
||||
// 所以只检查 fingerprint
|
||||
|
||||
DeviceInfo deviceInfo;
|
||||
@@ -228,12 +228,12 @@ public class EmoneyRequestConfig implements IConfig<EmoneyRequestConfig> {
|
||||
deviceInfo = DeviceInfo.from(null, fingerprint);
|
||||
Validate.validState(androidVersion.equals(
|
||||
deviceInfo.getVersionRelease()),
|
||||
"androidVersion(versionRelease) doesn't match");
|
||||
"androidVersion(versionRelease) 与预设 fingerprint 不匹配");
|
||||
Validate.validState(androidSdkLevel.equals(
|
||||
String.valueOf(androidSdkLevelConfig.getSdkLevel(deviceInfo.getVersionRelease()))),
|
||||
"androidSdkLevel doesn't match");
|
||||
"androidSdkLevel 与预设 fingerprint 不匹配");
|
||||
Validate.validState(buildId.equals(deviceInfo.getBuildId()),
|
||||
"buildId doesn't match");
|
||||
"buildId 与预设 fingerprint 不匹配");
|
||||
}
|
||||
catch (Exception e) {
|
||||
valid = false;
|
||||
@@ -468,7 +468,7 @@ public class EmoneyRequestConfig implements IConfig<EmoneyRequestConfig> {
|
||||
@JsonIgnore
|
||||
public ObjectNode getReloginObject() {
|
||||
|
||||
if (ObjectUtils.anyNull(getAuthorization(), getUid())) {
|
||||
if (getUid() == null || StringUtils.isBlank(getAuthorization())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,19 +9,15 @@ import org.springframework.context.annotation.Lazy;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import jodd.io.FileUtil;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.Accessors;
|
||||
import okhttp3.ConnectionPool;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import quant.rich.emoney.annotation.LockByCaller;
|
||||
import quant.rich.emoney.client.OkHttpClientProvider;
|
||||
import quant.rich.emoney.component.LockByCaller;
|
||||
import quant.rich.emoney.interfaces.ConfigInfo;
|
||||
import quant.rich.emoney.interfaces.IConfig;
|
||||
|
||||
|
||||
@@ -25,25 +25,55 @@ import quant.rich.emoney.mybatis.typehandler.JsonStringTypeHandler;
|
||||
@TableName(value = "plan", autoResultMap = true)
|
||||
public class Plan {
|
||||
|
||||
/**
|
||||
* 键 ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private String planId;
|
||||
|
||||
private String cronExpression;
|
||||
/**
|
||||
* 计划任务表达式
|
||||
*/
|
||||
private String cronExpr;
|
||||
|
||||
/**
|
||||
* 计划名称
|
||||
*/
|
||||
private String planName;
|
||||
|
||||
/**
|
||||
* 指标代码
|
||||
*/
|
||||
private String indexCode;
|
||||
|
||||
/**
|
||||
* 需要抓取的指标周期
|
||||
*/
|
||||
@TableField(typeHandler = CommaListTypeHandler.class)
|
||||
private List<String> periods;
|
||||
|
||||
/**
|
||||
* 参数
|
||||
*/
|
||||
@TableField(typeHandler = JsonStringTypeHandler.class)
|
||||
private JsonNode params;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 交易日检查,若为 true,则任务执行时判断当日是否为交易日,若是则不执行任务,
|
||||
* 反之无论是否为交易日都执行
|
||||
*/
|
||||
private Boolean openDayCheck;
|
||||
|
||||
/**
|
||||
* 设置抓取周期并去重
|
||||
* @param periods
|
||||
* @return
|
||||
*/
|
||||
public Plan setPeriods(List<String> periods) {
|
||||
if (CollectionUtils.isEmpty(periods)) {
|
||||
this.periods = Collections.emptyList();
|
||||
@@ -59,6 +89,10 @@ public class Plan {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取抓取周期。已去重
|
||||
* @return
|
||||
*/
|
||||
public List<String> getPeriods() {
|
||||
setPeriods(periods);
|
||||
return periods;
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package quant.rich.emoney.entity.sqlite;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 益盟策略和策略池
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain=true)
|
||||
@TableName(value="strategy_and_pool")
|
||||
@ToString
|
||||
public class StrategyAndPool implements Comparable<StrategyAndPool> {
|
||||
|
||||
private String strategyName;
|
||||
private Integer strategyId;
|
||||
private String poolName;
|
||||
@TableId
|
||||
private Integer poolId;
|
||||
|
||||
public StrategyAndPool() {
|
||||
|
||||
}
|
||||
|
||||
public StrategyAndPool(String strategyName, Integer strategyId, String poolName, Integer poolId) {
|
||||
this.strategyName = strategyName;
|
||||
this.strategyId = strategyId;
|
||||
this.poolName = poolName;
|
||||
this.poolId = poolId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof StrategyAndPool)) return false;
|
||||
StrategyAndPool strategyAndPool = (StrategyAndPool) o;
|
||||
return
|
||||
strategyName == strategyAndPool.strategyName &&
|
||||
strategyId == strategyAndPool.strategyId &&
|
||||
poolName == strategyAndPool.poolName &&
|
||||
poolId == strategyAndPool.poolId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(strategyName, strategyId, poolName, poolId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序,先按 strategyId 升序,再按 poolId 升序
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(StrategyAndPool other) {
|
||||
int cmp = Integer.compare(this.strategyId, other.strategyId);
|
||||
if (cmp == 0) {
|
||||
cmp = Integer.compare(this.poolId, other.poolId);
|
||||
}
|
||||
return cmp;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user