| | |
| | | import com.ruoyi.account.util.weChat.WeChatUtil; |
| | | import com.ruoyi.account.vo.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Override |
| | | public R<LoginVo> mobileLogin(MobileLogin mobileLogin) { |
| | | //校验验证码 |
| | | //校验验证码 TODO 待完善 |
| | | // String code = redisService.getCacheObject(mobileLogin.getPhone()); |
| | | // if(null == code || !code.equals(mobileLogin.getCode())){ |
| | | // return R.fail("验证码错误"); |
| | |
| | | */ |
| | | @Override |
| | | public R<LoginVo> registerAccount(RegisterAccount registerAccount) { |
| | | // TODO 待完善 |
| | | //校验验证码 |
| | | // String code = redisService.getCacheObject(registerAccount.getPhone()); |
| | | // if(null == code || !code.equals(registerAccount.getCode())){ |
| | |
| | | AppUser appUser2 = this.getById(registerAccount.getPromoter()); |
| | | appUser.setInviteUserId(registerAccount.getPromoter()); |
| | | appUser.setShopId(appUser2.getShopId()); |
| | | appUser.setPartPoint(BigDecimal.ZERO); |
| | | appUser.setPartGrowPoint(BigDecimal.ZERO); |
| | | appUser.setShopPoint(BigDecimal.ZERO); |
| | | appUser.setSharePoint(BigDecimal.ZERO); |
| | | appUser.setPartPoint(0); |
| | | appUser.setPartGrowPoint(0); |
| | | appUser.setShopPoint(0); |
| | | appUser.setSharePoint(0); |
| | | appUser.setShopAmount(BigDecimal.ZERO); |
| | | appUser.setWithdrawableAmount(BigDecimal.ZERO); |
| | | appUser.setWithdrawnAmount(BigDecimal.ZERO); |
| | | appUser.setTotalRechargeAmount(BigDecimal.ZERO); |
| | | appUser.setTotalRedPacketAmount(BigDecimal.ZERO); |
| | | appUser.setTotalDistributionAmount(BigDecimal.ZERO); |
| | | appUser.setLavePoint(BigDecimal.ZERO); |
| | | appUser.setBalance(BigDecimal.ZERO); |
| | | appUser.setLavePoint(0); |
| | | //根据平台的配置未达标,则标注为可修改推广人 |
| | | appUser.setChangePromoter(0); |
| | | appUser.setLongitude(registerAccount.getLongitude()); |
| | | appUser.setLatitude(registerAccount.getLatitude()); |
| | | //调用地图获取省市区数据 |
| | | //调用地图获取省市区数据 TODO 待完善 |
| | | // appUser.setProvince(); |
| | | // appUser.setProvinceCode(); |
| | | // appUser.setCity(); |
| | |
| | | } |
| | | |
| | | public AppUser getTopAppUser(List<AppUser> list, Long id){ |
| | | AppUser appUser = list.stream().filter(s -> s.getInviteUserId().equals(id)).findFirst().get(); |
| | | AppUser appUser = list.stream().filter(s -> s.getId().equals(id)).findFirst().get(); |
| | | if(null == appUser.getInviteUserId()){ |
| | | return appUser; |
| | | } |
| | | return getTopAppUser(list, appUser.getId()); |
| | | return getTopAppUser(list, appUser.getInviteUserId()); |
| | | } |
| | | |
| | | |
| | |
| | | //使用地图获取省市区数据 |
| | | String longitude = nearbyReferrer.getLongitude(); |
| | | String latitude = nearbyReferrer.getLatitude(); |
| | | String cityCode = ""; |
| | | String cityCode = ""; // TODO 待完善 |
| | | List<NearbyReferrerVo> list = this.baseMapper.getNearbyReferrer(cityCode, nearbyReferrer); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<AppUser> getUserAncestorList(Long id, List<AppUser> list) { |
| | | if (list == null) { |
| | | list = new ArrayList<>(); |
| | | } |
| | | |
| | | Set<Long> visitedIds = new HashSet<>(); |
| | | Long currentId = id; |
| | | |
| | | while (currentId != null && !visitedIds.contains(currentId)) { |
| | | AppUser appUser = getById(currentId); |
| | | if (appUser == null) { |
| | | break; // 如果用户不存在,终止循环 |
| | | } |
| | | |
| | | Long inviteUserId = appUser.getInviteUserId(); |
| | | if (inviteUserId != null) { |
| | | AppUser invitedUser = getById(inviteUserId); |
| | | if (invitedUser != null) { |
| | | list.add(invitedUser); |
| | | visitedIds.add(currentId); |
| | | currentId = inviteUserId; |
| | | } else { |
| | | break; // 如果邀请用户不存在,终止循环 |
| | | } |
| | | } else { |
| | | break; // 如果没有邀请用户,终止循环 |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | } |