| | |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.mainboard.MainBoardInvokeSyncService; |
| | | 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.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.admin.vo.EquipmentInfomation; |
| | | import com.sandu.ximon.dao.bo.C3ChargingBo; |
| | | import com.sandu.ximon.dao.domain.C3mCharging; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | |
| | | * @return 是否成功 |
| | | */ |
| | | public boolean updateReportState(String deviceName, String c3Mac, String statusBit, String deviceTemperature) { |
| | | C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, c3Mac)); |
| | | C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getC3Mac, c3Mac)); |
| | | if (one != null) { |
| | | // one.setStatusBit(Integer.valueOf(statusBit)); |
| | | one.setDeviceTemperature(deviceTemperature); |
| | | one.setPoleDevicesCode(deviceName); |
| | | one.setC3Mac(c3Mac); |
| | | |
| | | // List<C3mChargingCharge> list = c3mChargingChargeService.list(Wrappers.lambdaQuery(C3mChargingCharge.class).eq(C3mChargingCharge::getC3Id, one.getC3Id())); |
| | | // if (list.size() == 0) {//费率表中没有此充电桩数据时 添加默认费率 |
| | | // c3mChargingChargeService.initCharge((one.getC3Id()).intValue()); |
| | | // } |
| | | return updateById(one); |
| | | } else { |
| | | return false; |
| | |
| | | c3mCharging.setPoleDevicesCode(deviceName); |
| | | c3mCharging.setC3Mac(c3Mac); |
| | | flag = save(c3mCharging); |
| | | //设置费率 |
| | | C3mCharging c3mCharging1 = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, mcuUdid)); |
| | | List<C3mChargingCharge> list = c3mChargingChargeService.list(Wrappers.lambdaQuery(C3mChargingCharge.class).eq(C3mChargingCharge::getC3Id, c3mCharging1.getC3Id())); |
| | | if (list.size() == 0) {//费率表中没有此充电桩数据时 添加默认费率 |
| | | c3mChargingChargeService.initCharge((c3mCharging1.getC3Id()).intValue()); |
| | | } |
| | | |
| | | } else { |
| | | //将设备信息添加到充电桩设备表 |
| | | one.setPoleDevicesCode(deviceName); |
| | | one.setC3Mac(c3Mac); |
| | | flag = updateById(one); |
| | | //设置费率 |
| | | C3mCharging c3mCharging1 = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, mcuUdid)); |
| | | List<C3mChargingCharge> list = c3mChargingChargeService.list(Wrappers.lambdaQuery(C3mChargingCharge.class).eq(C3mChargingCharge::getC3Id, c3mCharging1.getC3Id())); |
| | | if (list.size() == 0) {//费率表中没有此充电桩数据时 添加默认费率 |
| | | c3mChargingChargeService.initCharge((c3mCharging1.getC3Id()).intValue()); |
| | | } |
| | | } |
| | | //设置费率 |
| | | C3mCharging c3mCharging1 = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, mcuUdid)); |
| | | List<C3mChargingCharge> list = c3mChargingChargeService.list(Wrappers.lambdaQuery(C3mChargingCharge.class).eq(C3mChargingCharge::getC3Id, c3mCharging1.getC3Id())); |
| | | if (list.size() == 0) {//费率表中没有此充电桩数据时 添加默认费率 |
| | | c3mChargingChargeService.initCharge((c3mCharging1.getC3Id()).intValue()); |
| | | } |
| | | // /** |
| | | // * 添加绑定关系开始 |
| | |
| | | } |
| | | equipmentInfo.setEquipmentCreateTime(one.getUpdateTime()); |
| | | equipmentInfo.setEquipmentMac(one.getMcuUdid()); |
| | | equipmentInfo.setEquipmentName(one.getC3Name()); |
| | | } |
| | | return equipmentInfo; |
| | | } |
| | |
| | | throw new BusinessException("C3充电桩硬件mcu_udid不存在"); |
| | | } |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-开始充电", a5Frame, commonFrame); |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | | |
| | |
| | | throw new BusinessException("C3充电桩硬件mcu_udid不存在"); |
| | | } |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-结束充电", a5Frame, commonFrame); |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | | A5C3OperationReportInnerFrame operationReportInnerFrame = new A5C3OperationReportInnerFrame().transformFrame(commonFrame.getPayload()); |
| | |
| | | throw new BusinessException("C3充电桩硬件mcu_udid不存在"); |
| | | } |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-同步结束", a5Frame, commonFrame); |
| | | |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | |
| | | throw new BusinessException("C3充电桩硬件mcu_udid不存在"); |
| | | } |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-二维码", a5Frame, commonFrame); |
| | | |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | |
| | | throw new BusinessException("C3充电桩硬件mcu_udid不存在"); |
| | | } |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-版本查询", a5Frame, commonFrame); |
| | | |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | |
| | | throw new BusinessException("C3充电桩硬件mcu_udid不存在"); |
| | | } |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-查询心跳包间隔时间", a5Frame, commonFrame); |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | |
| | | throw new BusinessException("C3充电桩硬件mcu_udid不存在"); |
| | | } |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-查询电压/电流常数", a5Frame, commonFrame); |
| | | |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | |
| | | throw new BusinessException("C3充电桩硬件mcu_udid不存在"); |
| | | } |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-查询地址", a5Frame, commonFrame); |
| | | |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | |
| | | throw new BusinessException("C3充电桩硬件mcu_udid不存在"); |
| | | } |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-查询故障码", a5Frame, commonFrame); |
| | | |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | |
| | | throw new BusinessException("C3充电桩硬件mcu_udid不存在"); |
| | | } |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-读取心跳包", a5Frame, commonFrame); |
| | | |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | |
| | | throw new BusinessException("C3充电桩硬件mcu_udid不存在"); |
| | | } |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-设置心跳包间隔时间", a5Frame, commonFrame); |
| | | |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | |
| | | throw new BusinessException("C3充电桩硬件mcu_udid不存在"); |
| | | } |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-设置电压/电流常数", a5Frame, commonFrame); |
| | | |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | |
| | | |
| | | |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-设置地址", a5Frame, commonFrame); |
| | | |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | |
| | | throw new BusinessException("C3充电桩硬件mcu_udid不存在"); |
| | | } |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-设置日历", a5Frame, commonFrame); |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | |
| | | throw new BusinessException("C3充电桩硬件mcu_udid不存在"); |
| | | } |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-清除故障码上报", a5Frame, commonFrame); |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | |
| | | throw new BusinessException("C3充电桩硬件mcu_udid不存在"); |
| | | } |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-恢复出厂设置", a5Frame, commonFrame); |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | |
| | | throw new BusinessException("C3充电桩硬件mcu_udid不存在"); |
| | | } |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame); |
| | | // CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC("32313243305008ff1a06ffff", a5Frame); |
| | | StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3帧-软重启", a5Frame, commonFrame); |
| | | |
| | | |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | |
| | | c3mCharging.setC3Name(c3ChargingAddParam.getC3Name()); |
| | | } |
| | | c3mCharging.setC3Mac(c3ChargingAddParam.getC3Mac()); |
| | | return save(c3mCharging); |
| | | /** |
| | | * 添加充电桩 日志记录开始 |
| | | */ |
| | | List<String> listCode = new ArrayList<>(1); |
| | | listCode.add(c3mCharging.getMcuUdid()); |
| | | String content = "{设备code:" + c3mCharging.getMcuUdid() + "设备名:" + c3mCharging.getC3Name() + |
| | | "}"; |
| | | |
| | | StoreOperationRecordsUtils.storeOperationData(listCode, null, "添加充电桩", content); |
| | | /** |
| | | * 添加充电桩 日志记录结束 |
| | | */ |
| | | |
| | | return |
| | | |
| | | save(c3mCharging); |
| | | |
| | | } |
| | | |
| | | public boolean updateC3ChargingName(C3ChargingAddParam c3ChargingAddParam) { |
| | |
| | | C3mCharging c3mCharging = new C3mCharging(); |
| | | c3mCharging.setC3Id(c3ChargingAddParam.getC3Id()); |
| | | c3mCharging.setC3Name(c3ChargingAddParam.getC3Name()); |
| | | |
| | | /** |
| | | * 修改充电桩 日志记录开始 |
| | | */ |
| | | List<String> listCode = new ArrayList<>(1); |
| | | listCode.add(c3mCharging.getMcuUdid()); |
| | | String content = "{设备code:" + c3mCharging.getMcuUdid() + "设备原名:" + one.getC3Name() + "更改后的设备名:" + c3mCharging.getC3Name() + |
| | | "}"; |
| | | |
| | | StoreOperationRecordsUtils.storeOperationData(listCode, null, "编辑充电桩", content); |
| | | /** |
| | | * 修改充电桩 日志记录结束 |
| | | */ |
| | | |
| | | |
| | | return updateById(c3mCharging); |
| | | } |
| | | |