| | |
| | | * @return 是否成功 |
| | | */ |
| | | public boolean updateReportState(String deviceName, String c3Mac, String statusBit, String deviceTemperature) { |
| | | C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getPoleDevicesCode, deviceName)); |
| | | C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, c3Mac)); |
| | | if (one != null) { |
| | | // one.setStatusBit(Integer.valueOf(statusBit)); |
| | | one.setDeviceTemperature(deviceTemperature); |
| | |
| | | c3mChargingChargeService.initCharge((c3mCharging1.getC3Id()).intValue()); |
| | | } |
| | | } |
| | | /** |
| | | * 添加绑定关系开始 |
| | | */ |
| | | Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getDeviceCode, deviceName)); |
| | | if (pole == null) { |
| | | Pole pole1 = new Pole(); |
| | | pole1.setDeviceCode(deviceName); |
| | | pole1.setPoleName(deviceName); |
| | | pole1.setPoleCode(poleService.generatePoleCode()); |
| | | poleService.save(pole1); |
| | | } |
| | | |
| | | Long poleId = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getDeviceCode, deviceName)).getId(); |
| | | PoleBindingParam poleBindingParam = new PoleBindingParam(); |
| | | poleBindingParam.setDeviceType(2); |
| | | poleBindingParam.setDeviceCode(mcuUdid); |
| | | bindingService.bindPole(poleId, poleBindingParam); |
| | | // /** |
| | | // * 添加绑定关系开始 |
| | | // */ |
| | | // Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getDeviceCode, deviceName)); |
| | | // if (pole == null) { |
| | | // Pole pole1 = new Pole(); |
| | | // pole1.setDeviceCode(deviceName); |
| | | // pole1.setPoleName(deviceName); |
| | | // pole1.setPoleCode(poleService.generatePoleCode()); |
| | | // poleService.save(pole1); |
| | | // } |
| | | // |
| | | // Long poleId = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getDeviceCode, deviceName)).getId(); |
| | | // PoleBindingParam poleBindingParam = new PoleBindingParam(); |
| | | // poleBindingParam.setDeviceType(2); |
| | | // poleBindingParam.setDeviceCode(mcuUdid); |
| | | // bindingService.bindPole(poleId, poleBindingParam); |
| | | |
| | | /** |
| | | * 添加绑定关系结束 |
| | |
| | | if (one == null) { |
| | | throw new BusinessException("未找到绑定关系"); |
| | | } |
| | | return getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getC3Mac, one.getDeviceCode())); |
| | | return getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, one.getDeviceCode())); |
| | | } |
| | | |
| | | |