| | |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private AppUserVipDetailClient vipDetailClient; |
| | | |
| | | // 远程新增临时站点 |
| | | @ResponseBody |
| | | @PostMapping("/addSiteTemp") |
| | | @ApiOperation(value = "添加站点", tags = {"管理后台-站点管理"}) |
| | | @Log(title = "【站点管理】添加站点", businessType = BusinessType.INSERT) |
| | | public R addSiteTemp(@RequestBody Site site){ |
| | | siteService.save(site); |
| | | return R.ok(site.getId()); |
| | | } |
| | | /** |
| | | * 根据站点id 查询所有充电桩 |
| | | * @param siteId |
| | |
| | | siteList.setPageCurr(1); |
| | | siteList.setPageSize(99999); |
| | | PageInfo<GetSiteListDTO> list = siteService.getSiteList(siteList); |
| | | for (GetSiteListDTO record : list.getRecords()) { |
| | | List<GetSiteListDTO> records = list.getRecords(); |
| | | if(records.isEmpty()){ |
| | | return R.ok(Collections.emptyList()); |
| | | } |
| | | List<Integer> collect = records.stream().map(GetSiteListDTO::getId).collect(Collectors.toList()); |
| | | List<TChargingGun> tChargingGuns = chargingGunService.lambdaQuery().in(TChargingGun::getSiteId, collect).list(); |
| | | List<TChargingPile> tChargingPiles = chargingPileService.lambdaQuery().in(TChargingPile::getSiteId, collect).list(); |
| | | Map<Integer, BigDecimal> map = chargingOrderClient.getSiteChargingCapacity(collect).getData(); |
| | | if(null == map){ |
| | | return R.ok(Collections.emptyList()); |
| | | } |
| | | for (GetSiteListDTO record : list.getRecords()) { |
| | | 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(); |
| | | Long count = tChargingGuns.stream().filter(s->s.getSiteId().equals(record.getId()) && s.getChargeMode() == 1 && s.getStatus() == 2).count(); |
| | | record.setC1(count); |
| | | Long count1 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).count(); |
| | | Long count1 = tChargingGuns.stream().filter(s->s.getSiteId().equals(record.getId()) && s.getChargeMode() == 1).count(); |
| | | record.setC2(count1); |
| | | Long count2 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, 2).count(); |
| | | Long count2 = tChargingGuns.stream().filter(s->s.getSiteId().equals(record.getId()) && s.getChargeMode() == 2 && s.getStatus() == 2).count(); |
| | | record.setK1(count2); |
| | | Long count3 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).count(); |
| | | Long count3 = tChargingGuns.stream().filter(s->s.getSiteId().equals(record.getId()) && s.getChargeMode() == 2).count(); |
| | | record.setK2(count3); |
| | | Long count4 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, 2).count(); |
| | | Long count4 = tChargingGuns.stream().filter(s->s.getSiteId().equals(record.getId()) && s.getChargeMode() == 3 && s.getStatus() == 2).count(); |
| | | record.setM1(count4); |
| | | Long count5 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).count(); |
| | | Long count5 = tChargingGuns.stream().filter(s->s.getSiteId().equals(record.getId()) && s.getChargeMode() == 3).count(); |
| | | record.setM2(count5); |
| | | |
| | | //利用率 |
| | | BigDecimal bigDecimal = new BigDecimal("0"); |
| | | //获取该站点的总充电度数 |
| | | List<TChargingOrder> chargingOrders = chargingOrderClient.getList(record.getId()).getData(); |
| | | for (TChargingOrder chargingOrder : chargingOrders) { |
| | | bigDecimal = bigDecimal.add(chargingOrder.getChargingCapacity()); |
| | | } |
| | | BigDecimal bigDecimal = map.get(record.getId()); |
| | | if(null == bigDecimal){ |
| | | bigDecimal = BigDecimal.ZERO; |
| | | } |
| | | //获取该站点的所有充电桩 |
| | | List<TChargingPile> chargingPiles = chargingPileService.lambdaQuery().eq(TChargingPile::getSiteId, record.getId()).list(); |
| | | BigDecimal bigDecimal1 = new BigDecimal("0"); |
| | | for (TChargingPile chargingPile : chargingPiles) { |
| | | bigDecimal1 = bigDecimal1.add(chargingPile.getRatedPower()); |
| | | } |
| | | BigDecimal multiply = bigDecimal1.multiply(new BigDecimal("24")); |
| | | |
| | | BigDecimal divide = bigDecimal.divide(multiply, 4, BigDecimal.ROUND_HALF_EVEN).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | record.setP1(divide); |
| | | |
| | | List<TChargingPile> chargingPiles = tChargingPiles.stream().filter(s->s.getSiteId().equals(record.getId())).collect(Collectors.toList()); |
| | | BigDecimal bigDecimal1 = chargingPiles.stream().map(TChargingPile::getRatedPower).reduce(BigDecimal::add).orElse(new BigDecimal("0")); |
| | | BigDecimal multiply = bigDecimal1.multiply(new BigDecimal("24")); |
| | | BigDecimal divide = BigDecimal.ZERO; |
| | | if(multiply.compareTo(BigDecimal.ZERO) > 0){ |
| | | 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 = {"/roleManagement/add", "/roleManagement/info", "/roleManagement/update", "/systemNotification", "/chargingPeriodStatistics", |
| | | "/parkingPaymentOrder", "/generateStatement", "/chargingPile/add", "/chargingPile/select", "/chargingPile/update"}, logical = Logical.OR) |
| | | "/parkingPaymentOrder", "/generateStatement", "/chargingPile/add", "/chargingPile/select", "/chargingPile/update", |
| | | "/appUserWhitelist/add", "/appUserWhitelist/update", "/appUserWhitelist/import"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/getAllSiteList") |
| | | @ApiOperation(value = "获取所有站点数据", tags = {"管理后台-充电桩信息", "管理后台-系统用户管理", "管理后台-角色管理", "管理后台-系统通知", "管理后台-充电评价"}) |