TASK:获取用户id信息做分页;订阅计划添加国家或地区字段
This commit is contained in:
@@ -179,8 +179,9 @@ public class ConvenientInquiryController {
|
||||
|
||||
@Operation(summary = "获取所有用户id")
|
||||
@GetMapping("/getAllUserId")
|
||||
public Response<List<Map<String, Object>>> getAllUsrIdList() {
|
||||
return Response.success(convenientInquiryService.getAllUserIdList());
|
||||
public Response<IPage<Map<String, Object>>> getAllUserIdList(@Parameter(description = "page") @RequestParam Integer page,
|
||||
@Parameter(description = "size") @RequestParam Integer size) {
|
||||
return Response.success(convenientInquiryService.getAllUserIdList(page, size));
|
||||
}
|
||||
|
||||
@Operation(summary = "获取所有交易信息")
|
||||
|
||||
@@ -67,6 +67,11 @@ public class SubscriptionPlan extends BaseEntity{
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 国家或地区
|
||||
*/
|
||||
private String CountryOrRegion;
|
||||
|
||||
// 在类内部定义的枚举
|
||||
@Getter
|
||||
public enum SubscriptionStatus {
|
||||
|
||||
@@ -48,4 +48,7 @@ public class SubscriptionPlanDTO {
|
||||
@Schema(description = "订阅计划状态")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "国家或地区")
|
||||
private String CountryOrRegion;
|
||||
|
||||
}
|
||||
|
||||
@@ -12,9 +12,12 @@ public class SubscriptionPlanPageQuery extends QueryPageByTimeDTO {
|
||||
@Schema(description = "组织id")
|
||||
private Long organizationId;
|
||||
|
||||
@Schema(description = "管理id")
|
||||
@Schema(description = "管理员id")
|
||||
private Long adminAccId;
|
||||
|
||||
@Schema(description = "状态 PENDING||ACTIVE||EXPIRED")
|
||||
private List<String> status;
|
||||
|
||||
@Schema(description = "国家或地区")
|
||||
private String countryOrRegion;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public interface ConvenientInquiryService extends IService<Questionnaire> {
|
||||
|
||||
IPage<Account> getUserInfo(QueryUserConditionsVO queryUserConditionsVO);
|
||||
|
||||
List<Map<String, Object>> getAllUserIdList();
|
||||
IPage<Map<String, Object>> getAllUserIdList(Integer pageNum, Integer pageSize);
|
||||
|
||||
PageBaseResponse<PaymentInfoVO> queryTransactionRecords(QueryPaymentInfoDTO queryPaymentInfoDTO);
|
||||
|
||||
|
||||
@@ -798,27 +798,42 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
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();
|
||||
Account account = accountMapper.selectById(accountId);
|
||||
// 允许查看数据的用户id
|
||||
if (Objects.nonNull(account.getSystemUser())
|
||||
&& (account.getSystemUser().equals(5)
|
||||
|| account.getSystemUser().equals(7)
|
||||
|| 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 {
|
||||
|
||||
// 权限校验
|
||||
if (Objects.isNull(account.getSystemUser())
|
||||
|| (!account.getSystemUser().equals(5)
|
||||
&& !account.getSystemUser().equals(7)
|
||||
&& !ADMIN_IDS.contains(account.getId())
|
||||
&& !ADMIN_IDS_READ_ONLY.contains(account.getId()))) {
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -78,7 +78,7 @@ public class SubscriptionPlanServiceImpl extends ServiceImpl<SubscriptionPlanMap
|
||||
}
|
||||
|
||||
baseMapper.insert(subscriptionPlan);
|
||||
if (subscriptionPlanDTO.getStatus().equals(SubscriptionPlan.SubscriptionStatus.ACTIVE.name())) {
|
||||
if (subscriptionPlan.getStatus().equals(SubscriptionPlan.SubscriptionStatus.ACTIVE.name())) {
|
||||
// 执行一次激活扫描器
|
||||
activeSubscriptionPlan();
|
||||
}
|
||||
@@ -167,6 +167,12 @@ public class SubscriptionPlanServiceImpl extends ServiceImpl<SubscriptionPlanMap
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -221,6 +227,9 @@ public class SubscriptionPlanServiceImpl extends ServiceImpl<SubscriptionPlanMap
|
||||
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)
|
||||
.orderByDesc("sp.create_time");
|
||||
|
||||
Reference in New Issue
Block a user