| | |
| | | package com.ruoyi.account.controller; |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.AgentApplication; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserChangeLog; |
| | | import com.ruoyi.account.dto.AgentQuery; |
| | | import com.ruoyi.account.service.AgentApplicationService; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.UserChangeLogService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | |
| | | public class AgentApplicationController extends BaseController { |
| | | @Resource |
| | | private AgentApplicationService agentApplicationService; |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | |
| | | @PostMapping("/apply") |
| | | @ApiOperation(value = "会员申请", tags = {"会员中心-小程序"}) |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/page") |
| | | @ApiOperation(value = "会员申请列表", tags = {"后台"}) |
| | | public R<IPage<AgentApplication>> page(@RequestBody AgentQuery agentQuery) { |
| | | |
| | | return R.ok(agentApplicationService.pageList(agentQuery)); |
| | | } |
| | | @GetMapping("/detail") |
| | | @ApiOperation(value = "会员申请详情", tags = {"会员中心-小程序"}) |
| | | public R<AgentApplication> detail(@RequestParam Long id) { |
| | | |
| | | return R.ok(agentApplicationService.getById(id)); |
| | | } |
| | | @Resource |
| | | private UserChangeLogService userChangeLogService; |
| | | |
| | | @GetMapping("/auth") |
| | | @ApiOperation(value = "会员申请审核", tags = {"会员中心-小程序"}) |
| | | public R<AgentApplication> auth(@RequestParam Long id, @ApiParam("2'已处理-同意',3'已处理-拒绝")Integer status,@ApiParam("处理意见") String remark) { |
| | | AgentApplication byId = agentApplicationService.getById(id); |
| | | 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()); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | |
| | | } |
| | | |