diff --git a/src/main/java/com/ai/da/model/dto/AffiliateQueryDTO.java b/src/main/java/com/ai/da/model/dto/AffiliateQueryDTO.java index da414a82..a8fa750a 100644 --- a/src/main/java/com/ai/da/model/dto/AffiliateQueryDTO.java +++ b/src/main/java/com/ai/da/model/dto/AffiliateQueryDTO.java @@ -18,10 +18,9 @@ public class AffiliateQueryDTO extends TimeQueryBaseDTO{ @ApiModelProperty("推广者id") private Long affiliateId; - @NotBlank(message = "orderBy cannot be empty") - @Pattern(regexp = "id|createTime|totalIncome", message = "允许排序字段只有id|createTime|totalIncome") + @Pattern(regexp = "id|createTime|totalIncome|", message = "允许排序字段只有id|createTime|totalIncome") @ApiModelProperty("目前允许按id, createTime, totalIncome进行排序") - private String orderBy; + private String orderBy = "id"; @ApiModelProperty("按时间 DESC 降序 || ASC 升序") private String order = "ASC"; diff --git a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java index 662557e3..7275b9ca 100644 --- a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java @@ -2227,12 +2227,12 @@ public class AccountServiceImpl extends ServiceImpl impl subAccount.setSystemUser(subUserRole); subAccount.setOrganizationName(adminAcc.getOrganizationName()); subAccount.setParentId(adminAcc.getId()); - if (Objects.nonNull(subAccount.getCreditsUsageLimit())){ - if (remainingCredits.compareTo(subAccount.getCreditsUsageLimit()) < 0) { + if (Objects.nonNull(addSubAccountDTO.getCreditsUsageLimit())){ + if (remainingCredits.compareTo(addSubAccountDTO.getCreditsUsageLimit()) < 0) { throw new BusinessException("Insufficient credits (Balance: " + remainingCredits + ").", ResultEnum.PROMPT.getCode()); } - subAccount.setCreditsUsageLimit(subAccount.getCreditsUsageLimit()); - subAccount.setCreditsUsage(subAccount.getCreditsUsageLimit()); + subAccount.setCreditsUsageLimit(addSubAccountDTO.getCreditsUsageLimit()); + subAccount.setCreditsUsage(addSubAccountDTO.getCreditsUsage()); if (Objects.nonNull(subAccount.getCredits())) { subAccount.setCredits(subAccount.getCreditsUsageLimit().add(subAccount.getCredits())); }else { diff --git a/src/main/java/com/ai/da/service/impl/AffiliateServiceImpl.java b/src/main/java/com/ai/da/service/impl/AffiliateServiceImpl.java index 2fcc14e4..c4066afd 100644 --- a/src/main/java/com/ai/da/service/impl/AffiliateServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/AffiliateServiceImpl.java @@ -91,7 +91,7 @@ public class AffiliateServiceImpl extends ServiceImpl {}", affiliateQueryDTO.toString()); int offset = (affiliateQueryDTO.getPage() - 1) * affiliateQueryDTO.getSize(); - String orderBy = affiliateQueryDTO.getOrderBy() == null ? "create_time" : + String orderBy = affiliateQueryDTO.getOrderBy() == null ? "id" : affiliateQueryDTO.getOrderBy().equals("id") ? "id" : affiliateQueryDTO.getOrderBy().equals("totalIncome") ? "total_earnings" : "create_time";