From fd7b8fb7c89832c28a838b0449bbb8a392433ee2 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期二, 22 四月 2025 14:33:02 +0800 Subject: [PATCH] 将华为云短信替换成阿里云短信 --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java | 108 +++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 83 insertions(+), 25 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 8958c81..e8aed9e 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 @@ -1,7 +1,11 @@ package com.ruoyi.account.controller; import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.ruoyi.account.api.model.AgentApplication; import com.ruoyi.account.api.model.AppUser; @@ -11,13 +15,17 @@ import com.ruoyi.account.service.AgentApplicationService; import com.ruoyi.account.service.AppUserService; import com.ruoyi.account.service.UserChangeLogService; +import com.ruoyi.account.service.VipCenterService; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.bean.BeanUtils; import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.other.api.domain.BaseSetting; import com.ruoyi.other.api.domain.VipSetting; +import com.ruoyi.other.api.feignClient.BaseSettingClient; import com.ruoyi.other.api.feignClient.VipSettingClient; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -37,6 +45,14 @@ private AgentApplicationService agentApplicationService; @Resource private AppUserService appUserService; + @Resource + private BaseSettingClient baseSettingClient; + @Resource + private VipCenterService vipCenterService; + @Resource + private VipSettingClient vipSettingClient; + @Resource + private UserChangeLogService userChangeLogService; @PostMapping("/apply") @ApiOperation(value = "会员申请", tags = {"会员中心-小程序"}) @@ -49,28 +65,25 @@ @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) { AgentApplication agentApplication = agentApplicationService.getById(id); + AppUser appUser = appUserService.getById(agentApplication.getAppUserId()); + agentApplication.setShopPoint(appUser.getShopPoint()); + agentApplication.setSharePoint(appUser.getSharePoint()); R<VipSetting> vipSetting = vipSettingClient.getVipSetting(agentApplication.getApplicationVipId()); VipSettingDto vipSettingDto = new VipSettingDto(); BeanUtils.copyProperties(vipSetting.getData(),vipSettingDto); agentApplication.setVipSettingDto(vipSettingDto); + agentApplication.setVipId(agentApplication.getVipId()); return R.ok(agentApplication); } - @Resource - private UserChangeLogService userChangeLogService; + + @GetMapping("/auth") @ApiOperation(value = "会员申请审核", tags = {"会员中心-小程序"}) @@ -79,25 +92,70 @@ 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); + 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); } - userChangeLogService.save(userChangeLog); - //变更会员等级 - byId1.setVipId(byId.getApplicationVipId()); - appUserService.updateById(byId1); return R.ok(byId); } + private Integer getPoint(R<VipSetting> vipSetting, AppUser appUser, Integer basePoint) { + VipSetting vipSettingData = vipSetting.getData(); + Integer vipLevelUpShopRole = vipSettingData.getVipLevelUpShopRole(); + int i = 1; + if (vipLevelUpShopRole == 1){ + i += 1; + } + Integer vipLevelUpNumRole = vipSettingData.getVipLevelUpNumRole(); + if (vipLevelUpNumRole == 1){ + i += 1; + } + + + if (vipCenterService.isEligibleForGlobalPartner(appUser.getId())){ + return basePoint * i; + } + return 0; + } + } -- Gitblit v1.7.1