Pu Zhibing
2025-05-08 41600563b0ee8cfad746c359c4d3971169d1c931
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java
@@ -1,18 +1,25 @@
package com.ruoyi.chargingPile.controller;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
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.feignClient.ParkingLotClient;
import com.ruoyi.chargingPile.api.feignClient.SiteClient;
import com.ruoyi.chargingPile.api.model.*;
import com.ruoyi.chargingPile.api.query.GetSiteList;
import com.ruoyi.chargingPile.api.query.SiteDetailQuery;
import com.ruoyi.chargingPile.api.query.SiteQuery;
import com.ruoyi.chargingPile.api.vo.*;
import com.ruoyi.chargingPile.domain.SiteMenu;
import com.ruoyi.chargingPile.api.domain.SiteMenu;
import com.ruoyi.chargingPile.dto.ChargingPercentBack;
import com.ruoyi.common.core.dto.ChargingOrderGroup;
import com.ruoyi.common.core.dto.ChargingPercentProvinceDto;
@@ -24,6 +31,9 @@
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.log.enums.OperatorType;
import com.ruoyi.common.security.annotation.Logical;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.order.api.feignClient.ChargingOrderClient;
@@ -41,13 +51,13 @@
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
@@ -76,7 +86,7 @@
   @Resource
   private RoleSiteClient roleSiteClient;
   @Resource
   private ParkingLotClient parkingLotClient;
   private SysUserRoleClient sysUserRoleClient;
   @Resource
   private TChargingPileService chargingPileService;
   @Resource
