TASK:获取用户id信息做分页;订阅计划添加国家或地区字段

This commit is contained in:
2026-01-06 09:56:21 +08:00
parent 501032ef17
commit 3beb27e491
7 changed files with 58 additions and 22 deletions

View File

@@ -179,8 +179,9 @@ public class ConvenientInquiryController {
@Operation(summary = "获取所有用户id") @Operation(summary = "获取所有用户id")
@GetMapping("/getAllUserId") @GetMapping("/getAllUserId")
public Response<List<Map<String, Object>>> getAllUsrIdList() { public Response<IPage<Map<String, Object>>> getAllUserIdList(@Parameter(description = "page") @RequestParam Integer page,
return Response.success(convenientInquiryService.getAllUserIdList()); @Parameter(description = "size") @RequestParam Integer size) {
return Response.success(convenientInquiryService.getAllUserIdList(page, size));
} }
@Operation(summary = "获取所有交易信息") @Operation(summary = "获取所有交易信息")

View File

@@ -67,6 +67,11 @@ public class SubscriptionPlan extends BaseEntity{
*/ */
private String status; private String status;
/**
* 国家或地区
*/
private String CountryOrRegion;
// 在类内部定义的枚举 // 在类内部定义的枚举
@Getter @Getter
public enum SubscriptionStatus { public enum SubscriptionStatus {

View File

@@ -48,4 +48,7 @@ public class SubscriptionPlanDTO {
@Schema(description = "订阅计划状态") @Schema(description = "订阅计划状态")
private String status; private String status;
@Schema(description = "国家或地区")
private String CountryOrRegion;
} }

View File

@@ -12,9 +12,12 @@ public class SubscriptionPlanPageQuery extends QueryPageByTimeDTO {
@Schema(description = "组织id") @Schema(description = "组织id")
private Long organizationId; private Long organizationId;
@Schema(description = "管理id") @Schema(description = "管理id")
private Long adminAccId; private Long adminAccId;
@Schema(description = "状态 PENDING||ACTIVE||EXPIRED") @Schema(description = "状态 PENDING||ACTIVE||EXPIRED")
private List<String> status; private List<String> status;
@Schema(description = "国家或地区")
private String countryOrRegion;
} }

View File

@@ -51,7 +51,7 @@ public interface ConvenientInquiryService extends IService<Questionnaire> {
IPage<Account> getUserInfo(QueryUserConditionsVO queryUserConditionsVO); IPage<Account> getUserInfo(QueryUserConditionsVO queryUserConditionsVO);
List<Map<String, Object>> getAllUserIdList(); IPage<Map<String, Object>> getAllUserIdList(Integer pageNum, Integer pageSize);
PageBaseResponse<PaymentInfoVO> queryTransactionRecords(QueryPaymentInfoDTO queryPaymentInfoDTO); PageBaseResponse<PaymentInfoVO> queryTransactionRecords(QueryPaymentInfoDTO queryPaymentInfoDTO);

View File

@@ -798,27 +798,42 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
return accountMapper.selectPage(new Page<>(queryUserConditionsVO.getPage(), queryUserConditionsVO.getSize()), queryWrapper); return accountMapper.selectPage(new Page<>(queryUserConditionsVO.getPage(), queryUserConditionsVO.getSize()), queryWrapper);
} }
public List<Map<String, Object>> getAllUserIdList() { public IPage<Map<String, Object>> getAllUserIdList(Integer pageNum, Integer pageSize) {
Long accountId = UserContext.getUserHolder().getId(); Long accountId = UserContext.getUserHolder().getId();
Account account = accountMapper.selectById(accountId); Account account = accountMapper.selectById(accountId);
// 允许查看数据的用户id
if (Objects.nonNull(account.getSystemUser()) // 权限校验
&& (account.getSystemUser().equals(5) if (Objects.isNull(account.getSystemUser())
|| account.getSystemUser().equals(7) || (!account.getSystemUser().equals(5)
|| ADMIN_IDS.contains(account.getId()) && !account.getSystemUser().equals(7)
|| ADMIN_IDS_READ_ONLY.contains(account.getId()) && !ADMIN_IDS.contains(account.getId())
)) { && !ADMIN_IDS_READ_ONLY.contains(account.getId()))) {
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
queryWrapper.select("id as value, user_name as label");
if ((account.getSystemUser().equals(7) || account.getSystemUser().equals(5))
&& !StringUtil.isNullOrEmpty(account.getOrganizationName())) {
queryWrapper.lambda().eq(Account::getOrganizationName, account.getOrganizationName());
}
return accountMapper.selectMaps(queryWrapper);
} else {
throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode()); throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode());
} }
// return maps.stream().map(map -> (Long)map.get("id")).collect(Collectors.toList());
// 创建分页对象
Page<Account> page = new Page<>(pageNum, pageSize);
// 构建查询条件
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
queryWrapper.select("id", "user_name", "user_email");
if ((account.getSystemUser().equals(7) || account.getSystemUser().equals(5))
&& !StringUtil.isNullOrEmpty(account.getOrganizationName())) {
queryWrapper.lambda().eq(Account::getOrganizationName, account.getOrganizationName());
}
// 执行分页查询
IPage<Account> accountPage = accountMapper.selectPage(page, queryWrapper);
// 转换为 IPage<Map> 并重命名字段
return accountPage.convert(acc -> {
Map<String, Object> map = new HashMap<>();
map.put("value", acc.getId());
map.put("label", acc.getUserName());
map.put("email", acc.getUserEmail());
return map;
});
} }
/** /**

View File

@@ -78,7 +78,7 @@ public class SubscriptionPlanServiceImpl extends ServiceImpl<SubscriptionPlanMap
} }
baseMapper.insert(subscriptionPlan); baseMapper.insert(subscriptionPlan);
if (subscriptionPlanDTO.getStatus().equals(SubscriptionPlan.SubscriptionStatus.ACTIVE.name())) { if (subscriptionPlan.getStatus().equals(SubscriptionPlan.SubscriptionStatus.ACTIVE.name())) {
// 执行一次激活扫描器 // 执行一次激活扫描器
activeSubscriptionPlan(); activeSubscriptionPlan();
} }
@@ -167,6 +167,12 @@ public class SubscriptionPlanServiceImpl extends ServiceImpl<SubscriptionPlanMap
queryWrapper.lambda().in(SubscriptionPlan::getStatus, subscriptionPlanPageQuery.getStatus()); queryWrapper.lambda().in(SubscriptionPlan::getStatus, subscriptionPlanPageQuery.getStatus());
} }
if (StringUtils.isNotBlank(subscriptionPlanPageQuery.getCountryOrRegion())){
queryWrapper.lambda().like(SubscriptionPlan::getCountryOrRegion, subscriptionPlanPageQuery.getCountryOrRegion());
}
queryWrapper.lambda().orderByAsc(SubscriptionPlan::getCurrentPeriodStart);
return baseMapper.selectList(queryWrapper); return baseMapper.selectList(queryWrapper);
} }
@@ -221,6 +227,9 @@ public class SubscriptionPlanServiceImpl extends ServiceImpl<SubscriptionPlanMap
wrapper.in("sp.status", query.getStatus()); wrapper.in("sp.status", query.getStatus());
} }
if (StringUtils.isNotBlank(query.getCountryOrRegion())) {
wrapper.like("sp.country_or_region", query.getCountryOrRegion());
}
// 按创建时间倒序排序 // 按创建时间倒序排序
wrapper.ne("sp.is_deleted", 1) wrapper.ne("sp.is_deleted", 1)
.orderByDesc("sp.create_time"); .orderByDesc("sp.create_time");