修正查看特权
This commit is contained in:
@@ -8,6 +8,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
@@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@@ -26,6 +29,30 @@ public class LbPurchaseApplyController {
|
||||
@Autowired
|
||||
private ILbPurchaseApplyService lbPurchaseApplyService;
|
||||
|
||||
@Data
|
||||
@Schema(description = "按用户ID批量开通或关闭 hxrd 用户特权请求体")
|
||||
public static class UpdateHxrAdminUserVipRequest {
|
||||
@Schema(description = "租户ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "租户id不能为空")
|
||||
private String tenantId;
|
||||
|
||||
@Schema(description = "hxrd 后台用户 ID 列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "用户id列表不能为空")
|
||||
private List<Long> userIds;
|
||||
|
||||
@Schema(description = "是否会员:1 开通特权,0 关闭特权", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "isVip不能为空")
|
||||
private Integer isVip;
|
||||
|
||||
@Schema(description = "特权结束时间,格式 yyyy-MM-dd HH:mm:ss;开通时必填")
|
||||
private String vipTime;
|
||||
|
||||
@Schema(description = "最大订单数 max_order;传 0 时不向第三方提交该字段,保持原值",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "maxOrder不能为空")
|
||||
private Integer maxOrder;
|
||||
}
|
||||
|
||||
@Data
|
||||
@Schema(description = "大模型解析订货信息请求体")
|
||||
public static class ParseOrderInfoRequest {
|
||||
@@ -131,6 +158,24 @@ public class LbPurchaseApplyController {
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
|
||||
@PostMapping("/updateHxrAdminUserVipByUserIds")
|
||||
@Operation(summary = "按用户ID列表批量开通或关闭 hxrd 用户特权",
|
||||
description = "根据入参 userIds 逐条调用 POST /app/admin/user/update,"
|
||||
+ "不计算 viptime,直接使用请求体中的 vipTime、maxOrder、isVip(1 开通,0 关闭);"
|
||||
+ "maxOrder 为 0 时不传 max_order,不修改第三方该字段。"
|
||||
+ "需配置 hxr.admin.cookie 或 hxr.admin.phpsid。")
|
||||
public ResponseEntity<Map<String, Object>> updateHxrAdminUserVipByUserIds(
|
||||
@Parameter(description = "租户、用户列表及特权参数", required = true)
|
||||
@Valid @RequestBody UpdateHxrAdminUserVipRequest body) {
|
||||
Map<String, Object> result = lbPurchaseApplyService.updateHxrAdminUserVipByUserIds(
|
||||
body.getTenantId(), body.getUserIds(), body.getIsVip(), body.getVipTime(), body.getMaxOrder());
|
||||
Boolean success = (Boolean) result.get("success");
|
||||
if (success != null && success) {
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
|
||||
@GetMapping("/syncHxrAdminColleagueVip")
|
||||
@Operation(summary = "按申请日期与租户同步同事 hxrd 用户 VIP",
|
||||
description = "根据 lb_purchase_apply 的申请日期区间与 tenant_id 逐条处理,"
|
||||
|
||||
Reference in New Issue
Block a user