Commit aa2969e1 authored by jim's avatar jim

invite code

parent 3ad8d2b4
......@@ -393,23 +393,23 @@ public class AccountServiceImpl implements AccountService {
current.setQueryIpUrlList(queryIpUrlList);
current.setWhiteList(whiteList);
int invitedUsers = repository.countByPromotionCodeAndParentIsNull(account.getPromotion().getCode());
String code = account.getPromotion().getCode();
List<Account> promotes = repository.findByPromotionCode(code);
double totalCommission = 0;
totalCommission = 0;
for (Account promote : promotes) {
List<UserPrePaidBilling> userPrePaidBillings = prePaidBillingRepository.findByUsernameAndYearAndMonthAndPayMethodIn(promote.getName(),
YearMonth.now().getYear(),
YearMonth.now().getMonthValue(), Arrays.asList(1, 2, 3));
totalCommission += userPrePaidBillings.stream().mapToDouble(UserPrePaidBilling::getTotal).sum();
}
account.getPromotion().setCommission((int) totalCommission);
account.getPromotion().setInvitedUsers(invitedUsers);
if (account.getPromotion() != null) {
int invitedUsers = repository.countByPromotionCodeAndParentIsNull(account.getPromotion().getCode());
String code = account.getPromotion().getCode();
List<Account> promotes = repository.findByPromotionCode(code);
double totalCommission = 0;
totalCommission = 0;
for (Account promote : promotes) {
List<UserPrePaidBilling> userPrePaidBillings = prePaidBillingRepository.findByUsernameAndYearAndMonthAndPayMethodIn(promote.getName(),
YearMonth.now().getYear(),
YearMonth.now().getMonthValue(), Arrays.asList(1, 2, 3));
totalCommission += userPrePaidBillings.stream().mapToDouble(UserPrePaidBilling::getTotal).sum();
}
repository.save(account);
account.getPromotion().setCommission((int) totalCommission);
account.getPromotion().setInvitedUsers(invitedUsers);
repository.save(account);
}
resultDto.setStatus(0);
resultDto.setData(current);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment