|
|
|
@ -444,33 +444,28 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|
|
|
|
.orderByAsc(DistributionMebConfigDO::getLevelId));
|
|
|
|
|
//添加5占一
|
|
|
|
|
if(ObjectUtil.isNotEmpty(distributionMebConfigDOS)){
|
|
|
|
|
Long l = distributionLogMapper.selectCount(new LambdaQueryWrapperX<DistributionLogDO>().eq(DistributionLogDO::getMebId, userId)
|
|
|
|
|
.orderByAsc(DistributionLogDO::getCreateTime));
|
|
|
|
|
if(l == 0){
|
|
|
|
|
//添加5占一游戏
|
|
|
|
|
DistributionLogDO distributionLogDO = new DistributionLogDO();
|
|
|
|
|
distributionLogDO.setMebId(userId);
|
|
|
|
|
distributionLogDO.setStatus("1");
|
|
|
|
|
//添加5占一游戏
|
|
|
|
|
DistributionLogDO distributionLogDO = new DistributionLogDO();
|
|
|
|
|
distributionLogDO.setMebId(userId);
|
|
|
|
|
distributionLogDO.setStatus("1");
|
|
|
|
|
// distributionLogDO.setBrokerage();
|
|
|
|
|
distributionLogDO.setGameStatus("1");
|
|
|
|
|
distributionLogDO.setConvertStatus("1");
|
|
|
|
|
distributionLogDO.setOutTime(LocalDateTime.now());
|
|
|
|
|
distributionLogMapper.insert(distributionLogDO);
|
|
|
|
|
//查询5占一总数
|
|
|
|
|
List<DistributionLogDO> distributionLogDOS = distributionLogMapper.selectList(new LambdaQueryWrapperX<DistributionLogDO>()
|
|
|
|
|
.orderByAsc(DistributionLogDO::getCreateTime));
|
|
|
|
|
int i1 = distributionLogDOS.size() % 5;
|
|
|
|
|
if(i1 == 0){
|
|
|
|
|
DistributionLogDO vo = distributionLogDOS.get((distributionLogDOS.size()/5)-1);
|
|
|
|
|
vo.setGameStatus("0");
|
|
|
|
|
distributionLogMapper.updateById(vo);
|
|
|
|
|
// List<DistributionLogDO> distributionLogDOS1 = distributionLogDOS.subList(0, (distributionLogDOS.size() / 5));
|
|
|
|
|
// for (DistributionLogDO dt:distributionLogDOS1) {
|
|
|
|
|
// dt.setGameStatus("0");
|
|
|
|
|
// }
|
|
|
|
|
// distributionLogMapper.updateBatch(distributionLogDOS1);
|
|
|
|
|
// distributionLogMapper.up
|
|
|
|
|
distributionLogDO.setGameStatus("1");
|
|
|
|
|
distributionLogDO.setConvertStatus("1");
|
|
|
|
|
distributionLogMapper.insert(distributionLogDO);
|
|
|
|
|
//查询5占一总数
|
|
|
|
|
List<DistributionLogDO> distributionLogDOS = distributionLogMapper.selectList(new LambdaQueryWrapperX<DistributionLogDO>()
|
|
|
|
|
.orderByAsc(DistributionLogDO::getCreateTime));
|
|
|
|
|
int i1 = distributionLogDOS.size() % 5;
|
|
|
|
|
if(i1 == 0){
|
|
|
|
|
// DistributionLogDO vo = distributionLogDOS.get((distributionLogDOS.size()/5)-1);
|
|
|
|
|
// vo.setGameStatus("0");
|
|
|
|
|
// distributionLogMapper.updateById(vo);
|
|
|
|
|
List<DistributionLogDO> distributionLogDOS1 = distributionLogDOS.subList(0, (distributionLogDOS.size() / 5));
|
|
|
|
|
for (DistributionLogDO dt:distributionLogDOS1) {
|
|
|
|
|
dt.setGameStatus("0");
|
|
|
|
|
}
|
|
|
|
|
distributionLogMapper.updateBatch(distributionLogDOS1);
|
|
|
|
|
// distributionLogMapper.up
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -487,8 +482,6 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|
|
|
|
if(eg.getLevelId() == memberUserDO.getLevelId()){
|
|
|
|
|
//添加佣金记录
|
|
|
|
|
BrokerageRecordDO brokerageRecordDO = new BrokerageRecordDO();
|
|
|
|
|
// brokerageRecordDO.setId(Math.toIntExact(brokerageUserDO.getBindUserId()));
|
|
|
|
|
brokerageRecordDO.setBizId(orderId+"");
|
|
|
|
|
brokerageRecordDO.setUserId(memberUserDO.getId());
|
|
|
|
|
brokerageRecordDO.setBizType(1);
|
|
|
|
|
brokerageRecordDO.setTitle("分销直推佣金");
|
|
|
|
@ -507,15 +500,11 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|
|
|
|
brokerageRecordDO.setSourceUserLevel(configLevelDO.getLevel());
|
|
|
|
|
brokerageRecordDO.setSourceUserId(userId);
|
|
|
|
|
brokerageRecordMapper.insert(brokerageRecordDO);
|
|
|
|
|
//修改推广员佣金
|
|
|
|
|
BrokerageUserDO brokerageUserDO1 = brokerageUserMapper.selectById(brokerageUserDO.getBindUserId());
|
|
|
|
|
brokerageUserDO1.setBrokeragePrice(eg.getBrokerage()*100+brokerageUserDO1.getBrokeragePrice());
|
|
|
|
|
brokerageUserMapper.updateById(brokerageUserDO1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
recursionMemberLevel(brokerageUserDO.getBindUserId(),orderId);
|
|
|
|
|
recursionMemberLevel(brokerageUserDO.getId(),orderId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -525,82 +514,80 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|
|
|
|
private void recursionMemberLevel(Long userId,Long orderId){
|
|
|
|
|
//查询会员信息
|
|
|
|
|
MemberUserDO memberUserDO = memberUserMapper.selectById(userId);
|
|
|
|
|
if(ObjectUtil.isNotEmpty(memberUserDO)){
|
|
|
|
|
DistributionStatisticsDO distributionStatisticsDO = new DistributionStatisticsDO();
|
|
|
|
|
distributionStatisticsDO.setLevelId(memberUserDO.getLevelId());
|
|
|
|
|
distributionStatisticsDO.setMebId(memberUserDO.getId());
|
|
|
|
|
distributionStatisticsDO.setLogId(orderId);
|
|
|
|
|
distributionStatisticsDO.setStatus("1");
|
|
|
|
|
distributionStatisticsMapper.insert(distributionStatisticsDO);
|
|
|
|
|
//查询会员当前等级
|
|
|
|
|
MemberLevelDO memberLevelDO = memberLevelMapper.selectById(memberUserDO.getLevelId());
|
|
|
|
|
if(ObjectUtil.isNotEmpty(memberLevelDO)){
|
|
|
|
|
//查询上一级会员等级
|
|
|
|
|
MemberLevelDO upLevelDO = memberLevelMapper.selectOne(new LambdaQueryWrapperX<MemberLevelDO>()
|
|
|
|
|
.eq(MemberLevelDO::getStatus, 0)
|
|
|
|
|
.eq(MemberLevelDO::getDeleted, 0)
|
|
|
|
|
.eq(MemberLevelDO::getLevel, (memberLevelDO.getLevel()+1))
|
|
|
|
|
.orderByAsc(MemberLevelDO::getLevel));
|
|
|
|
|
if(ObjectUtil.isNotEmpty(upLevelDO)){
|
|
|
|
|
if(ObjectUtil.equal(memberLevelDO.getLevel(),1)){//帮扶人不升级
|
|
|
|
|
//添加推荐统计
|
|
|
|
|
}
|
|
|
|
|
if(ObjectUtil.equal(memberLevelDO.getLevel(),2)){//帮扶员升级帮扶驿站
|
|
|
|
|
//查询会员邀请记录下级会员
|
|
|
|
|
List<BrokerageUserDO> brokerageUserDOS = brokerageUserMapper.selectList(new LambdaQueryWrapperX<BrokerageUserDO>()
|
|
|
|
|
.eq(BrokerageUserDO::getBindUserId, userId)
|
|
|
|
|
.ge(BrokerageUserDO::getLevel, memberLevelDO.getLevel())
|
|
|
|
|
.eq(BrokerageUserDO::getDeleted, 0)
|
|
|
|
|
);
|
|
|
|
|
if(ObjectUtil.isNotEmpty(brokerageUserDOS)){
|
|
|
|
|
if(brokerageUserDOS.size()>=3){
|
|
|
|
|
//升级会员
|
|
|
|
|
memberUserMapper.updateById(new MemberUserDO()
|
|
|
|
|
.setId(userId)
|
|
|
|
|
.setLevelId(upLevelDO.getId())
|
|
|
|
|
);
|
|
|
|
|
brokerageUserMapper.updateById(new BrokerageUserDO()
|
|
|
|
|
.setId(userId)
|
|
|
|
|
.setLevel(upLevelDO.getLevel())
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
DistributionStatisticsDO distributionStatisticsDO = new DistributionStatisticsDO();
|
|
|
|
|
distributionStatisticsDO.setLevelId(memberUserDO.getLevelId());
|
|
|
|
|
distributionStatisticsDO.setMebId(memberUserDO.getId());
|
|
|
|
|
distributionStatisticsDO.setLogId(orderId);
|
|
|
|
|
distributionStatisticsDO.setStatus("1");
|
|
|
|
|
distributionStatisticsMapper.insert(distributionStatisticsDO);
|
|
|
|
|
//查询会员当前等级
|
|
|
|
|
MemberLevelDO memberLevelDO = memberLevelMapper.selectById(memberUserDO.getLevelId());
|
|
|
|
|
if(ObjectUtil.isNotEmpty(memberLevelDO)){
|
|
|
|
|
//查询上一级会员等级
|
|
|
|
|
MemberLevelDO upLevelDO = memberLevelMapper.selectOne(new LambdaQueryWrapperX<MemberLevelDO>()
|
|
|
|
|
.eq(MemberLevelDO::getStatus, 0)
|
|
|
|
|
.eq(MemberLevelDO::getDeleted, 0)
|
|
|
|
|
.eq(MemberLevelDO::getLevel, (memberLevelDO.getLevel()+1))
|
|
|
|
|
.orderByAsc(MemberLevelDO::getLevel));
|
|
|
|
|
if(ObjectUtil.isNotEmpty(upLevelDO)){
|
|
|
|
|
if(ObjectUtil.equal(memberLevelDO.getLevel(),1)){//帮扶人不升级
|
|
|
|
|
//添加推荐统计
|
|
|
|
|
}
|
|
|
|
|
if(ObjectUtil.equal(memberLevelDO.getLevel(),2)){//帮扶员升级帮扶驿站
|
|
|
|
|
//查询会员邀请记录下级会员
|
|
|
|
|
List<BrokerageUserDO> brokerageUserDOS = brokerageUserMapper.selectList(new LambdaQueryWrapperX<BrokerageUserDO>()
|
|
|
|
|
.eq(BrokerageUserDO::getBindUserId, userId)
|
|
|
|
|
.ge(BrokerageUserDO::getLevel, memberLevelDO.getLevel())
|
|
|
|
|
.eq(BrokerageUserDO::getDeleted, 0)
|
|
|
|
|
);
|
|
|
|
|
if(ObjectUtil.isNotEmpty(brokerageUserDOS)){
|
|
|
|
|
if(brokerageUserDOS.size()>=3){
|
|
|
|
|
//升级会员
|
|
|
|
|
memberUserMapper.updateById(new MemberUserDO()
|
|
|
|
|
.setId(userId)
|
|
|
|
|
.setLevelId(upLevelDO.getId())
|
|
|
|
|
);
|
|
|
|
|
brokerageUserMapper.updateById(new BrokerageUserDO()
|
|
|
|
|
.setId(userId)
|
|
|
|
|
.setLevel(upLevelDO.getLevel())
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
//判断上级会员是否升级
|
|
|
|
|
BrokerageUserDO brokerageUserDO = brokerageUserMapper.selectById(userId);
|
|
|
|
|
recursionMemberLevel(brokerageUserDO.getBindUserId(),orderId);
|
|
|
|
|
}
|
|
|
|
|
if(ObjectUtil.equal(memberLevelDO.getLevel(),3)){//帮扶驿站升级帮扶中心
|
|
|
|
|
//查询会员邀请记录下级会员
|
|
|
|
|
List<BrokerageUserDO> brokerageUserDOS = brokerageUserMapper.selectList(new LambdaQueryWrapperX<BrokerageUserDO>()
|
|
|
|
|
.eq(BrokerageUserDO::getBindUserId, userId)
|
|
|
|
|
.ge(BrokerageUserDO::getLevel, memberLevelDO.getLevel())
|
|
|
|
|
.eq(BrokerageUserDO::getDeleted, 0)
|
|
|
|
|
);
|
|
|
|
|
//查询会员邀请记录下级会员
|
|
|
|
|
List<BrokerageUserDO> brokerageUserDOS1 = brokerageUserMapper.selectList(new LambdaQueryWrapperX<BrokerageUserDO>()
|
|
|
|
|
.eq(BrokerageUserDO::getBindUserId, userId)
|
|
|
|
|
.ge(BrokerageUserDO::getLevel, 2)
|
|
|
|
|
.eq(BrokerageUserDO::getDeleted, 0)
|
|
|
|
|
);
|
|
|
|
|
if(ObjectUtil.isNotEmpty(brokerageUserDOS)){
|
|
|
|
|
if(brokerageUserDOS.size()>=10 || brokerageUserDOS1.size()>=300){
|
|
|
|
|
//升级会员
|
|
|
|
|
memberUserMapper.updateById(new MemberUserDO()
|
|
|
|
|
.setId(userId)
|
|
|
|
|
.setLevelId(upLevelDO.getId())
|
|
|
|
|
);
|
|
|
|
|
brokerageUserMapper.updateById(new BrokerageUserDO()
|
|
|
|
|
.setId(userId)
|
|
|
|
|
.setLevel(upLevelDO.getLevel())
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
//判断上级会员是否升级
|
|
|
|
|
BrokerageUserDO brokerageUserDO = brokerageUserMapper.selectById(userId);
|
|
|
|
|
recursionMemberLevel(brokerageUserDO.getBindUserId(),orderId);
|
|
|
|
|
}
|
|
|
|
|
if(ObjectUtil.equal(memberLevelDO.getLevel(),3)){//帮扶驿站升级帮扶中心
|
|
|
|
|
//查询会员邀请记录下级会员
|
|
|
|
|
List<BrokerageUserDO> brokerageUserDOS = brokerageUserMapper.selectList(new LambdaQueryWrapperX<BrokerageUserDO>()
|
|
|
|
|
.eq(BrokerageUserDO::getBindUserId, userId)
|
|
|
|
|
.ge(BrokerageUserDO::getLevel, memberLevelDO.getLevel())
|
|
|
|
|
.eq(BrokerageUserDO::getDeleted, 0)
|
|
|
|
|
);
|
|
|
|
|
//查询会员邀请记录下级会员
|
|
|
|
|
List<BrokerageUserDO> brokerageUserDOS1 = brokerageUserMapper.selectList(new LambdaQueryWrapperX<BrokerageUserDO>()
|
|
|
|
|
.eq(BrokerageUserDO::getBindUserId, userId)
|
|
|
|
|
.ge(BrokerageUserDO::getLevel, 2)
|
|
|
|
|
.eq(BrokerageUserDO::getDeleted, 0)
|
|
|
|
|
);
|
|
|
|
|
if(ObjectUtil.isNotEmpty(brokerageUserDOS)){
|
|
|
|
|
if(brokerageUserDOS.size()>=10 || brokerageUserDOS1.size()>=300){
|
|
|
|
|
//升级会员
|
|
|
|
|
memberUserMapper.updateById(new MemberUserDO()
|
|
|
|
|
.setId(userId)
|
|
|
|
|
.setLevelId(upLevelDO.getId())
|
|
|
|
|
);
|
|
|
|
|
brokerageUserMapper.updateById(new BrokerageUserDO()
|
|
|
|
|
.setId(userId)
|
|
|
|
|
.setLevel(upLevelDO.getLevel())
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
//判断上级会员是否升级
|
|
|
|
|
BrokerageUserDO brokerageUserDO = brokerageUserMapper.selectById(userId);
|
|
|
|
|
recursionMemberLevel(brokerageUserDO.getBindUserId(),orderId);
|
|
|
|
|
}
|
|
|
|
|
if(ObjectUtil.equal(memberLevelDO.getLevel(),4)){//帮扶中心不做升级
|
|
|
|
|
}
|
|
|
|
|
//判断上级会员是否升级
|
|
|
|
|
BrokerageUserDO brokerageUserDO = brokerageUserMapper.selectById(userId);
|
|
|
|
|
recursionMemberLevel(brokerageUserDO.getBindUserId(),orderId);
|
|
|
|
|
}
|
|
|
|
|
if(ObjectUtil.equal(memberLevelDO.getLevel(),4)){//帮扶中心不做升级
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|