|
|
@@ -4,6 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
|
|
|
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
|
|
import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
|
|
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
|
|
+import com.izouma.nineth.TokenHistory;
|
|
|
import com.izouma.nineth.config.Constants;
|
|
|
import com.izouma.nineth.domain.Follow;
|
|
|
import com.izouma.nineth.domain.IdentityAuth;
|
|
|
@@ -30,6 +31,7 @@ import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
import me.chanjar.weixin.mp.api.WxMpService;
|
|
|
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
|
|
|
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
@@ -43,6 +45,7 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.regex.Pattern;
|
|
|
@@ -70,6 +73,7 @@ public class UserService {
|
|
|
private NFTService nftService;
|
|
|
private CacheService cacheService;
|
|
|
private ApplicationContext context;
|
|
|
+ private TokenHistoryRepo tokenHistoryRepo;
|
|
|
|
|
|
public User update(User user) {
|
|
|
User orig = userRepo.findById(user.getId()).orElseThrow(new BusinessException("无记录"));
|
|
|
@@ -536,4 +540,28 @@ public class UserService {
|
|
|
map.put("success", success);
|
|
|
return map;
|
|
|
}
|
|
|
+
|
|
|
+ public Map<String, Object> invite(PageQuery pageQuery) {
|
|
|
+ Page<User> all = this.all(pageQuery);
|
|
|
+
|
|
|
+ List<Long> userIds = all.map(User::getId).getContent();
|
|
|
+ List<TokenHistory> page = tokenHistoryRepo.userBuy(userIds);
|
|
|
+ Map<Long, BigDecimal> buy = page.stream()
|
|
|
+ .collect(Collectors.groupingBy(TokenHistory::getToUserId,
|
|
|
+ Collectors.mapping(TokenHistory::getPrice,
|
|
|
+ Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
|
|
|
+
|
|
|
+ Page<InvitePhoneDTO> users = all.map(user -> {
|
|
|
+ InvitePhoneDTO dto = new InvitePhoneDTO(user);
|
|
|
+ dto.setTotal(buy.get(user.getId()) == null ? BigDecimal.ZERO : buy.get(user.getId()));
|
|
|
+ return dto;
|
|
|
+ });
|
|
|
+
|
|
|
+ BigDecimal total = buy.values().stream().reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("user", users);
|
|
|
+ map.put("total", total);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|