| | |
| | | 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; |
| | |
| | | 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.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; |
| | |
| | | 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.*; |
| | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | @Resource |
| | | private ParkingLotClient parkingLotClient; |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | @Resource |
| | | private TChargingPileService chargingPileService; |
| | | @Resource |
| | |
| | | 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){ |
| | |
| | | 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){ |
| | |
| | | } |
| | | return R.ok(list.getRecords()); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargeDistribution"}, logical = Logical.OR) |
| | | @GetMapping("/map/getPercent") |
| | | @ApiOperation(value = "获取该充电站的利用率", tags = {"管理后台-数据分析-电站分析"}) |
| | | public R getPercent(Integer siteId){ |
| | |
| | | return R.ok(divide); |
| | | } |
| | | |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargeDistribution"}, logical = Logical.OR) |
| | | @PostMapping("/map/getPercentByprovinceCode") |
| | | @ApiOperation(value = "获取该充电站的利用率", tags = {"管理后台-数据分析-电站分析"}) |
| | | public R getPercentByCityCode(@RequestBody ChargingPercentProvinceDto chargingPercentProvinceDto){ |
| | | |
| | | |
| | | |
| | | 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(); |
| | |
| | | if (chargingPercentProvinceDto.getDate1().equals(chargingPercentProvinceDto.getDate2())){ |
| | | chargingPercentProvinceDto.setDate2(chargingPercentProvinceDto.getDate1().plusDays(1)); |
| | | } |
| | | List<ChargingOrderGroup> data = chargingOrderClient.getBySiteIdAndTime(chargingPercentProvinceDto).getData(); |
| | | List<ChargingOrderGroup> data = chargingOrderClient.getBySiteIdAndTime(chargingPercentProvinceDto).getData(); |
| | | // 计算利用率展示 |
| | | for (ChargingOrderGroup datum : data) { |
| | | List<TChargingPile> chargingPiles = chargingPileService.lambdaQuery().eq(TChargingPile::getSiteId, datum.getSiteId()).list(); |
| | |
| | | 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){ |
| | |
| | | return AjaxResult.success(siteService.pageList(query,isLogin)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "获取站点列表", tags = {"小程序-站点管理-地图导航站点"}) |
| | | @PostMapping("/getMapSiteList") |
| | | public AjaxResult<List<SiteVO>> getMapSiteList(@Validated @RequestBody SiteQuery query, HttpServletRequest request){ |
| | |
| | | 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 = {"管理后台-站点管理"}) |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/site/update"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/getSiteInfo/{id}") |
| | | @ApiOperation(value = "获取站点详情", tags = {"管理后台-站点管理"}) |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/site/update"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/editSite") |
| | | @ApiOperation(value = "编辑站点", tags = {"管理后台-站点管理"}) |
| | |
| | | return siteService.editSite(site); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/site/del", "/site/batch_del"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @DeleteMapping("/delSite") |
| | | @ApiOperation(value = "删除站点", tags = {"管理后台-站点管理"}) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/site/accounting_strategy"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/setAccountingStrategy/{id}") |
| | | @ApiOperation(value = "设置站点计费策略", tags = {"管理后台-站点管理"}) |
| | |
| | | } |
| | | |
| | | |
| | | @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); |
| | |
| | | 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(); |