| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.VipCenterService; |
| | | import com.ruoyi.account.service.VipSettingService; |
| | | import com.ruoyi.account.vo.vip.Level; |
| | | import com.ruoyi.account.vo.vip.VipLevel; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.other.api.feignClient.BaseSettingClient; |
| | | import com.ruoyi.other.api.feignClient.GoodsVipClient; |
| | | import com.ruoyi.other.api.feignClient.RemoteVipSettingClient; |
| | | import com.ruoyi.other.api.feignClient.VipGoodClient; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.extern.log4j.Log4j2; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private VipGoodClient vipGoodClient; |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | private VipCenterService vipCenterService; |
| | | |
| | | |
| | | @GetMapping("getVipLevelList") |
| | |
| | | public R<VipLevel> vipLevelList() { |
| | | try { |
| | | R<List<VipSetting>> r = remoteVipSettingClient.list(); |
| | | if (!checkSuccess(r)) { |
| | | if (checkSuccess(r)) { |
| | | return R.fail("会员等级获取失败"); |
| | | } |
| | | List<VipSetting> vipSettingList = r.getData(); |
| | |
| | | } |
| | | |
| | | R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(3); |
| | | if (!checkSuccess(baseSettingR)) { |
| | | if (checkSuccess(baseSettingR)) { |
| | | log.error("【会员设置说明】获取失败:{}", baseSettingR.getMsg()); |
| | | return R.fail("会员等级获取失败"); |
| | | } |
| | |
| | | |
| | | vipSettingList.forEach(vipSetting -> { |
| | | Level level = new Level(); |
| | | level.setId(vipSetting.getId()); |
| | | level.setName(vipSetting.getVipName()); |
| | | level.setVipInfo(vipSetting.getVipInfo()); |
| | | BeanUtils.copyBeanProp(level, vipSetting); |
| | | level.setVipDesc(baseSetting.getContent()); |
| | | level.setVipLevelUpShop(vipSetting.getVipLevelUpShop()); |
| | | level.setVipLevelUpShare(vipSetting.getVipLevelUpShare()); |
| | | level.setKeepBuyDay(vipSetting.getKeepBuyDay()); |
| | | level.setKeepBuyPoint(vipSetting.getKeepBuyPoint()); |
| | | level.setKeepShareDay(vipSetting.getKeepShareDay()); |
| | | level.setKeepSharePoint(vipSetting.getKeepSharePoint()); |
| | | level.setKeepShopDay(vipSetting.getKeepShopDay()); |
| | | level.setKeepShopPoint(vipSetting.getKeepShopPoint()); |
| | | |
| | | R<GoodsVip> goodsVipR = goodsVipMap.get(vipSetting.getId()); |
| | | if (R.isSuccess(goodsVipR)) { |
| | |
| | | } |
| | | |
| | | |
| | | public R<Void> test() { |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | AppUser appUser = appUserService.getById(loginUserApplet.getUserid()); |
| | | if (appUser.getShopPoint() < 500){ |
| | | return R.fail("消费积分不足500"); |
| | | } |
| | | if (appUser.getSharePoint() < 500){ |
| | | return R.fail("返佣积分不足500"); |
| | | } |
| | | // 当前用户的直推用户 |
| | | // List<AppUser> bottomUsers = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | // .eq(AppUser::getInviteUserId, loginUserApplet.getUserid()) |
| | | // .eq(AppUser::getVipId)); |
| | | |
| | | return null; |
| | | @GetMapping("/check") |
| | | @ApiOperation(value = "会员申请检查", tags = {"会员中心-小程序"}) |
| | | public R<Boolean> check(@ApiParam("4:准代理,5:代理,6:总代理,7:合伙人") @RequestParam Integer type) { |
| | | return R.ok(vipCenterService.check(type)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | private boolean checkSuccess(R<?> r) { |