goods同步

This commit is contained in:
2026-05-30 08:26:47 +08:00
parent 246c5a7080
commit dbf408c51f
20 changed files with 1233 additions and 32 deletions

View File

@@ -136,8 +136,9 @@ public class LbGoodsController {
@Operation(
summary = "抢购货品",
description =
"从 lb_goods 按 total_money 从大到小选取货品,调用 hxrd POST /api/order/buybody: id、seller_id"
+ "成功笔数达到 maxBuyCount 后停止token 可选,未传时使用 hxr.admin.goods-api-token")
"从 lb_goods 按 total_money 从大到小选取金额小于39000的货品,调用 hxrd POST /api/order/buybody: id、seller_id"
+ "成功笔数达到 maxBuyCount 后停止,且循环抢购总次数不超过 maxBuyCount 的5倍"
+ "token 可选,未传时使用 hxr.admin.goods-api-token")
public ResponseEntity<Map<String, Object>> rushBuy(
@Parameter(description = "maxBuyCount 必填token 可选", required = true)
@RequestBody LbGoodsRushBuyRequest request) {

View File

@@ -24,7 +24,9 @@ public class LbOrderRowController {
@PostMapping("/add")
@Operation(summary = "新增")
public ResponseEntity<Map<String, Object>> add(
@Parameter(description = "实体(id 为订单 id需调用方指定", required = true) @RequestBody LbOrderRow entity) {
@Parameter(description = "实体(复合主键 tenantId + id需调用方指定", required = true)
@RequestBody
LbOrderRow entity) {
Map<String, Object> result = lbOrderRowService.add(entity);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
@@ -36,7 +38,7 @@ public class LbOrderRowController {
@PutMapping("/update")
@Operation(summary = "编辑")
public ResponseEntity<Map<String, Object>> update(
@Parameter(description = "实体", required = true) @RequestBody LbOrderRow entity) {
@Parameter(description = "实体(须含 tenantId 与 id", required = true) @RequestBody LbOrderRow entity) {
Map<String, Object> result = lbOrderRowService.update(entity);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
@@ -48,8 +50,11 @@ public class LbOrderRowController {
@DeleteMapping("/delete/{id}")
@Operation(summary = "删除")
public ResponseEntity<Map<String, Object>> delete(
@Parameter(description = "主键(订单 id", required = true) @PathVariable Long id) {
Map<String, Object> result = lbOrderRowService.deleteById(id);
@Parameter(description = "订单 id(复合主键之一", required = true) @PathVariable Long id,
@Parameter(description = "租户 id复合主键之一未传时使用 X-Tenant-Id / Token 租户)")
@RequestParam(required = false)
String tenantId) {
Map<String, Object> result = lbOrderRowService.deleteById(id, tenantId);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
return ResponseEntity.ok(result);
@@ -92,7 +97,7 @@ public class LbOrderRowController {
@PostMapping("/sync-order-from-third")
@Operation(
summary = "从 外部系统 同步订单",
description = "按购买时间区间、租户 id、转卖状态调用后台 order/select将结果写入 lb_order_row按订单 id upsert")
description = "按购买时间区间、租户 id、转卖状态调用后台 order/select将结果写入 lb_order_row tenant_id + 订单 id upsert")
public ResponseEntity<Map<String, Object>> syncFromHxr(
@Parameter(description = "同步条件", required = true) @RequestBody LbOrderRowSyncFromHxrRequest request) {
Map<String, Object> result =

View File

@@ -0,0 +1,138 @@
package com.rj.controller;
import com.rj.dto.LbThirdIntegrationCredentialUpdateRequest;
import com.rj.entity.LbThirdIntegrationConfig;
import com.rj.service.ILbThirdIntegrationConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 租户第三方集成配置控制器
*/
@Slf4j
@RestController
@RequestMapping("/api/lbThirdIntegrationConfig")
@Tag(name = "租户第三方集成配置", description = "lb_third_integration_config 增删改查与分页")
public class LbThirdIntegrationConfigController {
@Autowired
private ILbThirdIntegrationConfigService lbThirdIntegrationConfigService;
@PostMapping("/add")
@Operation(summary = "新增")
public ResponseEntity<Map<String, Object>> add(
@Parameter(description = "配置实体(凭证请传 *Plain 明文字段)", required = true)
@RequestBody LbThirdIntegrationConfig entity) {
Map<String, Object> result = lbThirdIntegrationConfigService.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 = "配置实体(仅传需修改字段;凭证 *Plain 非空时才轮换)", required = true)
@RequestBody LbThirdIntegrationConfig entity) {
Map<String, Object> result = lbThirdIntegrationConfigService.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", required = true) @PathVariable String id) {
Map<String, Object> result = lbThirdIntegrationConfigService.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 providerCode,
@RequestParam(required = false) Integer enabled) {
Map<String, Object> result = lbThirdIntegrationConfigService.pageQuery(
current, size, tenantId, providerCode, enabled);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
return ResponseEntity.ok(result);
}
return ResponseEntity.internalServerError().body(result);
}
@GetMapping("/get/{id}")
@Operation(summary = "按ID查询")
public ResponseEntity<Map<String, Object>> getById(
@Parameter(description = "主键ID", required = true) @PathVariable String id) {
Map<String, Object> result = lbThirdIntegrationConfigService.getDetailById(id);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
return ResponseEntity.ok(result);
}
if ("记录不存在".equals(result.get("message"))) {
return ResponseEntity.notFound().build();
}
return ResponseEntity.badRequest().body(result);
}
@GetMapping("/credential/{tenantId}")
@Operation(
summary = "查询租户凭证(含明文)",
description = "按 tenantId 解密返回 cookie、phpsid、goodsApiToken、goodsApiAppStr 明文,便于管理查看")
public ResponseEntity<Map<String, Object>> getCredentialStatus(
@Parameter(description = "租户 id", required = true) @PathVariable String tenantId) {
Map<String, Object> result = lbThirdIntegrationConfigService.getCredentialStatusByTenantId(tenantId);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
return ResponseEntity.ok(result);
}
if ("该租户未配置第三方集成".equals(result.get("message"))) {
return ResponseEntity.notFound().build();
}
return ResponseEntity.badRequest().body(result);
}
@PostMapping("/credential/{tenantId}")
@Operation(
summary = "更新租户凭证",
description =
"仅更新 cookie/phpsid/goodsApiToken/goodsApiAppStr 凭证列;"
+ "传明文则加密入库并 credential_version+1"
+ "传 clear* 为 true 则清除对应密文;至少操作一项")
public ResponseEntity<Map<String, Object>> updateCredential(
@Parameter(description = "租户 id", required = true) @PathVariable String tenantId,
@Parameter(description = "凭证更新请求", required = true)
@RequestBody
LbThirdIntegrationCredentialUpdateRequest request) {
Map<String, Object> result =
lbThirdIntegrationConfigService.updateCredentialByTenantId(tenantId, request);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
return ResponseEntity.ok(result);
}
if ("该租户未配置第三方集成,请先新增配置".equals(result.get("message"))) {
return ResponseEntity.notFound().build();
}
return ResponseEntity.badRequest().body(result);
}
}