Pu Zhibing
2025-01-17 ec759e2c4e9340a1f447dec93ce4742c1c8c132a
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java
@@ -1,5 +1,6 @@
package com.ruoyi.account.controller;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -24,6 +25,7 @@
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;
@@ -47,6 +49,10 @@
    private BaseSettingClient baseSettingClient;
    @Resource
    private VipCenterService vipCenterService;
    @Resource
    private VipSettingClient vipSettingClient;
    @Resource
    private UserChangeLogService userChangeLogService;
    @PostMapping("/apply")
    @ApiOperation(value = "会员申请", tags = {"会员中心-小程序"})
@@ -59,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 = {"会员中心-小程序"})
@@ -116,7 +119,7 @@
            Integer point = getPoint(vipSetting, byId1, basePoint);
            byId1.setPartPoint(point);
            // 上级计算培育积分
            R<BaseSetting> baseSetting2 = baseSettingClient.getBaseSetting(1);
            R<BaseSetting> baseSetting2 = baseSettingClient.getBaseSetting(2);
            BaseSetting data2 = baseSetting2.getData();
            int basePoint2 = Integer.parseInt(data2.getContent());
            Long inviteUserId = byId1.getInviteUserId();
@@ -124,6 +127,7 @@
            if (byId2 != null){
                Integer point1 = getPoint(vipSetting, byId2, basePoint2);
                byId2.setPartGrowPoint(point1);
                appUserService.updateById(byId2);
            }
        }