@@ -100,7 +110,8 @@
   private TokenService tokenService;
   @Resource
   private AppUserClient appUserClient;
   @Resource
   private AppUserVipDetailClient vipDetailClient;
   /**
    * 根据站点id 查询所有充电桩
@@ -122,24 +133,51 @@
   public R<SiteInfoVO> getSiteInfoByNumber(@RequestParam("number") String number){
      SiteInfoVO siteInfoVO = new SiteInfoVO();
      TChargingGun chargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getFullNumber, number));
      Site site = siteService.getById(chargingGun.getSiteId());
      Integer accountingStrategyId = chargingGun.getAccountingStrategyId();
      if(null == accountingStrategyId){
         accountingStrategyId = site.getAccountingStrategyId();
      }
      TChargingPile one = chargingPileService.getById(chargingGun.getChargingPileId());
      Site byId = siteService.getById(one.getSiteId());
      TAccountingStrategy byId1 = accountingStrategyService.getById(byId.getAccountingStrategyId());
      TAccountingStrategy byId1 = accountingStrategyService.getById(accountingStrategyId);
      List<TAccountingStrategyDetail> list = accountingStrategyDetailService.lambdaQuery().eq(TAccountingStrategyDetail::getAccountingStrategyId, byId1.getId()).list();
      list.stream().filter(item -> "00:00".equals(item.getEndTime())).forEach(item -> item.setEndTime("23:59:59"));
      for (TAccountingStrategyDetail tAccountingStrategyDetail : list) {
         // 当前时间属于那个阶段 取哪个阶段的电价
         if(DateUtils.string2LocalTime(tAccountingStrategyDetail.getStartTime() + ":00").compareTo(LocalTime.now()) <= 0
               && DateUtils.string2LocalTime(tAccountingStrategyDetail.getEndTime() + ("23:59:59".equals(tAccountingStrategyDetail.getEndTime())?"":":00")).compareTo(LocalTime.now()) > 0){
            siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().setScale(4, BigDecimal.ROUND_HALF_UP));
            siteInfoVO.setElectrovalence(tAccountingStrategyDetail.getElectrovalence().setScale(4, BigDecimal.ROUND_HALF_UP));
            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)){
//               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()));
                  }
               }
            }
         }
      }
      siteInfoVO.setChargingGunId(chargingGun.getId());
      siteInfoVO.setChargingPileId(one.getId());
      siteInfoVO.setName(byId.getName());
      siteInfoVO.setName(site.getName());
      siteInfoVO.setNumber(one.getNumber().toString());
      siteInfoVO.setSpaceChargeExplain(byId.getSpaceChargeExplain());
      siteInfoVO.setSpaceChargeExplain(site.getSpaceChargeExplain());
      return R.ok(siteInfoVO);
   }
   /**
@@ -151,25 +189,68 @@
   public R<SiteInfoVO> getSiteInfoByNumber1(@RequestParam("number") String number){
      SiteInfoVO siteInfoVO = new SiteInfoVO();
      TChargingPile one = chargingPileService.lambdaQuery().eq(TChargingPile::getCode, number).one();
      Site byId = siteService.getById(one.getSiteId());
      TAccountingStrategy byId1 = accountingStrategyService.getById(byId.getAccountingStrategyId());
      TChargingGun chargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, one.getId()).last(" limit 0, 1"));
      Site site = siteService.getById(chargingGun.getSiteId());
      Integer accountingStrategyId = chargingGun.getAccountingStrategyId();
      if(null == accountingStrategyId){
         accountingStrategyId = site.getAccountingStrategyId();
      }
      TAccountingStrategy byId1 = accountingStrategyService.getById(accountingStrategyId);
      List<TAccountingStrategyDetail> list = accountingStrategyDetailService.lambdaQuery().eq(TAccountingStrategyDetail::getAccountingStrategyId, byId1.getId()).list();
      list.stream().filter(item -> "00:00".equals(item.getEndTime())).forEach(item -> item.setEndTime("23:59:59"));
      for (TAccountingStrategyDetail tAccountingStrategyDetail : list) {
         // 当前时间属于那个阶段 取哪个阶段的电价
         if(DateUtils.string2LocalTime(tAccountingStrategyDetail.getStartTime() + ":00").compareTo(LocalTime.now()) <= 0
               && DateUtils.string2LocalTime(tAccountingStrategyDetail.getEndTime() + ("23:59:59".equals(tAccountingStrategyDetail.getEndTime())?"":":00")).compareTo(LocalTime.now()) > 0){
            siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().setScale(4, BigDecimal.ROUND_HALF_UP));
            siteInfoVO.setElectrovalence(tAccountingStrategyDetail.getElectrovalence().setScale(4, BigDecimal.ROUND_HALF_UP));
            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)){
//               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()));
                  }
               }
            }
         }
      }
      List<TVip> vips = vipClient.getVipList().getData();
      if(!CollectionUtils.isEmpty(vips)){
         TVip tVip = vips.get(0);
         JSONArray objects = JSONArray.parseArray(tVip.getCoupon());
         Integer num = 0;
         for (Object object : objects) {
            JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object));
            Integer number1 = jsonObject.getInteger("number");
            num += number1;
         }
         siteInfoVO.setCouponCount(num);
      }
      siteInfoVO.setChargingPileId(one.getId());
      siteInfoVO.setName(byId.getName());
      siteInfoVO.setName(site.getName());
      siteInfoVO.setNumber(one.getNumber().toString());
      siteInfoVO.setSpaceChargeExplain(byId.getSpaceChargeExplain());
      siteInfoVO.setSpaceChargeExplain(site.getSpaceChargeExplain());
      return R.ok(siteInfoVO);
   }
   
   @RequiresPermissions(value = {"/systemUserManagement/update", "/site", "/platformRevenueAnalysis", "/chargingOperationAnalysis",
         "/chargingUserAnalysis", "/operationMaintenanceAnalysis", "/chargingEquipmentMonitoring", "/activityExpense", "/chargeEvaluation/list",
         "/parkingLot", "/workbench"}, logical = Logical.OR)
   @GetMapping("/getSiteList")
   @ApiOperation(value = "获取站点列表", tags = {"管理后台-站点管理"})
   public AjaxResult<PageInfo<GetSiteListDTO>> getSiteList(GetSiteList siteList){
@@ -184,9 +265,10 @@
      PageInfo<GetSiteListDTO> list = siteService.getSiteList1(userId);
      return R.ok(list.getRecords());
   }
   @RequiresPermissions(value = {"/chargeDistribution"}, logical = Logical.OR)
   @GetMapping("/map/getSiteList")
   @ApiOperation(value = "获取站点", tags = {"管理后台-数据分析-电站分析"})
   public R<List<GetSiteListDTO>> getMapSiteList(GetSiteList siteList){
@@ -195,17 +277,22 @@
      siteList.setPageSize(99999);
      PageInfo<GetSiteListDTO> list = siteService.getSiteList(siteList);
      for (GetSiteListDTO record : list.getRecords()) {
         Long count = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count();
         List<Integer> c1 = new ArrayList<>();
         c1.add(3);
         c1.add(4);
         c1.add(5);
         c1.add(6);
         Long count = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, 2).count();
         record.setC1(count);
         Long count1 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, 2).count();
         Long count1 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).count();
         record.setC2(count1);
         Long count2 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, 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, 2).count();
         record.setK1(count2);
         Long count3 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, 2).count();
         Long count3 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).count();
         record.setK2(count3);
         Long count4 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, 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, 2).count();
         record.setM1(count4);
         Long count5 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, 2).count();
         Long count5 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).count();
         record.setM2(count5);
         //利用率
@@ -223,14 +310,15 @@
         }
         BigDecimal multiply = bigDecimal1.multiply(new BigDecimal("24"));
         BigDecimal divide = bigDecimal.divide(multiply, 0, BigDecimal.ROUND_HALF_UP);
         BigDecimal divide = bigDecimal.divide(multiply, 4, BigDecimal.ROUND_HALF_EVEN).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_EVEN);
         record.setP1(divide);
      }
      return R.ok(list.getRecords());
   }
   @RequiresPermissions(value = {"/chargeDistribution"}, logical = Logical.OR)
   @GetMapping("/map/getPercent")
   @ApiOperation(value = "获取该充电站的利用率", tags = {"管理后台-数据分析-电站分析"})
   public R getPercent(Integer siteId){
@@ -254,22 +342,39 @@
      return R.ok(divide);
   }
   @RequiresPermissions(value = {"/chargeDistribution"}, logical = Logical.OR)
   @PostMapping("/map/getPercentByprovinceCode")
   @ApiOperation(value = "获取该充电站的利用率", tags = {"管理后台-数据分析-电站分析"})
   public R getPercentByCityCode(@RequestBody ChargingPercentProvinceDto chargingPercentProvinceDto){
      if (chargingPercentProvinceDto.getDate1()==null){
         LocalDate today = LocalDate.now();
         LocalDate lastMonth = today.minusMonths(1);
         LocalDate firstDayOfLastMonth = lastMonth.withDayOfMonth(1);
         LocalDate lastDayOfLastMonth =lastMonth.withDayOfMonth(lastMonth.lengthOfMonth());
         chargingPercentProvinceDto.setDate1(firstDayOfLastMonth);
         chargingPercentProvinceDto.setDate2(lastDayOfLastMonth);
      Set<Integer> ids = null;
      //校验合作商权限
      SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData();
      Integer roleType = sysUser.getRoleType();
      Integer objectId = sysUser.getObjectId();
      R<Integer> admin = sysUserClient.isAdmin(SecurityUtils.getUserId());
      //合作商
      if(roleType == 2){
         ids = partnerService.authSite(objectId, SiteMenu.SITE_LIST);
      }else{
         //非管理员需要根据角色和用户配置查询允许的站点数据
         //改用roleId=1来判断
         if(admin.getData()!=1){
            List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData();
            List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData();
            if(data2.size() > 0){
               List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData();
               data.addAll(data1);
            }
            ids = new HashSet<>(data);
         }
      }
      chargingPercentProvinceDto.setSiteIds(ids);
      GetSiteList siteList = new GetSiteList();
@@ -282,7 +387,10 @@
      List<GetSiteListDTO> records = siteService.getSiteList(siteList).getRecords();
      List<Integer> collect = records.stream().map(GetSiteListDTO::getId).collect(Collectors.toList());
      // 通过时间段获取和充电桩id获取各个充电站的充电订单
         List<ChargingOrderGroup> data = chargingOrderClient.getBySiteIdAndTime(chargingPercentProvinceDto).getData();
      if (chargingPercentProvinceDto.getDate1().equals(chargingPercentProvinceDto.getDate2())){
         chargingPercentProvinceDto.setDate2(chargingPercentProvinceDto.getDate1().plusDays(1));
      }
      List<ChargingOrderGroup> data = chargingOrderClient.getBySiteIdAndTime(chargingPercentProvinceDto).getData();
      // 计算利用率展示
      for (ChargingOrderGroup datum : data) {
         List<TChargingPile> chargingPiles = chargingPileService.lambdaQuery().eq(TChargingPile::getSiteId, datum.getSiteId()).list();
@@ -291,7 +399,7 @@
            bigDecimal1 = bigDecimal1.add(chargingPile.getRatedPower());
         }
         long daysBetween = ChronoUnit.DAYS.between(chargingPercentProvinceDto.getDate1(), chargingPercentProvinceDto.getDate2()) + 1;
         long daysBetween = ChronoUnit.DAYS.between(chargingPercentProvinceDto.getDate1(), chargingPercentProvinceDto.getDate2());
         BigDecimal multiply = bigDecimal1.multiply(new BigDecimal("24")).multiply(BigDecimal.valueOf(daysBetween));
         //得到利用率
         BigDecimal divide = datum.getChargingCapacity().divide(multiply, 0, BigDecimal.ROUND_HALF_UP);
@@ -323,30 +431,41 @@
   public AjaxResult<List<Site>> getSiteList1(){
      return AjaxResult.success(siteService.list(new QueryWrapper<>()));
   }
   @RequiresPermissions(value = {"/systemUserManagement", "/site", "/faultInformationList", "/repairRecord", "/balanceSheetRecord", "/chargingPileOrder",
         "/chargeOrderMonitoring", "/chargingPile", "/chargingGun"}, logical = Logical.OR)
   @GetMapping("/getSiteListGun")
   @ApiOperation(value = "获取站点列表 不分页", tags = {"管理后台-接口信息使用"})
   public AjaxResult<List<Site>> getSiteListGun(){
      return AjaxResult.success(siteService.getSiteListGun());
   }
   @RequiresPermissions(value = {"/parkingLot/add", "/parkingLot/select", "/parkingLot/update"}, logical = Logical.OR)
   @GetMapping("/getSiteListParkLot")
   @ApiOperation(value = "获取站点列表不分页", tags = {"管理后台-停车场绑定"})
   public AjaxResult<List<Site>> getSiteListParkLot(){
      return AjaxResult.success(siteService.getSiteListParkLot());
   }
   @ApiOperation(value = "获取站点分页列表", tags = {"小程序-站点管理-首页"})
   @PostMapping("/pageList")
   public AjaxResult<PageInfo<SiteVO>> pageList(@Validated @RequestBody SiteQuery query, HttpServletRequest request){
      int isLogin = StringUtils.isEmpty(SecurityUtils.getToken(request)) ? 0 : 1;
      return AjaxResult.success(siteService.pageList(query,isLogin));
   }
   @ApiOperation(value = "获取站点列表", tags = {"小程序-站点管理-地图导航站点"})
   @PostMapping("/getMapSiteList")
   public AjaxResult<List<SiteVO>> getMapSiteList(@Validated @RequestBody SiteQuery query){
      return AjaxResult.success(siteService.getMapSiteList(query));
   public AjaxResult<List<SiteVO>> getMapSiteList(@Validated @RequestBody SiteQuery query, HttpServletRequest request){
      int isLogin = StringUtils.isEmpty(SecurityUtils.getToken(request)) ? 0 : 1;
      return AjaxResult.success(siteService.getMapSiteList(query,isLogin));
   }
   @ApiOperation(value = "获取站点详细信息", tags = {"小程序-站点管理-站点详情"})
   @PostMapping("/getDetailById")
   public AjaxResult<SiteDetailVO> getDetailById(@Validated @RequestBody SiteDetailQuery query){
@@ -367,7 +486,8 @@
      }
      return AjaxResult.success(siteDetailVO);
   }
   @ApiOperation(value = "获取站点下充电桩及充电枪列表", tags = {"小程序-站点管理-站点详情"})
   @GetMapping("/getChargingGunList")
   public AjaxResult<List<TChargingPileVO>> getChargingGunList(@RequestParam(value = "siteId")@ApiParam(value = "站点id", required = true)Integer siteId,
@@ -375,13 +495,20 @@
      return AjaxResult.success(chargingPileService.getChargingGunList(siteId,type));
   }
   @ApiOperation(value = "获取站点下充电枪数量统计", tags = {"小程序-站点管理-站点详情","管理后台-数据分析-电站分析"})
   @ApiOperation(value = "获取站点下充电枪数量统计", tags = {"管理后台-数据分析-电站分析"})
   @GetMapping("/getChargingGunCount")
   public AjaxResult<Map<String,ChargingGunCountVO>> getChargingGunCount(@RequestParam(value = "siteId")@ApiParam(value = "站点id", required = true)Integer siteId){
      return AjaxResult.success(chargingGunService.getChargingGunCount(siteId));
   }
   
   @ApiOperation(value = "获取站点下充电枪数量统计", tags = {"小程序-站点管理-站点详情"})
   @GetMapping("/getChargingGunCount1")
   public AjaxResult<Map<String,ChargingGunCountVO>> getChargingGunCount1(@RequestParam(value = "siteId")@ApiParam(value = "站点id", required = true)Integer siteId){
      return AjaxResult.success(chargingGunService.getChargingGunCount(siteId));
   }
   @RequiresPermissions(value = {"/site/add"}, logical = Logical.OR)
   @ResponseBody
   @PostMapping("/addSite")
   @ApiOperation(value = "添加站点", tags = {"管理后台-站点管理"})
@@ -392,6 +519,7 @@
   
   
   
   @RequiresPermissions(value = {"/site/update"}, logical = Logical.OR)
   @ResponseBody
   @PostMapping("/getSiteInfo/{id}")
   @ApiOperation(value = "获取站点详情", tags = {"管理后台-站点管理"})
@@ -402,6 +530,7 @@
   
   
   
   @RequiresPermissions(value = {"/site/update"}, logical = Logical.OR)
   @ResponseBody
   @PostMapping("/editSite")
   @ApiOperation(value = "编辑站点", tags = {"管理后台-站点管理"})
@@ -410,6 +539,9 @@
      return siteService.editSite(site);
   }
   
   @RequiresPermissions(value = {"/site/del", "/site/batch_del"}, logical = Logical.OR)
   @ResponseBody
   @DeleteMapping("/delSite")
   @ApiOperation(value = "删除站点", tags = {"管理后台-站点管理"})
@@ -422,6 +554,8 @@
   }
   
   
   @RequiresPermissions(value = {"/site/accounting_strategy"}, logical = Logical.OR)
   @ResponseBody
   @PostMapping("/setAccountingStrategy/{id}")
   @ApiOperation(value = "设置站点计费策略", tags = {"管理后台-站点管理"})
@@ -436,12 +570,14 @@
   }
   
   
   @RequiresPermissions(value = {"/roleManagement/add", "/roleManagement/info", "/roleManagement/update", "/systemNotification", "/chargingPeriodStatistics",
         "/parkingPaymentOrder", "/generateStatement", "/chargingPile/add", "/chargingPile/select", "/chargingPile/update"}, logical = Logical.OR)
   @ResponseBody
   @GetMapping("/getAllSiteList")
   @ApiOperation(value = "获取所有站点数据", tags = {"管理后台-充电桩信息", "管理后台-系统用户管理", "管理后台-角色管理", "管理后台-系统通知", "管理后台-充电评价"})
   public AjaxResult<List<Site>> getAllSiteList(){
      //校验当前账户站点权限
      SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData();
      SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData();
      Integer roleType = sysUser.getRoleType();
      Integer objectId = sysUser.getObjectId();
      LambdaQueryWrapper<Site> wrapper = new LambdaQueryWrapper<Site>().eq(Site::getDelFlag, 0);
@@ -450,7 +586,7 @@
         wrapper.in(Site::getId, list);
      }else{
         //非管理员需要根据角色和用户配置查询允许的站点数据
         if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){
         if(!SecurityUtils.isAdmin(tokenService.getLoginUser().getUserid())){
            List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData();
            List<SysUserRoleVo> data2 = userRoleClient.getRoleByUserId(sysUser.getUserId()).getData();
            List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData();
@@ -487,4 +623,33 @@
      List<Site> list = siteService.list(new LambdaQueryWrapper<Site>().eq(Site::getDelFlag, 0));
      return R.ok(list);
   }
   /**
    * 分页查询站电数据
    * @param PageNo
    * @param PageSize
    * @return
    */
   @PostMapping("/getSiteListPaging")
   public PageInfo<Site> getSiteListPaging(@RequestParam("PageNo") Integer PageNo, @RequestParam("PageSize") Integer PageSize,
                                           @RequestParam("ids") List<String> ids){
      PageInfo<Site> pageInfo = new PageInfo<>(PageNo, PageSize);
      PageInfo<Site> page = siteService.lambdaQuery().eq(Site::getStatus, 1).in(ids.size() > 0, Site::getId, ids)
            .ne(Site::getSiteType, 2).page(pageInfo);
      return page;
   }
   /**
    * 分页查询站电数据
    * @param PageNo
    * @param PageSize
    * @return
    */
   @PostMapping("/getSiteListPagingJianGuan")
   public PageInfo<Site> getSiteListPagingJianGuan(@RequestParam("PageNo") Integer PageNo, @RequestParam("PageSize") Integer PageSize,
                                           @RequestParam("ids") List<String> ids){
      PageInfo<Site> pageInfo = new PageInfo<>(PageNo, PageSize);
      PageInfo<Site> page = siteService.lambdaQuery().eq(Site::getStatus, 1).in(ids.size() > 0, Site::getId, ids).page(pageInfo);
      return page;
   }
}