| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.xcong.excoin.common.entity.FebsConstant; |
| | | import com.xcong.excoin.common.entity.FebsResponse; |
| | | import com.xcong.excoin.common.entity.QueryRequest; |
| | | import com.xcong.excoin.common.exception.FebsException; |
| | | import com.xcong.excoin.common.utils.Md5Util; |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void editAgent(AgentUser agentUser, User user) { |
| | | if (FebsConstant.USER_TYPE_ADMIN.equals(user.getType())) { |
| | | user.setInviteId(FebsConstant.DEFAULT_REFERER_ID); |
| | | } |
| | | |
| | | AgentFriendRelationEntity agentFriendRelationEntity = agentFriendRelationMapper.selectAgentFriendRelationByUserId(agentUser.getId()); |
| | | if (!user.getInviteId().equals(agentFriendRelationEntity.getRefererId())) { |
| | | throw new FebsException("不是该用户直接上级,无法修改"); |
| | | } |
| | | |
| | | if (!FebsConstant.USER_TYPE_ADMIN.equals(user.getType())) { |
| | | AgentFriendRelationEntity friendRelationEntity = agentFriendRelationMapper.selectAgentFriendRelationByUserId(user.getUserId()); |
| | | if (agentUser.getReturnRatio().compareTo(friendRelationEntity.getReturnRatio()) > 0) { |
| | |
| | | editUser.setAgentName(agentUser.getName()); |
| | | userMapper.updateById(editUser); |
| | | |
| | | AgentFriendRelationEntity relationEntity = new AgentFriendRelationEntity(); |
| | | relationEntity.setUserId(agentUser.getId()); |
| | | relationEntity.setReturnRatio(agentUser.getReturnRatio()); |
| | | agentFriendRelationMapper.updateByUserId(relationEntity); |
| | | agentFriendRelationEntity.setReturnRatio(agentUser.getReturnRatio()); |
| | | agentFriendRelationMapper.updateById(agentFriendRelationEntity); |
| | | } |
| | | } |