抢单账户配置
This commit is contained in:
@@ -20,19 +20,19 @@ public class HxrAdminProperties {
|
||||
* 订单列表基础 URL(含分页等通用查询串);各业务在代码中覆盖查询参数,或使用独立 URL 配置。
|
||||
*/
|
||||
private String orderSelectUrl =
|
||||
"https://hxrdhoutai.hxrdsm.cn222/app/admin/order/select?page=1&limit=90";
|
||||
"https://22222/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";
|
||||
"https://22222/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";
|
||||
"https://22222/app/admin/order/select?page=1&limit=90&status=1";
|
||||
|
||||
/**
|
||||
* 定时将 hxrd 订单同步到 {@code lb_order_row} 时使用的租户 id;未配置时跳过订单状态同步。
|
||||
@@ -53,22 +53,22 @@ public class HxrAdminProperties {
|
||||
* 用户列表接口 URL(可含默认查询串);实际请求会覆盖 {@code mobile} 等参数。
|
||||
*/
|
||||
private String userSelectUrl =
|
||||
"https://hxrdhoutai.hxrdsm.cn222/app/admin/user/select?page=1&limit=90";
|
||||
"https://22222/app/admin/user/select?page=1&limit=90";
|
||||
|
||||
/**
|
||||
* 用户更新接口 URL。
|
||||
*/
|
||||
private String userUpdateUrl = "https://hxrdhoutai.hxrdsm.cn222/app/admin/user/update";
|
||||
private String userUpdateUrl = "https://22222/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";
|
||||
private String goodsApiUrl = "https://22222/api/order/goods?page=1&limit=20";
|
||||
|
||||
/**
|
||||
* 抢购 API({@code POST /api/order/buy})。
|
||||
*/
|
||||
private String buyApiUrl = "https://hxrdhoutai.hxrdsm.cn222/api/order/buy";
|
||||
private String buyApiUrl = "https://22222/api/order/buy";
|
||||
|
||||
/**
|
||||
* 货品列表 API 请求头 {@code token}。
|
||||
|
||||
84
src/main/java/com/rj/controller/LbBuyAccountController.java
Normal file
84
src/main/java/com/rj/controller/LbBuyAccountController.java
Normal file
@@ -0,0 +1,84 @@
|
||||
package com.rj.controller;
|
||||
|
||||
import com.rj.entity.LbBuyAccount;
|
||||
import com.rj.service.ILbBuyAccountService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/lbBuyAccount")
|
||||
@Tag(name = "LB抢单账号配置", description = "lb_buy_account 增删改查与分页")
|
||||
public class LbBuyAccountController {
|
||||
|
||||
@Autowired
|
||||
private ILbBuyAccountService lbBuyAccountService;
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "新增")
|
||||
public ResponseEntity<Map<String, Object>> add(
|
||||
@Parameter(description = "实体(id 为空时自动生成 UUID)", required = true)
|
||||
@RequestBody LbBuyAccount entity) {
|
||||
Map<String, Object> result = lbBuyAccountService.add(entity);
|
||||
Boolean success = (Boolean) result.get("success");
|
||||
if (success != null && success) {
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "编辑")
|
||||
public ResponseEntity<Map<String, Object>> update(
|
||||
@Parameter(description = "实体", required = true) @RequestBody LbBuyAccount entity) {
|
||||
Map<String, Object> result = lbBuyAccountService.update(entity);
|
||||
Boolean success = (Boolean) result.get("success");
|
||||
if (success != null && success) {
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@Operation(summary = "删除")
|
||||
public ResponseEntity<Map<String, Object>> delete(
|
||||
@Parameter(description = "主键ID(UUID)", required = true) @PathVariable String id) {
|
||||
Map<String, Object> result = lbBuyAccountService.deleteById(id);
|
||||
Boolean success = (Boolean) result.get("success");
|
||||
if (success != null && success) {
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "分页查询")
|
||||
public ResponseEntity<Map<String, Object>> list(
|
||||
@RequestParam(defaultValue = "1") Integer current,
|
||||
@RequestParam(defaultValue = "10") Integer size,
|
||||
@RequestParam(required = false) String tenantId,
|
||||
@RequestParam(required = false) String tenantName,
|
||||
@RequestParam(required = false) String loginAccount,
|
||||
@RequestParam(required = false) String nickname,
|
||||
@RequestParam(required = false) String referrerPhone,
|
||||
@RequestParam(required = false) String referrerName,
|
||||
@Parameter(description = "创建时间起,格式 yyyy-MM-dd HH:mm:ss")
|
||||
@RequestParam(required = false) String createTimeStart,
|
||||
@Parameter(description = "创建时间止,格式 yyyy-MM-dd HH:mm:ss")
|
||||
@RequestParam(required = false) String createTimeEnd) {
|
||||
Map<String, Object> result = lbBuyAccountService.pageQuery(
|
||||
current, size, tenantId, tenantName, loginAccount, nickname,
|
||||
referrerPhone, referrerName, createTimeStart, createTimeEnd
|
||||
);
|
||||
Boolean success = (Boolean) result.get("success");
|
||||
if (success != null && success) {
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ public class LbGoodsRushBuyRequest {
|
||||
@Schema(description = "租户 id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String tenantId;
|
||||
|
||||
@Schema(description = "hxrd 接口请求头 token;未传时使用 lb_third_integration_config 中的 goodsApiToken")
|
||||
@Schema(description = "hxrd 请求头 Token(与浏览器 DevTools 中一致);未传时使用 lb_third_integration_config.goodsApiToken,易过期导致 code=500")
|
||||
private String token;
|
||||
|
||||
@Schema(description = "最多成功抢购笔数(达到后停止继续请求)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
|
||||
84
src/main/java/com/rj/entity/LbBuyAccount.java
Normal file
84
src/main/java/com/rj/entity/LbBuyAccount.java
Normal file
@@ -0,0 +1,84 @@
|
||||
package com.rj.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("lb_buy_account")
|
||||
@Schema(description = "LB 抢单账号配置表")
|
||||
public class LbBuyAccount implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId("id")
|
||||
@Schema(description = "主键,UUID")
|
||||
private String id;
|
||||
|
||||
@TableField("tenant_id")
|
||||
@Schema(description = "租户ID,关联 tenant.id")
|
||||
private String tenantId;
|
||||
|
||||
@TableField("tenant_name")
|
||||
@Schema(description = "租户名称")
|
||||
private String tenantName;
|
||||
|
||||
@TableField("login_account")
|
||||
@Schema(description = "登录账号")
|
||||
private String loginAccount;
|
||||
|
||||
@TableField("login_password")
|
||||
@Schema(description = "登录密码(明文)")
|
||||
private String loginPassword;
|
||||
|
||||
@TableField("nickname")
|
||||
@Schema(description = "昵称")
|
||||
private String nickname;
|
||||
|
||||
@TableField("referrer_phone")
|
||||
@Schema(description = "推荐人手机号")
|
||||
private String referrerPhone;
|
||||
|
||||
@TableField("referrer_name")
|
||||
@Schema(description = "推荐人姓名")
|
||||
private String referrerName;
|
||||
|
||||
@TableField("login_url")
|
||||
@Schema(description = "登录网址")
|
||||
private String loginUrl;
|
||||
|
||||
@TableField("max_grab_amount")
|
||||
@Schema(description = "抢单最大金额(整数)")
|
||||
private Integer maxGrabAmount;
|
||||
|
||||
@TableField("max_grab_count")
|
||||
@Schema(description = "抢单最大次数")
|
||||
private Integer maxGrabCount;
|
||||
|
||||
@TableField("latest_recharge_points")
|
||||
@Schema(description = "最新充值点数")
|
||||
private Integer latestRechargePoints;
|
||||
|
||||
@TableField("remaining_points")
|
||||
@Schema(description = "剩余点数")
|
||||
private Integer remainingPoints;
|
||||
|
||||
@TableField("total_points")
|
||||
@Schema(description = "累计点数")
|
||||
private Integer totalPoints;
|
||||
|
||||
@TableField("create_time")
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField("update_time")
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
9
src/main/java/com/rj/mapper/LbBuyAccountMapper.java
Normal file
9
src/main/java/com/rj/mapper/LbBuyAccountMapper.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.rj.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.rj.entity.LbBuyAccount;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface LbBuyAccountMapper extends BaseMapper<LbBuyAccount> {
|
||||
}
|
||||
@@ -34,6 +34,9 @@ public class HxrAdminBuyService {
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
|
||||
+ "(KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Edg/148.0.0.0";
|
||||
|
||||
/** 与 hxrd 前端 DevTools 一致,使用 {@code Token} 而非小写 {@code token}。 */
|
||||
private static final String HEADER_TOKEN = "Token";
|
||||
|
||||
private static final ObjectMapper JSON = new ObjectMapper()
|
||||
.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
|
||||
|
||||
@@ -101,16 +104,21 @@ public class HxrAdminBuyService {
|
||||
.followRedirects(HttpClient.Redirect.NORMAL)
|
||||
.build();
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("hxr /api/order/buy request id={} sellerId={} tokenPrefix={} body={} signPayload=id={}&noncestr={}&seller_id={}×tamp={}",
|
||||
goodsId, sellerId, abbreviate(resolvedToken, 8), bodyJson, goodsId, noncestr, sellerId, timestamp);
|
||||
}
|
||||
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.uri(URI.create(buyApiUrl.trim()))
|
||||
.timeout(Duration.ofSeconds(120))
|
||||
.header("Accept", "application/json,*/*")
|
||||
.header("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8")
|
||||
.header("Content-Type", "application/json;charset=UTF-8")
|
||||
.header("Content-Type", "application/json")
|
||||
.header("Origin", ctx.origin())
|
||||
.header("Referer", ctx.referer())
|
||||
.header("User-Agent", USER_AGENT)
|
||||
.header("token", resolvedToken)
|
||||
.header(HEADER_TOKEN, resolvedToken)
|
||||
.header("S", sign)
|
||||
.header("T", String.valueOf(timestamp))
|
||||
.header("N", noncestr)
|
||||
@@ -134,8 +142,12 @@ public class HxrAdminBuyService {
|
||||
int code = root.path("code").asInt(-1);
|
||||
String msg = root.path("msg").asText("");
|
||||
if (code != 0) {
|
||||
log.warn("hxr /api/order/buy api code={} msg={} id={} sellerId={}",
|
||||
code, msg, goodsId, sellerId);
|
||||
log.warn("hxr /api/order/buy api code={} msg={} id={} sellerId={} tokenPrefix={} body={}",
|
||||
code, msg, goodsId, sellerId, abbreviate(resolvedToken, 8), abbreviate(bodyText, 200));
|
||||
if (code == 500 && "网络请求失败".equals(msg)) {
|
||||
log.warn("hxr /api/order/buy 鉴权失败常见原因:Token 与浏览器不一致或已过期、goodsApiAppStr 错误;"
|
||||
+ "请在 rush-buy 请求体传入浏览器 DevTools 中 Token 头的值,并核对 lb_third_integration_config.goods_api_token / goods_api_app_str");
|
||||
}
|
||||
}
|
||||
return new BuyApiResult(code == 0, code, msg);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ public class HxrAdminGoodsService {
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
|
||||
+ "(KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Edg/148.0.0.0";
|
||||
|
||||
private static final String HEADER_TOKEN = "Token";
|
||||
|
||||
private static final ObjectMapper JSON = new ObjectMapper()
|
||||
.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE)
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||
@@ -132,7 +134,7 @@ public class HxrAdminGoodsService {
|
||||
.header("Origin", ctx.origin())
|
||||
.header("Referer", ctx.referer())
|
||||
.header("User-Agent", USER_AGENT)
|
||||
.header("token", resolvedToken)
|
||||
.header(HEADER_TOKEN, resolvedToken)
|
||||
.header("S", sign)
|
||||
.header("T", String.valueOf(timestamp))
|
||||
.header("N", noncestr)
|
||||
|
||||
@@ -155,7 +155,7 @@ public class HxrAdminOrderSelectService {
|
||||
}
|
||||
String refererHeader = referer;
|
||||
if (refererHeader == null || refererHeader.isBlank()) {
|
||||
refererHeader = "https://hxrdhoutai.hxrdsm.cn222/app/admin/order/index";
|
||||
refererHeader = "https://22222/app/admin/order/index";
|
||||
}
|
||||
|
||||
HttpClient client = HttpClient.newBuilder()
|
||||
|
||||
@@ -117,7 +117,7 @@ public class HxrAdminUserService {
|
||||
stripQuery(properties.getUserSelectUrl()),
|
||||
USER_SELECT_PAGE_SIZE,
|
||||
cookieHeader,
|
||||
"https://hxrdhoutai.hxrdsm.cn222/app/admin/user/index");
|
||||
"https://22222/app/admin/user/index");
|
||||
return fetchUserSelectPage(page, ctx);
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ public class HxrAdminUserService {
|
||||
.header("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6")
|
||||
.header("Cookie", cookieHeader)
|
||||
.header("Priority", "u=1, i")
|
||||
.header("Referer", "https://hxrdhoutai.hxrdsm.cn222/app/admin/user/index")
|
||||
.header("Referer", "https://22222/app/admin/user/index")
|
||||
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Edg/148.0.0.0")
|
||||
.GET()
|
||||
.build();
|
||||
@@ -294,7 +294,7 @@ public class HxrAdminUserService {
|
||||
.header("Accept", "application/json, text/javascript, */*; q=0.01")
|
||||
.header("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
|
||||
.header("Cookie", cookieHeader)
|
||||
.header("Referer", "https://hxrdhoutai.hxrdsm.cn222/app/admin/user/index")
|
||||
.header("Referer", "https://22222/app/admin/user/index")
|
||||
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Edg/148.0.0.0")
|
||||
.POST(HttpRequest.BodyPublishers.ofString(form, StandardCharsets.UTF_8))
|
||||
.build();
|
||||
|
||||
26
src/main/java/com/rj/service/ILbBuyAccountService.java
Normal file
26
src/main/java/com/rj/service/ILbBuyAccountService.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.rj.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.rj.entity.LbBuyAccount;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface ILbBuyAccountService extends IService<LbBuyAccount> {
|
||||
|
||||
Map<String, Object> add(LbBuyAccount entity);
|
||||
|
||||
Map<String, Object> update(LbBuyAccount entity);
|
||||
|
||||
Map<String, Object> deleteById(String id);
|
||||
|
||||
Map<String, Object> pageQuery(Integer current,
|
||||
Integer size,
|
||||
String tenantId,
|
||||
String tenantName,
|
||||
String loginAccount,
|
||||
String nickname,
|
||||
String referrerPhone,
|
||||
String referrerName,
|
||||
String createTimeStart,
|
||||
String createTimeEnd);
|
||||
}
|
||||
268
src/main/java/com/rj/service/impl/LbBuyAccountServiceImpl.java
Normal file
268
src/main/java/com/rj/service/impl/LbBuyAccountServiceImpl.java
Normal file
@@ -0,0 +1,268 @@
|
||||
package com.rj.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.rj.entity.LbBuyAccount;
|
||||
import com.rj.mapper.LbBuyAccountMapper;
|
||||
import com.rj.service.ILbBuyAccountService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class LbBuyAccountServiceImpl
|
||||
extends ServiceImpl<LbBuyAccountMapper, LbBuyAccount>
|
||||
implements ILbBuyAccountService {
|
||||
|
||||
private static final DateTimeFormatter DATE_TIME_FORMATTER =
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Override
|
||||
public Map<String, Object> add(LbBuyAccount entity) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
Map<String, Object> validation = validateRequiredForAdd(entity);
|
||||
if (validation != null) {
|
||||
return validation;
|
||||
}
|
||||
trimStringFields(entity);
|
||||
defaultIntegerFields(entity);
|
||||
|
||||
if (entity.getId() == null || entity.getId().trim().isEmpty()) {
|
||||
entity.setId(UUID.randomUUID().toString());
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (entity.getCreateTime() == null) {
|
||||
entity.setCreateTime(now);
|
||||
}
|
||||
entity.setUpdateTime(now);
|
||||
|
||||
boolean ok = this.save(entity);
|
||||
result.put("success", ok);
|
||||
result.put("message", ok ? "新增成功" : "新增失败");
|
||||
if (ok) {
|
||||
result.put("data", entity);
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("抢单账号配置新增异常", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "新增异常:" + e.getMessage());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> update(LbBuyAccount entity) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
if (entity.getId() == null || entity.getId().trim().isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "id不能为空");
|
||||
return result;
|
||||
}
|
||||
trimStringFields(entity);
|
||||
entity.setUpdateTime(LocalDateTime.now());
|
||||
boolean ok = this.updateById(entity);
|
||||
result.put("success", ok);
|
||||
result.put("message", ok ? "编辑成功" : "编辑失败");
|
||||
if (ok) {
|
||||
result.put("data", this.getById(entity.getId()));
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("抢单账号配置编辑异常", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "编辑异常:" + e.getMessage());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> deleteById(String id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
if (id == null || id.trim().isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "id不能为空");
|
||||
return result;
|
||||
}
|
||||
boolean ok = this.removeById(id.trim());
|
||||
result.put("success", ok);
|
||||
result.put("message", ok ? "删除成功" : "删除失败");
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("抢单账号配置删除异常", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "删除异常:" + e.getMessage());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> pageQuery(Integer current,
|
||||
Integer size,
|
||||
String tenantId,
|
||||
String tenantName,
|
||||
String loginAccount,
|
||||
String nickname,
|
||||
String referrerPhone,
|
||||
String referrerName,
|
||||
String createTimeStart,
|
||||
String createTimeEnd) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
if (current == null || current < 1) {
|
||||
current = 1;
|
||||
}
|
||||
if (size == null || size < 1) {
|
||||
size = 10;
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<LbBuyAccount> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (tenantId != null && !tenantId.trim().isEmpty()) {
|
||||
queryWrapper.eq(LbBuyAccount::getTenantId, tenantId.trim());
|
||||
}
|
||||
if (tenantName != null && !tenantName.trim().isEmpty()) {
|
||||
queryWrapper.like(LbBuyAccount::getTenantName, tenantName.trim());
|
||||
}
|
||||
if (loginAccount != null && !loginAccount.trim().isEmpty()) {
|
||||
queryWrapper.like(LbBuyAccount::getLoginAccount, loginAccount.trim());
|
||||
}
|
||||
if (nickname != null && !nickname.trim().isEmpty()) {
|
||||
queryWrapper.like(LbBuyAccount::getNickname, nickname.trim());
|
||||
}
|
||||
if (referrerPhone != null && !referrerPhone.trim().isEmpty()) {
|
||||
queryWrapper.like(LbBuyAccount::getReferrerPhone, referrerPhone.trim());
|
||||
}
|
||||
if (referrerName != null && !referrerName.trim().isEmpty()) {
|
||||
queryWrapper.like(LbBuyAccount::getReferrerName, referrerName.trim());
|
||||
}
|
||||
|
||||
LocalDateTime start = parseDateTime(createTimeStart);
|
||||
if (createTimeStart != null && !createTimeStart.trim().isEmpty() && start == null) {
|
||||
result.put("success", false);
|
||||
result.put("message", "createTimeStart 格式错误,请使用 yyyy-MM-dd HH:mm:ss");
|
||||
return result;
|
||||
}
|
||||
LocalDateTime end = parseDateTime(createTimeEnd);
|
||||
if (createTimeEnd != null && !createTimeEnd.trim().isEmpty() && end == null) {
|
||||
result.put("success", false);
|
||||
result.put("message", "createTimeEnd 格式错误,请使用 yyyy-MM-dd HH:mm:ss");
|
||||
return result;
|
||||
}
|
||||
if (start != null) {
|
||||
queryWrapper.ge(LbBuyAccount::getCreateTime, start);
|
||||
}
|
||||
if (end != null) {
|
||||
queryWrapper.le(LbBuyAccount::getCreateTime, end);
|
||||
}
|
||||
|
||||
queryWrapper.orderByDesc(LbBuyAccount::getUpdateTime)
|
||||
.orderByDesc(LbBuyAccount::getCreateTime);
|
||||
|
||||
Page<LbBuyAccount> page = this.page(new Page<>(current, size), queryWrapper);
|
||||
result.put("success", true);
|
||||
result.put("message", "查询成功");
|
||||
result.put("data", page.getRecords());
|
||||
result.put("total", page.getTotal());
|
||||
result.put("current", page.getCurrent());
|
||||
result.put("size", page.getSize());
|
||||
result.put("pages", page.getPages());
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("抢单账号配置查询异常", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "查询异常:" + e.getMessage());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> validateRequiredForAdd(LbBuyAccount entity) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
if (entity.getTenantId() == null || entity.getTenantId().trim().isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "tenantId不能为空");
|
||||
return result;
|
||||
}
|
||||
if (entity.getTenantName() == null || entity.getTenantName().trim().isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "tenantName不能为空");
|
||||
return result;
|
||||
}
|
||||
if (entity.getLoginAccount() == null || entity.getLoginAccount().trim().isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "loginAccount不能为空");
|
||||
return result;
|
||||
}
|
||||
if (entity.getLoginPassword() == null || entity.getLoginPassword().trim().isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "loginPassword不能为空");
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void trimStringFields(LbBuyAccount entity) {
|
||||
if (entity.getTenantId() != null) {
|
||||
entity.setTenantId(entity.getTenantId().trim());
|
||||
}
|
||||
if (entity.getTenantName() != null) {
|
||||
entity.setTenantName(entity.getTenantName().trim());
|
||||
}
|
||||
if (entity.getLoginAccount() != null) {
|
||||
entity.setLoginAccount(entity.getLoginAccount().trim());
|
||||
}
|
||||
if (entity.getLoginPassword() != null) {
|
||||
entity.setLoginPassword(entity.getLoginPassword().trim());
|
||||
}
|
||||
if (entity.getNickname() != null) {
|
||||
entity.setNickname(entity.getNickname().trim());
|
||||
}
|
||||
if (entity.getReferrerPhone() != null) {
|
||||
entity.setReferrerPhone(entity.getReferrerPhone().trim());
|
||||
}
|
||||
if (entity.getReferrerName() != null) {
|
||||
entity.setReferrerName(entity.getReferrerName().trim());
|
||||
}
|
||||
if (entity.getLoginUrl() != null) {
|
||||
entity.setLoginUrl(entity.getLoginUrl().trim());
|
||||
}
|
||||
}
|
||||
|
||||
private static void defaultIntegerFields(LbBuyAccount entity) {
|
||||
if (entity.getMaxGrabAmount() == null) {
|
||||
entity.setMaxGrabAmount(0);
|
||||
}
|
||||
if (entity.getMaxGrabCount() == null) {
|
||||
entity.setMaxGrabCount(0);
|
||||
}
|
||||
if (entity.getLatestRechargePoints() == null) {
|
||||
entity.setLatestRechargePoints(0);
|
||||
}
|
||||
if (entity.getRemainingPoints() == null) {
|
||||
entity.setRemainingPoints(0);
|
||||
}
|
||||
if (entity.getTotalPoints() == null) {
|
||||
entity.setTotalPoints(0);
|
||||
}
|
||||
}
|
||||
|
||||
private static LocalDateTime parseDateTime(String text) {
|
||||
if (text == null || text.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return LocalDateTime.parse(text.trim(), DATE_TIME_FORMATTER);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -445,7 +445,7 @@ public class LbGoodsServiceImpl extends ServiceImpl<LbGoodsMapper, LbGoods> impl
|
||||
return result;
|
||||
}
|
||||
|
||||
int maxAttempts = maxBuyCount * 10;
|
||||
int maxAttempts = maxBuyCount * 2;
|
||||
List<Map<String, Object>> details = new ArrayList<>();
|
||||
int successCount = 0;
|
||||
int failCount = 0;
|
||||
|
||||
@@ -24,6 +24,7 @@ hxr:
|
||||
phpsid: "f3710baf6381da418aa832660ccb9d08"
|
||||
# 货品同步 /api/order/goods(LbGoodsController#sync-from-hxr)
|
||||
goods-api-token: "75d9a643-ea07-4f0a-afff-2f8bbcd3f3f2"
|
||||
# 来自文件: https://hxrdweb.hxrdsm.cn/static/configs.js
|
||||
goods-api-app-str: "ssniQQ3UP2Vr8mXwaugssgaOLzQo0cX5"
|
||||
goods-api-origin: "https://hxrdweb.hxrdsm.cn"
|
||||
goods-api-referer: "https://hxrdweb.hxrdsm.cn/"
|
||||
|
||||
@@ -8,7 +8,7 @@ CREATE TABLE `lb_third_integration_config` (
|
||||
`provider_code` VARCHAR(32) NOT NULL DEFAULT 'HXR_ADMIN' COMMENT '集成类型:HXR_ADMIN 等',
|
||||
`enabled` TINYINT NOT NULL DEFAULT 1 COMMENT '总开关:1启用 0禁用',
|
||||
|
||||
`admin_base_url` VARCHAR(256) NOT NULL COMMENT '后台管理域名,如 https://hxrdhoutai.hxrdsm.cn222',
|
||||
`admin_base_url` VARCHAR(256) NOT NULL COMMENT '后台管理域名,如 https://22222',
|
||||
`web_base_url` VARCHAR(256) NOT NULL COMMENT '前端 Web 域名,如 https://hxrdweb.hxrdsm.cn',
|
||||
|
||||
`order_select_path` VARCHAR(128) NOT NULL DEFAULT '/app/admin/order/select' COMMENT '订单列表 API 路径',
|
||||
|
||||
Reference in New Issue
Block a user