xuhy
2024-10-26 006388b29f309e1072e1e686a9cb3661debe6b7d
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java
@@ -110,10 +110,8 @@
   @ApiOperation(value = "扫一扫后通过桩编号获取电站信息", tags = {"小程序-扫一扫"})
   public R<SiteInfoVO> getSiteInfoByNumber(@RequestParam("number") String number){
      SiteInfoVO siteInfoVO = new SiteInfoVO();
      String chargingPileCode = number.substring(0, number.length() - 2);
      String chargingGunCode = number.substring(number.length() - 2);
      TChargingPile one = chargingPileService.lambdaQuery().eq(TChargingPile::getCode, chargingPileCode).one();
      TChargingGun chargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getCode, chargingGunCode).eq(TChargingGun::getChargingPileId, one.getId()));
      TChargingGun chargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getFullNumber, number));
      TChargingPile one = chargingPileService.getById(chargingGun.getChargingPileId());
      Site byId = siteService.getById(one.getSiteId());
      TAccountingStrategy byId1 = accountingStrategyService.getById(byId.getAccountingStrategyId());
      List<TAccountingStrategyDetail> list = accountingStrategyDetailService.lambdaQuery().eq(TAccountingStrategyDetail::getAccountingStrategyId, byId1.getId()).list();
@@ -121,7 +119,11 @@
         // 当前时间属于那个阶段 取哪个阶段的电价
         if(LocalTime.now().isAfter(LocalTime.parse(tAccountingStrategyDetail.getStartTime())) && LocalTime.now().isBefore(LocalTime.parse(tAccountingStrategyDetail.getEndTime()))){
            siteInfoVO.setElectrovalence(tAccountingStrategyDetail.getElectrovalence());
            siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().multiply(byId1.getDiscount()).setScale(4, BigDecimal.ROUND_HALF_UP));
            if(null != byId1.getDiscount()){
               siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().multiply(byId1.getDiscount()).setScale(4, BigDecimal.ROUND_HALF_UP));
            }else{
               siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence());
            }
         }
      }
      siteInfoVO.setChargingGunId(chargingGun.getId());
@@ -147,7 +149,11 @@
         // 当前时间属于那个阶段 取哪个阶段的电价
         if(LocalTime.now().isAfter(LocalTime.parse(tAccountingStrategyDetail.getStartTime())) && LocalTime.now().isBefore(LocalTime.parse(tAccountingStrategyDetail.getEndTime()))){
            siteInfoVO.setElectrovalence(tAccountingStrategyDetail.getElectrovalence());
            siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().multiply(byId1.getDiscount()).setScale(4, BigDecimal.ROUND_HALF_UP));
            if(null != byId1.getDiscount()){
               siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().multiply(byId1.getDiscount()).setScale(4, BigDecimal.ROUND_HALF_UP));
            }else{
               siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence());
            }
         }
      }
      siteInfoVO.setChargingPileId(one.getId());
@@ -182,17 +188,17 @@
      siteList.setPageSize(99999);
      PageInfo<GetSiteListDTO> list = siteService.getSiteList(siteList);
      for (GetSiteListDTO record : list.getRecords()) {
         Long count = chargingGunService.lambdaQuery().eq(TChargingGun::getChargingPileId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count();
         Long count = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count();
         record.setC1(count);
         Long count1 = chargingGunService.lambdaQuery().eq(TChargingGun::getChargingPileId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, 2).count();
         Long count1 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, 2).count();
         record.setC2(count1);
         Long count2 = chargingGunService.lambdaQuery().eq(TChargingGun::getChargingPileId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count();
         Long count2 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count();
         record.setK1(count2);
         Long count3 = chargingGunService.lambdaQuery().eq(TChargingGun::getChargingPileId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, 2).count();
         Long count3 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, 2).count();
         record.setK2(count3);
         Long count4 = chargingGunService.lambdaQuery().eq(TChargingGun::getChargingPileId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count();
         Long count4 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count();
         record.setM1(count4);
         Long count5 = chargingGunService.lambdaQuery().eq(TChargingGun::getChargingPileId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, 2).count();
         Long count5 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, 2).count();
         record.setM2(count5);
         //利用率