| | |
| | | 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.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderAccountingStrategyClient; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | |
| | | @Resource |
| | | private AppUserCarClient appUserCarClient; |
| | | |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | for (Integer id : ids) { |
| | | TChargingPile chargingPile = this.getById(id); |
| | | chargingPile.setDelFlag(true); |
| | | this.updateById(chargingPile); |
| | | this.removeById(chargingPile); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | List<Integer> id = setAccountingStrategy.getId(); |
| | | List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().in(TChargingGun::getChargingPileId, id).eq(TChargingGun::getDelFlag, 0)); |
| | | for (TChargingGun tChargingGun : list) { |
| | | tChargingGun.setChargingPileId(setAccountingStrategy.getAccountingStrategyId()); |
| | | tChargingGun.setAccountingStrategyId(setAccountingStrategy.getAccountingStrategyId()); |
| | | } |
| | | chargingGunService.updateBatchById(list); |
| | | } |
| | |
| | | @Override |
| | | public List<TChargingPileVO> getChargingGunList(Integer siteId,Integer type) { |
| | | List<TChargingPileVO> chargingPileVOS = this.baseMapper.getChargingGunList(siteId); |
| | | List<TChargingGun> chargingGuns = chargingGunService.list(Wrappers.lambdaQuery(TChargingGun.class) |
| | | .eq(TChargingGun::getSiteId, siteId) |
| | | .eq(TChargingGun::getChargeMode, type)); |
| | | LambdaQueryWrapper<TChargingGun> wrapper = new LambdaQueryWrapper<>(); |
| | | if(Objects.nonNull(type)){ |
| | | wrapper.eq(TChargingGun::getChargeMode, type); |
| | | } |
| | | wrapper.eq(TChargingGun::getSiteId, siteId); |
| | | List<TChargingGun> chargingGuns = chargingGunService.list(wrapper); |
| | | // 查询充电枪信息 |
| | | chargingPileVOS.forEach(item -> { |
| | | item.setChargingGunList(chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList())); |
| | |
| | | chargeMonitoring.setNotCharged(total.size() - charging.size()); |
| | | chargeMonitoring.setRatedPower(ratedPower.setScale(4, RoundingMode.HALF_EVEN)); |
| | | chargeMonitoring.setRealTimePower(realTimePower.setScale(4, RoundingMode.HALF_EVEN)); |
| | | chargeMonitoring.setDemandPowerSatisfactionRate(realTimePower.divide(ratedPower).multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN)); |
| | | |
| | | if(ratedPower.equals(BigDecimal.ZERO)){ |
| | | chargeMonitoring.setDemandPowerSatisfactionRate(BigDecimal.ZERO); |
| | | }else{ |
| | | chargeMonitoring.setDemandPowerSatisfactionRate(realTimePower.divide(ratedPower, new MathContext(2, RoundingMode.HALF_EVEN)) |
| | | .multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN)); |
| | | } |
| | | |
| | | List<String> dates = new ArrayList<>(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MMM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | |
| | | List<Double> data = chargingOrderAccountingStrategyClient.getDailyChargingDegree(6, siteIds).getData(); |
| | | List<Double> value2 = new ArrayList<>(); |
| | | for (Double datum : data) { |
| | | Double datum1 = new BigDecimal(datum).divide(new BigDecimal(list.size()).multiply(v).multiply(new BigDecimal(24))).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | value2.add(datum1); |
| | | if(list.size() == 0){ |
| | | value2.add(0D); |
| | | }else{ |
| | | Double datum1 = new BigDecimal(datum).divide(new BigDecimal(list.size()).multiply(v).multiply(new BigDecimal(24))).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | value2.add(datum1); |
| | | } |
| | | } |
| | | Map<String, Object> utilizationTrend = new HashMap<>(); |
| | | utilizationTrend.put("date", dates); |
| | |
| | | }else{ |
| | | siteIds.add(query.getSiteId()); |
| | | } |
| | | // todo 待完善 |
| | | |
| | | if(null != query.getStatus() && 0 < query.getStatus().size()){ |
| | | if(query.getStatus().contains(3)){ |
| | | query.getStatus().add(6); |
| | |
| | | Integer id = gunMonitoring.getId(); |
| | | //根据订单数据查询车牌号 |
| | | TChargingOrder chargingOrder = chargingOrderClient.getOrderDetailByGunId(id).getData(); |
| | | Integer appUserCarId = chargingOrder.getAppUserCarId(); |
| | | Long appUserCarId = chargingOrder.getAppUserCarId(); |
| | | if(null != appUserCarId){ |
| | | TAppUserCar tAppUserCar = appUserCarClient.getCarByIds(Arrays.asList(appUserCarId)).getData().get(0); |
| | | gunMonitoring.setLicensePlate(tAppUserCar.getLicensePlate()); |
| | | } |
| | | |
| | | UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); |
| | | gunMonitoring.setChargingRatio(BigDecimal.valueOf(data.getSoc())); |
| | | gunMonitoring.setElectricQuantity(data.getCharging_degree().toString()); |
| | | gunMonitoring.setSoc(data.getSoc().toString()); |
| | | gunMonitoring.setElectricCurrent(data.getOutput_current().toString()); |
| | | gunMonitoring.setVoltage(data.getOutput_voltage().toString()); |
| | | switch (data.getHardware_fault()){ |
| | | case 1: |
| | | gunMonitoring.setFaultCause("急停按钮动作故障"); |
| | | break; |
| | | case 2: |
| | | gunMonitoring.setFaultCause("无可用整流模块"); |
| | | break; |
| | | case 3: |
| | | gunMonitoring.setFaultCause("出风口温度过高"); |
| | | break; |
| | | case 4: |
| | | gunMonitoring.setFaultCause("交流防雷故障"); |
| | | break; |
| | | case 5: |
| | | gunMonitoring.setFaultCause("交直流模块 DC20 通信中断"); |
| | | break; |
| | | case 6: |
| | | gunMonitoring.setFaultCause("绝缘检测模块 FC08 通信中断"); |
| | | break; |
| | | case 7: |
| | | gunMonitoring.setFaultCause("电度表通信中断"); |
| | | break; |
| | | case 8: |
| | | gunMonitoring.setFaultCause("读卡器通信中断"); |
| | | break; |
| | | case 9: |
| | | gunMonitoring.setFaultCause("RC10 通信中断"); |
| | | break; |
| | | case 10: |
| | | gunMonitoring.setFaultCause("风扇调速板故障"); |
| | | break; |
| | | case 11: |
| | | gunMonitoring.setFaultCause("直流熔断器故障"); |
| | | break; |
| | | case 12: |
| | | gunMonitoring.setFaultCause("高压接触器故障"); |
| | | break; |
| | | case 13: |
| | | gunMonitoring.setFaultCause("门打开"); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | return pageInfo.setRecords(chargingGunMonitoring); |
| | | } |