From d08fe17ae9056598aa82efb85ac81a893f4cdf36 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期日, 28 九月 2025 15:20:43 +0800 Subject: [PATCH] 修改上传e路通bug --- ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java | 35 +++++++++++++++++++++-------------- 1 files changed, 21 insertions(+), 14 deletions(-) diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java index 4b52944..e691c89 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java @@ -26,6 +26,7 @@ import com.ruoyi.chargingPile.service.*; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.common.core.utils.ServletUtils; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageInfo; @@ -128,6 +129,7 @@ * @param number * @return */ + @Log(title = "【扫一扫】通过桩编号获取电站信息", businessType = BusinessType.OTHER,operatorType = OperatorType.MOBILE) @GetMapping("/getSiteInfoByNumber") @ApiOperation(value = "扫一扫后通过桩编号获取电站信息", tags = {"小程序-扫一扫"}) public R<SiteInfoVO> getSiteInfoByNumber(@RequestParam("number") String number){ @@ -148,29 +150,34 @@ && DateUtils.string2LocalTime(tAccountingStrategyDetail.getEndTime() + ("23:59:59".equals(tAccountingStrategyDetail.getEndTime())?"":":00")).compareTo(LocalTime.now()) > 0){ siteInfoVO.setElectrovalence(tAccountingStrategyDetail.getElectrovalence().add(tAccountingStrategyDetail.getServiceCharge()).setScale(4, BigDecimal.ROUND_HALF_UP)); // 获取当前登录用户id - Long userId = tokenService.getLoginUserApplet().getUserId(); - // 根据id查询用户信息 - TAppUser appUser = appUserClient.getUserById(userId).getData(); + // 获取请求携带的令牌 if(Objects.nonNull(byId1.getDiscount())){ siteInfoVO.setVipElectrovalence((tAccountingStrategyDetail.getServiceCharge().multiply(byId1.getDiscount()).add(tAccountingStrategyDetail.getElectrovalence())).setScale(4, BigDecimal.ROUND_HALF_UP)); }else { siteInfoVO.setVipElectrovalence((tAccountingStrategyDetail.getServiceCharge().add(tAccountingStrategyDetail.getElectrovalence())).setScale(4, BigDecimal.ROUND_HALF_UP)); } - if(Objects.nonNull(appUser)){ + String token = SecurityUtils.getToken(ServletUtils.getRequest()); + if(StringUtils.isNotEmpty(token)){ + Long userId = tokenService.getLoginUserApplet().getUserId(); + // 根据id查询用户信息 + TAppUser appUser = appUserClient.getUserById(userId).getData(); + if(Objects.nonNull(appUser)){ // 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(); - if(Objects.nonNull(data1)){ - String vipJson = data1.getVipJson(); - TVip vip = JSON.parseObject(vipJson, TVip.class); - if(Objects.nonNull(vip) && vip.getType() == 2){ - siteInfoVO.setVipElectrovalence(vip.getDiscount().divide(new BigDecimal(10)).multiply(tAccountingStrategyDetail.getServiceCharge()).add(tAccountingStrategyDetail.getElectrovalence())); + GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); + getAppUserVipDetail.setAppUserId(userId); + getAppUserVipDetail.setVipId(appUser.getVipId()); + R<TAppUserVipDetail> appUserVipDetail = vipDetailClient.getAppUserVipDetail(getAppUserVipDetail); + TAppUserVipDetail data1 = appUserVipDetail.getData(); + if(Objects.nonNull(data1)){ + String vipJson = data1.getVipJson(); + TVip vip = JSON.parseObject(vipJson, TVip.class); + if(Objects.nonNull(vip) && vip.getType() == 2){ + siteInfoVO.setVipElectrovalence(vip.getDiscount().divide(new BigDecimal(10)).multiply(tAccountingStrategyDetail.getServiceCharge()).add(tAccountingStrategyDetail.getElectrovalence())); + } } } } + } } siteInfoVO.setChargingGunId(chargingGun.getId()); -- Gitblit v1.7.1