From 21dbee73f1310f6c57efdc70982d58e354154183 Mon Sep 17 00:00:00 2001 From: luodangjia <luodangjia> Date: 星期四, 31 十月 2024 09:33:59 +0800 Subject: [PATCH] merge --- ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/SiteServiceImpl.java | 33 ++++++++++++++++++++++++++++----- 1 files changed, 28 insertions(+), 5 deletions(-) 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 44d5079..6bd9fe3 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 @@ -18,12 +18,14 @@ import com.ruoyi.chargingPile.domain.SiteMenu; import com.ruoyi.chargingPile.mapper.SiteMapper; import com.ruoyi.chargingPile.service.*; +import com.ruoyi.common.core.domain.R; 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; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.integration.api.feignClient.IntegrationClient; import com.ruoyi.other.api.domain.TVip; import com.ruoyi.other.api.feignClient.RoleSiteClient; import com.ruoyi.other.api.feignClient.UserSiteClient; @@ -76,6 +78,9 @@ private SysUserRoleClient sysUserRoleClient; @Resource private TParkingLotService parkingLotService; + + @Resource + private IntegrationClient integrationClient; @@ -84,6 +89,7 @@ * @param siteList * @return */ + @Override public PageInfo<GetSiteListDTO> getSiteList(GetSiteList siteList) { Set<Integer> ids = null; @@ -91,12 +97,15 @@ 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{ //非管理员需要根据角色和用户配置查询允许的站点数据 - if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ + //改用roleId=1来判断 + if(admin.getData()!=1){ +// if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); if(data2.size() > 0){ @@ -130,12 +139,14 @@ SysUser sysUser = sysUserClient.getSysUser(userId).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{ //非管理员需要根据角色和用户配置查询允许的站点数据 - if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ + if(admin.getData()!=1){ List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); @@ -324,9 +335,15 @@ } // 查询所有的停车场的站点id List<TParkingLot> list = parkingLotService.list(); - List<Integer> siteIds = list.stream().map(TParkingLot::getSiteId).collect(Collectors.toList()); + List<Integer> siteIds = list.stream().map(TParkingLot::getSiteId).distinct().collect(Collectors.toList()); if(!CollectionUtils.isEmpty(ids) && !CollectionUtils.isEmpty(siteIds)){ - ids.addAll(siteIds); + Iterator<Integer> iterator = ids.iterator(); + while (iterator.hasNext()){ + Integer next = iterator.next(); + if(siteIds.contains(next)){ + iterator.remove(); + } + } } return this.baseMapper.getSiteListParkLot(ids); } @@ -390,10 +407,16 @@ Site site = this.getById(id); site.setAccountingStrategyId(accountingStrategyId); this.updateById(site); - List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().in(TChargingGun::getChargingPileId, id).eq(TChargingGun::getDelFlag, 0)); + List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().in(TChargingGun::getSiteId, id).eq(TChargingGun::getDelFlag, 0)); for (TChargingGun tChargingGun : list) { tChargingGun.setAccountingStrategyId(accountingStrategyId); } chargingGunService.updateBatchById(list); + + //下发硬件数据 + List<TChargingPile> list1 = chargingPileService.lambdaQuery().eq(TChargingPile::getSiteId, id).eq(TChargingPile::getDelFlag, 0).list(); + for (TChargingPile tChargingPile : list1) { + integrationClient.setupBillingModel1(tChargingPile.getCode()); + } } } -- Gitblit v1.7.1