From 6cbe15b5456b1b6a10ef74046f2b69a2ed85cbda Mon Sep 17 00:00:00 2001 From: luodangjia <luodangjia> Date: 星期四, 31 十月 2024 15:40:15 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TInviteUserServiceImpl.java | 36 +++++++++++++++++ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java | 8 ++++ ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/SiteServiceImpl.java | 29 ++++++++++++-- 3 files changed, 67 insertions(+), 6 deletions(-) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TInviteUserServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TInviteUserServiceImpl.java index 85ec054..692caa6 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TInviteUserServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TInviteUserServiceImpl.java @@ -1,16 +1,26 @@ package com.ruoyi.account.service.impl; +import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.account.api.feignClient.AppUserVipDetailClient; +import com.ruoyi.account.api.model.TAppUser; +import com.ruoyi.account.api.model.TAppUserVipDetail; import com.ruoyi.account.api.model.TInviteUser; +import com.ruoyi.account.api.vo.GetAppUserVipDetail; import com.ruoyi.account.mapper.TInviteUserMapper; +import com.ruoyi.account.service.TAppUserService; import com.ruoyi.account.service.TInviteUserService; +import com.ruoyi.common.core.domain.R; import com.ruoyi.other.api.domain.TIntegralRule; +import com.ruoyi.other.api.domain.TVip; import com.ruoyi.other.api.feignClient.IntegralRuleClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.time.LocalDateTime; +import java.util.Objects; /** * <p> @@ -25,9 +35,29 @@ @Autowired private IntegralRuleClient integralRuleClient; + @Autowired + private TAppUserService appUserService; + @Resource + private AppUserVipDetailClient vipDetailClient; + /** + * + * @param appUserId 被邀请人 + * @param beInvitedAppUserId 邀请人 + */ @Override public void saveInviteUser(Long appUserId, Long beInvitedAppUserId) { + + // 查询用户信息 + TAppUser user = appUserService.getById(beInvitedAppUserId); + GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); + getAppUserVipDetail.setAppUserId(beInvitedAppUserId); + getAppUserVipDetail.setVipId(user.getVipId()); + R<TAppUserVipDetail> appUserVipDetail = vipDetailClient.getAppUserVipDetail(getAppUserVipDetail); + TAppUserVipDetail data1 = appUserVipDetail.getData(); + String vipJson = data1.getVipJson(); + TVip vip = JSON.parseObject(vipJson, TVip.class); + // 查询邀请用户获得积分配置 TIntegralRule integralRule = integralRuleClient.getSet().getData(); JSONObject jsonObject = JSONObject.parseObject(integralRule.getInviteUsersToEarnPoints()); @@ -35,7 +65,11 @@ inviteUser.setAppUserId(beInvitedAppUserId); inviteUser.setBeInvitedAppUserId(appUserId); inviteUser.setCreateTime(LocalDateTime.now()); - inviteUser.setAward(jsonObject.getInteger("num1")); + if(Objects.nonNull(vip) && vip.getDoubleIntegration() == 1){ + inviteUser.setAward(jsonObject.getInteger("num1")*2); + }else { + inviteUser.setAward(jsonObject.getInteger("num1")); + } this.save(inviteUser); } } diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/SiteServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/SiteServiceImpl.java index 627d205..3a4d301 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/SiteServiceImpl.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/SiteServiceImpl.java @@ -1,9 +1,13 @@ package com.ruoyi.chargingPile.service.impl; +import com.alibaba.fastjson2.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.account.api.feignClient.AppUserClient; +import com.ruoyi.account.api.feignClient.AppUserVipDetailClient; import com.ruoyi.account.api.model.TAppUser; +import com.ruoyi.account.api.model.TAppUserVipDetail; +import com.ruoyi.account.api.vo.GetAppUserVipDetail; import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; import com.ruoyi.chargingPile.api.model.Site; import com.ruoyi.chargingPile.api.model.TChargingGun; @@ -81,7 +85,8 @@ @Resource private IntegrationClient integrationClient; - + @Resource + private AppUserVipDetailClient vipDetailClient; /** @@ -287,9 +292,9 @@ @Override public PageInfo<SiteVO> pageList(SiteQuery query,Integer isLogin) { TAppUser appUser = null; + // 获取当前登录用户id + Long userId = tokenService.getLoginUserApplet().getUserId(); if(isLogin == 1){ - // 获取当前登录用户id - Long userId = tokenService.getLoginUserApplet().getUserId(); // 根据id查询用户信息 appUser = appUserClient.getUserById(userId).getData(); } @@ -297,7 +302,14 @@ List<SiteVO> list = this.baseMapper.pageList(query,pageInfo); if(Objects.nonNull(appUser) && Objects.nonNull(appUser.getVipId())){ // 查询会员信息 - TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); +// TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); + GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); + getAppUserVipDetail.setAppUserId(userId); + getAppUserVipDetail.setVipId(appUser.getVipId()); + R<TAppUserVipDetail> appUserVipDetail = vipDetailClient.getAppUserVipDetail(getAppUserVipDetail); + TAppUserVipDetail data1 = appUserVipDetail.getData(); + String vipJson = data1.getVipJson(); + TVip vip = JSON.parseObject(vipJson, TVip.class); if(Objects.nonNull(vip) && vip.getType() == 2){ list.forEach(item -> { if(Objects.nonNull(vip.getDiscount())){ @@ -387,7 +399,14 @@ List<SiteVO> list = this.baseMapper.getMapSiteList(query); if(Objects.nonNull(appUser) && Objects.nonNull(appUser.getVipId())){ // 查询会员信息 - TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); +// TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); + GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); + getAppUserVipDetail.setAppUserId(userId); + getAppUserVipDetail.setVipId(appUser.getVipId()); + R<TAppUserVipDetail> appUserVipDetail = vipDetailClient.getAppUserVipDetail(getAppUserVipDetail); + TAppUserVipDetail data1 = appUserVipDetail.getData(); + String vipJson = data1.getVipJson(); + TVip vip = JSON.parseObject(vipJson, TVip.class); if(Objects.nonNull(vip) && vip.getType() == 2){ list.forEach(item -> { item.setVipElectrovalence(vip.getDiscount().divide(new BigDecimal(10)).multiply(item.getServiceCharge()).add(item.getElectrovalenceOriginal())); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java index f25778c..5716b77 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java @@ -187,7 +187,15 @@ break; } } + + List<Long> appUserIds = list.stream().map(TActivityStatisticslVO::getAppUserId).collect(Collectors.toList()); + List<TAppUser> appUsers = appUserClient.getUserByIds(appUserIds).getData(); + for (TActivityStatisticslVO tActivityStatisticslVO : list) { + TAppUser appUser = appUsers.stream().filter(user -> user.getId().equals(tActivityStatisticslVO.getAppUserId())).findFirst().orElse(null); + if(Objects.nonNull(appUser)){ + tActivityStatisticslVO.setPhone(appUser.getPhone()); + } // 判断享有了哪些类型 switch (tActivityStatisticslVO.getOrderType()){ case 1: -- Gitblit v1.7.1