| | |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.config.C3mRedisConfig; |
| | | import com.sandu.ximon.admin.dto.ChargingDto; |
| | | import com.sandu.ximon.admin.manager.iot.frame.A5Frame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5C3HeartbeatReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5C3OperationReportInnerFrame; |
| | |
| | | import com.sandu.ximon.dao.domain.C3mOrder; |
| | | import com.sandu.ximon.dao.domain.PoleBinding; |
| | | import com.sandu.ximon.dao.enums.OrderStatus; |
| | | import com.sandu.ximon.dao.domain.*; |
| | | import com.sandu.ximon.dao.mapper.C3mChargingMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author ZZQ |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å
çµæ¡© |
| | | * è·åå
çµæ¡©è¯¦æ
|
| | | * |
| | | * @return |
| | | */ |
| | | public C3mCharging getByC3Mac(String udid) { |
| | | C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, udid)); |
| | | String s = RedisUtils.getBean().get(C3mRedisConstant.C3_STATUS.getCode() + one.getC3Mac()); |
| | | if (s != null) { |
| | | try { |
| | | A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage beatDataPackage = JSON.parseObject(s, A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage.class); |
| | | one.setStatusBit((Integer.valueOf(beatDataPackage.getStatusBit()))); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } else { |
| | | one.setStatusBit(0); |
| | | public ChargingDto getChargingInfo(String poleId) { |
| | | if (poleId == null) { |
| | | throw new BusinessException("ç¯æIDä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | return one; |
| | | |
| | | Pole pole = SpringContextHolder.getBean(PoleService.class). |
| | | getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, poleId)); |
| | | if (pole == null) { |
| | | throw new BusinessException("å
çµæ¡©ç»å®çç¯æä¸åå¨ï¼"); |
| | | } |
| | | |
| | | C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getPoleDevicesCode, pole.getDeviceCode())); |
| | | ChargingDto chargingDto = new ChargingDto(); |
| | | |
| | | if (one == null) { |
| | | throw new BusinessException("å
çµæ¡©ä¿¡æ¯ä¸åå¨ï¼"); |
| | | } |
| | | A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage beatDataPackage = ReadTheHeartbeatPackage(one.getC3Mac()); |
| | | if (beatDataPackage != null) { |
| | | //å
çµæ¡©ID |
| | | chargingDto.setC3Id(one.getC3Id()); |
| | | //C3Mac |
| | | chargingDto.setC3Mac(one.getC3Mac()); |
| | | //å¨çº¿ç¶æ |
| | | chargingDto.setStatusBit(Integer.valueOf(beatDataPackage.getStatusBit())); |
| | | //çµå |
| | | chargingDto.setGridVoltage(beatDataPackage.getGridVoltage()); |
| | | //çµæµ |
| | | chargingDto.setGridCurrent(beatDataPackage.getGridCurrent()); |
| | | //温度 |
| | | chargingDto.setDeviceTemperature(beatDataPackage.getDeviceTemperature()); |
| | | //ç¯æID |
| | | chargingDto.setPoleId(pole.getId()); |
| | | } |
| | | |
| | | return chargingDto; |
| | | } |
| | | |
| | | /** |