├── .gitignore ├── README.md └── springboot ├── .gitignore ├── README.md ├── pom.xml ├── webVueBlog-admin ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── webVueBlog │ │ ├── DaApplication.java │ │ ├── DaServletInitializer.java │ │ └── web │ │ ├── controller │ │ ├── common │ │ │ ├── CaptchaController.java │ │ │ └── CommonController.java │ │ ├── monitor │ │ │ ├── CacheController.java │ │ │ ├── ServerController.java │ │ │ ├── SysLogininforController.java │ │ │ ├── SysOperlogController.java │ │ │ └── SysUserOnlineController.java │ │ ├── system │ │ │ ├── SysConfigController.java │ │ │ ├── SysDeptController.java │ │ │ ├── SysDictDataController.java │ │ │ ├── SysDictTypeController.java │ │ │ ├── SysIndexController.java │ │ │ ├── SysLoginController.java │ │ │ ├── SysMenuController.java │ │ │ ├── SysNoticeController.java │ │ │ ├── SysPostController.java │ │ │ ├── SysProfileController.java │ │ │ ├── SysRegisterController.java │ │ │ ├── SysRoleController.java │ │ │ └── SysUserController.java │ │ └── tool │ │ │ ├── SwaggerController.java │ │ │ ├── TestController.java │ │ │ └── TestController2.java │ │ └── core │ │ └── config │ │ └── SwaggerConfig.java │ └── resources │ ├── META-INF │ └── spring-devtools.properties │ ├── application.yml │ ├── banner.txt │ └── mybatis │ └── mybatis-config.xml ├── webVueBlog-common ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── webVueBlog │ └── common │ ├── annotation │ ├── Anonymous.java │ ├── DataScope.java │ ├── DataSource.java │ ├── DictFormat.java │ ├── Excel.java │ ├── Excels.java │ ├── Log.java │ ├── RateLimiter.java │ ├── RepeatSubmit.java │ └── SysProtocol.java │ ├── config │ ├── DaConfig.java │ └── DeviceTask.java │ ├── constant │ ├── CacheConstants.java │ ├── Constants.java │ ├── DaConstant.java │ ├── GenConstants.java │ ├── HttpStatus.java │ ├── ProductAuthConstant.java │ ├── ScheduleConstants.java │ ├── SipConstants.java │ └── UserConstants.java │ ├── core │ ├── controller │ │ └── BaseController.java │ ├── domain │ │ ├── AjaxResult.java │ │ ├── BaseDO.java │ │ ├── BaseEntity.java │ │ ├── CommonResult.java │ │ ├── PageParam.java │ │ ├── PageResult.java │ │ ├── R.java │ │ ├── SortingField.java │ │ ├── TenantBaseDO.java │ │ ├── TreeEntity.java │ │ ├── TreeSelect.java │ │ ├── entity │ │ │ ├── SysDept.java │ │ │ ├── SysDictData.java │ │ │ ├── SysDictType.java │ │ │ ├── SysMenu.java │ │ │ ├── SysRole.java │ │ │ └── SysUser.java │ │ └── model │ │ │ ├── BindLoginBody.java │ │ │ ├── BindRegisterBody.java │ │ │ ├── LoginBody.java │ │ │ ├── LoginUser.java │ │ │ └── RegisterBody.java │ ├── iot │ │ └── response │ │ │ ├── DashDeviceTotalDto.java │ │ │ ├── DeCodeBo.java │ │ │ └── IdentityAndName.java │ ├── mq │ │ ├── DeviceReplyBo.java │ │ ├── DeviceReport.java │ │ ├── DeviceReportBo.java │ │ ├── DeviceStatusBo.java │ │ ├── InvokeReqDto.java │ │ ├── MQSendMessageBo.java │ │ ├── MessageReplyBo.java │ │ ├── message │ │ │ ├── DeviceData.java │ │ │ ├── DeviceDownMessage.java │ │ │ ├── DeviceFunctionMessage.java │ │ │ ├── DeviceMessage.java │ │ │ ├── InstructionsMessage.java │ │ │ ├── MqttBo.java │ │ │ ├── PropRead.java │ │ │ ├── ProtocolDto.java │ │ │ └── SubDeviceMessage.java │ │ └── ota │ │ │ ├── OtaReplyMessage.java │ │ │ ├── OtaUpgradeBo.java │ │ │ └── OtaUpgradeDelayTask.java │ ├── page │ │ ├── PageDomain.java │ │ ├── TableDataInfo.java │ │ └── TableSupport.java │ ├── protocol │ │ ├── Message.java │ │ └── modbus │ │ │ └── ModbusCode.java │ ├── redis │ │ ├── RedisCache.java │ │ ├── RedisKeyBuilder.java │ │ ├── RedisKeyDefine.java │ │ └── RedisKeyRegistry.java │ ├── text │ │ ├── CharsetKit.java │ │ ├── Convert.java │ │ ├── IntArrayValuable.java │ │ ├── KeyValue.java │ │ └── StrFormatter.java │ └── thingsModel │ │ ├── NeuronModel.java │ │ ├── ThingsModelSimpleItem.java │ │ └── ThingsModelValuesInput.java │ ├── enums │ ├── BusinessStatus.java │ ├── BusinessType.java │ ├── CommonStatusEnum.java │ ├── DataEnum.java │ ├── DataSourceType.java │ ├── DeviceStatus.java │ ├── ExceptionCode.java │ ├── FunctionReplyStatus.java │ ├── GlobalErrorCodeConstants.java │ ├── HttpMethod.java │ ├── IErrorCode.java │ ├── LimitType.java │ ├── ModbusDataType.java │ ├── OTAUpgrade.java │ ├── OperatorType.java │ ├── ResultCode.java │ ├── ServerType.java │ ├── SocialPlatformType.java │ ├── ThingsModelType.java │ ├── TopicType.java │ ├── UserStatus.java │ └── VerifyTypeEnum.java │ ├── exception │ ├── DemoModeException.java │ ├── ErrorCode.java │ ├── GlobalException.java │ ├── ServerException.java │ ├── ServiceException.java │ ├── ServiceExceptionUtil.java │ ├── UtilException.java │ ├── base │ │ └── BaseException.java │ ├── file │ │ ├── FileException.java │ │ ├── FileNameLengthLimitExceededException.java │ │ ├── FileSizeLimitExceededException.java │ │ └── InvalidExtensionException.java │ ├── iot │ │ ├── MqttAuthorizationException.java │ │ └── MqttClientUserNameOrPassException.java │ ├── job │ │ └── TaskException.java │ └── user │ │ ├── CaptchaException.java │ │ ├── CaptchaExpireException.java │ │ ├── UserException.java │ │ ├── UserPasswordNotMatchException.java │ │ └── UserPasswordRetryLimitExceedException.java │ ├── filter │ ├── PropertyPreExcludeFilter.java │ ├── RepeatableFilter.java │ ├── RepeatedlyRequestWrapper.java │ ├── XssFilter.java │ └── XssHttpServletRequestWrapper.java │ ├── utils │ ├── Arith.java │ ├── BeanMapUtilByReflect.java │ ├── CaculateUtils.java │ ├── DateUtils.java │ ├── DictUtils.java │ ├── DigestUtils.java │ ├── EncodeUtils.java │ ├── ExceptionUtil.java │ ├── ExceptionUtils.java │ ├── LogUtils.java │ ├── MapUtils.java │ ├── Md5Utils.java │ ├── MessageUtils.java │ ├── PageUtils.java │ ├── SecurityUtils.java │ ├── ServletUtils.java │ ├── StringUtils.java │ ├── Threads.java │ ├── ValidationUtils.java │ ├── VerifyCodeUtils.java │ ├── bean │ │ ├── BeanUtils.java │ │ └── BeanValidators.java │ ├── collection │ │ └── CollectionUtils.java │ ├── date │ │ ├── DateUtils.java │ │ └── LocalDateTimeUtils.java │ ├── file │ │ ├── FileTypeUtils.java │ │ ├── FileUploadUtils.java │ │ ├── FileUtils.java │ │ ├── ImageUtils.java │ │ └── MimeTypeUtils.java │ ├── gateway │ │ ├── CRC16Utils.java │ │ ├── CRC8Utils.java │ │ ├── mq │ │ │ ├── Topics.java │ │ │ ├── TopicsPost.java │ │ │ └── TopicsUtils.java │ │ └── protocol │ │ │ ├── ByteUtils.java │ │ │ └── NettyUtils.java │ ├── html │ │ ├── EscapeUtil.java │ │ └── HTMLFilter.java │ ├── http │ │ ├── HttpHelper.java │ │ └── HttpUtils.java │ ├── ip │ │ ├── AddressUtils.java │ │ └── IpUtils.java │ ├── json │ │ └── JsonUtils.java │ ├── object │ │ └── ObjectUtils.java │ ├── poi │ │ ├── ExcelHandlerAdapter.java │ │ └── ExcelUtil.java │ ├── reflect │ │ └── ReflectUtils.java │ ├── sign │ │ ├── Base64.java │ │ └── Md5Utils.java │ ├── spring │ │ └── SpringUtils.java │ ├── sql │ │ └── SqlUtil.java │ └── uuid │ │ ├── IdUtils.java │ │ ├── Seq.java │ │ └── UUID.java │ ├── wechat │ ├── WeChatAppResult.java │ ├── WeChatLoginBody.java │ ├── WeChatLoginResult.java │ ├── WeChatMiniProgramResult.java │ ├── WeChatPhoneInfo.java │ └── WeChatUserInfo.java │ └── xss │ ├── Xss.java │ └── XssValidator.java ├── webVueBlog-framework ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── webVueBlog │ └── framework │ ├── aspectj │ ├── DataScopeAspect.java │ ├── DataSourceAspect.java │ ├── LogAspect.java │ └── RateLimiterAspect.java │ ├── config │ ├── ApplicationConfig.java │ ├── CaptchaConfig.java │ ├── DruidConfig.java │ ├── FastJson2JsonRedisSerializer.java │ ├── FilterConfig.java │ ├── KaptchaTextCreator.java │ ├── MyBatisConfig.java │ ├── RedisConfig.java │ ├── ResourcesConfig.java │ ├── SecurityConfig.java │ ├── ServerConfig.java │ ├── ThreadPoolConfig.java │ └── properties │ │ ├── DruidProperties.java │ │ └── PermitAllUrlProperties.java │ ├── datasource │ ├── DynamicDataSource.java │ └── DynamicDataSourceContextHolder.java │ ├── interceptor │ ├── RepeatSubmitInterceptor.java │ └── impl │ │ └── SameUrlDataInterceptor.java │ ├── manager │ ├── AsyncManager.java │ ├── ShutdownManager.java │ └── factory │ │ └── AsyncFactory.java │ ├── mybatis │ ├── LambdaQueryWrapperX.java │ ├── QueryWrapperX.java │ ├── mapper │ │ └── BaseMapperX.java │ └── utils │ │ └── MyBatisUtils.java │ ├── security │ ├── context │ │ ├── AuthenticationContextHolder.java │ │ └── PermissionContextHolder.java │ ├── filter │ │ └── JwtAuthenticationTokenFilter.java │ └── handle │ │ ├── AuthenticationEntryPointImpl.java │ │ └── LogoutSuccessHandlerImpl.java │ └── web │ ├── domain │ ├── Server.java │ └── server │ │ ├── Cpu.java │ │ ├── Jvm.java │ │ ├── Mem.java │ │ ├── Sys.java │ │ └── SysFile.java │ ├── exception │ └── GlobalExceptionHandler.java │ └── service │ ├── PermissionService.java │ ├── SysLoginService.java │ ├── SysPasswordService.java │ ├── SysPermissionService.java │ ├── SysRegisterService.java │ ├── TokenService.java │ └── UserDetailsServiceImpl.java ├── webVueBlog-gateway ├── gateway-boot │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── webVueBlog │ │ └── gateway │ │ └── boot │ │ └── start │ │ └── StartBoot.java ├── pom.xml └── webVueBlog-mq │ ├── pom.xml │ └── src │ └── main │ └── java │ └── com │ └── webVueBlog │ └── mq │ ├── config │ └── MqConfig.java │ ├── model │ └── ReportDataBo.java │ ├── mqttClient │ ├── MqttClientConfig.java │ ├── MqttService.java │ ├── PubMqttCallBack.java │ └── PubMqttClient.java │ ├── redischannel │ ├── config │ │ └── RedisConsumeConfig.java │ ├── consumer │ │ ├── DeviceOtherMsgConsumer.java │ │ ├── DevicePropFetchConsumer.java │ │ ├── DeviceReplyMsgConsumer.java │ │ ├── DeviceReportMsgConsumer.java │ │ ├── DeviceStatusConsumer.java │ │ ├── FunctionInvokeConsumer.java │ │ └── RedisChannelConsume.java │ ├── listen │ │ ├── DeviceOtherListen.java │ │ ├── DevicePropFetchListen.java │ │ ├── DeviceReplyListen.java │ │ ├── DeviceReportListen.java │ │ ├── DeviceStatusListen.java │ │ ├── FunctionInvokeListen.java │ │ └── UpgradeListen.java │ ├── producer │ │ └── MessageProducer.java │ ├── queue │ │ ├── DeviceOtherQueue.java │ │ ├── DevicePropFetchQueue.java │ │ ├── DeviceReplyQueue.java │ │ ├── DeviceReportQueue.java │ │ ├── DeviceStatusQueue.java │ │ ├── FunctionInvokeQueue.java │ │ └── OtaUpgradeQueue.java │ └── service │ │ └── RedisPublishServiceImpl.java │ └── service │ ├── IDataHandler.java │ ├── IDeviceReportMessageService.java │ ├── IFunctionInvoke.java │ ├── IMessagePublishService.java │ ├── IMqttMessagePublish.java │ └── impl │ ├── DeviceOtherMsgHandler.java │ ├── FunctionInvokeImpl.java │ └── MessageManager.java ├── webVueBlog-open-api ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── webVueBlog │ └── data │ ├── config │ ├── DelayUpgradeQueue.java │ └── TaskConfig.java │ ├── controller │ ├── AuthResourceController.java │ ├── CategoryController.java │ ├── DeviceController.java │ ├── DeviceJobController.java │ ├── DeviceLogController.java │ ├── DeviceUserController.java │ ├── EventLogController.java │ ├── FunctionLogController.java │ ├── GroupController.java │ ├── NewsCategoryController.java │ ├── NewsController.java │ ├── OauthClientDetailsController.java │ ├── ProductAuthorizeController.java │ ├── ProductController.java │ ├── SocialLoginController.java │ ├── SocialPlatformController.java │ ├── ThingsModelController.java │ ├── ThingsModelTemplateController.java │ ├── ToolController.java │ ├── UserSocialController.java │ ├── dashBoard │ │ └── DashBoardController.java │ ├── netty │ │ └── NettyManagerController.java │ ├── protocol │ │ └── ProtocolController.java │ ├── runtime │ │ └── DeviceRuntimeController.java │ └── wechat │ │ └── WeChatController.java │ ├── quartz │ ├── AbstractQuartzJob.java │ ├── CronUtils.java │ ├── JobInvokeUtil.java │ ├── QuartzDisallowConcurrentExecution.java │ ├── QuartzJobExecution.java │ └── ScheduleUtils.java │ └── service │ ├── IPropGetService.java │ └── impl │ ├── DeviceJob.java │ ├── DeviceJobServiceImpl.java │ └── PropGetServiceImpl.java ├── webVueBlog-plugs ├── pom.xml ├── webVueBlog-generator │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── webVueBlog │ │ │ └── generator │ │ │ ├── config │ │ │ └── GenConfig.java │ │ │ ├── controller │ │ │ └── GenController.java │ │ │ ├── domain │ │ │ ├── GenTable.java │ │ │ └── GenTableColumn.java │ │ │ ├── mapper │ │ │ ├── GenTableColumnMapper.java │ │ │ └── GenTableMapper.java │ │ │ ├── service │ │ │ ├── GenTableColumnServiceImpl.java │ │ │ ├── GenTableServiceImpl.java │ │ │ ├── IGenTableColumnService.java │ │ │ └── IGenTableService.java │ │ │ └── util │ │ │ ├── GenUtils.java │ │ │ ├── VelocityInitializer.java │ │ │ └── VelocityUtils.java │ │ └── resources │ │ ├── generator.yml │ │ └── mapper │ │ └── generator │ │ ├── GenTableColumnMapper.xml │ │ └── GenTableMapper.xml └── webVueBlog-quartz │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── com │ │ └── webVueBlog │ │ └── quartz │ │ ├── config │ │ └── ScheduleConfig.java │ │ ├── controller │ │ ├── SysJobController.java │ │ └── SysJobLogController.java │ │ ├── domain │ │ ├── SysJob.java │ │ └── SysJobLog.java │ │ ├── mapper │ │ ├── SysJobLogMapper.java │ │ └── SysJobMapper.java │ │ ├── service │ │ ├── ISysJobLogService.java │ │ ├── ISysJobService.java │ │ └── impl │ │ │ ├── SysJobLogServiceImpl.java │ │ │ └── SysJobServiceImpl.java │ │ ├── task │ │ └── RyTask.java │ │ └── util │ │ ├── AbstractQuartzJob.java │ │ ├── CronUtils.java │ │ ├── JobInvokeUtil.java │ │ ├── QuartzDisallowConcurrentExecution.java │ │ ├── QuartzJobExecution.java │ │ └── ScheduleUtils.java │ └── resources │ └── mapper │ └── quartz │ ├── SysJobLogMapper.xml │ └── SysJobMapper.xml ├── webVueBlog-protocol ├── pom.xml ├── webVueBlog-protocol-base │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── webVueBlog │ │ └── protocol │ │ ├── PrepareLoadStore.java │ │ ├── ProtocolLoadUtils.java │ │ ├── WModelManager.java │ │ ├── base │ │ ├── annotation │ │ │ ├── Column.java │ │ │ ├── Columns.java │ │ │ ├── MergeSubClass.java │ │ │ └── Protocol.java │ │ ├── message │ │ │ ├── MessageBody.java │ │ │ └── MessageHead.java │ │ ├── model │ │ │ ├── ActiveModel.java │ │ │ ├── ArrayModel.java │ │ │ ├── BufferModel.java │ │ │ ├── DateTimeModel.java │ │ │ ├── MapModel.java │ │ │ ├── ModelRegistry.java │ │ │ ├── NumberModel.java │ │ │ ├── NumberPModel.java │ │ │ ├── StringModel.java │ │ │ └── WModel.java │ │ ├── protocol │ │ │ └── IProtocol.java │ │ └── struc │ │ │ ├── BaseStructure.java │ │ │ ├── CollectionStructure.java │ │ │ ├── LengthStructure.java │ │ │ ├── LengthUnitCollectionStructure.java │ │ │ ├── LengthUnitStructure.java │ │ │ ├── MapStructure.java │ │ │ ├── TotalArrayObjectStructure.java │ │ │ ├── TotalArrayPrimitiveStructure.java │ │ │ ├── TotalCollectionStructure.java │ │ │ └── TotalMapStructure.java │ │ ├── domain │ │ └── DeviceProtocol.java │ │ ├── enums │ │ ├── IModbusRtu.java │ │ ├── ModbusBitStatus.java │ │ ├── ModbusCoilStatus.java │ │ └── ModbusErrCode.java │ │ ├── service │ │ ├── IProtocolManagerService.java │ │ └── impl │ │ │ └── ProtocolManagerServiceImpl.java │ │ └── util │ │ ├── ArrayMap.java │ │ ├── Cache.java │ │ ├── CharsBuilder.java │ │ ├── ClassUtils.java │ │ ├── DateTool.java │ │ ├── ExplainUtils.java │ │ ├── IntTool.java │ │ ├── KeyValuePair.java │ │ ├── Msg.java │ │ ├── SingleVersionUtils.java │ │ └── ToStringBuilder.java └── webVueBlog-protocol-collect │ ├── pom.xml │ └── src │ └── main │ └── java │ └── com │ └── webVueBlog │ ├── common │ ├── ProtocolColl.java │ └── ProtocolDeCodeService.java │ ├── json │ └── JsonProtocolService.java │ ├── jsonPak │ ├── JsonPakProtocolService.java │ └── pak │ │ └── JsonEndPoint.java │ ├── jsonchenyi │ └── JsonChenYiProtocolService.java │ └── modbus │ └── codec │ └── MessageAdapter.java ├── webVueBlog-server ├── base-server │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── webVueBlog │ │ └── base │ │ ├── codec │ │ ├── Delimiter.java │ │ ├── LengthField.java │ │ ├── MessageDecoder.java │ │ └── MessageEncoder.java │ │ ├── core │ │ ├── AbstractHandlerMapping.java │ │ ├── DefaultHandlerMapping.java │ │ ├── HandlerInterceptor.java │ │ ├── HandlerMapping.java │ │ ├── SpringHandlerMapping.java │ │ ├── annotation │ │ │ ├── Async.java │ │ │ ├── AsyncBatch.java │ │ │ ├── Node.java │ │ │ └── PakMapping.java │ │ ├── hanler │ │ │ ├── AsyncBatchHandler.java │ │ │ ├── BaseHandler.java │ │ │ └── SyncHandler.java │ │ └── model │ │ │ └── Response.java │ │ ├── model │ │ ├── DeviceMsg.java │ │ └── SessionKey.java │ │ ├── service │ │ ├── ISessionStore.java │ │ └── impl │ │ │ └── SessionStoreImpl.java │ │ ├── session │ │ ├── Packet.java │ │ ├── Session.java │ │ ├── SessionListener.java │ │ └── SessionManager.java │ │ └── util │ │ ├── AttributeUtils.java │ │ ├── ByteBufUtils.java │ │ ├── ClassUtils.java │ │ ├── ConcurrentStorage.java │ │ ├── DeviceUtils.java │ │ ├── Stopwatch.java │ │ ├── Storage.java │ │ └── VirtualList.java ├── boot-strap │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── webVueBlog │ │ └── bootstrap │ │ ├── mqtt │ │ └── MQTTBootStrap.java │ │ ├── tcp │ │ ├── TCPBootStrap.java │ │ └── config │ │ │ ├── ModbusBeanConfig.java │ │ │ ├── ModbusHandlerInterceptor.java │ │ │ └── ModbusSessionListener.java │ │ └── udp │ │ └── UDPBootStrap.java ├── iot-server-core │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── webVueBlog │ │ └── server │ │ ├── Server.java │ │ ├── TCPServer.java │ │ ├── UDPServer.java │ │ ├── config │ │ └── NettyConfig.java │ │ └── handler │ │ ├── DelimiterBasedFrameDecoder.java │ │ ├── DispatcherHandler.java │ │ ├── LengthFieldAndDelimiterFrameDecoder.java │ │ ├── MessageDecoderWrapper.java │ │ ├── MessageEncoderWrapper.java │ │ ├── TCPMessageAdapter.java │ │ └── UDPMessageAdapter.java ├── mqtt-broker │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── webVueBlog │ │ └── mqtt │ │ ├── annotation │ │ └── Process.java │ │ ├── auth │ │ └── AuthService.java │ │ ├── codec │ │ └── WebSocketMqttCodec.java │ │ ├── handler │ │ ├── MqttConnect.java │ │ ├── MqttDisConnect.java │ │ ├── MqttPingreq.java │ │ ├── MqttPubAck.java │ │ ├── MqttPubRec.java │ │ ├── MqttPubRel.java │ │ ├── MqttPubcomp.java │ │ ├── MqttPublish.java │ │ ├── MqttSubscribe.java │ │ ├── MqttUnsubscribe.java │ │ └── adapter │ │ │ ├── MqttHandler.java │ │ │ ├── MqttMessageAdapter.java │ │ │ └── MqttMessageDelegate.java │ │ ├── manager │ │ ├── ClientManager.java │ │ ├── MqttRemoteManager.java │ │ ├── ResponseManager.java │ │ ├── RetainMsgManager.java │ │ ├── SessionManger.java │ │ └── WillMessageManager.java │ │ ├── model │ │ ├── ClientMessage.java │ │ ├── PushMessageBo.java │ │ ├── RetainMessage.java │ │ ├── Subscribe.java │ │ └── WillMessage.java │ │ ├── server │ │ ├── MqttServer.java │ │ └── WebSocketServer.java │ │ ├── service │ │ ├── IMessageStore.java │ │ ├── ISubscriptionService.java │ │ └── impl │ │ │ ├── DataHandlerImpl.java │ │ │ ├── DeviceReportMessageServiceImpl.java │ │ │ ├── MessageStoreImpl.java │ │ │ ├── MqttMessagePublishImpl.java │ │ │ └── SubscriptionServiceImpl.java │ │ └── utils │ │ └── MqttMessageUtils.java └── pom.xml └── webVueBlog-service ├── pom.xml ├── webVueBlog-iot-service ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── webVueBlog │ │ └── iot │ │ ├── domain │ │ ├── Category.java │ │ ├── Device.java │ │ ├── DeviceGroup.java │ │ ├── DeviceJob.java │ │ ├── DeviceLog.java │ │ ├── DeviceTemplate.java │ │ ├── DeviceUser.java │ │ ├── EventLog.java │ │ ├── FunctionLog.java │ │ ├── Group.java │ │ ├── News.java │ │ ├── NewsCategory.java │ │ ├── OauthClientDetails.java │ │ ├── Product.java │ │ ├── ProductAuthorize.java │ │ ├── Protocol.java │ │ ├── SocialPlatform.java │ │ ├── SocialUser.java │ │ ├── ThingsModel.java │ │ ├── ThingsModelTemplate.java │ │ ├── UserSocialProfile.java │ │ ├── VarTemp.java │ │ └── VarTempSalve.java │ │ ├── enums │ │ └── DeviceType.java │ │ ├── mapper │ │ ├── CategoryMapper.java │ │ ├── DeviceJobMapper.java │ │ ├── DeviceLogMapper.java │ │ ├── DeviceMapper.java │ │ ├── DeviceTemplateMapper.java │ │ ├── DeviceUserMapper.java │ │ ├── EventLogMapper.java │ │ ├── FunctionLogMapper.java │ │ ├── GroupMapper.java │ │ ├── NewsCategoryMapper.java │ │ ├── NewsMapper.java │ │ ├── OauthClientDetailsMapper.java │ │ ├── ProductAuthorizeMapper.java │ │ ├── ProductMapper.java │ │ ├── ProtocolMapper.java │ │ ├── SocialPlatformMapper.java │ │ ├── SocialUserMapper.java │ │ ├── ThingsModelMapper.java │ │ ├── ThingsModelTemplateMapper.java │ │ ├── VarTempMapper.java │ │ └── VarTempSalveMapper.java │ │ ├── model │ │ ├── Action.java │ │ ├── AuthenticateInputModel.java │ │ ├── CategoryNews.java │ │ ├── ChangeProductStatusModel.java │ │ ├── DataResult.java │ │ ├── DeviceAllShortOutput.java │ │ ├── DeviceGroupInput.java │ │ ├── DeviceMqttConnectVO.java │ │ ├── DeviceMqttVO.java │ │ ├── DeviceNumberAndProductId.java │ │ ├── DeviceRelateAlertLogVO.java │ │ ├── DeviceRelateUserInput.java │ │ ├── DeviceShortOutput.java │ │ ├── DeviceStatistic.java │ │ ├── HistoryModel.java │ │ ├── IdAndName.java │ │ ├── IdOutput.java │ │ ├── ImportThingsModelInput.java │ │ ├── MonitorModel.java │ │ ├── MqttAuthenticationModel.java │ │ ├── MqttClientConnectModel.java │ │ ├── MqttInfoModel.java │ │ ├── NtpModel.java │ │ ├── ProductAuthenticateModel.java │ │ ├── ProductAuthorizeVO.java │ │ ├── ProductCode.java │ │ ├── RegisterUserInput.java │ │ ├── RegisterUserOutput.java │ │ ├── Specs.java │ │ ├── ThingsModelItem │ │ │ ├── ArrayModelOutput.java │ │ │ ├── BoolModelOutput.java │ │ │ ├── Datatype.java │ │ │ ├── DecimalModelOutput.java │ │ │ ├── EnumItem.java │ │ │ ├── EnumItemOutput.java │ │ │ ├── EnumModelOutput.java │ │ │ ├── IntegerModelOutput.java │ │ │ ├── ReadOnlyModelOutput.java │ │ │ ├── StringModelOutput.java │ │ │ ├── ThingsModel.java │ │ │ └── ThingsModelItemBase.java │ │ ├── ThingsModelPerm.java │ │ ├── ThingsModels │ │ │ ├── EventDto.java │ │ │ ├── FunctionDto.java │ │ │ ├── PropertyDto.java │ │ │ ├── ThingsItems.java │ │ │ ├── ThingsModelShadow.java │ │ │ ├── ThingsModelValueItem.java │ │ │ ├── ThingsModelValueItemDto.java │ │ │ ├── ThingsModelValuesOutput.java │ │ │ ├── ThingsModelsDto.java │ │ │ └── ValueItem.java │ │ ├── TriggerParameter.java │ │ ├── UserIdDeviceIdModel.java │ │ ├── dashBoard │ │ │ ├── DashMqttMetrics.java │ │ │ └── DashMqttStat.java │ │ ├── dto │ │ │ └── DeviceRtDto.java │ │ ├── login │ │ │ ├── AuthRequestWrap.java │ │ │ ├── BindIdValue.java │ │ │ ├── LoginIdValue.java │ │ │ └── WeChatLoginQrRes.java │ │ └── varTemp │ │ │ ├── DeviceSlavePoint.java │ │ │ ├── DeviceTemp.java │ │ │ ├── EnumClass.java │ │ │ ├── SlaveIdAndId.java │ │ │ └── SyncModel.java │ │ ├── oauth │ │ ├── AuthorizationServerConfig.java │ │ ├── ResourceServerConfig.java │ │ ├── SpeakerApprovalHandler.java │ │ └── api │ │ │ ├── ConfirmAccessController.java │ │ │ ├── LoginController.java │ │ │ └── SpeakerController.java │ │ ├── service │ │ ├── IAuthRequestFactory.java │ │ ├── ICategoryService.java │ │ ├── IDeviceJobService.java │ │ ├── IDeviceLogService.java │ │ ├── IDeviceRuntimeService.java │ │ ├── IDeviceService.java │ │ ├── IDeviceTemplateService.java │ │ ├── IDeviceUserService.java │ │ ├── IEventLogService.java │ │ ├── IFunctionLogService.java │ │ ├── IGroupService.java │ │ ├── INewsCategoryService.java │ │ ├── INewsService.java │ │ ├── IOauthClientDetailsService.java │ │ ├── IProductAuthorizeService.java │ │ ├── IProductService.java │ │ ├── IProtocolService.java │ │ ├── ISocialLoginService.java │ │ ├── ISocialPlatformService.java │ │ ├── ISocialUserService.java │ │ ├── IThingsModelService.java │ │ ├── IThingsModelTemplateService.java │ │ ├── IToolService.java │ │ ├── IUserSocialProfileService.java │ │ ├── IVarTempSalveService.java │ │ ├── IVarTempService.java │ │ ├── cache │ │ │ ├── IDeviceCache.java │ │ │ ├── IFirmwareCache.java │ │ │ └── impl │ │ │ │ ├── DeviceCacheImpl.java │ │ │ │ └── FirmwareCacheImpl.java │ │ └── impl │ │ │ ├── AuthRequestFactoryImpl.java │ │ │ ├── AuthStateRedisCache.java │ │ │ ├── CategoryServiceImpl.java │ │ │ ├── DeviceLogServiceImpl.java │ │ │ ├── DeviceRuntimeServiceImpl.java │ │ │ ├── DeviceServiceImpl.java │ │ │ ├── DeviceTemplateServiceImpl.java │ │ │ ├── DeviceUserServiceImpl.java │ │ │ ├── EventLogServiceImpl.java │ │ │ ├── FunctionLogServiceImpl.java │ │ │ ├── GroupServiceImpl.java │ │ │ ├── NewsCategoryServiceImpl.java │ │ │ ├── NewsServiceImpl.java │ │ │ ├── OauthClientDetailsServiceImpl.java │ │ │ ├── ProductAuthorizeServiceImpl.java │ │ │ ├── ProductServiceImpl.java │ │ │ ├── ProtocolServiceImpl.java │ │ │ ├── SocialLoginServiceImpl.java │ │ │ ├── SocialPlatformServiceImpl.java │ │ │ ├── SocialUserServiceImpl.java │ │ │ ├── ThingsModelServiceImpl.java │ │ │ ├── ThingsModelTemplateServiceImpl.java │ │ │ ├── ToolServiceImpl.java │ │ │ ├── UserSocialProfileServiceImpl.java │ │ │ ├── VarTempSalveServiceImpl.java │ │ │ └── VarTempServiceImpl.java │ │ ├── tdengine │ │ ├── config │ │ │ └── TDengineConfig.java │ │ ├── dao │ │ │ └── TDDeviceLogDAO.java │ │ ├── init │ │ │ └── ApplicationStarted.java │ │ └── service │ │ │ ├── ILogService.java │ │ │ ├── factory │ │ │ └── LogServiceFactory.java │ │ │ ├── impl │ │ │ ├── MySqlLogServiceImpl.java │ │ │ └── TdengineLogServiceImpl.java │ │ │ └── model │ │ │ └── TdLogDto.java │ │ ├── util │ │ ├── AESUtils.java │ │ ├── SnowflakeIdWorker.java │ │ ├── VelocityInitializer.java │ │ └── VelocityUtils.java │ │ └── wechat │ │ ├── WeChatService.java │ │ ├── impl │ │ └── WeChatServiceImpl.java │ │ └── vo │ │ ├── WxBindReqVO.java │ │ └── WxCancelBindReqVO.java │ └── resources │ ├── mapper │ ├── iot │ │ ├── CategoryMapper.xml │ │ ├── DeviceJobMapper.xml │ │ ├── DeviceLogMapper.xml │ │ ├── DeviceMapper.xml │ │ ├── DeviceTemplateMapper.xml │ │ ├── DeviceUserMapper.xml │ │ ├── EventLogMapper.xml │ │ ├── FunctionLogMapper.xml │ │ ├── GroupMapper.xml │ │ ├── NewsCategoryMapper.xml │ │ ├── NewsMapper.xml │ │ ├── OauthClientDetailsMapper.xml │ │ ├── ProductAuthorizeMapper.xml │ │ ├── ProductMapper.xml │ │ ├── ProtocolMapper.xml │ │ ├── SocialPlatformMapper.xml │ │ ├── SocialUserMapper.xml │ │ ├── ThingsModelMapper.xml │ │ ├── ThingsModelTemplateMapper.xml │ │ ├── VarTempMapper.xml │ │ └── VarTempSalveMapper.xml │ └── tdengine │ │ └── TDDeviceLogMapper.xml │ ├── static │ └── oauth │ │ ├── css │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap-theme.min.css.map │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ │ └── js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ └── npm.js │ ├── templates │ └── oauth │ │ ├── access_confirmation.html │ │ ├── clientDetails.html │ │ ├── index.html │ │ └── login.html │ └── vm │ ├── java │ ├── controller.java.vm │ ├── domain.java.vm │ ├── mapper.java.vm │ ├── service.java.vm │ ├── serviceImpl.java.vm │ └── sub-domain.java.vm │ ├── js │ └── api.js.vm │ ├── sql │ └── sql.vm │ ├── vue │ ├── index-tree.vue.vm │ └── index.vue.vm │ └── xml │ └── mapper.xml.vm └── webVueBlog-system-service ├── pom.xml └── src └── main ├── java └── com │ └── webVueBlog │ └── system │ ├── domain │ ├── SysCache.java │ ├── SysConfig.java │ ├── SysLogininfor.java │ ├── SysNotice.java │ ├── SysOperLog.java │ ├── SysPost.java │ ├── SysRoleDept.java │ ├── SysRoleMenu.java │ ├── SysUserOnline.java │ ├── SysUserPost.java │ ├── SysUserRole.java │ └── vo │ │ ├── MetaVo.java │ │ └── RouterVo.java │ ├── mapper │ ├── SysConfigMapper.java │ ├── SysDeptMapper.java │ ├── SysDictDataMapper.java │ ├── SysDictTypeMapper.java │ ├── SysLogininforMapper.java │ ├── SysMenuMapper.java │ ├── SysNoticeMapper.java │ ├── SysOperLogMapper.java │ ├── SysPostMapper.java │ ├── SysRoleDeptMapper.java │ ├── SysRoleMapper.java │ ├── SysRoleMenuMapper.java │ ├── SysUserMapper.java │ ├── SysUserPostMapper.java │ └── SysUserRoleMapper.java │ └── service │ ├── ISysConfigService.java │ ├── ISysDeptService.java │ ├── ISysDictDataService.java │ ├── ISysDictTypeService.java │ ├── ISysLogininforService.java │ ├── ISysMenuService.java │ ├── ISysNoticeService.java │ ├── ISysOperLogService.java │ ├── ISysPostService.java │ ├── ISysRoleService.java │ ├── ISysUserOnlineService.java │ ├── ISysUserService.java │ └── impl │ ├── SysConfigServiceImpl.java │ ├── SysDeptServiceImpl.java │ ├── SysDictDataServiceImpl.java │ ├── SysDictTypeServiceImpl.java │ ├── SysLogininforServiceImpl.java │ ├── SysMenuServiceImpl.java │ ├── SysNoticeServiceImpl.java │ ├── SysOperLogServiceImpl.java │ ├── SysPostServiceImpl.java │ ├── SysRoleServiceImpl.java │ ├── SysUserOnlineServiceImpl.java │ └── SysUserServiceImpl.java └── resources └── mapper └── system ├── SysConfigMapper.xml ├── SysDeptMapper.xml ├── SysDictDataMapper.xml ├── SysDictTypeMapper.xml ├── SysLogininforMapper.xml ├── SysMenuMapper.xml ├── SysNoticeMapper.xml ├── SysOperLogMapper.xml ├── SysPostMapper.xml ├── SysRoleDeptMapper.xml ├── SysRoleMapper.xml ├── SysRoleMenuMapper.xml ├── SysUserMapper.xml ├── SysUserPostMapper.xml └── SysUserRoleMapper.xml /.gitignore: -------------------------------------------------------------------------------- 1 | /logs/ 2 | -------------------------------------------------------------------------------- /springboot/.gitignore: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Build Tools 3 | .yml 4 | .gradle 5 | /build/ 6 | !gradle/wrapper/gradle-wrapper.jar 7 | 8 | target/ 9 | !.mvn/wrapper/maven-wrapper.jar 10 | 11 | ###################################################################### 12 | # IDE 13 | 14 | ### STS ### 15 | .apt_generated 16 | .classpath 17 | .factorypath 18 | .project 19 | .settings 20 | .springBeans 21 | 22 | ### IntelliJ IDEA ### 23 | .idea 24 | *.iws 25 | *.iml 26 | *.ipr 27 | ../.idea 28 | 29 | ### NetBeans ### 30 | nbproject/private/ 31 | build/* 32 | nbbuild/ 33 | dist/ 34 | nbdist/ 35 | .nb-gradle/ 36 | 37 | ###################################################################### 38 | # Others 39 | *.log 40 | *.xml.versionsBackup 41 | *.swp 42 | 43 | own-* 44 | 45 | !*/build/*.java 46 | !*/build/*.html 47 | !*/build/*.xml 48 | -------------------------------------------------------------------------------- /springboot/README.md: -------------------------------------------------------------------------------- 1 | ### 一、项目目录 2 | 3 | - admin ------------- 主程序入口 4 | - common ---------- 公共模块 5 | - framework -------- 开发框架 6 | - gateway ----------- 消息通道转发 7 | - open-api ---------- 系统开放接口 8 | - plugs --------------- 拓展插件 9 | - protocol ------------ 编解码协议 10 | - server --------------- 传输层服务端 (netty-mqtt,tcp,udp,sip,coap) 11 | - service -------------- 核心业务处理 12 | -------------------------------------------------------------------------------- /springboot/webVueBlog-admin/src/main/java/com/webVueBlog/DaApplication.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 6 | 7 | /** 8 | * 启动程序 9 | * 10 | * 11 | */ 12 | @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) 13 | public class DaApplication 14 | { 15 | public static void main(String[] args) 16 | { 17 | // System.setProperty("spring.devtools.restart.enabled", "false"); 18 | SpringApplication.run(DaApplication.class, args); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /springboot/webVueBlog-admin/src/main/java/com/webVueBlog/DaServletInitializer.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog; 2 | 3 | import org.springframework.boot.builder.SpringApplicationBuilder; 4 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 5 | 6 | /** 7 | * web容器中进行部署 8 | * 9 | * 10 | */ 11 | public class DaServletInitializer extends SpringBootServletInitializer 12 | { 13 | @Override 14 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) 15 | { 16 | return application.sources(DaApplication.class); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /springboot/webVueBlog-admin/src/main/java/com/webVueBlog/web/controller/monitor/ServerController.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.web.controller.monitor; 2 | 3 | import io.swagger.annotations.Api; 4 | import io.swagger.annotations.ApiOperation; 5 | import org.springframework.security.access.prepost.PreAuthorize; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | import com.webVueBlog.common.core.domain.AjaxResult; 10 | import com.webVueBlog.framework.web.domain.Server; 11 | 12 | /** 13 | * 服务器监控 14 | * 15 | * 16 | */ 17 | @Api(tags = "服务器监控") 18 | @RestController 19 | @RequestMapping("/monitor/server") 20 | public class ServerController 21 | { 22 | @ApiOperation("获取服务器信息") 23 | @PreAuthorize("@ss.hasPermi('monitor:server:list')") 24 | @GetMapping() 25 | public AjaxResult getInfo() throws Exception 26 | { 27 | Server server = new Server(); 28 | server.copyTo(); 29 | return AjaxResult.success(server); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /springboot/webVueBlog-admin/src/main/java/com/webVueBlog/web/controller/system/SysIndexController.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.web.controller.system; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | import com.webVueBlog.common.config.DaConfig; 7 | import com.webVueBlog.common.utils.StringUtils; 8 | 9 | /** 10 | * 首页 11 | * 12 | * 13 | */ 14 | @RestController 15 | public class SysIndexController 16 | { 17 | /** 系统基础配置 */ 18 | @Autowired 19 | private DaConfig DaConfig; 20 | 21 | /** 22 | * 访问首页,提示语 23 | */ 24 | @RequestMapping("/") 25 | public String index() 26 | { 27 | return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", DaConfig.getName(), DaConfig.getVersion()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /springboot/webVueBlog-admin/src/main/java/com/webVueBlog/web/controller/tool/SwaggerController.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.web.controller.tool; 2 | 3 | import org.springframework.security.access.prepost.PreAuthorize; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import com.webVueBlog.common.core.controller.BaseController; 8 | 9 | /** 10 | * swagger 接口 11 | * 12 | * 13 | */ 14 | @Controller 15 | @RequestMapping("/tool/swagger") 16 | public class SwaggerController extends BaseController 17 | { 18 | @PreAuthorize("@ss.hasPermi('tool:swagger:view')") 19 | @GetMapping() 20 | public String index() 21 | { 22 | return redirect("/swagger-ui.html"); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /springboot/webVueBlog-admin/src/main/resources/META-INF/spring-devtools.properties: -------------------------------------------------------------------------------- 1 | restart.include.json=/com.alibaba.fastjson2.*.jar -------------------------------------------------------------------------------- /springboot/webVueBlog-admin/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | Application Version: ${webvueblog.version} 2 | Spring Boot Version: ${spring-boot.version} -------------------------------------------------------------------------------- /springboot/webVueBlog-admin/src/main/resources/mybatis/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/annotation/Anonymous.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.annotation; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * 匿名访问不鉴权注解 11 | * 12 | */ 13 | @Target({ ElementType.METHOD, ElementType.TYPE })//Target可以用于方法,类,接口 METHOD是用于方法,TYPE是用于类,接口 14 | @Retention(RetentionPolicy.RUNTIME)//RetentionPolicy.RUNTIME是VM在运行时可以获取到,CLASS是VM加载时可以获取到,SOURCE是源码阶段 15 | @Documented//表示生成javadoc时会包含注解信息 16 | public @interface Anonymous//自定义注解 17 | { 18 | } 19 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/annotation/DataScope.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.annotation; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * 数据权限过滤注解 11 | * 示例:@DataScope("deptAlias_","userAlias_") 12 | * @author webVueBlog 13 | */ 14 | @Target(ElementType.METHOD) 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Documented 17 | public @interface DataScope 18 | { 19 | /** 20 | * 部门表的别名 21 | */ 22 | public String deptAlias() default ""; 23 | 24 | /** 25 | * 用户表的别名 26 | */ 27 | public String userAlias() default ""; 28 | 29 | /** 30 | * 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来 31 | */ 32 | public String permission() default ""; 33 | } 34 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/annotation/DataSource.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.annotation; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Inherited; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | import com.webVueBlog.common.enums.DataSourceType; 10 | 11 | /** 12 | * 自定义多数据源切换注解 13 | * 14 | * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准 15 | * 16 | */ 17 | @Target({ ElementType.METHOD, ElementType.TYPE }) 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @Documented 20 | @Inherited//让注解在继承类时依旧有效 21 | public @interface DataSource 22 | { 23 | /** 24 | * 切换数据源名称 25 | */ 26 | public DataSourceType value() default DataSourceType.MASTER;//默认使用主数据源 27 | } 28 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/annotation/DictFormat.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 字典格式化 7 | * 8 | * 实现将字典数据的值,格式化成字典数据的标签 9 | */ 10 | @Target({ElementType.FIELD})// Target Type.FIELD 表示注解可以用于属性(字段) 11 | @Retention(RetentionPolicy.RUNTIME)// Retention Policy.RUNTIME 表示注解在程序运行期间存在 12 | @Inherited 13 | public @interface DictFormat { 14 | 15 | /** 16 | * 例如说,SysDictTypeConstants、InfDictTypeConstants 17 | * 18 | * @return 字典类型 19 | */ 20 | String value();// 字典类型 21 | 22 | } 23 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/annotation/Excels.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Excel注解集用来定义Excel列的属性,示例: 10 | * @Excels(Excel(name="姓名",columnWidth = 20,orderNum = 1)) 11 | * private String name; 12 | * @Excels(Excel(name="性别",columnWidth = 20,orderNum = 2)) 13 | * private String sex; 14 | * 15 | */ 16 | @Target(ElementType.FIELD) 17 | @Retention(RetentionPolicy.RUNTIME) 18 | public @interface Excels 19 | { 20 | public Excel[] value();// Excel集合 21 | } 22 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/annotation/Log.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.annotation; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | import com.webVueBlog.common.enums.BusinessType; 9 | import com.webVueBlog.common.enums.OperatorType; 10 | 11 | /** 12 | * 自定义操作日志记录注解 13 | * 14 | */ 15 | @Target({ ElementType.PARAMETER, ElementType.METHOD })//方法注解 ElementType.PARAMETER 方法参数注解 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Documented 18 | public @interface Log 19 | { 20 | /** 21 | * 模块 22 | */ 23 | public String title() default ""; 24 | 25 | /** 26 | * 功能 27 | */ 28 | public BusinessType businessType() default BusinessType.OTHER; 29 | 30 | /** 31 | * 操作人类别 32 | */ 33 | public OperatorType operatorType() default OperatorType.MANAGE;// manage 管理员 other 其他 34 | 35 | /** 36 | * 是否保存请求的参数 37 | */ 38 | public boolean isSaveRequestData() default true; 39 | 40 | /** 41 | * 是否保存响应的参数 42 | */ 43 | public boolean isSaveResponseData() default true; 44 | } 45 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/annotation/RateLimiter.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.annotation; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | import com.webVueBlog.common.constant.CacheConstants; 9 | import com.webVueBlog.common.enums.LimitType; 10 | 11 | /** 12 | * 限流注解 13 | * 14 | */ 15 | @Target(ElementType.METHOD) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Documented 18 | public @interface RateLimiter 19 | { 20 | /** 21 | * 限流key 22 | */ 23 | public String key() default CacheConstants.RATE_LIMIT_KEY;//限流 redis key rate_limit 24 | 25 | /** 26 | * 限流时间,单位秒 27 | */ 28 | public int time() default 60; 29 | 30 | /** 31 | * 限流次数 32 | */ 33 | public int count() default 100; 34 | 35 | /** 36 | * 限流类型 37 | */ 38 | public LimitType limitType() default LimitType.DEFAULT;//默认策略全局限流 39 | } 40 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/annotation/RepeatSubmit.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.annotation; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Inherited; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | /** 11 | * 自定义注解防止表单重复提交 12 | * 13 | */ 14 | @Inherited 15 | @Target(ElementType.METHOD) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Documented 18 | public @interface RepeatSubmit 19 | { 20 | /** 21 | * 间隔时间(ms),小于此时间视为重复提交 22 | */ 23 | public int interval() default 5000; 24 | 25 | /** 26 | * 提示消息 27 | */ 28 | public String message() default "不允许重复提交,请稍候再试"; 29 | } 30 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/annotation/SysProtocol.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 表示系统内部协议解析器 7 | */ 8 | @Target(ElementType.TYPE) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Documented 11 | public @interface SysProtocol { 12 | 13 | /*协议名*/ 14 | String name() default ""; 15 | /*协议编码*/ 16 | String protocolCode() default ""; 17 | //协议描述 18 | String description() default ""; 19 | } 20 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/constant/CacheConstants.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.constant; 2 | 3 | /** 4 | * 缓存的key 常量 5 | * 6 | */ 7 | public class CacheConstants 8 | { 9 | /** 10 | * 登录用户 redis key 11 | */ 12 | public static final String LOGIN_TOKEN_KEY = "login_tokens:"; 13 | 14 | /** 15 | * 登录用户 redis key 16 | */ 17 | public static final String LOGIN_USERID_KEY = "login_userId:"; 18 | 19 | /** 20 | * 验证码 redis key 21 | */ 22 | public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; 23 | 24 | /** 25 | * 参数管理 cache key 26 | */ 27 | public static final String SYS_CONFIG_KEY = "sys_config:"; 28 | 29 | /** 30 | * 字典管理 cache key 31 | */ 32 | public static final String SYS_DICT_KEY = "sys_dict:"; 33 | 34 | /** 35 | * 防重提交 redis key 36 | */ 37 | public static final String REPEAT_SUBMIT_KEY = "repeat_submit:"; 38 | 39 | /** 40 | * 限流 redis key 41 | */ 42 | public static final String RATE_LIMIT_KEY = "rate_limit:"; 43 | 44 | /** 45 | * 登录账户密码错误次数 redis key 46 | */ 47 | public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:"; 48 | } 49 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/constant/ProductAuthConstant.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.constant; 2 | 3 | /** 4 | * ProductAuthConstant是产品设备认证方式的常量类 5 | */ 6 | public class ProductAuthConstant { 7 | 8 | /** 9 | * 产品设备认证方式-简单认证 10 | */ 11 | public static final Integer AUTH_WAY_SIMPLE = 1; 12 | /** 13 | * 产品设备认证方式-简单认证 14 | */ 15 | public static final Integer AUTH_WAY_ENCRYPT = 2; 16 | /** 17 | * 产品设备认证方式-简单认证 18 | */ 19 | public static final Integer AUTH_WAY_SIMPLE_AND_ENCRYPT = 3; 20 | 21 | /** 22 | * 产品设备客户端ID认证类型-简单认证 23 | */ 24 | public static final String CLIENT_ID_AUTH_TYPE_SIMPLE = "S"; 25 | 26 | /** 27 | * 产品设备客户端ID认证类型-简单认证 28 | */ 29 | public static final String CLIENT_ID_AUTH_TYPE_ENCRYPT = "E"; 30 | /** 31 | * 设备授权 32 | */ 33 | public static final Integer AUTHORIZE = 1; 34 | /** 35 | * 设备没有授权 36 | */ 37 | public static final Integer NO_AUTHORIZE = 1; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/constant/ScheduleConstants.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.constant; 2 | 3 | /** 4 | * 任务调度通用常量 5 | * 6 | */ 7 | public class ScheduleConstants 8 | { 9 | public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";// 任务类名 10 | 11 | /** 执行目标key */ 12 | public static final String TASK_PROPERTIES = "TASK_PROPERTIES"; 13 | 14 | /** 默认 */ 15 | public static final String MISFIRE_DEFAULT = "0"; 16 | 17 | /** 立即触发执行 */ 18 | public static final String MISFIRE_IGNORE_MISFIRES = "1"; 19 | 20 | /** 触发一次执行 */ 21 | public static final String MISFIRE_FIRE_AND_PROCEED = "2"; 22 | 23 | /** 不触发立即执行 */ 24 | public static final String MISFIRE_DO_NOTHING = "3"; 25 | 26 | public enum Status 27 | { 28 | /** 29 | * 正常 30 | */ 31 | NORMAL("0"), 32 | /** 33 | * 暂停 34 | */ 35 | PAUSE("1"); 36 | 37 | private String value; 38 | 39 | private Status(String value) 40 | { 41 | this.value = value; 42 | } 43 | 44 | public String getValue() 45 | { 46 | return value; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/constant/SipConstants.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.constant; 2 | /** 3 | * 消息常量 4 | */ 5 | public class SipConstants { 6 | public static final String MESSAGE_CATALOG = "Catalog";//目录 7 | public static final String MESSAGE_KEEP_ALIVE = "Keepalive";//心跳 8 | public static final String MESSAGE_DEVICE_INFO = "DeviceInfo";//设备信息 9 | public static final String MESSAGE_RECORD_INFO = "RecordInfo";//录像信息 10 | public static final String MESSAGE_MEDIA_STATUS = "MediaStatus";//媒体状态 11 | } 12 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/domain/BaseDO.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.domain; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableLogic; 4 | import com.fasterxml.jackson.annotation.JsonFormat; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | import java.time.LocalDateTime; 10 | 11 | /** 12 | * 基类,时间类型改为LocalDateTime 13 | * 14 | */ 15 | @Data 16 | public class BaseDO implements Serializable { 17 | private static final long serialVersionUID = 1L; 18 | 19 | /** 创建者 */ 20 | @ApiModelProperty("创建者") 21 | private String createBy; 22 | 23 | /** 创建时间 */ 24 | @ApiModelProperty("创建时间") 25 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 26 | private LocalDateTime createTime; 27 | 28 | /** 更新者 */ 29 | @ApiModelProperty("更新者") 30 | private String updateBy; 31 | 32 | /** 更新时间 */ 33 | @ApiModelProperty("更新时间") 34 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 35 | private LocalDateTime updateTime; 36 | 37 | /** 逻辑删除 */ 38 | @ApiModelProperty("逻辑删除") 39 | @TableLogic 40 | private Boolean delFlag; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/domain/PageParam.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.domain; 2 | 3 | import lombok.Data; 4 | 5 | import javax.validation.constraints.Max; 6 | import javax.validation.constraints.Min; 7 | import javax.validation.constraints.NotNull; 8 | import java.io.Serializable; 9 | 10 | @Data 11 | public class PageParam implements Serializable { 12 | 13 | private static final Integer PAGE_NO = 1; 14 | private static final Integer PAGE_SIZE = 10; 15 | 16 | @NotNull(message = "页码不能为空") 17 | @Min(value = 1, message = "页码最小值为 1") 18 | private Integer pageNo = PAGE_NO; 19 | 20 | @NotNull(message = "每页条数不能为空") 21 | @Min(value = 1, message = "每页条数最小值为 1") 22 | @Max(value = 100, message = "每页条数最大值为 100") 23 | private Integer pageSize = PAGE_SIZE; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/domain/PageResult.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.domain; 2 | 3 | import io.swagger.annotations.Api; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | @Api(tags = "分页结果") 12 | @Data 13 | public final class PageResult implements Serializable { 14 | 15 | @ApiModelProperty(value = "数据", required = true) 16 | private List list; 17 | 18 | @ApiModelProperty(value = "总量", required = true) 19 | private Long total; 20 | 21 | public PageResult() { 22 | } 23 | 24 | public PageResult(List list, Long total) { 25 | this.list = list; 26 | this.total = total; 27 | } 28 | 29 | public PageResult(Long total) { 30 | this.list = new ArrayList<>(); 31 | this.total = total; 32 | } 33 | 34 | public static PageResult empty() { 35 | return new PageResult<>(0L); 36 | } 37 | 38 | public static PageResult empty(Long total) { 39 | return new PageResult<>(total); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/domain/TenantBaseDO.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.domain; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | 6 | /** 7 | * 拓展多租户的 BaseDO 基类 8 | * 9 | */ 10 | @Data 11 | @EqualsAndHashCode(callSuper = true) 12 | public abstract class TenantBaseDO extends BaseDO { 13 | 14 | /** 15 | * 多租户编号 16 | */ 17 | private Long tenantId; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/domain/model/BindLoginBody.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.domain.model; 2 | 3 | /** 4 | * 用户登录对象 5 | * 6 | * 7 | */ 8 | public class BindLoginBody extends LoginBody 9 | { 10 | /** 11 | * 绑定id 12 | */ 13 | private String bindId; 14 | 15 | public String getBindId() { 16 | return bindId; 17 | } 18 | 19 | public void setBindId(String bindId) { 20 | this.bindId = bindId; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/domain/model/BindRegisterBody.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.domain.model; 2 | 3 | /** 4 | * 用户注册对象 5 | * 6 | * 7 | */ 8 | public class BindRegisterBody extends RegisterBody { 9 | /** 10 | * 绑定id 11 | */ 12 | private String bindId; 13 | 14 | public String getBindId() { 15 | return bindId; 16 | } 17 | 18 | public void setBindId(String bindId) { 19 | this.bindId = bindId; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/domain/model/RegisterBody.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.domain.model; 2 | 3 | /** 4 | * 用户注册对象 5 | * 6 | * 7 | */ 8 | public class RegisterBody extends LoginBody 9 | { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/iot/response/DashDeviceTotalDto.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.iot.response; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 大屏设备总览数据 7 | * 8 | */ 9 | @Data 10 | public class DashDeviceTotalDto { 11 | 12 | /*设备总数*/ 13 | private Integer total; 14 | /*在线设备总数*/ 15 | private Integer onlineCount; 16 | /*离线设备总数*/ 17 | private Integer OfflineCount; 18 | /*未激活设备数*/ 19 | private Integer unActiveCount; 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/iot/response/DeCodeBo.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.iot.response; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 7 | */ 8 | @Data 9 | public class DeCodeBo { 10 | 11 | /**原始报文*/ 12 | private String payload; 13 | /**从机编号*/ 14 | private Integer slaveId; 15 | /**寄存器地址*/ 16 | private Integer address; 17 | /**功能码*/ 18 | private Integer code; 19 | /**读取个数*/ 20 | private Integer count; 21 | /**写入值*/ 22 | private Integer writeData; 23 | /**读写类型 1-解析 2-读指令 3-写指令 */ 24 | private Integer type; 25 | } 26 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/mq/DeviceReplyBo.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.mq; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 7 | */ 8 | @Data 9 | public class DeviceReplyBo { 10 | 11 | /*设备下发消息id*/ 12 | private String messageId; 13 | /*标识符*/ 14 | private String id; 15 | /**下发值*/ 16 | private String value; 17 | } 18 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/mq/DeviceStatusBo.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.mq; 2 | 3 | import com.webVueBlog.common.enums.DeviceStatus; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.util.Date; 10 | 11 | /** 12 | * 设备状态 13 | * 14 | */ 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | @Data 18 | @Builder 19 | public class DeviceStatusBo { 20 | /** 21 | * 设备客户端id 22 | */ 23 | private String serialNumber; 24 | /**是否活跃*/ 25 | private DeviceStatus status; 26 | /**消息时间*/ 27 | private Date timestamp; 28 | /*host*/ 29 | private String hostName; 30 | /*port*/ 31 | private Integer port; 32 | 33 | private String ip; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/mq/MessageReplyBo.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.mq; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.util.Date; 10 | 11 | /** 12 | * 设备消息回调或者下发指令值 13 | * 14 | */ 15 | @Data 16 | @Builder 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | public class MessageReplyBo { 20 | 21 | 22 | private String id; 23 | /** 24 | * 消息回执的messageId,和下行消息呼应 25 | */ 26 | private String messageId; 27 | /** 28 | * 设备处理消息的状态 29 | */ 30 | private Integer status; 31 | /** 32 | * 抵达服务器时间 33 | */ 34 | @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 35 | private Date timestamp; 36 | /** 37 | * 设备上报的时间 38 | */ 39 | @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 40 | private Date deviceTimestamp; 41 | /** 42 | * 回执消息内容 43 | */ 44 | private String body; 45 | /*产品编号*/ 46 | private Long productId; 47 | /*设备编号*/ 48 | private String serialNumber; 49 | } 50 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/mq/message/DeviceData.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.mq.message; 2 | 3 | import com.webVueBlog.common.core.protocol.Message; 4 | import com.webVueBlog.common.core.protocol.modbus.ModbusCode; 5 | import io.netty.buffer.ByteBuf; 6 | import lombok.Builder; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | 10 | /** 11 | * 消息解析model 12 | * 13 | */ 14 | @EqualsAndHashCode(callSuper = true) 15 | @Data 16 | @Builder 17 | public class DeviceData extends Message { 18 | 19 | /*topic*/ 20 | private String topicName; 21 | 22 | /*设备编号*/ 23 | private String serialNumber; 24 | 25 | /*原数据*/ 26 | private byte[] data; 27 | 28 | private ByteBuf buf; 29 | 30 | /*消息类型 1.设备上报数据 2.设备回调数据*/ 31 | private int messageType; 32 | 33 | /*下发数据model*/ 34 | private DeviceDownMessage downMessage; 35 | 36 | private Object body; 37 | /*MQTT OR 其他*/ 38 | private int type; 39 | 40 | /*Modbus*/ 41 | private ModbusCode code; 42 | 43 | private PropRead prop; 44 | /*是否使用modbus客户端模拟测试*/ 45 | private boolean isEnabledTest; 46 | /**产品id*/ 47 | private Long productId; 48 | } 49 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/mq/message/DeviceFunctionMessage.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.mq.message; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 平台下发指令数据model 7 | * 8 | */ 9 | @Data 10 | public class DeviceFunctionMessage { 11 | 12 | /*流水号,兼容modbus标准协议没有消息流水号*/ 13 | private String seqNo; 14 | /*平台时间*/ 15 | private Long pfTimestamp; 16 | /*下发的消息体*/ 17 | private Object body; 18 | /*下发的指令物模型标识符*/ 19 | private String identifier; 20 | /*下发的数据寄存器地址*/ 21 | private String hexAddress; 22 | /*产品ID*/ 23 | private Long productId; 24 | /*设备编号*/ 25 | private String serialNumber; 26 | /*网关设备编号*/ 27 | private String protocolCode; 28 | 29 | /*是否有子设备 0-否,1-是*/ 30 | private Integer hasSub; 31 | /*子设备从机编号 例如 02 编号从机。通过主机集控下发的指定从机编号*/ 32 | private String subDeviceCode; 33 | } 34 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/mq/message/DeviceMessage.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.mq.message; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * 集群消息 9 | * 10 | */ 11 | @Data 12 | @AllArgsConstructor 13 | @NoArgsConstructor 14 | public class DeviceMessage { 15 | 16 | /*数据*/ 17 | private T data; 18 | 19 | private int nodeId; 20 | } 21 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/mq/message/InstructionsMessage.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.mq.message; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 指令下发组将的model 7 | * 8 | */ 9 | @Data 10 | public class InstructionsMessage { 11 | 12 | /*下发的数据*/ 13 | private byte[] message; 14 | 15 | /*MQTt-下发的topic*/ 16 | private String topicName; 17 | 18 | /*设备编号*/ 19 | private String serialNumber; 20 | } 21 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/mq/message/MqttBo.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.mq.message; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.Data; 5 | 6 | import java.util.Date; 7 | 8 | /** 9 | * 10 | */ 11 | @Data 12 | public class MqttBo { 13 | 14 | /*主题*/ 15 | private String topic; 16 | /*数据*/ 17 | private String data; 18 | /*消息质量*/ 19 | private int qos = 1; 20 | /*发送方向*/ 21 | private String direction; 22 | /*时间*/ 23 | @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 24 | private Date ts; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/mq/message/PropRead.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.mq.message; 2 | 3 | import com.webVueBlog.common.core.protocol.modbus.ModbusCode; 4 | import lombok.Data; 5 | 6 | /** 7 | * 8 | */ 9 | @Data 10 | public class PropRead { 11 | 12 | /**设备编号*/ 13 | private String serialNumber; 14 | /**寄存器起始地址*/ 15 | private int address; 16 | /** 17 | * 读取寄存器个数 18 | */ 19 | private int count; 20 | /**数据结果长度计算值*/ 21 | private int length; 22 | /** 23 | * 从机地址 24 | */ 25 | private int slaveId; 26 | /** 27 | * 读取个数 28 | */ 29 | private int quantity; 30 | /** 31 | * 数据 32 | */ 33 | private String data; 34 | /** 35 | * 功能码 36 | */ 37 | private ModbusCode code; 38 | } 39 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/mq/message/ProtocolDto.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.mq.message; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 协议bean 7 | * 8 | */ 9 | @Data 10 | public class ProtocolDto { 11 | 12 | /**协议编号*/ 13 | private String code; 14 | private String name; 15 | /*外部协议url*/ 16 | private String protocolUrl; 17 | private String description; 18 | /**协议类型 协议类型 0:系统协议 1:jar,2.js,3.c*/ 19 | private Integer protocolType; 20 | } 21 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/mq/message/SubDeviceMessage.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.mq.message; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 网关子设备model 7 | * 8 | */ 9 | @Data 10 | public class SubDeviceMessage { 11 | /*子设备编号或编码*/ 12 | private String serialNumber; 13 | /*数据*/ 14 | private byte[] data; 15 | /*消息id*/ 16 | private String messageId; 17 | } 18 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/mq/ota/OtaReplyMessage.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.mq.ota; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * OTA升级回复model 7 | * 8 | */ 9 | @Data 10 | public class OtaReplyMessage { 11 | 12 | private String messageId; 13 | // 200成功 其他。。 14 | private int code; 15 | private String msg; 16 | } 17 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/protocol/Message.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.protocol; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * 基础消息 10 | * 11 | * 12 | */ 13 | @Data 14 | public class Message implements Serializable { 15 | 16 | /*获取客户端id*/ 17 | public String clientId; 18 | /*消息类型*/ 19 | public String messageId; 20 | /*消息流水号*/ 21 | public String serNo; 22 | /**消息通道id*/ 23 | public String channelId; 24 | 25 | public ByteBuf payload; 26 | 27 | /** 28 | * 是否数据和注册包都封装到一起 29 | */ 30 | private Boolean isPackage = false; 31 | 32 | private Object body; 33 | } 34 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/redis/RedisKeyRegistry.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.redis; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * {@link RedisKeyDefine} 注册表 8 | */ 9 | public class RedisKeyRegistry { 10 | 11 | /** 12 | * Redis RedisKeyDefine 数组 13 | */ 14 | private static final List DEFINES = new ArrayList<>(); 15 | 16 | public static void add(RedisKeyDefine define) { 17 | DEFINES.add(define); 18 | } 19 | 20 | public static List list() { 21 | return DEFINES; 22 | } 23 | 24 | public static int size() { 25 | return DEFINES.size(); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/text/IntArrayValuable.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.text; 2 | 3 | /** 4 | * 可生成 Int 数组的接口 5 | */ 6 | public interface IntArrayValuable { 7 | 8 | /** 9 | * @return int 数组 10 | */ 11 | int[] array(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/text/KeyValue.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.text; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * Key Value 的键值对 9 | * 10 | * 11 | */ 12 | @Data 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | public class KeyValue { 16 | 17 | private K key; 18 | private V value; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/core/thingsModel/NeuronModel.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.core.thingsModel; 2 | 3 | import com.alibaba.fastjson2.JSONObject; 4 | import lombok.Data; 5 | 6 | import java.util.Date; 7 | import java.util.List; 8 | 9 | /** 10 | * Neuron-JSON格式协议 11 | * 12 | */ 13 | @Data 14 | public class NeuronModel { 15 | 16 | /** 17 | * 产品节点 18 | */ 19 | private String node; 20 | 21 | /** 22 | * 网关编号 23 | */ 24 | private String group; 25 | /** 26 | * 上报时间 27 | */ 28 | private Date timestamp; 29 | 30 | /** 31 | * 上报JSON 32 | */ 33 | private JSONObject values; 34 | /** 35 | * 错误集合 36 | */ 37 | private JSONObject errors; 38 | /** 39 | * 上报属性值集合 40 | */ 41 | private List items; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/BusinessStatus.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | /** 4 | * 操作状态 5 | * 6 | * 7 | * 8 | */ 9 | public enum BusinessStatus 10 | { 11 | /** 12 | * 成功 13 | */ 14 | SUCCESS, 15 | 16 | /** 17 | * 失败 18 | */ 19 | FAIL, 20 | } 21 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/BusinessType.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | /** 4 | * 业务操作类型 5 | * 6 | * 7 | */ 8 | public enum BusinessType 9 | { 10 | /** 11 | * 其它 12 | */ 13 | OTHER, 14 | 15 | /** 16 | * 新增 17 | */ 18 | INSERT, 19 | 20 | /** 21 | * 修改 22 | */ 23 | UPDATE, 24 | 25 | /** 26 | * 删除 27 | */ 28 | DELETE, 29 | 30 | /** 31 | * 授权 32 | */ 33 | GRANT, 34 | 35 | /** 36 | * 导出 37 | */ 38 | EXPORT, 39 | 40 | /** 41 | * 导入 42 | */ 43 | IMPORT, 44 | 45 | /** 46 | * 强退 47 | */ 48 | FORCE, 49 | 50 | /** 51 | * 生成代码 52 | */ 53 | GENCODE, 54 | 55 | /** 56 | * 清空数据 57 | */ 58 | CLEAN, 59 | } 60 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/CommonStatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | import com.webVueBlog.common.core.text.IntArrayValuable; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Getter; 6 | 7 | import java.util.Arrays; 8 | 9 | /** 10 | * 通用状态枚举 11 | 12 | */ 13 | @Getter 14 | @AllArgsConstructor 15 | public enum CommonStatusEnum implements IntArrayValuable { 16 | 17 | ENABLE(0, "开启"), 18 | DISABLE(1, "关闭"); 19 | 20 | public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CommonStatusEnum::getStatus).toArray(); 21 | 22 | /** 23 | * 状态值 24 | */ 25 | private final Integer status; 26 | /** 27 | * 状态名 28 | */ 29 | private final String name; 30 | 31 | @Override 32 | public int[] array() { 33 | return ARRAYS; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/DataEnum.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | import java.util.Objects; 7 | 8 | /** 9 | */ 10 | @Getter 11 | @AllArgsConstructor 12 | public enum DataEnum { 13 | 14 | DECIMAL("decimal", "十进制"), 15 | DOUBLE("double", "双精度"), 16 | ENUM("enum","枚举"), 17 | BOOLEAN("boolean","布尔类型"), 18 | INTEGER("integer","整形"), 19 | OBJECT("object", "对象"), 20 | STRING("string","字符串"), 21 | ARRAY("array","数组"); 22 | 23 | String type; 24 | String msg; 25 | 26 | public static DataEnum convert(String type){ 27 | for (DataEnum value : DataEnum.values()) { 28 | if (Objects.equals(value.type, type)){ 29 | return value; 30 | } 31 | } 32 | return DataEnum.STRING; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/DataSourceType.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | /** 4 | * 数据源 5 | * 6 | * 7 | */ 8 | public enum DataSourceType 9 | { 10 | /** 11 | * 主库 12 | */ 13 | MASTER, 14 | 15 | /** 16 | * 从库 17 | */ 18 | SLAVE 19 | } 20 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/DeviceStatus.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | @Getter 7 | @AllArgsConstructor 8 | public enum DeviceStatus { 9 | 10 | UNACTIVATED(1,"NOTACTIVE","未激活"), 11 | FORBIDDEN(2,"DISABLE","禁用"), 12 | ONLINE(3,"ONLINE","在线"), 13 | OFFLINE(4,"OFFLINE","离线"); 14 | 15 | private int type; 16 | private String code; 17 | private String description; 18 | 19 | public static DeviceStatus convert(int type){ 20 | for (DeviceStatus value : DeviceStatus.values()) { 21 | if (value.type == type){ 22 | return value; 23 | } 24 | } 25 | return null; 26 | } 27 | 28 | public static DeviceStatus convert(String code){ 29 | for (DeviceStatus value : DeviceStatus.values()) { 30 | if (value.code.equals(code)){ 31 | return value; 32 | } 33 | } 34 | return null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/ExceptionCode.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.Getter; 6 | 7 | /** 8 | * 9 | */ 10 | @Getter 11 | @AllArgsConstructor 12 | public enum ExceptionCode { 13 | 14 | SUCCESS(200,"成功"), 15 | TIMEOUT(400,"超时"), 16 | OFFLINE(404,"设备断线"), 17 | FAIL(500,"失败"); 18 | ; 19 | 20 | public int code; 21 | public String desc; 22 | } 23 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/FunctionReplyStatus.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * 设备回调状态 8 | * 9 | */ 10 | @Getter 11 | @AllArgsConstructor 12 | public enum FunctionReplyStatus { 13 | SUCCESS(200,"设备执行成功"), 14 | FAIl(201,"指令执行失败"), 15 | UNKNOWN(204,"设备超时未回复"), 16 | NORELY(203, "指令下发成功"); 17 | 18 | int code; 19 | String message; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/HttpMethod.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | import org.springframework.lang.Nullable; 6 | 7 | /** 8 | * 请求方式 9 | * 10 | * 11 | */ 12 | public enum HttpMethod 13 | { 14 | GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; 15 | 16 | private static final Map mappings = new HashMap<>(16); 17 | 18 | static 19 | { 20 | for (HttpMethod httpMethod : values()) 21 | { 22 | mappings.put(httpMethod.name(), httpMethod); 23 | } 24 | } 25 | 26 | @Nullable 27 | public static HttpMethod resolve(@Nullable String method) 28 | { 29 | return (method != null ? mappings.get(method) : null); 30 | } 31 | 32 | public boolean matches(String method) 33 | { 34 | return (this == resolve(method)); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/IErrorCode.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | /** 4 | * 常用API返回对象接口 5 | */ 6 | public interface IErrorCode { 7 | 8 | /**返回码*/ 9 | int getCode(); 10 | 11 | /**返回信息*/ 12 | String getMessage(); 13 | 14 | } -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/LimitType.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | /** 4 | * 限流类型 5 | * 6 | * 7 | */ 8 | 9 | public enum LimitType 10 | { 11 | /** 12 | * 默认策略全局限流 13 | */ 14 | DEFAULT, 15 | 16 | /** 17 | * 根据请求者IP进行限流 18 | */ 19 | IP 20 | } 21 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/ModbusDataType.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | import java.util.Objects; 7 | 8 | /** 9 | * 10 | */ 11 | @Getter 12 | @AllArgsConstructor 13 | public enum ModbusDataType { 14 | 15 | 16 | U_SHORT("ushort","16位 无符号"), 17 | SHORT("short","16位 有符号"), 18 | LONG_ABCD("long-ABCD","32位 有符号(ABCD)"), 19 | LONG_CDAB("long-CDAB","32位 有符号(CDAB)"), 20 | U_LONG_ABCD("ulong-ABCD","32位 无符号(ABCD)"), 21 | U_LONG_CDAB("ulong-CDAB","32位 无符号(CDAB)"), 22 | FLOAT_ABCD("float-ABCD","32位 浮点数(ABCD)"), 23 | FLOAT_CDAB("float-CDAB","32位 浮点数(CDAB)"), 24 | BIT("bit","位"); 25 | 26 | String type; 27 | String msg; 28 | 29 | public static ModbusDataType convert(String type){ 30 | for (ModbusDataType value : ModbusDataType.values()) { 31 | if (Objects.equals(value.type,type)){ 32 | return value; 33 | } 34 | } 35 | return ModbusDataType.U_SHORT; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/OTAUpgrade.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * OTA升级状态 8 | * 9 | */ 10 | @AllArgsConstructor 11 | @Getter 12 | public enum OTAUpgrade { 13 | 14 | 15 | AWAIT(0, "等待升级","未推送固件到设备"), 16 | SEND(1, "已发送","已发送设备"), 17 | REPLY(2, "升级中","设备OTA升级中"), 18 | SUCCESS(3, "成功","升级成功"), 19 | FAILED(4, "失败","升级失败"), 20 | STOP(5, "停止","设备离线停止推送"), 21 | UNKNOWN(404, "未知","未知错误码"); 22 | Integer status; 23 | String subMsg; 24 | String des; 25 | 26 | public static OTAUpgrade parse(Integer code){ 27 | for (OTAUpgrade item: OTAUpgrade.values()){ 28 | if(item.status.equals(code)){ 29 | return item; 30 | } 31 | } 32 | 33 | return UNKNOWN; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/OperatorType.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | /** 4 | * 操作人类别 5 | * 6 | * 7 | */ 8 | public enum OperatorType 9 | { 10 | /** 11 | * 其它 12 | */ 13 | OTHER, 14 | 15 | /** 16 | * 后台用户 17 | */ 18 | MANAGE, 19 | 20 | /** 21 | * 手机端用户 22 | */ 23 | MOBILE 24 | } 25 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/ServerType.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * 8 | */ 9 | @Getter 10 | @AllArgsConstructor 11 | public enum ServerType { 12 | 13 | MQTT(1, "MQTT","MQTT-BROKER"), 14 | COAP(2, "COAP","COAP-SERVER"), 15 | TCP(3, "TCP","TCP-SERVER"), 16 | UDP(4, "UDP","UDP-SERVER"), 17 | WEBSOCKET(5,"WEBSOCKET","WEBSOCKET-SERVER"), 18 | GB28181(6,"GB28181","SIP-SERVER"), 19 | OTHER(999,"WEBSOCKET","MQTT-BROKER"); 20 | 21 | private int type; 22 | private String code; 23 | private String des; 24 | 25 | 26 | 27 | public static ServerType explain(String code) { 28 | for (ServerType value : ServerType.values()) { 29 | if (value.code.equals(code)) { 30 | return value; 31 | } 32 | } 33 | return ServerType.MQTT; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/UserStatus.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | /** 4 | * 用户状态 5 | * 6 | * 7 | */ 8 | public enum UserStatus 9 | { 10 | OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除"); 11 | 12 | private final String code; 13 | private final String info; 14 | 15 | UserStatus(String code, String info) 16 | { 17 | this.code = code; 18 | this.info = info; 19 | } 20 | 21 | public String getCode() 22 | { 23 | return code; 24 | } 25 | 26 | public String getInfo() 27 | { 28 | return info; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/enums/VerifyTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * 验证类型枚举 9 | * 10 | */ 11 | @Getter 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | public enum VerifyTypeEnum { 15 | 16 | PASSWORD(1, "账号密码验证"), 17 | SMS(2, "短信验证"); 18 | 19 | private Integer verifyType; 20 | 21 | private String desc; 22 | } 23 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/exception/DemoModeException.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.exception; 2 | 3 | /** 4 | * 演示模式异常 5 | * 6 | * 7 | */ 8 | public class DemoModeException extends RuntimeException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public DemoModeException() 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/exception/ErrorCode.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.exception; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | * 错误码对象 8 | * 9 | */ 10 | @Data 11 | @Accessors(chain = true) 12 | public class ErrorCode { 13 | 14 | /** 15 | * 错误码 16 | */ 17 | private final Integer code; 18 | /** 19 | * 错误提示 20 | */ 21 | private final String msg; 22 | 23 | public ErrorCode(Integer code, String message) { 24 | this.code = code; 25 | this.msg = message; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/exception/UtilException.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.exception; 2 | 3 | /** 4 | * 工具类异常 5 | * 6 | * 7 | */ 8 | public class UtilException extends RuntimeException 9 | { 10 | private static final long serialVersionUID = 8247610319171014183L; 11 | 12 | public UtilException(Throwable e) 13 | { 14 | super(e.getMessage(), e); 15 | } 16 | 17 | public UtilException(String message) 18 | { 19 | super(message); 20 | } 21 | 22 | public UtilException(String message, Throwable throwable) 23 | { 24 | super(message, throwable); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/exception/file/FileException.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.exception.file; 2 | 3 | import com.webVueBlog.common.exception.base.BaseException; 4 | 5 | /** 6 | * 文件信息异常类 7 | * 8 | * 9 | */ 10 | public class FileException extends BaseException 11 | { 12 | private static final long serialVersionUID = 1L; 13 | 14 | public FileException(String code, Object[] args) 15 | { 16 | super("file", code, args, null); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/exception/file/FileNameLengthLimitExceededException.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.exception.file; 2 | 3 | /** 4 | * 文件名称超长限制异常类 5 | * 6 | * 7 | */ 8 | public class FileNameLengthLimitExceededException extends FileException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public FileNameLengthLimitExceededException(int defaultFileNameLength) 13 | { 14 | super("upload.filename.exceed.length", new Object[] { defaultFileNameLength }); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/exception/file/FileSizeLimitExceededException.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.exception.file; 2 | 3 | /** 4 | * 文件名大小限制异常类 5 | * 6 | * 7 | */ 8 | public class FileSizeLimitExceededException extends FileException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public FileSizeLimitExceededException(long defaultMaxSize) 13 | { 14 | super("upload.exceed.maxSize", new Object[] { defaultMaxSize }); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/exception/iot/MqttAuthorizationException.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.exception.iot; 2 | 3 | import com.webVueBlog.common.exception.GlobalException; 4 | import lombok.NoArgsConstructor; 5 | 6 | /** 7 | * mqtt客户端权限校验异常 8 | * 9 | */ 10 | @NoArgsConstructor 11 | public class MqttAuthorizationException extends GlobalException { 12 | 13 | public MqttAuthorizationException(String messageId){ 14 | super(messageId); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/exception/iot/MqttClientUserNameOrPassException.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.exception.iot; 2 | 3 | import com.webVueBlog.common.exception.GlobalException; 4 | import lombok.NoArgsConstructor; 5 | 6 | /** 7 | * mqtt客户端校验 用户名或密码错误 8 | * 9 | */ 10 | @NoArgsConstructor 11 | public class MqttClientUserNameOrPassException extends GlobalException { 12 | 13 | public MqttClientUserNameOrPassException(String message){ 14 | super(message); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/exception/job/TaskException.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.exception.job; 2 | 3 | /** 4 | * 计划策略异常 5 | * 6 | * 7 | */ 8 | public class TaskException extends Exception 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | private Code code; 13 | 14 | public TaskException(String msg, Code code) 15 | { 16 | this(msg, code, null); 17 | } 18 | 19 | public TaskException(String msg, Code code, Exception nestedEx) 20 | { 21 | super(msg, nestedEx); 22 | this.code = code; 23 | } 24 | 25 | public Code getCode() 26 | { 27 | return code; 28 | } 29 | 30 | public enum Code 31 | { 32 | TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE 33 | } 34 | } -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/exception/user/CaptchaException.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.exception.user; 2 | 3 | /** 4 | * 验证码错误异常类 5 | * 6 | * 7 | */ 8 | public class CaptchaException extends UserException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public CaptchaException() 13 | { 14 | super("user.jcaptcha.error", null); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/exception/user/CaptchaExpireException.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.exception.user; 2 | 3 | /** 4 | * 验证码失效异常类 5 | * 6 | * 7 | */ 8 | public class CaptchaExpireException extends UserException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public CaptchaExpireException() 13 | { 14 | super("user.jcaptcha.expire", null); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/exception/user/UserException.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.exception.user; 2 | 3 | import com.webVueBlog.common.exception.base.BaseException; 4 | 5 | /** 6 | * 用户信息异常类 7 | * 8 | * 9 | */ 10 | public class UserException extends BaseException 11 | { 12 | private static final long serialVersionUID = 1L; 13 | 14 | public UserException(String code, Object[] args) 15 | { 16 | super("user", code, args, null); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/exception/user/UserPasswordNotMatchException.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.exception.user; 2 | 3 | /** 4 | * 用户密码不正确或不符合规范异常类 5 | * 6 | * 7 | */ 8 | public class UserPasswordNotMatchException extends UserException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public UserPasswordNotMatchException() 13 | { 14 | super("user.password.not.match", null); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/exception/user/UserPasswordRetryLimitExceedException.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.exception.user; 2 | 3 | /** 4 | * 用户错误最大次数异常类 5 | * 6 | * 7 | */ 8 | public class UserPasswordRetryLimitExceedException extends UserException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public UserPasswordRetryLimitExceedException(int retryLimitCount, int lockTime) 13 | { 14 | super("user.password.retry.limit.exceed", new Object[] { retryLimitCount, lockTime }); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/filter/PropertyPreExcludeFilter.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.filter; 2 | 3 | import com.alibaba.fastjson2.filter.SimplePropertyPreFilter; 4 | 5 | /** 6 | * 排除JSON敏感属性 7 | * 8 | * 9 | */ 10 | public class PropertyPreExcludeFilter extends SimplePropertyPreFilter 11 | { 12 | public PropertyPreExcludeFilter() 13 | { 14 | } 15 | 16 | public PropertyPreExcludeFilter addExcludes(String... filters) 17 | { 18 | for (int i = 0; i < filters.length; i++) 19 | { 20 | this.getExcludes().add(filters[i]); 21 | } 22 | return this; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/utils/ExceptionUtil.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.utils; 2 | 3 | import java.io.PrintWriter; 4 | import java.io.StringWriter; 5 | import org.apache.commons.lang3.exception.ExceptionUtils; 6 | 7 | /** 8 | * 错误信息处理类。 9 | * 10 | * 11 | */ 12 | public class ExceptionUtil 13 | { 14 | /** 15 | * 获取exception的详细错误信息。 16 | */ 17 | public static String getExceptionMessage(Throwable e) 18 | { 19 | StringWriter sw = new StringWriter(); 20 | e.printStackTrace(new PrintWriter(sw, true)); 21 | return sw.toString(); 22 | } 23 | 24 | public static String getRootErrorMessage(Exception e) 25 | { 26 | Throwable root = ExceptionUtils.getRootCause(e); 27 | root = (root == null ? e : root); 28 | if (root == null) 29 | { 30 | return ""; 31 | } 32 | String msg = root.getMessage(); 33 | if (msg == null) 34 | { 35 | return "null"; 36 | } 37 | return StringUtils.defaultString(msg); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/utils/LogUtils.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.utils; 2 | 3 | /** 4 | * 处理并记录日志文件 5 | * 6 | * 7 | */ 8 | public class LogUtils 9 | { 10 | public static String getBlock(Object msg) 11 | { 12 | if (msg == null) 13 | { 14 | msg = ""; 15 | } 16 | return "[" + msg.toString() + "]"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/utils/MessageUtils.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.utils; 2 | 3 | import org.springframework.context.MessageSource; 4 | import org.springframework.context.i18n.LocaleContextHolder; 5 | import com.webVueBlog.common.utils.spring.SpringUtils; 6 | 7 | /** 8 | * 获取i18n资源文件 9 | * 10 | * 11 | */ 12 | public class MessageUtils 13 | { 14 | /** 15 | * 根据消息键和参数 获取消息 委托给spring messageSource 16 | * 17 | * @param code 消息键 18 | * @param args 参数 19 | * @return 获取国际化翻译值 20 | */ 21 | public static String message(String code, Object... args) 22 | { 23 | MessageSource messageSource = SpringUtils.getBean(MessageSource.class); 24 | return messageSource.getMessage(code, args, LocaleContextHolder.getLocale()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/utils/PageUtils.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.utils; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.webVueBlog.common.core.page.PageDomain; 5 | import com.webVueBlog.common.core.page.TableSupport; 6 | import com.webVueBlog.common.utils.sql.SqlUtil; 7 | 8 | /** 9 | * 分页工具类 10 | * 11 | * 12 | */ 13 | public class PageUtils extends PageHelper 14 | { 15 | /** 16 | * 设置请求分页数据 17 | */ 18 | public static void startPage() 19 | { 20 | PageDomain pageDomain = TableSupport.buildPageRequest(); 21 | Integer pageNum = pageDomain.getPageNum(); 22 | Integer pageSize = pageDomain.getPageSize(); 23 | String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); 24 | Boolean reasonable = pageDomain.getReasonable(); 25 | PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable); 26 | } 27 | 28 | /** 29 | * 清理分页的线程变量 30 | */ 31 | public static void clearPage() 32 | { 33 | PageHelper.clearPage(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/utils/bean/BeanValidators.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.utils.bean; 2 | 3 | import java.util.Set; 4 | import javax.validation.ConstraintViolation; 5 | import javax.validation.ConstraintViolationException; 6 | import javax.validation.Validator; 7 | 8 | /** 9 | * bean对象属性验证 10 | * 11 | * 12 | */ 13 | public class BeanValidators 14 | { 15 | public static void validateWithException(Validator validator, Object object, Class>... groups) 16 | throws ConstraintViolationException 17 | { 18 | Set> constraintViolations = validator.validate(object, groups); 19 | if (!constraintViolations.isEmpty()) 20 | { 21 | throw new ConstraintViolationException(constraintViolations); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/utils/gateway/mq/Topics.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.utils.gateway.mq; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 7 | */ 8 | @Data 9 | public class Topics { 10 | 11 | 12 | private String topicName; 13 | private Integer qos =0; 14 | private String desc; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/utils/gateway/mq/TopicsPost.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.utils.gateway.mq; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 7 | */ 8 | @Data 9 | public class TopicsPost { 10 | 11 | private String[] topics; 12 | private int[] qos; 13 | } 14 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/utils/gateway/protocol/NettyUtils.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.utils.gateway.protocol; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import io.netty.buffer.ByteBufUtil; 5 | 6 | /** 7 | * 8 | */ 9 | public class NettyUtils { 10 | 11 | /** 12 | * ByteBuf转 byte[] 13 | * @param buf buffer 14 | * @return byte[] 15 | */ 16 | public static byte[] readBytesFromByteBuf(ByteBuf buf){ 17 | return ByteBufUtil.getBytes(buf); 18 | } 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/utils/poi/ExcelHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.utils.poi; 2 | 3 | /** 4 | * Excel数据格式处理适配器 5 | * 6 | * 7 | */ 8 | public interface ExcelHandlerAdapter 9 | { 10 | /** 11 | * 格式化 12 | * 13 | * @param value 单元格数据值 14 | * @param args excel注解args参数组 15 | * 16 | * @return 处理后的值 17 | */ 18 | Object format(Object value, String[] args); 19 | } 20 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/wechat/WeChatLoginResult.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.wechat; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 微信登录返回结果 7 | * 8 | */ 9 | @Data 10 | public class WeChatLoginResult { 11 | 12 | /** 13 | * 登录成功返回token 14 | */ 15 | private String token; 16 | 17 | /** 18 | * 绑定账号跳转页面 19 | */ 20 | private String bindId; 21 | } 22 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/wechat/WeChatMiniProgramResult.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.wechat; 2 | 3 | import com.alibaba.fastjson2.annotation.JSONField; 4 | import lombok.Data; 5 | 6 | /** 7 | * 8 | */ 9 | @Data 10 | public class WeChatMiniProgramResult { 11 | 12 | /** 13 | * 会话密钥 14 | */ 15 | @JSONField(name = "session_key") 16 | private String sessionKey; 17 | 18 | /** 19 | * 用户在开放平台的唯一标识符,若当前小程序已绑定到微信开放平台账号下会返回,详见 UnionID 机制说明 20 | */ 21 | @JSONField(name = "unionid") 22 | private String unionId; 23 | 24 | /** 25 | * 错误信息 26 | */ 27 | @JSONField(name = "errmsg") 28 | private String errMsg; 29 | 30 | /** 31 | * 用户唯一标识 32 | */ 33 | @JSONField(name = "openid") 34 | private String openId; 35 | 36 | /** 37 | * 错误码 38 | */ 39 | @JSONField(name = "errcode") 40 | private String errCode; 41 | } 42 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/wechat/WeChatPhoneInfo.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.wechat; 2 | 3 | import com.alibaba.fastjson2.annotation.JSONField; 4 | import lombok.Data; 5 | 6 | /** 7 | * 8 | */ 9 | @Data 10 | public class WeChatPhoneInfo { 11 | 12 | @JSONField(name = "errcode") 13 | private String errCode; 14 | 15 | @JSONField(name = "errmsg") 16 | private String errmsg; 17 | 18 | @JSONField(name = "phone_info") 19 | private PhoneInfo phoneInfo; 20 | 21 | @Data 22 | public class PhoneInfo { 23 | 24 | private String phoneNumber; 25 | 26 | private String purePhoneNumber; 27 | 28 | private String countryCode; 29 | 30 | private WaterMark watermark; 31 | } 32 | 33 | @Data 34 | class WaterMark { 35 | 36 | private String timestamp; 37 | 38 | private String appid; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/xss/Xss.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.xss; 2 | 3 | import javax.validation.Constraint; 4 | import javax.validation.Payload; 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | /** 11 | * 自定义xss校验注解 12 | * 13 | * 14 | */ 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Target(value = { ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.PARAMETER }) 17 | @Constraint(validatedBy = { XssValidator.class }) 18 | public @interface Xss 19 | { 20 | String message() 21 | 22 | default "不允许任何脚本运行"; 23 | 24 | Class>[] groups() default {}; 25 | 26 | Class extends Payload>[] payload() default {}; 27 | } 28 | -------------------------------------------------------------------------------- /springboot/webVueBlog-common/src/main/java/com/webVueBlog/common/xss/XssValidator.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common.xss; 2 | 3 | import com.webVueBlog.common.utils.StringUtils; 4 | import javax.validation.ConstraintValidator; 5 | import javax.validation.ConstraintValidatorContext; 6 | import java.util.regex.Matcher; 7 | import java.util.regex.Pattern; 8 | 9 | /** 10 | * 自定义xss校验注解实现 11 | * 12 | * 13 | */ 14 | public class XssValidator implements ConstraintValidator 15 | { 16 | private static final String HTML_PATTERN = "<(\\S*?)[^>]*>.*?|<.*? />"; 17 | 18 | @Override 19 | public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) 20 | { 21 | if (StringUtils.isBlank(value)) 22 | { 23 | return true; 24 | } 25 | return !containsHtml(value); 26 | } 27 | 28 | public static boolean containsHtml(String value) 29 | { 30 | Pattern pattern = Pattern.compile(HTML_PATTERN); 31 | Matcher matcher = pattern.matcher(value); 32 | return matcher.matches(); 33 | } 34 | } -------------------------------------------------------------------------------- /springboot/webVueBlog-framework/src/main/java/com/webVueBlog/framework/config/ApplicationConfig.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.framework.config; 2 | 3 | import java.util.TimeZone; 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.context.annotation.EnableAspectJAutoProxy; 9 | 10 | /** 11 | * 程序注解配置 12 | * 13 | * 14 | */ 15 | @Configuration 16 | // 表示通过aop框架暴露该代理对象,AopContext能够访问 17 | @EnableAspectJAutoProxy(exposeProxy = true) 18 | // 指定要扫描的Mapper类的包的路径 19 | @MapperScan("com.webVueBlog.**.mapper") 20 | public class ApplicationConfig 21 | { 22 | /** 23 | * 时区配置 24 | */ 25 | @Bean 26 | public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() 27 | { 28 | return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /springboot/webVueBlog-framework/src/main/java/com/webVueBlog/framework/config/ServerConfig.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.framework.config; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | import org.springframework.stereotype.Component; 5 | import com.webVueBlog.common.utils.ServletUtils; 6 | 7 | /** 8 | * 服务相关配置 9 | * 10 | * 11 | */ 12 | @Component 13 | public class ServerConfig 14 | { 15 | /** 16 | * 获取完整的请求路径,包括:域名,端口,上下文访问路径 17 | * 18 | * @return 服务地址 19 | */ 20 | public String getUrl() 21 | { 22 | HttpServletRequest request = ServletUtils.getRequest(); 23 | return getDomain(request); 24 | } 25 | 26 | public static String getDomain(HttpServletRequest request) 27 | { 28 | StringBuffer url = request.getRequestURL(); 29 | String contextPath = request.getServletContext().getContextPath(); 30 | return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /springboot/webVueBlog-framework/src/main/java/com/webVueBlog/framework/datasource/DynamicDataSource.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.framework.datasource; 2 | 3 | import java.util.Map; 4 | import javax.sql.DataSource; 5 | import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; 6 | 7 | /** 8 | * 动态数据源 9 | * 10 | * 11 | */ 12 | public class DynamicDataSource extends AbstractRoutingDataSource 13 | { 14 | public DynamicDataSource(DataSource defaultTargetDataSource, Map targetDataSources) 15 | { 16 | super.setDefaultTargetDataSource(defaultTargetDataSource); 17 | super.setTargetDataSources(targetDataSources); 18 | super.afterPropertiesSet(); 19 | } 20 | 21 | @Override 22 | protected Object determineCurrentLookupKey() 23 | { 24 | return DynamicDataSourceContextHolder.getDataSourceType(); 25 | } 26 | } -------------------------------------------------------------------------------- /springboot/webVueBlog-framework/src/main/java/com/webVueBlog/framework/datasource/DynamicDataSourceContextHolder.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.framework.datasource; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | /** 7 | * 数据源切换处理 8 | * 9 | * 10 | */ 11 | public class DynamicDataSourceContextHolder 12 | { 13 | public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class); 14 | 15 | /** 16 | * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本, 17 | * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。 18 | */ 19 | private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>(); 20 | 21 | /** 22 | * 设置数据源的变量 23 | */ 24 | public static void setDataSourceType(String dsType) 25 | { 26 | log.info("切换到{}数据源", dsType); 27 | CONTEXT_HOLDER.set(dsType); 28 | } 29 | 30 | /** 31 | * 获得数据源的变量 32 | */ 33 | public static String getDataSourceType() 34 | { 35 | return CONTEXT_HOLDER.get(); 36 | } 37 | 38 | /** 39 | * 清空数据源变量 40 | */ 41 | public static void clearDataSourceType() 42 | { 43 | CONTEXT_HOLDER.remove(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /springboot/webVueBlog-framework/src/main/java/com/webVueBlog/framework/manager/ShutdownManager.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.framework.manager; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.stereotype.Component; 6 | import javax.annotation.PreDestroy; 7 | 8 | /** 9 | * 确保应用退出时能关闭后台线程 10 | * 11 | * 12 | */ 13 | @Component 14 | public class ShutdownManager 15 | { 16 | private static final Logger logger = LoggerFactory.getLogger("sys-user"); 17 | 18 | @PreDestroy 19 | public void destroy() 20 | { 21 | shutdownAsyncManager(); 22 | } 23 | 24 | /** 25 | * 停止异步执行任务 26 | */ 27 | private void shutdownAsyncManager() 28 | { 29 | try 30 | { 31 | logger.info("====关闭后台任务任务线程池===="); 32 | AsyncManager.me().shutdown(); 33 | } 34 | catch (Exception e) 35 | { 36 | logger.error(e.getMessage(), e); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /springboot/webVueBlog-framework/src/main/java/com/webVueBlog/framework/security/context/AuthenticationContextHolder.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.framework.security.context; 2 | 3 | import org.springframework.security.core.Authentication; 4 | 5 | /** 6 | * 身份验证信息 7 | * 8 | * 9 | */ 10 | public class AuthenticationContextHolder 11 | { 12 | private static final ThreadLocal contextHolder = new ThreadLocal<>(); 13 | 14 | public static Authentication getContext() 15 | { 16 | return contextHolder.get(); 17 | } 18 | 19 | public static void setContext(Authentication context) 20 | { 21 | contextHolder.set(context); 22 | } 23 | 24 | public static void clearContext() 25 | { 26 | contextHolder.remove(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /springboot/webVueBlog-framework/src/main/java/com/webVueBlog/framework/security/context/PermissionContextHolder.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.framework.security.context; 2 | 3 | import org.springframework.web.context.request.RequestAttributes; 4 | import org.springframework.web.context.request.RequestContextHolder; 5 | import com.webVueBlog.common.core.text.Convert; 6 | 7 | /** 8 | * 权限信息 9 | * 10 | * 11 | */ 12 | public class PermissionContextHolder 13 | { 14 | private static final String PERMISSION_CONTEXT_ATTRIBUTES = "PERMISSION_CONTEXT"; 15 | 16 | public static void setContext(String permission) 17 | { 18 | RequestContextHolder.currentRequestAttributes().setAttribute(PERMISSION_CONTEXT_ATTRIBUTES, permission, 19 | RequestAttributes.SCOPE_REQUEST); 20 | } 21 | 22 | public static String getContext() 23 | { 24 | return Convert.toStr(RequestContextHolder.currentRequestAttributes().getAttribute(PERMISSION_CONTEXT_ATTRIBUTES, 25 | RequestAttributes.SCOPE_REQUEST)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/gateway-boot/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | webVueBlog-gateway 7 | com.webVueBlog 8 | 3.8.5 9 | 10 | gateway-boot 11 | 12 | 网关模块 13 | 14 | 15 | 16 | 17 | com.webVueBlog 18 | webVueBlog-mq 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | webVueBlog 7 | com.webVueBlog 8 | 3.8.5 9 | 10 | 11 | pom 12 | 13 | 14 | gateway-boot 15 | webVueBlog-mq 16 | 17 | 18 | webVueBlog-gateway 19 | webVueBlog-gateway 20 | 21 | 22 | 23 | com.webVueBlog 24 | webVueBlog-common 25 | 26 | 27 | 28 | com.webVueBlog 29 | webVueBlog-iot-service 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | webVueBlog-gateway 7 | com.webVueBlog 8 | 3.8.5 9 | 10 | webVueBlog-mq 11 | 12 | 13 | 14 | 15 | com.webVueBlog 16 | webVueBlog-protocol-base 17 | 18 | 19 | 20 | com.webVueBlog 21 | webVueBlog-protocol-collect 22 | 23 | 24 | 25 | cn.hutool 26 | hutool-all 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/config/MqConfig.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.config; 2 | 3 | import com.webVueBlog.common.constant.DaConstant; 4 | import com.webVueBlog.mq.redischannel.service.RedisPublishServiceImpl; 5 | import com.webVueBlog.mq.service.IMessagePublishService; 6 | import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; 7 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | 11 | /** 12 | * mq集群配置 13 | * 14 | */ 15 | @Configuration 16 | //是否开启集群,默认不开启 17 | @ConditionalOnExpression("${cluster.enable:false}") 18 | public class MqConfig { 19 | 20 | @Bean 21 | @ConditionalOnProperty(prefix ="cluster", name = "type" ,havingValue = DaConstant.MQTT.REDIS_CHANNEL,matchIfMissing = true) 22 | public IMessagePublishService redisChannelPublish(){ 23 | return new RedisPublishServiceImpl(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/model/ReportDataBo.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.model; 2 | 3 | import com.webVueBlog.common.core.thingsModel.ThingsModelSimpleItem; 4 | import lombok.Data; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 上报数据模型bo 10 | * 11 | */ 12 | @Data 13 | public class ReportDataBo { 14 | 15 | /**产品id*/ 16 | private Long productId; 17 | /**设备编号*/ 18 | private String serialNumber; 19 | /**上报消息*/ 20 | private String message; 21 | /**上报的数据*/ 22 | private List dataList; 23 | /**设备影子*/ 24 | private boolean isShadow; 25 | /** 26 | * 物模型类型 27 | * 1=属性,2=功能,3=事件,4=设备升级,5=设备上线,6=设备下线 28 | */ 29 | private int type; 30 | /**是否执行规则引擎*/ 31 | private boolean isRuleEngine; 32 | /**从机编号*/ 33 | private Integer slaveId; 34 | 35 | 36 | private Long userId; 37 | private String userName; 38 | private String deviceName; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/redischannel/consumer/DeviceOtherMsgConsumer.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.redischannel.consumer; 2 | 3 | import com.webVueBlog.common.constant.DaConstant; 4 | import com.webVueBlog.common.core.mq.DeviceReportBo; 5 | import com.webVueBlog.mq.service.impl.DeviceOtherMsgHandler; 6 | 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.scheduling.annotation.Async; 9 | import org.springframework.stereotype.Component; 10 | 11 | import javax.annotation.Resource; 12 | 13 | /** 14 | * 15 | */ 16 | @Slf4j 17 | @Component 18 | public class DeviceOtherMsgConsumer { 19 | 20 | @Resource 21 | private DeviceOtherMsgHandler otherMsgHandler; 22 | 23 | @Async(DaConstant.TASK.DEVICE_OTHER_TASK) 24 | public void consume(DeviceReportBo bo){ 25 | try { 26 | //处理emq订阅的非 property/post 属性上报的消息 ,因为其他消息量小,放在一起处理 27 | otherMsgHandler.messageHandler(bo); 28 | }catch (Exception e){ 29 | log.error("=>设备其他消息处理出错",e); 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/redischannel/consumer/DeviceReportMsgConsumer.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.redischannel.consumer; 2 | 3 | import com.webVueBlog.common.constant.DaConstant; 4 | import com.webVueBlog.common.core.mq.DeviceReportBo; 5 | import com.webVueBlog.mq.service.IDeviceReportMessageService; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.scheduling.annotation.Async; 9 | import org.springframework.stereotype.Component; 10 | 11 | /** 12 | * 设备上报消息处理 13 | * 14 | * 15 | */ 16 | @Slf4j 17 | @Component 18 | public class DeviceReportMsgConsumer { 19 | 20 | 21 | @Autowired 22 | private IDeviceReportMessageService reportMessageService; 23 | 24 | @Async(DaConstant.TASK.DEVICE_UP_MESSAGE_TASK) 25 | public void consume(DeviceReportBo bo) { 26 | try { 27 | //处理数据解析 28 | reportMessageService.parseReportMsg(bo); 29 | } catch (Exception e) { 30 | log.error("设备主动上报队列监听异常", e); 31 | } 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/redischannel/listen/DeviceOtherListen.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.redischannel.listen; 2 | 3 | import com.webVueBlog.common.constant.DaConstant; 4 | import com.webVueBlog.common.core.mq.DeviceReportBo; 5 | import com.webVueBlog.mq.redischannel.consumer.DeviceOtherMsgConsumer; 6 | import com.webVueBlog.mq.redischannel.queue.DeviceOtherQueue; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.scheduling.annotation.Async; 9 | import org.springframework.stereotype.Component; 10 | 11 | import javax.annotation.Resource; 12 | 13 | /** 14 | * 15 | */ 16 | @Slf4j 17 | @Component 18 | public class DeviceOtherListen { 19 | 20 | @Resource 21 | private DeviceOtherMsgConsumer otherMsgConsumer; 22 | 23 | @Async(DaConstant.TASK.DEVICE_OTHER_TASK) 24 | public void listen(){ 25 | while (true){ 26 | try { 27 | DeviceReportBo reportBo = DeviceOtherQueue.take(); 28 | otherMsgConsumer.consume(reportBo); 29 | }catch (Exception e){ 30 | log.error("=>emq数据转发异常"); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/redischannel/listen/DeviceStatusListen.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.redischannel.listen; 2 | 3 | import com.webVueBlog.common.constant.DaConstant; 4 | import com.webVueBlog.common.core.mq.DeviceStatusBo; 5 | import com.webVueBlog.mq.redischannel.consumer.DeviceStatusConsumer; 6 | import com.webVueBlog.mq.redischannel.queue.DeviceStatusQueue; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.scheduling.annotation.Async; 10 | import org.springframework.stereotype.Component; 11 | 12 | /** 13 | * 设备状态监听 14 | * 15 | */ 16 | @Slf4j 17 | @Component 18 | public class DeviceStatusListen { 19 | 20 | @Autowired 21 | private DeviceStatusConsumer deviceStatusConsumer; 22 | 23 | @Async(DaConstant.TASK.MESSAGE_CONSUME_TASK) 24 | public void listen() { 25 | try { 26 | while (true) { 27 | DeviceStatusBo status = DeviceStatusQueue.take(); 28 | deviceStatusConsumer.consume(status); 29 | } 30 | } catch (Exception e) { 31 | log.error("设备状态监听错误", e); 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/redischannel/listen/FunctionInvokeListen.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.redischannel.listen; 2 | 3 | import com.webVueBlog.common.constant.DaConstant; 4 | import com.webVueBlog.common.core.mq.MQSendMessageBo; 5 | import com.webVueBlog.mq.redischannel.consumer.FunctionInvokeConsumer; 6 | import com.webVueBlog.mq.redischannel.queue.FunctionInvokeQueue; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.scheduling.annotation.Async; 10 | import org.springframework.stereotype.Component; 11 | 12 | /** 13 | * 设备服务下发监听 14 | * 15 | * 16 | */ 17 | @Slf4j 18 | @Component 19 | public class FunctionInvokeListen { 20 | 21 | @Autowired 22 | private FunctionInvokeConsumer functionInvokeConsumer; 23 | 24 | @Async(DaConstant.TASK.MESSAGE_CONSUME_TASK) 25 | public void listen() { 26 | while (true) { 27 | try { 28 | MQSendMessageBo sendBo = FunctionInvokeQueue.take(); 29 | functionInvokeConsumer.handler(sendBo); 30 | } catch (Exception e) { 31 | log.error("=>下发服务消费异常", e); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/redischannel/listen/UpgradeListen.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.redischannel.listen; 2 | 3 | import com.webVueBlog.common.constant.DaConstant; 4 | import com.webVueBlog.common.core.mq.ota.OtaUpgradeBo; 5 | import com.webVueBlog.mq.redischannel.queue.OtaUpgradeQueue; 6 | import com.webVueBlog.mq.service.IMqttMessagePublish; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.scheduling.annotation.Async; 10 | import org.springframework.stereotype.Service; 11 | 12 | /** 13 | * OTA升级消息监听 14 | * 15 | * 16 | */ 17 | @Slf4j 18 | @Service 19 | public class UpgradeListen { 20 | 21 | @Autowired 22 | private IMqttMessagePublish functionSendService; 23 | 24 | @Async(DaConstant.TASK.MESSAGE_CONSUME_TASK) 25 | public void listen() { 26 | while (true) { 27 | try { 28 | /*获取队列中的OTA升级消息*/ 29 | OtaUpgradeBo upgradeBo = OtaUpgradeQueue.take(); 30 | // OTA升级处理 31 | functionSendService.upGradeOTA(upgradeBo); 32 | } catch (Exception e) { 33 | log.error("->OTA消息监听异常", e); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/redischannel/queue/DeviceOtherQueue.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.redischannel.queue; 2 | 3 | import com.webVueBlog.common.core.mq.DeviceReportBo; 4 | import lombok.SneakyThrows; 5 | 6 | import java.util.concurrent.LinkedBlockingQueue; 7 | 8 | /** 9 | * 10 | */ 11 | public class DeviceOtherQueue { 12 | 13 | private static final LinkedBlockingQueue queue = new LinkedBlockingQueue<>(); 14 | 15 | /*元素加入队列,最后*/ 16 | public static void offer(DeviceReportBo dto){ 17 | queue.offer(dto); 18 | } 19 | /*取出队列元素 先进先出*/ 20 | @SneakyThrows 21 | public static DeviceReportBo take(){ 22 | return queue.take(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/redischannel/queue/DevicePropFetchQueue.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.redischannel.queue; 2 | 3 | import com.webVueBlog.common.core.mq.DeviceReportBo; 4 | import com.webVueBlog.common.core.mq.message.DeviceDownMessage; 5 | import lombok.SneakyThrows; 6 | 7 | import java.util.concurrent.LinkedBlockingQueue; 8 | 9 | /** 10 | * 设备属性获取存储列队 11 | * 12 | */ 13 | public class DevicePropFetchQueue { 14 | private static final LinkedBlockingQueue queue = new LinkedBlockingQueue<>(); 15 | 16 | /*元素加入队列,最后*/ 17 | public static void offer(DeviceDownMessage dto){ 18 | queue.offer(dto); 19 | } 20 | /*取出队列元素 先进先出*/ 21 | @SneakyThrows 22 | public static DeviceDownMessage take(){ 23 | return queue.take(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/redischannel/queue/DeviceReplyQueue.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.redischannel.queue; 2 | 3 | import com.webVueBlog.common.core.mq.DeviceReportBo; 4 | import lombok.SneakyThrows; 5 | 6 | import java.util.concurrent.LinkedBlockingQueue; 7 | 8 | /** 9 | * 设备消息回调队列 {@link DeviceReportBo} 10 | * 11 | */ 12 | public class DeviceReplyQueue { 13 | private static final LinkedBlockingQueue queue = new LinkedBlockingQueue<>(); 14 | 15 | /*元素加入队列,最后*/ 16 | public static void offer(DeviceReportBo dto){ 17 | queue.offer(dto); 18 | } 19 | /*取出队列元素 先进先出*/ 20 | @SneakyThrows 21 | public static DeviceReportBo take(){ 22 | return queue.take(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/redischannel/queue/DeviceReportQueue.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.redischannel.queue; 2 | 3 | import com.webVueBlog.common.core.mq.DeviceReportBo; 4 | import lombok.SneakyThrows; 5 | 6 | import java.util.concurrent.LinkedBlockingQueue; 7 | 8 | /** 9 | * 10 | */ 11 | public class DeviceReportQueue { 12 | 13 | private static final LinkedBlockingQueue queue = new LinkedBlockingQueue<>(); 14 | 15 | /*元素加入队列,最后*/ 16 | public static void offer(DeviceReportBo dto){ 17 | queue.offer(dto); 18 | } 19 | /*取出队列元素 先进先出*/ 20 | @SneakyThrows 21 | public static DeviceReportBo take(){ 22 | return queue.take(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/redischannel/queue/DeviceStatusQueue.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.redischannel.queue; 2 | 3 | import com.webVueBlog.common.core.mq.DeviceStatusBo; 4 | import lombok.SneakyThrows; 5 | 6 | import java.util.concurrent.LinkedBlockingQueue; 7 | 8 | /** 9 | * 设备消息缓存队列 添加{@link DeviceStatusBo} 消息 10 | * 11 | */ 12 | public class DeviceStatusQueue { 13 | private static final LinkedBlockingQueue queue = new LinkedBlockingQueue<>(); 14 | 15 | /*元素加入队列,最后*/ 16 | public static void offer(DeviceStatusBo dto){ 17 | queue.offer(dto); 18 | } 19 | /*取出队列元素 先进先出*/ 20 | @SneakyThrows 21 | public static DeviceStatusBo take(){ 22 | return queue.take(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/redischannel/queue/FunctionInvokeQueue.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.redischannel.queue; 2 | 3 | import com.webVueBlog.common.core.mq.MQSendMessageBo; 4 | import lombok.SneakyThrows; 5 | 6 | import java.util.concurrent.LinkedBlockingQueue; 7 | 8 | /** 9 | * 服务下发队列 处理{@link MQSendMessageBo} 10 | * 11 | */ 12 | public class FunctionInvokeQueue { 13 | private static final LinkedBlockingQueue queue = new LinkedBlockingQueue<>(); 14 | 15 | /*元素加入队列,最后*/ 16 | public static void offer(MQSendMessageBo dto){ 17 | queue.offer(dto); 18 | } 19 | /*取出队列元素 先进先出*/ 20 | @SneakyThrows 21 | public static MQSendMessageBo take(){ 22 | return queue.take(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/redischannel/queue/OtaUpgradeQueue.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.redischannel.queue; 2 | 3 | import com.webVueBlog.common.core.mq.ota.OtaUpgradeBo; 4 | import lombok.SneakyThrows; 5 | 6 | import java.util.concurrent.LinkedBlockingQueue; 7 | 8 | /** 9 | * OTA升级列队 {@link OtaUpgradeBo} 10 | * 11 | */ 12 | public class OtaUpgradeQueue { 13 | private static final LinkedBlockingQueue queue = new LinkedBlockingQueue<>(); 14 | 15 | /*元素加入队列,最后*/ 16 | public static void offer(OtaUpgradeBo dto){ 17 | queue.offer(dto); 18 | } 19 | /*取出队列元素 先进先出*/ 20 | @SneakyThrows 21 | public static OtaUpgradeBo take(){ 22 | return queue.take(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/redischannel/service/RedisPublishServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.redischannel.service; 2 | 3 | import com.webVueBlog.common.core.redis.RedisCache; 4 | import com.webVueBlog.mq.service.IMessagePublishService; 5 | import lombok.NoArgsConstructor; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | 8 | /** 9 | * 设备消息推送至RedisChannel 10 | * 11 | */ 12 | @NoArgsConstructor 13 | public class RedisPublishServiceImpl implements IMessagePublishService { 14 | 15 | @Autowired 16 | private RedisCache redisCache; 17 | 18 | /** 19 | * 消息推送到redisChannel 20 | * @param message 设备消息 21 | * @param channel 推送channel 22 | */ 23 | @Override 24 | public void publish(Object message,String channel) { 25 | redisCache.publish(message,channel); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/service/IDataHandler.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.service; 2 | 3 | import com.webVueBlog.mq.model.ReportDataBo; 4 | 5 | /** 6 | * 客户端上报数据处理方法集合 7 | * 8 | */ 9 | public interface IDataHandler { 10 | 11 | /** 12 | * 上报属性或功能处理 13 | * 14 | * @param bo 上报数据模型 15 | */ 16 | public void reportData(ReportDataBo bo); 17 | 18 | 19 | /** 20 | * 上报事件 21 | * 22 | * @param bo 上报数据模型 23 | */ 24 | public void reportEvent(ReportDataBo bo); 25 | 26 | /** 27 | * 上报设备信息 28 | * @param bo 上报数据模型 29 | */ 30 | public void reportDevice(ReportDataBo bo); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/service/IDeviceReportMessageService.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.service; 2 | 3 | import com.webVueBlog.common.core.mq.DeviceReport; 4 | import com.webVueBlog.common.core.mq.DeviceReportBo; 5 | import com.webVueBlog.iot.domain.Device; 6 | import com.webVueBlog.protocol.base.protocol.IProtocol; 7 | 8 | /** 9 | * 处理设备上报数据解析 10 | * 11 | */ 12 | public interface IDeviceReportMessageService { 13 | 14 | /** 15 | * 处理设备主动上报数据 16 | * @param bo 17 | */ 18 | public void parseReportMsg(DeviceReportBo bo); 19 | 20 | /** 21 | * 处理设备普通消息回调 22 | * @param bo 23 | */ 24 | public void parseReplyMsg(DeviceReportBo bo); 25 | 26 | 27 | /** 28 | * 构建消息 29 | * @param bo 30 | */ 31 | public Device buildReport(DeviceReportBo bo); 32 | 33 | 34 | /** 35 | * 根据产品id获取协议处理器 36 | */ 37 | IProtocol selectedProtocol(Long productId); 38 | 39 | /** 40 | * 处理设备主动上报属性 41 | * 42 | * @param topicName 43 | * @param message 44 | */ 45 | public void handlerReportMessage(DeviceReport message, String topicName); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/service/IFunctionInvoke.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.service; 2 | 3 | import com.webVueBlog.common.core.mq.InvokeReqDto; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * 设备指令下发接口 9 | * 10 | */ 11 | public interface IFunctionInvoke { 12 | 13 | /** 14 | * 服务调用,等待设备响应 15 | * @param reqDto 服务下发对象 16 | * @return 数据结果 17 | */ 18 | public Map invokeReply(InvokeReqDto reqDto); 19 | 20 | /** 21 | * 服务调用,设备不响应 22 | * @param reqDto 服务下发对象 23 | * @return 消息id messageId 24 | */ 25 | public String invokeNoReply(InvokeReqDto reqDto); 26 | } 27 | -------------------------------------------------------------------------------- /springboot/webVueBlog-gateway/webVueBlog-mq/src/main/java/com/webVueBlog/mq/service/IMessagePublishService.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mq.service; 2 | 3 | import com.webVueBlog.common.core.mq.message.DeviceMessage; 4 | 5 | /** 6 | * 设备消息推送mq 7 | * 8 | */ 9 | public interface IMessagePublishService { 10 | 11 | 12 | /** 13 | * 发布消息到mq 14 | * @param message 设备消息 15 | * @param channel 推送channel 16 | */ 17 | public void publish(Object message,String channel); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /springboot/webVueBlog-open-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | webVueBlog 7 | com.webVueBlog 8 | 3.8.5 9 | 10 | 11 | 12 | webVueBlog-open-api 13 | controller层接口 14 | 15 | 16 | 17 | com.webVueBlog 18 | mqtt-broker 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /springboot/webVueBlog-open-api/src/main/java/com/webVueBlog/data/config/DelayUpgradeQueue.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.data.config; 2 | 3 | import com.webVueBlog.common.core.mq.ota.OtaUpgradeDelayTask; 4 | import lombok.extern.slf4j.Slf4j; 5 | 6 | import java.util.concurrent.DelayQueue; 7 | 8 | /** 9 | * OTA延迟升级队列 10 | * 11 | */ 12 | @Slf4j 13 | public class DelayUpgradeQueue { 14 | 15 | /** 16 | * 使用springboot的 DelayQueue 实现延迟队列(OTA对单个设备延迟升级,提高升级容错率) 17 | */ 18 | private static DelayQueue queue = new DelayQueue<>();// 延迟队列 19 | 20 | public static void offerTask(OtaUpgradeDelayTask task) {// 生产者生产任务 21 | try { 22 | queue.offer(task);// 添加任务到队列中 23 | log.info("=>OTA任务添加成功"); 24 | } catch (Exception e) { 25 | log.error("OTA任务推送异常", e); 26 | } 27 | } 28 | 29 | public static OtaUpgradeDelayTask task() {// 消费者获取任务 30 | log.info("=>OTA任务获取"); 31 | try { 32 | return queue.take();// 获取队列中的任务 33 | } catch (Exception exception) { 34 | log.error("=>OTA任务获取异常"); 35 | return null; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /springboot/webVueBlog-open-api/src/main/java/com/webVueBlog/data/config/TaskConfig.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.data.config; 2 | 3 | public class TaskConfig {// 定时任务配置类 4 | } 5 | -------------------------------------------------------------------------------- /springboot/webVueBlog-open-api/src/main/java/com/webVueBlog/data/controller/AuthResourceController.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.data.controller; 2 | 3 | import com.webVueBlog.common.core.controller.BaseController; 4 | import org.springframework.web.bind.annotation.*; 5 | 6 | /** 7 | * 设备告警Controller 8 | * 9 | * 10 | * 11 | */ 12 | @RestController 13 | @RequestMapping("/oauth/resource") 14 | public class AuthResourceController extends BaseController 15 | { 16 | /** 17 | * 查询设备告警列表 18 | */ 19 | @GetMapping("/product") 20 | public String findAll() { 21 | return "查询产品列表成功!"; 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /springboot/webVueBlog-open-api/src/main/java/com/webVueBlog/data/quartz/QuartzDisallowConcurrentExecution.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.data.quartz; 2 | 3 | import com.webVueBlog.iot.domain.DeviceJob; 4 | import org.quartz.DisallowConcurrentExecution; 5 | import org.quartz.JobExecutionContext; 6 | 7 | /** 8 | * 定时任务处理(禁止并发执行) 9 | * 10 | * 11 | * 12 | */ 13 | @DisallowConcurrentExecution 14 | public class QuartzDisallowConcurrentExecution extends AbstractQuartzJob 15 | { 16 | @Override 17 | protected void doExecute(JobExecutionContext context, DeviceJob deviceJob) throws Exception 18 | { 19 | JobInvokeUtil.invokeMethod(deviceJob); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /springboot/webVueBlog-open-api/src/main/java/com/webVueBlog/data/quartz/QuartzJobExecution.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.data.quartz; 2 | 3 | import com.webVueBlog.iot.domain.DeviceJob; 4 | import org.quartz.JobExecutionContext; 5 | 6 | /** 7 | * 定时任务处理(允许并发执行) 8 | * 9 | * 10 | * 11 | */ 12 | public class QuartzJobExecution extends AbstractQuartzJob 13 | { 14 | @Override 15 | protected void doExecute(JobExecutionContext context, DeviceJob deviceJob) throws Exception 16 | { 17 | JobInvokeUtil.invokeMethod(deviceJob); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /springboot/webVueBlog-open-api/src/main/java/com/webVueBlog/data/service/IPropGetService.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.data.service; 2 | 3 | public interface IPropGetService { 4 | 5 | /** 6 | * 属性读取 7 | */ 8 | public void fetchProperty();// 属性读取 9 | 10 | } 11 | -------------------------------------------------------------------------------- /springboot/webVueBlog-plugs/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | webVueBlog 7 | com.webVueBlog 8 | 3.8.5 9 | 10 | 11 | pom 12 | webVueBlog-plugs 13 | 插件工具类整合 14 | 15 | 16 | webVueBlog-quartz 17 | webVueBlog-generator 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /springboot/webVueBlog-plugs/webVueBlog-generator/src/main/java/com/webVueBlog/generator/service/IGenTableColumnService.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.generator.service; 2 | 3 | import java.util.List; 4 | import com.webVueBlog.generator.domain.GenTableColumn; 5 | 6 | /** 7 | * 业务字段 服务层 8 | * 9 | * 10 | */ 11 | public interface IGenTableColumnService 12 | { 13 | /** 14 | * 查询业务字段列表 15 | * 16 | * @param tableId 业务字段编号 17 | * @return 业务字段集合 18 | */ 19 | public List selectGenTableColumnListByTableId(Long tableId); 20 | 21 | /** 22 | * 新增业务字段 23 | * 24 | * @param genTableColumn 业务字段信息 25 | * @return 结果 26 | */ 27 | public int insertGenTableColumn(GenTableColumn genTableColumn); 28 | 29 | /** 30 | * 修改业务字段 31 | * 32 | * @param genTableColumn 业务字段信息 33 | * @return 结果 34 | */ 35 | public int updateGenTableColumn(GenTableColumn genTableColumn); 36 | 37 | /** 38 | * 删除业务字段信息 39 | * 40 | * @param ids 需要删除的数据ID 41 | * @return 结果 42 | */ 43 | public int deleteGenTableColumnByIds(String ids); 44 | } 45 | -------------------------------------------------------------------------------- /springboot/webVueBlog-plugs/webVueBlog-generator/src/main/java/com/webVueBlog/generator/util/VelocityInitializer.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.generator.util; 2 | 3 | import java.util.Properties; 4 | import org.apache.velocity.app.Velocity; 5 | import com.webVueBlog.common.constant.Constants; 6 | 7 | /** 8 | * VelocityEngine工厂 9 | * 10 | * 11 | */ 12 | public class VelocityInitializer 13 | { 14 | /** 15 | * 初始化vm方法 16 | */ 17 | public static void initVelocity() 18 | { 19 | Properties p = new Properties(); 20 | try 21 | { 22 | // 加载classpath目录下的vm文件 23 | p.setProperty("resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); 24 | // 定义字符集 25 | p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8); 26 | // 初始化Velocity引擎,指定配置Properties 27 | Velocity.init(p); 28 | } 29 | catch (Exception e) 30 | { 31 | throw new RuntimeException(e); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /springboot/webVueBlog-plugs/webVueBlog-generator/src/main/resources/generator.yml: -------------------------------------------------------------------------------- 1 | # 代码生成 2 | gen: 3 | # 作者 4 | author: webVueBlog 5 | # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool 6 | packageName: com.webVueBlog.iot 7 | # 自动去除表前缀,默认是false 8 | autoRemovePre: true 9 | # 表前缀(生成类名不会包含表前缀,多个用逗号分隔) 10 | tablePrefix: iot_ -------------------------------------------------------------------------------- /springboot/webVueBlog-plugs/webVueBlog-quartz/src/main/java/com/webVueBlog/quartz/task/RyTask.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.quartz.task; 2 | 3 | import org.springframework.stereotype.Component; 4 | import com.webVueBlog.common.utils.StringUtils; 5 | 6 | /** 7 | * 定时任务调度测试 8 | * 9 | * 10 | */ 11 | @Component("ryTask") 12 | public class RyTask 13 | { 14 | public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) 15 | { 16 | System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); 17 | } 18 | 19 | public void ryParams(String params) 20 | { 21 | System.out.println("执行有参方法:" + params); 22 | } 23 | 24 | public void ryNoParams() 25 | { 26 | System.out.println("执行无参方法"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /springboot/webVueBlog-plugs/webVueBlog-quartz/src/main/java/com/webVueBlog/quartz/util/QuartzDisallowConcurrentExecution.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.quartz.util; 2 | 3 | import org.quartz.DisallowConcurrentExecution; 4 | import org.quartz.JobExecutionContext; 5 | import com.webVueBlog.quartz.domain.SysJob; 6 | 7 | /** 8 | * 定时任务处理(禁止并发执行) 9 | * 10 | * 11 | * 12 | */ 13 | @DisallowConcurrentExecution 14 | public class QuartzDisallowConcurrentExecution extends AbstractQuartzJob 15 | { 16 | @Override 17 | protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception 18 | { 19 | JobInvokeUtil.invokeMethod(sysJob); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /springboot/webVueBlog-plugs/webVueBlog-quartz/src/main/java/com/webVueBlog/quartz/util/QuartzJobExecution.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.quartz.util; 2 | 3 | import org.quartz.JobExecutionContext; 4 | import com.webVueBlog.quartz.domain.SysJob; 5 | 6 | /** 7 | * 定时任务处理(允许并发执行) 8 | * 9 | * 10 | * 11 | */ 12 | public class QuartzJobExecution extends AbstractQuartzJob 13 | { 14 | @Override 15 | protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception 16 | { 17 | JobInvokeUtil.invokeMethod(sysJob); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | webVueBlog 7 | com.webVueBlog 8 | 3.8.5 9 | 10 | webVueBlog-protocol 11 | 设备协议模块 12 | pom 13 | 14 | webVueBlog-protocol-base 15 | webVueBlog-protocol-collect 16 | 17 | 18 | 19 | com.webVueBlog 20 | webVueBlog-common 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/webVueBlog-protocol-base/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | webVueBlog-protocol 7 | com.webVueBlog 8 | 3.8.5 9 | 10 | 网关协议管理模块 11 | webVueBlog-protocol-base 12 | 13 | 14 | com.webVueBlog 15 | webVueBlog-iot-service 16 | 17 | 18 | com.webVueBlog 19 | base-server 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/webVueBlog-protocol-base/src/main/java/com/webVueBlog/protocol/PrepareLoadStore.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.protocol; 2 | 3 | import com.webVueBlog.protocol.base.model.WModel; 4 | import com.webVueBlog.protocol.util.SingleVersionUtils; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | import java.util.TreeMap; 9 | 10 | public class PrepareLoadStore { 11 | 12 | private final Map models = new TreeMap<>();// 有序的map 13 | 14 | public PrepareLoadStore addSchema(T key, WModel schema) {// 有序的map 15 | models.put(key, schema);// 有序的map 16 | return this;// 有序的map 17 | } 18 | 19 | public PrepareLoadStore addSchema(T key, Class typeClass) {// 有序的map 20 | WModel model = SingleVersionUtils.getActiveModel(typeClass);// 有序的map 21 | models.put(key, model);// 有序的map 22 | return this;// 有序的map 23 | } 24 | 25 | public Map build() { 26 | Map a = new HashMap<>(models.size()); 27 | a.putAll(models); 28 | return a; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/webVueBlog-protocol-base/src/main/java/com/webVueBlog/protocol/base/annotation/Columns.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.protocol.base.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target(ElementType.FIELD) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface Columns { 11 | 12 | Column[] value();// 列的数组 13 | } 14 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/webVueBlog-protocol-base/src/main/java/com/webVueBlog/protocol/base/annotation/MergeSubClass.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.protocol.base.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 将父类字段合并到子类 7 | */ 8 | @Target(ElementType.TYPE) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Documented 11 | public @interface MergeSubClass { 12 | 13 | /** 14 | * 合并父类属性到当前类属性前 15 | */ 16 | boolean addBefore() default false;// 合并父类属性到当前类属性前 17 | } 18 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/webVueBlog-protocol-base/src/main/java/com/webVueBlog/protocol/base/annotation/Protocol.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.protocol.base.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 协议类型标注 7 | */ 8 | @Inherited 9 | @Target(ElementType.TYPE) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Documented 12 | public @interface Protocol { 13 | 14 | int[] value() default {};//协议类型 15 | 16 | String desc() default ""; 17 | } 18 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/webVueBlog-protocol-base/src/main/java/com/webVueBlog/protocol/base/message/MessageBody.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.protocol.base.message; 2 | 3 | /** 4 | * 通用消息体 5 | */ 6 | public interface MessageBody { 7 | 8 | /** 9 | * 消息体 10 | * @return 11 | */ 12 | byte[] getPayload();// 消息体 13 | 14 | /** 15 | * 消息体长度 16 | * @return 17 | */ 18 | default int getLength(){ 19 | return getPayload().length;// 消息体长度 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/webVueBlog-protocol-base/src/main/java/com/webVueBlog/protocol/base/message/MessageHead.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.protocol.base.message; 2 | 3 | /** 4 | * 消息头 5 | */ 6 | public interface MessageHead { 7 | 8 | /** 9 | * 设备编号 modbus对应从机编号 10 | * @return 11 | */ 12 | String getSerialNumber(); 13 | 14 | /** 15 | * 设置设备编号 16 | * @param serialNumber 17 | */ 18 | MessageHead setSerialNumber(String serialNumber); 19 | 20 | /** 21 | * 获取消息ID 22 | * @return 23 | */ 24 | String getMessageId(); 25 | 26 | /** 27 | * 设置消息id 28 | * @param messageId 消息ID 29 | * @return 30 | */ 31 | MessageHead setMessageId(String messageId); 32 | 33 | /** 34 | * 消息头data 35 | * @return 36 | */ 37 | byte[] getMessage(); 38 | 39 | /** 40 | * 消息头长度 41 | * @return 42 | */ 43 | default int getLength() { 44 | return getMessage().length; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/webVueBlog-protocol-base/src/main/java/com/webVueBlog/protocol/base/protocol/IProtocol.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.protocol.base.protocol; 2 | 3 | 4 | import com.webVueBlog.common.core.mq.DeviceReport; 5 | import com.webVueBlog.common.core.mq.message.DeviceData; 6 | 7 | /** 8 | * 基础协议 9 | */ 10 | public interface IProtocol { 11 | 12 | DeviceReport decode(DeviceData data, String clientId);// 解码 13 | 14 | byte[] encode(DeviceData message, String clientId);// 编码 15 | 16 | } 17 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/webVueBlog-protocol-base/src/main/java/com/webVueBlog/protocol/domain/DeviceProtocol.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.protocol.domain; 2 | 3 | import com.webVueBlog.protocol.base.protocol.IProtocol; 4 | import lombok.Data; 5 | 6 | /** 7 | * 设备协议model 8 | */ 9 | @Data 10 | public class DeviceProtocol { 11 | 12 | /**协议实例*/ 13 | private IProtocol protocol; 14 | 15 | /**产品id*/ 16 | private Long productId; 17 | 18 | /**设备编号*/ 19 | private String serialNumber; 20 | } 21 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/webVueBlog-protocol-base/src/main/java/com/webVueBlog/protocol/enums/ModbusBitStatus.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.protocol.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * 位定义 0-关闭 1-k开启 ,如果不同状态清重写 8 | */ 9 | @Getter 10 | @AllArgsConstructor 11 | public enum ModbusBitStatus { 12 | 13 | OPEN((byte) 0x01),// 0-关闭 1-k开启 14 | CLOSED((byte) 0x00)/* 0-关闭 1-k开启 */ 15 | ; 16 | private byte bit; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/webVueBlog-protocol-base/src/main/java/com/webVueBlog/protocol/enums/ModbusCoilStatus.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.protocol.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * 线圈状态 8 | */ 9 | @Getter 10 | @AllArgsConstructor 11 | public enum ModbusCoilStatus { 12 | 13 | //线圈开启 14 | ON(new byte[] {(byte) 0xFF, 0x00}), 15 | //线圈关闭 16 | OFF(new byte[] {0x00, 0x00}) 17 | ; 18 | private byte[] data; 19 | } 20 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/webVueBlog-protocol-base/src/main/java/com/webVueBlog/protocol/service/IProtocolManagerService.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.protocol.service; 2 | 3 | import com.webVueBlog.common.core.mq.message.ProtocolDto; 4 | import com.webVueBlog.protocol.base.protocol.IProtocol; 5 | import com.webVueBlog.protocol.domain.DeviceProtocol; 6 | 7 | import java.util.List; 8 | 9 | public interface IProtocolManagerService { 10 | 11 | /** 12 | *获取所有的协议,包含脚本解析协议和系统内部定义协议 13 | */ 14 | public List getAllProtocols(); 15 | 16 | /** 17 | * 根据协议编码获取系统内部协议 18 | * @param protocolCode 协议编码 19 | * @return 协议 20 | */ 21 | IProtocol getProtocolByProtocolCode(String protocolCode); 22 | 23 | /** 24 | * 根据设备编号获取系统内部协议实例 25 | * @param serialNumber 产品编号 26 | * @return 协议实例 27 | */ 28 | DeviceProtocol getProtocolBySerialNumber(String serialNumber); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/webVueBlog-protocol-base/src/main/java/com/webVueBlog/protocol/util/KeyValuePair.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.protocol.util; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * 键值对 7 | */ 8 | public class KeyValuePair implements Map.Entry { 9 | 10 | private K key; 11 | private V value; 12 | 13 | public KeyValuePair() { 14 | } 15 | 16 | public KeyValuePair(K key) { 17 | this.key = key; 18 | } 19 | 20 | @Override 21 | public K getKey() { 22 | return key; 23 | } 24 | 25 | public void setKey(K key) { 26 | this.key = key; 27 | } 28 | 29 | @Override 30 | public V getValue() { 31 | return value; 32 | } 33 | 34 | @Override 35 | public V setValue(V value) { 36 | this.value = value; 37 | return value; 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | final StringBuilder sb = new StringBuilder(32); 43 | sb.append("KeyValuePair{key=").append(key); 44 | sb.append(", value=").append(value); 45 | sb.append('}'); 46 | return sb.toString(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/webVueBlog-protocol-collect/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | webVueBlog-protocol 7 | com.webVueBlog 8 | 3.8.5 9 | 10 | webVueBlog-protocol-collect 11 | 12 | 13 | com.webVueBlog 14 | webVueBlog-protocol-base 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/webVueBlog-protocol-collect/src/main/java/com/webVueBlog/common/ProtocolColl.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.common; 2 | 3 | import com.webVueBlog.protocol.base.protocol.IProtocol; 4 | import lombok.Data; 5 | 6 | @Data 7 | public class ProtocolColl {// 协议集合 8 | 9 | private IProtocol protocol;// 协议 10 | 11 | private Long productId;// 产品id 12 | } 13 | -------------------------------------------------------------------------------- /springboot/webVueBlog-protocol/webVueBlog-protocol-collect/src/main/java/com/webVueBlog/jsonPak/pak/JsonEndPoint.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.jsonPak.pak; 2 | 3 | import com.webVueBlog.base.core.annotation.Node; 4 | import com.webVueBlog.base.core.annotation.PakMapping; 5 | import com.webVueBlog.base.session.Session; 6 | import com.webVueBlog.common.core.mq.DeviceReport; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.stereotype.Component; 9 | 10 | @Node 11 | @Component 12 | @Slf4j 13 | public class JsonEndPoint { 14 | 15 | 16 | @PakMapping(types = 0) 17 | public void register(DeviceReport message, Session session){ 18 | // 注册设备 19 | session.register(message); 20 | //String callback = "{\"pak_ty\":\"set_inf\",\"cj_s\":null,\"up_s\":3600,\"xt_s\":3600,\"x_yz\":500,\"y_yz\":500,\"z_yz\":500,\"nian\":2022,\"yue\":3,\"ri\":25,\"shi\":12,\"fen\":23,\"miao\":33}"; 21 | //message.setBody(callback); 22 | //return message; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | webVueBlog-server 7 | com.webVueBlog 8 | 3.8.5 9 | 10 | 11 | base-server 12 | 13 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/codec/Delimiter.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.codec; 2 | 3 | /** 4 | * 分隔符报文处理器 5 | * 处理分割符报文,tcp粘包处理 6 | * 7 | */ 8 | public class Delimiter { 9 | 10 | public final byte[] value; 11 | public final boolean strip; 12 | 13 | public Delimiter(byte[] value) { 14 | this(value, true); 15 | } 16 | 17 | public Delimiter(byte[] value, boolean strip) { 18 | this.value = value; 19 | this.strip = strip; 20 | } 21 | 22 | public byte[] getValue() { 23 | return value; 24 | } 25 | 26 | public boolean isStrip() { 27 | return strip; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/codec/MessageDecoder.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.codec; 2 | 3 | 4 | import com.webVueBlog.common.core.mq.DeviceReport; 5 | import io.netty.buffer.ByteBuf; 6 | 7 | /** 8 | * 基础消息解码类 9 | * 10 | * 11 | */ 12 | public interface MessageDecoder { 13 | 14 | /** 15 | * TCP3.进站消息解码方法 16 | */ 17 | DeviceReport decode(ByteBuf buf, String clientId); 18 | } -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/codec/MessageEncoder.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.codec; 2 | 3 | import com.webVueBlog.common.core.protocol.Message; 4 | import com.webVueBlog.base.session.Session; 5 | import io.netty.buffer.ByteBuf; 6 | 7 | /** 8 | * 基础消息编码类 9 | * 10 | * 11 | */ 12 | public interface MessageEncoder{ 13 | 14 | ByteBuf encode(Message message, String clientId); 15 | } 16 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/core/DefaultHandlerMapping.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.core; 2 | 3 | import com.webVueBlog.base.core.annotation.Node; 4 | import com.webVueBlog.base.util.ClassUtils; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 默认消息映射处理类 10 | * 11 | */ 12 | public class DefaultHandlerMapping extends AbstractHandlerMapping { 13 | 14 | public DefaultHandlerMapping(String endpointPackage) { 15 | List endpointClasses = ClassUtils.getClassList(endpointPackage, Node.class); 16 | 17 | for (Class endpointClass : endpointClasses) { 18 | try { 19 | Object bean = endpointClass.getDeclaredConstructor((Class[]) null).newInstance((Object[]) null); 20 | super.registerHandlers(bean); 21 | } catch (Exception e) { 22 | throw new RuntimeException(e); 23 | } 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/core/HandlerInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.core; 2 | 3 | 4 | import com.webVueBlog.common.core.protocol.Message; 5 | import com.webVueBlog.base.session.Session; 6 | 7 | /** 8 | * 消息拦截器 9 | * 10 | */ 11 | public interface HandlerInterceptor { 12 | 13 | /** 14 | * 未匹配到对应的Handle(消息处理) 15 | */ 16 | T notSupported(T request, Session session); 17 | 18 | /** 19 | * 调用之前 20 | * 处理消息类型匹配 21 | */ 22 | boolean beforeHandle(T request, Session session); 23 | 24 | /** 25 | * 需要应答设备,在这里执行 26 | * 调用之后,返回值为void的 */ 27 | T successful(T request, Session session); 28 | 29 | /** 调用之后,有返回值的 */ 30 | void afterHandle(T request, T response, Session session); 31 | 32 | /** 33 | * 报错应答方法 34 | * 调用之后抛出异常的 35 | */ 36 | T exceptional(T request, Session session, Exception e); 37 | } 38 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/core/HandlerMapping.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.core; 2 | 3 | import com.webVueBlog.base.core.hanler.BaseHandler; 4 | 5 | /** 6 | * 消息处理接口 7 | * 8 | */ 9 | public interface HandlerMapping { 10 | 11 | BaseHandler getHandler(int messageId); 12 | } 13 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/core/SpringHandlerMapping.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.core; 2 | 3 | import com.webVueBlog.base.core.annotation.Node; 4 | import org.springframework.beans.BeansException; 5 | import org.springframework.context.ApplicationContext; 6 | import org.springframework.context.ApplicationContextAware; 7 | 8 | import java.util.Map; 9 | 10 | /** 11 | * 12 | * 13 | */ 14 | public class SpringHandlerMapping extends AbstractHandlerMapping implements ApplicationContextAware { 15 | 16 | @Override 17 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 18 | Map endpoints = applicationContext.getBeansWithAnnotation(Node.class); 19 | for (Object bean : endpoints.values()) { 20 | super.registerHandlers(bean); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/core/annotation/Async.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.core.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 异步处理设备数据 7 | * 8 | * 9 | */ 10 | @Target({ElementType.METHOD}) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Documented 13 | public @interface Async { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/core/annotation/AsyncBatch.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.core.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 多线程异步处理设备数据,新建线程组处理 7 | * 8 | * 9 | */ 10 | @Target({ElementType.METHOD}) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Documented 13 | public @interface AsyncBatch { 14 | 15 | /*批量处理的最大消息数*/ 16 | int maxMessageSize() default 5000; 17 | 18 | /*线程数*/ 19 | int poolSize() default 2; 20 | 21 | /*最大等待时间*/ 22 | int maxWaitTime() default 1000; 23 | 24 | /*最小处理消息数*/ 25 | int minMessageSize() default 100; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/core/annotation/Node.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.core.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 消息节点 7 | * 8 | */ 9 | @Target({ElementType.TYPE}) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Documented 12 | public @interface Node { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/core/annotation/PakMapping.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.core.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 字段映射 7 | * 8 | */ 9 | @Target({ElementType.METHOD}) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Documented 12 | public @interface PakMapping { 13 | 14 | int[] types(); 15 | 16 | String desc() default ""; 17 | } 18 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/core/hanler/SyncHandler.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.core.hanler; 2 | 3 | import com.webVueBlog.common.core.protocol.Message; 4 | import com.webVueBlog.base.session.Session; 5 | 6 | 7 | import java.lang.reflect.Method; 8 | 9 | /** 10 | * 同步处理报文 11 | * 12 | */ 13 | public class SyncHandler extends BaseHandler{ 14 | 15 | public SyncHandler(Object target, Method targetMethod, String desc,boolean async) { 16 | super(target, targetMethod, desc, async); 17 | } 18 | 19 | @Override 20 | public T invoke(T request, Session session) throws Exception { 21 | return super.invoke(request, session); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/core/model/Response.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.core.model; 2 | 3 | /** 4 | * 消息流水号响应 5 | * 6 | */ 7 | public interface Response { 8 | 9 | /**应答消息流水号*/ 10 | int getResponseSerialNo(); 11 | } 12 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/model/DeviceMsg.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 7 | */ 8 | @Data 9 | public class DeviceMsg { 10 | 11 | protected String clientId; 12 | 13 | protected Long deviceId; 14 | 15 | private int protocolVersion; 16 | 17 | private Long productId; 18 | } 19 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/model/SessionKey.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.model; 2 | 3 | import com.webVueBlog.base.session.Session; 4 | 5 | /** 6 | * 7 | */ 8 | public enum SessionKey { 9 | 10 | DeviceMsg; 11 | 12 | public static DeviceMsg getDeviceMsg(Session session){ 13 | return (DeviceMsg)session.getAttribute(SessionKey.DeviceMsg); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/session/SessionListener.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.session; 2 | 3 | /** 4 | * session监听 5 | * 6 | */ 7 | 8 | public interface SessionListener { 9 | 10 | /** 客户端建立连接 */ 11 | default void sessionCreated(Session session) { 12 | 13 | } 14 | 15 | /** 客户端完成注册或鉴权 */ 16 | default void sessionRegistered(Session session) { 17 | } 18 | 19 | /** 20 | * 客户端注销或离线 21 | */ 22 | default void sessionDestroyed(Session session) { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/util/ConcurrentStorage.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.util; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.concurrent.ConcurrentHashMap; 6 | 7 | /** 8 | * concurrentMap存储类 9 | * 10 | */ 11 | @Data 12 | public abstract class ConcurrentStorage implements Storage{ 13 | 14 | private volatile ConcurrentHashMap map; 15 | 16 | public ConcurrentStorage(){ 17 | this(new ConcurrentHashMap()); 18 | } 19 | 20 | public ConcurrentStorage(ConcurrentHashMap map){ 21 | this.map = map; 22 | } 23 | 24 | 25 | @Override 26 | public V push(K key, V value) { 27 | return map.put(key,value); 28 | } 29 | 30 | @Override 31 | public V pop(K key) { 32 | return map.get(key); 33 | } 34 | 35 | @Override 36 | public V remove(K key) { 37 | return map.remove(key); 38 | } 39 | 40 | @Override 41 | public boolean isContains(Object key) { 42 | return map.containsKey(key); 43 | } 44 | 45 | @Override 46 | public Object getStorage() { 47 | return this.map; 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/util/DeviceUtils.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.util; 2 | 3 | import com.webVueBlog.common.core.mq.DeviceStatusBo; 4 | import com.webVueBlog.common.enums.DeviceStatus; 5 | import com.webVueBlog.common.utils.DateUtils; 6 | import io.netty.channel.Channel; 7 | 8 | import java.net.InetSocketAddress; 9 | 10 | /** 11 | * 设备信息工具类 12 | * 13 | */ 14 | public class DeviceUtils { 15 | 16 | 17 | 18 | 19 | /*构造返回MQ的设备状态model*/ 20 | public static DeviceStatusBo buildStatusMsg(Channel channel, String clientId, DeviceStatus status, String ip){ 21 | InetSocketAddress address = (InetSocketAddress) channel.remoteAddress(); 22 | return DeviceStatusBo.builder() 23 | .serialNumber(clientId) 24 | .status(status) 25 | .ip(ip) 26 | .hostName(address.getHostName()) 27 | .port(address.getPort()) 28 | .timestamp(DateUtils.getNowDate()).build(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/base-server/src/main/java/com/webVueBlog/base/util/Storage.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.base.util; 2 | 3 | /** 4 | * 存储管理 5 | * 6 | */ 7 | public interface Storage { 8 | 9 | V push(K key, V value); 10 | 11 | V pop(K key); 12 | 13 | V remove(K key); 14 | 15 | boolean isContains(K key); 16 | 17 | Object getStorage(); 18 | } 19 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/boot-strap/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | webVueBlog-server 7 | com.webVueBlog 8 | 3.8.5 9 | 10 | boot-strap 11 | 网关服务启动模块 12 | 13 | 14 | 15 | 16 | com.webVueBlog 17 | mqtt-broker 18 | 19 | 20 | 21 | com.webVueBlog 22 | webVueBlog-protocol-collect 23 | 24 | 25 | com.webVueBlog 26 | base-server 27 | 3.8.5 28 | compile 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/iot-server-core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | webVueBlog-server 7 | com.webVueBlog 8 | 3.8.5 9 | 10 | 11 | iot-server-core 12 | 13 | 14 | 15 | com.webVueBlog 16 | base-server 17 | compile 18 | 19 | 20 | com.webVueBlog 21 | webVueBlog-mq 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/mqtt-broker/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | webVueBlog-server 7 | com.webVueBlog 8 | 3.8.5 9 | 10 | 11 | mqtt-broker 12 | 基于netty搭建的mqttBroker 13 | 14 | 15 | 16 | com.webVueBlog 17 | iot-server-core 18 | 19 | 20 | 21 | com.webVueBlog 22 | webVueBlog-mq 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/mqtt-broker/src/main/java/com/webVueBlog/mqtt/annotation/Process.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mqtt.annotation; 2 | 3 | import io.netty.handler.codec.mqtt.MqttMessageType; 4 | import org.springframework.stereotype.Component; 5 | 6 | import java.lang.annotation.ElementType; 7 | import java.lang.annotation.Retention; 8 | import java.lang.annotation.RetentionPolicy; 9 | import java.lang.annotation.Target; 10 | 11 | /** 12 | * 标注mqtt消息处理 13 | * 14 | */ 15 | @Target(ElementType.TYPE) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | /*自动注入bean*/ 18 | @Component 19 | public @interface Process { 20 | 21 | 22 | /*消息类型*/ 23 | MqttMessageType type() default MqttMessageType.PUBLISH; 24 | } 25 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/mqtt-broker/src/main/java/com/webVueBlog/mqtt/codec/WebSocketMqttCodec.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mqtt.codec; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import io.netty.channel.ChannelHandler; 5 | import io.netty.channel.ChannelHandlerContext; 6 | import io.netty.handler.codec.MessageToMessageCodec; 7 | import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame; 8 | import org.springframework.stereotype.Component; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * ws协议与MQTT协议编码转换 14 | * 15 | */ 16 | @ChannelHandler.Sharable 17 | @Component 18 | public class WebSocketMqttCodec extends MessageToMessageCodec { 19 | 20 | @Override 21 | protected void encode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List list) throws Exception { 22 | list.add(new BinaryWebSocketFrame(byteBuf.retain())); 23 | } 24 | 25 | @Override 26 | protected void decode(ChannelHandlerContext channelHandlerContext, BinaryWebSocketFrame binaryWebSocketFrame, List list) throws Exception { 27 | list.add(binaryWebSocketFrame.retain().content()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/mqtt-broker/src/main/java/com/webVueBlog/mqtt/handler/adapter/MqttHandler.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mqtt.handler.adapter; 2 | 3 | import io.netty.channel.ChannelHandlerContext; 4 | import io.netty.handler.codec.mqtt.MqttMessage; 5 | 6 | /** 7 | * 8 | */ 9 | public interface MqttHandler { 10 | 11 | public void handler(ChannelHandlerContext ctx, MqttMessage message); 12 | } 13 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/mqtt-broker/src/main/java/com/webVueBlog/mqtt/manager/WillMessageManager.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mqtt.manager; 2 | 3 | import com.webVueBlog.mqtt.model.WillMessage; 4 | import lombok.extern.slf4j.Slf4j; 5 | 6 | import java.util.Map; 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | /** 10 | * 遗嘱消息处理 11 | * 12 | */ 13 | @Slf4j 14 | public class WillMessageManager { 15 | 16 | private static Map map = new ConcurrentHashMap<>(); 17 | 18 | public static void push(WillMessage message){ 19 | map.put(message.getClientId(),message); 20 | } 21 | 22 | public static void pop(String clientId){ 23 | try { 24 | WillMessage message = map.get(clientId); 25 | if (null == message){ 26 | return; 27 | } 28 | ClientManager.pubTopic(message.getMessage()); 29 | }catch (Exception e){ 30 | log.error("=>发送客户端[{}],遗嘱消息异常",e.getMessage(),e); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/mqtt-broker/src/main/java/com/webVueBlog/mqtt/model/PushMessageBo.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mqtt.model; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 9 | */ 10 | @Data 11 | public class PushMessageBo implements Serializable { 12 | 13 | /*主题*/ 14 | private String topic; 15 | /*数据*/ 16 | private String message; 17 | /*消息质量*/ 18 | private int qos; 19 | 20 | private Integer value; 21 | private Integer address; 22 | private Integer slaveId; 23 | } 24 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/mqtt-broker/src/main/java/com/webVueBlog/mqtt/model/RetainMessage.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mqtt.model; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * 保留消息bo 10 | * 11 | */ 12 | @Data 13 | @Builder 14 | public class RetainMessage implements Serializable { 15 | 16 | /*主题*/ 17 | private String topic; 18 | /*数据*/ 19 | private byte[] message; 20 | /*消息质量*/ 21 | private int qos; 22 | } 23 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/mqtt-broker/src/main/java/com/webVueBlog/mqtt/model/Subscribe.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mqtt.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | 6 | /** 7 | * 订阅topic信息 8 | * 9 | */ 10 | @Data 11 | @AllArgsConstructor 12 | public class Subscribe { 13 | /*topic*/ 14 | private String topicName; 15 | /*消息质量*/ 16 | private int qos; 17 | /*客户端id*/ 18 | private String clientId; 19 | /*清楚回话*/ 20 | private boolean cleanSession; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/mqtt-broker/src/main/java/com/webVueBlog/mqtt/model/WillMessage.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mqtt.model; 2 | 3 | import io.netty.handler.codec.mqtt.MqttPublishMessage; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * 11 | */ 12 | @Data 13 | @AllArgsConstructor 14 | public class WillMessage implements Serializable { 15 | private static final long serialVersionUID = -1L; 16 | 17 | /*客户端Id*/ 18 | private String clientId; 19 | /*清楚客户端*/ 20 | private boolean cleanSession; 21 | /*topic*/ 22 | private String topic; 23 | /*客户端推送消息*/ 24 | private MqttPublishMessage message; 25 | } 26 | -------------------------------------------------------------------------------- /springboot/webVueBlog-server/mqtt-broker/src/main/java/com/webVueBlog/mqtt/service/ISubscriptionService.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.mqtt.service; 2 | 3 | import com.webVueBlog.mqtt.model.Subscribe; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 订阅缓存 9 | * 10 | */ 11 | public interface ISubscriptionService { 12 | 13 | /** 14 | * 保存客户订阅的主题 15 | * 16 | * @param subscribeList 客户订阅 17 | */ 18 | void subscribe(List subscribeList, String clientId); 19 | 20 | /** 21 | * 解除订阅 22 | * 23 | * @param clientId 客户id 24 | * @param topicName 主题 25 | */ 26 | void unsubscribe(String clientId, String topicName); 27 | 28 | /** 29 | * 获取订阅了 topic 的客户id 30 | * 31 | * @param topic 主题 32 | * @return 订阅了主题的客户id列表 33 | */ 34 | List searchSubscribeClientList(String topic); 35 | 36 | 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | webVueBlog 7 | com.webVueBlog 8 | 3.8.5 9 | 10 | pom 11 | webVueBlog-service 12 | 业务层管理模块 13 | 14 | webVueBlog-iot-service 15 | webVueBlog-system-service 16 | 17 | 18 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/domain/DeviceGroup.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.domain; 2 | 3 | import com.webVueBlog.common.annotation.Excel; 4 | import com.webVueBlog.common.core.domain.BaseEntity; 5 | import io.swagger.annotations.ApiModel; 6 | import io.swagger.annotations.ApiModelProperty; 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | 10 | /** 11 | * 设备分组对象 iot_device_group 12 | * 13 | * 14 | * 15 | */ 16 | @ApiModel(value = "DeviceGroup", description = "设备分组对象 iot_device_group") 17 | public class DeviceGroup 18 | { 19 | private static final long serialVersionUID = 1L; 20 | 21 | /** 分组ID */ 22 | @ApiModelProperty("分组ID") 23 | private Long groupId; 24 | 25 | /** 设备ID */ 26 | @ApiModelProperty("设备ID") 27 | private Long deviceId; 28 | 29 | public Long getGroupId() { 30 | return groupId; 31 | } 32 | 33 | public void setGroupId(Long groupId) { 34 | this.groupId = groupId; 35 | } 36 | 37 | public Long getDeviceId() { 38 | return deviceId; 39 | } 40 | 41 | public void setDeviceId(Long deviceId) { 42 | this.deviceId = deviceId; 43 | } 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/enums/DeviceType.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | @AllArgsConstructor 7 | @Getter 8 | public enum DeviceType { 9 | /** 10 | * 未知 11 | */ 12 | UNKNOWN(0, "未知"), 13 | /** 14 | * 直连设备 15 | */ 16 | DIRECT_DEVICE(1, "直连设备"), 17 | /** 18 | * 网关设备 19 | */ 20 | GATEWAY(2, "网关设备"), 21 | /** 22 | * 监控设备 23 | */ 24 | CAMERA(3, "监控设备"); 25 | 26 | private int code; 27 | private String desc; 28 | } 29 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/AuthenticateInputModel.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | /** 4 | * 动作 5 | * 6 | * 7 | */ 8 | public class AuthenticateInputModel 9 | { 10 | /** 设备编号 */ 11 | private String serialNumber; 12 | 13 | /** 产品ID */ 14 | private Long productId; 15 | 16 | public AuthenticateInputModel(String serialNumber,Long productId){ 17 | this.serialNumber=serialNumber; 18 | this.productId=productId; 19 | } 20 | 21 | public String getSerialNumber() { 22 | return serialNumber; 23 | } 24 | 25 | public void setSerialNumber(String serialNumber) { 26 | this.serialNumber = serialNumber; 27 | } 28 | 29 | public Long getProductId() { 30 | return productId; 31 | } 32 | 33 | public void setProductId(Long productId) { 34 | this.productId = productId; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/CategoryNews.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | import com.webVueBlog.iot.domain.News; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * 产品分类的Id和名称输出 10 | * 11 | * 12 | * 13 | */ 14 | public class CategoryNews 15 | { 16 | private Long categoryId; 17 | 18 | private String categoryName; 19 | 20 | private List newsList; 21 | 22 | public CategoryNews(){ 23 | this.newsList=new ArrayList<>(); 24 | } 25 | 26 | public Long getCategoryId() { 27 | return categoryId; 28 | } 29 | 30 | public void setCategoryId(Long categoryId) { 31 | this.categoryId = categoryId; 32 | } 33 | 34 | public String getCategoryName() { 35 | return categoryName; 36 | } 37 | 38 | public void setCategoryName(String categoryName) { 39 | this.categoryName = categoryName; 40 | } 41 | 42 | public List getNewsList() { 43 | return newsList; 44 | } 45 | 46 | public void setNewsList(List newsList) { 47 | this.newsList = newsList; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ChangeProductStatusModel.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | /** 4 | * id和name 5 | * 6 | * 7 | * 8 | */ 9 | public class ChangeProductStatusModel 10 | { 11 | private Long productId; 12 | 13 | private Integer status; 14 | 15 | private Integer deviceType; 16 | 17 | public Integer getDeviceType() { 18 | return deviceType; 19 | } 20 | 21 | public void setDeviceType(Integer deviceType) { 22 | this.deviceType = deviceType; 23 | } 24 | 25 | public Long getProductId() { 26 | return productId; 27 | } 28 | 29 | public void setProductId(Long productId) { 30 | this.productId = productId; 31 | } 32 | 33 | public Integer getStatus() { 34 | return status; 35 | } 36 | 37 | public void setStatus(Integer status) { 38 | this.status = status; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/DataResult.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | * 9 | */ 10 | @Data 11 | public class DataResult { 12 | 13 | private String id; 14 | /**值*/ 15 | private String value; 16 | /**时间*/ 17 | private Date ts; 18 | } 19 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/DeviceGroupInput.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | /** 4 | * 设备分组对象 iot_device_group 5 | * 6 | * 7 | * 8 | */ 9 | public class DeviceGroupInput 10 | { 11 | private static final long serialVersionUID = 1L; 12 | 13 | /** 分组ID */ 14 | private Long groupId; 15 | 16 | /** 设备ID */ 17 | private Long[] deviceIds; 18 | 19 | public Long getGroupId() { 20 | return groupId; 21 | } 22 | 23 | public void setGroupId(Long groupId) { 24 | this.groupId = groupId; 25 | } 26 | 27 | public Long[] getDeviceIds() { 28 | return deviceIds; 29 | } 30 | 31 | public void setDeviceIds(Long[] deviceIds) { 32 | this.deviceIds = deviceIds; 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/DeviceMqttConnectVO.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | * 设备MQTT连接参数实体类 8 | * 9 | */ 10 | @Accessors(chain = true) 11 | @Data 12 | public class DeviceMqttConnectVO { 13 | 14 | /** 15 | * 客户端id 16 | */ 17 | private String clientId; 18 | 19 | /** 20 | * 连接用户名 21 | */ 22 | private String username; 23 | 24 | /** 25 | * 连接密码 26 | */ 27 | private String passwd; 28 | 29 | /** 30 | * 连接端口号 31 | */ 32 | private Long port; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/DeviceNumberAndProductId.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | /** 4 | * 5 | * 6 | * 7 | */ 8 | public class DeviceNumberAndProductId 9 | { 10 | /** 产品ID,用于自动添加设备 */ 11 | private Long productId; 12 | 13 | /** 设备编号集合 */ 14 | private String deviceNumber; 15 | 16 | public DeviceNumberAndProductId(){} 17 | 18 | public DeviceNumberAndProductId(Long productId, String deviceNumber){ 19 | this.productId=productId; 20 | this.deviceNumber=deviceNumber; 21 | } 22 | 23 | public Long getProductId() { 24 | return productId; 25 | } 26 | 27 | public void setProductId(Long productId) { 28 | this.productId = productId; 29 | } 30 | 31 | public String getDeviceNumber() { 32 | return deviceNumber; 33 | } 34 | 35 | public void setDeviceNumber(String deviceNumber) { 36 | this.deviceNumber = deviceNumber; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/DeviceRelateAlertLogVO.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 7 | */ 8 | @Data 9 | public class DeviceRelateAlertLogVO { 10 | 11 | /** 12 | * 设备ID 13 | */ 14 | private Long deviceId; 15 | 16 | /** 17 | * 设备编号 18 | */ 19 | private String serialNumber; 20 | 21 | /** 22 | * 设备名称 23 | */ 24 | private String deviceName; 25 | 26 | /** 27 | * 用户ID 28 | */ 29 | private Long userId; 30 | } 31 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/DeviceRelateUserInput.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * 7 | * 8 | * 9 | */ 10 | public class DeviceRelateUserInput 11 | { 12 | 13 | /** 用户Id */ 14 | private Long userId; 15 | 16 | /** 设备编号和产品ID集合 */ 17 | private List deviceNumberAndProductIds; 18 | 19 | public DeviceRelateUserInput(){} 20 | 21 | public DeviceRelateUserInput(Long userId,List deviceNumberAndProductIds){ 22 | this.userId=userId; 23 | this.deviceNumberAndProductIds=deviceNumberAndProductIds; 24 | } 25 | 26 | public Long getUserId() { 27 | return userId; 28 | } 29 | 30 | public void setUserId(Long userId) { 31 | this.userId = userId; 32 | } 33 | 34 | public List getDeviceNumberAndProductIds() { 35 | return deviceNumberAndProductIds; 36 | } 37 | 38 | public void setDeviceNumberAndProductIds(List deviceNumberAndProductIds) { 39 | this.deviceNumberAndProductIds = deviceNumberAndProductIds; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/HistoryModel.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.Data; 5 | 6 | import java.util.Date; 7 | 8 | /** 9 | * 10 | */ 11 | @Data 12 | public class HistoryModel { 13 | 14 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 15 | private Date time; 16 | 17 | private String value; 18 | 19 | private String identity; 20 | } 21 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/IdAndName.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | import org.apache.commons.lang3.builder.ToStringStyle; 5 | 6 | /** 7 | * id和name 8 | * 9 | * 10 | * 11 | */ 12 | public class IdAndName 13 | { 14 | private Long id; 15 | 16 | private String name; 17 | 18 | 19 | public void setId(Long id) 20 | { 21 | this.id = id; 22 | } 23 | public Long getId() 24 | { 25 | return id; 26 | } 27 | 28 | public void setName(String name) 29 | { 30 | this.name = name; 31 | } 32 | public String getName() 33 | { 34 | return name; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 40 | .append("categoryId", getId()) 41 | .append("categoryName", getName()) 42 | .toString(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/IdOutput.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | import org.apache.commons.lang3.builder.ToStringStyle; 5 | 6 | /** 7 | * 产品分类的Id和名称输出 8 | * 9 | * 10 | * 11 | */ 12 | public class IdOutput 13 | { 14 | private Long id; 15 | 16 | public void setId(Long id) 17 | { 18 | this.id = id; 19 | } 20 | public Long getId() 21 | { 22 | return id; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ImportThingsModelInput.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | import com.webVueBlog.common.annotation.Excel; 4 | import org.apache.commons.lang3.builder.ToStringBuilder; 5 | import org.apache.commons.lang3.builder.ToStringStyle; 6 | 7 | /** 8 | * 导入产品物模型的输入对象 9 | * 10 | * 11 | * 12 | */ 13 | public class ImportThingsModelInput 14 | { 15 | /** 产品ID */ 16 | private Long productId; 17 | 18 | /** 产品名称 */ 19 | private String ProductName; 20 | 21 | /** 通用物模型ID集合 */ 22 | private Long[] templateIds; 23 | 24 | public Long getProductId() { 25 | return productId; 26 | } 27 | 28 | public void setProductId(Long productId) { 29 | this.productId = productId; 30 | } 31 | 32 | public String getProductName() { 33 | return ProductName; 34 | } 35 | 36 | public void setProductName(String productName) { 37 | ProductName = productName; 38 | } 39 | 40 | public Long[] getTemplateIds() { 41 | return templateIds; 42 | } 43 | 44 | public void setTemplateIds(Long[] templateIds) { 45 | this.templateIds = templateIds; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/MonitorModel.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | * 动作 9 | * 10 | * 11 | */ 12 | public class MonitorModel 13 | { 14 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 15 | private Date time; 16 | 17 | private String value; 18 | 19 | public Date getTime() { 20 | return time; 21 | } 22 | 23 | public void setTime(Date time) { 24 | this.time = time; 25 | } 26 | 27 | public String getValue() { 28 | return value; 29 | } 30 | 31 | public void setValue(String value) { 32 | this.value = value; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/MqttInfoModel.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | import org.apache.commons.lang3.builder.ToStringStyle; 5 | 6 | /** 7 | * id和name 8 | * 9 | * 10 | * 11 | */ 12 | public class MqttInfoModel 13 | { 14 | private String clientid;// 客户端id 15 | 16 | private String username;// 用户名 17 | 18 | private String password;// 密码 19 | 20 | public String getClientid() { 21 | return clientid; 22 | } 23 | 24 | public void setClientid(String clientid) { 25 | this.clientid = clientid; 26 | } 27 | 28 | public String getUsername() { 29 | return username; 30 | } 31 | 32 | public void setUsername(String username) { 33 | this.username = username; 34 | } 35 | 36 | public String getPassword() { 37 | return password; 38 | } 39 | 40 | public void setPassword(String password) { 41 | this.password = password; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/NtpModel.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | /** 4 | * 产品分类的Id和名称输出 5 | * 6 | * 7 | * 8 | */ 9 | public class NtpModel 10 | { 11 | private Long deviceSendTime;// 设备发送时间 12 | 13 | private Long serverRecvTime;// 服务器接收时间 14 | 15 | private Long serverSendTime;// 服务器发送时间 16 | 17 | public Long getDeviceSendTime() { 18 | return deviceSendTime; 19 | } 20 | 21 | public void setDeviceSendTime(Long deviceSendTime) { 22 | this.deviceSendTime = deviceSendTime; 23 | } 24 | 25 | public Long getServerRecvTime() { 26 | return serverRecvTime; 27 | } 28 | 29 | public void setServerRecvTime(Long serverRecvTime) { 30 | this.serverRecvTime = serverRecvTime; 31 | } 32 | 33 | public Long getServerSendTime() { 34 | return serverSendTime; 35 | } 36 | 37 | public void setServerSendTime(Long serverSendTime) { 38 | this.serverSendTime = serverSendTime; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ProductAuthorizeVO.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | /** 4 | * 批量新增产品授权码VO 5 | * 6 | * 7 | */ 8 | 9 | public class ProductAuthorizeVO { 10 | 11 | private Long productId;// 产品ID 12 | private int createNum;// 授权码数量 13 | 14 | public Long getProductId() { 15 | return productId; 16 | } 17 | 18 | public void setProductId(Long productId) { 19 | this.productId = productId; 20 | } 21 | 22 | public int getCreateNum() { 23 | return createNum; 24 | } 25 | 26 | public void setCreateNum(int createNum) { 27 | this.createNum = createNum; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ProductCode.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 7 | */ 8 | @Data 9 | public class ProductCode { 10 | 11 | /** 12 | * 产品id 13 | */ 14 | private Long productId; 15 | /** 16 | * 协议编号 17 | */ 18 | private String protocolCode; 19 | } 20 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/RegisterUserOutput.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 7 | */ 8 | @Data 9 | public class RegisterUserOutput { 10 | 11 | /** 12 | * 错误信息 13 | */ 14 | private String msg; 15 | 16 | /** 17 | * 用户id 18 | */ 19 | private Long sysUserId; 20 | } 21 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/Specs.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 数据定义 7 | * 8 | * 9 | */ 10 | @Data 11 | public class Specs { 12 | 13 | private String id; 14 | private String name; 15 | private Integer isMonitor; 16 | private Integer slaveId; 17 | private Integer isChart; 18 | private Integer isHistory; 19 | private String datatype; 20 | /** 21 | * 计算公式 22 | */ 23 | private String formula; 24 | 25 | 26 | @Data 27 | static class Datatype { 28 | 29 | private String unit; 30 | private Long min; 31 | private Long max; 32 | private Integer step; 33 | private String type; 34 | private String trueText; 35 | private String falseText; 36 | private EnumList enumList; 37 | } 38 | 39 | @Data 40 | static class EnumList{ 41 | private String text; 42 | private String value; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ThingsModelItem/ArrayModelOutput.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.ThingsModelItem; 2 | 3 | public class ArrayModelOutput extends ThingsModelItemBase 4 | { 5 | private String arrayType; 6 | 7 | private Integer arrayCount; 8 | 9 | public Integer getArrayCount() { 10 | return arrayCount; 11 | } 12 | 13 | public void setArrayCount(Integer arrayCount) { 14 | this.arrayCount = arrayCount; 15 | } 16 | 17 | public String getArrayType() { 18 | return arrayType; 19 | } 20 | 21 | public void setArrayType(String arrayType) { 22 | this.arrayType = arrayType; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ThingsModelItem/BoolModelOutput.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.ThingsModelItem; 2 | 3 | public class BoolModelOutput extends ThingsModelItemBase 4 | { 5 | private String falseText; 6 | private String trueText; 7 | 8 | public String getFalseText() { 9 | return falseText; 10 | } 11 | 12 | public void setFalseText(String falseText) { 13 | this.falseText = falseText; 14 | } 15 | 16 | public String getTrueText() { 17 | return trueText; 18 | } 19 | 20 | public void setTrueText(String trueText) { 21 | this.trueText = trueText; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ThingsModelItem/DecimalModelOutput.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.ThingsModelItem; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class DecimalModelOutput extends ThingsModelItemBase 6 | { 7 | private BigDecimal min; 8 | private BigDecimal max; 9 | private BigDecimal step; 10 | private String unit; 11 | 12 | public BigDecimal getMin() { 13 | return min; 14 | } 15 | 16 | public void setMin(BigDecimal min) { 17 | this.min = min; 18 | } 19 | 20 | public BigDecimal getMax() { 21 | return max; 22 | } 23 | 24 | public void setMax(BigDecimal max) { 25 | this.max = max; 26 | } 27 | 28 | public BigDecimal getStep() { 29 | return step; 30 | } 31 | 32 | public void setStep(BigDecimal step) { 33 | this.step = step; 34 | } 35 | 36 | public String getUnit() { 37 | return unit; 38 | } 39 | 40 | public void setUnit(String unit) { 41 | this.unit = unit; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ThingsModelItem/EnumItem.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.ThingsModelItem; 2 | 3 | 4 | public class EnumItem 5 | { 6 | private String text; 7 | private String value; 8 | 9 | public String getText() { 10 | return text; 11 | } 12 | 13 | public void setText(String text) { 14 | this.text = text; 15 | } 16 | 17 | public String getValue() { 18 | return value; 19 | } 20 | 21 | public void setValue(String value) { 22 | this.value = value; 23 | } 24 | 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ThingsModelItem/EnumItemOutput.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.ThingsModelItem; 2 | 3 | public class EnumItemOutput 4 | { 5 | private String text; 6 | private String value; 7 | 8 | public String getText() { 9 | return text; 10 | } 11 | 12 | public void setText(String text) { 13 | this.text = text; 14 | } 15 | 16 | public String getValue() { 17 | return value; 18 | } 19 | 20 | public void setValue(String value) { 21 | this.value = value; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ThingsModelItem/EnumModelOutput.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.ThingsModelItem; 2 | 3 | import java.util.List; 4 | 5 | public class EnumModelOutput extends ThingsModelItemBase 6 | { 7 | private List enumList; 8 | 9 | public List getEnumList() { 10 | return enumList; 11 | } 12 | 13 | public void setEnumList(List enumList) { 14 | this.enumList = enumList; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ThingsModelItem/IntegerModelOutput.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.ThingsModelItem; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class IntegerModelOutput extends ThingsModelItemBase 6 | { 7 | private BigDecimal min; 8 | private BigDecimal max; 9 | private BigDecimal step; 10 | private String unit; 11 | 12 | public BigDecimal getMin() { 13 | return min; 14 | } 15 | 16 | public void setMin(BigDecimal min) { 17 | this.min = min; 18 | } 19 | 20 | public BigDecimal getMax() { 21 | return max; 22 | } 23 | 24 | public void setMax(BigDecimal max) { 25 | this.max = max; 26 | } 27 | 28 | public BigDecimal getStep() { 29 | return step; 30 | } 31 | 32 | public void setStep(BigDecimal step) { 33 | this.step = step; 34 | } 35 | 36 | public String getUnit() { 37 | return unit; 38 | } 39 | 40 | public void setUnit(String unit) { 41 | this.unit = unit; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ThingsModelItem/ReadOnlyModelOutput.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.ThingsModelItem; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.List; 5 | 6 | public class ReadOnlyModelOutput extends ThingsModelItemBase 7 | { 8 | private BigDecimal min; 9 | private BigDecimal max; 10 | private BigDecimal step; 11 | private String unit; 12 | 13 | public BigDecimal getMin() { 14 | return min; 15 | } 16 | 17 | public void setMin(BigDecimal min) { 18 | this.min = min; 19 | } 20 | 21 | public BigDecimal getMax() { 22 | return max; 23 | } 24 | 25 | public void setMax(BigDecimal max) { 26 | this.max = max; 27 | } 28 | 29 | public BigDecimal getStep() { 30 | return step; 31 | } 32 | 33 | public void setStep(BigDecimal step) { 34 | this.step = step; 35 | } 36 | 37 | public String getUnit() { 38 | return unit; 39 | } 40 | 41 | public void setUnit(String unit) { 42 | this.unit = unit; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ThingsModelItem/StringModelOutput.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.ThingsModelItem; 2 | 3 | public class StringModelOutput extends ThingsModelItemBase 4 | { 5 | private int maxLength; 6 | 7 | public int getMaxLength() { 8 | return maxLength; 9 | } 10 | 11 | public void setMaxLength(int maxLength) { 12 | this.maxLength = maxLength; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ThingsModelPerm.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | /** 4 | * 5 | * 6 | */ 7 | public class ThingsModelPerm 8 | { 9 | /** 物模型名称 */ 10 | private String modelName; 11 | 12 | /** 标识符,产品下唯一 */ 13 | private String identifier; 14 | 15 | /** 备注信息 */ 16 | private String remark; 17 | 18 | public String getModelName() { 19 | return modelName; 20 | } 21 | 22 | public void setModelName(String modelName) { 23 | this.modelName = modelName; 24 | } 25 | 26 | public String getIdentifier() { 27 | return identifier; 28 | } 29 | 30 | public void setIdentifier(String identifier) { 31 | this.identifier = identifier; 32 | } 33 | 34 | public String getRemark() { 35 | return remark; 36 | } 37 | 38 | public void setRemark(String remark) { 39 | this.remark = remark; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ThingsModels/EventDto.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.ThingsModels; 2 | 3 | import com.alibaba.fastjson2.JSONObject; 4 | import lombok.Data; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 产品分类的Id和名称输出 10 | * 11 | * 12 | * 13 | */ 14 | @Data 15 | public class EventDto { 16 | /** 17 | * 物模型唯一标识符 18 | */ 19 | private String id; 20 | /** 21 | * 物模型名称 22 | */ 23 | private String name; 24 | /** 25 | * 数据定义 26 | */ 27 | private JSONObject datatype; 28 | 29 | /** 30 | * 从机编号 31 | */ 32 | private Integer SlaveId; 33 | /** 34 | * 计算公式 35 | */ 36 | private String formula; 37 | 38 | private Integer isParams; 39 | 40 | private Integer isHistory; 41 | 42 | /** 43 | * 从机编号 44 | */ 45 | private Long tempSlaveId; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ThingsModels/FunctionDto.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.ThingsModels; 2 | 3 | import com.alibaba.fastjson2.JSONObject; 4 | import lombok.Data; 5 | 6 | /** 7 | * 产品分类的Id和名称输出 8 | * 9 | * 10 | * 11 | */ 12 | @Data 13 | public class FunctionDto 14 | { 15 | /** 物模型唯一标识符 */ 16 | private String id; 17 | /** 物模型名称 */ 18 | private String name; 19 | /** 是否首页显示(0-否,1-是) */ 20 | private Integer isChart; 21 | /** 是否只读 */ 22 | private Integer isReadonly; 23 | /** 是否历史存储 */ 24 | private Integer isHistory; 25 | /** 排序 */ 26 | private Integer order; 27 | /** 数据定义 */ 28 | private JSONObject datatype; 29 | 30 | /** 31 | * 从机编号 32 | */ 33 | private Integer SlaveId; 34 | /** 35 | * 计算公式 36 | */ 37 | private String formula; 38 | 39 | private Integer isParams; 40 | 41 | /** 42 | * 从机编号 43 | */ 44 | private Long tempSlaveId; 45 | } 46 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ThingsModels/ThingsItems.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.ThingsModels; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 9 | */ 10 | @Data 11 | public class ThingsItems { 12 | 13 | private List ids; 14 | 15 | private Long productId; 16 | 17 | private Integer slaveId; 18 | } 19 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/ThingsModels/ValueItem.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.ThingsModels; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.Date; 8 | 9 | /** 10 | * redis缓存物模型值 11 | * 12 | */ 13 | @Data 14 | @NoArgsConstructor 15 | public class ValueItem { 16 | 17 | public ValueItem(String id, Integer slaveId, String regArr) { 18 | this.id = id; 19 | this.slaveId = slaveId; 20 | this.regArr = regArr; 21 | } 22 | 23 | /** 24 | * 标识符 25 | */ 26 | private String id; 27 | 28 | /** 29 | * 物模型值 30 | */ 31 | private String value; 32 | 33 | /** 34 | * 影子值 35 | **/ 36 | private String shadow; 37 | 38 | /** 39 | * 物模型名称 40 | **/ 41 | private String name; 42 | 43 | /** 44 | * 上报时间 45 | */ 46 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 47 | private Date ts; 48 | 49 | /** 50 | * 从机编号 51 | */ 52 | private Integer slaveId; 53 | 54 | /** 55 | * 寄存器地址 56 | */ 57 | private String regArr; 58 | 59 | private String remark; 60 | 61 | } 62 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/UserIdDeviceIdModel.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model; 2 | 3 | /** 4 | * 用户ID和设备ID模型 5 | * 6 | * 7 | * 8 | */ 9 | public class UserIdDeviceIdModel 10 | { 11 | private Long userId; 12 | 13 | private Long deviceId; 14 | 15 | public UserIdDeviceIdModel(Long userId, Long deviceId){ 16 | this.userId=userId; 17 | this.deviceId=deviceId; 18 | } 19 | 20 | 21 | public Long getUserId() { 22 | return userId; 23 | } 24 | 25 | public void setUserId(Long userId) { 26 | this.userId = userId; 27 | } 28 | 29 | public Long getDeviceId() { 30 | return deviceId; 31 | } 32 | 33 | public void setDeviceId(Long deviceId) { 34 | this.deviceId = deviceId; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/dashBoard/DashMqttMetrics.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.dashBoard; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | /** 9 | * DashMqttMetrics是DashMqttMetrics的实体类,用于存储MQTT仪表板指标的值。 10 | */ 11 | @Data 12 | @Builder 13 | public class DashMqttMetrics { 14 | 15 | /**接收总数*/ 16 | private Integer receive_total; 17 | /**发送总数*/ 18 | private Integer send_total; 19 | /**认证总数*/ 20 | private Integer auth_total; 21 | /**连接总数*/ 22 | private Integer connect_total; 23 | /**订阅总数*/ 24 | private Integer subscribe_total; 25 | /**今日接收总数*/ 26 | private Integer today_received; 27 | /**今日发送总数*/ 28 | private Integer today_send; 29 | } 30 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/dashBoard/DashMqttStat.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.dashBoard; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | 6 | /** 7 | * DashMqttStat是MQTT仪表板统计信息 8 | */ 9 | @Data 10 | @Builder 11 | public class DashMqttStat { 12 | 13 | /**当前连接数*/ 14 | private Integer connection_count; 15 | /**连接总数*/ 16 | private Integer connection_total; 17 | /**会话数量*/ 18 | private Integer session_count; 19 | /**会话总数*/ 20 | private Integer session_total; 21 | /**当前订阅主题总数*/ 22 | private Integer subscription_count; 23 | /**总订阅总数*/ 24 | private Integer subscription_total; 25 | /**当前保留消息*/ 26 | private Integer retain_count; 27 | /**总保留信息数*/ 28 | private Integer retain_total; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/dto/DeviceRtDto.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 设备实时数据dto 7 | * 8 | */ 9 | @Data 10 | public class DeviceRtDto { 11 | 12 | /**物模型名称*/ 13 | private String modelName; 14 | /**值*/ 15 | private String value; 16 | /**标识符*/ 17 | private String identifier; 18 | /**数据定义*/ 19 | private String specs; 20 | /**寄存器地址*/ 21 | private String regAddr; 22 | /**数据类型*/ 23 | private String dataType; 24 | /**更新时间*/ 25 | private String platformTime; 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/login/AuthRequestWrap.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.login; 2 | 3 | import com.webVueBlog.iot.domain.SocialPlatform; 4 | import me.zhyd.oauth.request.AuthRequest; 5 | 6 | public class AuthRequestWrap { 7 | private AuthRequest authRequest;// 第三方登录请求 8 | 9 | private SocialPlatform socialPlatform;// 第三方登录平台 10 | 11 | public AuthRequest getAuthRequest() { 12 | return authRequest; 13 | } 14 | 15 | public void setAuthRequest(AuthRequest authRequest) { 16 | this.authRequest = authRequest; 17 | } 18 | 19 | public SocialPlatform getSocialPlatform() { 20 | return socialPlatform; 21 | } 22 | 23 | public void setSocialPlatform(SocialPlatform socialPlatform) { 24 | this.socialPlatform = socialPlatform; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/login/BindIdValue.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.login; 2 | 3 | public class BindIdValue { 4 | 5 | private String uuid;//uuid 6 | private String source;//来源 7 | 8 | public String getSource() { 9 | return source; 10 | } 11 | 12 | public void setSource(String source) { 13 | this.source = source; 14 | } 15 | 16 | public String getUuid() { 17 | return uuid; 18 | } 19 | 20 | public void setUuid(String uuid) { 21 | this.uuid = uuid; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/login/LoginIdValue.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.login; 2 | 3 | public class LoginIdValue { 4 | String username; 5 | String password; 6 | 7 | public String getPassword() { 8 | return password; 9 | } 10 | 11 | public void setPassword(String password) { 12 | this.password = password; 13 | } 14 | 15 | public String getUsername() { 16 | return username; 17 | } 18 | 19 | public void setUsername(String username) { 20 | this.username = username; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/login/WeChatLoginQrRes.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.login; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 7 | */ 8 | @Data 9 | public class WeChatLoginQrRes { 10 | 11 | private String appid; 12 | 13 | private String scope;// 14 | 15 | private String redirectUri;// 16 | 17 | private String state;// 18 | } 19 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/varTemp/DeviceSlavePoint.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.varTemp; 2 | 3 | import com.webVueBlog.common.core.iot.response.IdentityAndName; 4 | import com.webVueBlog.iot.domain.ThingsModel; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 11 | */ 12 | @Data 13 | public class DeviceSlavePoint { 14 | 15 | /**从机编号*/ 16 | private Integer slaveId; 17 | /**从机对应采集点数据*/ 18 | private List pointList; 19 | /**轮询时间*/ 20 | private Long timer; 21 | /**批量读取的个数*/ 22 | private Integer packetLength; 23 | 24 | private Integer code; 25 | } 26 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/varTemp/DeviceTemp.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.varTemp; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 9 | */ 10 | @Data 11 | public class DeviceTemp { 12 | 13 | private Long productId; 14 | 15 | private String serialNumber;//设备序列号 16 | 17 | private List pointList; 18 | } 19 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/varTemp/EnumClass.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.varTemp; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 7 | */ 8 | @Data 9 | public class EnumClass { 10 | 11 | private String text; 12 | private String value; 13 | } 14 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/varTemp/SlaveIdAndId.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.varTemp; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 7 | */ 8 | @Data 9 | public class SlaveIdAndId { 10 | 11 | private Integer slaveId;// 从站id 12 | private Long id;// 设备id 13 | } 14 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/model/varTemp/SyncModel.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.model.varTemp; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 9 | */ 10 | @Data 11 | public class SyncModel { 12 | 13 | private List productIds;// 产品id集合 14 | private Long templateId;// 模板id 15 | } 16 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/service/IAuthRequestFactory.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.service; 2 | 3 | import com.webVueBlog.iot.model.login.AuthRequestWrap; 4 | 5 | /** 6 | * AuthRequest简单工程类接口 7 | * 8 | * 9 | */ 10 | public interface IAuthRequestFactory { 11 | 12 | AuthRequestWrap getAuthRequest(String source); 13 | } 14 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/service/IDeviceRuntimeService.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.service; 2 | 3 | import com.webVueBlog.common.enums.ThingsModelType; 4 | import com.webVueBlog.iot.domain.DeviceLog; 5 | import com.webVueBlog.iot.domain.FunctionLog; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 设备运行时数据 11 | * 12 | * 13 | */ 14 | public interface IDeviceRuntimeService { 15 | 16 | /** 17 | * 根据设备编号查询设备实时运行状态 18 | * 19 | * @param serialNumber 设备编号 20 | * @param type 物模型类型 21 | * @return 设备实时数据 22 | */ 23 | public List runtimeBySerialNumber(String serialNumber, ThingsModelType type,Long productId,Integer slaveId); 24 | 25 | /** 26 | * 根据设备编号查询设备服务调用日志情况 27 | * @param serialNumber 设备编号 28 | * @return 服务下发日志 29 | */ 30 | public List runtimeReply(String serialNumber); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/service/IUserSocialProfileService.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.service; 2 | 3 | import com.webVueBlog.common.core.domain.AjaxResult; 4 | import com.webVueBlog.iot.domain.UserSocialProfile; 5 | 6 | import java.util.List; 7 | 8 | public interface IUserSocialProfileService { 9 | /** 10 | * 找到用户绑定的社交账户 11 | * 12 | * @param sysUserId 用户主键 13 | * @return 14 | */ 15 | List selectUserSocialProfile(Long sysUserId); 16 | 17 | /** 18 | * 绑定用户 19 | * 20 | * @param bindId 绑定的Id 21 | * @param sysUserId 用户主键 22 | * @return 23 | */ 24 | AjaxResult bindUser(String bindId, Long sysUserId); 25 | 26 | /** 27 | * 点击绑定跳转api 28 | * 29 | * @param platform 平台 30 | * @return 31 | */ 32 | AjaxResult bindSocialAccount(String platform); 33 | 34 | /** 35 | * 解除绑定 36 | * 37 | * @param socialUserId 要解除的社交账户主键 38 | * @param sysUserId 用户主键 39 | * @return 40 | */ 41 | AjaxResult unbindSocialAccount(Long socialUserId, Long sysUserId); 42 | } 43 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/service/cache/IDeviceCache.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.service.cache; 2 | 3 | import com.webVueBlog.common.core.mq.DeviceStatusBo; 4 | import com.webVueBlog.common.enums.DeviceStatus; 5 | import com.webVueBlog.iot.domain.Device; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 设备缓存 11 | * 12 | */ 13 | public interface IDeviceCache { 14 | 15 | /** 16 | * 更新设备状态 17 | * @param dto dto 18 | */ 19 | public Device updateDeviceStatusCache(DeviceStatusBo dto); 20 | 21 | /** 22 | * 获取设备在线总数 23 | * @return 设备在线总数 24 | */ 25 | public long deviceOnlineTotal(); 26 | 27 | 28 | /** 29 | * 批量更新redis缓存设备状态 30 | * @param serialNumbers 设备列表 31 | * @param status 状态 32 | */ 33 | void updateBatchDeviceStatusCache(List serialNumbers, DeviceStatus status); 34 | 35 | /** 36 | * 移除过期的设备 37 | */ 38 | public List removeExpiredDevice(); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/service/cache/IFirmwareCache.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.service.cache; 2 | 3 | /** 4 | * 固件版本缓存 5 | * 6 | */ 7 | public interface IFirmwareCache { 8 | 9 | /** 10 | * 固件版本缓存 11 | * @param firmwareId 固件ID 12 | * @param urlName 升级URL 13 | * @return 14 | */ 15 | public void setFirmwareCache(Long firmwareId,String urlName); 16 | 17 | /** 18 | * 获取固件版本信息 19 | * @param firmwareId 固件ID 20 | * @return 升级URL 21 | */ 22 | public String getFirmwareCache(Long firmwareId); 23 | 24 | /** 25 | * 移除固件版本 26 | * @param firmwareId 固件id 27 | */ 28 | public void remove(Long firmwareId); 29 | } 30 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/tdengine/service/model/TdLogDto.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.tdengine.service.model; 2 | 3 | import com.webVueBlog.iot.domain.DeviceLog; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * 12 | */ 13 | @Data 14 | @NoArgsConstructor//@NoArgsConstructor是lombok注解,用于生成一个无参构造函数。 15 | @AllArgsConstructor//@AllArgsConstructor是lombok注解,用于生成一个包含所有参数的构造函数。 16 | public class TdLogDto { 17 | 18 | /** 19 | * 设备编号 20 | */ 21 | private String serialNumber; 22 | /** 23 | * 设备日志列表 24 | */ 25 | private List list; 26 | } 27 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/util/VelocityInitializer.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.util; 2 | 3 | import com.webVueBlog.common.constant.Constants; 4 | import org.apache.velocity.app.Velocity; 5 | 6 | import java.util.Properties; 7 | 8 | /** 9 | * VelocityEngine工厂是Velocity的Java配置方式 10 | * 用来初始化Velocity引擎 11 | */ 12 | public class VelocityInitializer 13 | { 14 | /** 15 | * 初始化vm方法 16 | */ 17 | public static void initVelocity() 18 | { 19 | Properties p = new Properties(); 20 | try 21 | { 22 | // 加载classpath目录下的vm文件 23 | p.setProperty("resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); 24 | // 定义字符集 25 | p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8); 26 | // 初始化Velocity引擎,指定配置Properties 27 | Velocity.init(p); 28 | } 29 | catch (Exception e) 30 | { 31 | throw new RuntimeException(e); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/wechat/vo/WxBindReqVO.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.wechat.vo; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * WxBindReqVO是微信绑定请求的VO类 7 | */ 8 | @Data 9 | public class WxBindReqVO { 10 | 11 | private String sourceClient;// 客户端来源 12 | 13 | private String openId;// 用户的唯一标识 14 | 15 | private String unionId;// 微信开放平台的唯一标识符 16 | 17 | private String code;// 微信登录时获取的code 18 | } 19 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/java/com/webVueBlog/iot/wechat/vo/WxCancelBindReqVO.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.iot.wechat.vo; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 微信解绑传参类 7 | * 8 | */ 9 | @Data 10 | public class WxCancelBindReqVO { 11 | 12 | /** 13 | * 验证类型 14 | */ 15 | private Integer verifyType; 16 | 17 | /** 18 | * 用户密码 19 | */ 20 | private String password; 21 | 22 | /** 23 | * 手机号 24 | */ 25 | private String userPhone; 26 | 27 | /** 28 | * 短信验证码 29 | */ 30 | private String smsCode; 31 | } 32 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/resources/static/oauth/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webVueBlog/Springboot-IOT-Platform/d5f76d66cb1713336d69fb65144ac9a913d2df3f/springboot/webVueBlog-service/webVueBlog-iot-service/src/main/resources/static/oauth/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/resources/static/oauth/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webVueBlog/Springboot-IOT-Platform/d5f76d66cb1713336d69fb65144ac9a913d2df3f/springboot/webVueBlog-service/webVueBlog-iot-service/src/main/resources/static/oauth/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/resources/static/oauth/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webVueBlog/Springboot-IOT-Platform/d5f76d66cb1713336d69fb65144ac9a913d2df3f/springboot/webVueBlog-service/webVueBlog-iot-service/src/main/resources/static/oauth/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/resources/static/oauth/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webVueBlog/Springboot-IOT-Platform/d5f76d66cb1713336d69fb65144ac9a913d2df3f/springboot/webVueBlog-service/webVueBlog-iot-service/src/main/resources/static/oauth/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/resources/static/oauth/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/resources/templates/oauth/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | webVueBlog-smart-auth 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | webVueBlog-smart oauth 授权 13 | 14 | 15 | 16 | 17 | webVueBlog-smart 授权平台 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-iot-service/src/main/resources/vm/js/api.js.vm: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request' 2 | 3 | // 查询${functionName}列表 4 | export function list${BusinessName}(query) { 5 | return request({ 6 | url: '/${moduleName}/${businessName}/list', 7 | method: 'get', 8 | params: query 9 | }) 10 | } 11 | 12 | // 查询${functionName}详细 13 | export function get${BusinessName}(${pkColumn.javaField}) { 14 | return request({ 15 | url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, 16 | method: 'get' 17 | }) 18 | } 19 | 20 | // 新增${functionName} 21 | export function add${BusinessName}(data) { 22 | return request({ 23 | url: '/${moduleName}/${businessName}', 24 | method: 'post', 25 | data: data 26 | }) 27 | } 28 | 29 | // 修改${functionName} 30 | export function update${BusinessName}(data) { 31 | return request({ 32 | url: '/${moduleName}/${businessName}', 33 | method: 'put', 34 | data: data 35 | }) 36 | } 37 | 38 | // 删除${functionName} 39 | export function del${BusinessName}(${pkColumn.javaField}) { 40 | return request({ 41 | url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, 42 | method: 'delete' 43 | }) 44 | } 45 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-system-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | webVueBlog-service 7 | com.webVueBlog 8 | 3.8.5 9 | 10 | 4.0.0 11 | webVueBlog-system-service 12 | 13 | system系统模块 14 | 15 | 16 | 17 | 18 | com.webVueBlog 19 | webVueBlog-common 20 | 21 | 22 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-system-service/src/main/java/com/webVueBlog/system/mapper/SysLogininforMapper.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.system.mapper; 2 | 3 | import java.util.List; 4 | import com.webVueBlog.system.domain.SysLogininfor; 5 | 6 | /** 7 | * 系统访问日志情况信息 数据层 8 | * 9 | * 10 | */ 11 | public interface SysLogininforMapper 12 | { 13 | /** 14 | * 新增系统登录日志 15 | * 16 | * @param logininfor 访问日志对象 17 | */ 18 | public void insertLogininfor(SysLogininfor logininfor); 19 | 20 | /** 21 | * 查询系统登录日志集合 22 | * 23 | * @param logininfor 访问日志对象 24 | * @return 登录记录集合 25 | */ 26 | public List selectLogininforList(SysLogininfor logininfor); 27 | 28 | /** 29 | * 批量删除系统登录日志 30 | * 31 | * @param infoIds 需要删除的登录日志ID 32 | * @return 结果 33 | */ 34 | public int deleteLogininforByIds(Long[] infoIds); 35 | 36 | /** 37 | * 清空系统登录日志 38 | * 39 | * @return 结果 40 | */ 41 | public int cleanLogininfor(); 42 | } 43 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-system-service/src/main/java/com/webVueBlog/system/mapper/SysOperLogMapper.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.system.mapper; 2 | 3 | import java.util.List; 4 | import com.webVueBlog.system.domain.SysOperLog; 5 | 6 | /** 7 | * 操作日志 数据层 8 | * 9 | * 10 | */ 11 | public interface SysOperLogMapper 12 | { 13 | /** 14 | * 新增操作日志 15 | * 16 | * @param operLog 操作日志对象 17 | */ 18 | public void insertOperlog(SysOperLog operLog); 19 | 20 | /** 21 | * 查询系统操作日志集合 22 | * 23 | * @param operLog 操作日志对象 24 | * @return 操作日志集合 25 | */ 26 | public List selectOperLogList(SysOperLog operLog); 27 | 28 | /** 29 | * 批量删除系统操作日志 30 | * 31 | * @param operIds 需要删除的操作日志ID 32 | * @return 结果 33 | */ 34 | public int deleteOperLogByIds(Long[] operIds); 35 | 36 | /** 37 | * 查询操作日志详细 38 | * 39 | * @param operId 操作ID 40 | * @return 操作日志对象 41 | */ 42 | public SysOperLog selectOperLogById(Long operId); 43 | 44 | /** 45 | * 清空操作日志 46 | */ 47 | public void cleanOperLog(); 48 | } 49 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-system-service/src/main/java/com/webVueBlog/system/mapper/SysRoleDeptMapper.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.system.mapper; 2 | 3 | import java.util.List; 4 | import com.webVueBlog.system.domain.SysRoleDept; 5 | 6 | /** 7 | * 角色与部门关联表 数据层 8 | * 9 | * 10 | */ 11 | public interface SysRoleDeptMapper 12 | { 13 | /** 14 | * 通过角色ID删除角色和部门关联 15 | * 16 | * @param roleId 角色ID 17 | * @return 结果 18 | */ 19 | public int deleteRoleDeptByRoleId(Long roleId); 20 | 21 | /** 22 | * 批量删除角色部门关联信息 23 | * 24 | * @param ids 需要删除的数据ID 25 | * @return 结果 26 | */ 27 | public int deleteRoleDept(Long[] ids); 28 | 29 | /** 30 | * 查询部门使用数量 31 | * 32 | * @param deptId 部门ID 33 | * @return 结果 34 | */ 35 | public int selectCountRoleDeptByDeptId(Long deptId); 36 | 37 | /** 38 | * 批量新增角色部门信息 39 | * 40 | * @param roleDeptList 角色部门列表 41 | * @return 结果 42 | */ 43 | public int batchRoleDept(List roleDeptList); 44 | } 45 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-system-service/src/main/java/com/webVueBlog/system/mapper/SysRoleMenuMapper.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.system.mapper; 2 | 3 | import java.util.List; 4 | import com.webVueBlog.system.domain.SysRoleMenu; 5 | 6 | /** 7 | * 角色与菜单关联表 数据层 8 | * 9 | * 10 | */ 11 | public interface SysRoleMenuMapper 12 | { 13 | /** 14 | * 查询菜单使用数量 15 | * 16 | * @param menuId 菜单ID 17 | * @return 结果 18 | */ 19 | public int checkMenuExistRole(Long menuId); 20 | 21 | /** 22 | * 通过角色ID删除角色和菜单关联 23 | * 24 | * @param roleId 角色ID 25 | * @return 结果 26 | */ 27 | public int deleteRoleMenuByRoleId(Long roleId); 28 | 29 | /** 30 | * 批量删除角色菜单关联信息 31 | * 32 | * @param ids 需要删除的数据ID 33 | * @return 结果 34 | */ 35 | public int deleteRoleMenu(Long[] ids); 36 | 37 | /** 38 | * 批量新增角色菜单信息 39 | * 40 | * @param roleMenuList 角色菜单列表 41 | * @return 结果 42 | */ 43 | public int batchRoleMenu(List roleMenuList); 44 | } 45 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-system-service/src/main/java/com/webVueBlog/system/mapper/SysUserPostMapper.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.system.mapper; 2 | 3 | import java.util.List; 4 | import com.webVueBlog.system.domain.SysUserPost; 5 | 6 | /** 7 | * 用户与岗位关联表 数据层 8 | * 9 | * 10 | */ 11 | public interface SysUserPostMapper 12 | { 13 | /** 14 | * 通过用户ID删除用户和岗位关联 15 | * 16 | * @param userId 用户ID 17 | * @return 结果 18 | */ 19 | public int deleteUserPostByUserId(Long userId); 20 | 21 | /** 22 | * 通过岗位ID查询岗位使用数量 23 | * 24 | * @param postId 岗位ID 25 | * @return 结果 26 | */ 27 | public int countUserPostById(Long postId); 28 | 29 | /** 30 | * 批量删除用户和岗位关联 31 | * 32 | * @param ids 需要删除的数据ID 33 | * @return 结果 34 | */ 35 | public int deleteUserPost(Long[] ids); 36 | 37 | /** 38 | * 批量新增用户岗位信息 39 | * 40 | * @param userPostList 用户角色列表 41 | * @return 结果 42 | */ 43 | public int batchUserPost(List userPostList); 44 | } 45 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-system-service/src/main/java/com/webVueBlog/system/service/ISysLogininforService.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.system.service; 2 | 3 | import java.util.List; 4 | import com.webVueBlog.system.domain.SysLogininfor; 5 | 6 | /** 7 | * 系统访问日志情况信息 服务层 8 | * 9 | */ 10 | public interface ISysLogininforService 11 | { 12 | /** 13 | * 新增系统登录日志 14 | * 15 | * @param logininfor 访问日志对象 16 | */ 17 | public void insertLogininfor(SysLogininfor logininfor); 18 | 19 | /** 20 | * 查询系统登录日志集合 21 | * 22 | * @param logininfor 访问日志对象 23 | * @return 登录记录集合 24 | */ 25 | public List selectLogininforList(SysLogininfor logininfor); 26 | 27 | /** 28 | * 批量删除系统登录日志 29 | * 30 | * @param infoIds 需要删除的登录日志ID 31 | * @return 结果 32 | */ 33 | public int deleteLogininforByIds(Long[] infoIds); 34 | 35 | /** 36 | * 清空系统登录日志 37 | */ 38 | public void cleanLogininfor(); 39 | } 40 | -------------------------------------------------------------------------------- /springboot/webVueBlog-service/webVueBlog-system-service/src/main/java/com/webVueBlog/system/service/ISysOperLogService.java: -------------------------------------------------------------------------------- 1 | package com.webVueBlog.system.service; 2 | 3 | import java.util.List; 4 | import com.webVueBlog.system.domain.SysOperLog; 5 | 6 | /** 7 | * 操作日志 服务层 8 | * 9 | */ 10 | public interface ISysOperLogService 11 | { 12 | /** 13 | * 新增操作日志 14 | * 15 | * @param operLog 操作日志对象 16 | */ 17 | public void insertOperlog(SysOperLog operLog); 18 | 19 | /** 20 | * 查询系统操作日志集合 21 | * 22 | * @param operLog 操作日志对象 23 | * @return 操作日志集合 24 | */ 25 | public List selectOperLogList(SysOperLog operLog); 26 | 27 | /** 28 | * 批量删除系统操作日志 29 | * 30 | * @param operIds 需要删除的操作日志ID 31 | * @return 结果 32 | */ 33 | public int deleteOperLogByIds(Long[] operIds); 34 | 35 | /** 36 | * 查询操作日志详细 37 | * 38 | * @param operId 操作ID 39 | * @return 操作日志对象 40 | */ 41 | public SysOperLog selectOperLogById(Long operId); 42 | 43 | /** 44 | * 清空操作日志 45 | */ 46 | public void cleanOperLog(); 47 | } 48 | --------------------------------------------------------------------------------
webVueBlog-smart 授权平台