注册相关,查询用户详情,后台切换通道相关

This commit is contained in:
liuyingfang
2023-07-04 10:51:41 +08:00
parent b426dfa12e
commit 5beafd2970
10 changed files with 91 additions and 40 deletions

View File

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -236,4 +237,17 @@ public interface MerchantChannelStatusService extends IService<MerchantChannelSt
UpdateWrapper<MerchantChannelStatus> objectUpdateWrapper = new UpdateWrapper<MerchantChannelStatus>()
.eq("merchantCode",merchantCode);
}
@Transactional(rollbackFor = Exception.class)
default void updateValid(String merchantCode){
MerchantChannelStatus validData = getValidData(merchantCode);
UpdateWrapper<MerchantChannelStatus> UpdateWrapper1 = new UpdateWrapper<MerchantChannelStatus>();
UpdateWrapper1.eq("id", validData.getId());
UpdateWrapper1.set("valid",0);
UpdateWrapper<MerchantChannelStatus> UpdateWrapper = new UpdateWrapper<MerchantChannelStatus>();
UpdateWrapper.eq("merchantCode", merchantCode)
.eq("valid",-1);
UpdateWrapper.set("valid",1);
}
}

View File

@@ -124,10 +124,7 @@ public class UserInfoServiceImpl extends BaseUserInfoService {
}
userInfo.setCreateTime(new Date());
save(userInfo);
// 可能和数据库存储的数据不一致
userInfo.setCreateTime(null);
// 获取当前用户的id保存用户的角色信息
userInfo = queryUserInfo(userInfo);
userInfo.setInviteCode(inviteCode);
RoleUserInfo role = new RoleUserInfo();
role.setRoleId(roleId);
@@ -163,6 +160,11 @@ public class UserInfoServiceImpl extends BaseUserInfoService {
promotion.setIsExtend(userInfo.getTypeCode().equals("MC")?"0":"1");
promotion.setCreateTime(new Date());
userPromotionMapper.insert(promotion);
// 可能和数据库存储的数据不一致
userInfo.setCreateTime(null);
// 获取当前用户的id保存用户的角色信息
userInfo = queryUserInfo(userInfo);
// 保存信息
userAppService.save(userApp);
roleUserInfoService.saveRoleUserInfo(role);
@@ -209,7 +211,9 @@ public class UserInfoServiceImpl extends BaseUserInfoService {
private UserPromotionMapper userPromotionMapper;
private UserPromotion getUserPromotionByUserId(String userId){
UserPromotion promotion= userPromotionMapper.selectById(userId);
UserPromotion userPromotion = new UserPromotion();
userPromotion.setUserId(Long.valueOf(userId));
UserPromotion promotion= userPromotionMapper.selectOne(new QueryWrapper<>(userPromotion));
if(ObjectUtil.isNotEmpty(promotion)){
if("MG".equals(promotion.getTypeCode())||"FB".equals(promotion.getTypeCode())||

View File

@@ -11,6 +11,7 @@ import cn.pluss.platform.user.UserIpRecordService;
import cn.pluss.platform.userInfo.UserInfoService;
import cn.pluss.platform.util.MD5Util;
import cn.pluss.platform.util.StringUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
@@ -104,8 +105,7 @@ public class UserInfoServiceNewImpl extends BaseUserInfoService {
saveUserInfo(userInfo);
// 可能和数据库存储的数据不一致
userInfo.setCreateTime(null);
// 获取当前用户的id保存用户的角色信息
userInfo = queryUserInfo(userInfo);
RoleUserInfo role = new RoleUserInfo();
role.setRoleId(roleId);
role.setUserId(userInfo.getId());
@@ -114,11 +114,17 @@ public class UserInfoServiceNewImpl extends BaseUserInfoService {
userApp.setParentId(new Long(244));
userApp.setInviteNum(getRandomNum());
//查找代理
if (userInfo.getTypeCode() == null){
userInfo.setTypeCode("MG");
}
if (userInfo.getCurrentFee() == null){
userInfo.setCurrentFee("0.38");
}
UserPromotion promotion= getUserPromotionByUserId(String.valueOf(244));
String parenId=promotion.getUserId().toString();
promotion=new UserPromotion();
promotion.setUserId(userInfo.getId());
promotion.setParentUserId(parenId);
UserPromotion promotionNew = new UserPromotion();
promotionNew.setUserId(userInfo.getId());
promotionNew.setParentUserId(parenId);
if(userInfo.getTypeCode().equals("FB")){
if (promotion.getCurrentFee().compareTo(userInfo.getCurrentFee()) >0||
userInfo.getCurrentFee().compareTo(getUserPromotionByUserId("244").getCurrentFee()) < 0){
@@ -132,12 +138,13 @@ public class UserInfoServiceNewImpl extends BaseUserInfoService {
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);
promotionNew.setCurrentFee(promotion.getCurrentFee());
promotionNew.setTypeCode(userInfo.getTypeCode());
promotionNew.setIsExtend(userInfo.getTypeCode().equals("MC")?"0":"1");
promotionNew.setCreateTime(new Date());
userPromotionMapper.insert(promotionNew);
// 获取当前用户的id保存用户的角色信息
userInfo = queryUserInfo(userInfo);
// 保存信息
userAppService.save(userApp);
roleUserInfoService.saveRoleUserInfo(role);
@@ -193,7 +200,9 @@ public class UserInfoServiceNewImpl extends BaseUserInfoService {
private UserPromotionMapper userPromotionMapper;
private UserPromotion getUserPromotionByUserId(String userId){
UserPromotion promotion= userPromotionMapper.selectById(userId);
UserPromotion userPromotion = new UserPromotion();
userPromotion.setUserId(Long.valueOf(userId));
UserPromotion promotion= userPromotionMapper.selectOne(new QueryWrapper<>(userPromotion));
if(ObjectUtil.isNotEmpty(promotion)){
if("MG".equals(promotion.getTypeCode())||"FB".equals(promotion.getTypeCode())||