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);
|
||||
for (Project project : projectList) {
|
||||
BigDecimal projectPrice = projectPriceMap.get(project.getId());
|
||||
project.setProjectPrice(projectPrice);
|
||||
project.setProjectPrice(projectPrice == null ? BigDecimal.ZERO : projectPrice);
|
||||
}
|
||||
List<ProjectCardVO> projectCardVOS = commonService.convertList(projectList, ProjectCardVO.class);
|
||||
return ResultUtils.success(projectCardVOS);
|
||||
|
|
|
@ -100,8 +100,12 @@ public class PromoCodeApplyController {
|
|||
String promoCodeImage = promoCode.getPromoCodeImage();
|
||||
// 获取项目的参数信息
|
||||
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);
|
||||
String projectName = project.getProjectName();
|
||||
String projectImage = project.getProjectImage();
|
||||
|
@ -124,6 +128,7 @@ public class PromoCodeApplyController {
|
|||
promoCodeApplyService.save(promoCodeApply);
|
||||
|
||||
// 添加用户项目记录
|
||||
if (userProjectList.isEmpty()) {
|
||||
UserProject userProject = UserProject.builder()
|
||||
.projectId(projectId)
|
||||
.projectName(projectName)
|
||||
|
@ -132,6 +137,7 @@ public class PromoCodeApplyController {
|
|||
.userId(userId)
|
||||
.build();
|
||||
userProjectService.save(userProject);
|
||||
}
|
||||
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.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -81,6 +82,7 @@ public class UserMainInfoController {
|
|||
userMainInfoMap.put(userMainInfo.getUserId(), userMainInfo);
|
||||
}
|
||||
List<UserMemberInfoVO> userMemberInfoVOList = new ArrayList<>();
|
||||
BigDecimal totalEarnings = BigDecimal.ZERO;
|
||||
for (UserInfo userInfo : userInfoList) {
|
||||
Long id = userInfo.getId();
|
||||
UserInfo userInformation = userInfoMap.get(id);
|
||||
|
@ -94,14 +96,17 @@ public class UserMainInfoController {
|
|||
.registerTime(userInformation.getCreateTime())
|
||||
.build();
|
||||
userMemberInfoVOList.add(userMemberInfoVO);
|
||||
totalEarnings = totalEarnings.add(userMainInfo.getParentEarnings());
|
||||
}
|
||||
UserInfo userInfo = userInfoService.getById(userId);
|
||||
UserTeamInfoVO userTeamInfoVO = commonService.copyProperties(userInfo, UserTeamInfoVO.class);
|
||||
userTeamInfoVO.setDirectAgentSize(userInfoList.size());
|
||||
userTeamInfoVO.setTeamEarnings(totalEarnings);
|
||||
|
||||
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userMainInfoLambdaQueryWrapper.eq(UserMainInfo::getUserId, userId);
|
||||
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
|
||||
userTeamInfoVO.setTeamSize(userMainInfo.getTeamSize());
|
||||
userTeamInfoVO.setInviteQrCode(userMainInfo.getInviteQrCode());
|
||||
userTeamInfoVO.setUserMemberInfoVOList(userMemberInfoVOList);
|
||||
|
||||
|
|
|
@ -142,11 +142,10 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
|||
|
||||
String invitationCode = userInfoRegisterRequest.getInvitationCode();
|
||||
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);
|
||||
ThrowUtils.throwIf(parentUserInfo == null, ErrorCode.OPERATION_ERROR, "邀请码错误");
|
||||
|
||||
|
||||
UserInfo myUserInfo = commonService.copyProperties(userInfoRegisterRequest, UserInfo.class);
|
||||
// 判断当前用户是否是根节点
|
||||
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.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 {
|
||||
String view = wechatGetQrcodeService.getWxQrCode(myUserInfo.getInvitationCode());
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
active: test
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user