| | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.api.query.BatchSetAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.query.PageChargingPileList; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | |
| | | import com.ruoyi.chargingPile.dto.ChargingGunMonitoring; |
| | | import com.ruoyi.chargingPile.dto.GetChargingGunMonitoring; |
| | | import com.ruoyi.chargingPile.mapper.TChargingPileMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | 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.redis.service.RedisService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.IntegrationClient; |
| | | import com.ruoyi.integration.api.feignClient.IotInterfaceClient; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | @Resource |
| | | private TFaultMessageService faultMessageService; |
| | | |
| | | @Resource |
| | | private IntegrationClient integrationClient; |
| | | |
| | | |
| | | |
| | |
| | | tChargingGun.setAccountingStrategyId(setAccountingStrategy.getAccountingStrategyId()); |
| | | } |
| | | chargingGunService.updateBatchById(list); |
| | | //下发硬件更新计费模板 |
| | | for (TChargingPile chargingPile : this.listByIds(id)) { |
| | | integrationClient.setupBillingModel1(chargingPile.getCode()); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | List<TChargingGun> chargingGunList = chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList()); |
| | | for (TChargingGun chargingGun : chargingGunList) { |
| | | if(chargingGun.getStatus().equals(4)){ |
| | | // TODO 查询正在充电的单子的实时记录 |
| | | chargingGun.setSoc(100); |
| | | // 查询正在充电的单子的实时记录 |
| | | TChargingOrder chargingOrder = chargingOrderClient.getOrderDetailByGunId(chargingGun.getId()).getData(); |
| | | if(Objects.nonNull(chargingOrder)){ |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); |
| | | chargingGun.setSoc(uploadRealTimeMonitoringData.getSoc()); |
| | | }else { |
| | | chargingGun.setSoc(100); |
| | | } |
| | | } |
| | | if(chargingGun.getStatus().equals(5)){ |
| | | chargingGun.setSoc(100); |
| | |
| | | ChargeMonitoring chargeMonitoring = new ChargeMonitoring(); |
| | | chargeMonitoring.setPhone(sites.size() == 1 ? sites.get(0).getPhone() : ""); |
| | | chargeMonitoring.setAddress(sites.size() == 1 ? sites.get(0).getAddress() : ""); |
| | | chargeMonitoring.setTerminalTotal(sites.size()); |
| | | chargeMonitoring.setTerminalTotal(total.size()); |
| | | chargeMonitoring.setCharging(charging.size()); |
| | | chargeMonitoring.setNotCharged(total.size() - charging.size()); |
| | | chargeMonitoring.setRatedPower(ratedPower.setScale(4, RoundingMode.HALF_EVEN)); |
| | |
| | | //充电中 |
| | | long charging = list.stream().filter(s -> s.getStatus().equals(4)).count(); |
| | | //离网 |
| | | long offline = list.stream().filter(s -> s.getStatus().equals(0)).count(); |
| | | long offline = list.stream().filter(s -> s.getStatus().equals(1)).count(); |
| | | //故障 |
| | | long breakdown = list.stream().filter(s -> s.getStatus().equals(7)).count(); |
| | | ChargingGunCountMonitoring chargingGunCountMonitoring = new ChargingGunCountMonitoring(); |
| | |
| | | |
| | | if(null != query.getStatus() && 0 < query.getStatus().size()){ |
| | | if(query.getStatus().contains(3)){ |
| | | query.getStatus().add(5); |
| | | query.getStatus().add(6); |
| | | query.getStatus().add(7); |
| | | } |
| | | } |
| | | PageInfo<ChargingGunMonitoring> pageInfo = new PageInfo<>(query.getPageCurr(), query.getPageSize()); |
| | |
| | | TChargingOrder chargingOrder = chargingOrderClient.getOrderDetailByGunId(id).getData(); |
| | | if(null != chargingOrder){ |
| | | Long appUserCarId = chargingOrder.getAppUserCarId(); |
| | | TAppUserCar tAppUserCar = appUserCarClient.getCarByIds(Arrays.asList(appUserCarId)).getData().get(0); |
| | | if(null != tAppUserCar){ |
| | | if(null != appUserCarId){ |
| | | TAppUserCar tAppUserCar = appUserCarClient.getCarByIds(Arrays.asList(appUserCarId)).getData().get(0); |
| | | gunMonitoring.setLicensePlate(tAppUserCar.getLicensePlate()); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void updateStatus() { |
| | | List<TChargingPile> list = this.list(new LambdaQueryWrapper<TChargingPile>().eq(TChargingPile::getDelFlag, 0)); |
| | | List<TChargingPile> datas = new ArrayList(); |
| | | Map<String, Object> charging_pile_online = redisService.getCacheMap("charging_pile_online"); |
| | | for (TChargingPile chargingPile : list) { |
| | | Long time = (Long) charging_pile_online.get(chargingPile.getCode()); |
| | | if(null != time && System.currentTimeMillis() - time > 60000){ |
| | | chargingPile.setStatus(2); |
| | | datas.add(chargingPile); |
| | | TChargingPile chargingPile1 = new TChargingPile(); |
| | | chargingPile1.setId(chargingPile.getId()); |
| | | chargingPile1.setStatus(2); |
| | | this.updateById(chargingPile1); |
| | | List<TChargingGun> list1 = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, chargingPile.getId())); |
| | | for (TChargingGun chargingGun : list1) { |
| | | TChargingGun chargingGun1 = new TChargingGun(); |
| | | chargingGun1.setId(chargingGun.getId()); |
| | | chargingGun1.setStatus(1); |
| | | chargingGunService.updateById(chargingGun1); |
| | | } |
| | | |
| | | //添加记录 |
| | | TFaultMessage faultMessage = faultMessageService.getOne(new LambdaQueryWrapper<TFaultMessage>().eq(TFaultMessage::getChargingPileId, chargingPile.getId()) |
| | | .eq(TFaultMessage::getStatus, 1).eq(TFaultMessage::getDelFlag, 0).isNull(TFaultMessage::getEndTime)); |
| | | if(null == faultMessage){ |
| | | faultMessage = new TFaultMessage(); |
| | | faultMessage.setSiteId(chargingPile.getSiteId()); |
| | | faultMessage.setChargingPileId(chargingPile.getId()); |
| | | faultMessage.setStatus(1); |
| | | faultMessage.setDownTime(LocalDateTime.now()); |
| | | faultMessage.setCreateTime(LocalDateTime.now()); |
| | | faultMessage.setDelFlag(false); |
| | | faultMessage.setContent("设备离线"); |
| | | faultMessageService.save(faultMessage); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(datas.size() > 0){ |
| | | this.updateBatchById(datas); |
| | | } |
| | | } |
| | | } |