| | |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.api.vo.TMonitoringEquipmentVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.TChargingGunMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | 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.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class TChargingGunServiceImpl extends ServiceImpl<TChargingGunMapper, TChargingGun> implements TChargingGunService { |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<TChargingGunVO> pageList(TChargingGunQuery query) { |
| | | List<Integer> siteIds = null; |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.CHARGING_GUN); |
| | | } |
| | | PageInfo<TChargingGunVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TChargingGunVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | List<TChargingGunVO> list = this.baseMapper.pageList(query,pageInfo, siteIds); |
| | | for (TChargingGunVO tChargingGunVO : list) { |
| | | Integer siteId = tChargingGunVO.getSiteId(); |
| | | tChargingGunVO.setAuthDelete(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_GUN_DELETE)); |
| | | tChargingGunVO.setAuthDownloadQRCode(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_GUN_DOWNLOAD_QR_CODE)); |
| | | tChargingGunVO.setAuthEndCharge(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_GUN_END_CHARGE)); |
| | | tChargingGunVO.setAuthQueryInfo(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_GUN_QUERY_INFO)); |
| | | tChargingGunVO.setAuthUpdate(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_GUN_UPDATE)); |
| | | tChargingGunVO.setAuthViewRates(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_GUN_VIEW_RATES)); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |