| | |
| | | import com.xcong.excoin.common.system.service.CommonService; |
| | | import com.xcong.excoin.modules.coin.dao.MemberAccountMoneyChangeDao; |
| | | import com.xcong.excoin.modules.coin.dao.ZhiYaDao; |
| | | import com.xcong.excoin.modules.coin.dao.ZhiYaRecordDao; |
| | | import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange; |
| | | import com.xcong.excoin.modules.coin.entity.ZhiYaEntity; |
| | | import com.xcong.excoin.modules.coin.entity.ZhiYaRecordEntity; |
| | | import com.xcong.excoin.modules.coin.entity.ZhiYaTeam; |
| | | import com.xcong.excoin.modules.coin.parameter.vo.ZhiyaInfoVo; |
| | | import com.xcong.excoin.modules.member.dao.*; |
| | | import com.xcong.excoin.modules.member.entity.*; |
| | |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.web3j.abi.datatypes.Int; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | @Resource |
| | | private MemberDao memberDao; |
| | | |
| | | @Resource |
| | | private ZhiYaRecordDao zhiYaRecordDao; |
| | | |
| | | @Resource |
| | | private MemberWalletAgentDao memberWalletAgentDao; |
| | |
| | | //获取用户ID |
| | | Long memberId = LoginUserUtils.getAppLoginUser().getId(); |
| | | MemberEntity member = memberDao.selectById(memberId); |
| | | Page<MemberTeamVo> page = new Page<>(memberTeamRecordsPageDto.getPageNum(), memberTeamRecordsPageDto.getPageSize()); |
| | | MemberEntity memberEntity = new MemberEntity(); |
| | | memberEntity.setId(memberId); |
| | | memberEntity.setInviteId(member.getInviteId()); |
| | | IPage<MemberTeamVo> lists = memberDao.selectAllTeamByInviteIdInPage(page, memberEntity); |
| | | return Result.ok(lists); |
| | | MemberTeamVo memberTeamVo = memberDao.selectAllTeamByInviteIdInPage(memberId,member.getInviteId()); |
| | | List<TeamVo> teamVos = new ArrayList<>(); |
| | | if(ObjectUtil.isEmpty(memberTeamVo)){ |
| | | MemberTeamVo memberTeamVoNull = new MemberTeamVo(); |
| | | Integer teamCnt = memberDao.selectMemberCountByInvitedId(member.getInviteId()); |
| | | memberTeamVoNull.setTeamCnt(teamCnt); |
| | | memberTeamVoNull.setZhiyaCnt(BigDecimal.ZERO); |
| | | memberTeamVoNull.setRewardCnt(BigDecimal.ZERO); |
| | | memberTeamVoNull.setTeamVo(teamVos); |
| | | return Result.ok(memberTeamVoNull); |
| | | } |
| | | //直属会员 |
| | | List<MemberEntity> memberZhiShu = memberDao.selectMemberInfoByRefererId(member.getInviteId()); |
| | | if(CollUtil.isNotEmpty(memberZhiShu)){ |
| | | for(MemberEntity zhishu : memberZhiShu){ |
| | | Long zhiShuMemberId = zhishu.getId(); |
| | | ZhiYaTeam zhiYaTeam = memberDao.selectZhiYaTeamRecordByMemberId(zhiShuMemberId); |
| | | TeamVo teamVo = new TeamVo(); |
| | | String phone = zhishu.getPhone(); |
| | | if(StrUtil.isNotEmpty(phone)){ |
| | | String result = phone.substring(phone.length()-4,phone.length()); |
| | | teamVo.setAccount(result); |
| | | } |
| | | int memberCnt = memberDao.selectMemberCountByInvitedId(zhishu.getInviteId()); |
| | | teamVo.setTeamCnt(memberCnt); |
| | | |
| | | Long aLong = zhiYaRecordDao.selectSumZhiyaCntByMemberIdAndOrderStatus(zhiShuMemberId, 1); |
| | | Long rLong = zhiYaRecordDao.selectSumRewardCntByMemberId(zhiShuMemberId); |
| | | teamVo.setZhiyaCnt(new BigDecimal(aLong)); |
| | | teamVo.setRewardCnt(new BigDecimal(rLong)); |
| | | if(ObjectUtil.isNotEmpty(zhiYaTeam)){ |
| | | teamVo.setZhiyaCnt((zhiYaTeam.getZhiyaCnt() == null ? BigDecimal.ZERO : zhiYaTeam.getZhiyaCnt()).add(new BigDecimal(aLong))); |
| | | teamVo.setRewardCnt(zhiYaTeam.getRewardCnt() == null ?BigDecimal.ZERO : zhiYaTeam.getRewardCnt().add(new BigDecimal(rLong))); |
| | | } |
| | | teamVos.add(teamVo); |
| | | } |
| | | memberTeamVo.setTeamVo(teamVos); |
| | | } |
| | | return Result.ok(memberTeamVo); |
| | | } |
| | | } |
| | | |