完成了第一版

This commit is contained in:
chen-xin-zhi 2025-05-15 19:21:58 +08:00
parent 943454c734
commit b946338c6d
3 changed files with 21 additions and 14 deletions

View File

@ -91,6 +91,9 @@ public class PromoCodeApplyController {
String promoCodeLink = promoCode.getPromoCodeLink();
// 获取项目的参数信息
Project project = projectService.getById(projectId);
// 更新项目的推广人数
project.setCurrentPromotionCount(project.getCurrentPromotionCount() + 1);
projectService.updateById(project);
String projectName = project.getProjectName();
String projectImage = project.getProjectImage();
Integer projectSettlementCycle = project.getProjectSettlementCycle();

View File

@ -166,23 +166,27 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
}
userMainInfoService.save(userMainInfo);
List<SubUserProjectCommission> subUserProjectCommissionList = commonService.findByFieldEqTargetField(SubUserProjectCommission::getSubUserId, parentUserInfo.getId(), subUserProjectCommissionService);
List<ProjectCommission> projectCommissionList = new ArrayList<>();
for (SubUserProjectCommission subUserProjectCommission : subUserProjectCommissionList) {
// 插入下级用户项目明细抽佣记录
// 查询上级用户的项目抽佣记录
List<ProjectCommission> projectCommissionList = commonService.findByFieldEqTargetField(ProjectCommission::getUserId, parentUserInfo.getId(), projectCommissionService);
// 插入当前用户的项目抽佣记录
for (ProjectCommission projectCommission : projectCommissionList) {
ProjectCommission currentUserProjectCommission = commonService.copyProperties(projectCommission, ProjectCommission.class);
currentUserProjectCommission.setId(null);
currentUserProjectCommission.setMyUnitPrice(projectCommission.getMyUnitPrice().multiply(BigDecimal.ONE.subtract(projectCommission.getCurrentCommissionRate())));
currentUserProjectCommission.setCurrentCommissionRate(BigDecimal.ZERO);
currentUserProjectCommission.setUserId(myUserInfo.getId());
}
projectCommissionService.saveBatch(projectCommissionList);
// 插入下级用户的项目明细抽佣记录
List<ProjectCommission> proCommissionList = commonService.findByFieldEqTargetField(ProjectCommission::getUserId, parentUserInfo.getId(), projectCommissionService);
List<SubUserProjectCommission> subUserProjectCommissionList = new ArrayList<>();
for (ProjectCommission projectCommission : proCommissionList) {
SubUserProjectCommission subUserProjectCommission = commonService.copyProperties(projectCommission, SubUserProjectCommission.class);
subUserProjectCommission.setId(null);
subUserProjectCommission.setUserId(parentUserInfo.getId());
subUserProjectCommission.setSubUserId(myUserInfo.getId());
subUserProjectCommission.setMyUnitPrice(subUserProjectCommission.getMyUnitPrice().multiply(BigDecimal.ONE.subtract(subUserProjectCommission.getCurrentCommissionRate())));
// 插入用户项目明细抽佣记录
ProjectCommission projectCommission = commonService.copyProperties(subUserProjectCommission, ProjectCommission.class);
projectCommission.setId(null);
projectCommission.setCurrentCommissionRate(BigDecimal.ZERO);
projectCommission.setUserId(myUserInfo.getId());
subUserProjectCommissionList.add(subUserProjectCommission);
}
subUserProjectCommissionService.saveBatch(subUserProjectCommissionList);
projectCommissionService.saveBatch(projectCommissionList);
}

View File

@ -1,4 +1,4 @@
spring:
profiles:
active: test-caozhe
active: test