| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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.*; |
| | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | @Resource |
| | | private ParkingLotClient parkingLotClient; |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | @Resource |
| | | private TChargingPileService chargingPileService; |
| | | @Resource |
| | |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private AppUserVipDetailClient vipDetailClient; |
| | | |
| | | /** |
| | | * 根据站点id 查询所有充电桩 |
| | |
| | | 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); |
| | | } |
| | | /** |
| | |
| | | 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){ |
| | |
| | | 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){ |
| | |
| | | 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); |
| | | |
| | | //利用率 |
| | |
| | | } |
| | | 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){ |
| | |
| | | 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(); |
| | |
| | | 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(); |
| | |
| | | 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); |
| | |
| | | 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){ |
| | |
| | | } |
| | | return AjaxResult.success(siteDetailVO); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "获取站点下充电桩及充电枪列表", tags = {"小程序-站点管理-站点详情"}) |
| | | @GetMapping("/getChargingGunList") |
| | | public AjaxResult<List<TChargingPileVO>> getChargingGunList(@RequestParam(value = "siteId")@ApiParam(value = "站点id", required = true)Integer siteId, |
| | |
| | | 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(); |
| | |
| | | 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; |
| | | } |
| | | } |