From 3cb59ae9ddc31e62988e5c7feb6647b44f1c7cf8 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期五, 17 一月 2025 17:50:37 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java | 116 ++++++++++++++++++++++++----------------------------------
1 files changed, 48 insertions(+), 68 deletions(-)
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java
index f50b3e3..620f03b 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java
@@ -49,6 +49,10 @@
private BaseSettingClient baseSettingClient;
@Resource
private VipCenterService vipCenterService;
+ @Resource
+ private VipSettingClient vipSettingClient;
+ @Resource
+ private UserChangeLogService userChangeLogService;
@PostMapping("/apply")
@ApiOperation(value = "会员申请", tags = {"会员中心-小程序"})
@@ -61,16 +65,9 @@
@ApiOperation(value = "会员申请列表", tags = {"后台"})
public R<IPage<AgentApplication>> page(@RequestBody AgentQuery agentQuery) {
IPage<AgentApplication> agentApplicationIPage = agentApplicationService.pageList(agentQuery);
- for (AgentApplication record : agentApplicationIPage.getRecords()) {
- AppUser byId = appUserService.getById(record.getAppUserId());
- if (byId!=null){
- record.setVipId(byId.getVipId());
- }
- }
return R.ok(agentApplicationIPage);
}
- @Resource
- private VipSettingClient vipSettingClient;
+
@GetMapping("/detail")
@ApiOperation(value = "会员申请详情", tags = {"会员中心-小程序"})
public R<AgentApplication> detail(@RequestParam Long id) {
@@ -82,31 +79,11 @@
VipSettingDto vipSettingDto = new VipSettingDto();
BeanUtils.copyProperties(vipSetting.getData(),vipSettingDto);
agentApplication.setVipSettingDto(vipSettingDto);
-// List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>()
-// .ne(AppUser::getStatus, 3)
-// .eq(AppUser::getDelFlag, 0));
-// ArrayList<Long> userIds = new ArrayList<>();
-// userIds.add(appUser.getId());
-// getUserAncestorList(appUser,userIds,new ArrayList<>(),appUserList);
- agentApplication.setVipId(agentApplication.getApplicationVipId());
+ agentApplication.setVipId(agentApplication.getVipId());
return R.ok(agentApplication);
}
- public void getUserAncestorList(AppUser user,List<Long> userIds, List<AppUser> children,List<AppUser> list) {
- children = list.stream().filter(u -> userIds.contains(u.getInviteUserId()) || userIds.contains(u.getTopInviteId())).collect(Collectors.toList());
- if(!CollectionUtils.isEmpty(children)){
- user.setCount1((user.getCount1() == null ? 0L : user.getCount1()) + children.stream().filter(e->e.getVipId() == 1).count());
- user.setCount2((user.getCount2() == null ? 0L : user.getCount2()) + children.stream().filter(e->e.getVipId() == 2).count());
- user.setCount3((user.getCount3() == null ? 0L : user.getCount3()) + children.stream().filter(e->e.getVipId() == 3).count());
- user.setCount4((user.getCount4() == null ? 0L : user.getCount4()) + children.stream().filter(e->e.getVipId() == 4).count());
- user.setCount5((user.getCount5() == null ? 0L : user.getCount5()) + children.stream().filter(e->e.getVipId() == 5).count());
- user.setCount6((user.getCount6() == null ? 0L : user.getCount6()) + children.stream().filter(e->e.getVipId() == 6).count());
- user.setCount7((user.getCount7() == null ? 0L : user.getCount7()) + children.stream().filter(e->e.getVipId() == 7).count());
- List<Long> userIdList = children.stream().map(AppUser::getId).collect(Collectors.toList());
- getUserAncestorList(user,userIdList, children,list);
- }
- }
- @Resource
- private UserChangeLogService userChangeLogService;
+
+
@GetMapping("/auth")
@ApiOperation(value = "会员申请审核", tags = {"会员中心-小程序"})
@@ -115,45 +92,48 @@
byId.setStatus(status);
byId.setRemark(remark);
agentApplicationService.updateById(byId);
- AppUser byId1 = appUserService.getById(byId.getAppUserId());
- //插入等级变化数据
- UserChangeLog userChangeLog = new UserChangeLog();
- userChangeLog.setCreateTime(LocalDateTime.now());
- userChangeLog.setAppUserId(byId.getAppUserId());
- userChangeLog.setBeforeVipId(byId1.getVipId());
- userChangeLog.setAfterVipId(byId.getApplicationVipId());
- if (userChangeLog.getBeforeVipId()>userChangeLog.getAfterVipId()) {
- userChangeLog.setChangeType(0);
- }else {
- userChangeLog.setChangeType(1);
- }
- userChangeLogService.save(userChangeLog);
- //变更会员等级
- byId1.setVipId(byId.getApplicationVipId());
-
- // 当用户为合伙人时,计算合伙人积分和培育积分
- Integer vipId = byId1.getVipId();
- if (vipId == 7){
- R<BaseSetting> baseSetting = baseSettingClient.getBaseSetting(1);
- BaseSetting data = baseSetting.getData();
- int basePoint = Integer.parseInt(data.getContent());
- // 当前用户计算合伙人积分
- R<VipSetting> vipSetting = vipSettingClient.getVipSetting(vipId);
- Integer point = getPoint(vipSetting, byId1, basePoint);
- byId1.setPartPoint(point);
- // 上级计算培育积分
- R<BaseSetting> baseSetting2 = baseSettingClient.getBaseSetting(1);
- BaseSetting data2 = baseSetting2.getData();
- int basePoint2 = Integer.parseInt(data2.getContent());
- Long inviteUserId = byId1.getInviteUserId();
- AppUser byId2 = appUserService.getById(inviteUserId);
- if (byId2 != null){
- Integer point1 = getPoint(vipSetting, byId2, basePoint2);
- byId2.setPartGrowPoint(point1);
+ if(2 == status){
+ AppUser byId1 = appUserService.getById(byId.getAppUserId());
+ //插入等级变化数据
+ UserChangeLog userChangeLog = new UserChangeLog();
+ userChangeLog.setCreateTime(LocalDateTime.now());
+ userChangeLog.setAppUserId(byId.getAppUserId());
+ userChangeLog.setBeforeVipId(byId1.getVipId());
+ userChangeLog.setAfterVipId(byId.getApplicationVipId());
+ if (userChangeLog.getBeforeVipId()>userChangeLog.getAfterVipId()) {
+ userChangeLog.setChangeType(0);
+ }else {
+ userChangeLog.setChangeType(1);
}
+ userChangeLogService.save(userChangeLog);
+ //变更会员等级
+ byId1.setVipId(byId.getApplicationVipId());
+
+ // 当用户为合伙人时,计算合伙人积分和培育积分
+ Integer vipId = byId1.getVipId();
+ if (vipId == 7){
+ R<BaseSetting> baseSetting = baseSettingClient.getBaseSetting(1);
+ BaseSetting data = baseSetting.getData();
+ int basePoint = Integer.parseInt(data.getContent());
+ // 当前用户计算合伙人积分
+ R<VipSetting> vipSetting = vipSettingClient.getVipSetting(vipId);
+ Integer point = getPoint(vipSetting, byId1, basePoint);
+ byId1.setPartPoint(point);
+ // 上级计算培育积分
+ R<BaseSetting> baseSetting2 = baseSettingClient.getBaseSetting(2);
+ BaseSetting data2 = baseSetting2.getData();
+ int basePoint2 = Integer.parseInt(data2.getContent());
+ Long inviteUserId = byId1.getInviteUserId();
+ AppUser byId2 = appUserService.getById(inviteUserId);
+ if (byId2 != null){
+ Integer point1 = getPoint(vipSetting, byId1, basePoint2);
+ byId2.setPartGrowPoint(point1);
+ appUserService.updateById(byId2);
+ }
+ }
+
+ appUserService.updateById(byId1);
}
-
- appUserService.updateById(byId1);
return R.ok(byId);
}
--
Gitblit v1.7.1