Files
smartDriveEE/src/main/java/com/rj/config/HxrAdminProperties.java
2026-05-31 07:33:00 +08:00

118 lines
3.7 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.rj.config;
import com.rj.scheduler.LBAdminPullScheduler;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* hxrd 后台订单列表拉取(供 {@link LBAdminPullScheduler} 使用)。
*/
@Data
@ConfigurationProperties(prefix = "hxr.admin")
public class HxrAdminProperties {
/**
* 是否启用拉取任务;未启用时不发 HTTP 请求。
*/
private boolean enabled = true;
/**
* 订单列表基础 URL含分页等通用查询串各业务在代码中覆盖查询参数或使用独立 URL 配置。
*/
private String orderSelectUrl =
"https://hxrdhoutai.hxrdsm.cn222/app/admin/order/select?page=1&limit=90";
/**
* 未支付订单拉取 URL含 {@code status=0} 等业务筛选),供 {@link LBAdminPullScheduler#pullOrdersForUnPay} 使用。
*/
private String orderSelectUnPayUrl =
"https://hxrdhoutai.hxrdsm.cn222/app/admin/order/select?page=1&limit=90&status=0";
/**
* 已支付订单拉取 URL含 {@code status=1}),供 {@link LBAdminPullScheduler#pullOrdersForUnPay} 使用。
*/
private String orderSelectPaidUrl =
"https://hxrdhoutai.hxrdsm.cn222/app/admin/order/select?page=1&limit=90&status=1";
/**
* 定时将 hxrd 订单同步到 {@code lb_order_row} 时使用的租户 id未配置时跳过订单状态同步。
*/
private String syncTenantId = "TENANT_ID_CST_2026";
/**
* 请求头 Cookie 完整取值,例如 {@code PHPSID=xxxx}。非空时优先于 {@link #phpsid}。
*/
private String cookie = "";
/**
* 仅 PHPSID 会话值(不含 {@code PHPSID=} 前缀);在 {@link #cookie} 为空时使用。
*/
private String phpsid = "";
/**
* 用户列表接口 URL可含默认查询串实际请求会覆盖 {@code mobile} 等参数。
*/
private String userSelectUrl =
"https://hxrdhoutai.hxrdsm.cn222/app/admin/user/select?page=1&limit=90";
/**
* 用户更新接口 URL。
*/
private String userUpdateUrl = "https://hxrdhoutai.hxrdsm.cn222/app/admin/user/update";
/**
* 货品列表 API{@code /api/order/goods});实际请求会覆盖 {@code page}、{@code limit}。
*/
private String goodsApiUrl = "https://hxrdhoutai.hxrdsm.cn222/api/order/goods?page=1&limit=20";
/**
* 抢购 API{@code POST /api/order/buy})。
*/
private String buyApiUrl = "https://hxrdhoutai.hxrdsm.cn222/api/order/buy";
/**
* 货品列表 API 请求头 {@code token}。
*/
private String goodsApiToken = "04e2a8aa-d178-4da4-b97f-057849607824";
/**
* 货品 API 请求头 {@code Origin},与浏览器前端域一致。
*/
private String goodsApiOrigin = "https://hxrdweb.hxrdsm.cn";
/**
* 货品 API 请求头 {@code Referer}。
*/
private String goodsApiReferer = "https://hxrdweb.hxrdsm.cn/";
/**
* 货品 API 签名密钥(前端 configs.appStr
*/
private String goodsApiAppStr = "ssniQQ3UP2Vr8mXwaugssgaOLzQo0cX5";
/**
* 组装 Cookie 请求头:优先 {@link #cookie},否则 {@code PHPSID=}{@link #phpsid}。
*
* @return 非空 Cookie 值,或无法组装时的空串
*/
public String resolveCookieHeader() {
String c = firstNonBlank(cookie);
if (c != null) {
return c;
}
String id = firstNonBlank(phpsid);
if (id != null) {
return "PHPSID=" + id;
}
return "";
}
private static String firstNonBlank(String s) {
if (s == null) {
return null;
}
String t = s.trim();
return t.isEmpty() ? null : t;
}
}