├── .github └── ISSUE_TEMPLATE │ └── feature_request.md ├── .gitignore ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── ClusterDevicePlatform-client ├── .gitignore ├── build.gradle ├── gradlew ├── gradlew.bat └── src │ ├── main │ ├── java │ │ └── cc │ │ │ └── bitky │ │ │ └── clusterdeviceplatform │ │ │ └── client │ │ │ ├── ClientApplication.java │ │ │ ├── config │ │ │ ├── CommSetting.java │ │ │ └── DeviceSetting.java │ │ │ ├── netty │ │ │ ├── NettyClient.java │ │ │ ├── TcpPresenter.java │ │ │ ├── handler │ │ │ │ ├── ClientChannelInitializer.java │ │ │ │ ├── ConfigHandler.java │ │ │ │ ├── FrameRecognitionInBoundHandler.java │ │ │ │ ├── MsgRecognitionOutBoundHandler.java │ │ │ │ └── ParsedMessageInBoundHandler.java │ │ │ └── repo │ │ │ │ └── TcpRepository.java │ │ │ ├── server │ │ │ ├── ServerTcpHandler.java │ │ │ ├── ServerWebHandler.java │ │ │ ├── repo │ │ │ │ ├── MsgPackage.java │ │ │ │ └── MsgProcessingRepository.java │ │ │ └── statistic │ │ │ │ ├── MsgCount.java │ │ │ │ └── ProcessedMsgRepo.java │ │ │ ├── ui │ │ │ ├── UiPresenter.java │ │ │ ├── bean │ │ │ │ ├── Device.java │ │ │ │ ├── DeviceCellRepo.java │ │ │ │ ├── DeviceGroup.java │ │ │ │ └── DeviceGroupListCell.java │ │ │ └── view │ │ │ │ ├── DeviceCellView.java │ │ │ │ ├── MainView.java │ │ │ │ └── UiLauncher.java │ │ │ └── web │ │ │ └── TcpController.java │ └── resources │ │ ├── application.properties │ │ ├── css │ │ ├── listview.css │ │ └── main.css │ │ └── fxml │ │ ├── device-cell.fxml │ │ └── main-view.fxml │ └── test │ └── java │ └── cc │ └── bitky │ └── clusterdeviceplatform │ └── client │ └── ClientApplicationTests.java ├── ClusterDevicePlatform-server ├── .gitignore ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── lombok.config └── src │ ├── main │ ├── java │ │ └── cc │ │ │ └── bitky │ │ │ └── clusterdeviceplatform │ │ │ └── server │ │ │ ├── ServerApplication.java │ │ │ ├── config │ │ │ ├── CommSetting.java │ │ │ ├── DbSetting.java │ │ │ ├── DeviceSetting.java │ │ │ ├── LocalProfile.java │ │ │ ├── ServerSetting.java │ │ │ └── WebSetting.java │ │ │ ├── db │ │ │ ├── .gitignore │ │ │ ├── DbPresenter.java │ │ │ ├── dto │ │ │ │ ├── CardSet.java │ │ │ │ ├── Device.java │ │ │ │ ├── DeviceGroup.java │ │ │ │ ├── Employee.java │ │ │ │ └── routineinfo │ │ │ │ │ ├── DutyInfo.java │ │ │ │ │ ├── HistoryInfo.java │ │ │ │ │ └── LampStatusHistory.java │ │ │ ├── operate │ │ │ │ ├── CardSetOperate.java │ │ │ │ ├── DbRoutineOperate.java │ │ │ │ ├── DeviceOperate.java │ │ │ │ └── EmployeeOperate.java │ │ │ ├── repository │ │ │ │ ├── CardSetRepository.java │ │ │ │ ├── DeviceRepository.java │ │ │ │ ├── EmployeeRepository.java │ │ │ │ └── RoutineTableRepository.java │ │ │ ├── statistic │ │ │ │ ├── pressure │ │ │ │ │ ├── GroupCacheItem.java │ │ │ │ │ └── MsgCount.java │ │ │ │ ├── repo │ │ │ │ │ └── ProcessedMsgRepo.java │ │ │ │ └── status │ │ │ │ │ ├── DeviceGroupItem.java │ │ │ │ │ ├── DeviceGroupOutline.java │ │ │ │ │ └── DeviceStatusItem.java │ │ │ └── work │ │ │ │ └── KyMongoConfig.java │ │ │ ├── pojo │ │ │ ├── client │ │ │ │ ├── CardType.java │ │ │ │ ├── QueueDevice.java │ │ │ │ ├── QueueInfo.java │ │ │ │ └── WebLed.java │ │ │ ├── dataprocess │ │ │ │ ├── DeviceStatusItem.java │ │ │ │ ├── EmployeeCategory.java │ │ │ │ ├── EmployeeGatherByDepartment.java │ │ │ │ ├── EmployeeGatherByGroup.java │ │ │ │ └── EmployeeGatherOutline.java │ │ │ ├── tcp │ │ │ │ ├── BaseMsgSending.java │ │ │ │ ├── DeviceGroupedMsgSending.java │ │ │ │ ├── DeviceItemMsgSending.java │ │ │ │ ├── MachineMsgSending.java │ │ │ │ └── MsgSending.java │ │ │ └── user │ │ │ │ ├── Token.java │ │ │ │ ├── UserInfo.java │ │ │ │ └── UserLogin.java │ │ │ ├── server │ │ │ ├── ServerCenterProcessor.java │ │ │ ├── ServerRunner.java │ │ │ ├── ServerTcpProcessor.java │ │ │ ├── ServerWebProcessor.java │ │ │ ├── demonstrate │ │ │ │ ├── msgprocess │ │ │ │ │ ├── KyRandom.java │ │ │ │ │ └── MsgCountRandom.java │ │ │ │ └── tcp │ │ │ │ │ └── KyRandom.java │ │ │ ├── repo │ │ │ │ ├── DeviceStatusRepository.java │ │ │ │ ├── MsgProcessingRepository.java │ │ │ │ ├── TcpFeedBackRepository.java │ │ │ │ └── bean │ │ │ │ │ ├── DeviceItem.java │ │ │ │ │ └── StatusItem.java │ │ │ ├── statistic │ │ │ │ ├── CollectInfo.java │ │ │ │ ├── info │ │ │ │ │ ├── DataBaseInfo.java │ │ │ │ │ ├── ServerInfo.java │ │ │ │ │ ├── ServerSettingInfo.java │ │ │ │ │ ├── ServerStatusInfo.java │ │ │ │ │ ├── SysEnvInfo.java │ │ │ │ │ ├── TcpDetailInfo.java │ │ │ │ │ └── TcpInfo.java │ │ │ │ └── utils │ │ │ │ │ ├── IpUtil.java │ │ │ │ │ └── Test.java │ │ │ └── utils │ │ │ │ └── DeviceOutBoundDetect.java │ │ │ ├── tcp │ │ │ ├── NettyServer.java │ │ │ ├── TcpPresenter.java │ │ │ ├── handler │ │ │ │ ├── ConfigHandler.java │ │ │ │ ├── FrameRecognitionInBoundHandler.java │ │ │ │ ├── KyReadTimeoutHandler.java │ │ │ │ ├── MsgRecognitionOutBoundHandler.java │ │ │ │ ├── ParsedMessageInBoundHandler.java │ │ │ │ └── ServerChannelInitializer.java │ │ │ ├── repo │ │ │ │ └── TcpRepository.java │ │ │ └── statistic │ │ │ │ ├── channel │ │ │ │ ├── ChannelItem.java │ │ │ │ └── ChannelOutline.java │ │ │ │ └── except │ │ │ │ ├── TcpFeedbackItem.java │ │ │ │ └── TypeEnum.java │ │ │ ├── utils │ │ │ ├── ResMsg.java │ │ │ └── WebUtil.java │ │ │ └── web │ │ │ ├── client │ │ │ ├── InfoCardSetRestController.java │ │ │ ├── InfoDevicesRestController.java │ │ │ ├── InfoServerRestController.java │ │ │ ├── LedRestController.java │ │ │ └── OperateDevicesRestController.java │ │ │ └── spa │ │ │ ├── data │ │ │ ├── DataProcessController.java │ │ │ └── StatusGatherController.java │ │ │ ├── feedbackmsg │ │ │ └── FeedbackMsgController.java │ │ │ ├── server │ │ │ └── ServerInnerController.java │ │ │ ├── tcp │ │ │ └── TcpController.java │ │ │ └── user │ │ │ └── UserController.java │ └── resources │ │ ├── .gitignore │ │ └── application.properties │ └── test │ └── java │ └── cc │ └── bitky │ └── clusterdeviceplatform │ └── server │ └── ServerApplicationTests.java ├── LICENSE ├── Project-v1-Obsolete ├── ClusterManageServerTestIris │ ├── .gitignore │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── out │ │ └── production │ │ │ ├── classes │ │ │ └── cc │ │ │ │ └── bitky │ │ │ │ └── ClusterManageServerTestIris │ │ │ │ ├── ClusterManageServerTestIrisApplication.class │ │ │ │ ├── OperateRestController.class │ │ │ │ └── ServerSetting.class │ │ │ └── resources │ │ │ └── application.properties │ └── src │ │ ├── main │ │ ├── java │ │ │ └── cc │ │ │ │ └── bitky │ │ │ │ └── ClusterManageServerTestIris │ │ │ │ ├── ClusterManageServerTestIrisApplication.java │ │ │ │ ├── OperateRestController.java │ │ │ │ └── ServerSetting.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── cc │ │ └── bitky │ │ └── ClusterManageServerTestIris │ │ └── ClusterManageServerTestIrisApplicationTests.java ├── clustermanage-client-console │ ├── .gitignore │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── cc │ │ │ └── bitky │ │ │ └── clustermanage │ │ │ ├── App.java │ │ │ ├── netty │ │ │ ├── NettyServer.java │ │ │ ├── WebMsgDeployEmployeeDepartment2.java │ │ │ ├── handler │ │ │ │ ├── CanFrameChannelInboundHandler.java │ │ │ │ ├── KyChannelInitializer.java │ │ │ │ ├── KyOutBoundHandler.java │ │ │ │ └── ParsedMessageInBoundHandler.java │ │ │ └── message │ │ │ │ ├── CardType.java │ │ │ │ ├── MsgType.java │ │ │ │ ├── WebMsgDeployFreeCardSpecial.java │ │ │ │ ├── base │ │ │ │ ├── BaseMessage.java │ │ │ │ ├── BaseMsgCardNum.java │ │ │ │ ├── BaseTcpResponseMsg.java │ │ │ │ ├── IMessage.java │ │ │ │ └── WebMsgBaseEmployee.java │ │ │ │ ├── tcp │ │ │ │ ├── MsgErrorMessage.java │ │ │ │ ├── TcpMsgInitResponseCardNumber.java │ │ │ │ ├── TcpMsgResponseBoxId.java │ │ │ │ ├── TcpMsgResponseDeviceStatus.java │ │ │ │ ├── TcpMsgResponseEmployeeCardnumber.java │ │ │ │ ├── TcpMsgResponseEmployeeDepartment.java │ │ │ │ ├── TcpMsgResponseEmployeeName.java │ │ │ │ ├── TcpMsgResponseFreeCardNumber.java │ │ │ │ ├── TcpMsgResponseOperateBoxUnlock.java │ │ │ │ └── TcpMsgResponseRemainChargeTimes.java │ │ │ │ └── web │ │ │ │ ├── WebMsgDeployEmployeeCardNumber.java │ │ │ │ ├── WebMsgDeployEmployeeDepartment.java │ │ │ │ ├── WebMsgDeployEmployeeDeviceId.java │ │ │ │ ├── WebMsgDeployEmployeeName.java │ │ │ │ ├── WebMsgDeployRemainChargeTimes.java │ │ │ │ ├── WebMsgInitClearDeviceStatus.java │ │ │ │ ├── WebMsgInitMarchConfirmCardResponse.java │ │ │ │ ├── WebMsgObtainDeviceStatus.java │ │ │ │ └── WebMsgOperateBoxUnlock.java │ │ │ └── utils │ │ │ ├── ChargeStatusEnum.java │ │ │ ├── KyLog.java │ │ │ ├── SuccessfulListener.java │ │ │ ├── TcpMsgBuilder.java │ │ │ ├── TcpReceiveListener.java │ │ │ └── TcpSendListener.java │ │ └── resources │ │ └── logback.xml ├── clustermanage-client-javafx │ ├── .gitignore │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── cc │ │ │ └── bitky │ │ │ └── clustermanage │ │ │ ├── KySetting.java │ │ │ ├── MainLauncher.java │ │ │ ├── NettyLauncher.java │ │ │ ├── netty │ │ │ ├── NettyClient.java │ │ │ ├── handler │ │ │ │ ├── CanFrameChannelInboundHandler.java │ │ │ │ ├── KyChannelInitializer.java │ │ │ │ ├── KyOutBoundHandler.java │ │ │ │ └── ParsedMessageInBoundHandler.java │ │ │ └── message │ │ │ │ ├── CardType.java │ │ │ │ ├── MsgType.java │ │ │ │ ├── TcpMsgResponseRandomDeviceStatus.java │ │ │ │ ├── base │ │ │ │ ├── BaseMessage.java │ │ │ │ ├── BaseMsgCardNum.java │ │ │ │ ├── BaseTcpResponseMsg.java │ │ │ │ ├── IMessage.java │ │ │ │ └── WebMsgBaseEmployee.java │ │ │ │ ├── tcp │ │ │ │ ├── MsgErrorMessage.java │ │ │ │ ├── TcpMsgInitResponseCardNumber.java │ │ │ │ ├── TcpMsgResponseBoxId.java │ │ │ │ ├── TcpMsgResponseDeviceStatus.java │ │ │ │ ├── TcpMsgResponseEmployeeCardnumber.java │ │ │ │ ├── TcpMsgResponseEmployeeDepartment.java │ │ │ │ ├── TcpMsgResponseEmployeeDepartment2.java │ │ │ │ ├── TcpMsgResponseEmployeeName.java │ │ │ │ ├── TcpMsgResponseFreeCardNumber.java │ │ │ │ ├── TcpMsgResponseLed.java │ │ │ │ ├── TcpMsgResponseOperateBoxUnlock.java │ │ │ │ └── TcpMsgResponseRemainChargeTimes.java │ │ │ │ └── web │ │ │ │ ├── WebMsgDeployEmployeeCardNumber.java │ │ │ │ ├── WebMsgDeployEmployeeDepartment.java │ │ │ │ ├── WebMsgDeployEmployeeDepartment2.java │ │ │ │ ├── WebMsgDeployEmployeeDeviceId.java │ │ │ │ ├── WebMsgDeployEmployeeName.java │ │ │ │ ├── WebMsgDeployFreeCardSpecial.java │ │ │ │ ├── WebMsgDeployLedSetting.java │ │ │ │ ├── WebMsgDeployLedStop.java │ │ │ │ ├── WebMsgDeployRemainChargeTimes.java │ │ │ │ ├── WebMsgInitClearDeviceStatus.java │ │ │ │ ├── WebMsgInitMarchConfirmCardResponse.java │ │ │ │ ├── WebMsgObtainDeviceStatus.java │ │ │ │ └── WebMsgOperateBoxUnlock.java │ │ │ ├── utils │ │ │ ├── ChargeStatusEnum.java │ │ │ ├── KyLog.java │ │ │ ├── SuccessfulListener.java │ │ │ ├── TcpMsgBuilder.java │ │ │ ├── TcpReceiveListener.java │ │ │ ├── TcpSendListener.java │ │ │ └── ViewUtil.java │ │ │ └── view │ │ │ ├── Container.java │ │ │ ├── DeviceStatusChangeListener.java │ │ │ ├── MainView.java │ │ │ ├── MainViewActionListener.java │ │ │ ├── bean │ │ │ ├── Device.java │ │ │ ├── DeviceGroup.java │ │ │ └── DeviceKey.java │ │ │ ├── menu │ │ │ ├── AboutController.java │ │ │ └── about.fxml │ │ │ ├── rootLayout.fxml │ │ │ └── viewbean │ │ │ ├── DeviceGroupListCell.java │ │ │ ├── DeviceView.java │ │ │ └── device_view.fxml │ │ └── resources │ │ └── logback.xml ├── clustermanage-server │ ├── .gitignore │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── cc │ │ │ │ └── bitky │ │ │ │ └── clustermanage │ │ │ │ ├── ClusterManageServerApplication.java │ │ │ │ ├── db │ │ │ │ ├── bean │ │ │ │ │ ├── Cards.java │ │ │ │ │ ├── Device.java │ │ │ │ │ ├── DeviceGroup.java │ │ │ │ │ ├── Employee.java │ │ │ │ │ └── routineinfo │ │ │ │ │ │ ├── DutyInfo.java │ │ │ │ │ │ ├── HistoryInfo.java │ │ │ │ │ │ └── LampStatusHistory.java │ │ │ │ ├── mongoops │ │ │ │ │ ├── KyMongoConfig.java │ │ │ │ │ └── KyRedisConfig.java │ │ │ │ ├── presenter │ │ │ │ │ ├── DbDevicePresenter.java │ │ │ │ │ ├── DbEmployeePresenter.java │ │ │ │ │ ├── DbRoutinePresenter.java │ │ │ │ │ ├── DbSettingPresenter.java │ │ │ │ │ └── KyDbPresenter.java │ │ │ │ └── repository │ │ │ │ │ ├── DeviceGroupRepository.java │ │ │ │ │ ├── DeviceRepository.java │ │ │ │ │ ├── EmployeeRepository.java │ │ │ │ │ ├── RoutineTableRepository.java │ │ │ │ │ └── SettingRepository.java │ │ │ │ ├── global │ │ │ │ ├── CommSetting.java │ │ │ │ ├── DbSetting.java │ │ │ │ ├── ExSetting.java │ │ │ │ └── ServerSetting.java │ │ │ │ ├── server │ │ │ │ ├── bean │ │ │ │ │ ├── KyServerCenterHandler.java │ │ │ │ │ ├── ServerTcpMessageHandler.java │ │ │ │ │ └── ServerWebMessageHandler.java │ │ │ │ ├── message │ │ │ │ │ ├── CardType.java │ │ │ │ │ ├── ChargeStatus.java │ │ │ │ │ ├── MsgType.java │ │ │ │ │ ├── base │ │ │ │ │ │ ├── BaseMessage.java │ │ │ │ │ │ ├── BaseMsgCardNum.java │ │ │ │ │ │ ├── BaseTcpResponseMsg.java │ │ │ │ │ │ ├── IMessage.java │ │ │ │ │ │ ├── ISendableMsg.java │ │ │ │ │ │ └── WebMsgBaseEmployee.java │ │ │ │ │ ├── send │ │ │ │ │ │ ├── SendableMsg.java │ │ │ │ │ │ └── WebMsgSpecial.java │ │ │ │ │ ├── tcp │ │ │ │ │ │ ├── MsgErrorMessage.java │ │ │ │ │ │ ├── TcpMsgInitResponseCardNumber.java │ │ │ │ │ │ ├── TcpMsgResponseDeviceId.java │ │ │ │ │ │ ├── TcpMsgResponseEmployeeCardnumber.java │ │ │ │ │ │ ├── TcpMsgResponseEmployeeDepartment1.java │ │ │ │ │ │ ├── TcpMsgResponseEmployeeDepartment2.java │ │ │ │ │ │ ├── TcpMsgResponseEmployeeName.java │ │ │ │ │ │ ├── TcpMsgResponseFreeCardNumber.java │ │ │ │ │ │ ├── TcpMsgResponseLed.java │ │ │ │ │ │ ├── TcpMsgResponseOperateBoxUnlock.java │ │ │ │ │ │ ├── TcpMsgResponseRemainChargeTimes.java │ │ │ │ │ │ └── TcpMsgResponseStatus.java │ │ │ │ │ └── web │ │ │ │ │ │ ├── WebMsgDeployEmployeeCardNumber.java │ │ │ │ │ │ ├── WebMsgDeployEmployeeDepartment.java │ │ │ │ │ │ ├── WebMsgDeployEmployeeDeviceId.java │ │ │ │ │ │ ├── WebMsgDeployEmployeeName.java │ │ │ │ │ │ ├── WebMsgDeployFreeCardNumber.java │ │ │ │ │ │ ├── WebMsgDeployLedSetting.java │ │ │ │ │ │ ├── WebMsgDeployLedStop.java │ │ │ │ │ │ ├── WebMsgDeployRemainChargeTimes.java │ │ │ │ │ │ ├── WebMsgInitClearDeviceStatus.java │ │ │ │ │ │ ├── WebMsgInitMarchConfirmCardResponse.java │ │ │ │ │ │ ├── WebMsgObtainDeviceStatus.java │ │ │ │ │ │ └── WebMsgOperateBoxUnlock.java │ │ │ │ └── schedule │ │ │ │ │ ├── MsgKey.java │ │ │ │ │ └── SendingMsgRepo.java │ │ │ │ ├── tcp │ │ │ │ ├── TcpMediator.java │ │ │ │ ├── base │ │ │ │ │ ├── BasePresenter.java │ │ │ │ │ └── BaseView.java │ │ │ │ ├── server │ │ │ │ │ ├── MsgToCanParser.java │ │ │ │ │ ├── NettyServerShow.java │ │ │ │ │ ├── PolicyCanTransmitter.java │ │ │ │ │ ├── channelhandler │ │ │ │ │ │ ├── CanFrameChannelInboundHandler.java │ │ │ │ │ │ ├── ConfigHandler.java │ │ │ │ │ │ ├── ParsedMessageInBoundHandler.java │ │ │ │ │ │ ├── SendingOutBoundHandler.java │ │ │ │ │ │ └── ServerChannelInitializer.java │ │ │ │ │ └── netty │ │ │ │ │ │ ├── NettyServer.java │ │ │ │ │ │ ├── NettyServerContract.java │ │ │ │ │ │ └── SendWebMessagesListener.java │ │ │ │ └── util │ │ │ │ │ ├── KyLog.java │ │ │ │ │ ├── TcpMsgBuilder.java │ │ │ │ │ └── listener │ │ │ │ │ └── SuccessfulListener.java │ │ │ │ └── web │ │ │ │ ├── InfoRestController.java │ │ │ │ ├── LedRestController.java │ │ │ │ ├── OperateRestController.java │ │ │ │ └── bean │ │ │ │ ├── LedSetting.java │ │ │ │ ├── QueueDevice.java │ │ │ │ └── QueueInfo.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── application.yml │ │ └── test │ │ └── java │ │ ├── Girl.java │ │ ├── Main.java │ │ ├── Person.java │ │ └── cc │ │ └── bitky │ │ └── clustermanage │ │ └── db │ │ └── KyTest.java └── hardware │ └── SingleDeviceTestNET │ ├── .gitignore │ ├── SingleDeviceTest.sln │ └── SingleDeviceTestNET │ ├── App.config │ ├── Form1.Designer.cs │ ├── Form1.cs │ ├── Form1.resx │ ├── Program.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ ├── SingleDeviceTestNET.csproj │ ├── message │ ├── WebMsgOperateBoxUnlock.cs │ └── base │ │ ├── BaseMessage.cs │ │ └── IMessage.cs │ └── utils │ ├── CanBuilder.cs │ ├── MsgType.cs │ └── TcpMsgBuilder.cs ├── README.md ├── SerialRawData ├── .gitignore ├── build.gradle ├── settings.gradle └── src │ └── main │ └── java │ └── cc │ └── bitky │ └── clusterdeviceplatform │ └── serialrawdata │ ├── LicenseKeyPool.java │ ├── LicenseVerifyPresenter.java │ ├── NetCard.java │ └── utils │ ├── .gitignore │ ├── DesUtil.java │ ├── EigestUtil.java │ ├── NetCardFactory.java │ └── StringConvert.java ├── ServerPreSetting ├── .gitignore ├── ServerPreSetting.sln └── ServerPreSetting │ ├── App.config │ ├── App.xaml │ ├── App.xaml.cs │ ├── KySetting.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ ├── ServerPreSetting.csproj │ └── packages.config ├── clusterdeviceplatform-demo ├── .gitignore ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── libs │ └── messageUtils-1.9.1.jar └── src │ ├── main │ ├── java │ │ └── cc │ │ │ └── bitky │ │ │ └── clusterdeviceplatform │ │ │ └── demo │ │ │ ├── DemoApplication.java │ │ │ ├── config │ │ │ ├── CommSetting.java │ │ │ ├── DbSetting.java │ │ │ ├── DeviceSetting.java │ │ │ └── ServerSetting.java │ │ │ ├── db │ │ │ └── statistic │ │ │ │ ├── pressure │ │ │ │ ├── GroupCacheItem.java │ │ │ │ └── MsgCount.java │ │ │ │ ├── repo │ │ │ │ └── ProcessedMsgRepo.java │ │ │ │ └── status │ │ │ │ ├── DeviceGroupItem.java │ │ │ │ ├── DeviceGroupOutline.java │ │ │ │ └── DeviceItem.java │ │ │ ├── server │ │ │ └── statistic │ │ │ │ ├── CollectInfo.java │ │ │ │ ├── info │ │ │ │ ├── DataBaseInfo.java │ │ │ │ ├── ServerInfo.java │ │ │ │ ├── ServerSettingInfo.java │ │ │ │ ├── ServerStatusInfo.java │ │ │ │ ├── SysEnvInfo.java │ │ │ │ ├── TcpDetailInfo.java │ │ │ │ └── TcpInfo.java │ │ │ │ └── util │ │ │ │ ├── IpUtils.java │ │ │ │ └── Test.java │ │ │ ├── tcp │ │ │ └── statistic │ │ │ │ ├── channel │ │ │ │ ├── ChannelItem.java │ │ │ │ └── ChannelOutline.java │ │ │ │ └── except │ │ │ │ ├── TcpFeedbackItem.java │ │ │ │ └── TypeEnum.java │ │ │ └── web │ │ │ └── spa │ │ │ ├── data │ │ │ ├── DataProcessController.java │ │ │ ├── pojo │ │ │ │ ├── DeviceStatusItem.java │ │ │ │ ├── EmployeeCategory.java │ │ │ │ ├── EmployeeGatherByDepartment.java │ │ │ │ ├── EmployeeGatherByGroup.java │ │ │ │ └── EmployeeGatherOutline.java │ │ │ └── random │ │ │ │ ├── KyRandom.java │ │ │ │ └── MsgCountRandom.java │ │ │ ├── feedbackmsg │ │ │ └── FeedbackMsgController.java │ │ │ ├── server │ │ │ └── ServerInnerController.java │ │ │ ├── tcp │ │ │ ├── KyRandom.java │ │ │ └── TcpController.java │ │ │ ├── user │ │ │ ├── UserController.java │ │ │ └── pojo │ │ │ │ ├── Token.java │ │ │ │ ├── UserInfo.java │ │ │ │ └── UserLogin.java │ │ │ └── utils │ │ │ └── ResMsg.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── cc │ └── bitky │ └── clusterdeviceplatform │ └── demo │ └── DemoApplicationTests.java ├── mdphoto ├── main11.jpg ├── main12.jpg ├── main13.jpg ├── main19.png ├── main20.jpg ├── main21.jpg └── main22.jpg └── script ├── README.md ├── buildProject ├── .gitignore ├── run.sh ├── script-template │ ├── client-template │ └── server-template └── template │ └── setting ├── createHistoryStatus ├── .gitignore ├── .vscode │ └── settings.json ├── main.py └── utils │ ├── device_create.py │ └── history_item.py └── createTestData ├── .gitignore ├── .vscode └── settings.json ├── main.py └── utils ├── device_create.py └── namecreater.py /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 整理/ 2 | publish/ 3 | messageUtils/ 4 | 5 | # Node.js 6 | # ***************************** 7 | # Logs 8 | logs 9 | *.log 10 | npm-debug.log* 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | 17 | # Directory for instrumented libs generated by jscoverage/JSCover 18 | lib-cov 19 | 20 | # Coverage directory used by tools like istanbul 21 | coverage 22 | 23 | # nyc test coverage 24 | .nyc_output 25 | 26 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 27 | .grunt 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules 37 | jspm_packages 38 | 39 | # Optional npm cache directory 40 | .npm 41 | 42 | # Optional REPL history 43 | .node_repl_history 44 | 45 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | 3 | jdk: 4 | - openjdk8 5 | 6 | script: 7 | - cd clusterdeviceplatform-demo 8 | - /bin/bash gradlew build 9 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | NA 2 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-client/.gitignore: -------------------------------------------------------------------------------- 1 | /.gradle/ 2 | /build/ 3 | /gradle/ 4 | /libs/ 5 | /out/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | 15 | ### IntelliJ IDEA ### 16 | .idea 17 | *.iws 18 | *.iml 19 | *.ipr 20 | 21 | ### NetBeans ### 22 | nbproject/private/ 23 | build/ 24 | nbbuild/ 25 | dist/ 26 | nbdist/ 27 | .nb-gradle/ -------------------------------------------------------------------------------- /ClusterDevicePlatform-client/src/main/java/cc/bitky/clusterdeviceplatform/client/config/CommSetting.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.client.config; 2 | 3 | public class CommSetting { 4 | /** 5 | * 待发送缓冲队列中,帧发送间隔「单位/ms」 6 | */ 7 | public static int FRAME_SEND_INTERVAL = 10; 8 | /** 9 | * 服务器主机名 10 | */ 11 | public static String SERVER_HOSTNAME = "localhost"; 12 | /** 13 | * 服务器端口号 14 | */ 15 | public static int SERVER_PORT = 30232; 16 | /** 17 | * TCP 通道验证时间 18 | */ 19 | public static int ACCESSIBLE_CHANNEL_REPLY_INTERVAL = 1000; 20 | } 21 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-client/src/main/java/cc/bitky/clusterdeviceplatform/client/config/DeviceSetting.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.client.config; 2 | 3 | public class DeviceSetting { 4 | /** 5 | * 最大设备组号 6 | */ 7 | public static int MAX_GROUP_ID = 100; 8 | /** 9 | * 设备组内的最大设备号 10 | */ 11 | public static final int MAX_DEVICE_ID = 100; 12 | } 13 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-client/src/main/java/cc/bitky/clusterdeviceplatform/client/server/repo/MsgPackage.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.client.server.repo; 2 | 3 | import cc.bitky.clusterdeviceplatform.messageutils.msg.statusreply.MsgReplyDeviceStatus; 4 | 5 | public class MsgPackage { 6 | MsgReplyDeviceStatus chargeStatus; 7 | MsgReplyDeviceStatus workStatus; 8 | 9 | public MsgPackage(MsgReplyDeviceStatus chargeStatus, MsgReplyDeviceStatus workStatus) { 10 | this.chargeStatus = chargeStatus; 11 | this.workStatus = workStatus; 12 | } 13 | 14 | public MsgReplyDeviceStatus getChargeStatus() { 15 | return chargeStatus; 16 | } 17 | 18 | public MsgReplyDeviceStatus getWorkStatus() { 19 | return workStatus; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-client/src/main/java/cc/bitky/clusterdeviceplatform/client/server/statistic/ProcessedMsgRepo.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.client.server.statistic; 2 | 3 | import java.util.concurrent.atomic.AtomicLong; 4 | 5 | public class ProcessedMsgRepo { 6 | /** 7 | * 已收到的消息总数 8 | */ 9 | public static final AtomicLong MSG_COUNT = new AtomicLong(0); 10 | /** 11 | * 已收到的充电状态帧总数 12 | */ 13 | public static final AtomicLong MSG_CHARGE_COUNT = new AtomicLong(0); 14 | /** 15 | * 状态已改变的充电状态帧总数 16 | */ 17 | public static final AtomicLong MSG_CHARGE_COUNT_FIXED = new AtomicLong(0); 18 | /** 19 | * 状态未改变的充电状态帧总数 20 | */ 21 | public static final AtomicLong MSG_CHARGE_COUNT_VARIABLE = new AtomicLong(0); 22 | /** 23 | * 已收到的工作状态帧总数 24 | */ 25 | public static final AtomicLong MSG_WORK_COUNT = new AtomicLong(0); 26 | /** 27 | * 状态已改变的工作状态帧总数 28 | */ 29 | public static final AtomicLong MSG_WORK_COUNT_FIXED = new AtomicLong(0); 30 | /** 31 | * 状态未改变的工作状态帧总数 32 | */ 33 | public static final AtomicLong MSG_WORK_COUNT_VARIABLE = new AtomicLong(0); 34 | } 35 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-client/src/main/java/cc/bitky/clusterdeviceplatform/client/ui/UiPresenter.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.client.ui; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.boot.CommandLineRunner; 5 | import org.springframework.stereotype.Service; 6 | 7 | import cc.bitky.clusterdeviceplatform.client.server.ServerTcpHandler; 8 | import cc.bitky.clusterdeviceplatform.client.ui.view.UiLauncher; 9 | import cc.bitky.clusterdeviceplatform.messageutils.define.base.BaseMsg; 10 | 11 | @Service 12 | public class UiPresenter implements CommandLineRunner { 13 | 14 | public final ServerTcpHandler server; 15 | 16 | @Autowired 17 | public UiPresenter(ServerTcpHandler server) { 18 | this.server = server; 19 | } 20 | 21 | @Override 22 | public void run(String... args) throws Exception { 23 | UiLauncher.runUi(this, args); 24 | } 25 | 26 | public void shutdown() { 27 | server.shutdown(); 28 | } 29 | 30 | public void sendMessage(BaseMsg message) { 31 | server.sendMessage(message); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-client/src/main/java/cc/bitky/clusterdeviceplatform/client/ui/bean/DeviceGroup.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.client.ui.bean; 2 | 3 | public class DeviceGroup { 4 | 5 | int groupId; 6 | 7 | public DeviceGroup(int groupId) { 8 | this.groupId = groupId; 9 | } 10 | 11 | public int getGroupId() { 12 | 13 | return groupId; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-client/src/main/java/cc/bitky/clusterdeviceplatform/client/ui/bean/DeviceGroupListCell.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.client.ui.bean; 2 | 3 | import com.jfoenix.controls.JFXListCell; 4 | 5 | public class DeviceGroupListCell extends JFXListCell { 6 | 7 | @Override 8 | protected void updateItem(DeviceGroup item, boolean empty) { 9 | super.updateItem(item, empty); 10 | if (item != null) { 11 | setText("第 " + item.getGroupId() + " 组"); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-client/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | debug=false 2 | server.port=8081 3 | logging.level.root=info -------------------------------------------------------------------------------- /ClusterDevicePlatform-client/src/main/resources/fxml/main-view.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 |
29 |
30 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-client/src/test/java/cc/bitky/clusterdeviceplatform/client/ClientApplicationTests.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.client; 2 | 3 | //@RunWith(SpringRunner.class) 4 | //@SpringBootTest 5 | public class ClientApplicationTests { 6 | 7 | // @Test 8 | // public void contextLoads() { 9 | // } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/.gitignore: -------------------------------------------------------------------------------- 1 | setting 2 | src/test/java/ 3 | *.exe 4 | *.dll 5 | 6 | /.gradle/ 7 | /build/ 8 | /libs/ 9 | /out/ 10 | 11 | ### STS ### 12 | .apt_generated 13 | .classpath 14 | .factorypath 15 | .project 16 | .settings 17 | .springBeans 18 | 19 | ### IntelliJ IDEA ### 20 | .idea 21 | *.iws 22 | *.iml 23 | *.ipr 24 | 25 | ### NetBeans ### 26 | nbproject/private/ 27 | build/ 28 | nbbuild/ 29 | dist/ 30 | nbdist/ 31 | .nb-gradle/ 32 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '2.3.4.RELEASE' 4 | } 5 | repositories { 6 | mavenCentral() 7 | } 8 | dependencies { 9 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 10 | } 11 | } 12 | 13 | plugins { 14 | id "io.freefair.lombok" version "5.1.1" 15 | } 16 | 17 | apply plugin: 'java' 18 | apply plugin: 'eclipse' 19 | apply plugin: 'org.springframework.boot' 20 | apply plugin: 'io.spring.dependency-management' 21 | 22 | group = 'cc.bitky.ClusterDevicePlatform' 23 | version = '1.16.0-release' 24 | sourceCompatibility = 1.8 25 | 26 | repositories { 27 | mavenCentral() 28 | } 29 | 30 | tasks.withType(JavaCompile) { 31 | options.encoding = "UTF-8" 32 | } 33 | 34 | dependencies { 35 | compile('org.springframework.boot:spring-boot-starter-data-mongodb-reactive') 36 | compile('org.springframework.boot:spring-boot-starter-web') 37 | compile 'io.netty:netty-all:4.1.52.Final' 38 | compile 'com.alibaba:fastjson:1.2.73' 39 | compile files('../messageUtils/build/libs/messageUtils-1.16.0.jar') 40 | compile files('../SerialRawData/build/libs/SerialRawData-1.1.0.jar') 41 | } 42 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/ClusterDevicePlatform-server/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/lombok.config: -------------------------------------------------------------------------------- 1 | # This file is generated by the 'io.freefair.lombok' Gradle plugin 2 | config.stopBubbling = true 3 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/config/DbSetting.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.config; 2 | 3 | public class DbSetting { 4 | /** 5 | * MongoDB 的主机名 6 | */ 7 | public static String mongodbHost = "lml-desktop"; 8 | /** 9 | * MongoDB 的端口号 10 | */ 11 | public static int mongodbPort = 27017; 12 | /** 13 | * MongoDB 的IP地址 14 | */ 15 | public static String mongodbIp = "未知"; 16 | /** 17 | * 数据库 18 | */ 19 | public static String database = "bitkyTest"; 20 | /** 21 | * 异常消息的最大缓存容量 22 | */ 23 | public static int feedbackItemSizeMax = 500; 24 | /** 25 | * 默认员工卡号 26 | */ 27 | public static String defaultEmployeeCardNumber = "0"; 28 | /** 29 | * 默认员工姓名 30 | */ 31 | public static String defaultEmployeeName = "备用"; 32 | /** 33 | * 默认员工单位 34 | */ 35 | public static String defaultEmployeeDepartment = "默认单位"; 36 | /** 37 | * 数据库认证用户名 38 | */ 39 | public static String databaseUsername = "数据库用户名"; 40 | /** 41 | * 数据库认证密码 42 | */ 43 | public static String databasePassword = "数据库密码"; 44 | /** 45 | * 数据库认证状态 46 | */ 47 | public static boolean databaseAuthenticationStatus = false; 48 | } 49 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/config/DeviceSetting.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.config; 2 | 3 | public class DeviceSetting { 4 | /** 5 | * 最大设备组号 6 | */ 7 | public static final int MAX_GROUP_ID = 100; 8 | /** 9 | * 设备组内的最大设备号 10 | */ 11 | public static final int MAX_DEVICE_ID = 100; 12 | 13 | /** 14 | * 「时间同步计划任务」执行时间间隔『分钟』 15 | */ 16 | public static final int TIMESYNC_INTERVAL = 30; 17 | } 18 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/config/WebSetting.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.config; 2 | 3 | public class WebSetting { 4 | /** 5 | * 设备组号为该值时,获取到用于广播所有 Channel 的广播帧 6 | */ 7 | public static final int BROADCAST_GROUP_ID = 255; 8 | /** 9 | * 设备号为该值时,获取到用于特定 Channel 中所有设备的广播帧 10 | */ 11 | public static final int BROADCAST_DEVICE_ID = 255; 12 | } 13 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/db/.gitignore: -------------------------------------------------------------------------------- 1 | DbPresenter.java 2 | /operate/ -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/db/dto/CardSet.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.db.dto; 2 | 3 | import lombok.Data; 4 | import org.springframework.data.annotation.Id; 5 | import org.springframework.data.mongodb.core.mapping.Document; 6 | 7 | /** 8 | * @author limingliang 9 | */ 10 | @Data 11 | @Document(collection = "CardSet") 12 | public class CardSet { 13 | 14 | @Id 15 | private String id; 16 | private String[] cardList; 17 | 18 | public CardSet(String id, String[] cardList) { 19 | this.id = id; 20 | this.cardList = cardList; 21 | } 22 | 23 | public CardSet() { 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/db/dto/DeviceGroup.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.db.dto; 2 | 3 | import lombok.Data; 4 | import org.springframework.data.annotation.Id; 5 | import org.springframework.data.mongodb.core.mapping.Document; 6 | import org.springframework.data.mongodb.core.mapping.Field; 7 | 8 | import java.util.Date; 9 | 10 | @Data 11 | @Document(collection = "DeviceGroup") 12 | public class DeviceGroup { 13 | 14 | @Id 15 | private String id; 16 | 17 | @Field("HeartBeatTime") 18 | private Date heartBeatTime; 19 | 20 | @Field("GroupId") 21 | private int groupId; 22 | 23 | 24 | public DeviceGroup(int groupId) { 25 | this.groupId = groupId; 26 | heartBeatTime = new Date(0); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/db/dto/routineinfo/DutyInfo.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.db.dto.routineinfo; 2 | 3 | import java.util.Date; 4 | 5 | public class DutyInfo { 6 | 7 | private Date onTime; 8 | private Date offTime; 9 | 10 | public DutyInfo(long onTime) { 11 | this.onTime = new Date(onTime); 12 | } 13 | 14 | public DutyInfo() { 15 | } 16 | 17 | public Date getOnTime() { 18 | return onTime; 19 | } 20 | 21 | public void setOnTime(Date onTime) { 22 | this.onTime = onTime; 23 | } 24 | 25 | public Date getOffTime() { 26 | return offTime; 27 | } 28 | 29 | public void setOffTime(Date offTime) { 30 | this.offTime = offTime; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/db/dto/routineinfo/HistoryInfo.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.db.dto.routineinfo; 2 | 3 | import org.springframework.data.mongodb.core.mapping.Document; 4 | import org.springframework.data.mongodb.core.mapping.Field; 5 | 6 | import java.util.Date; 7 | 8 | @Document(collection = "HistoryInfo") 9 | public class HistoryInfo { 10 | 11 | @Field("Time") 12 | private Date time; 13 | 14 | @Field("Status") 15 | private int status = -1; 16 | 17 | 18 | public HistoryInfo(long time, int status) { 19 | this.time = new Date(time); 20 | this.status = status; 21 | } 22 | 23 | public HistoryInfo() { 24 | time = new Date(0); 25 | } 26 | 27 | public int getStatus() { 28 | return status; 29 | } 30 | 31 | public void setStatus(int status) { 32 | this.status = status; 33 | } 34 | 35 | public Date getTime() { 36 | return time; 37 | } 38 | 39 | public void setTime(Date time) { 40 | this.time = time; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/db/dto/routineinfo/LampStatusHistory.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.db.dto.routineinfo; 2 | 3 | import org.springframework.data.annotation.Id; 4 | import org.springframework.data.mongodb.core.mapping.Document; 5 | import org.springframework.data.mongodb.core.mapping.Field; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | @Document(collection = "LampStatusHistory") 11 | public class LampStatusHistory { 12 | 13 | @Id 14 | private String id; 15 | 16 | @Field("ChargeStatus") 17 | private List chargeStatus = new ArrayList<>(); 18 | 19 | @Field("WorkStatus") 20 | private List workStatus = new ArrayList<>(); 21 | 22 | 23 | public String getId() { 24 | return id; 25 | } 26 | 27 | public void setId(String id) { 28 | this.id = id; 29 | } 30 | 31 | public List getChargeStatus() { 32 | return chargeStatus; 33 | } 34 | 35 | public void setChargeStatus(List chargeStatus) { 36 | this.chargeStatus = chargeStatus; 37 | } 38 | 39 | public List getWorkStatus() { 40 | return workStatus; 41 | } 42 | 43 | public void setWorkStatus(List workStatus) { 44 | this.workStatus = workStatus; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/db/operate/CardSetOperate.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.db.operate; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import cc.bitky.clusterdeviceplatform.server.db.dto.CardSet; 7 | import cc.bitky.clusterdeviceplatform.server.db.repository.CardSetRepository; 8 | import reactor.core.publisher.Mono; 9 | 10 | @Repository 11 | public class CardSetOperate { 12 | 13 | private final CardSetRepository repository; 14 | 15 | @Autowired 16 | public CardSetOperate(CardSetRepository repository) { 17 | this.repository = repository; 18 | } 19 | 20 | /** 21 | * 保存特定的卡号组 22 | * 23 | * @param objectId 卡号组的名称 24 | * @param cardSet 特定的卡号组 25 | * @return 已保存的卡号组 26 | */ 27 | public Mono saveCardSet(String objectId, String[] cardSet) { 28 | return repository.save(new CardSet(objectId, cardSet)); 29 | } 30 | 31 | /** 32 | * 根据名称获取指定的卡号组 33 | * 34 | * @param name 卡号组的名称 35 | * @return 特定的卡号组 36 | */ 37 | public Mono obtainCardSet(String name) { 38 | return repository.findById(name); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/db/operate/EmployeeOperate.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.db.operate; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import java.util.List; 7 | import java.util.Optional; 8 | 9 | import cc.bitky.clusterdeviceplatform.server.db.dto.Employee; 10 | import cc.bitky.clusterdeviceplatform.server.db.repository.EmployeeRepository; 11 | 12 | @Repository 13 | public class EmployeeOperate { 14 | 15 | private final EmployeeRepository repository; 16 | 17 | @Autowired 18 | public EmployeeOperate(EmployeeRepository repository) { 19 | this.repository = repository; 20 | } 21 | 22 | /** 23 | * 根据 ObjectId 检索指定的员工对象 24 | * 25 | * @param objectId 员工的 ObjectId 26 | * @return 指定的员工对象 27 | */ 28 | public Optional queryEmployee(String objectId) { 29 | return repository.findById(objectId); 30 | } 31 | 32 | /** 33 | * 检索所有的员工对象 34 | * 35 | * @return 员工对象集合 36 | */ 37 | public List queryEmployeeAll() { 38 | return repository.findAll(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/db/repository/CardSetRepository.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.db.repository; 2 | 3 | import org.springframework.data.repository.reactive.ReactiveCrudRepository; 4 | 5 | import cc.bitky.clusterdeviceplatform.server.db.dto.CardSet; 6 | 7 | public interface CardSetRepository extends ReactiveCrudRepository { 8 | 9 | // Mono findByCardList(); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/db/repository/DeviceRepository.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.db.repository; 2 | 3 | import org.springframework.data.mongodb.repository.MongoRepository; 4 | 5 | import java.util.List; 6 | 7 | import cc.bitky.clusterdeviceplatform.server.db.dto.Device; 8 | 9 | 10 | public interface DeviceRepository extends MongoRepository { 11 | 12 | /** 13 | * 通过组号和设备号查询特定设备 14 | * 15 | * @param groupId 组号 16 | * @param deviceId 设备号 17 | * @return 查询到的特定设备 18 | */ 19 | List findByGroupIdAndDeviceId(int groupId, int deviceId); 20 | 21 | Device findFirstByGroupIdAndDeviceId(int groupId, int deviceId); 22 | 23 | /** 24 | * 通过组号查询特定设备组 25 | * 26 | * @param groupid 组号 27 | * @return 查询到的设备组 28 | */ 29 | List findByGroupId(int groupid); 30 | } 31 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/db/repository/EmployeeRepository.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.db.repository; 2 | 3 | import org.springframework.data.mongodb.repository.MongoRepository; 4 | 5 | import cc.bitky.clusterdeviceplatform.server.db.dto.Employee; 6 | 7 | 8 | public interface EmployeeRepository extends MongoRepository { 9 | } 10 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/db/repository/RoutineTableRepository.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.db.repository; 2 | 3 | import org.springframework.data.mongodb.repository.MongoRepository; 4 | 5 | import cc.bitky.clusterdeviceplatform.server.db.dto.routineinfo.LampStatusHistory; 6 | 7 | public interface RoutineTableRepository extends MongoRepository { 8 | } 9 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/db/statistic/repo/ProcessedMsgRepo.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.db.statistic.repo; 2 | 3 | import java.util.concurrent.atomic.AtomicLong; 4 | 5 | public class ProcessedMsgRepo { 6 | /** 7 | * 已收到的消息总数 8 | */ 9 | public static final AtomicLong MSG_COUNT = new AtomicLong(0); 10 | /** 11 | * 已收到的充电状态帧总数 12 | */ 13 | public static final AtomicLong MSG_CHARGE_COUNT = new AtomicLong(0); 14 | /** 15 | * 状态已改变的充电状态帧总数 16 | */ 17 | public static final AtomicLong MSG_CHARGE_COUNT_FIXED = new AtomicLong(0); 18 | /** 19 | * 状态未改变的充电状态帧总数 20 | */ 21 | public static final AtomicLong MSG_CHARGE_COUNT_VARIABLE = new AtomicLong(0); 22 | /** 23 | * 已收到的工作状态帧总数 24 | */ 25 | public static final AtomicLong MSG_WORK_COUNT = new AtomicLong(0); 26 | /** 27 | * 状态已改变的工作状态帧总数 28 | */ 29 | public static final AtomicLong MSG_WORK_COUNT_FIXED = new AtomicLong(0); 30 | /** 31 | * 状态未改变的工作状态帧总数 32 | */ 33 | public static final AtomicLong MSG_WORK_COUNT_VARIABLE = new AtomicLong(0); 34 | } 35 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/db/statistic/status/DeviceGroupOutline.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.db.statistic.status; 2 | 3 | import lombok.Getter; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 需统计的通道消息汇总 9 | */ 10 | @Getter 11 | public class DeviceGroupOutline { 12 | /** 13 | * 设备组集合 14 | */ 15 | private List deviceGroupItems; 16 | /** 17 | * 设备组总数 18 | */ 19 | private int deviceGroupCount; 20 | /** 21 | * 负载正常的界限 22 | */ 23 | private int normalLimit; 24 | /** 25 | * 负载异常的界限 26 | */ 27 | private int exceptionLimit; 28 | 29 | public DeviceGroupOutline(List deviceGroupItems, int deviceGroupCount) { 30 | this.deviceGroupItems = deviceGroupItems; 31 | this.deviceGroupCount = deviceGroupCount; 32 | } 33 | 34 | /** 35 | * 设置前端界面报警的限定 36 | * 37 | * @param normalLimit 负载正常的界限 38 | * @param exceptionLimit 负载异常的界限 39 | */ 40 | public void setAlarmLimit(int normalLimit, int exceptionLimit) { 41 | this.normalLimit = normalLimit; 42 | this.exceptionLimit = exceptionLimit; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/db/statistic/status/DeviceStatusItem.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.db.statistic.status; 2 | 3 | import cc.bitky.clusterdeviceplatform.messageutils.config.ChargeStatus; 4 | import cc.bitky.clusterdeviceplatform.messageutils.config.WorkStatus; 5 | import lombok.Getter; 6 | 7 | /** 8 | * TCP模块中单个 Channel 的当前负载量 9 | */ 10 | @Getter 11 | public class DeviceStatusItem { 12 | /** 13 | * 通道的 ID 14 | */ 15 | private int id; 16 | /** 17 | * 充电状态码 18 | */ 19 | private int chargeStatus; 20 | /** 21 | * 充电状态文字描述 22 | */ 23 | private String chargeStatusDescription; 24 | /** 25 | * 工作状态码 26 | */ 27 | private int workStatus; 28 | /** 29 | * 工作状态文字描述 30 | */ 31 | private String workStatusDescription; 32 | 33 | public DeviceStatusItem(int id, int chargeStatus, int workStatus) { 34 | this.id = id; 35 | this.chargeStatus = chargeStatus; 36 | this.chargeStatusDescription = ChargeStatus.obtainDescription(chargeStatus); 37 | this.workStatus = workStatus; 38 | this.workStatusDescription = WorkStatus.obtainDescription(workStatus); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/db/work/KyMongoConfig.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.db.work; 2 | 3 | import cc.bitky.clusterdeviceplatform.server.config.DbSetting; 4 | import com.mongodb.reactivestreams.client.MongoClient; 5 | import com.mongodb.reactivestreams.client.MongoClients; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.data.mongodb.core.ReactiveMongoTemplate; 9 | 10 | /** 11 | * @author limingliang 12 | */ 13 | @Configuration 14 | public class KyMongoConfig { 15 | 16 | @Bean 17 | public MongoClient reactiveMongoClient() { 18 | if (DbSetting.databaseAuthenticationStatus) { 19 | return MongoClients.create("mongodb://" + DbSetting.databaseUsername + ":" + DbSetting.databasePassword + "@" + DbSetting.mongodbHost + ":" + DbSetting.mongodbPort + "/" + DbSetting.database); 20 | } else { 21 | return MongoClients.create("mongodb://" + DbSetting.mongodbHost + ":" + DbSetting.mongodbPort); 22 | } 23 | } 24 | 25 | @Bean 26 | public ReactiveMongoTemplate reactiveMongoTemplate() { 27 | return new ReactiveMongoTemplate(reactiveMongoClient(), getDatabaseName()); 28 | } 29 | 30 | private String getDatabaseName() { 31 | return DbSetting.database; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/pojo/client/CardType.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.pojo.client; 2 | 3 | public enum CardType { 4 | /** 5 | * 万能卡 6 | */ 7 | Free, 8 | /** 9 | * 确认卡 10 | */ 11 | Confirm, 12 | /** 13 | * 清除卡 14 | */ 15 | Clear, 16 | /** 17 | * 空 18 | */ 19 | None 20 | } 21 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/pojo/client/QueueInfo.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.pojo.client; 2 | 3 | 4 | /** 5 | * CAN 帧发送队列局部信息 6 | */ 7 | public class QueueInfo { 8 | /** 9 | * CAN 帧发送队列中帧的数量 10 | */ 11 | private int size; 12 | /** 13 | * CAN 帧发送队列容量 14 | */ 15 | private int capacity; 16 | /** 17 | * CAN 帧发送间隔 18 | */ 19 | private int interval; 20 | 21 | public QueueInfo(int size, int capacity, int interval) { 22 | this.size = size; 23 | this.capacity = capacity; 24 | this.interval = interval; 25 | } 26 | 27 | public int getSize() { 28 | return size; 29 | } 30 | 31 | public void setSize(int size) { 32 | this.size = size; 33 | } 34 | 35 | public int getCapacity() { 36 | return capacity; 37 | } 38 | 39 | public void setCapacity(int capacity) { 40 | this.capacity = capacity; 41 | } 42 | 43 | public int getInterval() { 44 | return interval; 45 | } 46 | 47 | public void setInterval(int interval) { 48 | this.interval = interval; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/pojo/dataprocess/DeviceStatusItem.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.pojo.dataprocess; 2 | 3 | public class DeviceStatusItem { 4 | /** 5 | * 充电状态码 6 | */ 7 | private int chargeStatus; 8 | /** 9 | * 工作状态码 10 | */ 11 | private int workStatus; 12 | 13 | public DeviceStatusItem(int chargeStatus, int workStatus) { 14 | this.chargeStatus = chargeStatus; 15 | this.workStatus = workStatus; 16 | } 17 | 18 | public int getChargeStatus() { 19 | return chargeStatus; 20 | } 21 | 22 | public int getWorkStatus() { 23 | return workStatus; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/pojo/dataprocess/EmployeeGatherByDepartment.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.pojo.dataprocess; 2 | 3 | public class EmployeeGatherByDepartment { 4 | /** 5 | * 部门名称 6 | */ 7 | String department; 8 | /** 9 | * 总人数 10 | */ 11 | int population; 12 | /** 13 | * 分类 14 | */ 15 | EmployeeCategory category; 16 | 17 | public EmployeeGatherByDepartment(String department, int population, EmployeeCategory category) { 18 | 19 | this.department = department; 20 | this.population = population; 21 | this.category = category; 22 | } 23 | 24 | public String getDepartment() { 25 | return department; 26 | } 27 | 28 | public int getPopulation() { 29 | return population; 30 | } 31 | 32 | public EmployeeCategory getCategory() { 33 | return category; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/pojo/dataprocess/EmployeeGatherByGroup.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.pojo.dataprocess; 2 | 3 | public class EmployeeGatherByGroup { 4 | /** 5 | * 设备组 ID 6 | */ 7 | private int groupId; 8 | /** 9 | * 总人数 10 | */ 11 | private int population; 12 | /** 13 | * 分类 14 | */ 15 | private EmployeeCategory category; 16 | 17 | public EmployeeGatherByGroup(int groupId, int population, EmployeeCategory category) { 18 | this.groupId = groupId; 19 | this.population = population; 20 | this.category = category; 21 | } 22 | 23 | public int getGroupId() { 24 | return groupId; 25 | } 26 | 27 | public int getPopulation() { 28 | return population; 29 | } 30 | 31 | public EmployeeCategory getCategory() { 32 | return category; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/pojo/dataprocess/EmployeeGatherOutline.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.pojo.dataprocess; 2 | 3 | import java.util.List; 4 | 5 | public class EmployeeGatherOutline { 6 | List departments; 7 | List deviceGroup; 8 | 9 | public EmployeeGatherOutline(List departments, List deviceGroup) { 10 | this.departments = departments; 11 | this.deviceGroup = deviceGroup; 12 | } 13 | 14 | public List getDepartments() { 15 | return departments; 16 | } 17 | 18 | public List getDeviceGroup() { 19 | return deviceGroup; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/pojo/tcp/BaseMsgSending.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.pojo.tcp; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | public class BaseMsgSending { 7 | 8 | private int msgCount; 9 | private int msgSendingCount; 10 | private List msgSendings = Collections.emptyList(); 11 | 12 | protected BaseMsgSending(int msgCount, int msgSendingCount) { 13 | this.msgCount = msgCount; 14 | this.msgSendingCount = msgSendingCount; 15 | } 16 | 17 | public int getMsgCount() { 18 | return msgCount; 19 | } 20 | 21 | protected void setMsgCount(int msgCount) { 22 | this.msgCount = msgCount; 23 | } 24 | 25 | public int getMsgSendingCount() { 26 | return msgSendingCount; 27 | } 28 | 29 | protected void setMsgSendingCount(int msgSendingCount) { 30 | this.msgSendingCount = msgSendingCount; 31 | } 32 | 33 | public List getMsgSendings() { 34 | return msgSendings; 35 | } 36 | 37 | protected void setMsgSendings(List msgSendings) { 38 | this.msgSendings = msgSendings; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/pojo/tcp/MsgSending.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.pojo.tcp; 2 | 3 | import cc.bitky.clusterdeviceplatform.messageutils.define.base.BaseMsg; 4 | import cc.bitky.clusterdeviceplatform.messageutils.define.base.BaseMsgCodec; 5 | 6 | public class MsgSending { 7 | private int groupId; 8 | private int deviceId; 9 | private String detail = ""; 10 | private String type = ""; 11 | 12 | public MsgSending(BaseMsg msg) { 13 | groupId = msg.getGroupId(); 14 | deviceId = msg.getDeviceId(); 15 | BaseMsgCodec msgCodec = msg.getMsgCodec(); 16 | if (msgCodec != null) { 17 | detail = msgCodec.getDetail(); 18 | if (msgCodec.getMajorMsgId() == 0x11) { 19 | type = "portrait"; 20 | } 21 | } 22 | } 23 | 24 | public int getGroupId() { 25 | return groupId; 26 | } 27 | 28 | public int getDeviceId() { 29 | return deviceId; 30 | } 31 | 32 | public String getDetail() { 33 | return detail; 34 | } 35 | 36 | public String getType() { 37 | return type; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/pojo/user/Token.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.pojo.user; 2 | 3 | public class Token { 4 | String token = "admin"; 5 | 6 | public String getToken() { 7 | return token; 8 | } 9 | 10 | public void setToken(String token) { 11 | this.token = token; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/pojo/user/UserInfo.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.pojo.user; 2 | 3 | public class UserInfo { 4 | String[] role = {"admin"}; 5 | String name = "admin"; 6 | String avatar = "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif"; 7 | 8 | public String[] getRole() { 9 | return role; 10 | } 11 | 12 | public void setRole(String[] role) { 13 | this.role = role; 14 | } 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name; 22 | } 23 | 24 | public String getAvatar() { 25 | return avatar; 26 | } 27 | 28 | public void setAvatar(String avatar) { 29 | this.avatar = avatar; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/pojo/user/UserLogin.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.pojo.user; 2 | 3 | public class UserLogin { 4 | public String username; 5 | public String password; 6 | 7 | public String getUsername() { 8 | return username; 9 | } 10 | 11 | public void setUsername(String username) { 12 | this.username = username; 13 | } 14 | 15 | public String getPassword() { 16 | return password; 17 | } 18 | 19 | public void setPassword(String password) { 20 | this.password = password; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/server/ServerWebProcessor.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.server; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | 6 | import cc.bitky.clusterdeviceplatform.messageutils.define.base.BaseMsg; 7 | import cc.bitky.clusterdeviceplatform.server.db.DbPresenter; 8 | 9 | @Service 10 | public class ServerWebProcessor { 11 | 12 | private final ServerCenterProcessor centerProcessor; 13 | 14 | 15 | @Autowired 16 | public ServerWebProcessor(ServerCenterProcessor centerProcessor) { 17 | this.centerProcessor = centerProcessor; 18 | } 19 | 20 | public ServerTcpProcessor getTcpProcessor() { 21 | return centerProcessor.getTcpProcessor(); 22 | } 23 | 24 | public DbPresenter getDbPresenter() { 25 | return centerProcessor.getDbPresenter(); 26 | } 27 | 28 | public boolean sendMessageGrouped(BaseMsg message) { 29 | return centerProcessor.sendMessageGrouped(message); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/server/demonstrate/msgprocess/MsgCountRandom.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.server.demonstrate.msgprocess; 2 | 3 | import java.util.Random; 4 | 5 | import cc.bitky.clusterdeviceplatform.server.db.statistic.pressure.MsgCount; 6 | 7 | /** 8 | * 待处理及已处理消息统计计数 9 | */ 10 | public class MsgCountRandom extends MsgCount { 11 | 12 | public MsgCountRandom(MsgCountRandom random) { 13 | if (random == null) { 14 | return; 15 | } 16 | Random r = new Random(); 17 | setMsgChargeCountFixed(random.getMsgChargeCountFixed() + r.nextInt(100)); 18 | setMsgChargeCountVariable(random.getMsgChargeCountVariable() + r.nextInt(100)); 19 | setMsgWorkCountFixed(random.getMsgWorkCountFixed() + r.nextInt(100)); 20 | setMsgWorkCountVariable(random.getMsgWorkCountVariable() + r.nextInt(100)); 21 | setMsgChargeCount(getMsgChargeCountVariable() + getMsgChargeCountFixed()); 22 | setMsgWorkCount(getMsgWorkCountVariable() + getMsgWorkCountFixed()); 23 | setMsgCount(getMsgWorkCount() + getMsgChargeCount()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/server/repo/bean/StatusItem.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.server.repo.bean; 2 | 3 | 4 | import cc.bitky.clusterdeviceplatform.messageutils.msg.statusreply.MsgReplyDeviceStatus; 5 | 6 | /** 7 | * 用于服务器临时存储的状态时间对象 8 | */ 9 | public class StatusItem { 10 | 11 | private final long time; 12 | 13 | private final int status; 14 | 15 | private StatusItem(long time, int status) { 16 | this.time = time; 17 | this.status = status; 18 | } 19 | 20 | public StatusItem() { 21 | this(-1, -1); 22 | } 23 | 24 | public static StatusItem newInstance(MsgReplyDeviceStatus item) { 25 | return new StatusItem(item.getTime(), item.getStatus()); 26 | } 27 | 28 | public long getTime() { 29 | return time; 30 | } 31 | 32 | public int getStatus() { 33 | return status; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/server/statistic/info/ServerInfo.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.server.statistic.info; 2 | 3 | import cc.bitky.clusterdeviceplatform.server.config.ServerSetting; 4 | import cc.bitky.clusterdeviceplatform.server.server.statistic.utils.IpUtil; 5 | 6 | 7 | public class ServerInfo { 8 | /** 9 | * 服务器版本 10 | */ 11 | String version = ServerSetting.VERSION; 12 | /** 13 | * web端口号 14 | */ 15 | int webPort = ServerSetting.SERVER_WEB_PORT; 16 | /** 17 | * tcp端口号 18 | */ 19 | int tcpPort= ServerSetting.SERVER_TCP_PORT; 20 | /** 21 | * 服务器主机名 22 | */ 23 | String hostName; 24 | /** 25 | * 服务器地址 26 | */ 27 | String[] ipAddress; 28 | 29 | public ServerInfo() { 30 | this.hostName = IpUtil.getLocalHostName(); 31 | this.ipAddress = IpUtil.getIP(hostName); 32 | } 33 | 34 | public int getWebPort() { 35 | return webPort; 36 | } 37 | 38 | public int getTcpPort() { 39 | return tcpPort; 40 | } 41 | 42 | public String getHostName() { 43 | return hostName; 44 | } 45 | 46 | public String[] getIpAddress() { 47 | return ipAddress; 48 | } 49 | 50 | public String getVersion() { 51 | return version; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/server/utils/DeviceOutBoundDetect.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.server.utils; 2 | 3 | import cc.bitky.clusterdeviceplatform.server.config.DeviceSetting; 4 | 5 | public class DeviceOutBoundDetect { 6 | /** 7 | * 指定的组号和设备号是否超出系统设定的界限 8 | * 9 | * @param groupId 设备组 ID 10 | * @param deviceId 设备 ID 11 | * @return 已超出界限返回true 12 | */ 13 | public static boolean detect(int groupId, int deviceId) { 14 | return groupId > DeviceSetting.MAX_GROUP_ID || groupId <= 0 || deviceId > DeviceSetting.MAX_DEVICE_ID || deviceId <= 0; 15 | } 16 | 17 | /** 18 | * 指定的组号和设备号是否超出系统设定的界限 19 | * 20 | * @param deviceId 设备 ID 21 | * @return 是否超出界限 22 | */ 23 | public static boolean detectDevice(int deviceId) { 24 | return deviceId > DeviceSetting.MAX_DEVICE_ID || deviceId <= 0; 25 | } 26 | 27 | /** 28 | * 指定的组号和设备号是否超出系统设定的界限 29 | * 30 | * @param groupId 设备组 ID 31 | * @return 是否超出界限 32 | */ 33 | public static boolean detectGroup(int groupId) { 34 | return groupId > DeviceSetting.MAX_GROUP_ID || groupId <= 0; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/tcp/handler/KyReadTimeoutHandler.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.tcp.handler; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import io.netty.handler.timeout.ReadTimeoutHandler; 7 | 8 | public class KyReadTimeoutHandler extends ReadTimeoutHandler { 9 | 10 | private final Logger logger = LoggerFactory.getLogger(getClass()); 11 | 12 | public KyReadTimeoutHandler(int timeoutSeconds) { 13 | super(timeoutSeconds); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/tcp/statistic/channel/ChannelItem.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.tcp.statistic.channel; 2 | 3 | /** 4 | * TCP模块中单个 Channel 的当前负载量 5 | */ 6 | public class ChannelItem { 7 | /** 8 | * 通道的 ID 9 | */ 10 | private int id; 11 | /** 12 | * 当前Channel是否已启用 13 | */ 14 | private boolean enabled; 15 | /** 16 | * 待发送缓冲区中的消息数 17 | */ 18 | private int count; 19 | 20 | public ChannelItem(int id, boolean enabled, int count) { 21 | this.id = id; 22 | this.enabled = enabled; 23 | this.count = count; 24 | } 25 | 26 | 27 | public int getId() { 28 | return id; 29 | } 30 | 31 | public boolean isEnabled() { 32 | return enabled; 33 | } 34 | 35 | public int getCount() { 36 | return count; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/tcp/statistic/except/TypeEnum.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.tcp.statistic.except; 2 | 3 | /** 4 | * 类型信息枚举 5 | */ 6 | public enum TypeEnum { 7 | 8 | RESEND_OUT_BOUND("消息重发次数超出限制"), 9 | 10 | CHANNEL_DISCONNECT("通道连接已断开"), 11 | 12 | WORK_STATUS_EXCEPTION("设备工作状态异常"), 13 | 14 | DEVICE_GROUP_NO_RESPONSE("设备组无响应"); 15 | 16 | private String detail; 17 | 18 | TypeEnum(String detail) { 19 | this.detail = detail; 20 | } 21 | 22 | public String getDetail() { 23 | return detail; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/utils/ResMsg.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.utils; 2 | 3 | public class ResMsg { 4 | 5 | int code = 20000; 6 | 7 | Object data = null; 8 | 9 | public ResMsg(Object data) { 10 | this.data = data; 11 | } 12 | 13 | public int getCode() { 14 | return code; 15 | } 16 | 17 | public Object getData() { 18 | return data; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/java/cc/bitky/clusterdeviceplatform/server/utils/WebUtil.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server.utils; 2 | 3 | import org.slf4j.Logger; 4 | 5 | public class WebUtil { 6 | public static void printTimeConsumed(long start, Logger logger) { 7 | long l2 = System.currentTimeMillis(); 8 | logger.info("耗时:" + (l2 - start) + " ms"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/resources/.gitignore: -------------------------------------------------------------------------------- 1 | /static/ -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | debug=false 2 | logging.level.root=info 3 | spring.servlet.multipart.max-file-size=50MB 4 | #logging.level.cc=info 5 | server.port=8080 -------------------------------------------------------------------------------- /ClusterDevicePlatform-server/src/test/java/cc/bitky/clusterdeviceplatform/server/ServerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.server; 2 | 3 | import java.util.concurrent.atomic.AtomicReference; 4 | 5 | import cc.bitky.clusterdeviceplatform.server.db.dto.Employee; 6 | 7 | //@RunWith(SpringRunner.class) 8 | //@SpringBootTest 9 | public class ServerApplicationTests { 10 | // @Test 11 | public void contextLoads() { 12 | int[][] d = new int[5][]; 13 | AtomicReference employee = new AtomicReference<>(); 14 | Employee employee1 = employee.get(); 15 | System.out.println(); 16 | } 17 | } 18 | 19 | 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 123lml123 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/ClusterManageServerTestIris/.gitignore: -------------------------------------------------------------------------------- 1 | /out/ 2 | .gradle 3 | /build/ 4 | !gradle/wrapper/gradle-wrapper.jar 5 | 6 | ### STS ### 7 | .apt_generated 8 | .classpath 9 | .factorypath 10 | .project 11 | .settings 12 | .springBeans 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | nbproject/private/ 22 | build/ 23 | nbbuild/ 24 | dist/ 25 | nbdist/ 26 | .nb-gradle/ -------------------------------------------------------------------------------- /Project-v1-Obsolete/ClusterManageServerTestIris/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '1.5.6.RELEASE' 4 | } 5 | repositories { 6 | mavenCentral() 7 | } 8 | dependencies { 9 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 10 | } 11 | } 12 | 13 | apply plugin: 'java' 14 | apply plugin: 'idea' 15 | apply plugin: 'org.springframework.boot' 16 | 17 | version = '0.0.1-SNAPSHOT' 18 | sourceCompatibility = 1.8 19 | 20 | repositories { 21 | mavenCentral() 22 | } 23 | 24 | dependencies { 25 | compile('org.springframework.boot:spring-boot-starter-web') 26 | testCompile('org.springframework.boot:spring-boot-starter-test') 27 | } 28 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/ClusterManageServerTestIris/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/Project-v1-Obsolete/ClusterManageServerTestIris/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Project-v1-Obsolete/ClusterManageServerTestIris/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Aug 13 19:58:18 CST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.5.1-all.zip 7 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/ClusterManageServerTestIris/out/production/classes/cc/bitky/ClusterManageServerTestIris/ClusterManageServerTestIrisApplication.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/Project-v1-Obsolete/ClusterManageServerTestIris/out/production/classes/cc/bitky/ClusterManageServerTestIris/ClusterManageServerTestIrisApplication.class -------------------------------------------------------------------------------- /Project-v1-Obsolete/ClusterManageServerTestIris/out/production/classes/cc/bitky/ClusterManageServerTestIris/OperateRestController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/Project-v1-Obsolete/ClusterManageServerTestIris/out/production/classes/cc/bitky/ClusterManageServerTestIris/OperateRestController.class -------------------------------------------------------------------------------- /Project-v1-Obsolete/ClusterManageServerTestIris/out/production/classes/cc/bitky/ClusterManageServerTestIris/ServerSetting.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/Project-v1-Obsolete/ClusterManageServerTestIris/out/production/classes/cc/bitky/ClusterManageServerTestIris/ServerSetting.class -------------------------------------------------------------------------------- /Project-v1-Obsolete/ClusterManageServerTestIris/out/production/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/Project-v1-Obsolete/ClusterManageServerTestIris/out/production/resources/application.properties -------------------------------------------------------------------------------- /Project-v1-Obsolete/ClusterManageServerTestIris/src/main/java/cc/bitky/ClusterManageServerTestIris/ClusterManageServerTestIrisApplication.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.ClusterManageServerTestIris; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class ClusterManageServerTestIrisApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(ClusterManageServerTestIrisApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/ClusterManageServerTestIris/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/Project-v1-Obsolete/ClusterManageServerTestIris/src/main/resources/application.properties -------------------------------------------------------------------------------- /Project-v1-Obsolete/ClusterManageServerTestIris/src/test/java/cc/bitky/ClusterManageServerTestIris/ClusterManageServerTestIrisApplicationTests.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.ClusterManageServerTestIris; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class ClusterManageServerTestIrisApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | test/ 3 | .mvn/ 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | nbproject/private/ 21 | build/ 22 | nbbuild/ 23 | dist/ 24 | nbdist/ 25 | .nb-gradle/ -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/WebMsgDeployEmployeeDepartment2.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.WebMsgBaseEmployee; 6 | 7 | /** 8 | * 服务器部署员工部门 9 | */ 10 | public class WebMsgDeployEmployeeDepartment2 extends WebMsgBaseEmployee { 11 | public WebMsgDeployEmployeeDepartment2(int groupId, int boxId, String value) { 12 | super(groupId, boxId, value); 13 | setMsgId(MsgType.SERVER_SET_EMPLOYEE_DEPARTMENT_2); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/CardType.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message; 2 | 3 | public enum CardType { 4 | /** 5 | * 万能卡 6 | */ 7 | FREE, 8 | /** 9 | * 确认卡 10 | */ 11 | CONFIRM, 12 | /** 13 | * 员工卡 14 | */ 15 | EMPLOYEE 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/WebMsgDeployFreeCardSpecial.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message; 2 | 3 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 4 | 5 | /** 6 | * 服务器部署万能卡号 7 | */ 8 | public class WebMsgDeployFreeCardSpecial extends BaseMessage { 9 | 10 | private final int itemId; 11 | private long cardNumber; 12 | 13 | /** 14 | * 服务器部署万能卡号 15 | * 16 | * @param groupId 组号 17 | * @param boxId 设备号 18 | * @param cardNumber 万能卡号集合 19 | */ 20 | public WebMsgDeployFreeCardSpecial(int groupId, int boxId, long cardNumber, int itemId) { 21 | super(groupId, boxId); 22 | this.cardNumber = cardNumber; 23 | this.itemId = itemId; 24 | setMsgId(MsgType.SERVER_SET_FREE_CARD_NUMBER); 25 | } 26 | 27 | public int getItemId() { 28 | return itemId; 29 | } 30 | 31 | public long getCardNumber() { 32 | return cardNumber; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/base/BaseMessage.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.base; 2 | 3 | /** 4 | * 基础信息 Message 5 | */ 6 | public class BaseMessage implements IMessage { 7 | private int msgId = -1; 8 | private int groupId = -1; 9 | private int boxId = -1; 10 | 11 | protected BaseMessage(int groupId) { 12 | this.groupId = groupId; 13 | } 14 | 15 | protected BaseMessage(int groupId, int boxId) { 16 | this(groupId); 17 | this.boxId = boxId; 18 | } 19 | 20 | @Override 21 | public int getMsgId() { 22 | return msgId; 23 | } 24 | @Override 25 | public void setMsgId(int msgId) { 26 | this.msgId = msgId; 27 | } 28 | 29 | @Override 30 | public int getGroupId() { 31 | return groupId; 32 | } 33 | 34 | @Override 35 | public void setGroupId(int groupId) { 36 | this.groupId = groupId; 37 | } 38 | 39 | @Override 40 | public int getBoxId() { 41 | return boxId; 42 | } 43 | 44 | @Override 45 | public void setBoxId(int boxId) { 46 | this.boxId = boxId; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/base/BaseMsgCardNum.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.base; 2 | 3 | public class BaseMsgCardNum extends BaseMessage { 4 | 5 | private long cardNumber; 6 | 7 | protected BaseMsgCardNum(int groupId, int boxId, long cardNumber, int msgType) { 8 | super(groupId, boxId); 9 | setMsgId(msgType); 10 | this.cardNumber = cardNumber; 11 | } 12 | 13 | public long getCardNumber() { 14 | return cardNumber; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/base/BaseTcpResponseMsg.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.base; 2 | 3 | 4 | public class BaseTcpResponseMsg extends BaseMessage { 5 | 6 | private final int status; 7 | 8 | public BaseTcpResponseMsg(int groupId, int boxId, int status) { 9 | super(groupId, boxId); 10 | this.status = status; 11 | } 12 | 13 | public int getStatus() { 14 | return status; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/base/IMessage.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.base; 2 | 3 | public interface IMessage { 4 | int getMsgId(); 5 | 6 | void setMsgId(int msgId); 7 | 8 | int getBoxId(); 9 | 10 | void setBoxId(int boxId); 11 | 12 | int getGroupId(); 13 | 14 | void setGroupId(int groupId); 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/base/WebMsgBaseEmployee.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.base; 2 | 3 | public class WebMsgBaseEmployee extends BaseMessage { 4 | 5 | String value; 6 | 7 | protected WebMsgBaseEmployee(int groupId, int boxId, String value) { 8 | super(groupId, boxId); 9 | this.value = value; 10 | } 11 | 12 | public String getValue() { 13 | return value; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/tcp/MsgErrorMessage.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 6 | 7 | public class MsgErrorMessage extends BaseMessage { 8 | 9 | private String msg; 10 | 11 | public MsgErrorMessage(int groupId) { 12 | super(groupId); 13 | setMsgId(MsgType.ERROR); 14 | } 15 | 16 | public MsgErrorMessage() { 17 | this(-1); 18 | } 19 | 20 | private MsgErrorMessage(int groupId, String msg) { 21 | this(groupId); 22 | this.msg = msg; 23 | } 24 | 25 | public MsgErrorMessage(String msg) { 26 | this(-1, msg); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgInitResponseCardNumber.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseMsgCardNum; 5 | 6 | /** 7 | * 设备初始化「1, 3」: 发送员工卡号 8 | */ 9 | public class TcpMsgInitResponseCardNumber extends BaseMsgCardNum { 10 | 11 | public TcpMsgInitResponseCardNumber(int groupId, int boxId, long cardNumber) { 12 | super(groupId, boxId, cardNumber, MsgType.INITIALIZE_DEVICE_RESPONSE_CARD); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseBoxId.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 6 | 7 | /** 8 | * 设备回复: 设备 Id 更新 9 | */ 10 | public class TcpMsgResponseBoxId extends BaseTcpResponseMsg { 11 | 12 | public TcpMsgResponseBoxId(int groupId, int boxId, int status) { 13 | super(groupId, boxId, status); 14 | setMsgId(MsgType.DEVICE_RESPONSE_DEVICE_ID); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseDeviceStatus.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 6 | 7 | /** 8 | * 设备回复: 充电状态 9 | */ 10 | public class TcpMsgResponseDeviceStatus extends BaseTcpResponseMsg { 11 | 12 | public TcpMsgResponseDeviceStatus(int groupId, int boxId, int status) { 13 | super(groupId, boxId, status); 14 | setMsgId(MsgType.DEVICE_RESPONSE_STATUS); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseEmployeeCardnumber.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 6 | 7 | /** 8 | * 设备回复: 员工卡号更新 9 | */ 10 | public class TcpMsgResponseEmployeeCardnumber extends BaseTcpResponseMsg { 11 | 12 | public TcpMsgResponseEmployeeCardnumber(int groupId, int boxId, int status) { 13 | super(groupId, boxId, status); 14 | setMsgId(MsgType.DEVICE_RESPONSE_EMPLOYEE_CARD_NUMBER); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseEmployeeDepartment.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 5 | 6 | /** 7 | * 设备回复: 员工部门更新 8 | */ 9 | public class TcpMsgResponseEmployeeDepartment extends BaseTcpResponseMsg { 10 | 11 | public TcpMsgResponseEmployeeDepartment(int groupId, int boxId, int status) { 12 | super(groupId, boxId, status); 13 | setMsgId(MsgType.DEVICE_RESPONSE_EMPLOYEE_DEPARTMENT_1); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseEmployeeName.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 6 | 7 | /** 8 | * 设备回复: 员工姓名更新 9 | */ 10 | public class TcpMsgResponseEmployeeName extends BaseTcpResponseMsg { 11 | 12 | public TcpMsgResponseEmployeeName(int groupId, int boxId, int status) { 13 | super(groupId, boxId, status); 14 | setMsgId(MsgType.DEVICE_RESPONSE_EMPLOYEE_NAME); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseFreeCardNumber.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 6 | 7 | /** 8 | * 设备回复: 员工部门更新 9 | */ 10 | public class TcpMsgResponseFreeCardNumber extends BaseTcpResponseMsg { 11 | 12 | public TcpMsgResponseFreeCardNumber(int groupId, int boxId, int status, int item) { 13 | super(groupId, boxId, status); 14 | setMsgId(MsgType.DEVICE_RESPONSE_FREE_CARD_NUMBER + item); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseOperateBoxUnlock.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 6 | 7 | /** 8 | * 设备回复: 开锁成功 9 | */ 10 | public class TcpMsgResponseOperateBoxUnlock extends BaseTcpResponseMsg { 11 | 12 | public TcpMsgResponseOperateBoxUnlock(int groupId, int boxId, int status) { 13 | super(groupId, boxId, status); 14 | setMsgId(MsgType.DEVICE_RESPONSE_REMOTE_UNLOCK); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseRemainChargeTimes.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 6 | 7 | /** 8 | * 设备回复: 剩余充电次数更新 9 | */ 10 | public class TcpMsgResponseRemainChargeTimes extends BaseTcpResponseMsg { 11 | 12 | public TcpMsgResponseRemainChargeTimes(int groupId, int boxId, int status) { 13 | super(groupId, boxId, status); 14 | setMsgId(MsgType.DEVICE_RESPONSE_REMAIN_CHARGE_TIMES); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgDeployEmployeeCardNumber.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseMsgCardNum; 5 | 6 | /** 7 | * 服务器部署员工卡号 8 | */ 9 | public class WebMsgDeployEmployeeCardNumber extends BaseMsgCardNum { 10 | 11 | public WebMsgDeployEmployeeCardNumber(int groupId, int boxId, long cardNumber) { 12 | super(groupId, boxId, cardNumber, MsgType.SERVER_SET_EMPLOYEE_CARD_NUMBER); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgDeployEmployeeDepartment.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.WebMsgBaseEmployee; 6 | 7 | /** 8 | * 服务器部署员工部门 9 | */ 10 | public class WebMsgDeployEmployeeDepartment extends WebMsgBaseEmployee { 11 | public WebMsgDeployEmployeeDepartment(int groupId, int boxId, String value) { 12 | super(groupId, boxId, value); 13 | setMsgId(MsgType.SERVER_SET_EMPLOYEE_DEPARTMENT_1); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgDeployEmployeeDeviceId.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 6 | 7 | /** 8 | * 服务器部署设备 Id 9 | */ 10 | public class WebMsgDeployEmployeeDeviceId extends BaseMessage { 11 | int updatedDeviceId; 12 | 13 | public WebMsgDeployEmployeeDeviceId(int groupId, int boxId, int updatedDeviceId) { 14 | super(groupId, boxId); 15 | this.updatedDeviceId = updatedDeviceId; 16 | setMsgId(MsgType.SERVER_SET_DEVICE_ID); 17 | } 18 | 19 | public int getUpdatedDeviceId() { 20 | return updatedDeviceId; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgDeployEmployeeName.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.WebMsgBaseEmployee; 6 | 7 | /** 8 | * 服务器部署员工姓名 9 | */ 10 | public class WebMsgDeployEmployeeName extends WebMsgBaseEmployee { 11 | public WebMsgDeployEmployeeName(int groupId, int boxId, String value) { 12 | super(groupId, boxId, value); 13 | setMsgId(MsgType.SERVER_SET_EMPLOYEE_NAME); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgDeployRemainChargeTimes.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 5 | 6 | /** 7 | * 服务器部署剩余充电次数 8 | */ 9 | public class WebMsgDeployRemainChargeTimes extends BaseMessage { 10 | 11 | private int times; 12 | 13 | public WebMsgDeployRemainChargeTimes(int groupId, int boxId, int times) { 14 | super(groupId, boxId); 15 | setMsgId(MsgType.SERVER_SET_REMAIN_CHARGE_TIMES); 16 | this.times = times; 17 | } 18 | 19 | public int getTimes() { 20 | return times; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgInitClearDeviceStatus.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 5 | 6 | /** 7 | * 设备初始化「3」: 服务器清除设备的初始化状态 8 | */ 9 | public class WebMsgInitClearDeviceStatus extends BaseMessage { 10 | 11 | public WebMsgInitClearDeviceStatus(int groupId, int boxId) { 12 | super(groupId, boxId); 13 | setMsgId(MsgType.INITIALIZE_SERVER_CLEAR_INITIALIZE_MESSAGE); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgInitMarchConfirmCardResponse.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 5 | 6 | /** 7 | * 设备初始化「2」: 服务器匹配确认卡号回复 8 | */ 9 | public class WebMsgInitMarchConfirmCardResponse extends BaseMessage { 10 | 11 | private boolean successful; 12 | 13 | public WebMsgInitMarchConfirmCardResponse(int groupId, int boxId, boolean successful) { 14 | super(groupId, boxId); 15 | this.successful = successful; 16 | setMsgId(MsgType.INITIALIZE_SERVER_MARCH_CONFIRM_CARD_RESPONSE); 17 | } 18 | 19 | public boolean isSuccessful() { 20 | return successful; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgObtainDeviceStatus.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 5 | 6 | /** 7 | * 服务器获取设备的当前状态 8 | */ 9 | public class WebMsgObtainDeviceStatus extends BaseMessage { 10 | 11 | 12 | public WebMsgObtainDeviceStatus(int groupId, int boxId) { 13 | super(groupId, boxId); 14 | setMsgId(MsgType.SERVER_REQUSET_STATUS); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgOperateBoxUnlock.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 5 | 6 | /** 7 | * 服务器操作远程开锁 8 | */ 9 | public class WebMsgOperateBoxUnlock extends BaseMessage { 10 | 11 | public WebMsgOperateBoxUnlock(int groupId, int boxId) { 12 | super(groupId, boxId); 13 | setMsgId(MsgType.SERVER_REMOTE_UNLOCK); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/utils/ChargeStatusEnum.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.utils; 2 | 3 | public class ChargeStatusEnum { 4 | /** 5 | * 未初始化 6 | */ 7 | public static final int UNINIT = 0; 8 | /** 9 | * 使用中 10 | */ 11 | public static final int USING = 1; 12 | /** 13 | * 充电中 14 | */ 15 | public static final int CHARGING = 2; 16 | /** 17 | * 已充满 18 | */ 19 | public static final int FULL = 3; 20 | /** 21 | * 通信故障 22 | */ 23 | public static final int TRAFFIC_ERROR = 4; 24 | 25 | /** 26 | * 充电故障 27 | */ 28 | public static final int CHARGE_ERROR = 5; 29 | 30 | /** 31 | * 多种故障 32 | */ 33 | public static final int CRASH = 6; 34 | } 35 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/utils/KyLog.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.utils; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import io.netty.buffer.ByteBufUtil; 5 | 6 | public class KyLog { 7 | public static void LogFrame(ByteBuf byteBuf) { 8 | System.out.println( 9 | "begin:" + byteBuf.readerIndex() + ", end:" + byteBuf.writerIndex() + ", readable:" + 10 | byteBuf.readableBytes() + ", writable:" + byteBuf.writableBytes()); 11 | System.out.println(ByteBufUtil.prettyHexDump(byteBuf)); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/utils/SuccessfulListener.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.utils; 2 | 3 | @FunctionalInterface 4 | public interface SuccessfulListener { 5 | 6 | void onSuccess(boolean isSuccess); 7 | } 8 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/utils/TcpReceiveListener.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.utils; 2 | 3 | public interface TcpReceiveListener { 4 | void receive(); 5 | } 6 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/java/cc/bitky/clustermanage/utils/TcpSendListener.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.utils; 2 | 3 | public interface TcpSendListener { 4 | void send(); 5 | } 6 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-console/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle/ 2 | .idea/ 3 | target/ 4 | test/ 5 | .mvn/ 6 | out/ 7 | 8 | ### STS ### 9 | .apt_generated 10 | .classpath 11 | .factorypath 12 | .project 13 | .settings 14 | .springBeans 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | nbproject/private/ 24 | build/ 25 | nbbuild/ 26 | dist/ 27 | nbdist/ 28 | .nb-gradle/ -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/KySetting.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage; 2 | 3 | public class KySetting { 4 | //------------------系统--------------------------- 5 | public static final String VERSION = "v0.9.9"; 6 | 7 | //----------------网络连接-------------------------- 8 | public static final String HOST_NAME = "lml-win10"; 9 | public static final int PORT = 30232; 10 | } 11 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/MainLauncher.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage; 2 | 3 | import cc.bitky.clustermanage.view.MainView; 4 | import javafx.application.Application; 5 | import javafx.scene.Scene; 6 | import javafx.stage.Stage; 7 | 8 | public class MainLauncher extends Application { 9 | 10 | @Override 11 | public void start(Stage primaryStage) throws Exception { 12 | startApp(primaryStage); 13 | } 14 | 15 | private void startApp(Stage primaryStage) { 16 | primaryStage.setTitle("设备模拟客户端"); 17 | primaryStage.setScene(new Scene(MainView.getInstance())); 18 | primaryStage.setMaximized(true); 19 | primaryStage.setOnCloseRequest(event -> NettyLauncher.getInstance().shutdown()); 20 | primaryStage.show(); 21 | MainView.getInstance().updateGroupCount(10); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/NettyLauncher.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import cc.bitky.clustermanage.netty.NettyClient; 7 | import cc.bitky.clustermanage.view.MainView; 8 | 9 | public class NettyLauncher { 10 | private static Logger logger = LoggerFactory.getLogger(NettyLauncher.class); 11 | private static NettyLauncher nettyLauncher; 12 | private NettyClient nettyClient; 13 | 14 | private NettyLauncher() { 15 | } 16 | 17 | public static NettyLauncher getInstance() { 18 | if (nettyLauncher == null) nettyLauncher = new NettyLauncher(); 19 | return nettyLauncher; 20 | } 21 | 22 | public void start(String hostName, int port) { 23 | nettyClient = new NettyClient(); 24 | nettyClient.setLaunchSuccessfulListener(isSuccess -> { 25 | MainView.getInstance().setLabelConnStatus(isSuccess); 26 | }); 27 | nettyClient.setFinishSuccessfulListener(isSuccess -> { 28 | logger.info("客户端优雅关闭成功"); 29 | System.exit(0); 30 | }); 31 | nettyClient.start(hostName, port); 32 | } 33 | 34 | void shutdown() { 35 | if (nettyClient != null) 36 | nettyClient.shutdown(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/CardType.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message; 2 | 3 | public enum CardType { 4 | /** 5 | * 万能卡 6 | */ 7 | FREE, 8 | /** 9 | * 确认卡 10 | */ 11 | CONFIRM, 12 | /** 13 | * 员工卡 14 | */ 15 | EMPLOYEE 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/TcpMsgResponseRandomDeviceStatus.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message; 2 | 3 | 4 | /** 5 | * 设备回复: 随机充电状态 6 | */ 7 | public class TcpMsgResponseRandomDeviceStatus { 8 | 9 | private final int groupId; 10 | private final int statusMax; 11 | private final int length; 12 | 13 | public TcpMsgResponseRandomDeviceStatus(int groupId, int status, int length) { 14 | 15 | this.groupId = groupId; 16 | this.statusMax = status; 17 | this.length = length; 18 | } 19 | 20 | public int getGroupId() { 21 | return groupId; 22 | } 23 | 24 | public int getStatusMax() { 25 | return statusMax; 26 | } 27 | 28 | public int getLength() { 29 | return length; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/base/BaseMessage.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.base; 2 | 3 | /** 4 | * 基础信息 Message 5 | */ 6 | public class BaseMessage implements IMessage { 7 | private int msgId = -1; 8 | private int groupId = -1; 9 | private int boxId = -1; 10 | 11 | protected BaseMessage(int groupId) { 12 | this.groupId = groupId; 13 | } 14 | 15 | protected BaseMessage(int groupId, int boxId) { 16 | this(groupId); 17 | this.boxId = boxId; 18 | } 19 | 20 | @Override 21 | public int getMsgId() { 22 | return msgId; 23 | } 24 | @Override 25 | public void setMsgId(int msgId) { 26 | this.msgId = msgId; 27 | } 28 | 29 | @Override 30 | public int getGroupId() { 31 | return groupId; 32 | } 33 | 34 | @Override 35 | public void setGroupId(int groupId) { 36 | this.groupId = groupId; 37 | } 38 | 39 | @Override 40 | public int getBoxId() { 41 | return boxId; 42 | } 43 | 44 | @Override 45 | public void setBoxId(int boxId) { 46 | this.boxId = boxId; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/base/BaseMsgCardNum.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.base; 2 | 3 | public class BaseMsgCardNum extends BaseMessage { 4 | 5 | private String cardNumber; 6 | 7 | protected BaseMsgCardNum(int groupId, int boxId, String cardNumber, int msgType) { 8 | super(groupId, boxId); 9 | setMsgId(msgType); 10 | this.cardNumber = cardNumber; 11 | } 12 | 13 | public String getCardNumber() { 14 | return cardNumber; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/base/BaseTcpResponseMsg.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.base; 2 | 3 | 4 | public class BaseTcpResponseMsg extends BaseMessage { 5 | 6 | private final int status; 7 | 8 | public BaseTcpResponseMsg(int groupId, int boxId, int status) { 9 | super(groupId, boxId); 10 | this.status = status; 11 | } 12 | 13 | public int getStatus() { 14 | return status; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/base/IMessage.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.base; 2 | 3 | public interface IMessage { 4 | int getMsgId(); 5 | 6 | void setMsgId(int msgId); 7 | 8 | int getBoxId(); 9 | 10 | void setBoxId(int boxId); 11 | 12 | int getGroupId(); 13 | 14 | void setGroupId(int groupId); 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/base/WebMsgBaseEmployee.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.base; 2 | 3 | public class WebMsgBaseEmployee extends BaseMessage { 4 | 5 | String value; 6 | 7 | protected WebMsgBaseEmployee(int groupId, int boxId, String value) { 8 | super(groupId, boxId); 9 | this.value = value; 10 | } 11 | 12 | public String getValue() { 13 | return value; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/tcp/MsgErrorMessage.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 6 | 7 | public class MsgErrorMessage extends BaseMessage { 8 | 9 | private String msg; 10 | 11 | public MsgErrorMessage(int groupId) { 12 | super(groupId); 13 | setMsgId(MsgType.ERROR); 14 | } 15 | 16 | public MsgErrorMessage() { 17 | this(-1); 18 | } 19 | 20 | private MsgErrorMessage(int groupId, String msg) { 21 | this(groupId); 22 | this.msg = msg; 23 | } 24 | 25 | public MsgErrorMessage(String msg) { 26 | this(-1, msg); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgInitResponseCardNumber.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseMsgCardNum; 5 | 6 | /** 7 | * 设备初始化「1, 3」: 发送员工卡号 8 | */ 9 | public class TcpMsgInitResponseCardNumber extends BaseMsgCardNum { 10 | 11 | public TcpMsgInitResponseCardNumber(int groupId, int boxId, String cardNumber) { 12 | super(groupId, boxId, cardNumber, MsgType.INITIALIZE_DEVICE_RESPONSE_CARD); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseBoxId.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 6 | 7 | /** 8 | * 设备回复: 设备 Id 更新 9 | */ 10 | public class TcpMsgResponseBoxId extends BaseTcpResponseMsg { 11 | 12 | public TcpMsgResponseBoxId(int groupId, int boxId, int status) { 13 | super(groupId, boxId, status); 14 | setMsgId(MsgType.DEVICE_RESPONSE_DEVICE_ID); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseDeviceStatus.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 6 | 7 | /** 8 | * 设备回复: 充电状态 9 | */ 10 | public class TcpMsgResponseDeviceStatus extends BaseTcpResponseMsg { 11 | 12 | public TcpMsgResponseDeviceStatus(int groupId, int boxId, int status) { 13 | super(groupId, boxId, status); 14 | setMsgId(MsgType.DEVICE_RESPONSE_STATUS); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseEmployeeCardnumber.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 6 | 7 | /** 8 | * 设备回复: 员工卡号更新 9 | */ 10 | public class TcpMsgResponseEmployeeCardnumber extends BaseTcpResponseMsg { 11 | 12 | public TcpMsgResponseEmployeeCardnumber(int groupId, int boxId, int status) { 13 | super(groupId, boxId, status); 14 | setMsgId(MsgType.DEVICE_RESPONSE_EMPLOYEE_CARD_NUMBER); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseEmployeeDepartment.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 5 | 6 | /** 7 | * 设备回复: 员工部门更新 8 | */ 9 | public class TcpMsgResponseEmployeeDepartment extends BaseTcpResponseMsg { 10 | 11 | public TcpMsgResponseEmployeeDepartment(int groupId, int boxId, int status) { 12 | super(groupId, boxId, status); 13 | setMsgId(MsgType.DEVICE_RESPONSE_EMPLOYEE_DEPARTMENT_1); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseEmployeeDepartment2.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 5 | 6 | /** 7 | * 设备回复: 员工部门更新 8 | */ 9 | public class TcpMsgResponseEmployeeDepartment2 extends BaseTcpResponseMsg { 10 | 11 | public TcpMsgResponseEmployeeDepartment2(int groupId, int boxId, int status) { 12 | super(groupId, boxId, status); 13 | setMsgId(MsgType.DEVICE_RESPONSE_EMPLOYEE_DEPARTMENT_2); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseEmployeeName.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 6 | 7 | /** 8 | * 设备回复: 员工姓名更新 9 | */ 10 | public class TcpMsgResponseEmployeeName extends BaseTcpResponseMsg { 11 | 12 | public TcpMsgResponseEmployeeName(int groupId, int boxId, int status) { 13 | super(groupId, boxId, status); 14 | setMsgId(MsgType.DEVICE_RESPONSE_EMPLOYEE_NAME); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseFreeCardNumber.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 6 | 7 | /** 8 | * 设备回复: 员工部门更新 9 | */ 10 | public class TcpMsgResponseFreeCardNumber extends BaseTcpResponseMsg { 11 | 12 | public TcpMsgResponseFreeCardNumber(int groupId, int boxId, int status, int item) { 13 | super(groupId, boxId, status); 14 | setMsgId(MsgType.DEVICE_RESPONSE_FREE_CARD_NUMBER + item); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseLed.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 6 | 7 | /** 8 | * 设备回复: 设备 Id 更新 9 | */ 10 | public class TcpMsgResponseLed extends BaseTcpResponseMsg { 11 | 12 | public TcpMsgResponseLed(int groupId, int boxId, int status) { 13 | super(groupId, boxId, status); 14 | setMsgId(MsgType.DEVICE_RESPONSE_LED_SETTING); 15 | } 16 | 17 | @Override 18 | public void setMsgId(int msgId) { 19 | super.setMsgId(msgId); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseOperateBoxUnlock.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 6 | 7 | /** 8 | * 设备回复: 开锁成功 9 | */ 10 | public class TcpMsgResponseOperateBoxUnlock extends BaseTcpResponseMsg { 11 | 12 | public TcpMsgResponseOperateBoxUnlock(int groupId, int boxId, int status) { 13 | super(groupId, boxId, status); 14 | setMsgId(MsgType.DEVICE_RESPONSE_REMOTE_UNLOCK); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/tcp/TcpMsgResponseRemainChargeTimes.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.tcp; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseTcpResponseMsg; 6 | 7 | /** 8 | * 设备回复: 剩余充电次数更新 9 | */ 10 | public class TcpMsgResponseRemainChargeTimes extends BaseTcpResponseMsg { 11 | 12 | public TcpMsgResponseRemainChargeTimes(int groupId, int boxId, int status) { 13 | super(groupId, boxId, status); 14 | setMsgId(MsgType.DEVICE_RESPONSE_REMAIN_CHARGE_TIMES); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgDeployEmployeeCardNumber.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseMsgCardNum; 5 | 6 | /** 7 | * 服务器部署员工卡号 8 | */ 9 | public class WebMsgDeployEmployeeCardNumber extends BaseMsgCardNum { 10 | 11 | public WebMsgDeployEmployeeCardNumber(int groupId, int boxId, String cardNumber) { 12 | super(groupId, boxId, cardNumber, MsgType.SERVER_SET_EMPLOYEE_CARD_NUMBER); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgDeployEmployeeDepartment.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.WebMsgBaseEmployee; 6 | 7 | /** 8 | * 服务器部署员工部门 9 | */ 10 | public class WebMsgDeployEmployeeDepartment extends WebMsgBaseEmployee { 11 | public WebMsgDeployEmployeeDepartment(int groupId, int boxId, String value) { 12 | super(groupId, boxId, value); 13 | setMsgId(MsgType.SERVER_SET_EMPLOYEE_DEPARTMENT_1); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgDeployEmployeeDepartment2.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.WebMsgBaseEmployee; 6 | 7 | /** 8 | * 服务器部署员工部门 9 | */ 10 | public class WebMsgDeployEmployeeDepartment2 extends WebMsgBaseEmployee { 11 | public WebMsgDeployEmployeeDepartment2(int groupId, int boxId, String value) { 12 | super(groupId, boxId, value); 13 | setMsgId(MsgType.SERVER_SET_EMPLOYEE_DEPARTMENT_2); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgDeployEmployeeDeviceId.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 6 | 7 | /** 8 | * 服务器部署设备 Id 9 | */ 10 | public class WebMsgDeployEmployeeDeviceId extends BaseMessage { 11 | int updatedDeviceId; 12 | 13 | public WebMsgDeployEmployeeDeviceId(int groupId, int boxId, int updatedDeviceId) { 14 | super(groupId, boxId); 15 | this.updatedDeviceId = updatedDeviceId; 16 | setMsgId(MsgType.SERVER_SET_DEVICE_ID); 17 | } 18 | 19 | public int getUpdatedDeviceId() { 20 | return updatedDeviceId; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgDeployEmployeeName.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.WebMsgBaseEmployee; 6 | 7 | /** 8 | * 服务器部署员工姓名 9 | */ 10 | public class WebMsgDeployEmployeeName extends WebMsgBaseEmployee { 11 | public WebMsgDeployEmployeeName(int groupId, int boxId, String value) { 12 | super(groupId, boxId, value); 13 | setMsgId(MsgType.SERVER_SET_EMPLOYEE_NAME); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgDeployFreeCardSpecial.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 5 | 6 | /** 7 | * 服务器部署万能卡号 8 | */ 9 | public class WebMsgDeployFreeCardSpecial extends BaseMessage { 10 | 11 | private final int itemId; 12 | private String cardNumber; 13 | 14 | /** 15 | * 服务器部署万能卡号 16 | * 17 | * @param groupId 组号 18 | * @param boxId 设备号 19 | * @param cardNumber 万能卡号集合 20 | */ 21 | public WebMsgDeployFreeCardSpecial(int groupId, int boxId, String cardNumber, int itemId) { 22 | super(groupId, boxId); 23 | this.cardNumber = cardNumber; 24 | this.itemId = itemId; 25 | setMsgId(MsgType.SERVER_SET_FREE_CARD_NUMBER); 26 | } 27 | 28 | public int getItemId() { 29 | return itemId; 30 | } 31 | 32 | public String getCardNumber() { 33 | return cardNumber; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgDeployLedSetting.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 5 | 6 | /** 7 | * 服务器部署员工卡号 8 | */ 9 | public class WebMsgDeployLedSetting extends BaseMessage { 10 | String text; 11 | 12 | public WebMsgDeployLedSetting(int groupId, int boxId) { 13 | super(groupId, boxId); 14 | setMsgId(MsgType.SERVER_LED_SETTING); 15 | } 16 | 17 | public WebMsgDeployLedSetting(int groupId, int boxId, String text) { 18 | this(groupId, boxId); 19 | this.text = text; 20 | } 21 | 22 | @Override 23 | public void setMsgId(int msgId) { 24 | super.setMsgId(msgId); 25 | } 26 | 27 | public String getText() { 28 | return text; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgDeployLedStop.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | 4 | import cc.bitky.clustermanage.netty.message.MsgType; 5 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 6 | 7 | /** 8 | * 服务器操作远程开锁 9 | */ 10 | public class WebMsgDeployLedStop extends BaseMessage { 11 | 12 | public WebMsgDeployLedStop(int groupId, int boxId) { 13 | super(groupId, boxId); 14 | setMsgId(MsgType.SERVER_LED_STOP); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgDeployRemainChargeTimes.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 5 | 6 | /** 7 | * 服务器部署剩余充电次数 8 | */ 9 | public class WebMsgDeployRemainChargeTimes extends BaseMessage { 10 | 11 | private int times; 12 | 13 | public WebMsgDeployRemainChargeTimes(int groupId, int boxId, int times) { 14 | super(groupId, boxId); 15 | setMsgId(MsgType.SERVER_SET_REMAIN_CHARGE_TIMES); 16 | this.times = times; 17 | } 18 | 19 | public int getTimes() { 20 | return times; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgInitClearDeviceStatus.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 5 | 6 | /** 7 | * 设备初始化「3」: 服务器清除设备的初始化状态 8 | */ 9 | public class WebMsgInitClearDeviceStatus extends BaseMessage { 10 | 11 | public WebMsgInitClearDeviceStatus(int groupId, int boxId) { 12 | super(groupId, boxId); 13 | setMsgId(MsgType.INITIALIZE_SERVER_CLEAR_INITIALIZE_MESSAGE); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgInitMarchConfirmCardResponse.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 5 | 6 | /** 7 | * 设备初始化「2」: 服务器匹配确认卡号回复 8 | */ 9 | public class WebMsgInitMarchConfirmCardResponse extends BaseMessage { 10 | 11 | private boolean successful; 12 | 13 | public WebMsgInitMarchConfirmCardResponse(int groupId, int boxId, boolean successful) { 14 | super(groupId, boxId); 15 | this.successful = successful; 16 | setMsgId(MsgType.INITIALIZE_SERVER_MARCH_CONFIRM_CARD_RESPONSE); 17 | } 18 | 19 | public boolean isSuccessful() { 20 | return successful; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgObtainDeviceStatus.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 5 | 6 | /** 7 | * 服务器获取设备的当前状态 8 | */ 9 | public class WebMsgObtainDeviceStatus extends BaseMessage { 10 | 11 | 12 | public WebMsgObtainDeviceStatus(int groupId, int boxId) { 13 | super(groupId, boxId); 14 | setMsgId(MsgType.SERVER_REQUSET_STATUS); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/netty/message/web/WebMsgOperateBoxUnlock.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.netty.message.web; 2 | 3 | import cc.bitky.clustermanage.netty.message.MsgType; 4 | import cc.bitky.clustermanage.netty.message.base.BaseMessage; 5 | 6 | /** 7 | * 服务器操作远程开锁 8 | */ 9 | public class WebMsgOperateBoxUnlock extends BaseMessage { 10 | 11 | public WebMsgOperateBoxUnlock(int groupId, int boxId) { 12 | super(groupId, boxId); 13 | setMsgId(MsgType.SERVER_REMOTE_UNLOCK); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/utils/ChargeStatusEnum.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.utils; 2 | 3 | public class ChargeStatusEnum { 4 | /** 5 | * 未初始化 6 | */ 7 | public static final int UNINIT = 0; 8 | /** 9 | * 使用中 10 | */ 11 | public static final int USING = 1; 12 | /** 13 | * 充电中 14 | */ 15 | public static final int CHARGING = 2; 16 | /** 17 | * 已充满 18 | */ 19 | public static final int FULL = 3; 20 | /** 21 | * 通信故障 22 | */ 23 | public static final int TRAFFIC_ERROR = 4; 24 | 25 | /** 26 | * 充电故障 27 | */ 28 | public static final int CHARGE_ERROR = 5; 29 | 30 | /** 31 | * 多种故障 32 | */ 33 | public static final int CRASH = 6; 34 | } 35 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/utils/KyLog.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.utils; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import io.netty.buffer.ByteBufUtil; 5 | 6 | public class KyLog { 7 | public static void LogFrame(ByteBuf byteBuf) { 8 | System.out.println( 9 | "begin:" + byteBuf.readerIndex() + ", end:" + byteBuf.writerIndex() + ", readable:" + 10 | byteBuf.readableBytes() + ", writable:" + byteBuf.writableBytes()); 11 | System.out.println(ByteBufUtil.prettyHexDump(byteBuf)); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/utils/SuccessfulListener.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.utils; 2 | 3 | @FunctionalInterface 4 | public interface SuccessfulListener { 5 | 6 | void onSuccess(boolean isSuccess); 7 | } 8 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/utils/TcpReceiveListener.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.utils; 2 | 3 | public interface TcpReceiveListener { 4 | void receive(); 5 | } 6 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/utils/TcpSendListener.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.utils; 2 | 3 | public interface TcpSendListener { 4 | void send(); 5 | } 6 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/view/Container.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.view; 2 | 3 | import java.util.HashMap; 4 | 5 | import cc.bitky.clustermanage.view.bean.Device; 6 | import cc.bitky.clustermanage.view.bean.DeviceKey; 7 | import cc.bitky.clustermanage.view.viewbean.DeviceView; 8 | 9 | public class Container { 10 | 11 | static final HashMap deviceViewHashMap = new HashMap<>(100); 12 | 13 | public static final HashMap deviceHashMap = new HashMap<>(10000); 14 | } 15 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/view/DeviceStatusChangeListener.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.view; 2 | 3 | import cc.bitky.clustermanage.netty.message.tcp.TcpMsgResponseDeviceStatus; 4 | 5 | public interface DeviceStatusChangeListener { 6 | 7 | void btnChargeChanged(TcpMsgResponseDeviceStatus tcpMsgResponseDeviceStatus); 8 | } 9 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/view/MainViewActionListener.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.view; 2 | 3 | import cc.bitky.clustermanage.netty.message.TcpMsgResponseRandomDeviceStatus; 4 | import cc.bitky.clustermanage.netty.message.tcp.TcpMsgResponseDeviceStatus; 5 | 6 | public interface MainViewActionListener { 7 | 8 | void btnChargeChanged(TcpMsgResponseDeviceStatus tcpMsgResponseDeviceStatus); 9 | 10 | void btnRandomChargeChanged(TcpMsgResponseRandomDeviceStatus tcpMsgResponseDeviceStatus); 11 | 12 | void clearRecCount(boolean rec, boolean err); 13 | } 14 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/view/bean/DeviceGroup.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.view.bean; 2 | 3 | public class DeviceGroup { 4 | int groupId; 5 | 6 | 7 | public DeviceGroup(int groupId) { 8 | this.groupId = groupId; 9 | } 10 | 11 | public int getGroupId() { 12 | return groupId; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/view/bean/DeviceKey.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.view.bean; 2 | 3 | public class DeviceKey { 4 | private int groupId = -1; 5 | private int deviceId = -1; 6 | 7 | public DeviceKey(int groupId, int deviceId) { 8 | this.groupId = groupId; 9 | this.deviceId = deviceId; 10 | } 11 | 12 | @Override 13 | public boolean equals(Object o) { 14 | if (this == o) return true; 15 | if (o == null || getClass() != o.getClass()) return false; 16 | 17 | DeviceKey deviceKey = (DeviceKey) o; 18 | 19 | if (groupId != deviceKey.groupId) return false; 20 | return deviceId == deviceKey.deviceId; 21 | } 22 | 23 | @Override 24 | public int hashCode() { 25 | int result = groupId; 26 | result = 31 * result + deviceId; 27 | return result; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/view/menu/AboutController.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.view.menu; 2 | 3 | import java.io.IOException; 4 | 5 | import javafx.fxml.FXML; 6 | import javafx.fxml.FXMLLoader; 7 | import javafx.scene.control.MenuItem; 8 | import javafx.scene.layout.AnchorPane; 9 | 10 | public class AboutController extends AnchorPane { 11 | @FXML 12 | private MenuItem menuItemClose; 13 | 14 | public AboutController() { 15 | FXMLLoader loader = new FXMLLoader(getClass().getResource("about.fxml")); 16 | loader.setRoot(this); 17 | loader.setController(this); 18 | try { 19 | loader.load(); 20 | } catch (IOException e) { 21 | e.printStackTrace(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/view/menu/about.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/java/cc/bitky/clustermanage/view/viewbean/DeviceGroupListCell.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.view.viewbean; 2 | 3 | import java.net.URL; 4 | import java.util.ResourceBundle; 5 | 6 | import cc.bitky.clustermanage.view.bean.DeviceGroup; 7 | import javafx.fxml.Initializable; 8 | import javafx.scene.control.ListCell; 9 | 10 | public class DeviceGroupListCell extends ListCell implements Initializable { 11 | 12 | @Override 13 | protected void updateItem(DeviceGroup item, boolean empty) { 14 | super.updateItem(item, empty); 15 | if (item != null) { 16 | setText("第 " + item.getGroupId() + " 组"); 17 | } 18 | } 19 | 20 | @Override 21 | public void initialize(URL location, ResourceBundle resources) { 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-client-javafx/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/.gitignore: -------------------------------------------------------------------------------- 1 | 运行/ 2 | 3 | 4 | target/ 5 | .mvn/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | 15 | ### IntelliJ IDEA ### 16 | .idea 17 | *.iws 18 | *.iml 19 | *.ipr 20 | 21 | ### NetBeans ### 22 | nbproject/private/ 23 | build/ 24 | nbbuild/ 25 | dist/ 26 | nbdist/ 27 | .nb-gradle/ -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/db/bean/Cards.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.db.bean; 2 | 3 | import org.springframework.data.annotation.Id; 4 | import org.springframework.data.mongodb.core.mapping.Document; 5 | 6 | @Document(collection = "Cards") 7 | public class Cards { 8 | @Id 9 | private String id; 10 | private String[] freeCardList; 11 | private String[] confirmCardList; 12 | 13 | public String[] getFreeCardList() { 14 | return freeCardList; 15 | } 16 | 17 | public void setFreeCardList(String[] freeCardList) { 18 | this.freeCardList = freeCardList; 19 | } 20 | 21 | public String[] getConfirmCardList() { 22 | return confirmCardList; 23 | } 24 | 25 | public void setConfirmCardList(String[] confirmCardList) { 26 | this.confirmCardList = confirmCardList; 27 | } 28 | 29 | public String getId() { 30 | return id; 31 | } 32 | 33 | public void setId(String id) { 34 | this.id = id; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/db/bean/DeviceGroup.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.db.bean; 2 | 3 | import org.springframework.data.annotation.Id; 4 | import org.springframework.data.mongodb.core.mapping.Document; 5 | import org.springframework.data.mongodb.core.mapping.Field; 6 | 7 | import java.util.Date; 8 | 9 | @Document(collection = "DeviceGroup") 10 | public class DeviceGroup { 11 | 12 | @Id 13 | private String id; 14 | 15 | @Field("HeartBeatTime") 16 | private Date heartBeatTime; 17 | 18 | @Field("GroupId") 19 | private int groupId; 20 | 21 | 22 | public DeviceGroup(int groupId) { 23 | this.groupId = groupId; 24 | heartBeatTime = new Date(0); 25 | } 26 | 27 | public String getId() { 28 | return id; 29 | } 30 | 31 | public void setId(String id) { 32 | this.id = id; 33 | } 34 | 35 | public Date getHeartBeatTime() { 36 | return heartBeatTime; 37 | } 38 | 39 | public void setHeartBeatTime(Date heartBeatTime) { 40 | this.heartBeatTime = heartBeatTime; 41 | } 42 | 43 | public int getGroupId() { 44 | return groupId; 45 | } 46 | 47 | public void setGroupId(int groupId) { 48 | this.groupId = groupId; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/db/bean/routineinfo/DutyInfo.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.db.bean.routineinfo; 2 | 3 | import java.util.Date; 4 | 5 | public class DutyInfo { 6 | 7 | private Date onTime; 8 | private Date offTime; 9 | 10 | public DutyInfo(long onTime) { 11 | this.onTime = new Date(onTime); 12 | } 13 | 14 | public DutyInfo() { 15 | } 16 | 17 | public Date getOnTime() { 18 | return onTime; 19 | } 20 | 21 | public void setOnTime(Date onTime) { 22 | this.onTime = onTime; 23 | } 24 | 25 | public Date getOffTime() { 26 | return offTime; 27 | } 28 | 29 | public void setOffTime(Date offTime) { 30 | this.offTime = offTime; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/db/bean/routineinfo/HistoryInfo.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.db.bean.routineinfo; 2 | 3 | import org.springframework.data.mongodb.core.mapping.Document; 4 | import org.springframework.data.mongodb.core.mapping.Field; 5 | 6 | import java.util.Date; 7 | 8 | @Document(collection = "HistoryInfo") 9 | public class HistoryInfo { 10 | 11 | @Field("Time") 12 | private Date time; 13 | 14 | @Field("Status") 15 | private int status = -1; 16 | 17 | 18 | public HistoryInfo(long time, int status) { 19 | this.time = new Date(time); 20 | this.status = status; 21 | } 22 | 23 | public HistoryInfo() { 24 | time = new Date(0); 25 | } 26 | 27 | public int getStatus() { 28 | return status; 29 | } 30 | 31 | public void setStatus(int status) { 32 | this.status = status; 33 | } 34 | 35 | public Date getTime() { 36 | return time; 37 | } 38 | 39 | public void setTime(Date time) { 40 | this.time = time; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/db/bean/routineinfo/LampStatusHistory.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.db.bean.routineinfo; 2 | 3 | import org.springframework.data.annotation.Id; 4 | import org.springframework.data.mongodb.core.mapping.Document; 5 | import org.springframework.data.mongodb.core.mapping.Field; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | @Document(collection = "LampStatusHistory") 11 | public class LampStatusHistory { 12 | 13 | @Id 14 | private String id; 15 | 16 | @Field("StatusList") 17 | private List statusList = new ArrayList<>(); 18 | 19 | 20 | public String getId() { 21 | return id; 22 | } 23 | 24 | public void setId(String id) { 25 | this.id = id; 26 | } 27 | 28 | public List getStatusList() { 29 | return statusList; 30 | } 31 | 32 | public void setStatusList(List statusList) { 33 | this.statusList = statusList; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/db/mongoops/KyMongoConfig.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.db.mongoops; 2 | 3 | import com.mongodb.Mongo; 4 | import com.mongodb.MongoClient; 5 | 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.data.mongodb.config.AbstractMongoConfiguration; 9 | import org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper; 10 | import org.springframework.data.mongodb.core.convert.MappingMongoConverter; 11 | 12 | import cc.bitky.clustermanage.global.DbSetting; 13 | 14 | @Configuration 15 | public class KyMongoConfig extends AbstractMongoConfiguration { 16 | 17 | @Bean 18 | @Override 19 | public MappingMongoConverter mappingMongoConverter() throws Exception { 20 | MappingMongoConverter mmc = super.mappingMongoConverter(); 21 | //remove _class 22 | mmc.setTypeMapper(new DefaultMongoTypeMapper(null)); 23 | return mmc; 24 | } 25 | 26 | @Override 27 | protected String getDatabaseName() { 28 | return DbSetting.DATABASE; 29 | } 30 | 31 | @Override 32 | public Mongo mongo() throws Exception { 33 | return new MongoClient(DbSetting.HOST); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/db/mongoops/KyRedisConfig.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.db.mongoops; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.data.redis.connection.RedisConnectionFactory; 6 | import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; 7 | import org.springframework.data.redis.core.StringRedisTemplate; 8 | 9 | import cc.bitky.clustermanage.global.DbSetting; 10 | 11 | @Configuration 12 | public class KyRedisConfig { 13 | 14 | @Bean 15 | public RedisConnectionFactory redisConnectionFactory() { 16 | JedisConnectionFactory factory = new JedisConnectionFactory(); 17 | factory.setHostName(DbSetting.HOST); 18 | return factory; 19 | } 20 | 21 | @Bean 22 | public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory redisConnectionFactory) { 23 | return new StringRedisTemplate(redisConnectionFactory); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/db/presenter/DbEmployeePresenter.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.db.presenter; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | 9 | import cc.bitky.clustermanage.db.bean.Employee; 10 | import cc.bitky.clustermanage.db.repository.EmployeeRepository; 11 | 12 | @Repository 13 | public class DbEmployeePresenter { 14 | private final EmployeeRepository employeeRepository; 15 | private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 16 | 17 | @Autowired 18 | public DbEmployeePresenter(EmployeeRepository employeeRepository) { 19 | this.employeeRepository = employeeRepository; 20 | } 21 | 22 | Employee ObtainEmployeeByObjectId(String employeeObjectId) { 23 | if (employeeObjectId == null) return null; 24 | return employeeRepository.findOne(employeeObjectId); 25 | } 26 | 27 | Employee createEmployee(int groupId, int boxId) { 28 | Employee employee = new Employee("备用「" + simpleDateFormat.format(new Date()) + "」", ""); 29 | employee.setGroupId(groupId); 30 | employee.setDeviceId(boxId); 31 | employee = employeeRepository.save(employee); 32 | return employee; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/db/repository/DeviceGroupRepository.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.db.repository; 2 | 3 | import org.springframework.data.mongodb.repository.MongoRepository; 4 | 5 | import cc.bitky.clustermanage.db.bean.DeviceGroup; 6 | 7 | public interface DeviceGroupRepository extends MongoRepository { 8 | DeviceGroup findByGroupId(int GroupId); 9 | } 10 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/db/repository/DeviceRepository.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.db.repository; 2 | 3 | import org.springframework.data.mongodb.repository.MongoRepository; 4 | 5 | import java.util.List; 6 | 7 | import cc.bitky.clustermanage.db.bean.Device; 8 | 9 | public interface DeviceRepository extends MongoRepository { 10 | 11 | Device findFirstByGroupIdAndDeviceId(int GroupId, int DeviceId); 12 | 13 | List findByGroupId(int GroupId); 14 | } 15 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/db/repository/EmployeeRepository.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.db.repository; 2 | 3 | import org.springframework.data.mongodb.repository.MongoRepository; 4 | 5 | import cc.bitky.clustermanage.db.bean.Employee; 6 | 7 | public interface EmployeeRepository extends MongoRepository { 8 | } 9 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/db/repository/RoutineTableRepository.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.db.repository; 2 | 3 | import org.springframework.data.mongodb.repository.MongoRepository; 4 | 5 | import cc.bitky.clustermanage.db.bean.routineinfo.LampStatusHistory; 6 | 7 | public interface RoutineTableRepository extends MongoRepository { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/db/repository/SettingRepository.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.db.repository; 2 | 3 | import org.springframework.data.mongodb.repository.MongoRepository; 4 | 5 | import cc.bitky.clustermanage.db.bean.Cards; 6 | 7 | public interface SettingRepository extends MongoRepository { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/global/CommSetting.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.global; 2 | 3 | /** 4 | * 与设备的通信策略 5 | */ 6 | public class CommSetting { 7 | /** 8 | * 部署设备信息时,数据库中的设备和员工未初始化时,是否自动部署默认值 9 | */ 10 | public static boolean DEPLOY_DEVICES_INIT = true; 11 | /** 12 | * 收到充电状态包时,自动创建相应的默认设备以及相应的员工和考勤表 13 | */ 14 | public static boolean AUTO_CREATE_DEVICE_EMPLOYEE = false; 15 | /** 16 | * 待发送缓冲双端队列的限定容量,当队列中存在的 Message 大于该值时,使用时间轮延时向队列添加 Message 17 | */ 18 | public static int LINKED_DEQUE_LIMIT_CAPACITY = 10000; 19 | /** 20 | * 已发送帧后,在该间隔时间后,检测接收回复帧的状态,用于检错重发功能「单位/s」 21 | */ 22 | public static int FRAME_SENT_TO_DETECT_INTERVAL = 5; 23 | /** 24 | * 待发送缓冲队列 Message 大于限定容量后,待执行指令的延迟等待执行时间「单位/s」 25 | */ 26 | public static int COMMAND_DELAY_WAITING_TIME = 30; 27 | /** 28 | * 当设备中记录的剩余充电次数小于该值时,则向设备发送剩余充电次数 29 | */ 30 | public static int DEPLOY_REMAIN_CHARGE_TIMES = 20; 31 | /** 32 | * 单个设备的初始充电次数 33 | */ 34 | public static int DEVICE_INIT_CHARGE_TIMES = 500; 35 | /** 36 | * 待发送缓冲队列中,帧发送间隔「单位/ms」 37 | */ 38 | public static int FRAME_SEND_INTERVAL = 50; 39 | /** 40 | * 检错重发最大次数,服务器向 TCP 通道发送 CAN 帧,最大重复发送次数 41 | */ 42 | public static int AUTO_REPEAT_REQUEST_TIMES = 5; 43 | } 44 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/global/DbSetting.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.global; 2 | 3 | public class DbSetting { 4 | /** 5 | * 数据库 6 | */ 7 | public static String DATABASE = "ChargeDevice"; 8 | /** 9 | * 默认员工卡号 10 | */ 11 | public static String DEFAULT_EMPLOYEE_CARD_NUMBER = ""; 12 | /** 13 | * 默认员工姓名 14 | */ 15 | public static String DEFAULT_EMPLOYEE_NAME = "备用"; 16 | /** 17 | * 默认员工单位 18 | */ 19 | public static String DEFAULT_EMPLOYEE_DEPARTMENT = "默认单位"; 20 | /** 21 | * 主机名 22 | */ 23 | public static String HOST = "lml-desktop"; 24 | /** 25 | * MongoDB的端口号 26 | */ 27 | public static int MONGODB_PORT = 27017; 28 | /** 29 | * Redis的端口号 30 | */ 31 | public static int REDIS_PORT = 6379; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/global/ExSetting.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.global; 2 | 3 | public class ExSetting { 4 | //部署员工信息时,若数据库中无指定的相关信息,而部署的默认员工默认信息 5 | public String 员工默认卡号 = ""; 6 | 7 | public String 员工默认姓名 = "备用"; 8 | 9 | public String 员工默认部门 = "默认单位"; 10 | 11 | //当剩余充电次数小于该阈值时,服务器下发剩余充电次数 12 | public int 部署剩余充电次数阈值 = 20; 13 | 14 | //服务器下发数据帧时,帧发送间隔「单位:ms」 15 | public int 帧发送间隔 = 60; 16 | 17 | //检错重发最大次数,服务器向 TCP 通道发送 CAN 帧,最大重复发送次数 18 | public int 检错重发最大重复次数 = 5; 19 | 20 | //新矿灯的初始化充电次数 21 | public int 初始充电次数 = 500; 22 | 23 | //数据库服务器的主机名或者IP地址 24 | public String 数据库服务器的主机名或IP = "localhost"; 25 | } 26 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/global/ServerSetting.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.global; 2 | 3 | /** 4 | * 服务器总体配置 5 | */ 6 | public class ServerSetting { 7 | /** 8 | * 项目版本号 9 | */ 10 | public static final String VERSION = "1.0.3"; 11 | /** 12 | * 最大设备组数量 13 | */ 14 | public static final int MAX_DEVICE_GROUP_SIZE = 127; 15 | /** 16 | * 单设备组中最大的设备数量 17 | */ 18 | public static final int MAX_DEVICE_SIZE_EACH_GROUP = 127; 19 | /** 20 | * 本地配置文件 21 | */ 22 | public static final String CONFIG_FILE_PATH = "setting"; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/CardType.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message; 2 | 3 | public enum CardType { 4 | /** 5 | * 万能卡 6 | */ 7 | FREE, 8 | /** 9 | * 确认卡 10 | */ 11 | CONFIRM, 12 | } 13 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/ChargeStatus.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message; 2 | 3 | public interface ChargeStatus { 4 | 5 | /** 6 | * 未初始化 7 | */ 8 | int UNINIT = 0; 9 | 10 | /** 11 | * 使用中 12 | */ 13 | int USING = 1; 14 | 15 | /** 16 | * 充电中 17 | */ 18 | int CHARGING = 2; 19 | 20 | /** 21 | * 已充满 22 | */ 23 | int FULL = 3; 24 | 25 | /** 26 | * 通信故障 27 | */ 28 | int TRAFFIC_ERROR = 4; 29 | 30 | /** 31 | * 充电故障 32 | */ 33 | int CHARGE_ERROR = 5; 34 | 35 | /** 36 | * 矿灯未挂好 37 | */ 38 | int HUNG_ERROR = 6; 39 | 40 | /** 41 | * 多种故障 42 | */ 43 | int CRASH = 50; 44 | } 45 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/base/BaseMessage.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.base; 2 | 3 | /** 4 | * 基础信息 Message 5 | */ 6 | public class BaseMessage implements IMessage { 7 | 8 | private int msgId = -1; 9 | private int groupId = -1; 10 | private int deviceId = -1; 11 | 12 | protected BaseMessage(int groupId) { 13 | this.groupId = groupId; 14 | } 15 | 16 | protected BaseMessage(int groupId, int deviceId) { 17 | this(groupId); 18 | this.deviceId = deviceId; 19 | } 20 | 21 | @Override 22 | public int getMsgId() { 23 | return msgId; 24 | } 25 | 26 | protected void setMsgId(int msgId) { 27 | this.msgId = msgId; 28 | } 29 | 30 | @Override 31 | public int getGroupId() { 32 | return groupId; 33 | } 34 | 35 | @Override 36 | public void setGroupId(int groupId) { 37 | this.groupId = groupId; 38 | } 39 | 40 | @Override 41 | public int getDeviceId() { 42 | return deviceId; 43 | } 44 | 45 | @Override 46 | public void setDeviceId(int deviceId) { 47 | this.deviceId = deviceId; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/base/BaseMsgCardNum.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.base; 2 | 3 | public class BaseMsgCardNum extends BaseMessage { 4 | 5 | private String cardNumber; 6 | 7 | protected BaseMsgCardNum(int groupId, int boxId, String cardNumber, int msgType) { 8 | super(groupId, boxId); 9 | setMsgId(msgType); 10 | this.cardNumber = cardNumber; 11 | } 12 | 13 | public String getCardNumber() { 14 | return cardNumber; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/base/BaseTcpResponseMsg.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.base; 2 | 3 | 4 | public class BaseTcpResponseMsg extends BaseMessage { 5 | 6 | private final int status; 7 | 8 | public BaseTcpResponseMsg(int groupId, int deviceId, int status) { 9 | super(groupId, deviceId); 10 | this.status = status; 11 | } 12 | 13 | public int getStatus() { 14 | return status; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/base/IMessage.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.base; 2 | 3 | public interface IMessage { 4 | int getMsgId(); 5 | 6 | int getDeviceId(); 7 | 8 | void setDeviceId(int deviceId); 9 | 10 | int getGroupId(); 11 | 12 | void setGroupId(int groupId); 13 | } 14 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/base/ISendableMsg.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.base; 2 | 3 | 4 | import cc.bitky.clustermanage.server.schedule.MsgKey; 5 | 6 | public interface ISendableMsg { 7 | byte getSendTimes(); 8 | 9 | void increaseSendTimes(); 10 | 11 | MsgKey getMsgKey(); 12 | 13 | byte[] getBytes(); 14 | } 15 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/base/WebMsgBaseEmployee.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.base; 2 | 3 | public class WebMsgBaseEmployee extends BaseMessage { 4 | 5 | private String value; 6 | 7 | protected WebMsgBaseEmployee(int groupId, int boxId, String value) { 8 | super(groupId, boxId); 9 | this.value = value; 10 | } 11 | 12 | public String getValue() { 13 | return value; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/tcp/MsgErrorMessage.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.tcp; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseMessage; 5 | 6 | public class MsgErrorMessage extends BaseMessage { 7 | 8 | private String msg; 9 | 10 | private MsgErrorMessage(int groupId) { 11 | super(groupId); 12 | setMsgId(MsgType.ERROR); 13 | } 14 | 15 | private MsgErrorMessage(int groupId, String msg) { 16 | this(groupId); 17 | this.msg = msg; 18 | } 19 | 20 | public MsgErrorMessage(String msg) { 21 | this(-1, msg); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/tcp/TcpMsgInitResponseCardNumber.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.tcp; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseMsgCardNum; 5 | 6 | /** 7 | * 设备初始化: 发送员工卡号 8 | */ 9 | public class TcpMsgInitResponseCardNumber extends BaseMsgCardNum { 10 | 11 | public TcpMsgInitResponseCardNumber(int groupId, int boxId, String cardNumber) { 12 | super(groupId, boxId, cardNumber, MsgType.INITIALIZE_DEVICE_RESPONSE_CARD); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/tcp/TcpMsgResponseDeviceId.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.tcp; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseTcpResponseMsg; 5 | 6 | /** 7 | * 设备回复: 设备 Id 更新 8 | */ 9 | public class TcpMsgResponseDeviceId extends BaseTcpResponseMsg { 10 | 11 | public TcpMsgResponseDeviceId(int groupId, int boxId, int status) { 12 | super(groupId, boxId, status); 13 | setMsgId(MsgType.DEVICE_RESPONSE_DEVICE_ID); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/tcp/TcpMsgResponseEmployeeCardnumber.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.tcp; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseTcpResponseMsg; 5 | 6 | /** 7 | * 设备回复: 员工卡号更新 8 | */ 9 | public class TcpMsgResponseEmployeeCardnumber extends BaseTcpResponseMsg { 10 | 11 | public TcpMsgResponseEmployeeCardnumber(int groupId, int boxId, int status) { 12 | super(groupId, boxId, status); 13 | setMsgId(MsgType.DEVICE_RESPONSE_EMPLOYEE_CARD_NUMBER); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/tcp/TcpMsgResponseEmployeeDepartment1.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.tcp; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseTcpResponseMsg; 5 | 6 | /** 7 | * 设备回复: 员工部门更新「1」 8 | */ 9 | public class TcpMsgResponseEmployeeDepartment1 extends BaseTcpResponseMsg { 10 | 11 | public TcpMsgResponseEmployeeDepartment1(int groupId, int boxId, int status) { 12 | super(groupId, boxId, status); 13 | setMsgId(MsgType.DEVICE_RESPONSE_EMPLOYEE_DEPARTMENT_1); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/tcp/TcpMsgResponseEmployeeDepartment2.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.tcp; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseTcpResponseMsg; 5 | 6 | /** 7 | * 设备回复: 员工部门更新「2」 8 | */ 9 | public class TcpMsgResponseEmployeeDepartment2 extends BaseTcpResponseMsg { 10 | 11 | public TcpMsgResponseEmployeeDepartment2(int groupId, int boxId, int status) { 12 | super(groupId, boxId, status); 13 | setMsgId(MsgType.DEVICE_RESPONSE_EMPLOYEE_DEPARTMENT_2); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/tcp/TcpMsgResponseEmployeeName.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.tcp; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseTcpResponseMsg; 5 | 6 | /** 7 | * 设备回复: 员工姓名更新 8 | */ 9 | public class TcpMsgResponseEmployeeName extends BaseTcpResponseMsg { 10 | 11 | public TcpMsgResponseEmployeeName(int groupId, int boxId, int status) { 12 | super(groupId, boxId, status); 13 | setMsgId(MsgType.DEVICE_RESPONSE_EMPLOYEE_NAME); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/tcp/TcpMsgResponseFreeCardNumber.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.tcp; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseTcpResponseMsg; 5 | 6 | /** 7 | * 设备回复: 员工部门更新 8 | */ 9 | public class TcpMsgResponseFreeCardNumber extends BaseTcpResponseMsg { 10 | 11 | private TcpMsgResponseFreeCardNumber(int groupId, int deviceId, int status) { 12 | super(groupId, deviceId, status); 13 | setMsgId(MsgType.DEVICE_RESPONSE_FREE_CARD_NUMBER); 14 | } 15 | 16 | public TcpMsgResponseFreeCardNumber(int groupId, int deviceId, int msgId, int status) { 17 | super(groupId, deviceId, status); 18 | setMsgId(msgId); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/tcp/TcpMsgResponseLed.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.tcp; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseTcpResponseMsg; 5 | 6 | /** 7 | * 设备回复: 设备 Id 更新 8 | */ 9 | public class TcpMsgResponseLed extends BaseTcpResponseMsg { 10 | 11 | public TcpMsgResponseLed(int groupId, int boxId, int status) { 12 | super(groupId, boxId, status); 13 | setMsgId(MsgType.DEVICE_RESPONSE_LED_SETTING); 14 | } 15 | 16 | @Override 17 | public void setMsgId(int msgId) { 18 | super.setMsgId(msgId); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/tcp/TcpMsgResponseOperateBoxUnlock.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.tcp; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseTcpResponseMsg; 5 | 6 | /** 7 | * 设备回复: 开锁成功 8 | */ 9 | public class TcpMsgResponseOperateBoxUnlock extends BaseTcpResponseMsg { 10 | 11 | public TcpMsgResponseOperateBoxUnlock(int groupId, int boxId, int status) { 12 | super(groupId, boxId, status); 13 | setMsgId(MsgType.DEVICE_RESPONSE_REMOTE_UNLOCK); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/tcp/TcpMsgResponseRemainChargeTimes.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.tcp; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseTcpResponseMsg; 5 | 6 | /** 7 | * 设备回复: 剩余充电次数更新 8 | */ 9 | public class TcpMsgResponseRemainChargeTimes extends BaseTcpResponseMsg { 10 | 11 | public TcpMsgResponseRemainChargeTimes(int groupId, int boxId, int status) { 12 | super(groupId, boxId, status); 13 | setMsgId(MsgType.DEVICE_RESPONSE_REMAIN_CHARGE_TIMES); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/web/WebMsgDeployEmployeeCardNumber.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.web; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseMsgCardNum; 5 | 6 | /** 7 | * 服务器部署员工卡号 8 | */ 9 | public class WebMsgDeployEmployeeCardNumber extends BaseMsgCardNum { 10 | 11 | public WebMsgDeployEmployeeCardNumber(int groupId, int boxId, String cardNumber) { 12 | super(groupId, boxId, cardNumber, MsgType.SERVER_SET_EMPLOYEE_CARD_NUMBER); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/web/WebMsgDeployEmployeeDepartment.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.web; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.WebMsgBaseEmployee; 5 | 6 | /** 7 | * 服务器部署员工部门 8 | */ 9 | public class WebMsgDeployEmployeeDepartment extends WebMsgBaseEmployee { 10 | public WebMsgDeployEmployeeDepartment(int groupId, int boxId, String value) { 11 | super(groupId, boxId, value); 12 | setMsgId(MsgType.SERVER_SET_EMPLOYEE_DEPARTMENT_1); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/web/WebMsgDeployEmployeeDeviceId.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.web; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseMessage; 5 | 6 | /** 7 | * 服务器部署设备 Id 8 | */ 9 | public class WebMsgDeployEmployeeDeviceId extends BaseMessage { 10 | 11 | private int updatedDeviceId; 12 | 13 | public WebMsgDeployEmployeeDeviceId(int groupId, int boxId, int updatedDeviceId) { 14 | super(groupId, boxId); 15 | this.updatedDeviceId = updatedDeviceId; 16 | setMsgId(MsgType.SERVER_SET_DEVICE_ID); 17 | } 18 | 19 | public int getUpdatedDeviceId() { 20 | return updatedDeviceId; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/web/WebMsgDeployEmployeeName.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.web; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.WebMsgBaseEmployee; 5 | 6 | /** 7 | * 服务器部署员工姓名 8 | */ 9 | public class WebMsgDeployEmployeeName extends WebMsgBaseEmployee { 10 | public WebMsgDeployEmployeeName(int groupId, int boxId, String value) { 11 | super(groupId, boxId, value); 12 | setMsgId(MsgType.SERVER_SET_EMPLOYEE_NAME); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/web/WebMsgDeployFreeCardNumber.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.web; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseMessage; 5 | 6 | /** 7 | * 服务器部署万能卡号 8 | */ 9 | public class WebMsgDeployFreeCardNumber extends BaseMessage { 10 | 11 | private String[] cardNumbers; 12 | 13 | /** 14 | * 服务器部署万能卡号 15 | * 16 | * @param groupId 组号 17 | * @param boxId 设备号 18 | * @param numbers 万能卡号集合 19 | */ 20 | public WebMsgDeployFreeCardNumber(int groupId, int boxId, String[] numbers) { 21 | super(groupId, boxId); 22 | setMsgId(MsgType.SERVER_SET_FREE_CARD_NUMBER); 23 | if (numbers.length <= 16) { 24 | this.cardNumbers = numbers; 25 | return; 26 | } 27 | int length = numbers.length > 16 ? 16 : numbers.length; 28 | System.arraycopy(numbers, 0, cardNumbers, 0, length); 29 | } 30 | 31 | public String[] getCardNumbers() { 32 | return cardNumbers; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/web/WebMsgDeployLedStop.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.web; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseMessage; 5 | 6 | /** 7 | * 服务器操作远程开锁 8 | */ 9 | public class WebMsgDeployLedStop extends BaseMessage { 10 | 11 | public WebMsgDeployLedStop(int groupId, int boxId) { 12 | super(groupId, boxId); 13 | setMsgId(MsgType.SERVER_LED_STOP); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/web/WebMsgDeployRemainChargeTimes.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.web; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseMessage; 5 | 6 | /** 7 | * 服务器部署剩余充电次数 8 | */ 9 | public class WebMsgDeployRemainChargeTimes extends BaseMessage { 10 | 11 | private int times; 12 | 13 | public WebMsgDeployRemainChargeTimes(int groupId, int boxId, int times) { 14 | super(groupId, boxId); 15 | setMsgId(MsgType.SERVER_SET_REMAIN_CHARGE_TIMES); 16 | this.times = times; 17 | } 18 | 19 | public int getTimes() { 20 | return times; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/web/WebMsgInitClearDeviceStatus.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.web; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseMessage; 5 | 6 | /** 7 | * 设备初始化「3」: 服务器清除设备的初始化状态 8 | */ 9 | public class WebMsgInitClearDeviceStatus extends BaseMessage { 10 | 11 | public WebMsgInitClearDeviceStatus(int groupId, int boxId) { 12 | super(groupId, boxId); 13 | setMsgId(MsgType.INITIALIZE_SERVER_CLEAR_INITIALIZE_MESSAGE); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/web/WebMsgInitMarchConfirmCardResponse.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.web; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseMessage; 5 | 6 | /** 7 | * 设备初始化「2」: 服务器匹配确认卡号回复 8 | */ 9 | public class WebMsgInitMarchConfirmCardResponse extends BaseMessage { 10 | 11 | private boolean successful; 12 | 13 | public WebMsgInitMarchConfirmCardResponse(int groupId, int boxId, boolean successful) { 14 | super(groupId, boxId); 15 | this.successful = successful; 16 | setMsgId(MsgType.INITIALIZE_SERVER_MARCH_CONFIRM_CARD_RESPONSE); 17 | } 18 | 19 | public boolean isSuccessful() { 20 | return successful; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/web/WebMsgObtainDeviceStatus.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.web; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseMessage; 5 | 6 | /** 7 | * 服务器获取设备的当前状态 8 | */ 9 | public class WebMsgObtainDeviceStatus extends BaseMessage { 10 | 11 | 12 | public WebMsgObtainDeviceStatus(int groupId, int boxId) { 13 | super(groupId, boxId); 14 | setMsgId(MsgType.SERVER_REQUSET_STATUS); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/server/message/web/WebMsgOperateBoxUnlock.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.server.message.web; 2 | 3 | import cc.bitky.clustermanage.server.message.MsgType; 4 | import cc.bitky.clustermanage.server.message.base.BaseMessage; 5 | 6 | /** 7 | * 服务器操作远程开锁 8 | */ 9 | public class WebMsgOperateBoxUnlock extends BaseMessage { 10 | 11 | public WebMsgOperateBoxUnlock(int groupId, int boxId) { 12 | super(groupId, boxId); 13 | setMsgId(MsgType.SERVER_REMOTE_UNLOCK); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/tcp/base/BasePresenter.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.tcp.base; 2 | 3 | public interface BasePresenter { 4 | void start(); 5 | } 6 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/tcp/base/BaseView.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.tcp.base; 2 | 3 | public interface BaseView { 4 | void setPresenter(T presenter); 5 | } 6 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/tcp/server/channelhandler/SendingOutBoundHandler.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.tcp.server.channelhandler; 2 | 3 | import org.springframework.stereotype.Service; 4 | 5 | import cc.bitky.clustermanage.server.message.send.SendableMsg; 6 | import io.netty.buffer.Unpooled; 7 | import io.netty.channel.ChannelHandler; 8 | import io.netty.channel.ChannelHandlerContext; 9 | import io.netty.channel.ChannelOutboundHandlerAdapter; 10 | import io.netty.channel.ChannelPromise; 11 | 12 | @Service 13 | @ChannelHandler.Sharable 14 | public class SendingOutBoundHandler extends ChannelOutboundHandlerAdapter { 15 | 16 | @Override 17 | public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { 18 | if (!(msg instanceof SendableMsg)) { 19 | return; 20 | } 21 | SendableMsg message = (SendableMsg) msg; 22 | ctx.writeAndFlush(Unpooled.wrappedBuffer(message.getBytes())); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/tcp/server/netty/NettyServerContract.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.tcp.server.netty; 2 | 3 | import cc.bitky.clustermanage.tcp.base.BasePresenter; 4 | import cc.bitky.clustermanage.tcp.base.BaseView; 5 | import cc.bitky.clustermanage.tcp.util.listener.SuccessfulListener; 6 | 7 | public class NettyServerContract { 8 | 9 | public interface IServerView extends BaseView { 10 | void setLaunchSuccessfulListener(SuccessfulListener successfulListener); 11 | 12 | void setFinishSuccessfulListener(SuccessfulListener successfulListener); 13 | 14 | void start(); 15 | 16 | void shutdown(); 17 | } 18 | 19 | interface IServerPresenter extends BasePresenter { 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/tcp/server/netty/SendWebMessagesListener.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.tcp.server.netty; 2 | 3 | import cc.bitky.clustermanage.server.message.base.IMessage; 4 | 5 | /** 6 | * Server 模块发送消息 bean 监听器 7 | */ 8 | @FunctionalInterface 9 | public interface SendWebMessagesListener { 10 | 11 | /** 12 | * 向 Tcp 通道发送消息 bean 的集合 13 | * 14 | * @param message 消息 bean 的集合 15 | * @return 是否发送成功 16 | */ 17 | boolean sendMessagesToTcp(IMessage message); 18 | } 19 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/tcp/util/KyLog.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.tcp.util; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import io.netty.buffer.ByteBufUtil; 5 | 6 | public class KyLog { 7 | public static void LogFrame(ByteBuf byteBuf) { 8 | System.out.println("begin:" + byteBuf.readerIndex() 9 | + ", end:" + byteBuf.writerIndex() 10 | + ", readable:" + byteBuf.readableBytes() 11 | + ", writable:" + byteBuf.writableBytes()); 12 | System.out.println(ByteBufUtil.prettyHexDump(byteBuf)); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/tcp/util/listener/SuccessfulListener.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.tcp.util.listener; 2 | 3 | @FunctionalInterface 4 | public interface SuccessfulListener { 5 | void onSuccess(boolean isSuccess); 6 | } 7 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/web/bean/LedSetting.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.web.bean; 2 | 3 | import cc.bitky.clustermanage.server.message.web.WebMsgDeployLedSetting; 4 | 5 | public class LedSetting { 6 | public int duration; 7 | public int brightness; 8 | public String text; 9 | public String point; 10 | 11 | public boolean isEnabled() { 12 | if (duration < 0 || duration > 9) 13 | return false; 14 | if (brightness < 1 || brightness > 16) 15 | return false; 16 | return point != null && text != null; 17 | } 18 | 19 | public WebMsgDeployLedSetting.Point getPoint() { 20 | switch (point) { 21 | case "上": 22 | return WebMsgDeployLedSetting.Point.TOP; 23 | case "下": 24 | return WebMsgDeployLedSetting.Point.BOTTOM; 25 | case "左": 26 | return WebMsgDeployLedSetting.Point.LEFT; 27 | case "右": 28 | return WebMsgDeployLedSetting.Point.RIGHT; 29 | } 30 | return WebMsgDeployLedSetting.Point.RIGHT; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/java/cc/bitky/clustermanage/web/bean/QueueInfo.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.web.bean; 2 | 3 | 4 | /** 5 | * CAN 帧发送队列局部信息 6 | */ 7 | public class QueueInfo { 8 | /** 9 | * CAN 帧发送队列中帧的数量 10 | */ 11 | private int size; 12 | /** 13 | * CAN 帧发送队列容量 14 | */ 15 | private int capacity; 16 | /** 17 | * CAN 帧发送间隔 18 | */ 19 | private int interval; 20 | 21 | public QueueInfo(int size, int capacity, int interval) { 22 | this.size = size; 23 | this.capacity = capacity; 24 | this.interval = interval; 25 | } 26 | 27 | public int getSize() { 28 | return size; 29 | } 30 | 31 | public void setSize(int size) { 32 | this.size = size; 33 | } 34 | 35 | public int getCapacity() { 36 | return capacity; 37 | } 38 | 39 | public void setCapacity(int capacity) { 40 | this.capacity = capacity; 41 | } 42 | 43 | public int getInterval() { 44 | return interval; 45 | } 46 | 47 | public void setInterval(int interval) { 48 | this.interval = interval; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/Project-v1-Obsolete/clustermanage-server/src/main/resources/application.properties -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | debug: false 2 | logging: 3 | level: 4 | root: info 5 | server: 6 | port: 8080 7 | 8 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/test/java/Girl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by lmlLocal on 2017/5/25. 3 | */ 4 | public class Girl extends Person { 5 | 6 | 7 | @Override 8 | public int getAge() { 9 | return age; 10 | } 11 | 12 | public void setAge(int a) { 13 | age = a; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/test/java/Main.java: -------------------------------------------------------------------------------- 1 | import java.util.List; 2 | 3 | import javax.validation.constraints.NotNull; 4 | 5 | public class Main { 6 | public static void main(String[] lml) { 7 | 8 | 9 | } 10 | 11 | public void run(@NotNull List strings) { 12 | 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/test/java/Person.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by lmlLocal on 2017/5/25. 3 | */ 4 | public class Person { 5 | 6 | int age = 18; 7 | 8 | public int getAge() { 9 | return age; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/clustermanage-server/src/test/java/cc/bitky/clustermanage/db/KyTest.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clustermanage.db; 2 | 3 | //@RunWith(SpringRunner.class) 4 | //@SpringBootTest 5 | public class KyTest { 6 | // @Autowired 7 | // private StringRedisTemplate stringRedisTemplate; 8 | // 9 | // @Test 10 | // public void contextLoads() { 11 | // // 保存字符串 12 | // stringRedisTemplate.opsForValue().set("aaa", "111"); 13 | // Assert.assertEquals("111", stringRedisTemplate.opsForValue().get("aaa")); 14 | // 15 | // } 16 | 17 | } -------------------------------------------------------------------------------- /Project-v1-Obsolete/hardware/SingleDeviceTestNET/SingleDeviceTest.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SingleDeviceTestNET", "SingleDeviceTestNET\SingleDeviceTestNET.csproj", "{5E0C4B0F-13FF-47E3-B951-A2457DF0BC25}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {5E0C4B0F-13FF-47E3-B951-A2457DF0BC25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {5E0C4B0F-13FF-47E3-B951-A2457DF0BC25}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {5E0C4B0F-13FF-47E3-B951-A2457DF0BC25}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {5E0C4B0F-13FF-47E3-B951-A2457DF0BC25}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/hardware/SingleDeviceTestNET/SingleDeviceTestNET/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/hardware/SingleDeviceTestNET/SingleDeviceTestNET/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace SocketServer 5 | { 6 | static class Program 7 | { 8 | /// 9 | /// 应用程序的主入口点。 10 | /// 11 | [STAThread] 12 | private static void Main() 13 | { 14 | Application.EnableVisualStyles(); 15 | Application.SetCompatibleTextRenderingDefault(false); 16 | Application.Run(new FormSocketServer()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/hardware/SingleDeviceTestNET/SingleDeviceTestNET/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("SocketSever")] 8 | [assembly: AssemblyDescription("SocketSever for .net3.5")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("SocketSever")] 12 | [assembly: AssemblyCopyright("Copyright © 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("5e0c4b0f-13ff-47e3-b951-a2457df0bc25")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/hardware/SingleDeviceTestNET/SingleDeviceTestNET/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SingleDeviceTest.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/hardware/SingleDeviceTestNET/SingleDeviceTestNET/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Project-v1-Obsolete/hardware/SingleDeviceTestNET/SingleDeviceTestNET/message/WebMsgOperateBoxUnlock.cs: -------------------------------------------------------------------------------- 1 | using SocketServer.message.@base; 2 | using SocketServer.utils; 3 | 4 | namespace SocketServer.message 5 | { 6 | public class WebMsgOperateBoxUnlock : BaseMessage 7 | { 8 | public WebMsgOperateBoxUnlock(int groupId, int boxId) : base(groupId, boxId) 9 | { 10 | setMsgId(MsgType.ServerRemoteUnlock); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /Project-v1-Obsolete/hardware/SingleDeviceTestNET/SingleDeviceTestNET/message/base/BaseMessage.cs: -------------------------------------------------------------------------------- 1 | namespace SocketServer.message.@base 2 | { 3 | public class BaseMessage : IMessage 4 | { 5 | private int _msgId = -1; 6 | private int _groupId = -1; 7 | private int _deviceId = -1; 8 | 9 | protected BaseMessage(int groupId) 10 | { 11 | this._groupId = groupId; 12 | } 13 | 14 | protected BaseMessage(int groupId, int deviceId) : this(groupId) 15 | { 16 | this._deviceId = deviceId; 17 | } 18 | 19 | public int getMsgId() 20 | { 21 | return _msgId; 22 | } 23 | 24 | protected void setMsgId(int msgId) 25 | { 26 | this._msgId = msgId; 27 | } 28 | 29 | public int getGroupId() 30 | { 31 | return _groupId; 32 | } 33 | 34 | public void setGroupId(int groupId) 35 | { 36 | this._groupId = groupId; 37 | } 38 | 39 | 40 | public int getDeviceId() 41 | { 42 | return _deviceId; 43 | } 44 | 45 | 46 | public void setDeviceId(int deviceId) 47 | { 48 | this._deviceId = deviceId; 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Project-v1-Obsolete/hardware/SingleDeviceTestNET/SingleDeviceTestNET/message/base/IMessage.cs: -------------------------------------------------------------------------------- 1 | namespace SocketServer.message.@base 2 | { 3 | public interface IMessage 4 | { 5 | int getMsgId(); 6 | 7 | int getDeviceId(); 8 | 9 | void setDeviceId(int deviceId); 10 | 11 | int getGroupId(); 12 | 13 | void setGroupId(int groupId); 14 | } 15 | } -------------------------------------------------------------------------------- /SerialRawData/.gitignore: -------------------------------------------------------------------------------- 1 | setting 2 | src/test/java/ 3 | *.exe 4 | *.dll 5 | 6 | /.gradle/ 7 | /build/ 8 | /gradle/ 9 | /libs/ 10 | /out/ 11 | 12 | ### STS ### 13 | .apt_generated 14 | .classpath 15 | .factorypath 16 | .project 17 | .settings 18 | .springBeans 19 | 20 | ### IntelliJ IDEA ### 21 | .idea 22 | *.iws 23 | *.iml 24 | *.ipr 25 | 26 | ### NetBeans ### 27 | nbproject/private/ 28 | build/ 29 | nbbuild/ 30 | dist/ 31 | nbdist/ 32 | .nb-gradle/ -------------------------------------------------------------------------------- /SerialRawData/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | } 4 | 5 | group 'cc.bitky.ClusterDevicePlatform' 6 | version '1.1.0' 7 | 8 | sourceCompatibility = 1.8 9 | 10 | repositories { 11 | mavenCentral() 12 | } 13 | 14 | tasks.withType(JavaCompile) { 15 | options.encoding = "UTF-8" 16 | } 17 | 18 | dependencies { 19 | testCompile('org.junit.jupiter:junit-jupiter-api:5.2.0') 20 | testRuntime('org.junit.jupiter:junit-jupiter-engine:5.2.0') 21 | compile 'com.alibaba:fastjson:1.2.46' 22 | } 23 | 24 | jar { 25 | from { 26 | //添加依懒到打包文件 27 | //configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } 28 | configurations.runtime.collect{zipTree(it)} 29 | } 30 | 31 | manifest { 32 | attributes 'Main-Class': 'cc.bitky.clusterdeviceplatform.serialrawdata.LicenseVerifyPresenter' 33 | } 34 | } -------------------------------------------------------------------------------- /SerialRawData/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'SerialRawData' 2 | 3 | -------------------------------------------------------------------------------- /SerialRawData/src/main/java/cc/bitky/clusterdeviceplatform/serialrawdata/NetCard.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.serialrawdata; 2 | 3 | public class NetCard { 4 | 5 | private String name; 6 | private String mac; 7 | 8 | public NetCard(String name, String mac) { 9 | this.name = name; 10 | this.mac = mac; 11 | } 12 | 13 | public String getName() { 14 | return name; 15 | } 16 | 17 | public String getMac() { 18 | return mac; 19 | } 20 | } -------------------------------------------------------------------------------- /SerialRawData/src/main/java/cc/bitky/clusterdeviceplatform/serialrawdata/utils/.gitignore: -------------------------------------------------------------------------------- 1 | ### 本工程的私有加密密钥,无分享的必要 ### 2 | DangerousKey.java -------------------------------------------------------------------------------- /SerialRawData/src/main/java/cc/bitky/clusterdeviceplatform/serialrawdata/utils/EigestUtil.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.serialrawdata.utils; 2 | 3 | import java.security.MessageDigest; 4 | import java.security.NoSuchAlgorithmException; 5 | 6 | /** 7 | * 消息摘要算法工具类,此加密不可逆 8 | */ 9 | public class EigestUtil { 10 | 11 | private static MessageDigest messageDigest; 12 | 13 | static { 14 | try { 15 | messageDigest = MessageDigest.getInstance("SHA-256"); 16 | } catch (NoSuchAlgorithmException e) { 17 | e.printStackTrace(); 18 | } 19 | } 20 | 21 | /** 22 | * 对字符串进行加扰 23 | * 24 | * @param str 原始字符串 25 | * @return 加扰后的字符串 26 | */ 27 | private static String strConfuse(String str) { 28 | return DangerousKey.strConfuse(str); 29 | } 30 | 31 | /** 32 | * 对字符串进行摘要 33 | * 34 | * @param str 原始字符串 35 | * @return 摘要后的字符串 36 | */ 37 | public static String strEigest(String str) { 38 | return StringConvert.byteArrayToHexStr(messageDigest.digest(strConfuse(str).getBytes())); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /SerialRawData/src/main/java/cc/bitky/clusterdeviceplatform/serialrawdata/utils/NetCardFactory.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.serialrawdata.utils; 2 | 3 | import java.net.NetworkInterface; 4 | import java.net.SocketException; 5 | import java.util.ArrayList; 6 | import java.util.Enumeration; 7 | import java.util.List; 8 | 9 | import cc.bitky.clusterdeviceplatform.serialrawdata.NetCard; 10 | 11 | public class NetCardFactory { 12 | 13 | public static List createNetCards() throws SocketException { 14 | Enumeration anInterface = NetworkInterface.getNetworkInterfaces(); 15 | List netCards = new ArrayList<>(); 16 | while (anInterface.hasMoreElements()) { 17 | NetworkInterface networkInterface = anInterface.nextElement(); 18 | if (networkInterface.isUp() && networkInterface.getHardwareAddress() != null) { 19 | netCards.add(new NetCard(networkInterface.getDisplayName(), StringConvert.byteArrayToMacStr(networkInterface.getHardwareAddress()))); 20 | } 21 | } 22 | return netCards; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SerialRawData/src/main/java/cc/bitky/clusterdeviceplatform/serialrawdata/utils/StringConvert.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.serialrawdata.utils; 2 | 3 | public class StringConvert { 4 | 5 | static String byteArrayToHexStr(byte[] byteArray) { 6 | if (byteArray == null) { 7 | return null; 8 | } 9 | char[] hexArray = "0123456789ABCDEF".toCharArray(); 10 | char[] hexChars = new char[byteArray.length * 2]; 11 | for (int j = 0; j < byteArray.length; j++) { 12 | int v = byteArray[j] & 0xFF; 13 | hexChars[j * 2] = hexArray[v >>> 4]; 14 | hexChars[j * 2 + 1] = hexArray[v & 0x0F]; 15 | } 16 | return new String(hexChars); 17 | } 18 | 19 | static String byteArrayToMacStr(byte[] byteArray) { 20 | if (byteArray == null) { 21 | return null; 22 | } 23 | char[] hexArray = "0123456789ABCDEF".toCharArray(); 24 | char[] hexChars = new char[byteArray.length * 3 - 1]; 25 | int i = 0; 26 | for (int j = 0; j < byteArray.length; j++) { 27 | int v = byteArray[j] & 0xFF; 28 | hexChars[i++] = hexArray[v >>> 4]; 29 | hexChars[i++] = hexArray[v & 0x0F]; 30 | if (i < hexChars.length) { 31 | hexChars[i++] = '-'; 32 | } 33 | } 34 | return new String(hexChars); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /ServerPreSetting/ServerPreSetting.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerPreSetting", "ServerPreSetting\ServerPreSetting.csproj", "{CE9B218F-2EF5-4F1D-AD95-126EAF0EB8B6}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {CE9B218F-2EF5-4F1D-AD95-126EAF0EB8B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {CE9B218F-2EF5-4F1D-AD95-126EAF0EB8B6}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {CE9B218F-2EF5-4F1D-AD95-126EAF0EB8B6}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {CE9B218F-2EF5-4F1D-AD95-126EAF0EB8B6}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /ServerPreSetting/ServerPreSetting/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ServerPreSetting/ServerPreSetting/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /ServerPreSetting/ServerPreSetting/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace ServerPreSetting 10 | { 11 | /// 12 | /// App.xaml 的交互逻辑 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ServerPreSetting/ServerPreSetting/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ServerPreSetting.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ServerPreSetting/ServerPreSetting/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /ServerPreSetting/ServerPreSetting/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/.gitignore: -------------------------------------------------------------------------------- 1 | src/main/resources/static/ 2 | out/ 3 | 4 | .gradle 5 | /build/ 6 | !gradle/wrapper/gradle-wrapper.jar 7 | 8 | ### STS ### 9 | .apt_generated 10 | .classpath 11 | .factorypath 12 | .project 13 | .settings 14 | .springBeans 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | nbproject/private/ 24 | build/ 25 | nbbuild/ 26 | dist/ 27 | nbdist/ 28 | .nb-gradle/ -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '2.3.3.RELEASE' 4 | } 5 | repositories { 6 | mavenCentral() 7 | } 8 | dependencies { 9 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 10 | } 11 | } 12 | 13 | apply plugin: 'java' 14 | apply plugin: 'eclipse' 15 | apply plugin: 'org.springframework.boot' 16 | apply plugin: 'io.spring.dependency-management' 17 | 18 | group = 'cc.bitky.clusterdeviceplatform' 19 | version = '1.0.0' 20 | sourceCompatibility = 1.8 21 | 22 | repositories { 23 | mavenCentral() 24 | } 25 | 26 | 27 | dependencies { 28 | compile('org.springframework.boot:spring-boot-starter-web') 29 | compile files('libs/messageUtils-1.9.1.jar') 30 | 31 | compileOnly 'org.projectlombok:lombok:1.18.12' 32 | annotationProcessor 'org.projectlombok:lombok:1.18.12' 33 | 34 | testCompileOnly 'org.projectlombok:lombok:1.18.12' 35 | testAnnotationProcessor 'org.projectlombok:lombok:1.18.12' 36 | testCompile('org.springframework.boot:spring-boot-starter-test') 37 | } 38 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/clusterdeviceplatform-demo/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Jan 31 15:45:38 CST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip 7 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/libs/messageUtils-1.9.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/clusterdeviceplatform-demo/libs/messageUtils-1.9.1.jar -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/DemoApplication.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | import cc.bitky.clusterdeviceplatform.messageutils.MsgProcessor; 7 | 8 | @SpringBootApplication 9 | public class DemoApplication { 10 | 11 | private static MsgProcessor msgProcessor; 12 | 13 | public static void main(String[] args) { 14 | msgProcessor = MsgProcessor.getInstance(); 15 | SpringApplication.run(DemoApplication.class, args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/config/CommSetting.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.config; 2 | 3 | /** 4 | * 与设备的通信策略 5 | * 6 | * @author limingliang 7 | */ 8 | public class CommSetting { 9 | /** 10 | * 服务器发送消息对象后,是否需要设置检错重发任务「要求客户端回复确认」 11 | */ 12 | public static final boolean DEPLOY_MSG_NEED_REPLY = true; 13 | /** 14 | * 已连接通道未响应监测模式 15 | */ 16 | public static final boolean NO_RESPONSE_MONITOR = true; 17 | /** 18 | * 已连接通道未响应持续的时间间隔「s」 19 | */ 20 | public static final int NO_RESPONSE_INTERVAL = 60 * 2; 21 | /** 22 | * 待发送缓冲队列中,帧发送间隔「单位/ms」 23 | */ 24 | public static final int FRAME_SEND_INTERVAL = 300; 25 | /** 26 | * 已发送帧后,在该间隔时间后,检测接收回复帧的状态,用于检错重发功能「单位/s」 27 | */ 28 | public static final int FRAME_SENT_TO_DETECT_INTERVAL = 5; 29 | /** 30 | * 收到一个已激活的 Channel,直到校验结束所需要的时间「单位/ms」 31 | */ 32 | public static final int ACCESSIBLE_CHANNEL_REPLY_INTERVAL = 1000; 33 | /** 34 | * 检错重发最大次数,服务器向 TCP 通道发送 CAN 帧,最大重复发送次数 35 | */ 36 | public static final int AUTO_REPEAT_REQUEST_TIMES = 5; 37 | /** 38 | * 当设备中记录的剩余充电次数小于该值时,则向设备发送剩余充电次数 39 | */ 40 | public static final int DEPLOY_REMAIN_CHARGE_TIMES = 20; 41 | 42 | private CommSetting() { 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/config/DbSetting.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.config; 2 | 3 | public class DbSetting { 4 | /** 5 | * MongoDB 的主机名 6 | */ 7 | public static final String MONGODB_HOST = "lml-desktop"; 8 | /** 9 | * MongoDB 的端口号 10 | */ 11 | public static final int MONGODB_PORT = 27017; 12 | /** 13 | * MongoDB 的IP地址 14 | */ 15 | public static final String MONGODB_IP = "未知"; 16 | /** 17 | * 数据库 18 | */ 19 | public static final String DATABASE = "bitkyTest"; 20 | } 21 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/config/DeviceSetting.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.config; 2 | 3 | /** 4 | * @author limingliang 5 | */ 6 | public class DeviceSetting { 7 | /** 8 | * 最大设备组号 9 | */ 10 | public static final int MAX_GROUP_ID = 100; 11 | /** 12 | * 设备组内的最大设备号 13 | */ 14 | public static final int MAX_DEVICE_ID = 100; 15 | 16 | private DeviceSetting() { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/db/statistic/repo/ProcessedMsgRepo.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.db.statistic.repo; 2 | 3 | import java.util.concurrent.atomic.AtomicLong; 4 | 5 | public class ProcessedMsgRepo { 6 | /** 7 | * 已收到的消息总数 8 | */ 9 | public static final AtomicLong MSG_COUNT = new AtomicLong(0); 10 | /** 11 | * 已收到的充电状态帧总数 12 | */ 13 | public static final AtomicLong MSG_CHARGE_COUNT = new AtomicLong(0); 14 | /** 15 | * 状态已改变的充电状态帧总数 16 | */ 17 | public static final AtomicLong MSG_CHARGE_COUNT_FIXED = new AtomicLong(0); 18 | /** 19 | * 状态未改变的充电状态帧总数 20 | */ 21 | public static final AtomicLong MSG_CHARGE_COUNT_VARIABLE = new AtomicLong(0); 22 | /** 23 | * 已收到的工作状态帧总数 24 | */ 25 | public static final AtomicLong MSG_WORK_COUNT = new AtomicLong(0); 26 | /** 27 | * 状态已改变的工作状态帧总数 28 | */ 29 | public static final AtomicLong MSG_WORK_COUNT_FIXED = new AtomicLong(0); 30 | /** 31 | * 状态未改变的工作状态帧总数 32 | */ 33 | public static final AtomicLong MSG_WORK_COUNT_VARIABLE = new AtomicLong(0); 34 | } 35 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/server/statistic/info/DataBaseInfo.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.server.statistic.info; 2 | 3 | import cc.bitky.clusterdeviceplatform.demo.config.DbSetting; 4 | 5 | public class DataBaseInfo { 6 | /** 7 | * 数据库类型 8 | */ 9 | private String type; 10 | /** 11 | * MongoDB 的端口号 12 | */ 13 | private int port; 14 | /** 15 | * MongoDB 的主机名 16 | */ 17 | private String host; 18 | /** 19 | * MongoDB 的IP 20 | */ 21 | private String ip; 22 | /** 23 | * 数据库 24 | */ 25 | private String database; 26 | 27 | public DataBaseInfo() { 28 | this.type = "MongoDB"; 29 | this.port = DbSetting.MONGODB_PORT; 30 | this.host = DbSetting.MONGODB_HOST; 31 | this.ip = DbSetting.MONGODB_IP; 32 | this.database = DbSetting.DATABASE; 33 | } 34 | 35 | public String getType() { 36 | return type; 37 | } 38 | 39 | public int getPort() { 40 | return port; 41 | } 42 | 43 | public String getHost() { 44 | return host; 45 | } 46 | 47 | public String getIp() { 48 | return ip; 49 | } 50 | 51 | public String getDatabase() { 52 | return database; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/server/statistic/info/ServerInfo.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.server.statistic.info; 2 | 3 | 4 | import cc.bitky.clusterdeviceplatform.demo.config.ServerSetting; 5 | import cc.bitky.clusterdeviceplatform.demo.server.statistic.util.IpUtils; 6 | 7 | public class ServerInfo { 8 | /** 9 | * 服务器版本 10 | */ 11 | String version = ServerSetting.VERSION; 12 | /** 13 | * web端口号 14 | */ 15 | int webPort = ServerSetting.SERVER_WEB_PORT; 16 | /** 17 | * tcp端口号 18 | */ 19 | int tcpPort= ServerSetting.SERVER_TCP_PORT; 20 | /** 21 | * 服务器主机名 22 | */ 23 | String hostName; 24 | /** 25 | * 服务器地址 26 | */ 27 | String[] ipAddress; 28 | 29 | public ServerInfo() { 30 | this.hostName = IpUtils.getLocalHostName(); 31 | this.ipAddress = IpUtils.getIP(hostName); 32 | } 33 | 34 | public int getWebPort() { 35 | return webPort; 36 | } 37 | 38 | public int getTcpPort() { 39 | return tcpPort; 40 | } 41 | 42 | public String getHostName() { 43 | return hostName; 44 | } 45 | 46 | public String[] getIpAddress() { 47 | return ipAddress; 48 | } 49 | 50 | public String getVersion() { 51 | return version; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/tcp/statistic/channel/ChannelItem.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.tcp.statistic.channel; 2 | 3 | /** 4 | * TCP模块中单个 Channel 的当前负载量 5 | */ 6 | public class ChannelItem { 7 | /** 8 | * 通道的 ID 9 | */ 10 | private int id; 11 | /** 12 | * 当前Channel是否已启用 13 | */ 14 | private boolean enabled; 15 | /** 16 | * 待发送缓冲区中的消息数 17 | */ 18 | private int count; 19 | 20 | public ChannelItem(int id, boolean enabled, int count) { 21 | this.id = id; 22 | this.enabled = enabled; 23 | this.count = count; 24 | } 25 | 26 | 27 | public int getId() { 28 | return id; 29 | } 30 | 31 | public boolean isEnabled() { 32 | return enabled; 33 | } 34 | 35 | public int getCount() { 36 | return count; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/tcp/statistic/except/TypeEnum.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.tcp.statistic.except; 2 | 3 | /** 4 | * 类型信息枚举 5 | */ 6 | public enum TypeEnum { 7 | 8 | RESEND_OUT_BOUND("消息重发次数超出限制"), 9 | 10 | CHANNEL_DISCONNECT("通道连接已断开"), 11 | 12 | WORK_STATUS_EXCEPTION("设备工作状态异常"), 13 | 14 | DEVICE_GROUP_NO_RESPONSE("设备组无响应"); 15 | 16 | private String detail; 17 | 18 | TypeEnum(String detail) { 19 | this.detail = detail; 20 | } 21 | 22 | public String getDetail() { 23 | return detail; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/web/spa/data/pojo/DeviceStatusItem.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.web.spa.data.pojo; 2 | 3 | public class DeviceStatusItem { 4 | /** 5 | * 充电状态码 6 | */ 7 | private int chargeStatus; 8 | /** 9 | * 工作状态码 10 | */ 11 | private int workStatus; 12 | 13 | public DeviceStatusItem(int chargeStatus, int workStatus) { 14 | this.chargeStatus = chargeStatus; 15 | this.workStatus = workStatus; 16 | } 17 | 18 | public int getChargeStatus() { 19 | return chargeStatus; 20 | } 21 | 22 | public int getWorkStatus() { 23 | return workStatus; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/web/spa/data/pojo/EmployeeGatherByDepartment.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.web.spa.data.pojo; 2 | 3 | public class EmployeeGatherByDepartment { 4 | /** 5 | * 部门名称 6 | */ 7 | String department; 8 | /** 9 | * 总人数 10 | */ 11 | int population; 12 | /** 13 | * 分类 14 | */ 15 | EmployeeCategory category; 16 | 17 | public EmployeeGatherByDepartment(String department, int population, EmployeeCategory category) { 18 | 19 | this.department = department; 20 | this.population = population; 21 | this.category = category; 22 | } 23 | 24 | public String getDepartment() { 25 | return department; 26 | } 27 | 28 | public int getPopulation() { 29 | return population; 30 | } 31 | 32 | public EmployeeCategory getCategory() { 33 | return category; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/web/spa/data/pojo/EmployeeGatherByGroup.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.web.spa.data.pojo; 2 | 3 | public class EmployeeGatherByGroup { 4 | /** 5 | * 设备组 ID 6 | */ 7 | private int groupId; 8 | /** 9 | * 总人数 10 | */ 11 | private int population; 12 | /** 13 | * 分类 14 | */ 15 | private EmployeeCategory category; 16 | 17 | public EmployeeGatherByGroup(int groupId, int population, EmployeeCategory category) { 18 | this.groupId = groupId; 19 | this.population = population; 20 | this.category = category; 21 | } 22 | 23 | public int getGroupId() { 24 | return groupId; 25 | } 26 | 27 | public int getPopulation() { 28 | return population; 29 | } 30 | 31 | public EmployeeCategory getCategory() { 32 | return category; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/web/spa/data/pojo/EmployeeGatherOutline.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.web.spa.data.pojo; 2 | 3 | import java.util.List; 4 | 5 | public class EmployeeGatherOutline { 6 | List departments; 7 | List deviceGroup; 8 | 9 | public EmployeeGatherOutline(List departments, List deviceGroup) { 10 | this.departments = departments; 11 | this.deviceGroup = deviceGroup; 12 | } 13 | 14 | public List getDepartments() { 15 | return departments; 16 | } 17 | 18 | public List getDeviceGroup() { 19 | return deviceGroup; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/web/spa/data/random/MsgCountRandom.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.web.spa.data.random; 2 | 3 | import java.util.Random; 4 | import java.util.concurrent.ThreadLocalRandom; 5 | 6 | import cc.bitky.clusterdeviceplatform.demo.db.statistic.pressure.MsgCount; 7 | 8 | 9 | /** 10 | * 待处理及已处理消息统计计数 11 | */ 12 | public class MsgCountRandom extends MsgCount { 13 | 14 | public MsgCountRandom(MsgCountRandom random) { 15 | if (random == null) { 16 | return; 17 | } 18 | Random r = ThreadLocalRandom.current(); 19 | setMsgChargeCountFixed(random.getMsgChargeCountFixed() + r.nextInt(100)); 20 | setMsgChargeCountVariable(random.getMsgChargeCountVariable() + r.nextInt(100)); 21 | setMsgWorkCountFixed(random.getMsgWorkCountFixed() + r.nextInt(100)); 22 | setMsgWorkCountVariable(random.getMsgWorkCountVariable() + r.nextInt(100)); 23 | setMsgChargeCount(getMsgChargeCountVariable() + getMsgChargeCountFixed()); 24 | setMsgWorkCount(getMsgWorkCountVariable() + getMsgWorkCountFixed()); 25 | setMsgCount(getMsgWorkCount() + getMsgChargeCount()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/web/spa/user/pojo/Token.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.web.spa.user.pojo; 2 | 3 | public class Token { 4 | String token = "admin"; 5 | 6 | public String getToken() { 7 | return token; 8 | } 9 | 10 | public void setToken(String token) { 11 | this.token = token; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/web/spa/user/pojo/UserInfo.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.web.spa.user.pojo; 2 | 3 | public class UserInfo { 4 | String[] role = {"admin"}; 5 | String name = "admin"; 6 | String avatar = "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif"; 7 | 8 | public String[] getRole() { 9 | return role; 10 | } 11 | 12 | public void setRole(String[] role) { 13 | this.role = role; 14 | } 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name; 22 | } 23 | 24 | public String getAvatar() { 25 | return avatar; 26 | } 27 | 28 | public void setAvatar(String avatar) { 29 | this.avatar = avatar; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/web/spa/user/pojo/UserLogin.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.web.spa.user.pojo; 2 | 3 | public class UserLogin { 4 | public String username; 5 | public String password; 6 | 7 | public String getUsername() { 8 | return username; 9 | } 10 | 11 | public void setUsername(String username) { 12 | this.username = username; 13 | } 14 | 15 | public String getPassword() { 16 | return password; 17 | } 18 | 19 | public void setPassword(String password) { 20 | this.password = password; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/java/cc/bitky/clusterdeviceplatform/demo/web/spa/utils/ResMsg.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo.web.spa.utils; 2 | 3 | public class ResMsg { 4 | 5 | int code = 20000; 6 | 7 | Object data = null; 8 | 9 | public ResMsg(Object data) { 10 | this.data = data; 11 | } 12 | 13 | public int getCode() { 14 | return code; 15 | } 16 | 17 | public Object getData() { 18 | return data; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8081 -------------------------------------------------------------------------------- /clusterdeviceplatform-demo/src/test/java/cc/bitky/clusterdeviceplatform/demo/DemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package cc.bitky.clusterdeviceplatform.demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class DemoApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /mdphoto/main11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/mdphoto/main11.jpg -------------------------------------------------------------------------------- /mdphoto/main12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/mdphoto/main12.jpg -------------------------------------------------------------------------------- /mdphoto/main13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/mdphoto/main13.jpg -------------------------------------------------------------------------------- /mdphoto/main19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/mdphoto/main19.png -------------------------------------------------------------------------------- /mdphoto/main20.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/mdphoto/main20.jpg -------------------------------------------------------------------------------- /mdphoto/main21.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/mdphoto/main21.jpg -------------------------------------------------------------------------------- /mdphoto/main22.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitkylin/ClusterDeviceControlPlatform/00bfcd8a81d4fa227e705a72692c31aea39fdaac/mdphoto/main22.jpg -------------------------------------------------------------------------------- /script/README.md: -------------------------------------------------------------------------------- 1 | # 项目相关脚本 2 | 3 | ## 1. createTestData 在数据库中生成测试数据 4 | 「Python」在数据库中添加设备及相应设备的工作人员。 5 | 6 | ## 2. buildProject 工程整体清理、构建、打包、发布 7 | 「Shell」集群设备管理系统工程的web端、模拟客户端、服务器端等的整体清理、构建、打包、发布脚本,一键傻瓜式执行。 8 | 9 | ## 3. createHistoryStatus 历史状态记录生成工具 10 | 「Python」生成每个设备的工作状态历史纪录。 -------------------------------------------------------------------------------- /script/buildProject/.gitignore: -------------------------------------------------------------------------------- 1 | template/ -------------------------------------------------------------------------------- /script/buildProject/script-template/client-template: -------------------------------------------------------------------------------- 1 | chcp 65001 2 | java -jar -'Dfile.encoding'=UTF-8 .\{clientName} localhost 100 3 | $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") 4 | -------------------------------------------------------------------------------- /script/buildProject/script-template/server-template: -------------------------------------------------------------------------------- 1 | chcp 65001 2 | java -jar -'Dfile.encoding'=UTF-8 .\{serverName} 3 | $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") 4 | -------------------------------------------------------------------------------- /script/buildProject/template/setting: -------------------------------------------------------------------------------- 1 | { 2 | "通道未响应时间": 300, 3 | "通道无响应监测": true, 4 | "帧送达监测": true, 5 | "调试模式": true, 6 | "随机Web数据模式": false, 7 | "数据库认证模式": false, 8 | "员工默认卡号": "0", 9 | "员工默认姓名": "备用", 10 | "员工默认部门": "默认单位", 11 | "部署剩余充电次数阈值": 20, 12 | "帧发送间隔": 200, 13 | "检错重发最大重复次数": 5, 14 | "服务器端口号": 30232, 15 | "数据库服务器的主机名或IP": "localhost", 16 | "数据库用户名": "admin", 17 | "数据库密码": "admin", 18 | "授权码": "" 19 | } -------------------------------------------------------------------------------- /script/createHistoryStatus/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.pythonPath": "${workspaceFolder}\\venv\\Scripts\\python.exe" 3 | } -------------------------------------------------------------------------------- /script/createHistoryStatus/main.py: -------------------------------------------------------------------------------- 1 | from utils import device_create 2 | from utils.history_item import HistoryItem 3 | from datetime import datetime 4 | 5 | db = device_create.get_creator("202.193.57.44", "bitkyTest") 6 | LampStatusHistory = db.LampStatusHistory 7 | LampStatusHistory.drop() 8 | device_list = [] 9 | employees = db.Employee.find() 10 | print('共需执行次数:' + str(employees.count())) 11 | print('开始执行...') 12 | i = 1 13 | for employee in employees: 14 | # if i % 100 == 0: 15 | print('正在执行第' + str(i) + '次') 16 | i += 1 17 | hisItem = {'_id': employee['_id']} 18 | hisInit = HistoryItem(datetime(2015, 4, 19), 3650) 19 | hisItem['ChargeStatus'] = hisInit.ChargeStatus 20 | hisItem['WorkStatus'] = hisInit.WorkStatus 21 | device_list.append(hisItem) 22 | print('正在向数据库写入数据...') 23 | result = LampStatusHistory.insert_many(device_list) 24 | print('写入完毕') 25 | pass 26 | -------------------------------------------------------------------------------- /script/createHistoryStatus/utils/device_create.py: -------------------------------------------------------------------------------- 1 | from pymongo import MongoClient 2 | import socket 3 | 4 | 5 | def get_creator(hostname, database): 6 | """根据已有的IP地址及端口号创建 MongoDB 客户端""" 7 | client = MongoClient(socket.gethostbyname(hostname), 27017) 8 | return client[database] 9 | -------------------------------------------------------------------------------- /script/createHistoryStatus/utils/history_item.py: -------------------------------------------------------------------------------- 1 | from datetime import timedelta 2 | import random 3 | 4 | 5 | def gen_charge(i, start): 6 | return {'Time': (start + timedelta(days=i // 3) 7 | + timedelta(hours=random.randint(1, 8)) 8 | + timedelta(minutes=random.randint(0, 59)) 9 | + timedelta(seconds=random.randint(0, 59))), 10 | 'Status': random.randint(1, 3)} 11 | 12 | 13 | def gen_work(i, start): 14 | return {'Time': (start + timedelta(days=i // 3) 15 | + timedelta(hours=random.randint(0, 8)) 16 | + timedelta(minutes=random.randint(0, 59)) 17 | + timedelta(seconds=random.randint(0, 59))), 18 | 'Status': random.randint(1, 10)} 19 | 20 | 21 | class HistoryItem: 22 | def __init__(self, start, count): 23 | self.ChargeStatus = [gen_charge(i, start + timedelta(hours=i % 3 * 8)) for i in range(0, count * 3)] 24 | self.WorkStatus = [gen_work(i, start + timedelta(hours=i % 3 * 8)) for i in range(0, count * 3)] 25 | -------------------------------------------------------------------------------- /script/createTestData/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.formatting.provider": "yapf" 3 | } -------------------------------------------------------------------------------- /script/createTestData/main.py: -------------------------------------------------------------------------------- 1 | from utils import device_create 2 | from utils import namecreater 3 | from datetime import datetime 4 | import random 5 | 6 | db = device_create.get_creator("202.193.56.205", "bitkyTest") 7 | device = db.Device 8 | employee = db.Employee 9 | device.drop() 10 | employee.drop() 11 | 12 | # 生成并插入 device 集合 13 | result = device.insert_many( 14 | [{'GroupId': group_id, 15 | 'DeviceId': device_id, 16 | 'ChargeStatus': 0, 17 | 'WorkStatus': 0, 18 | 'ChargeStatusTime': datetime.utcnow(), 19 | 'WorkStatusTime': datetime.utcnow(), 20 | 'RemainChargeTime': 500, 21 | 'CardNumber': hex(random.randint(1, 0xFFFFFFFF))[2:]} 22 | for group_id in range(1, 101) 23 | for device_id in range(1, 101)]) 24 | 25 | # 从数据库中获取到 device 集合 26 | device_list = [device.find_one({'_id': device_id}) for device_id in result.inserted_ids] 27 | 28 | # 插入完整的 employee 并更新为完整的 device 29 | for device_item in device_list: 30 | employee_item = namecreater.random_employee_from_device(device_item) 31 | employee_item_result = employee.insert_one(employee_item) 32 | device.update_one(device_item, {'$set': {'EmployeeObjectId': str(employee_item_result.inserted_id)}}) 33 | -------------------------------------------------------------------------------- /script/createTestData/utils/device_create.py: -------------------------------------------------------------------------------- 1 | from pymongo import MongoClient 2 | import socket 3 | 4 | 5 | def get_creator(hostname, database): 6 | """根据已有的IP地址及端口号创建 MongoDB 客户端""" 7 | client = MongoClient(socket.gethostbyname(hostname), 27017) 8 | return client[database] 9 | --------------------------------------------------------------------------------