注册时加入代理商查询

This commit is contained in:
liuyingfang
2023-07-03 16:16:23 +08:00
parent 38cd7b6402
commit b426dfa12e
3 changed files with 73 additions and 6 deletions

View File

@@ -27,11 +27,15 @@ public class UserPromotion {
@TableField(value = "parent_user_id") @TableField(value = "parent_user_id")
private String parentUserId; private String parentUserId;
@TableField(value = "create_time") @TableField(value = "create_time")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
@TableField(value = "is_extend")
private String isExtend;
@TableField(value = "update_time") @TableField(value = "update_time")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")

View File

@@ -18,6 +18,7 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -139,13 +140,29 @@ public class UserInfoServiceImpl extends BaseUserInfoService {
UserPromotion promotion= getUserPromotionByUserId(parentApp.getUserId().toString()); UserPromotion promotion= getUserPromotionByUserId(parentApp.getUserId().toString());
String parenId=promotion.getUserId().toString(); String parenId=promotion.getUserId().toString();
// BigDecimal fee=promotion.get promotion=new UserPromotion();
promotion.setUserId(userInfo.getId());
promotion.setParentUserId(parenId);
promotion.setCurrentFee(userInfo.getCurrentFee());
promotion.setTypeCode(userInfo.getTypeCode());
if(userInfo.getTypeCode().equals("FB")){
if (promotion.getCurrentFee().compareTo(userInfo.getCurrentFee()) >0||
userInfo.getCurrentFee().compareTo(getUserPromotionByUserId("244").getCurrentFee()) < 0){
MsgException.checkNull(null,"错误的费率信息");
}
}
if(userInfo.getTypeCode().equals("SB")){
if (promotion.getCurrentFee().compareTo(userInfo.getCurrentFee()) >0||
userInfo.getCurrentFee().compareTo(getUserPromotionByUserId("244").getCurrentFee()) < 0){
MsgException.checkNull(null,"错误的费率信息");
}
}
promotion.setIsExtend(userInfo.getTypeCode().equals("MC")?"0":"1");
promotion.setCreateTime(new Date());
userPromotionMapper.insert(promotion);
// 保存信息 // 保存信息
userAppService.save(userApp); userAppService.save(userApp);
roleUserInfoService.saveRoleUserInfo(role); roleUserInfoService.saveRoleUserInfo(role);
@@ -188,14 +205,15 @@ public class UserInfoServiceImpl extends BaseUserInfoService {
// ipRecordService.saveRegIp(userInfo.getId() + "", operatorUserId); // ipRecordService.saveRegIp(userInfo.getId() + "", operatorUserId);
} }
@Resource
private UserPromotionMapper userPromotionMapper; private UserPromotionMapper userPromotionMapper;
private UserPromotion getUserPromotionByUserId(String userId){ private UserPromotion getUserPromotionByUserId(String userId){
UserPromotion promotion= userPromotionMapper.selectById(userId); UserPromotion promotion= userPromotionMapper.selectById(userId);
if(ObjectUtil.isNotEmpty(promotion)){ if(ObjectUtil.isNotEmpty(promotion)){
if("FB".equals(promotion.getTypeCode())||"SB".equals(promotion.getTypeCode())||"1".equals(promotion.toString())){ if("MG".equals(promotion.getTypeCode())||"FB".equals(promotion.getTypeCode())||
"SB".equals(promotion.getTypeCode())||"1".equals(promotion.getIsExtend())){
return promotion; return promotion;
} }

View File

@@ -1,8 +1,10 @@
package cn.pluss.platform.userInfo.impl; package cn.pluss.platform.userInfo.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.pluss.platform.entity.*; import cn.pluss.platform.entity.*;
import cn.pluss.platform.exception.MsgException; import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.jfShop.JfShopHandler; import cn.pluss.platform.jfShop.JfShopHandler;
import cn.pluss.platform.mapper.UserPromotionMapper;
import cn.pluss.platform.roleUserInfo.RoleUserInfoService; import cn.pluss.platform.roleUserInfo.RoleUserInfoService;
import cn.pluss.platform.systemConfig.SystemConfigService; import cn.pluss.platform.systemConfig.SystemConfigService;
import cn.pluss.platform.user.UserIpRecordService; import cn.pluss.platform.user.UserIpRecordService;
@@ -18,6 +20,7 @@ import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Base64; import java.util.Base64;
import java.util.Date; import java.util.Date;
@@ -110,6 +113,31 @@ public class UserInfoServiceNewImpl extends BaseUserInfoService {
UserApp userApp = getSaveUserAppInfo(userInfo); UserApp userApp = getSaveUserAppInfo(userInfo);
userApp.setParentId(new Long(244)); userApp.setParentId(new Long(244));
userApp.setInviteNum(getRandomNum()); userApp.setInviteNum(getRandomNum());
//查找代理
UserPromotion promotion= getUserPromotionByUserId(String.valueOf(244));
String parenId=promotion.getUserId().toString();
promotion=new UserPromotion();
promotion.setUserId(userInfo.getId());
promotion.setParentUserId(parenId);
if(userInfo.getTypeCode().equals("FB")){
if (promotion.getCurrentFee().compareTo(userInfo.getCurrentFee()) >0||
userInfo.getCurrentFee().compareTo(getUserPromotionByUserId("244").getCurrentFee()) < 0){
MsgException.checkNull(null,"错误的费率信息");
}
}
if(userInfo.getTypeCode().equals("SB")){
if (promotion.getCurrentFee().compareTo(userInfo.getCurrentFee()) >0||
userInfo.getCurrentFee().compareTo(getUserPromotionByUserId("244").getCurrentFee()) < 0){
MsgException.checkNull(null,"错误的费率信息");
}
}
promotion.setCurrentFee(promotion.getCurrentFee());
promotion.setTypeCode(userInfo.getTypeCode());
promotion.setIsExtend(userInfo.getTypeCode().equals("MC")?"0":"1");
promotion.setCreateTime(new Date());
userPromotionMapper.insert(promotion);
// 保存信息 // 保存信息
userAppService.save(userApp); userAppService.save(userApp);
roleUserInfoService.saveRoleUserInfo(role); roleUserInfoService.saveRoleUserInfo(role);
@@ -161,4 +189,21 @@ public class UserInfoServiceNewImpl extends BaseUserInfoService {
} }
} while (true); } while (true);
} }
@Resource
private UserPromotionMapper userPromotionMapper;
private UserPromotion getUserPromotionByUserId(String userId){
UserPromotion promotion= userPromotionMapper.selectById(userId);
if(ObjectUtil.isNotEmpty(promotion)){
if("MG".equals(promotion.getTypeCode())||"FB".equals(promotion.getTypeCode())||
"SB".equals(promotion.getTypeCode())||"1".equals(promotion.getIsExtend())){
return promotion;
}
}
getUserPromotionByUserId(promotion.getParentUserId());
return null;
}
} }