Merge branch 'feature-team' into dev
This commit is contained in:
commit
72d2e6b45f
|
@ -109,7 +109,7 @@ public class ProjectController {
|
||||||
List<Project> projectList = commonService.findByFieldEqTargetField(Project::getIsShelves, 1, projectService);
|
List<Project> projectList = commonService.findByFieldEqTargetField(Project::getIsShelves, 1, projectService);
|
||||||
for (Project project : projectList) {
|
for (Project project : projectList) {
|
||||||
BigDecimal projectPrice = projectPriceMap.get(project.getId());
|
BigDecimal projectPrice = projectPriceMap.get(project.getId());
|
||||||
project.setProjectPrice(projectPrice);
|
project.setProjectPrice(projectPrice == null ? BigDecimal.ZERO : projectPrice);
|
||||||
}
|
}
|
||||||
List<ProjectCardVO> projectCardVOS = commonService.convertList(projectList, ProjectCardVO.class);
|
List<ProjectCardVO> projectCardVOS = commonService.convertList(projectList, ProjectCardVO.class);
|
||||||
return ResultUtils.success(projectCardVOS);
|
return ResultUtils.success(projectCardVOS);
|
||||||
|
|
|
@ -100,8 +100,12 @@ public class PromoCodeApplyController {
|
||||||
String promoCodeImage = promoCode.getPromoCodeImage();
|
String promoCodeImage = promoCode.getPromoCodeImage();
|
||||||
// 获取项目的参数信息
|
// 获取项目的参数信息
|
||||||
Project project = projectService.getById(projectId);
|
Project project = projectService.getById(projectId);
|
||||||
|
|
||||||
// 更新项目的推广人数
|
// 更新项目的推广人数
|
||||||
project.setCurrentPromotionCount(project.getCurrentPromotionCount() + 1);
|
Map<SFunction<UserProject, ?>, Object> projectConditions = Map.of(UserProject::getProjectId, projectId, UserProject::getUserId, userId);
|
||||||
|
List<UserProject> userProjectList = commonService.findByFieldEqTargetFields(projectConditions, userProjectService);
|
||||||
|
if (userProjectList.isEmpty()) project.setCurrentPromotionCount(project.getCurrentPromotionCount() + 1);
|
||||||
|
|
||||||
projectService.updateById(project);
|
projectService.updateById(project);
|
||||||
String projectName = project.getProjectName();
|
String projectName = project.getProjectName();
|
||||||
String projectImage = project.getProjectImage();
|
String projectImage = project.getProjectImage();
|
||||||
|
@ -124,14 +128,16 @@ public class PromoCodeApplyController {
|
||||||
promoCodeApplyService.save(promoCodeApply);
|
promoCodeApplyService.save(promoCodeApply);
|
||||||
|
|
||||||
// 添加用户项目记录
|
// 添加用户项目记录
|
||||||
UserProject userProject = UserProject.builder()
|
if (userProjectList.isEmpty()) {
|
||||||
.projectId(projectId)
|
UserProject userProject = UserProject.builder()
|
||||||
.projectName(projectName)
|
.projectId(projectId)
|
||||||
.projectImage(projectImage)
|
.projectName(projectName)
|
||||||
.projectSettlementCycle(projectSettlementCycle)
|
.projectImage(projectImage)
|
||||||
.userId(userId)
|
.projectSettlementCycle(projectSettlementCycle)
|
||||||
.build();
|
.userId(userId)
|
||||||
userProjectService.save(userProject);
|
.build();
|
||||||
|
userProjectService.save(userProject);
|
||||||
|
}
|
||||||
return ResultUtils.success(true);
|
return ResultUtils.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import jakarta.validation.Valid;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -81,6 +82,7 @@ public class UserMainInfoController {
|
||||||
userMainInfoMap.put(userMainInfo.getUserId(), userMainInfo);
|
userMainInfoMap.put(userMainInfo.getUserId(), userMainInfo);
|
||||||
}
|
}
|
||||||
List<UserMemberInfoVO> userMemberInfoVOList = new ArrayList<>();
|
List<UserMemberInfoVO> userMemberInfoVOList = new ArrayList<>();
|
||||||
|
BigDecimal totalEarnings = BigDecimal.ZERO;
|
||||||
for (UserInfo userInfo : userInfoList) {
|
for (UserInfo userInfo : userInfoList) {
|
||||||
Long id = userInfo.getId();
|
Long id = userInfo.getId();
|
||||||
UserInfo userInformation = userInfoMap.get(id);
|
UserInfo userInformation = userInfoMap.get(id);
|
||||||
|
@ -94,14 +96,17 @@ public class UserMainInfoController {
|
||||||
.registerTime(userInformation.getCreateTime())
|
.registerTime(userInformation.getCreateTime())
|
||||||
.build();
|
.build();
|
||||||
userMemberInfoVOList.add(userMemberInfoVO);
|
userMemberInfoVOList.add(userMemberInfoVO);
|
||||||
|
totalEarnings = totalEarnings.add(userMainInfo.getParentEarnings());
|
||||||
}
|
}
|
||||||
UserInfo userInfo = userInfoService.getById(userId);
|
UserInfo userInfo = userInfoService.getById(userId);
|
||||||
UserTeamInfoVO userTeamInfoVO = commonService.copyProperties(userInfo, UserTeamInfoVO.class);
|
UserTeamInfoVO userTeamInfoVO = commonService.copyProperties(userInfo, UserTeamInfoVO.class);
|
||||||
userTeamInfoVO.setDirectAgentSize(userInfoList.size());
|
userTeamInfoVO.setDirectAgentSize(userInfoList.size());
|
||||||
|
userTeamInfoVO.setTeamEarnings(totalEarnings);
|
||||||
|
|
||||||
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
userMainInfoLambdaQueryWrapper.eq(UserMainInfo::getUserId, userId);
|
userMainInfoLambdaQueryWrapper.eq(UserMainInfo::getUserId, userId);
|
||||||
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
|
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
|
||||||
|
userTeamInfoVO.setTeamSize(userMainInfo.getTeamSize());
|
||||||
userTeamInfoVO.setInviteQrCode(userMainInfo.getInviteQrCode());
|
userTeamInfoVO.setInviteQrCode(userMainInfo.getInviteQrCode());
|
||||||
userTeamInfoVO.setUserMemberInfoVOList(userMemberInfoVOList);
|
userTeamInfoVO.setUserMemberInfoVOList(userMemberInfoVOList);
|
||||||
|
|
||||||
|
|
|
@ -142,11 +142,10 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||||
|
|
||||||
String invitationCode = userInfoRegisterRequest.getInvitationCode();
|
String invitationCode = userInfoRegisterRequest.getInvitationCode();
|
||||||
LambdaQueryWrapper<UserInfo> invitedLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<UserInfo> invitedLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
invitedLambdaQueryWrapper.eq(UserInfo::getInvitationCode, invitationCode);
|
invitedLambdaQueryWrapper.eq(UserInfo::getInvitationCode, invitationCode).eq(UserInfo::getUserRole, UserConstant.DEFAULT_ROLE);
|
||||||
UserInfo parentUserInfo = this.getOne(invitedLambdaQueryWrapper);
|
UserInfo parentUserInfo = this.getOne(invitedLambdaQueryWrapper);
|
||||||
ThrowUtils.throwIf(parentUserInfo == null, ErrorCode.OPERATION_ERROR, "邀请码错误");
|
ThrowUtils.throwIf(parentUserInfo == null, ErrorCode.OPERATION_ERROR, "邀请码错误");
|
||||||
|
|
||||||
|
|
||||||
UserInfo myUserInfo = commonService.copyProperties(userInfoRegisterRequest, UserInfo.class);
|
UserInfo myUserInfo = commonService.copyProperties(userInfoRegisterRequest, UserInfo.class);
|
||||||
// 判断当前用户是否是根节点
|
// 判断当前用户是否是根节点
|
||||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserConstant.DEFAULT_ROLE, this);
|
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserConstant.DEFAULT_ROLE, this);
|
||||||
|
@ -160,6 +159,14 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||||
UserMainInfo userMainInfo = new UserMainInfo();
|
UserMainInfo userMainInfo = new UserMainInfo();
|
||||||
userMainInfo.setUserId(myUserInfo.getId());
|
userMainInfo.setUserId(myUserInfo.getId());
|
||||||
|
|
||||||
|
// 批量更新父级用户团队人数
|
||||||
|
List<Long> pathToRoot = this.findPathToRoot(myUserInfo.getId());
|
||||||
|
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetField(pathToRoot, userMainInfoService, id -> id, UserMainInfo::getUserId);
|
||||||
|
for (UserMainInfo mainInfo : userMainInfoList) {
|
||||||
|
mainInfo.setTeamSize(mainInfo.getTeamSize() + 1);
|
||||||
|
}
|
||||||
|
userMainInfoService.updateBatchById(userMainInfoList);
|
||||||
|
|
||||||
// 生成邀请二维码
|
// 生成邀请二维码
|
||||||
try {
|
try {
|
||||||
String view = wechatGetQrcodeService.getWxQrCode(myUserInfo.getInvitationCode());
|
String view = wechatGetQrcodeService.getWxQrCode(myUserInfo.getInvitationCode());
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: test
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user