| | |
| | | import com.sandu.ximon.admin.param.C3ChargingAddParam; |
| | | import com.sandu.ximon.admin.param.C3ChargingParam; |
| | | import com.sandu.ximon.admin.param.PoleBindingParam; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.LogUtils; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import com.sandu.ximon.dao.bo.C3ChargingBo; |
| | |
| | | * @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); |
| | | |
| | | /** |
| | | * 添加绑定关系结束 |
| | |
| | | * @return |
| | | */ |
| | | public List<C3ChargingBo> getC3ChargingListByKeyword(BaseConditionVO baseConditionVO, C3ChargingParam c3ChargingParam) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | if (baseConditionVO != null) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | } |
| | | if (c3ChargingParam == null) { |
| | | c3ChargingParam = new C3ChargingParam(); |
| | | } |
| | |
| | | c3ChargingParam.setKeyword(c3ChargingParam.getKeyword().trim()); |
| | | } |
| | | |
| | | List<C3ChargingBo> c3ChargingBoList = c3mChargingMapper.listC3mChargingDto(c3ChargingParam.getKeyword()); |
| | | List<C3ChargingBo> c3ChargingBoList; |
| | | if (SecurityUtils.getClientId() == null) { |
| | | c3ChargingBoList = c3mChargingMapper.listC3mChargingDto(c3ChargingParam.getKeyword(), null); |
| | | } else { |
| | | c3ChargingBoList = c3mChargingMapper.listC3mChargingDto(c3ChargingParam.getKeyword(), SecurityUtils.getUserId()); |
| | | } |
| | | for (C3ChargingBo one : c3ChargingBoList) { |
| | | String s = RedisUtils.getBean().get(C3mRedisConstant.C3_STATUS.getCode() + one.getC3Mac()); |
| | | if (s != null) { |
| | | one.setStatusBit(1); |
| | | 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); |
| | | } |
| | |
| | | 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) { |
| | | one.setStatusBit(1); |
| | | 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); |
| | | } |
| | |
| | | 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())); |
| | | } |
| | | |
| | | |