├── resource └── iot │ ├── iot-业务.png │ └── iot-领域对象.png ├── vms-infrastructure ├── vms-core │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── dreamcc │ │ │ │ └── common │ │ │ │ └── core │ │ │ │ ├── concurrent │ │ │ │ ├── thread │ │ │ │ │ ├── RequestProcessorThreadPool.java │ │ │ │ │ └── RequestProcessorThread.java │ │ │ │ └── queue │ │ │ │ │ └── IoTRequest.java │ │ │ │ ├── exception │ │ │ │ ├── PreAuthorizeException.java │ │ │ │ ├── DemoModeException.java │ │ │ │ ├── CaptchaException.java │ │ │ │ ├── InnerAuthException.java │ │ │ │ ├── auth │ │ │ │ │ ├── NotLoginException.java │ │ │ │ │ ├── NotRoleException.java │ │ │ │ │ └── NotPermissionException.java │ │ │ │ ├── user │ │ │ │ │ ├── CaptchaExpireException.java │ │ │ │ │ ├── UserPasswordNotMatchException.java │ │ │ │ │ └── UserException.java │ │ │ │ ├── file │ │ │ │ │ ├── FileSizeLimitExceededException.java │ │ │ │ │ ├── FileException.java │ │ │ │ │ └── FileNameLengthLimitExceededException.java │ │ │ │ ├── UtilException.java │ │ │ │ ├── job │ │ │ │ │ └── TaskException.java │ │ │ │ ├── CheckedException.java │ │ │ │ └── GlobalException.java │ │ │ │ ├── config │ │ │ │ ├── GlobalConfig.java │ │ │ │ └── AsyncConfig.java │ │ │ │ ├── utils │ │ │ │ ├── poi │ │ │ │ │ └── ExcelHandlerAdapter.java │ │ │ │ ├── sql │ │ │ │ │ └── SqlUtil.java │ │ │ │ ├── ExceptionUtil.java │ │ │ │ └── IdUtils.java │ │ │ │ ├── annotation │ │ │ │ └── Excels.java │ │ │ │ ├── constant │ │ │ │ ├── CacheConstants.java │ │ │ │ ├── TokenConstants.java │ │ │ │ ├── ServiceNameConstants.java │ │ │ │ ├── CommonConsts.java │ │ │ │ ├── SecurityConstants.java │ │ │ │ └── ScheduleConstants.java │ │ │ │ └── enums │ │ │ │ └── UserStatus.java │ │ └── resources │ │ │ ├── META-INF │ │ │ └── spring.factories │ │ │ └── thread.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── bonc │ │ └── common │ │ └── BaseTest.java ├── vms-auth │ └── src │ │ └── main │ │ ├── resources │ │ ├── application.yml │ │ ├── banner.txt │ │ └── bootstrap.yml │ │ └── java │ │ └── com │ │ └── dreamcc │ │ └── auth │ │ ├── form │ │ ├── RegisterBody.java │ │ └── LoginBody.java │ │ └── RuoYiAuthApplication.java ├── vms-config │ ├── vms-log │ │ ├── src │ │ │ └── main │ │ │ │ ├── resources │ │ │ │ └── META-INF │ │ │ │ │ └── spring.factories │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── dreamcc │ │ │ │ └── log │ │ │ │ ├── enums │ │ │ │ ├── BusinessStatus.java │ │ │ │ └── OperatorType.java │ │ │ │ ├── service │ │ │ │ └── AsyncLogService.java │ │ │ │ └── annotation │ │ │ │ └── Log.java │ │ └── pom.xml │ ├── vms-redis │ │ ├── src │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── spring.factories │ │ └── pom.xml │ ├── vms-security │ │ ├── src │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── dreamcc │ │ │ │ │ └── security │ │ │ │ │ ├── annotation │ │ │ │ │ ├── Logical.java │ │ │ │ │ ├── InnerAuth.java │ │ │ │ │ ├── RequiresLogin.java │ │ │ │ │ ├── RequiresRoles.java │ │ │ │ │ ├── RequiresPermissions.java │ │ │ │ │ ├── EnableRyFeignClients.java │ │ │ │ │ └── EnableCustomConfig.java │ │ │ │ │ ├── feign │ │ │ │ │ └── FeignAutoConfiguration.java │ │ │ │ │ └── config │ │ │ │ │ ├── ApplicationConfig.java │ │ │ │ │ └── WebMvcConfig.java │ │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── spring.factories │ │ └── pom.xml │ ├── vms-datasource │ │ ├── src │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── dreamcc │ │ │ │ └── datasource │ │ │ │ └── annotation │ │ │ │ ├── Master.java │ │ │ │ └── Slave.java │ │ └── pom.xml │ ├── vms-datascope │ │ └── pom.xml │ ├── pom.xml │ └── vms-swagger │ │ └── pom.xml ├── vms-rpc │ └── src │ │ └── main │ │ ├── resources │ │ ├── META-INF │ │ │ └── additional-spring-configuration-metadata.json │ │ ├── application.yml │ │ └── application.properties │ │ └── java │ │ └── com │ │ └── dreamcc │ │ └── iot │ │ ├── entity │ │ ├── AbstractMonitorMessage.java │ │ ├── KeepAliveReceived.java │ │ ├── AbstractMonitorMessageReceived.java │ │ ├── IotInfo.java │ │ ├── RTUChannelInfo.java │ │ ├── HeaderModel.java │ │ └── GlobalInfo.java │ │ ├── rpc │ │ ├── service │ │ │ ├── IDeviceService.java │ │ │ └── impl │ │ │ │ └── DeviceServiceImpl.java │ │ ├── annotation │ │ │ └── RPCService.java │ │ ├── dataBridge │ │ │ ├── Response.java │ │ │ └── Request.java │ │ ├── codec │ │ │ ├── JSONEncoder.java │ │ │ └── JSONDecoder.java │ │ └── config │ │ │ └── RPCConfig.java │ │ ├── util │ │ ├── IoTStringUtil.java │ │ ├── OperConst.java │ │ └── Const.java │ │ ├── mq │ │ ├── VMSSource.java │ │ └── BaseMqSend.java │ │ ├── IoTGatewayApplication.java │ │ ├── config │ │ └── NettyConfig.java │ │ └── server │ │ └── ServerChannelInitializer.java ├── vms-iot-gateway │ ├── vms-driver-virtual │ │ └── src │ │ │ └── main │ │ │ ├── resources │ │ │ ├── application.yml │ │ │ └── META-INF │ │ │ │ └── additional-spring-configuration-metadata.json │ │ │ └── java │ │ │ └── com │ │ │ └── dreamcc │ │ │ ├── driver │ │ │ └── virtual │ │ │ │ ├── dto │ │ │ │ ├── DeviceDTO.java │ │ │ │ └── ProfileDTO.java │ │ │ │ ├── bean │ │ │ │ └── DriverProperty.java │ │ │ │ └── service │ │ │ │ ├── DriverClient.java │ │ │ │ └── DriverRegister.java │ │ │ └── VirtualApplication.java │ └── pom.xml ├── vms-gateway │ └── src │ │ └── main │ │ ├── resources │ │ ├── banner.txt │ │ └── bootstrap.yml │ │ └── java │ │ └── com │ │ └── dreamcc │ │ └── gateway │ │ ├── service │ │ └── ValidateCodeService.java │ │ ├── config │ │ ├── GatewayConfig.java │ │ ├── properties │ │ │ ├── IgnoreWhiteProperties.java │ │ │ ├── CaptchaProperties.java │ │ │ └── XssProperties.java │ │ └── RouterFunctionConfiguration.java │ │ └── RuoYiGatewayApplication.java ├── vms-infrastructure-iot │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── dreamcc │ │ ├── orm │ │ ├── dao │ │ │ └── ProfileDAO.java │ │ ├── service │ │ │ ├── DeviceServiceImpl.java │ │ │ └── DriverServiceImpl.java │ │ ├── mapstruct │ │ │ └── ProfilePoMapper.java │ │ └── dataobject │ │ │ └── ProfileDO.java │ │ ├── config │ │ └── MyMetaObjectHandler.java │ │ └── mq │ │ └── producer │ │ └── DriverProducerImpl.java ├── vms-upms │ └── src │ │ └── main │ │ ├── resources │ │ ├── banner.txt │ │ ├── bootstrap.yml │ │ └── mapper │ │ │ └── system │ │ │ ├── SysRoleMenuMapper.xml │ │ │ ├── SysUserPostMapper.xml │ │ │ └── SysRoleDeptMapper.xml │ │ └── java │ │ └── com │ │ └── dreamcc │ │ └── system │ │ ├── service │ │ ├── ISysPermissionService.java │ │ ├── ISysLogininforService.java │ │ ├── ISysOperLogService.java │ │ ├── ISysUserOnlineService.java │ │ └── ISysNoticeService.java │ │ ├── mapper │ │ ├── SysLogininforMapper.java │ │ ├── SysRoleMenuMapper.java │ │ ├── SysUserPostMapper.java │ │ ├── SysRoleDeptMapper.java │ │ ├── SysOperLogMapper.java │ │ └── SysNoticeMapper.java │ │ ├── domain │ │ ├── SysRoleDept.java │ │ ├── SysRoleMenu.java │ │ ├── SysUserPost.java │ │ └── SysUserRole.java │ │ └── RuoYiSystemApplication.java └── pom.xml ├── vms-modules ├── vms-service-device │ └── src │ │ ├── main │ │ ├── resources │ │ │ ├── META-INF │ │ │ │ └── spring.factories │ │ │ ├── application.yml │ │ │ └── mapper │ │ │ │ └── ServerUnitMapper.xml │ │ └── java │ │ │ └── com │ │ │ └── dreamcc │ │ │ └── service │ │ │ └── device │ │ │ ├── rpc │ │ │ ├── service │ │ │ │ └── IDeviceService.java │ │ │ ├── annotation │ │ │ │ └── RPCService.java │ │ │ ├── dataBridge │ │ │ │ ├── Response.java │ │ │ │ └── Request.java │ │ │ ├── codec │ │ │ │ ├── JSONEncoder.java │ │ │ │ └── JSONDecoder.java │ │ │ └── connection │ │ │ │ └── ServiceDiscovery.java │ │ │ ├── service │ │ │ ├── IServerUnitRefService.java │ │ │ ├── IServerDeviceService.java │ │ │ ├── IServerUnitService.java │ │ │ └── impl │ │ │ │ └── ServerUnitRefServiceImpl.java │ │ │ ├── mapper │ │ │ ├── ServerDeviceMapper.java │ │ │ ├── ServerUnitRefMapper.java │ │ │ └── ServerUnitMapper.java │ │ │ ├── DeviceApplication.java │ │ │ ├── entity │ │ │ └── ServerUnitRef.java │ │ │ ├── config │ │ │ └── MybaitsPlusConfiguer.java │ │ │ ├── dto │ │ │ └── ServerDeviceDTO.java │ │ │ └── controller │ │ │ └── ServerDeviceController.java │ │ └── test │ │ └── java │ │ └── com │ │ └── dreamcc │ │ └── service │ │ └── device │ │ └── BaseTest.java ├── vms-service-alarm │ ├── src │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── dreamcc │ │ │ │ └── service │ │ │ │ └── alarm │ │ │ │ ├── controller │ │ │ │ ├── HelloRegistryFacade.java │ │ │ │ ├── TestService.java │ │ │ │ ├── HelloRegistryFacadeImpl.java │ │ │ │ ├── TestServiceImpl.java │ │ │ │ └── RegistryService.java │ │ │ │ ├── AlarmApplication.java │ │ │ │ └── service │ │ │ │ └── RegistryClient.java │ │ │ └── resources │ │ │ └── application.yml │ └── pom.xml ├── vms-service-file │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── dreamcc │ │ │ └── file │ │ │ ├── service │ │ │ ├── ISysFileService.java │ │ │ ├── LocalSysFileServiceImpl.java │ │ │ └── FastDfsSysFileServiceImpl.java │ │ │ └── RuoYiFileApplication.java │ │ └── resources │ │ └── bootstrap.yml ├── vms-service-monitor │ └── src │ │ └── main │ │ ├── resources │ │ ├── banner.txt │ │ └── bootstrap.yml │ │ └── java │ │ └── com │ │ └── dreamcc │ │ └── monitor │ │ └── RuoYiMonitorApplication.java ├── vms-service-job │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── dreamcc │ │ └── job │ │ ├── util │ │ ├── QuartzJobExecution.java │ │ └── QuartzDisallowConcurrentExecution.java │ │ ├── task │ │ └── RyTask.java │ │ ├── service │ │ └── ISysJobLogService.java │ │ ├── RuoYiJobApplication.java │ │ └── mapper │ │ ├── SysJobMapper.java │ │ └── SysJobLogMapper.java └── pom.xml ├── vms-api ├── vms-api-system │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── spring.factories │ │ │ └── java │ │ │ └── com │ │ │ └── dreamcc │ │ │ └── system │ │ │ └── api │ │ │ ├── factory │ │ │ ├── RemoteFileFallbackFactory.java │ │ │ ├── RemoteLogFallbackFactory.java │ │ │ └── RemoteUserFallbackFactory.java │ │ │ ├── domain │ │ │ └── SysFile.java │ │ │ ├── RemoteFileService.java │ │ │ └── RemoteUserService.java │ └── pom.xml ├── vms-api-iot │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── dreamcc │ │ │ ├── IotApp.java │ │ │ └── api │ │ │ └── iot │ │ │ └── controller │ │ │ └── DriverController.java │ │ └── resources │ │ └── application.yml └── pom.xml ├── vms-application ├── vms-application-iot │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── spring.factories │ │ │ └── java │ │ │ └── com │ │ │ └── dreamcc │ │ │ └── application │ │ │ └── iot │ │ │ ├── command │ │ │ └── CreateProfileCommand.java │ │ │ ├── exception │ │ │ └── DuplicateException.java │ │ │ ├── dto │ │ │ ├── DeviceDTO.java │ │ │ └── ProfileDTO.java │ │ │ ├── mq │ │ │ ├── producer │ │ │ │ └── DriverProducer.java │ │ │ ├── event │ │ │ │ └── DriverEvent.java │ │ │ └── consumer │ │ │ │ └── DriverConsumer.java │ │ │ ├── mapstruct │ │ │ ├── DeviceMapper.java │ │ │ ├── DriverMapper.java │ │ │ └── ProfileMapper.java │ │ │ ├── query │ │ │ └── ProfileQuery.java │ │ │ ├── ProfileQueryApplication.java │ │ │ ├── DeviceApplication.java │ │ │ └── DriverApplication.java │ └── pom.xml └── pom.xml ├── vms-domain ├── vms-domain-iot │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── dreamcc │ │ │ └── domain │ │ │ └── iot │ │ │ ├── common │ │ │ ├── ProfileConstants.java │ │ │ ├── DriverConstants.java │ │ │ ├── MqConstants.java │ │ │ ├── CacheConstants.java │ │ │ ├── annotation │ │ │ │ ├── Entity.java │ │ │ │ ├── ValueObject.java │ │ │ │ └── AggregateRoot.java │ │ │ └── StatusConstants.java │ │ │ ├── domain │ │ │ ├── service │ │ │ │ ├── DeviceFactory.java │ │ │ │ └── IdGenerator.java │ │ │ └── aggregate │ │ │ │ └── status │ │ │ │ └── StatusCenter.java │ │ │ └── repository │ │ │ ├── DeviceRepository.java │ │ │ ├── DriverRepository.java │ │ │ └── ProfileRepository.java │ └── pom.xml └── pom.xml ├── vms-common ├── src │ └── main │ │ └── java │ │ └── com │ │ └── dreamcc │ │ └── common │ │ └── constans │ │ ├── Common.java │ │ └── BaseDomain.java └── pom.xml ├── .gitignore └── vms-test └── pom.xml /resource/iot/iot-业务.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamcc0817/vms/HEAD/resource/iot/iot-业务.png -------------------------------------------------------------------------------- /resource/iot/iot-领域对象.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dreamcc0817/vms/HEAD/resource/iot/iot-领域对象.png -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/concurrent/thread/RequestProcessorThreadPool.java: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-auth/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: vms-auth 4 | # Tomcat 5 | server: 6 | port: 9200 -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.dreamcc.common.config.SwaggerConfig -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.dreamcc.common.core.utils.SpringUtils 3 | 4 | 5 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-auth/src/main/java/com/dreamcc/auth/form/RegisterBody.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.auth.form; 2 | 3 | /** 4 | * 用户注册对象 5 | * 6 | * @author ruoyi 7 | */ 8 | public class RegisterBody extends LoginBody { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-log/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.dreamcc.log.service.AsyncLogService,\ 3 | com.dreamcc.log.aspect.LogAspect 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-redis/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.dreamcc.redis.configure.RedisConfig,\ 3 | com.dreamcc.redis.service.RedisService 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /vms-api/vms-api-system/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.dreamcc.system.api.factory.RemoteUserFallbackFactory,\ 3 | com.dreamcc.system.api.factory.RemoteLogFallbackFactory, \ 4 | com.dreamcc.system.api.factory.RemoteFileFallbackFactory 5 | -------------------------------------------------------------------------------- /vms-application/vms-application-iot/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.dreamcc.application.iot.ProfileCommandApplication,\ 3 | com.dreamcc.application.iot.DeviceApplication,\ 4 | com.dreamcc.application.iot.DriverApplication 5 | 6 | 7 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/test/java/com/bonc/common/BaseTest.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common; 2 | 3 | /** 4 | * @Title: vms 5 | * @Package: com.dreamcc.common 6 | * @Description: 7 | * @Author: dreamcc 8 | * @Date: 2020/1/6 17:19 9 | * @Version: V1.0 10 | */ 11 | 12 | 13 | public class BaseTest { 14 | } 15 | -------------------------------------------------------------------------------- /vms-domain/vms-domain-iot/src/main/java/com/dreamcc/domain/iot/common/ProfileConstants.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.domain.iot.common; 2 | 3 | /** 4 | * @author cloud-cc 5 | * @ClassName ProfileConstants 6 | * @Description 模板常量 7 | * @date 2021/12/2 15:43 8 | * @Version 1.0 9 | */ 10 | public interface ProfileConstants { 11 | } 12 | -------------------------------------------------------------------------------- /vms-modules/vms-service-alarm/src/main/java/com/dreamcc/service/alarm/controller/HelloRegistryFacade.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.alarm.controller; 2 | 3 | import java.rmi.Remote; 4 | import java.rmi.RemoteException; 5 | 6 | public interface HelloRegistryFacade extends Remote { 7 | 8 | String helloWorld(String name) throws RemoteException; 9 | 10 | } -------------------------------------------------------------------------------- /vms-common/src/main/java/com/dreamcc/common/constans/Common.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.constans; 2 | 3 | /** 4 | * @author cloud-cc 5 | * @ClassName Common 6 | * @Description 常量信息 7 | * @date 2021/12/7 09:14 8 | * @Version 1.0 9 | */ 10 | public interface Common { 11 | 12 | String VMS_VIRTUAL_DRIVER_SERVICE_NAME = "VMS-VIRTUAL-DRIVER"; 13 | } 14 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/resources/thread.properties: -------------------------------------------------------------------------------- 1 | #\u7EBF\u7A0B\u6C60\u57FA\u672C\u5927\u5C0F 2 | iot.thread.coreThread=10 3 | #\u7EBF\u7A0B\u6C60\u6700\u5927\u6570\u91CF 4 | iot.thread.maxThread=100 5 | #\u7EBF\u7A0B\u6D3B\u52A8\u4FDD\u6301\u65F6\u95F4 6 | iot.thread.keepAliveTime=10L 7 | #\u4EFB\u52A1\u961F\u5217\u5BB9\u91CF 8 | iot.thread.capacitySize=1000 -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/resources/META-INF/additional-spring-configuration-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "properties": [ 3 | { 4 | "name": "spring.cloud.stream.rocketmq.bindinds.vms-output.destination", 5 | "type": "java.lang.String", 6 | "description": "Description for spring.cloud.stream.rocketmq.bindinds.vms-output.destination." 7 | } 8 | ] } -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-log/src/main/java/com/dreamcc/log/enums/BusinessStatus.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.log.enums; 2 | 3 | /** 4 | * 操作状态 5 | * 6 | * @author ruoyi 7 | * 8 | */ 9 | public enum BusinessStatus 10 | { 11 | /** 12 | * 成功 13 | */ 14 | SUCCESS, 15 | 16 | /** 17 | * 失败 18 | */ 19 | FAIL, 20 | } 21 | -------------------------------------------------------------------------------- /vms-modules/vms-service-alarm/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8899 3 | spring: 4 | application: 5 | name: vms-service-alarm 6 | 7 | cloud: 8 | stream: 9 | rocketmq: 10 | binder: 11 | name-server: 106.12.191.184:9876 12 | bindings: 13 | input: 14 | destination: vms-topic 15 | group: vms-alarm -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-security/src/main/java/com/dreamcc/security/annotation/Logical.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.security.annotation; 2 | 3 | /** 4 | * 权限注解的验证模式 5 | * 6 | * @author ruoyi 7 | * 8 | */ 9 | public enum Logical 10 | { 11 | /** 12 | * 必须具有所有的元素 13 | */ 14 | AND, 15 | 16 | /** 17 | * 只需具有其中一个元素 18 | */ 19 | OR 20 | } 21 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-auth/src/main/java/com/dreamcc/auth/form/LoginBody.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.auth.form; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 用户登录对象 7 | * 8 | * @author ruoyi 9 | */ 10 | @Data 11 | public class LoginBody { 12 | /** 13 | * 用户名 14 | */ 15 | private String username; 16 | 17 | /** 18 | * 用户密码 19 | */ 20 | private String password; 21 | } 22 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-iot-gateway/vms-driver-virtual/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | driver: 2 | driver-info: 3 | name: virtual 4 | type: driver 5 | description: 虚拟驱动 6 | 7 | spring: 8 | application: 9 | name: vms-driver-virtual 10 | cloud: 11 | nacos: 12 | discovery: 13 | # 服务注册地址 14 | server-addr: 127.0.0.1:8848 15 | server: 16 | port: 8897 17 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-security/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.dreamcc.security.config.WebMvcConfig,\ 3 | com.dreamcc.security.service.TokenService,\ 4 | com.dreamcc.security.aspect.PreAuthorizeAspect,\ 5 | com.dreamcc.security.aspect.InnerAuthAspect,\ 6 | com.dreamcc.security.handler.GlobalExceptionHandler 7 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/PreAuthorizeException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception; 2 | 3 | /** 4 | * 权限异常 5 | * 6 | * @author ruoyi 7 | */ 8 | public class PreAuthorizeException extends RuntimeException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public PreAuthorizeException() 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /vms-domain/vms-domain-iot/src/main/java/com/dreamcc/domain/iot/domain/service/DeviceFactory.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.domain.iot.domain.service; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | /** 6 | * @author cloud-cc 7 | * @ClassName DeviceFactory 8 | * @Description 设备工厂类 9 | * @date 2021/11/30 10:28 10 | * @Version 1.0 11 | */ 12 | @Component 13 | public class DeviceFactory { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/DemoModeException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception; 2 | 3 | /** 4 | * 演示模式异常 5 | * 6 | * @author ruoyi 7 | */ 8 | public class DemoModeException extends RuntimeException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public DemoModeException() 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /vms-domain/vms-domain-iot/src/main/java/com/dreamcc/domain/iot/common/DriverConstants.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.domain.iot.common; 2 | 3 | /** 4 | * @author cloud-cc 5 | * @ClassName DriverConstants 6 | * @Description 驱动常量 7 | * @date 2021/12/2 15:43 8 | * @Version 1.0 9 | */ 10 | public interface DriverConstants { 11 | 12 | /** 13 | * 驱动注册事件 14 | */ 15 | String DRIVER_REGISTER = "driver_register"; 16 | } 17 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-log/src/main/java/com/dreamcc/log/enums/OperatorType.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.log.enums; 2 | 3 | /** 4 | * 操作人类别 5 | * 6 | * @author ruoyi 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 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/concurrent/queue/IoTRequest.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.concurrent.queue; 2 | 3 | /** 4 | * @Title: vms 5 | * @Package: com.dreamcc.common.core.concurrent 6 | * @Description: IoT设备请求接口 7 | * @Author: dreamcc 8 | * @Date: 2019/12/10 13:58 9 | * @Version: V1.0 10 | */ 11 | public interface IoTRequest { 12 | 13 | /** 14 | * 执行方法体 15 | */ 16 | void process(); 17 | } 18 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/CaptchaException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception; 2 | 3 | /** 4 | * 验证码错误异常类 5 | * 6 | * @author ruoyi 7 | */ 8 | public class CaptchaException extends RuntimeException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public CaptchaException(String msg) 13 | { 14 | super(msg); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/config/GlobalConfig.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | 5 | /** 6 | * @Title: vms 7 | * @Package: com.dreamcc.common.core.config 8 | * @Description: 全局配置类 9 | * @Author: dreamcc 10 | * @Date: 2019/12/17 9:36 11 | * @Version: V1.0 12 | */ 13 | @Configuration 14 | public class GlobalConfig { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/InnerAuthException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception; 2 | 3 | /** 4 | * 内部认证异常 5 | * 6 | * @author ruoyi 7 | */ 8 | public class InnerAuthException extends RuntimeException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public InnerAuthException(String message) 13 | { 14 | super(message); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/entity/AbstractMonitorMessage.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.entity; 2 | 3 | /** 4 | * @Title: vms 5 | * @Package: com.dreamcc.vms.gateway.entity 6 | * @Description: 监控设备接受消息基类,实现类必须在构造方法中赋予msgType值 7 | * @Author: dreamcc 8 | * @Date: 2019/12/11 10:23 9 | * @Version: V1.0 10 | */ 11 | public abstract class AbstractMonitorMessage { 12 | /** 13 | * 消息类型 14 | */ 15 | public Integer msgType; 16 | } 17 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/test/java/com/dreamcc/service/device/BaseTest.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device; 2 | 3 | import org.springframework.boot.test.context.SpringBootTest; 4 | 5 | /** 6 | * @Title: vms 7 | * @Package: com.dreamcc.service.device 8 | * @Description: 9 | * @Author: dreamcc 10 | * @Date: 2020/1/6 17:22 11 | * @Version: V1.0 12 | */ 13 | @SpringBootTest(classes = DeviceApplication.class) 14 | public class BaseTest { 15 | } 16 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/auth/NotLoginException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception.auth; 2 | 3 | /** 4 | * 未能通过的登录认证异常 5 | * 6 | * @author ruoyi 7 | */ 8 | public class NotLoginException extends RuntimeException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public NotLoginException(String message) 13 | { 14 | super(message); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/rpc/service/IDeviceService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.rpc.service; 2 | 3 | /** 4 | * @Title: vms 5 | * @Package: com.dreamcc.vms.gateway.service 6 | * @Description: 设备服务 7 | * @Author: dreamcc 8 | * @Date: 2019/12/13 14:33 9 | * @Version: V1.0 10 | */ 11 | public interface IDeviceService { 12 | 13 | /** 14 | * 查询设备连接信息 15 | * 16 | * @return 17 | */ 18 | String findDevice(String ip); 19 | } 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/** 4 | !**/src/test/** 5 | *.class 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /vms-application/vms-application-iot/src/main/java/com/dreamcc/application/iot/command/CreateProfileCommand.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.application.iot.command; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author cloud-cc 7 | * @ClassName CreateProfileCommand 8 | * @Description 创建模板命令 9 | * @date 2021/12/7 16:13 10 | * @Version 1.0 11 | */ 12 | @Data 13 | public class CreateProfileCommand { 14 | 15 | private String name; 16 | 17 | private String description; 18 | } 19 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-security/src/main/java/com/dreamcc/security/annotation/InnerAuth.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.security.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 内部认证注解 7 | * 8 | * @author ruoyi 9 | */ 10 | @Target(ElementType.METHOD) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Documented 13 | public @interface InnerAuth 14 | { 15 | /** 16 | * 是否校验用户信息 17 | */ 18 | boolean isUser() default false; 19 | } -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/user/CaptchaExpireException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception.user; 2 | 3 | /** 4 | * 验证码失效异常类 5 | * 6 | * @author ruoyi 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 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-gateway/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | Spring Boot Version: ${spring-boot.version} 2 | 3 | ██ ██ ████ ████ ████████ 4 | ░██ ░██ ░██░██ ██░██ ██░░░░░░ 5 | ░██ ░██ ░██░░██ ██ ░██ ░██ 6 | ░░██ ██ ░██ ░░███ ░██ ░█████████ 7 | ░░██ ██ ░██ ░░█ ░██ ░░░░░░░░██ 8 | ░░████ ░██ ░ ░██ ░██ 9 | ░░██ ░██ ░██ ████████ 10 | ░░ ░░ ░░ ░░░░░░░░ 11 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-datasource/src/main/java/com/dreamcc/datasource/annotation/Master.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.datasource.annotation; 2 | 3 | import com.baomidou.dynamic.datasource.annotation.DS; 4 | 5 | import java.lang.annotation.*; 6 | 7 | /** 8 | * 主库数据源 9 | * 10 | * @author ruoyi 11 | */ 12 | @Target({ ElementType.TYPE, ElementType.METHOD }) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Documented 15 | @DS("master") 16 | public @interface Master 17 | { 18 | 19 | } -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-datasource/src/main/java/com/dreamcc/datasource/annotation/Slave.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.datasource.annotation; 2 | 3 | import com.baomidou.dynamic.datasource.annotation.DS; 4 | 5 | import java.lang.annotation.*; 6 | 7 | /** 8 | * 从库数据源 9 | * 10 | * @author ruoyi 11 | */ 12 | @Target({ ElementType.TYPE, ElementType.METHOD }) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Documented 15 | @DS("slave") 16 | public @interface Slave 17 | { 18 | 19 | } -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/utils/poi/ExcelHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.utils.poi; 2 | 3 | /** 4 | * Excel数据格式处理适配器 5 | * 6 | * @author ruoyi 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 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: iot-gateway 4 | cloud: 5 | stream: 6 | # 配置rocketmq的nameserver地址 7 | rocketmq: 8 | binder: 9 | name-server: 106.12.191.184:9876 10 | bindinds: 11 | vms-output: 12 | destination: vms-topic 13 | netty: 14 | bossThreads: 10 15 | worker-threads: 50 16 | port: 9999 17 | rpc: 18 | boss-threads: 10 19 | worker-threads: 50 20 | port: 9888 -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/rpc/service/IDeviceService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.rpc.service; 2 | 3 | /** 4 | * @Title: vms 5 | * @Package: com.dreamcc.vms.gateway.service 6 | * @Description: 设备服务 7 | * @Author: dreamcc 8 | * @Date: 2019/12/13 14:33 9 | * @Version: V1.0 10 | */ 11 | public interface IDeviceService { 12 | 13 | 14 | /** 15 | * 查询设备连接信息 16 | * @param ip ip 17 | * @return 18 | */ 19 | String findDevice(String ip); 20 | } 21 | -------------------------------------------------------------------------------- /vms-domain/vms-domain-iot/src/main/java/com/dreamcc/domain/iot/common/MqConstants.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.domain.iot.common; 2 | 3 | /** 4 | * @author cloud-cc 5 | * @ClassName MqConstants 6 | * @Description MQ常量 7 | * @date 2021/12/2 17:01 8 | * @Version 1.0 9 | */ 10 | public interface MqConstants { 11 | 12 | String TOPIC_EXCHANGE_EVENT = "vms.exchange.event"; 13 | String ROUTING_DRIVER_EVENT_PREFIX = "vms.routing.event.driver."; 14 | String QUEUE_DRIVER_EVENT = "vms.queue.event.driver"; 15 | } 16 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/user/UserPasswordNotMatchException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception.user; 2 | 3 | /** 4 | * 用户密码不正确或不符合规范异常类 5 | * 6 | * @author ruoyi 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 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-infrastructure-iot/src/main/java/com/dreamcc/orm/dao/ProfileDAO.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.orm.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.dreamcc.orm.dataobject.ProfileDO; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * @author cloud-cc 9 | * @ClassName ProfileDAO 10 | * @Description Profile数据库操作类 11 | * @date 2021/12/1 09:10 12 | * @Version 1.0 13 | */ 14 | @Mapper 15 | public interface ProfileDAO extends BaseMapper { 16 | 17 | } -------------------------------------------------------------------------------- /vms-modules/vms-service-alarm/src/main/java/com/dreamcc/service/alarm/controller/TestService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.alarm.controller; 2 | 3 | import java.rmi.Remote; 4 | import java.rmi.RemoteException; 5 | 6 | /** 7 | * @Title: vms 8 | * @Package: com.dreamcc.service.alarm.controller 9 | * @Description: 10 | * @Author: dreamcc 11 | * @Date: 2020/1/15 8:49 12 | * @Version: V1.0 13 | */ 14 | public interface TestService extends Remote { 15 | 16 | String helloWorld(String name) throws RemoteException; 17 | 18 | } -------------------------------------------------------------------------------- /vms-domain/vms-domain-iot/src/main/java/com/dreamcc/domain/iot/common/CacheConstants.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.domain.iot.common; 2 | 3 | /** 4 | * @author cloud-cc 5 | * @ClassName CacheConstants 6 | * @Description 缓存KEY常量 7 | * @date 2021/11/30 16:08 8 | * @Version 1.0 9 | */ 10 | public interface CacheConstants { 11 | 12 | String ID = "_id"; 13 | String NAME = "_name"; 14 | String TYPE = "_type"; 15 | String PROFILE = "profile"; 16 | String LIST = "_list"; 17 | String DIC = "_dic"; 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/annotation/Excels.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.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注解集 10 | * 11 | * @author ruoyi 12 | */ 13 | @Target(ElementType.FIELD) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface Excels 16 | { 17 | Excel[] value(); 18 | } -------------------------------------------------------------------------------- /vms-modules/vms-service-file/src/main/java/com/dreamcc/file/service/ISysFileService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.file.service; 2 | 3 | import org.springframework.web.multipart.MultipartFile; 4 | 5 | /** 6 | * 文件上传接口 7 | * 8 | * @author ruoyi 9 | */ 10 | public interface ISysFileService 11 | { 12 | /** 13 | * 文件上传接口 14 | * 15 | * @param file 上传的文件 16 | * @return 访问地址 17 | * @throws Exception 18 | */ 19 | public String uploadFile(MultipartFile file) throws Exception; 20 | } 21 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-auth/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | Spring Boot Version: ${spring-boot.version} 2 | Spring Application Name: ${spring.application.name} 3 | 4 | ██ ██ ████ ████ ████████ 5 | ░██ ░██ ░██░██ ██░██ ██░░░░░░ 6 | ░██ ░██ ░██░░██ ██ ░██ ░██ 7 | ░░██ ██ ░██ ░░███ ░██ ░█████████ 8 | ░░██ ██ ░██ ░░█ ░██ ░░░░░░░░██ 9 | ░░████ ░██ ░ ░██ ░██ 10 | ░░██ ░██ ░██ ████████ 11 | ░░ ░░ ░░ ░░░░░░░░ 12 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | Spring Boot Version: ${spring-boot.version} 2 | Spring Application Name: ${spring.application.name} 3 | 4 | ██ ██ ████ ████ ████████ 5 | ░██ ░██ ░██░██ ██░██ ██░░░░░░ 6 | ░██ ░██ ░██░░██ ██ ░██ ░██ 7 | ░░██ ██ ░██ ░░███ ░██ ░█████████ 8 | ░░██ ██ ░██ ░░█ ░██ ░░░░░░░░██ 9 | ░░████ ░██ ░ ░██ ░██ 10 | ░░██ ░██ ░██ ████████ 11 | ░░ ░░ ░░ ░░░░░░░░ 12 | -------------------------------------------------------------------------------- /vms-domain/vms-domain-iot/src/main/java/com/dreamcc/domain/iot/common/annotation/Entity.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.domain.iot.common.annotation; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | import java.lang.annotation.*; 6 | 7 | /** 8 | * @author cloud-cc 9 | * @ClassName Entity 10 | * @Description 领域实体 11 | * @date 2021/12/8 09:02 12 | * @Version 1.0 13 | */ 14 | @Documented 15 | @Inherited 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Target({ ElementType.TYPE }) 18 | @Component 19 | public @interface Entity { 20 | } 21 | -------------------------------------------------------------------------------- /vms-modules/vms-service-monitor/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | Spring Boot Version: ${spring-boot.version} 2 | Spring Application Name: ${spring.application.name} 3 | 4 | ██ ██ ████ ████ ████████ 5 | ░██ ░██ ░██░██ ██░██ ██░░░░░░ 6 | ░██ ░██ ░██░░██ ██ ░██ ░██ 7 | ░░██ ██ ░██ ░░███ ░██ ░█████████ 8 | ░░██ ██ ░██ ░░█ ░██ ░░░░░░░░██ 9 | ░░████ ░██ ░ ░██ ░██ 10 | ░░██ ░██ ░██ ████████ 11 | ░░ ░░ ░░ ░░░░░░░░ 12 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/file/FileSizeLimitExceededException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception.file; 2 | 3 | /** 4 | * 文件名大小限制异常类 5 | * 6 | * @author ruoyi 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 | -------------------------------------------------------------------------------- /vms-domain/vms-domain-iot/src/main/java/com/dreamcc/domain/iot/common/annotation/ValueObject.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.domain.iot.common.annotation; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | import java.lang.annotation.*; 6 | 7 | /** 8 | * @author cloud-cc 9 | * @ClassName ValueObject 10 | * @Description 值对象 11 | * @date 2021/12/8 09:47 12 | * @Version 1.0 13 | */ 14 | @Documented 15 | @Inherited 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Target({ ElementType.TYPE }) 18 | @Component 19 | public @interface ValueObject { 20 | } 21 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/file/FileException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception.file; 2 | 3 | import com.dreamcc.common.core.exception.base.BaseException; 4 | 5 | /** 6 | * 文件信息异常类 7 | * 8 | * @author ruoyi 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 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/user/UserException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception.user; 2 | 3 | 4 | import com.dreamcc.common.core.exception.base.BaseException; 5 | 6 | /** 7 | * 用户信息异常类 8 | * 9 | * @author ruoyi 10 | */ 11 | public class UserException extends BaseException 12 | { 13 | private static final long serialVersionUID = 1L; 14 | 15 | public UserException(String code, Object[] args) 16 | { 17 | super("user", code, args, null); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vms-modules/vms-service-job/src/main/java/com/dreamcc/job/util/QuartzJobExecution.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.job.util; 2 | 3 | import com.dreamcc.job.domain.SysJob; 4 | import org.quartz.JobExecutionContext; 5 | 6 | /** 7 | * 定时任务处理(允许并发执行) 8 | * 9 | * @author ruoyi 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 | -------------------------------------------------------------------------------- /vms-application/vms-application-iot/src/main/java/com/dreamcc/application/iot/exception/DuplicateException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.application.iot.exception; 2 | 3 | import cn.hutool.core.util.StrUtil; 4 | 5 | /** 6 | * @author cloud-cc 7 | * @ClassName DuplicateException 8 | * @Description 重复异常 9 | * @date 2021/11/30 16:56 10 | * @Version 1.0 11 | */ 12 | public class DuplicateException extends RuntimeException { 13 | public DuplicateException(CharSequence template, Object... params) { 14 | super(StrUtil.format(template, params)); 15 | } 16 | } -------------------------------------------------------------------------------- /vms-domain/vms-domain-iot/src/main/java/com/dreamcc/domain/iot/common/annotation/AggregateRoot.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.domain.iot.common.annotation; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | import java.lang.annotation.*; 6 | 7 | /** 8 | * @author cloud-cc 9 | * @ClassName AggregateRoot 10 | * @Description 聚合根 11 | * @date 2021/12/8 09:01 12 | * @Version 1.0 13 | */ 14 | @Documented 15 | @Inherited 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Target({ ElementType.TYPE }) 18 | @Component 19 | public @interface AggregateRoot { 20 | } 21 | -------------------------------------------------------------------------------- /vms-domain/vms-domain-iot/src/main/java/com/dreamcc/domain/iot/domain/service/IdGenerator.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.domain.iot.domain.service; 2 | 3 | import cn.hutool.core.util.IdUtil; 4 | 5 | /** 6 | * @author cloud-cc 7 | * @ClassName IdGenerator 8 | * @Description Id生成器 9 | * @date 2021/11/27 13:59 10 | * @Version 1.0 11 | */ 12 | public class IdGenerator { 13 | 14 | /** 15 | * 生成ID 16 | * 17 | * @return 雪花算法ID 18 | */ 19 | public static Long snowFlakeId() { 20 | return IdUtil.createSnowflake(1, 1).nextId(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/service/IServerUnitRefService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.dreamcc.service.device.entity.ServerUnitRef; 5 | 6 | /** 7 | * @Title: vms 8 | * @Package: com.dreamcc.service.device.service 9 | * @Description: 服务器与服务单元关系类service 10 | * @Author: dreamcc 11 | * @Date: 2020/1/2 11:34 12 | * @Version: V1.0 13 | */ 14 | public interface IServerUnitRefService extends IService { 15 | } 16 | -------------------------------------------------------------------------------- /vms-application/vms-application-iot/src/main/java/com/dreamcc/application/iot/dto/DeviceDTO.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.application.iot.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @author cloud-cc 11 | * @ClassName DeviceDTO 12 | * @Description 设备传输对象 13 | * @date 2021/11/30 14:55 14 | * @Version 1.0 15 | */ 16 | @Data 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | public class DeviceDTO implements Serializable { 20 | private Long id; 21 | } 22 | -------------------------------------------------------------------------------- /vms-application/vms-application-iot/src/main/java/com/dreamcc/application/iot/mq/producer/DriverProducer.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.application.iot.mq.producer; 2 | 3 | import com.dreamcc.application.iot.mq.event.DriverEvent; 4 | 5 | /** 6 | * @author cloud-cc 7 | * @ClassName DriverProducer 8 | * @Description 驱动事件生产者 9 | * @date 2021/12/2 14:13 10 | * @Version 1.0 11 | */ 12 | public interface DriverProducer { 13 | 14 | /** 15 | * 驱动事件发送 16 | * 17 | * @param driverEvent 消息 18 | */ 19 | void driverEventSender(DriverEvent driverEvent); 20 | } 21 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-security/src/main/java/com/dreamcc/security/annotation/RequiresLogin.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.security.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 | * 登录认证:只有登录之后才能进入该方法 10 | * 11 | * @author ruoyi 12 | * 13 | */ 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Target({ ElementType.METHOD, ElementType.TYPE }) 16 | public @interface RequiresLogin 17 | { 18 | } 19 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/rpc/annotation/RPCService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.rpc.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * @Title: vms 7 | * @Package: com.dreamcc.service.device.rpc.annotation 8 | * @Description: RPC注解 9 | * @Author: dreamcc 10 | * @Date: 2019/12/13 15:08 11 | * @Version: V1.0 12 | */ 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Target({ElementType.TYPE, ElementType.METHOD}) 15 | @Documented 16 | public @interface RPCService { 17 | String value() default ""; 18 | } 19 | -------------------------------------------------------------------------------- /vms-modules/vms-service-alarm/src/main/java/com/dreamcc/service/alarm/controller/HelloRegistryFacadeImpl.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.alarm.controller; 2 | 3 | import java.rmi.RemoteException; 4 | import java.rmi.server.UnicastRemoteObject; 5 | 6 | public class HelloRegistryFacadeImpl extends UnicastRemoteObject implements HelloRegistryFacade{ 7 | 8 | public HelloRegistryFacadeImpl() throws RemoteException { 9 | super(); 10 | } 11 | 12 | @Override 13 | public String helloWorld(String name) { 14 | return "[Registry] 你好! " + name; 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /vms-infrastructure/vms-iot-gateway/vms-driver-virtual/src/main/java/com/dreamcc/driver/virtual/dto/DeviceDTO.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.driver.virtual.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @author cloud-cc 11 | * @ClassName DeviceDTO 12 | * @Description 设备传输对象 13 | * @date 2021/11/30 14:55 14 | * @Version 1.0 15 | */ 16 | @Data 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | public class DeviceDTO implements Serializable { 20 | private Long id; 21 | } 22 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/file/FileNameLengthLimitExceededException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception.file; 2 | 3 | /** 4 | * 文件名称超长限制异常类 5 | * 6 | * @author ruoyi 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 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/util/IoTStringUtil.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.util; 2 | 3 | /** 4 | * @Title: vms 5 | * @Package: com.dreamcc.vms.gateway.util 6 | * @Description: 7 | * @Author: dreamcc 8 | * @Date: 2019/12/10 17:21 9 | * @Version: V1.0 10 | */ 11 | public class IoTStringUtil { 12 | 13 | /** 14 | * 格式化IP地址 15 | * 16 | * @param ip IP地址 17 | * @param port 端口号 18 | * @return 格式化后的地址 19 | */ 20 | public static String formatIpAddress(String ip, String port) { 21 | return String.format("%s:%s", ip.trim(), port.trim()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/java/com/dreamcc/system/service/ISysPermissionService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.service; 2 | 3 | import java.util.Set; 4 | 5 | public interface ISysPermissionService 6 | { 7 | /** 8 | * 获取角色数据权限 9 | * 10 | * @param userId 用户Id 11 | * @return 角色权限信息 12 | */ 13 | public Set getRolePermission(Long userId); 14 | 15 | /** 16 | * 获取菜单数据权限 17 | * 18 | * @param userId 用户Id 19 | * @return 菜单权限信息 20 | */ 21 | public Set getMenuPermission(Long userId); 22 | } 23 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-security/src/main/java/com/dreamcc/security/feign/FeignAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.security.feign; 2 | 3 | import feign.RequestInterceptor; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * Feign 配置注册 9 | * 10 | * @author ruoyi 11 | **/ 12 | @Configuration 13 | public class FeignAutoConfiguration 14 | { 15 | @Bean 16 | public RequestInterceptor requestInterceptor() 17 | { 18 | return new FeignRequestInterceptor(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/constant/CacheConstants.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.constant; 2 | 3 | /** 4 | * 缓存的key 常量 5 | * 6 | * @author ruoyi 7 | */ 8 | public class CacheConstants 9 | { 10 | /** 11 | * 缓存有效期,默认720(分钟) 12 | */ 13 | public final static long EXPIRATION = 720; 14 | 15 | /** 16 | * 缓存刷新时间,默认120(分钟) 17 | */ 18 | public final static long REFRESH_TIME = 120; 19 | 20 | /** 21 | * 权限缓存前缀 22 | */ 23 | public final static String LOGIN_TOKEN_KEY = "login_tokens:"; 24 | } 25 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/entity/KeepAliveReceived.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.entity; 2 | 3 | import com.dreamcc.iot.util.Const; 4 | 5 | /** 6 | * @Title: vms 7 | * @Package: com.dreamcc.vms.gateway.entity 8 | * @Description: 接收心跳信息 9 | * @Author: dreamcc 10 | * @Date: 2019/12/24 9:24 11 | * @Version: V1.0 12 | */ 13 | public class KeepAliveReceived extends AbstractMonitorMessageReceived{ 14 | 15 | public KeepAliveReceived(){ 16 | super.msgType= Const.Gateway.RPC_HEART_BEAT.getCode(); 17 | } 18 | 19 | @Override 20 | public void process() { 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vms-api/vms-api-iot/src/main/java/com/dreamcc/IotApp.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cache.annotation.EnableCaching; 6 | 7 | /** 8 | * @author cloud-cc 9 | * @ClassName IotApp 10 | * @Description Iot启动类 11 | * @date 2021/11/27 20:48 12 | * @Version 1.0 13 | */ 14 | @EnableCaching 15 | @SpringBootApplication 16 | public class IotApp { 17 | public static void main(String[] args) { 18 | SpringApplication.run(IotApp.class, args); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/mapper/ServerDeviceMapper.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.dreamcc.service.device.entity.ServerDevice; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * @Title: vms 9 | * @Package: com.dreamcc.service.device.dao 10 | * @Description: 服务器设备业务逻辑处理类 11 | * @Author: dreamcc 12 | * @Date: 2019/12/23 15:03 13 | * @Version: V1.0 14 | */ 15 | @Mapper 16 | public interface ServerDeviceMapper extends BaseMapper { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/mapper/ServerUnitRefMapper.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.dreamcc.service.device.entity.ServerUnitRef; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * @Title: vms 9 | * @Package: com.dreamcc.service.device.dao 10 | * @Description: 服务器与服务单元Mapper 11 | * @Author: dreamcc 12 | * @Date: 2020/1/2 11:37 13 | * @Version: V1.0 14 | */ 15 | @Mapper 16 | public interface ServerUnitRefMapper extends BaseMapper { 17 | } 18 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/constant/TokenConstants.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.constant; 2 | 3 | /** 4 | * Token的Key常量 5 | * 6 | * @author ruoyi 7 | */ 8 | public class TokenConstants 9 | { 10 | /** 11 | * 令牌自定义标识 12 | */ 13 | public static final String AUTHENTICATION = "Authorization"; 14 | 15 | /** 16 | * 令牌前缀 17 | */ 18 | public static final String PREFIX = "Bearer "; 19 | 20 | /** 21 | * 令牌秘钥 22 | */ 23 | public final static String SECRET = "abcdefghijklmnopqrstuvwxyz"; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/constant/ServiceNameConstants.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.constant; 2 | 3 | /** 4 | * 服务名称 5 | * 6 | * @author ruoyi 7 | */ 8 | public class ServiceNameConstants 9 | { 10 | /** 11 | * 认证服务的serviceid 12 | */ 13 | public static final String AUTH_SERVICE = "vms-auth"; 14 | 15 | /** 16 | * 系统模块的serviceid 17 | */ 18 | public static final String SYSTEM_SERVICE = "vms-upms"; 19 | 20 | /** 21 | * 文件服务的serviceid 22 | */ 23 | public static final String FILE_SERVICE = "vms-file"; 24 | } 25 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/DeviceApplication.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * @Title: vms 8 | * @Package: com.dreamcc.service.device 9 | * @Description: 设备服务启动类 10 | * @Author: dreamcc 11 | * @Date: 2019/12/16 17:57 12 | * @Version: V1.0 13 | */ 14 | @SpringBootApplication 15 | public class DeviceApplication { 16 | public static void main(String[] args) { 17 | SpringApplication.run(DeviceApplication.class, args); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/auth/NotRoleException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception.auth; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | 5 | /** 6 | * 未能通过的角色认证异常 7 | * 8 | * @author ruoyi 9 | */ 10 | public class NotRoleException extends RuntimeException 11 | { 12 | private static final long serialVersionUID = 1L; 13 | 14 | public NotRoleException(String role) 15 | { 16 | super(role); 17 | } 18 | 19 | public NotRoleException(String[] roles) 20 | { 21 | super(StringUtils.join(roles, ",")); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/entity/ServerUnitRef.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import lombok.Data; 5 | 6 | /** 7 | * @Title: vms 8 | * @Package: com.dreamcc.service.device.entity 9 | * @Description: 服务器设备与服务单元关系类 10 | * @Author: dreamcc 11 | * @Date: 2020/1/2 11:25 12 | * @Version: V1.0 13 | */ 14 | @Data 15 | @TableName("device_server_unit_ref") 16 | public class ServerUnitRef { 17 | 18 | /** 19 | * 服务器ID 20 | */ 21 | private Long serverId; 22 | /** 23 | * 设备服务单元ID 24 | */ 25 | private Long unitId; 26 | } 27 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-auth/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | # Tomcat 2 | server: 3 | port: 9200 4 | 5 | # Spring 6 | spring: 7 | application: 8 | # 应用名称 9 | name: vms-auth 10 | profiles: 11 | # 环境配置 12 | active: dev 13 | cloud: 14 | nacos: 15 | discovery: 16 | # 服务注册地址 17 | server-addr: 127.0.0.1:8848 18 | config: 19 | # 配置中心地址 20 | server-addr: 127.0.0.1:8848 21 | # 配置文件格式 22 | file-extension: yml 23 | # 共享配置 24 | shared-configs: 25 | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} 26 | -------------------------------------------------------------------------------- /vms-modules/vms-service-file/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | # Tomcat 2 | server: 3 | port: 9300 4 | 5 | # Spring 6 | spring: 7 | application: 8 | # 应用名称 9 | name: ruoyi-file 10 | profiles: 11 | # 环境配置 12 | active: dev 13 | cloud: 14 | nacos: 15 | discovery: 16 | # 服务注册地址 17 | server-addr: 127.0.0.1:8848 18 | config: 19 | # 配置中心地址 20 | server-addr: 127.0.0.1:8848 21 | # 配置文件格式 22 | file-extension: yml 23 | # 共享配置 24 | shared-configs: 25 | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} 26 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/mq/VMSSource.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.mq; 2 | 3 | import org.springframework.cloud.stream.annotation.Output; 4 | import org.springframework.messaging.MessageChannel; 5 | 6 | /** 7 | * @Title: vms 8 | * @Package: com.dreamcc.vms.gateway.mq 9 | * @Description: vms自定义生产者 10 | * @Author: dreamcc 11 | * @Date: 2020/1/7 16:23 12 | * @Version: V1.0 13 | */ 14 | public interface VMSSource { 15 | 16 | /** 17 | * vms-output 18 | */ 19 | String VMS_OUTPUT = "vms-output"; 20 | 21 | /** 22 | * 输出 23 | * 24 | * @return MessageChannel 25 | */ 26 | @Output 27 | MessageChannel output(); 28 | } 29 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | # Tomcat 2 | server: 3 | port: 9201 4 | 5 | # Spring 6 | spring: 7 | application: 8 | # 应用名称 9 | name: vms-upms 10 | profiles: 11 | # 环境配置 12 | active: dev 13 | cloud: 14 | nacos: 15 | discovery: 16 | # 服务注册地址 17 | server-addr: 127.0.0.1:8848 18 | # config: 19 | # # 配置中心地址 20 | # server-addr: 127.0.0.1:8848 21 | # # 配置文件格式 22 | # file-extension: yml 23 | # # 共享配置 24 | # shared-configs: 25 | # - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} 26 | -------------------------------------------------------------------------------- /vms-modules/vms-service-monitor/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | # Tomcat 2 | server: 3 | port: 9100 4 | 5 | # Spring 6 | spring: 7 | application: 8 | # 应用名称 9 | name: ruoyi-monitor 10 | profiles: 11 | # 环境配置 12 | active: dev 13 | cloud: 14 | nacos: 15 | discovery: 16 | # 服务注册地址 17 | server-addr: 127.0.0.1:8848 18 | config: 19 | # 配置中心地址 20 | server-addr: 127.0.0.1:8848 21 | # 配置文件格式 22 | file-extension: yml 23 | # 共享配置 24 | shared-configs: 25 | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} 26 | -------------------------------------------------------------------------------- /vms-domain/vms-domain-iot/src/main/java/com/dreamcc/domain/iot/common/StatusConstants.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.domain.iot.common; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * @author cloud-cc 7 | * @ClassName StatusConstants 8 | * @Description 状态常量 9 | * @date 2021/11/29 21:09 10 | * @Version 1.0 11 | */ 12 | public enum StatusConstants { 13 | /** 14 | * 在线 15 | */ 16 | ONLINE(0), 17 | /** 18 | * 离线 19 | */ 20 | OFF_LINE(1), 21 | /** 22 | * 未知 23 | */ 24 | UNKNOWN(2); 25 | 26 | @Getter 27 | private Integer code; 28 | 29 | StatusConstants(Integer code) { 30 | this.code = code; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /vms-domain/vms-domain-iot/src/main/java/com/dreamcc/domain/iot/repository/DeviceRepository.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.domain.iot.repository; 2 | 3 | import com.dreamcc.domain.iot.domain.aggregate.device.Device; 4 | 5 | /** 6 | * @author cloud-cc 7 | * @ClassName DeviceRepository 8 | * @Description 设备仓储类 9 | * @date 2021/11/30 09:12 10 | * @Version 1.0 11 | */ 12 | public interface DeviceRepository { 13 | 14 | /** 15 | * 保存设备 16 | * 17 | * @param device 设备信息 18 | */ 19 | void save(Device device); 20 | 21 | /** 22 | * 通过ID获取设备 23 | * 24 | * @param id ID 25 | * @return 设备 26 | */ 27 | Device getById(Long id); 28 | } 29 | -------------------------------------------------------------------------------- /vms-domain/vms-domain-iot/src/main/java/com/dreamcc/domain/iot/repository/DriverRepository.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.domain.iot.repository; 2 | 3 | import com.dreamcc.domain.iot.domain.aggregate.driver.Driver; 4 | 5 | /** 6 | * @author cloud-cc 7 | * @ClassName DriverRepository 8 | * @Description 驱动仓储类 9 | * @date 2021/11/30 09:13 10 | * @Version 1.0 11 | */ 12 | public interface DriverRepository { 13 | 14 | /** 15 | * 注册驱动 16 | * 17 | * @param driver 驱动 18 | */ 19 | void save(Driver driver); 20 | 21 | /** 22 | * 根据ID获取驱动 23 | * 24 | * @param id ID 25 | * @return 驱动 26 | */ 27 | Driver getById(Long id); 28 | } 29 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-gateway/src/main/java/com/dreamcc/gateway/service/ValidateCodeService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.gateway.service; 2 | 3 | import com.dreamcc.common.core.exception.CaptchaException; 4 | import com.dreamcc.common.core.web.domain.AjaxResult; 5 | 6 | import java.io.IOException; 7 | 8 | /** 9 | * 验证码处理 10 | * 11 | * @author ruoyi 12 | */ 13 | public interface ValidateCodeService 14 | { 15 | /** 16 | * 生成验证码 17 | */ 18 | AjaxResult createCapcha() throws IOException, CaptchaException; 19 | 20 | /** 21 | * 校验验证码 22 | */ 23 | void checkCapcha(String key, String value) throws CaptchaException; 24 | } 25 | -------------------------------------------------------------------------------- /vms-modules/vms-service-job/src/main/java/com/dreamcc/job/util/QuartzDisallowConcurrentExecution.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.job.util; 2 | 3 | import com.dreamcc.job.domain.SysJob; 4 | import org.quartz.DisallowConcurrentExecution; 5 | import org.quartz.JobExecutionContext; 6 | 7 | /** 8 | * 定时任务处理(禁止并发执行) 9 | * 10 | * @author ruoyi 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 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/entity/AbstractMonitorMessageReceived.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.entity; 2 | 3 | import io.netty.channel.ChannelHandlerContext; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | /** 8 | * @Title: vms 9 | * @Package: com.dreamcc.vms.gateway.entity 10 | * @Description: 接受消息的基类 11 | * @Author: dreamcc 12 | * @Date: 2019/12/11 11:20 13 | * @Version: V1.0 14 | */ 15 | @Getter 16 | @Setter 17 | public abstract class AbstractMonitorMessageReceived extends AbstractMonitorMessage { 18 | 19 | private ChannelHandlerContext ctx; 20 | 21 | /** 22 | * 处理解码逻辑实现类 23 | */ 24 | public abstract void process(); 25 | } 26 | -------------------------------------------------------------------------------- /vms-application/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | vms-application 13 | 14 | pom 15 | 16 | 17 | vms-application-iot 18 | 19 | -------------------------------------------------------------------------------- /vms-application/vms-application-iot/src/main/java/com/dreamcc/application/iot/mq/event/DriverEvent.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.application.iot.mq.event; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author cloud-cc 7 | * @ClassName DriverEvent 8 | * @Description 驱动消息 9 | * @date 2021/12/2 14:21 10 | * @Version 1.0 11 | */ 12 | @Data 13 | public class DriverEvent { 14 | 15 | /** 16 | * Driver Event 17 | */ 18 | private String type; 19 | 20 | private Object content; 21 | 22 | public DriverEvent() { 23 | } 24 | 25 | public DriverEvent(String type, Object content) { 26 | this.type = type; 27 | this.content = content; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/auth/NotPermissionException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception.auth; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | 5 | /** 6 | * 未能通过的权限认证异常 7 | * 8 | * @author ruoyi 9 | */ 10 | public class NotPermissionException extends RuntimeException 11 | { 12 | private static final long serialVersionUID = 1L; 13 | 14 | public NotPermissionException(String permission) 15 | { 16 | super(permission); 17 | } 18 | 19 | public NotPermissionException(String[] permissions) 20 | { 21 | super(StringUtils.join(permissions, ",")); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vms-application/vms-application-iot/src/main/java/com/dreamcc/application/iot/mq/consumer/DriverConsumer.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.application.iot.mq.consumer; 2 | 3 | import com.dreamcc.application.iot.mq.event.DriverEvent; 4 | 5 | /** 6 | * @author cloud-cc 7 | * @ClassName DriverConsumer 8 | * @Description 驱动事件消费者 9 | * @date 2021/12/2 14:44 10 | * @Version 1.0 11 | */ 12 | public interface DriverConsumer { 13 | 14 | /** 15 | * 发送握手命令 16 | * 17 | * @return DriverEvent 18 | */ 19 | DriverEvent receiveHandShakeEvent(); 20 | 21 | /** 22 | * 接收注册事件 23 | * 24 | * @return DriverEvent 25 | */ 26 | DriverEvent receiveRegisterEvent(); 27 | } 28 | -------------------------------------------------------------------------------- /vms-application/vms-application-iot/src/main/java/com/dreamcc/application/iot/mapstruct/DeviceMapper.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.application.iot.mapstruct; 2 | 3 | import com.dreamcc.application.iot.dto.DeviceDTO; 4 | import com.dreamcc.domain.iot.domain.aggregate.device.Device; 5 | import org.mapstruct.Mapper; 6 | 7 | /** 8 | * @author cloud-cc 9 | * @ClassName DeviceMap 10 | * @Description 转换类 11 | * @date 2021/11/30 15:01 12 | * @Version 1.0 13 | */ 14 | @Mapper(componentModel = "spring") 15 | public interface DeviceMapper { 16 | 17 | /** 18 | * entity转dto 19 | * 20 | * @param device entity 21 | * @return dto 22 | */ 23 | DeviceDTO deviceToDto(Device device); 24 | } 25 | -------------------------------------------------------------------------------- /vms-application/vms-application-iot/src/main/java/com/dreamcc/application/iot/mapstruct/DriverMapper.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.application.iot.mapstruct; 2 | 3 | import com.dreamcc.application.iot.dto.DriverDTO; 4 | import com.dreamcc.domain.iot.domain.aggregate.driver.Driver; 5 | import org.mapstruct.Mapper; 6 | 7 | /** 8 | * @author cloud-cc 9 | * @ClassName DriverMap 10 | * @Description 转换类 11 | * @date 2021/11/30 15:06 12 | * @Version 1.0 13 | */ 14 | @Mapper(componentModel = "spring") 15 | public interface DriverMapper { 16 | 17 | /** 18 | * entity转dto 19 | * 20 | * @param driver entity 21 | * @return dto 22 | */ 23 | DriverDTO driverToDto(Driver driver); 24 | } 25 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/UtilException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception; 2 | 3 | /** 4 | * 工具类异常 5 | * 6 | * @author ruoyi 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 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/entity/IotInfo.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.util.Map; 9 | 10 | /** 11 | * @Title: vms 12 | * @Package: com.dreamcc.vms.gateway.entity 13 | * @Description: IOT设备信息 14 | * @Author: dreamcc 15 | * @Date: 2020/1/5 19:14 16 | * @Version: V1.0 17 | */ 18 | @Data 19 | @NoArgsConstructor 20 | @AllArgsConstructor 21 | @Builder 22 | public class IotInfo { 23 | /** 24 | * IOT设备ID 25 | */ 26 | private String id; 27 | /** 28 | * 设备消息 29 | */ 30 | private Map data; 31 | } 32 | -------------------------------------------------------------------------------- /vms-modules/vms-service-alarm/src/main/java/com/dreamcc/service/alarm/controller/TestServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.alarm.controller; 2 | 3 | import java.rmi.RemoteException; 4 | import java.rmi.server.UnicastRemoteObject; 5 | 6 | /** 7 | * @Title: vms 8 | * @Package: com.dreamcc.service.alarm.controller 9 | * @Description: 10 | * @Author: dreamcc 11 | * @Date: 2020/1/15 8:50 12 | * @Version: V1.0 13 | */ 14 | public class TestServiceImpl extends UnicastRemoteObject implements TestService { 15 | public TestServiceImpl() throws RemoteException { 16 | super(); 17 | } 18 | 19 | @Override 20 | public String helloWorld(String name) { 21 | return "[Registry] hello! " + name; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/mq/BaseMqSend.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.mq; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | /** 9 | * @Title: vms 10 | * @Package: com.dreamcc.vms.gateway.mq 11 | * @Description: mq发送消息基类 12 | * @Author: dreamcc 13 | * @Date: 2019/12/31 10:48 14 | * @Version: V1.0 15 | */ 16 | @Data 17 | @Builder 18 | @NoArgsConstructor 19 | @AllArgsConstructor 20 | public class BaseMqSend { 21 | /** 22 | * ip地址 23 | */ 24 | private String ip; 25 | /** 26 | * 接收到的消息 27 | */ 28 | private Object msg; 29 | /** 30 | * 设备状态 31 | */ 32 | private Integer state; 33 | } 34 | -------------------------------------------------------------------------------- /vms-test/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | vms-test 13 | 14 | 15 | 8 16 | 8 17 | 18 | 19 | -------------------------------------------------------------------------------- /vms-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | 13 | vms-api-system 14 | vms-api-iot 15 | 16 | 17 | vms-api 18 | 19 | pom 20 | 21 | 22 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/rpc/annotation/RPCService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.rpc.annotation; 2 | 3 | import org.springframework.stereotype.Component; 4 | 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 | * @Title: vms 12 | * @Package: com.dreamcc.vms.gateway.rpc 13 | * @Description: RPC注解 14 | * @Author: dreamcc 15 | * @Date: 2019/12/13 15:08 16 | * @Version: V1.0 17 | */ 18 | @Target({ElementType.TYPE}) 19 | @Retention(RetentionPolicy.RUNTIME) 20 | @Component 21 | public @interface RPCService { 22 | String value() default ""; 23 | } 24 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/rpc/dataBridge/Response.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.rpc.dataBridge; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @Title: vms 9 | * @Package: com.dreamcc.vms.gateway.rpc.dataBridge 10 | * @Description: 返回信息 11 | * @Author: dreamcc 12 | * @Date: 2019/12/13 15:13 13 | * @Version: V1.0 14 | */ 15 | @Data 16 | public class Response implements Serializable { 17 | 18 | private static final long serialVersionUID = 4852847675718142511L; 19 | /** 20 | * 请求ID 21 | */ 22 | private String requestId; 23 | /** 24 | * 响应码 25 | */ 26 | private int code; 27 | /** 28 | * 返回消息 29 | */ 30 | private Object data; 31 | } 32 | -------------------------------------------------------------------------------- /vms-domain/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | vms-domain 13 | 14 | pom 15 | 16 | 领域层 17 | 18 | vms-domain-iot 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-iot-gateway/vms-driver-virtual/src/main/java/com/dreamcc/driver/virtual/dto/ProfileDTO.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.driver.virtual.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @author cloud-cc 11 | * @ClassName ProfileDTO 12 | * @Description 模板传输对象 13 | * @date 2021/11/27 14:38 14 | * @Version 1.0 15 | */ 16 | @Data 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | public class ProfileDTO implements Serializable { 20 | 21 | private Long profileId; 22 | 23 | private String profileName; 24 | 25 | private String profileDesc; 26 | 27 | private String enable; 28 | } 29 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-infrastructure-iot/src/main/java/com/dreamcc/orm/service/DeviceServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.orm.service; 2 | 3 | import com.dreamcc.domain.iot.domain.aggregate.device.Device; 4 | import com.dreamcc.domain.iot.repository.DeviceRepository; 5 | import org.springframework.stereotype.Service; 6 | 7 | /** 8 | * @author cloud-cc 9 | * @ClassName DeviceServiceImpl 10 | * @Description 设备 11 | * @date 2021/12/1 13:58 12 | * @Version 1.0 13 | */ 14 | @Service 15 | public class DeviceServiceImpl implements DeviceRepository { 16 | @Override 17 | public void save(Device device) { 18 | 19 | } 20 | 21 | @Override 22 | public Device getById(Long id) { 23 | return null; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-iot-gateway/vms-driver-virtual/src/main/java/com/dreamcc/driver/virtual/bean/DriverProperty.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.driver.virtual.bean; 2 | 3 | import com.dreamcc.driver.virtual.dto.DriverDTO; 4 | import lombok.Data; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * @author cloud-cc 10 | * @ClassName DriverProperty 11 | * @Description 驱动配置文件 12 | * @date 2021/12/6 15:06 13 | * @Version 1.0 14 | */ 15 | @Data 16 | @Component 17 | @ConfigurationProperties(prefix = "driver") 18 | public class DriverProperty { 19 | 20 | /** 21 | * 基本信息 22 | */ 23 | private DriverDTO driverInfo; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/entity/RTUChannelInfo.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.entity; 2 | 3 | import io.netty.channel.ChannelId; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | /** 10 | * @Title: vms 11 | * @Package: com.dreamcc.vms.gateway.entity 12 | * @Description: 远程服务单元channel 信息 13 | * @Author: dreamcc 14 | * @Date: 2020/1/5 18:30 15 | * @Version: V1.0 16 | */ 17 | @Data 18 | @Builder 19 | @NoArgsConstructor 20 | @AllArgsConstructor 21 | public class RTUChannelInfo { 22 | /** 23 | * netty通道ID 24 | */ 25 | private ChannelId channelId; 26 | 27 | /** 28 | * 设备sn码 29 | */ 30 | private String sn; 31 | } 32 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-security/src/main/java/com/dreamcc/security/config/ApplicationConfig.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.security.config; 2 | 3 | import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; 4 | import org.springframework.context.annotation.Bean; 5 | 6 | import java.util.TimeZone; 7 | 8 | /** 9 | * 系统配置 10 | * 11 | * @author ruoyi 12 | */ 13 | public class ApplicationConfig 14 | { 15 | /** 16 | * 时区配置 17 | */ 18 | @Bean 19 | public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() 20 | { 21 | return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-infrastructure-iot/src/main/java/com/dreamcc/orm/service/DriverServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.orm.service; 2 | 3 | import com.dreamcc.domain.iot.domain.aggregate.driver.Driver; 4 | import com.dreamcc.domain.iot.repository.DriverRepository; 5 | import org.springframework.stereotype.Service; 6 | 7 | /** 8 | * @author cloud-cc 9 | * @ClassName DriverServiceImpl 10 | * @Description 驱动业务操作类 11 | * @date 2021/12/1 13:59 12 | * @Version 1.0 13 | */ 14 | @Service 15 | public class DriverServiceImpl implements DriverRepository { 16 | @Override 17 | public void save(Driver driver) { 18 | 19 | } 20 | 21 | @Override 22 | public Driver getById(Long id) { 23 | return null; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8888 3 | spring: 4 | application: 5 | name: device 6 | datasource: 7 | driver-class-name: com.mysql.cj.jdbc.Driver 8 | url: jdbc:mysql://106.12.191.184:3306/vms?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true 9 | username: root 10 | password: dreamcc@2020 11 | cloud: 12 | nacos: 13 | server-addr: 106.12.191.184:8848 14 | stream: 15 | rocketmq: 16 | binder: 17 | name-server: 106.12.191.184:9876 18 | bindings: 19 | input: 20 | destination: vms-topic 21 | group: vms-device 22 | logging: 23 | level: 24 | com.dreamcc.service.device: debug -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/constant/CommonConsts.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.constant; 2 | 3 | /** 4 | * @Title: vms 5 | * @Package: com.dreamcc.common.core.constant 6 | * @Description: 公共常量 7 | * @Author: dreamcc 8 | * @Date: 2019/12/12 15:26 9 | * @Version: V1.0 10 | */ 11 | public interface CommonConsts { 12 | /** 13 | * 成功标识 14 | */ 15 | Integer SUCCESS = 1; 16 | /** 17 | * 失败标识 18 | */ 19 | Integer FAILED = 0; 20 | /** 21 | * 成功消息 22 | */ 23 | String SUCCESS_MSG = "SUCCESS"; 24 | /** 25 | * 失败消息 26 | */ 27 | String FAILED_SUCCESS = "FAILED"; 28 | /** 29 | * 正常 30 | */ 31 | Integer STATUS_NORMAL = 1; 32 | /** 33 | * 删除 34 | */ 35 | Integer STATUS_DEL = 0; 36 | } 37 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-gateway/src/main/java/com/dreamcc/gateway/config/GatewayConfig.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.gateway.config; 2 | 3 | import com.dreamcc.gateway.handler.SentinelFallbackHandler; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.core.Ordered; 7 | import org.springframework.core.annotation.Order; 8 | 9 | /** 10 | * 网关限流配置 11 | * 12 | * @author ruoyi 13 | */ 14 | @Configuration 15 | public class GatewayConfig 16 | { 17 | @Bean 18 | @Order(Ordered.HIGHEST_PRECEDENCE) 19 | public SentinelFallbackHandler sentinelGatewayExceptionHandler() 20 | { 21 | return new SentinelFallbackHandler(); 22 | } 23 | } -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-security/src/main/java/com/dreamcc/security/annotation/RequiresRoles.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.security.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 | * 角色认证:必须具有指定角色标识才能进入该方法 10 | * 11 | * @author ruoyi 12 | */ 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Target({ ElementType.METHOD, ElementType.TYPE }) 15 | public @interface RequiresRoles 16 | { 17 | /** 18 | * 需要校验的角色标识 19 | */ 20 | String[] value() default {}; 21 | 22 | /** 23 | * 验证逻辑:AND | OR,默认AND 24 | */ 25 | Logical logical() default Logical.AND; 26 | } 27 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/IoTGatewayApplication.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot; 2 | 3 | import com.dreamcc.iot.mq.VMSSource; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.stream.annotation.EnableBinding; 7 | 8 | /** 9 | * @Title: vms 10 | * @Package: com.dreamcc.vms.gateway 11 | * @Description: 安防系统网关启动类 12 | * @Author: dreamcc 13 | * @Date: 2019/12/6 13:43 14 | * @Version: V1.0 15 | */ 16 | @EnableBinding(VMSSource.class) 17 | @SpringBootApplication 18 | public class IoTGatewayApplication { 19 | public static void main(String[] args) { 20 | SpringApplication.run(IoTGatewayApplication.class, args); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-iot-gateway/vms-driver-virtual/src/main/java/com/dreamcc/driver/virtual/service/DriverClient.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.driver.virtual.service; 2 | 3 | import com.dreamcc.common.core.domain.R; 4 | import com.dreamcc.driver.virtual.dto.DriverDTO; 5 | import org.springframework.cloud.openfeign.FeignClient; 6 | import org.springframework.web.bind.annotation.PostMapping; 7 | import org.springframework.web.bind.annotation.RequestBody; 8 | 9 | /** 10 | * @author cloud-cc 11 | * @ClassName DriverClient 12 | * @Description 驱动请求类 13 | * @date 2021/12/7 09:05 14 | * @Version 1.0 15 | */ 16 | @FeignClient(name = "vms-iot") 17 | public interface DriverClient { 18 | 19 | @PostMapping("/driver") 20 | R register(@RequestBody DriverDTO driverDTO); 21 | } 22 | -------------------------------------------------------------------------------- /vms-modules/vms-service-alarm/src/main/java/com/dreamcc/service/alarm/AlarmApplication.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.alarm; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.stream.annotation.EnableBinding; 6 | import org.springframework.cloud.stream.messaging.Sink; 7 | 8 | /** 9 | * @Title: vms 10 | * @Package: com.dreamcc.service.alarm 11 | * @Description: 12 | * @Author: dreamcc 13 | * @Date: 2019/12/27 17:02 14 | * @Version: V1.0 15 | */ 16 | @EnableBinding({Sink.class}) 17 | @SpringBootApplication 18 | public class AlarmApplication { 19 | public static void main(String[] args) { 20 | SpringApplication.run(AlarmApplication.class, args); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-security/src/main/java/com/dreamcc/security/annotation/RequiresPermissions.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.security.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 | * 权限认证:必须具有指定权限才能进入该方法 10 | * 11 | * @author ruoyi 12 | * 13 | */ 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Target({ ElementType.METHOD, ElementType.TYPE }) 16 | public @interface RequiresPermissions 17 | { 18 | /** 19 | * 需要校验的权限码 20 | */ 21 | String[] value() default {}; 22 | 23 | /** 24 | * 验证模式:AND | OR,默认AND 25 | */ 26 | Logical logical() default Logical.AND; 27 | } 28 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/rpc/dataBridge/Response.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.rpc.dataBridge; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @Title: vms 9 | * @Package: com.dreamcc.service.device.rpc.dataBridge 10 | * @Description: 返回信息 11 | * @Author: dreamcc 12 | * @Date: 2019/12/16 18:00 13 | * @Version: V1.0 14 | */ 15 | @Data 16 | public class Response implements Serializable { 17 | 18 | private static final long serialVersionUID = 4852847675718142511L; 19 | /** 20 | * 请求ID 21 | */ 22 | private String requestId; 23 | /** 24 | * 响应码 25 | */ 26 | private int code; 27 | /** 28 | * 返回消息 29 | */ 30 | private Object data; 31 | /** 32 | * 错误信息 33 | */ 34 | private String errorMsg; 35 | } -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/service/IServerDeviceService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.dreamcc.service.device.dto.ServerDeviceDTO; 5 | import com.dreamcc.service.device.entity.ServerDevice; 6 | 7 | /** 8 | * @Title: vms 9 | * @Package: com.dreamcc.service.device.service 10 | * @Description: 服务器设备逻辑处理接口 11 | * @Author: dreamcc 12 | * @Date: 2019/12/23 10:33 13 | * @Version: V1.0 14 | */ 15 | public interface IServerDeviceService extends IService { 16 | 17 | /** 18 | * 增加服务器设备与服务单元 19 | * 20 | * @param serverDeviceDTO 服务器设备与服务单元DTO 21 | * @return Boolean 22 | */ 23 | Boolean addServerDevice(ServerDeviceDTO serverDeviceDTO); 24 | } 25 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/service/IServerUnitService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.dreamcc.service.device.entity.ServerUnit; 5 | 6 | /** 7 | * @Title: vms 8 | * @Package: com.dreamcc.service.device.service 9 | * @Description: 服务单元service 10 | * @Author: dreamcc 11 | * @Date: 2020/1/2 16:39 12 | * @Version: V1.0 13 | */ 14 | public interface IServerUnitService extends IService { 15 | /** 16 | * 修改服务单元状态 17 | * 18 | * @param host ip地址 19 | * @param type 设备类型 20 | * @param port 端口号 21 | * @param state 状态 22 | * @return 0失败/1成功 23 | */ 24 | Integer modifyUnitState(String host, Integer type, Integer port, Integer state); 25 | } 26 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-log/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms-config 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | vms-log 13 | 14 | 15 | 16 | 17 | com.dreamcc 18 | vms-security 19 | 20 | 21 | -------------------------------------------------------------------------------- /vms-modules/vms-service-job/src/main/java/com/dreamcc/job/task/RyTask.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.job.task; 2 | 3 | import com.dreamcc.common.core.utils.StringUtils; 4 | import org.springframework.stereotype.Component; 5 | 6 | /** 7 | * 定时任务调度测试 8 | * 9 | * @author ruoyi 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 | -------------------------------------------------------------------------------- /vms-api/vms-api-system/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms-api 7 | com.dreamcc 8 | v1.0 9 | 10 | 11 | 4.0.0 12 | 13 | vms-api-system 14 | 15 | 16 | 17 | 18 | 19 | com.dreamcc 20 | vms-core 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-security/src/main/java/com/dreamcc/security/annotation/EnableRyFeignClients.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.security.annotation; 2 | 3 | import org.springframework.cloud.openfeign.EnableFeignClients; 4 | 5 | import java.lang.annotation.*; 6 | 7 | /** 8 | * 自定义feign注解 9 | * 添加basePackages路径 10 | * 11 | * @author ruoyi 12 | */ 13 | @Target(ElementType.TYPE) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Documented 16 | @EnableFeignClients 17 | public @interface EnableRyFeignClients 18 | { 19 | String[] value() default {}; 20 | 21 | String[] basePackages() default { "com.dreamcc" }; 22 | 23 | Class[] basePackageClasses() default {}; 24 | 25 | Class[] defaultConfiguration() default {}; 26 | 27 | Class[] clients() default {}; 28 | } 29 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/entity/HeaderModel.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @Title: vms 7 | * @Package: com.dreamcc.vms.gateway.entity 8 | * @Description: 消息头封装类 9 | * @Author: dreamcc 10 | * @Date: 2019/12/12 11:15 11 | * @Version: V1.0 12 | */ 13 | @Data 14 | public class HeaderModel { 15 | /** 16 | * 版本信息 17 | */ 18 | private int version; 19 | /** 20 | * 公司信息 21 | */ 22 | private String company; 23 | /** 24 | * 消息类型 25 | */ 26 | private int msgType; 27 | /** 28 | * 消息数据类型:二进制,xml 29 | */ 30 | private int dataType; 31 | /** 32 | * 消息体长度 33 | */ 34 | private int bodyLength; 35 | /** 36 | * 保留字段一 37 | */ 38 | private int reserved1; 39 | /** 40 | * 保留字段二 41 | */ 42 | private int reserved2; 43 | } 44 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-datascope/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms-config 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | vms-datascope 13 | 14 | 15 | 16 | 17 | 18 | com.dreamcc 19 | vms-security 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/enums/UserStatus.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.enums; 2 | 3 | /** 4 | * 用户状态 5 | * 6 | * @author ruoyi 7 | */ 8 | public enum UserStatus { 9 | /** 10 | * 正常 11 | */ 12 | OK("0", "正常"), 13 | /** 14 | * 停用 15 | */ 16 | DISABLE("1", "停用"), 17 | /** 18 | * 删除 19 | */ 20 | DELETED("2", "删除"); 21 | 22 | private final String code; 23 | private final String info; 24 | 25 | UserStatus(String code, String info) 26 | { 27 | this.code = code; 28 | this.info = info; 29 | } 30 | 31 | public String getCode() 32 | { 33 | return code; 34 | } 35 | 36 | public String getInfo() 37 | { 38 | return info; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vms-application/vms-application-iot/src/main/java/com/dreamcc/application/iot/dto/ProfileDTO.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.application.iot.dto; 2 | 3 | import com.dreamcc.common.constans.BaseDomain; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.io.Serializable; 10 | 11 | /** 12 | * @author cloud-cc 13 | * @ClassName ProfileDTO 14 | * @Description 模板传输对象 15 | * @date 2021/11/27 14:38 16 | * @Version 1.0 17 | */ 18 | @EqualsAndHashCode(callSuper = true) 19 | @Data 20 | @NoArgsConstructor 21 | @AllArgsConstructor 22 | public class ProfileDTO extends BaseDomain implements Serializable { 23 | 24 | private Long id; 25 | 26 | private String name; 27 | 28 | private String description; 29 | 30 | private Integer enable; 31 | } 32 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-iot-gateway/vms-driver-virtual/src/main/resources/META-INF/additional-spring-configuration-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "properties": [ 3 | { 4 | "name": "driver.driver-info", 5 | "type": "java.lang.String", 6 | "description": "Description for driver.driver-info." 7 | }, 8 | { 9 | "name": "driver.driver-info.name", 10 | "type": "java.lang.String", 11 | "description": "Description for driver.driver-info.name." 12 | }, 13 | { 14 | "name": "driver.driver-info.type", 15 | "type": "java.lang.String", 16 | "description": "Description for driver.driver-info.type." 17 | }, 18 | { 19 | "name": "driver.driver-info.description", 20 | "type": "java.lang.String", 21 | "description": "Description for driver.driver-info.description." 22 | } 23 | ] } -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/mapper/ServerUnitMapper.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.dreamcc.service.device.entity.ServerUnit; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | /** 9 | * @Title: vms 10 | * @Package: com.dreamcc.service.device.dao 11 | * @Description: 服务单元Mapper 12 | * @Author: dreamcc 13 | * @Date: 2020/1/2 11:36 14 | * @Version: V1.0 15 | */ 16 | @Mapper 17 | public interface ServerUnitMapper extends BaseMapper { 18 | 19 | /** 20 | * 通过IP与类型查找服务单元 21 | * 22 | * @param host ip地址 23 | * @param type 设备类型 24 | * @return 25 | */ 26 | ServerUnit findByIpAndType(@Param("host") String host, @Param("type") Integer type); 27 | } 28 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/rpc/dataBridge/Request.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.rpc.dataBridge; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @Title: vms 9 | * @Package: com.dreamcc.vms.gateway.rpc.dataBridge 10 | * @Description: 请求信息 11 | * @Author: dreamcc 12 | * @Date: 2019/12/13 15:11 13 | * @Version: V1.0 14 | */ 15 | @Data 16 | public class Request implements Serializable { 17 | 18 | private static final long serialVersionUID = 4428843963026677373L; 19 | /** 20 | * ID 21 | */ 22 | private String id; 23 | /** 24 | * 类名 25 | */ 26 | private String className; 27 | /** 28 | * 函数名称 29 | */ 30 | private String methodName; 31 | /** 32 | * 参数类型 33 | */ 34 | private Class[] parameterTypes; 35 | /** 36 | * 参数列表 37 | */ 38 | private Object[] parameters; 39 | } 40 | -------------------------------------------------------------------------------- /vms-modules/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | vms-modules 13 | pom 14 | 15 | 16 | vms-service-device 17 | vms-service-alarm 18 | vms-service-file 19 | vms-service-job 20 | vms-service-monitor 21 | 22 | 23 | -------------------------------------------------------------------------------- /vms-application/vms-application-iot/src/main/java/com/dreamcc/application/iot/query/ProfileQuery.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.application.iot.query; 2 | 3 | import lombok.Data; 4 | 5 | import javax.validation.constraints.NotEmpty; 6 | import javax.validation.constraints.Pattern; 7 | 8 | /** 9 | * @author cloud-cc 10 | * @ClassName ProfileQuery 11 | * @Description 模板查询条件 12 | * @date 2021/12/7 17:07 13 | * @Version 1.0 14 | */ 15 | @Data 16 | public class ProfileQuery { 17 | 18 | private Long id; 19 | 20 | @NotEmpty(message = "name can't be empty") 21 | @Pattern(regexp = "^[A-Za-z0-9\\u4e00-\\u9fa5][A-Za-z0-9\\u4e00-\\u9fa5-_#@/\\.\\|]{1,31}$", 22 | message = "invalid name,contains invalid characters or length is not in the range of 2~32") 23 | private String name; 24 | 25 | private Integer enable; 26 | 27 | private String description; 28 | } 29 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-iot-gateway/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms-infrastructure 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | vms-iot-gateway 13 | pom 14 | 15 | vms-driver-virtual 16 | 17 | 18 | 19 | 8 20 | 8 21 | 22 | 23 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/rpc/dataBridge/Request.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.rpc.dataBridge; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @Title: vms 9 | * @Package: com.dreamcc.service.device.rpc.dataBridge 10 | * @Description: 请求信息 11 | * @Author: dreamcc 12 | * @Date: 2019/12/16 18:00 13 | * @Version: V1.0 14 | */ 15 | @Data 16 | public class Request implements Serializable { 17 | 18 | private static final long serialVersionUID = 4428843963026677373L; 19 | /** 20 | * ID 21 | */ 22 | private String id; 23 | /** 24 | * 类名 25 | */ 26 | private String className; 27 | /** 28 | * 函数名称 29 | */ 30 | private String methodName; 31 | /** 32 | * 参数类型 33 | */ 34 | private Class[] parameterTypes; 35 | /** 36 | * 参数列表 37 | */ 38 | private Object[] parameters; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/job/TaskException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception.job; 2 | 3 | /** 4 | * 计划策略异常 5 | * 6 | * @author ruoyi 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 | } -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/CheckedException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception; 2 | 3 | /** 4 | * 检查异常 5 | * 6 | * @author ruoyi 7 | */ 8 | public class CheckedException extends RuntimeException 9 | { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public CheckedException(String message) 13 | { 14 | super(message); 15 | } 16 | 17 | public CheckedException(Throwable cause) 18 | { 19 | super(cause); 20 | } 21 | 22 | public CheckedException(String message, Throwable cause) 23 | { 24 | super(message, cause); 25 | } 26 | 27 | public CheckedException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) 28 | { 29 | super(message, cause, enableSuppression, writableStackTrace); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/rpc/service/impl/DeviceServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.rpc.service.impl; 2 | 3 | import com.dreamcc.iot.rpc.annotation.RPCService; 4 | import com.dreamcc.iot.cache.IoTDeviceCache; 5 | import com.dreamcc.iot.rpc.service.IDeviceService; 6 | import io.netty.channel.Channel; 7 | import org.springframework.stereotype.Component; 8 | 9 | /** 10 | * @Title: vms 11 | * @Package: com.dreamcc.vms.gateway.service.impl 12 | * @Description: 设备操作业务类 13 | * @Author: dreamcc 14 | * @Date: 2019/12/13 14:37 15 | * @Version: V1.0 16 | */ 17 | @RPCService 18 | @Component 19 | public class DeviceServiceImpl implements IDeviceService { 20 | 21 | @Override 22 | public String findDevice(String ip) { 23 | Channel channel = IoTDeviceCache.get(ip); 24 | String s = (channel == null) ? "Hello Netty" : channel.remoteAddress().toString(); 25 | return s; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-log/src/main/java/com/dreamcc/log/service/AsyncLogService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.log.service; 2 | 3 | import com.dreamcc.common.core.constant.SecurityConstants; 4 | import com.dreamcc.system.api.RemoteLogService; 5 | import com.dreamcc.system.api.domain.SysOperLog; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.scheduling.annotation.Async; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | * 异步调用日志服务 12 | * 13 | * @author ruoyi 14 | */ 15 | @Service 16 | public class AsyncLogService 17 | { 18 | @Autowired 19 | private RemoteLogService remoteLogService; 20 | 21 | /** 22 | * 保存系统日志记录 23 | */ 24 | @Async 25 | public void saveSysLog(SysOperLog sysOperLog) 26 | { 27 | remoteLogService.saveLog(sysOperLog, SecurityConstants.INNER); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vms-common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | vms-common 13 | 14 | 15 | org.projectlombok 16 | lombok 17 | 18 | 19 | com.fasterxml.jackson.core 20 | jackson-annotations 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-iot-gateway/vms-driver-virtual/src/main/java/com/dreamcc/VirtualApplication.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | import org.springframework.cloud.openfeign.EnableFeignClients; 8 | 9 | /** 10 | * @author cloud-cc 11 | * @ClassName VirtualApplication 12 | * @Description 虚拟驱动启动类 13 | * @date 2021/12/6 15:39 14 | * @Version 1.0 15 | */ 16 | @EnableDiscoveryClient 17 | @EnableFeignClients 18 | @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class }) 19 | public class VirtualApplication { 20 | public static void main(String[] args) { 21 | SpringApplication.run(VirtualApplication.class); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/config/MybaitsPlusConfiguer.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.config; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | /** 9 | * @Title: vms 10 | * @Package: com.dreamcc.service.device.config 11 | * @Description: mybatisplus插件配置类 12 | * @Author: dreamcc 13 | * @Date: 2020/1/2 10:11 14 | * @Version: V1.0 15 | */ 16 | @Configuration 17 | @MapperScan("com.dreamcc.service.device.mapper") 18 | public class MybaitsPlusConfiguer { 19 | 20 | /** 21 | * 分页插件 22 | * 23 | * @return PaginationInterceptor 24 | */ 25 | @Bean 26 | public PaginationInterceptor paginationInterceptor() { 27 | return new PaginationInterceptor(); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /vms-application/vms-application-iot/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms-application 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | vms-application-iot 13 | 14 | 15 | 16 | 17 | com.dreamcc 18 | vms-domain-iot 19 | 20 | 21 | org.mapstruct 22 | mapstruct 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/entity/GlobalInfo.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.entity; 2 | 3 | import io.netty.channel.ChannelId; 4 | 5 | import java.util.Map; 6 | import java.util.concurrent.ConcurrentHashMap; 7 | 8 | /** 9 | * @Title: vms 10 | * @Package: com.dreamcc.vms.gateway.entity 11 | * @Description: 物理网全局信息 12 | * @Author: dreamcc 13 | * @Date: 2020/1/5 19:12 14 | * @Version: V1.0 15 | */ 16 | public class GlobalInfo { 17 | 18 | /** 19 | * 缓冲Rediskey 20 | */ 21 | public static String GLOBAL_IOT_REDIS_KEY; 22 | /** 23 | * IOT信息 物联网设备映射 24 | */ 25 | public static Map iotMapper; 26 | /** 27 | * 全局netty Channel远程服务单元管理器 28 | */ 29 | public static final Map CHANNEL_INFO_MAP = new ConcurrentHashMap<>(); 30 | /** 31 | * 全局netty Channel SN码管理器 32 | */ 33 | public static final Map SN_CHANNEL_INFO_MAP = new ConcurrentHashMap<>(); 34 | } 35 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/dto/ServerDeviceDTO.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.dto; 2 | 3 | import com.dreamcc.service.device.entity.ServerDevice; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * @Title: vms 13 | * @Package: com.dreamcc.service.device.dto 14 | * @Description: 服务器设备与服务单元DTO 15 | * @Author: dreamcc 16 | * @Date: 2020/1/2 10:41 17 | * @Version: V1.0 18 | */ 19 | @ApiModel(description = "服务器与服务单元信息") 20 | @Data 21 | @EqualsAndHashCode(callSuper = true) 22 | public class ServerDeviceDTO extends ServerDevice { 23 | private static final long serialVersionUID = -8698067106234583032L; 24 | 25 | /** 26 | * 服务单元ID 27 | */ 28 | @ApiModelProperty(value = "服务单元类型",example = "10002") 29 | private List serverUnitType; 30 | } 31 | -------------------------------------------------------------------------------- /vms-api/vms-api-system/src/main/java/com/dreamcc/system/api/factory/RemoteFileFallbackFactory.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.api.factory; 2 | 3 | import com.dreamcc.common.core.domain.R; 4 | import com.dreamcc.system.api.RemoteFileService; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.cloud.openfeign.FallbackFactory; 8 | import org.springframework.stereotype.Component; 9 | 10 | /** 11 | * 文件服务降级处理 12 | * 13 | * @author ruoyi 14 | */ 15 | @Component 16 | public class RemoteFileFallbackFactory implements FallbackFactory 17 | { 18 | private static final Logger log = LoggerFactory.getLogger(RemoteFileFallbackFactory.class); 19 | 20 | @Override 21 | public RemoteFileService create(Throwable throwable) 22 | { 23 | log.error("文件服务调用失败:{}", throwable.getMessage()); 24 | return file -> R.fail("上传文件失败:" + throwable.getMessage()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vms-application/vms-application-iot/src/main/java/com/dreamcc/application/iot/mapstruct/ProfileMapper.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.application.iot.mapstruct; 2 | 3 | 4 | import com.dreamcc.application.iot.dto.ProfileDTO; 5 | import com.dreamcc.application.iot.query.ProfileQuery; 6 | import com.dreamcc.domain.iot.domain.aggregate.profile.Profile; 7 | import org.mapstruct.Mapper; 8 | 9 | /** 10 | * @author cloud-cc 11 | * @ClassName ProfileMap 12 | * @Description 转换类 13 | * @date 2021/11/27 14:55 14 | * @Version 1.0 15 | */ 16 | @Mapper(componentModel = "spring") 17 | public interface ProfileMapper { 18 | 19 | /** 20 | * entity转dto 21 | * 22 | * @param profile entity 23 | * @return dto 24 | */ 25 | ProfileDTO profileToDto(Profile profile); 26 | 27 | /** 28 | * 查询条件转entity 29 | * 30 | * @param profileQuery 查询条件 31 | * @return entity 32 | */ 33 | Profile queryToProfile(ProfileQuery profileQuery); 34 | } 35 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/rpc/codec/JSONEncoder.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.rpc.codec; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import io.netty.buffer.ByteBuf; 5 | import io.netty.buffer.ByteBufAllocator; 6 | import io.netty.channel.ChannelHandlerContext; 7 | import io.netty.handler.codec.MessageToMessageEncoder; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * @Title: vms 13 | * @Package: com.dreamcc.vms.gateway.rpc.codec 14 | * @Description: JSON编码 15 | * @Author: dreamcc 16 | * @Date: 2019/12/18 16:17 17 | * @Version: V1.0 18 | */ 19 | public class JSONEncoder extends MessageToMessageEncoder { 20 | @Override 21 | protected void encode(ChannelHandlerContext ctx, Object msg, List out) throws Exception { 22 | ByteBuf byteBuf = ByteBufAllocator.DEFAULT.ioBuffer(); 23 | byte[] bytes = JSON.toJSONBytes(msg); 24 | byteBuf.writeInt(bytes.length); 25 | byteBuf.writeBytes(bytes); 26 | out.add(byteBuf); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/rpc/config/RPCConfig.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.rpc.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * @Title: vms 10 | * @Package: com.dreamcc.vms.gateway.config 11 | * @Description: RPC配置类 12 | * @Author: dreamcc 13 | * @Date: 2019/12/16 9:32 14 | * @Version: V1.0 15 | */ 16 | @Data 17 | @Component 18 | @ConfigurationProperties(prefix = "rpc") 19 | public class RPCConfig { 20 | /** 21 | * rpc服务端端口号 22 | */ 23 | @Value("${rpc.port}") 24 | private int port; 25 | /** 26 | * 用于接收客户端的TCP连接 27 | */ 28 | @Value("${rpc.bossThreads}") 29 | private int bossThreads; 30 | /** 31 | * 用于处理I/O相关的读写操作,或者执行系统Task、定时任务Task等 32 | */ 33 | @Value("${rpc.workerThreads}") 34 | private int workerThreads; 35 | } 36 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/service/impl/ServerUnitRefServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.dreamcc.service.device.entity.ServerUnitRef; 5 | import com.dreamcc.service.device.mapper.ServerUnitRefMapper; 6 | import com.dreamcc.service.device.service.IServerUnitRefService; 7 | import lombok.AllArgsConstructor; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.stereotype.Service; 10 | 11 | /** 12 | * @Title: vms 13 | * @Package: com.dreamcc.service.device.service.impl 14 | * @Description: 服务器与服务单元业务处理类 15 | * @Author: dreamcc 16 | * @Date: 2020/1/2 11:35 17 | * @Version: V1.0 18 | */ 19 | @Slf4j 20 | @Service("serverUnitRefService") 21 | @AllArgsConstructor 22 | public class ServerUnitRefServiceImpl extends ServiceImpl implements IServerUnitRefService { 23 | } 24 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-infrastructure-iot/src/main/java/com/dreamcc/config/MyMetaObjectHandler.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.config; 2 | 3 | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; 4 | import org.apache.ibatis.reflection.MetaObject; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.util.Date; 8 | 9 | /** 10 | * @author cloud-cc 11 | * @ClassName MyMetaObjectHandler 12 | * @Description mybatis工具类 13 | * @date 2021-06-03 14 | * @Version 1.0 15 | */ 16 | @Component 17 | public class MyMetaObjectHandler implements MetaObjectHandler { 18 | @Override 19 | public void insertFill(MetaObject metaObject) { 20 | this.setFieldValByName("createTime", new Date(), metaObject); 21 | this.setFieldValByName("updateTime", new Date(), metaObject); 22 | } 23 | 24 | 25 | @Override 26 | public void updateFill(MetaObject metaObject) { 27 | this.setFieldValByName("updateTime", new Date(), metaObject); 28 | } 29 | } -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/config/NettyConfig.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * @Title: vms 10 | * @Package: com.dreamcc.vms.gateway.config 11 | * @Description: netty网关配置类 12 | * @Author: dreamcc 13 | * @Date: 2019/12/12 17:28 14 | * @Version: V1.0 15 | */ 16 | @Data 17 | @Component 18 | @ConfigurationProperties(prefix = "netty") 19 | public class NettyConfig { 20 | /** 21 | * nettty服务端端口号 22 | */ 23 | @Value("${netty.port}") 24 | private int port; 25 | /** 26 | * 用于接收客户端的TCP连接 27 | */ 28 | @Value("${netty.bossThreads}") 29 | private int bossThreads; 30 | /** 31 | * 用于处理I/O相关的读写操作,或者执行系统Task、定时任务Task等 32 | */ 33 | @Value("${netty.workerThreads}") 34 | private int workerThreads; 35 | } 36 | -------------------------------------------------------------------------------- /vms-common/src/main/java/com/dreamcc/common/constans/BaseDomain.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.constans; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | import java.util.Date; 8 | 9 | /** 10 | * @author cloud-cc 11 | * @ClassName BaseDomain 12 | * @Description domain基类 13 | * @date 2021/12/7 16:37 14 | * @Version 1.0 15 | */ 16 | @Data 17 | public class BaseDomain implements Serializable { 18 | 19 | /** 20 | * 创建者 21 | */ 22 | private String createBy; 23 | 24 | /** 25 | * 创建时间 26 | */ 27 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 28 | private Date createTime; 29 | 30 | /** 31 | * 更新者 32 | */ 33 | private String updateBy; 34 | 35 | /** 36 | * 更新时间 37 | */ 38 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 39 | private Date updateTime; 40 | 41 | /** 42 | * 备注 43 | */ 44 | private String remark; 45 | } 46 | -------------------------------------------------------------------------------- /vms-infrastructure/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | 13 | vms-core 14 | vms-config 15 | vms-gateway 16 | vms-upms 17 | vms-auth 18 | vms-rpc 19 | vms-infrastructure-iot 20 | vms-iot-gateway 21 | 22 | 23 | 24 | vms-infrastructure 25 | 26 | pom 27 | 28 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms-infrastructure 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | vms-config 13 | 14 | pom 15 | 16 | IOT 平台 基础层(通用技术能力,三方软件包,数据库服务等) 17 | 18 | 19 | vms-redis 20 | vms-log 21 | vms-datascope 22 | vms-datasource 23 | vms-security 24 | vms-swagger 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/rpc/codec/JSONEncoder.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.rpc.codec; 2 | 3 | 4 | import com.alibaba.fastjson.JSON; 5 | import io.netty.buffer.ByteBuf; 6 | import io.netty.buffer.ByteBufAllocator; 7 | import io.netty.channel.ChannelHandlerContext; 8 | import io.netty.handler.codec.MessageToMessageEncoder; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @Title: vms 14 | * @Package: com.dreamcc.service.device.rpc.codec 15 | * @Description: JSON编码 16 | * @Author: dreamcc 17 | * @Date: 2019/12/18 8:59 18 | * @Version: V1.0 19 | */ 20 | public class JSONEncoder extends MessageToMessageEncoder { 21 | @Override 22 | protected void encode(ChannelHandlerContext ctx, Object msg, List out) throws Exception { 23 | ByteBuf byteBuf = ByteBufAllocator.DEFAULT.ioBuffer(); 24 | byte[] bytes = JSON.toJSONBytes(msg); 25 | byteBuf.writeInt(bytes.length); 26 | byteBuf.writeBytes(bytes); 27 | out.add(byteBuf); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vms-api/vms-api-iot/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 9931 3 | spring: 4 | application: 5 | name: vms-iot 6 | profiles: 7 | # 环境配置 8 | active: dev 9 | cloud: 10 | nacos: 11 | discovery: 12 | # 服务注册地址 13 | server-addr: 127.0.0.1:8848 14 | redis: 15 | host: localhost 16 | port: 6379 17 | database: 5 18 | datasource: 19 | type: com.zaxxer.hikari.HikariDataSource 20 | driver-class-name: com.mysql.cj.jdbc.Driver 21 | url: jdbc:mysql://127.0.0.1:3306/vms?useUnicode=true&characterEncoding=UTF-8&useSSL=false 22 | username: root 23 | password: root 24 | hikari: 25 | connection-test-query: SELECT 1 26 | rabbitmq: 27 | addresses: 127.0.0.1 28 | username: vms 29 | password: vms 30 | port: 5672 31 | listener: 32 | direct: 33 | acknowledge-mode: manual 34 | retry: 35 | enabled: true 36 | publisher-confirm-type: correlated 37 | virtual-host: vms 38 | 39 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #netty\u7F51\u5173\u670D\u52A1\u7AEF\u7AEF\u53E3\u53F7 2 | netty.port=9999 3 | #\u63A5\u53D7TCP\u8FDE\u63A5\u7EBF\u7A0B 4 | netty.bossThreads=10 5 | #\u5904\u7406I/O\u76F8\u5173\u7684\u8BFB\u5199\u64CD\u4F5C\uFF0C\u6216\u8005\u6267\u884C\u7CFB\u7EDFTask\u3001\u5B9A\u65F6\u4EFB\u52A1Task\u7B49 6 | netty.workerThreads=50 7 | 8 | #rpc\u7F51\u5173\u670D\u52A1\u7AEF\u7AEF\u53E3\u53F7 9 | rpc.port=9888 10 | #rpc\u63A5\u53D7TCP\u8FDE\u63A5\u7EBF\u7A0B 11 | rpc.bossThreads=10 12 | #rpc\u5904\u7406I/O\u76F8\u5173\u7684\u8BFB\u5199\u64CD\u4F5C\uFF0C\u6216\u8005\u6267\u884C\u7CFB\u7EDFTask\u3001\u5B9A\u65F6\u4EFB\u52A1Task\u7B49 13 | rpc.workerThreads=50 14 | 15 | 16 | # \u914D\u7F6Erocketmq\u7684nameserver\u5730\u5740 17 | spring.cloud.stream.rocketmq.binder.name-server=106.12.191.184:9876 18 | # \u5B9A\u4E49name\u4E3Aoutput\u7684binding 19 | spring.cloud.stream.bindings.output.destination=vms-topic 20 | # 21 | spring.application.name=iot-gateway 22 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-gateway/src/main/java/com/dreamcc/gateway/config/properties/IgnoreWhiteProperties.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.gateway.config.properties; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.cloud.context.config.annotation.RefreshScope; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | /** 11 | * 放行白名单配置 12 | * 13 | * @author ruoyi 14 | */ 15 | @Configuration 16 | @RefreshScope 17 | @ConfigurationProperties(prefix = "security.ignore") 18 | public class IgnoreWhiteProperties 19 | { 20 | /** 21 | * 放行白名单配置,网关不校验此处的白名单 22 | */ 23 | private List whites = new ArrayList<>(); 24 | 25 | public List getWhites() 26 | { 27 | return whites; 28 | } 29 | 30 | public void setWhites(List whites) 31 | { 32 | this.whites = whites; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-security/src/main/java/com/dreamcc/security/annotation/EnableCustomConfig.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.security.annotation; 2 | 3 | import com.dreamcc.security.config.ApplicationConfig; 4 | import com.dreamcc.security.feign.FeignAutoConfiguration; 5 | import org.mybatis.spring.annotation.MapperScan; 6 | import org.springframework.context.annotation.EnableAspectJAutoProxy; 7 | import org.springframework.context.annotation.Import; 8 | import org.springframework.scheduling.annotation.EnableAsync; 9 | 10 | import java.lang.annotation.*; 11 | 12 | @Target(ElementType.TYPE) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Documented 15 | @Inherited 16 | // 表示通过aop框架暴露该代理对象,AopContext能够访问 17 | @EnableAspectJAutoProxy(exposeProxy = true) 18 | // 指定要扫描的Mapper类的包的路径 19 | @MapperScan("com.dreamcc.system.mapper") 20 | // 开启线程异步执行 21 | @EnableAsync 22 | // 自动加载类 23 | @Import({ApplicationConfig.class, FeignAutoConfiguration.class}) 24 | public @interface EnableCustomConfig { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/java/com/dreamcc/system/service/ISysLogininforService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.service; 2 | 3 | import com.dreamcc.system.api.domain.SysLogininfor; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 系统访问日志情况信息 服务层 9 | * 10 | * @author ruoyi 11 | */ 12 | public interface ISysLogininforService 13 | { 14 | /** 15 | * 新增系统登录日志 16 | * 17 | * @param logininfor 访问日志对象 18 | */ 19 | public int insertLogininfor(SysLogininfor logininfor); 20 | 21 | /** 22 | * 查询系统登录日志集合 23 | * 24 | * @param logininfor 访问日志对象 25 | * @return 登录记录集合 26 | */ 27 | public List selectLogininforList(SysLogininfor logininfor); 28 | 29 | /** 30 | * 批量删除系统登录日志 31 | * 32 | * @param infoIds 需要删除的登录日志ID 33 | * @return 34 | */ 35 | public int deleteLogininforByIds(Long[] infoIds); 36 | 37 | /** 38 | * 清空系统登录日志 39 | */ 40 | public void cleanLogininfor(); 41 | } 42 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/concurrent/thread/RequestProcessorThread.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.concurrent.thread; 2 | 3 | import com.dreamcc.common.core.concurrent.queue.IoTRequest; 4 | 5 | import java.util.concurrent.ArrayBlockingQueue; 6 | import java.util.concurrent.Callable; 7 | 8 | /** 9 | * @Title: vms 10 | * @Package: com.dreamcc.common.core.concurrent.thread 11 | * @Description: 执行请求的工作线程 12 | * @Author: dreamcc 13 | * @Date: 2019/12/10 14:59 14 | * @Version: V1.0 15 | */ 16 | public class RequestProcessorThread implements Callable { 17 | 18 | /** 19 | * 监控自己的内存队列 20 | */ 21 | private ArrayBlockingQueue queue; 22 | 23 | public RequestProcessorThread(ArrayBlockingQueue queue) { 24 | this.queue = queue; 25 | } 26 | 27 | 28 | @Override 29 | public Boolean call() throws Exception { 30 | try { 31 | while (true) { 32 | 33 | } 34 | }catch (Exception e){ 35 | e.printStackTrace(); 36 | } 37 | return true; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/rpc/codec/JSONDecoder.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.rpc.codec; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import io.netty.buffer.ByteBuf; 5 | import io.netty.channel.ChannelHandlerContext; 6 | import io.netty.handler.codec.LengthFieldBasedFrameDecoder; 7 | 8 | /** 9 | * @Title: vms 10 | * @Package: com.dreamcc.vms.gateway.rpc.codec 11 | * @Description: JSON解码 12 | * @Author: dreamcc 13 | * @Date: 2019/12/18 13:40 14 | * @Version: V1.0 15 | */ 16 | public class JSONDecoder extends LengthFieldBasedFrameDecoder { 17 | public JSONDecoder() { 18 | super(65535, 0, 4,0,4); 19 | } 20 | 21 | @Override 22 | protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception { 23 | ByteBuf decode = (ByteBuf) super.decode(ctx, in); 24 | if (decode==null){ 25 | return null; 26 | } 27 | int dataLen = decode.readableBytes(); 28 | byte[] bytes = new byte[dataLen]; 29 | decode.readBytes(bytes); 30 | Object parse = JSON.parse(bytes); 31 | return parse; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/utils/sql/SqlUtil.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.utils.sql; 2 | 3 | 4 | import com.dreamcc.common.core.exception.UtilException; 5 | import com.dreamcc.common.core.utils.StringUtils; 6 | 7 | /** 8 | * sql操作工具类 9 | * 10 | * @author ruoyi 11 | */ 12 | public class SqlUtil 13 | { 14 | /** 15 | * 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序) 16 | */ 17 | public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+"; 18 | 19 | /** 20 | * 检查字符,防止注入绕过 21 | */ 22 | public static String escapeOrderBySql(String value) 23 | { 24 | if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) 25 | { 26 | throw new UtilException("参数不符合规范,不能进行查询"); 27 | } 28 | return value; 29 | } 30 | 31 | /** 32 | * 验证 order by 语法是否符合规范 33 | */ 34 | public static boolean isValidOrderBySql(String value) 35 | { 36 | return value.matches(SQL_PATTERN); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /vms-modules/vms-service-alarm/src/main/java/com/dreamcc/service/alarm/service/RegistryClient.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.alarm.service; 2 | 3 | import com.dreamcc.service.alarm.controller.HelloRegistryFacade; 4 | import com.dreamcc.service.alarm.controller.TestService; 5 | 6 | import java.rmi.NotBoundException; 7 | import java.rmi.RemoteException; 8 | import java.rmi.registry.LocateRegistry; 9 | import java.rmi.registry.Registry; 10 | 11 | public class RegistryClient { 12 | public static void main(String[] args) { 13 | try { 14 | Registry registry = LocateRegistry.getRegistry(9124); 15 | HelloRegistryFacade hello = (HelloRegistryFacade) registry.lookup("syncData"); 16 | TestService testService = (TestService)registry.lookup("test"); 17 | 18 | String response = testService.helloWorld("ZhenJin"); 19 | System.out.println("=======> " + response + " <======="); 20 | } catch (NotBoundException | RemoteException e) { 21 | e.printStackTrace(); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-swagger/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms-config 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | vms-swagger 13 | 14 | 15 | 16 | 17 | org.springframework.boot 18 | spring-boot-starter-web 19 | 20 | 21 | 22 | 23 | io.springfox 24 | springfox-boot-starter 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/constant/SecurityConstants.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.constant; 2 | 3 | /** 4 | * 权限相关通用常量 5 | * 6 | * @author ruoyi 7 | */ 8 | public class SecurityConstants 9 | { 10 | /** 11 | * 用户ID字段 12 | */ 13 | public static final String DETAILS_USER_ID = "user_id"; 14 | 15 | /** 16 | * 用户名字段 17 | */ 18 | public static final String DETAILS_USERNAME = "username"; 19 | 20 | /** 21 | * 授权信息字段 22 | */ 23 | public static final String AUTHORIZATION_HEADER = "authorization"; 24 | 25 | /** 26 | * 请求来源 27 | */ 28 | public static final String FROM_SOURCE = "from-source"; 29 | 30 | /** 31 | * 内部请求 32 | */ 33 | public static final String INNER = "inner"; 34 | 35 | /** 36 | * 用户标识 37 | */ 38 | public static final String USER_KEY = "user_key"; 39 | 40 | /** 41 | * 登录用户 42 | */ 43 | public static final String LOGIN_USER = "login_user"; 44 | } 45 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/java/com/dreamcc/system/mapper/SysLogininforMapper.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.mapper; 2 | 3 | import com.dreamcc.system.api.domain.SysLogininfor; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 系统访问日志情况信息 数据层 9 | * 10 | * @author ruoyi 11 | */ 12 | public interface SysLogininforMapper 13 | { 14 | /** 15 | * 新增系统登录日志 16 | * 17 | * @param logininfor 访问日志对象 18 | */ 19 | public int insertLogininfor(SysLogininfor logininfor); 20 | 21 | /** 22 | * 查询系统登录日志集合 23 | * 24 | * @param logininfor 访问日志对象 25 | * @return 登录记录集合 26 | */ 27 | public List selectLogininforList(SysLogininfor logininfor); 28 | 29 | /** 30 | * 批量删除系统登录日志 31 | * 32 | * @param infoIds 需要删除的登录日志ID 33 | * @return 结果 34 | */ 35 | public int deleteLogininforByIds(Long[] infoIds); 36 | 37 | /** 38 | * 清空系统登录日志 39 | * 40 | * @return 结果 41 | */ 42 | public int cleanLogininfor(); 43 | } 44 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-log/src/main/java/com/dreamcc/log/annotation/Log.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.log.annotation; 2 | 3 | 4 | import com.dreamcc.log.enums.BusinessType; 5 | import com.dreamcc.log.enums.OperatorType; 6 | 7 | import java.lang.annotation.*; 8 | 9 | /** 10 | * 自定义操作日志记录注解 11 | * 12 | * @author ruoyi 13 | * 14 | */ 15 | @Target({ ElementType.PARAMETER, ElementType.METHOD }) 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; 34 | 35 | /** 36 | * 是否保存请求的参数 37 | */ 38 | public boolean isSaveRequestData() default true; 39 | 40 | /** 41 | * 是否保存响应的参数 42 | */ 43 | public boolean isSaveResponseData() default true; 44 | } 45 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/server/ServerChannelInitializer.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.server; 2 | 3 | import com.dreamcc.iot.handler.NettyServerHandler; 4 | import com.dreamcc.iot.codec.AbstractMonitorDecoder; 5 | import io.netty.channel.ChannelInitializer; 6 | import io.netty.channel.socket.SocketChannel; 7 | import io.netty.handler.codec.string.StringEncoder; 8 | import io.netty.util.CharsetUtil; 9 | 10 | /** 11 | * @Title: vms 12 | * @Package: com.dreamcc.vms.gateway.server 13 | * @Description: netty服务初始化器 14 | * @Author: dreamcc 15 | * @Date: 2019/12/6 13:48 16 | * @Version: V1.0 17 | */ 18 | public class ServerChannelInitializer extends ChannelInitializer { 19 | /** 20 | * 初始化 21 | * 22 | * @param ch 操作的channel 23 | */ 24 | @Override 25 | protected void initChannel(SocketChannel ch) { 26 | //添加编解码 27 | ch.pipeline().addLast("encoder", new StringEncoder(CharsetUtil.UTF_8)); 28 | ch.pipeline().addLast("decoder", new AbstractMonitorDecoder()); 29 | ch.pipeline().addLast(new NettyServerHandler()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/rpc/codec/JSONDecoder.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.rpc.codec; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import io.netty.buffer.ByteBuf; 5 | import io.netty.channel.ChannelHandlerContext; 6 | import io.netty.handler.codec.LengthFieldBasedFrameDecoder; 7 | 8 | /** 9 | * @Title: vms 10 | * @Package: com.dreamcc.service.device.rpc.codec 11 | * @Description: JSON解码 12 | * @Author: dreamcc 13 | * @Date: 2019/12/18 16:16 14 | * @Version: V1.0 15 | */ 16 | 17 | public class JSONDecoder extends LengthFieldBasedFrameDecoder { 18 | public JSONDecoder() { 19 | super(65535, 0, 4,0,4); 20 | } 21 | 22 | @Override 23 | protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception { 24 | ByteBuf decode = (ByteBuf) super.decode(ctx, in); 25 | if (decode==null){ 26 | return null; 27 | } 28 | int dataLen = decode.readableBytes(); 29 | byte[] bytes = new byte[dataLen]; 30 | decode.readBytes(bytes); 31 | Object parse = JSON.parse(bytes); 32 | return parse; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/java/com/dreamcc/system/mapper/SysRoleMenuMapper.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.mapper; 2 | 3 | import com.dreamcc.system.domain.SysRoleMenu; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 角色与菜单关联表 数据层 9 | * 10 | * @author ruoyi 11 | */ 12 | public interface SysRoleMenuMapper 13 | { 14 | /** 15 | * 查询菜单使用数量 16 | * 17 | * @param menuId 菜单ID 18 | * @return 结果 19 | */ 20 | public int checkMenuExistRole(Long menuId); 21 | 22 | /** 23 | * 通过角色ID删除角色和菜单关联 24 | * 25 | * @param roleId 角色ID 26 | * @return 结果 27 | */ 28 | public int deleteRoleMenuByRoleId(Long roleId); 29 | 30 | /** 31 | * 批量删除角色菜单关联信息 32 | * 33 | * @param ids 需要删除的数据ID 34 | * @return 结果 35 | */ 36 | public int deleteRoleMenu(Long[] ids); 37 | 38 | /** 39 | * 批量新增角色菜单信息 40 | * 41 | * @param roleMenuList 角色菜单列表 42 | * @return 结果 43 | */ 44 | public int batchRoleMenu(List roleMenuList); 45 | } 46 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/java/com/dreamcc/system/mapper/SysUserPostMapper.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.mapper; 2 | 3 | import com.dreamcc.system.domain.SysUserPost; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 用户与岗位关联表 数据层 9 | * 10 | * @author ruoyi 11 | */ 12 | public interface SysUserPostMapper 13 | { 14 | /** 15 | * 通过用户ID删除用户和岗位关联 16 | * 17 | * @param userId 用户ID 18 | * @return 结果 19 | */ 20 | public int deleteUserPostByUserId(Long userId); 21 | 22 | /** 23 | * 通过岗位ID查询岗位使用数量 24 | * 25 | * @param postId 岗位ID 26 | * @return 结果 27 | */ 28 | public int countUserPostById(Long postId); 29 | 30 | /** 31 | * 批量删除用户和岗位关联 32 | * 33 | * @param ids 需要删除的数据ID 34 | * @return 结果 35 | */ 36 | public int deleteUserPost(Long[] ids); 37 | 38 | /** 39 | * 批量新增用户岗位信息 40 | * 41 | * @param userPostList 用户角色列表 42 | * @return 结果 43 | */ 44 | public int batchUserPost(List userPostList); 45 | } 46 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/java/com/dreamcc/system/mapper/SysRoleDeptMapper.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.mapper; 2 | 3 | import com.dreamcc.system.domain.SysRoleDept; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 角色与部门关联表 数据层 9 | * 10 | * @author ruoyi 11 | */ 12 | public interface SysRoleDeptMapper 13 | { 14 | /** 15 | * 通过角色ID删除角色和部门关联 16 | * 17 | * @param roleId 角色ID 18 | * @return 结果 19 | */ 20 | public int deleteRoleDeptByRoleId(Long roleId); 21 | 22 | /** 23 | * 批量删除角色部门关联信息 24 | * 25 | * @param ids 需要删除的数据ID 26 | * @return 结果 27 | */ 28 | public int deleteRoleDept(Long[] ids); 29 | 30 | /** 31 | * 查询部门使用数量 32 | * 33 | * @param deptId 部门ID 34 | * @return 结果 35 | */ 36 | public int selectCountRoleDeptByDeptId(Long deptId); 37 | 38 | /** 39 | * 批量新增角色部门信息 40 | * 41 | * @param roleDeptList 角色部门列表 42 | * @return 结果 43 | */ 44 | public int batchRoleDept(List roleDeptList); 45 | } 46 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-infrastructure-iot/src/main/java/com/dreamcc/orm/mapstruct/ProfilePoMapper.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.orm.mapstruct; 2 | 3 | 4 | import com.dreamcc.application.iot.dto.ProfileDTO; 5 | import com.dreamcc.domain.iot.domain.aggregate.profile.Profile; 6 | import com.dreamcc.orm.dataobject.ProfileDO; 7 | import org.mapstruct.Mapper; 8 | 9 | /** 10 | * @author cloud-cc 11 | * @ClassName ProfilePoMapper 12 | * @Description 转换类 13 | * @date 2021/12/1 10:00 14 | * @Version 1.0 15 | */ 16 | @Mapper(componentModel = "spring") 17 | public interface ProfilePoMapper { 18 | 19 | /** 20 | * do转dto 21 | * 22 | * @param profileDO do 23 | * @return entity 24 | */ 25 | ProfileDTO doToDto(ProfileDO profileDO); 26 | 27 | /** 28 | * entity转do 29 | * 30 | * @param profile entity 31 | * @return do 32 | */ 33 | ProfileDO profileToPo(Profile profile); 34 | 35 | /** 36 | * do 转 entity 37 | * 38 | * @param profileDO do 39 | * @return entity 40 | */ 41 | Profile poToProfile(ProfileDO profileDO); 42 | } 43 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-security/src/main/java/com/dreamcc/security/config/WebMvcConfig.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.security.config; 2 | 3 | import com.dreamcc.security.interceptor.HeaderInterceptor; 4 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | /** 8 | * 拦截器配置 9 | * 10 | * @author ruoyi 11 | */ 12 | public class WebMvcConfig implements WebMvcConfigurer 13 | { 14 | /** 不需要拦截地址 */ 15 | public static final String[] excludeUrls = { "/login", "/logout", "/refresh" }; 16 | 17 | @Override 18 | public void addInterceptors(InterceptorRegistry registry) 19 | { 20 | registry.addInterceptor(getHeaderInterceptor()) 21 | .addPathPatterns("/**") 22 | .excludePathPatterns(excludeUrls) 23 | .order(-10); 24 | } 25 | 26 | /** 27 | * 自定义请求头拦截器 28 | */ 29 | public HeaderInterceptor getHeaderInterceptor() 30 | { 31 | return new HeaderInterceptor(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /vms-modules/vms-service-alarm/src/main/java/com/dreamcc/service/alarm/controller/RegistryService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.alarm.controller; 2 | 3 | import lombok.SneakyThrows; 4 | 5 | import java.rmi.RemoteException; 6 | import java.rmi.registry.LocateRegistry; 7 | import java.rmi.registry.Registry; 8 | 9 | /** 10 | * @Title: vms 11 | * @Package: com.dreamcc.service.alarm.controller 12 | * @Description: 13 | * @Author: dreamcc 14 | * @Date: 2020/1/15 8:47 15 | * @Version: V1.0 16 | */ 17 | public class RegistryService { 18 | @SneakyThrows 19 | public static void main(String[] args) { 20 | try { 21 | // 本地主机上的远程对象注册表Registry的实例,默认端口1099 22 | Registry registry = LocateRegistry.createRegistry(1099); 23 | // 创建一个远程对象 24 | HelloRegistryFacade hello = new HelloRegistryFacadeImpl(); 25 | TestService test = new TestServiceImpl(); 26 | // 把远程对象注册到RMI注册服务器上,并命名为HelloRegistry 27 | registry.bind("HelloRegistry", hello); 28 | registry.bind("test",test); 29 | System.out.println("======= 启动RMI服务成功! ======="); 30 | } catch (RemoteException e) { 31 | e.printStackTrace(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vms-application/vms-application-iot/src/main/java/com/dreamcc/application/iot/ProfileQueryApplication.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.application.iot; 2 | 3 | import com.dreamcc.application.iot.dto.ProfileDTO; 4 | import com.dreamcc.application.iot.query.ProfileQuery; 5 | import com.dreamcc.domain.iot.domain.aggregate.profile.Profile; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author cloud-cc 11 | * @ClassName ProfileQueryApplication 12 | * @Description 模板查询类 13 | * @date 2021/12/8 10:22 14 | * @Version 1.0 15 | */ 16 | public interface ProfileQueryApplication { 17 | 18 | /** 19 | * 获取模板列表 20 | * 21 | * @param profileQuery 查询条件 22 | * @return List 23 | */ 24 | List getProfileList(ProfileQuery profileQuery); 25 | 26 | /** 27 | * 根据ID获取模板 28 | * 29 | * @param profileId 模板ID 30 | * @return ProfileDTO 31 | */ 32 | ProfileDTO getProfileById(Long profileId); 33 | 34 | /** 35 | * 根据模板名称查找模板 36 | * 37 | * @param profileName 名称 38 | * @return 模板信息 39 | */ 40 | Profile getProfileByName(String profileName); 41 | } 42 | -------------------------------------------------------------------------------- /vms-domain/vms-domain-iot/src/main/java/com/dreamcc/domain/iot/repository/ProfileRepository.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.domain.iot.repository; 2 | 3 | import com.dreamcc.domain.iot.domain.aggregate.profile.Profile; 4 | 5 | /** 6 | * @author cloud-cc 7 | * @ClassName ProfileRepository 8 | * @Description 模板仓库 9 | * @date 2021/11/27 09:12 10 | * @Version 1.0 11 | */ 12 | public interface ProfileRepository { 13 | 14 | /** 15 | * 保存 16 | * 17 | * @param profile 模板信息 18 | */ 19 | void addProfile(Profile profile); 20 | 21 | /** 22 | * 更新 23 | * 24 | * @param profile 模板信息 25 | */ 26 | void updateProfile(Profile profile); 27 | 28 | /** 29 | * 删除 30 | * 31 | * @param id id 32 | */ 33 | void deleteProfile(Long id); 34 | 35 | /** 36 | * 根据Id获取模板 37 | * 38 | * @param id 模板ID 39 | * @return 模板 40 | */ 41 | Profile getProfileById(Long id); 42 | 43 | 44 | /** 45 | * 根据模板名称查找模板 46 | * 47 | * @param profileName 名称 48 | * @return 模板信息 49 | */ 50 | Profile getProfileByName(String profileName); 51 | 52 | } 53 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-gateway/src/main/java/com/dreamcc/gateway/config/properties/CaptchaProperties.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.gateway.config.properties; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.cloud.context.config.annotation.RefreshScope; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * 验证码配置 9 | * 10 | * @author ruoyi 11 | */ 12 | @Configuration 13 | @RefreshScope 14 | @ConfigurationProperties(prefix = "security.captcha") 15 | public class CaptchaProperties { 16 | /** 17 | * 验证码开关 18 | */ 19 | private Boolean enabled; 20 | 21 | /** 22 | * 验证码类型(math 数组计算 char 字符) 23 | */ 24 | private String type; 25 | 26 | public Boolean getEnabled() { 27 | return enabled; 28 | } 29 | 30 | public void setEnabled(Boolean enabled) { 31 | this.enabled = enabled; 32 | } 33 | 34 | public String getType() { 35 | return type; 36 | } 37 | 38 | public void setType(String type) { 39 | this.type = type; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /vms-api/vms-api-system/src/main/java/com/dreamcc/system/api/domain/SysFile.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.api.domain; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | import org.apache.commons.lang3.builder.ToStringStyle; 5 | 6 | /** 7 | * 文件信息 8 | * 9 | * @author ruoyi 10 | */ 11 | public class SysFile 12 | { 13 | /** 14 | * 文件名称 15 | */ 16 | private String name; 17 | 18 | /** 19 | * 文件地址 20 | */ 21 | private String url; 22 | 23 | public String getName() 24 | { 25 | return name; 26 | } 27 | 28 | public void setName(String name) 29 | { 30 | this.name = name; 31 | } 32 | 33 | public String getUrl() 34 | { 35 | return url; 36 | } 37 | 38 | public void setUrl(String url) 39 | { 40 | this.url = url; 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 46 | .append("name", getName()) 47 | .append("url", getUrl()) 48 | .toString(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-gateway/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | # Tomcat 2 | server: 3 | port: 8080 4 | 5 | # Spring 6 | spring: 7 | application: 8 | # 应用名称 9 | name: vms-gateway 10 | profiles: 11 | # 环境配置 12 | active: dev 13 | main: 14 | allow-bean-definition-overriding: true 15 | cloud: 16 | nacos: 17 | discovery: 18 | # 服务注册地址 19 | server-addr: 127.0.0.1:8848 20 | config: 21 | # 配置中心地址 22 | server-addr: 127.0.0.1:8848 23 | # 配置文件格式 24 | file-extension: yml 25 | # 共享配置 26 | shared-configs: 27 | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} 28 | sentinel: 29 | # 取消控制台懒加载 30 | eager: true 31 | transport: 32 | # 控制台地址 33 | dashboard: 127.0.0.1:8718 34 | # nacos配置持久化 35 | datasource: 36 | ds1: 37 | nacos: 38 | server-addr: 127.0.0.1:8848 39 | dataId: sentinel-ruoyi-gateway 40 | groupId: DEFAULT_GROUP 41 | data-type: json 42 | rule-type: flow 43 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/java/com/dreamcc/system/mapper/SysOperLogMapper.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.mapper; 2 | 3 | import com.dreamcc.system.api.domain.SysOperLog; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 操作日志 数据层 9 | * 10 | * @author ruoyi 11 | */ 12 | public interface SysOperLogMapper 13 | { 14 | /** 15 | * 新增操作日志 16 | * 17 | * @param operLog 操作日志对象 18 | */ 19 | public int insertOperlog(SysOperLog operLog); 20 | 21 | /** 22 | * 查询系统操作日志集合 23 | * 24 | * @param operLog 操作日志对象 25 | * @return 操作日志集合 26 | */ 27 | public List selectOperLogList(SysOperLog operLog); 28 | 29 | /** 30 | * 批量删除系统操作日志 31 | * 32 | * @param operIds 需要删除的操作日志ID 33 | * @return 结果 34 | */ 35 | public int deleteOperLogByIds(Long[] operIds); 36 | 37 | /** 38 | * 查询操作日志详细 39 | * 40 | * @param operId 操作ID 41 | * @return 操作日志对象 42 | */ 43 | public SysOperLog selectOperLogById(Long operId); 44 | 45 | /** 46 | * 清空操作日志 47 | */ 48 | public void cleanOperLog(); 49 | } 50 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/java/com/dreamcc/system/domain/SysRoleDept.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.domain; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | import org.apache.commons.lang3.builder.ToStringStyle; 5 | 6 | /** 7 | * 角色和部门关联 sys_role_dept 8 | * 9 | * @author ruoyi 10 | */ 11 | public class SysRoleDept 12 | { 13 | /** 角色ID */ 14 | private Long roleId; 15 | 16 | /** 部门ID */ 17 | private Long deptId; 18 | 19 | public Long getRoleId() 20 | { 21 | return roleId; 22 | } 23 | 24 | public void setRoleId(Long roleId) 25 | { 26 | this.roleId = roleId; 27 | } 28 | 29 | public Long getDeptId() 30 | { 31 | return deptId; 32 | } 33 | 34 | public void setDeptId(Long deptId) 35 | { 36 | this.deptId = deptId; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 42 | .append("roleId", getRoleId()) 43 | .append("deptId", getDeptId()) 44 | .toString(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/java/com/dreamcc/system/domain/SysRoleMenu.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.domain; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | import org.apache.commons.lang3.builder.ToStringStyle; 5 | 6 | /** 7 | * 角色和菜单关联 sys_role_menu 8 | * 9 | * @author ruoyi 10 | */ 11 | public class SysRoleMenu 12 | { 13 | /** 角色ID */ 14 | private Long roleId; 15 | 16 | /** 菜单ID */ 17 | private Long menuId; 18 | 19 | public Long getRoleId() 20 | { 21 | return roleId; 22 | } 23 | 24 | public void setRoleId(Long roleId) 25 | { 26 | this.roleId = roleId; 27 | } 28 | 29 | public Long getMenuId() 30 | { 31 | return menuId; 32 | } 33 | 34 | public void setMenuId(Long menuId) 35 | { 36 | this.menuId = menuId; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 42 | .append("roleId", getRoleId()) 43 | .append("menuId", getMenuId()) 44 | .toString(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/java/com/dreamcc/system/domain/SysUserPost.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.domain; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | import org.apache.commons.lang3.builder.ToStringStyle; 5 | 6 | /** 7 | * 用户和岗位关联 sys_user_post 8 | * 9 | * @author ruoyi 10 | */ 11 | public class SysUserPost 12 | { 13 | /** 用户ID */ 14 | private Long userId; 15 | 16 | /** 岗位ID */ 17 | private Long postId; 18 | 19 | public Long getUserId() 20 | { 21 | return userId; 22 | } 23 | 24 | public void setUserId(Long userId) 25 | { 26 | this.userId = userId; 27 | } 28 | 29 | public Long getPostId() 30 | { 31 | return postId; 32 | } 33 | 34 | public void setPostId(Long postId) 35 | { 36 | this.postId = postId; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 42 | .append("userId", getUserId()) 43 | .append("postId", getPostId()) 44 | .toString(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/java/com/dreamcc/system/domain/SysUserRole.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.domain; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | import org.apache.commons.lang3.builder.ToStringStyle; 5 | 6 | /** 7 | * 用户和角色关联 sys_user_role 8 | * 9 | * @author ruoyi 10 | */ 11 | public class SysUserRole 12 | { 13 | /** 用户ID */ 14 | private Long userId; 15 | 16 | /** 角色ID */ 17 | private Long roleId; 18 | 19 | public Long getUserId() 20 | { 21 | return userId; 22 | } 23 | 24 | public void setUserId(Long userId) 25 | { 26 | this.userId = userId; 27 | } 28 | 29 | public Long getRoleId() 30 | { 31 | return roleId; 32 | } 33 | 34 | public void setRoleId(Long roleId) 35 | { 36 | this.roleId = roleId; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 42 | .append("userId", getUserId()) 43 | .append("roleId", getRoleId()) 44 | .toString(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/utils/ExceptionUtil.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.utils; 2 | 3 | import org.apache.commons.lang3.exception.ExceptionUtils; 4 | 5 | import java.io.PrintWriter; 6 | import java.io.StringWriter; 7 | 8 | /** 9 | * 错误信息处理类。 10 | * 11 | * @author ruoyi 12 | */ 13 | public class ExceptionUtil 14 | { 15 | /** 16 | * 获取exception的详细错误信息。 17 | */ 18 | public static String getExceptionMessage(Throwable e) 19 | { 20 | StringWriter sw = new StringWriter(); 21 | e.printStackTrace(new PrintWriter(sw, true)); 22 | String str = sw.toString(); 23 | return str; 24 | } 25 | 26 | public static String getRootErrorMessage(Exception e) 27 | { 28 | Throwable root = ExceptionUtils.getRootCause(e); 29 | root = (root == null ? e : root); 30 | if (root == null) 31 | { 32 | return ""; 33 | } 34 | String msg = root.getMessage(); 35 | if (msg == null) 36 | { 37 | return "null"; 38 | } 39 | return StringUtils.defaultString(msg); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/java/com/dreamcc/system/service/ISysOperLogService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.service; 2 | 3 | import com.dreamcc.system.api.domain.SysOperLog; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 操作日志 服务层 9 | * 10 | * @author ruoyi 11 | */ 12 | public interface ISysOperLogService 13 | { 14 | /** 15 | * 新增操作日志 16 | * 17 | * @param operLog 操作日志对象 18 | * @return 结果 19 | */ 20 | public int insertOperlog(SysOperLog operLog); 21 | 22 | /** 23 | * 查询系统操作日志集合 24 | * 25 | * @param operLog 操作日志对象 26 | * @return 操作日志集合 27 | */ 28 | public List selectOperLogList(SysOperLog operLog); 29 | 30 | /** 31 | * 批量删除系统操作日志 32 | * 33 | * @param operIds 需要删除的操作日志ID 34 | * @return 结果 35 | */ 36 | public int deleteOperLogByIds(Long[] operIds); 37 | 38 | /** 39 | * 查询操作日志详细 40 | * 41 | * @param operId 操作ID 42 | * @return 操作日志对象 43 | */ 44 | public SysOperLog selectOperLogById(Long operId); 45 | 46 | /** 47 | * 清空操作日志 48 | */ 49 | public void cleanOperLog(); 50 | } 51 | -------------------------------------------------------------------------------- /vms-api/vms-api-system/src/main/java/com/dreamcc/system/api/RemoteFileService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.api; 2 | 3 | import com.dreamcc.system.api.domain.SysFile; 4 | import com.dreamcc.system.api.factory.RemoteFileFallbackFactory; 5 | import com.dreamcc.common.core.constant.ServiceNameConstants; 6 | import com.dreamcc.common.core.domain.R; 7 | import org.springframework.cloud.openfeign.FeignClient; 8 | import org.springframework.http.MediaType; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestPart; 11 | import org.springframework.web.multipart.MultipartFile; 12 | 13 | /** 14 | * 文件服务 15 | * 16 | * @author ruoyi 17 | */ 18 | @FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class) 19 | public interface RemoteFileService 20 | { 21 | /** 22 | * 上传文件 23 | * 24 | * @param file 文件信息 25 | * @return 结果 26 | */ 27 | @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) 28 | public R upload(@RequestPart(value = "file") MultipartFile file); 29 | } 30 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-redis/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms-config 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | vms-redis 13 | 14 | 15 | 16 | 17 | 18 | org.springframework.boot 19 | spring-boot-starter-data-redis 20 | 21 | 22 | io.netty 23 | netty-all 24 | 25 | 26 | 27 | com.dreamcc 28 | vms-core 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/resources/mapper/ServerUnitMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | unit.id ,unit_name AS unitName,port ,type,load_num AS loadNum,unit.state 14 | 15 | 16 | 17 | 27 | 28 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-security/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms-config 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | vms-security 13 | 14 | 15 | 16 | 17 | org.springframework 18 | spring-webmvc 19 | 20 | 21 | 22 | 23 | com.dreamcc 24 | vms-api-system 25 | 26 | 27 | 28 | 29 | com.dreamcc 30 | vms-redis 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/config/AsyncConfig.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.scheduling.annotation.AsyncConfigurer; 5 | import org.springframework.scheduling.annotation.EnableAsync; 6 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; 7 | 8 | import java.util.concurrent.Executor; 9 | 10 | /** 11 | * @Title: vms 12 | * @Package: com.dreamcc.common.core.config 13 | * @Description: 配置线程池和启用异步 14 | * @Author: dreamcc 15 | * @Date: 2019/12/17 9:30 16 | * @Version: V1.0 17 | */ 18 | @Configuration 19 | @EnableAsync 20 | public class AsyncConfig implements AsyncConfigurer { 21 | 22 | @Override 23 | public Executor getAsyncExecutor() { 24 | //定义线程池 25 | ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor(); 26 | //核心线程数 27 | threadPoolTaskExecutor.setCorePoolSize(10); 28 | //线程池最大线程数 29 | threadPoolTaskExecutor.setMaxPoolSize(30); 30 | //线程队列最大线程数 31 | threadPoolTaskExecutor.setQueueCapacity(2000); 32 | //初始化 33 | threadPoolTaskExecutor.initialize(); 34 | return threadPoolTaskExecutor; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/utils/IdUtils.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.utils; 2 | 3 | import com.dreamcc.common.core.text.UUID; 4 | 5 | /** 6 | * ID生成器工具类 7 | * 8 | * @author ruoyi 9 | */ 10 | public class IdUtils 11 | { 12 | /** 13 | * 获取随机UUID 14 | * 15 | * @return 随机UUID 16 | */ 17 | public static String randomUUID() 18 | { 19 | return UUID.randomUUID().toString(); 20 | } 21 | 22 | /** 23 | * 简化的UUID,去掉了横线 24 | * 25 | * @return 简化的UUID,去掉了横线 26 | */ 27 | public static String simpleUUID() 28 | { 29 | return UUID.randomUUID().toString(true); 30 | } 31 | 32 | /** 33 | * 获取随机UUID,使用性能更好的ThreadLocalRandom生成UUID 34 | * 35 | * @return 随机UUID 36 | */ 37 | public static String fastUUID() 38 | { 39 | return UUID.fastUUID().toString(); 40 | } 41 | 42 | /** 43 | * 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID 44 | * 45 | * @return 简化的UUID,去掉了横线 46 | */ 47 | public static String fastSimpleUUID() 48 | { 49 | return UUID.fastUUID().toString(true); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-gateway/src/main/java/com/dreamcc/gateway/config/RouterFunctionConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.gateway.config; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.http.MediaType; 7 | import org.springframework.web.reactive.function.server.RequestPredicates; 8 | import org.springframework.web.reactive.function.server.RouterFunction; 9 | import org.springframework.web.reactive.function.server.RouterFunctions; 10 | import com.dreamcc.gateway.handler.ValidateCodeHandler; 11 | 12 | /** 13 | * 路由配置信息 14 | * 15 | * @author ruoyi 16 | */ 17 | @Configuration 18 | public class RouterFunctionConfiguration 19 | { 20 | @Autowired 21 | private ValidateCodeHandler validateCodeHandler; 22 | 23 | @SuppressWarnings("rawtypes") 24 | @Bean 25 | public RouterFunction routerFunction() 26 | { 27 | return RouterFunctions.route( 28 | RequestPredicates.GET("/code").and(RequestPredicates.accept(MediaType.TEXT_PLAIN)), 29 | validateCodeHandler); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-iot-gateway/vms-driver-virtual/src/main/java/com/dreamcc/driver/virtual/service/DriverRegister.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.driver.virtual.service; 2 | 3 | import com.dreamcc.driver.virtual.bean.DriverProperty; 4 | import com.dreamcc.driver.virtual.dto.DriverDTO; 5 | import org.springframework.boot.ApplicationArguments; 6 | import org.springframework.boot.ApplicationRunner; 7 | import org.springframework.stereotype.Component; 8 | 9 | /** 10 | * @author cloud-cc 11 | * @ClassName DriverRegister 12 | * @Description 驱动注册 13 | * @date 2021/12/7 09:29 14 | * @Version 1.0 15 | */ 16 | @Component 17 | public class DriverRegister implements ApplicationRunner { 18 | 19 | private final DriverProperty driverProperty; 20 | 21 | private final DriverClient driverClient; 22 | 23 | public DriverRegister(DriverProperty driverProperty, DriverClient driverClient) { 24 | this.driverProperty = driverProperty; 25 | this.driverClient = driverClient; 26 | } 27 | 28 | @Override 29 | public void run(ApplicationArguments args) throws Exception { 30 | 31 | DriverDTO driverInfo = driverProperty.getDriverInfo(); 32 | 33 | driverClient.register(driverInfo); 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vms-application/vms-application-iot/src/main/java/com/dreamcc/application/iot/DeviceApplication.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.application.iot; 2 | 3 | import com.dreamcc.application.iot.dto.DeviceDTO; 4 | import com.dreamcc.application.iot.mapstruct.DeviceMapper; 5 | import com.dreamcc.domain.iot.domain.service.DeviceFactory; 6 | import com.dreamcc.domain.iot.repository.DeviceRepository; 7 | import org.springframework.stereotype.Component; 8 | 9 | /** 10 | * @author cloud-cc 11 | * @ClassName DeviceApplication 12 | * @Description 设备 13 | * @date 2021/11/30 10:26 14 | * @Version 1.0 15 | */ 16 | @Component 17 | public class DeviceApplication { 18 | 19 | private final DeviceRepository deviceRepository; 20 | 21 | private final DeviceFactory deviceFactory; 22 | 23 | private final DeviceMapper deviceMapper; 24 | 25 | public DeviceApplication(DeviceRepository deviceRepository, DeviceFactory deviceFactory, DeviceMapper deviceMapper) { 26 | this.deviceRepository = deviceRepository; 27 | this.deviceFactory = deviceFactory; 28 | this.deviceMapper = deviceMapper; 29 | } 30 | 31 | /** 32 | * 创建设备 33 | * 34 | * @param deviceDTO 设备 35 | */ 36 | public void create(DeviceDTO deviceDTO) { 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/util/OperConst.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.util; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * @Title: vms 8 | * @Package: com.dreamcc.vms.gateway.util 9 | * @Description: 操作静态常量 10 | * @Author: dreamcc 11 | * @Date: 2019/12/13 11:30 12 | * @Version: V1.0 13 | */ 14 | public class OperConst { 15 | 16 | /** 17 | * 操作类型 18 | */ 19 | public final static String CMD_TYPE = "CmdType"; 20 | 21 | /** 22 | * 设备操作 23 | */ 24 | @Getter 25 | @AllArgsConstructor 26 | public enum DeviceOper { 27 | /** 28 | * 设备注册 29 | */ 30 | REGISTER(1500, "Register"), 31 | /** 32 | * 心跳检测 33 | */ 34 | KEEP_ALIVE(1501,"Keepalive"), 35 | /** 36 | * Ping任务 37 | */ 38 | PING(10025, "设备Ping任务初始化化失败"); 39 | /** 40 | * 操作代码 41 | */ 42 | private Integer code; 43 | /** 44 | * 操作消息 45 | */ 46 | private String value; 47 | } 48 | 49 | /** 50 | * 编解码操作 51 | */ 52 | @Getter 53 | @AllArgsConstructor 54 | public enum EnDeCoder { 55 | /** 56 | * 解析XML异常 57 | */ 58 | DECODER_XML_ERROR(10020, "解析XML异常"); 59 | /** 60 | * 操作代码 61 | */ 62 | private Integer code; 63 | /** 64 | * 操作消息 65 | */ 66 | private String msg; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /vms-modules/vms-service-monitor/src/main/java/com/dreamcc/monitor/RuoYiMonitorApplication.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.monitor; 2 | 3 | import de.codecentric.boot.admin.server.config.EnableAdminServer; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | /** 8 | * 监控中心 9 | * 10 | * @author ruoyi 11 | */ 12 | @EnableAdminServer 13 | @SpringBootApplication 14 | public class RuoYiMonitorApplication 15 | { 16 | public static void main(String[] args) 17 | { 18 | SpringApplication.run(RuoYiMonitorApplication.class, args); 19 | System.out.println("(♥◠‿◠)ノ゙ 监控中心启动成功 ლ(´ڡ`ლ)゙ \n" + 20 | " .-------. ____ __ \n" + 21 | " | _ _ \\ \\ \\ / / \n" + 22 | " | ( ' ) | \\ _. / ' \n" + 23 | " |(_ o _) / _( )_ .' \n" + 24 | " | (_,_).' __ ___(_ o _)' \n" + 25 | " | |\\ \\ | || |(_,_)' \n" + 26 | " | | \\ `' /| `-' / \n" + 27 | " | | \\ / \\ / \n" + 28 | " ''-' `'-' `-..-' "); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/constant/ScheduleConstants.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.constant; 2 | 3 | /** 4 | * 任务调度通用常量 5 | * 6 | * @author ruoyi 7 | */ 8 | public class ScheduleConstants 9 | { 10 | public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME"; 11 | 12 | /** 执行目标key */ 13 | public static final String TASK_PROPERTIES = "TASK_PROPERTIES"; 14 | 15 | /** 默认 */ 16 | public static final String MISFIRE_DEFAULT = "0"; 17 | 18 | /** 立即触发执行 */ 19 | public static final String MISFIRE_IGNORE_MISFIRES = "1"; 20 | 21 | /** 触发一次执行 */ 22 | public static final String MISFIRE_FIRE_AND_PROCEED = "2"; 23 | 24 | /** 不触发立即执行 */ 25 | public static final String MISFIRE_DO_NOTHING = "3"; 26 | 27 | public enum Status 28 | { 29 | /** 30 | * 正常 31 | */ 32 | NORMAL("0"), 33 | /** 34 | * 暂停 35 | */ 36 | PAUSE("1"); 37 | 38 | private String value; 39 | 40 | private Status(String value) 41 | { 42 | this.value = value; 43 | } 44 | 45 | public String getValue() 46 | { 47 | return value; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-core/src/main/java/com/dreamcc/common/core/exception/GlobalException.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.common.core.exception; 2 | 3 | /** 4 | * 全局异常 5 | * 6 | * @author ruoyi 7 | */ 8 | public class GlobalException extends RuntimeException 9 | { 10 | 11 | private static final long serialVersionUID = 1L; 12 | 13 | /** 14 | * 错误提示 15 | */ 16 | private String message; 17 | 18 | /** 19 | * 错误明细,内部调试错误 20 | * 21 | * 和 {@link CommonResult#getDetailMessage()} 一致的设计 22 | */ 23 | private String detailMessage; 24 | 25 | /** 26 | * 空构造方法,避免反序列化问题 27 | */ 28 | public GlobalException() 29 | { 30 | } 31 | 32 | public GlobalException(String message) 33 | { 34 | this.message = message; 35 | } 36 | 37 | public String getDetailMessage() 38 | { 39 | return detailMessage; 40 | } 41 | 42 | public GlobalException setDetailMessage(String detailMessage) 43 | { 44 | this.detailMessage = detailMessage; 45 | return this; 46 | } 47 | 48 | public String getMessage() 49 | { 50 | return message; 51 | } 52 | 53 | public GlobalException setMessage(String message) 54 | { 55 | this.message = message; 56 | return this; 57 | } 58 | } -------------------------------------------------------------------------------- /vms-infrastructure/vms-gateway/src/main/java/com/dreamcc/gateway/config/properties/XssProperties.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.gateway.config.properties; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.cloud.context.config.annotation.RefreshScope; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | /** 11 | * XSS跨站脚本配置 12 | * 13 | * @author ruoyi 14 | */ 15 | @Configuration 16 | @RefreshScope 17 | @ConfigurationProperties(prefix = "security.xss") 18 | public class XssProperties 19 | { 20 | /** 21 | * Xss开关 22 | */ 23 | private Boolean enabled; 24 | 25 | /** 26 | * 排除路径 27 | */ 28 | private List excludeUrls = new ArrayList<>(); 29 | 30 | public Boolean getEnabled() 31 | { 32 | return enabled; 33 | } 34 | 35 | public void setEnabled(Boolean enabled) 36 | { 37 | this.enabled = enabled; 38 | } 39 | 40 | public List getExcludeUrls() 41 | { 42 | return excludeUrls; 43 | } 44 | 45 | public void setExcludeUrls(List excludeUrls) 46 | { 47 | this.excludeUrls = excludeUrls; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-infrastructure-iot/src/main/java/com/dreamcc/mq/producer/DriverProducerImpl.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.mq.producer; 2 | 3 | import cn.hutool.json.JSONUtil; 4 | import com.dreamcc.application.iot.mq.event.DriverEvent; 5 | import com.dreamcc.application.iot.mq.producer.DriverProducer; 6 | import com.dreamcc.domain.iot.common.MqConstants; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.amqp.rabbit.core.RabbitTemplate; 9 | import org.springframework.stereotype.Component; 10 | 11 | /** 12 | * @author cloud-cc 13 | * @ClassName DriverProducerImpl 14 | * @Description RabbitMQ实现消息发送 15 | * @date 2021/12/2 17:24 16 | * @Version 1.0 17 | */ 18 | @Slf4j 19 | @Component 20 | public class DriverProducerImpl implements DriverProducer { 21 | 22 | private final RabbitTemplate rabbitTemplate; 23 | 24 | public DriverProducerImpl(RabbitTemplate rabbitTemplate) { 25 | this.rabbitTemplate = rabbitTemplate; 26 | } 27 | 28 | @Override 29 | public void driverEventSender(DriverEvent driverEvent) { 30 | log.debug("send driver event:{}", JSONUtil.toJsonStr(driverEvent)); 31 | rabbitTemplate.convertAndSend(MqConstants.TOPIC_EXCHANGE_EVENT 32 | ,MqConstants.ROUTING_DRIVER_EVENT_PREFIX 33 | ,driverEvent); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-gateway/src/main/java/com/dreamcc/gateway/RuoYiGatewayApplication.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.gateway; 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 | * @author ruoyi 11 | */ 12 | @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class }) 13 | public class RuoYiGatewayApplication 14 | { 15 | public static void main(String[] args) 16 | { 17 | SpringApplication.run(RuoYiGatewayApplication.class, args); 18 | System.out.println("(♥◠‿◠)ノ゙ 若依网关启动成功 ლ(´ڡ`ლ)゙ \n" + 19 | " .-------. ____ __ \n" + 20 | " | _ _ \\ \\ \\ / / \n" + 21 | " | ( ' ) | \\ _. / ' \n" + 22 | " |(_ o _) / _( )_ .' \n" + 23 | " | (_,_).' __ ___(_ o _)' \n" + 24 | " | |\\ \\ | || |(_,_)' \n" + 25 | " | | \\ `' /| `-' / \n" + 26 | " | | \\ / \\ / \n" + 27 | " ''-' `'-' `-..-' "); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vms-domain/vms-domain-iot/src/main/java/com/dreamcc/domain/iot/domain/aggregate/status/StatusCenter.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.domain.iot.domain.aggregate.status; 2 | 3 | import com.dreamcc.domain.iot.common.StatusConstants; 4 | import com.dreamcc.domain.iot.common.annotation.AggregateRoot; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | /** 10 | * @author cloud-cc 11 | * @ClassName StatusCenter 12 | * @Description 驱动/设备状态管理 13 | * @date 2021/11/29 20:50 14 | * @Version 1.0 15 | */ 16 | @Data 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | @AggregateRoot 20 | public class StatusCenter { 21 | 22 | /** 23 | * 驱动/设备 ID 24 | */ 25 | private Long id; 26 | 27 | /** 28 | * 类型 29 | */ 30 | private Integer type; 31 | 32 | /** 33 | * 状态 34 | */ 35 | private Integer status; 36 | 37 | /** 38 | * 启动 39 | * 40 | * @return 在线状态 41 | */ 42 | public StatusCenter start(){ 43 | this.status = StatusConstants.ONLINE.getCode(); 44 | return this; 45 | } 46 | 47 | /** 48 | * 停止 49 | * 50 | * @return 离线状态 51 | */ 52 | public StatusCenter stop(){ 53 | this.status = StatusConstants.OFF_LINE.getCode(); 54 | return this; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/java/com/dreamcc/system/service/ISysUserOnlineService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.service; 2 | 3 | import com.dreamcc.system.api.model.LoginUser; 4 | import com.dreamcc.system.domain.SysUserOnline; 5 | 6 | /** 7 | * 在线用户 服务层 8 | * 9 | * @author ruoyi 10 | */ 11 | public interface ISysUserOnlineService 12 | { 13 | /** 14 | * 通过登录地址查询信息 15 | * 16 | * @param ipaddr 登录地址 17 | * @param user 用户信息 18 | * @return 在线用户信息 19 | */ 20 | public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user); 21 | 22 | /** 23 | * 通过用户名称查询信息 24 | * 25 | * @param userName 用户名称 26 | * @param user 用户信息 27 | * @return 在线用户信息 28 | */ 29 | public SysUserOnline selectOnlineByUserName(String userName, LoginUser user); 30 | 31 | /** 32 | * 通过登录地址/用户名称查询信息 33 | * 34 | * @param ipaddr 登录地址 35 | * @param userName 用户名称 36 | * @param user 用户信息 37 | * @return 在线用户信息 38 | */ 39 | public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user); 40 | 41 | /** 42 | * 设置在线用户信息 43 | * 44 | * @param user 用户信息 45 | * @return 在线用户 46 | */ 47 | public SysUserOnline loginUserToUserOnline(LoginUser user); 48 | } 49 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-infrastructure-iot/src/main/java/com/dreamcc/orm/dataobject/ProfileDO.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.orm.dataobject; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | import java.util.Date; 11 | 12 | /** 13 | * @author cloud-cc 14 | * @ClassName ProfilePO 15 | * @Description 模板数据库存储类 16 | * @date 2021/12/1 09:11 17 | * @Version 1.0 18 | */ 19 | @Data 20 | @TableName("vms_iot_profile") 21 | public class ProfileDO implements Serializable { 22 | 23 | /** 24 | * id 25 | */ 26 | @TableId 27 | private Long id; 28 | /** 29 | * 模板名称 30 | */ 31 | private String name; 32 | /** 33 | * 是否可用 34 | */ 35 | private Integer enable; 36 | /** 37 | * 描述 38 | */ 39 | private String description; 40 | /** 41 | * 创建时间 42 | */ 43 | @TableField(fill = FieldFill.INSERT) 44 | private Date createTime; 45 | /** 46 | * 更新时间 47 | */ 48 | @TableField(fill = FieldFill.INSERT_UPDATE) 49 | private Date updateTime; 50 | /** 51 | * 逻辑删除符 52 | */ 53 | private Integer deleted; 54 | } 55 | -------------------------------------------------------------------------------- /vms-modules/vms-service-job/src/main/java/com/dreamcc/job/service/ISysJobLogService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.job.service; 2 | 3 | import com.dreamcc.job.domain.SysJobLog; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 定时任务调度日志信息信息 服务层 9 | * 10 | * @author ruoyi 11 | */ 12 | public interface ISysJobLogService 13 | { 14 | /** 15 | * 获取quartz调度器日志的计划任务 16 | * 17 | * @param jobLog 调度日志信息 18 | * @return 调度任务日志集合 19 | */ 20 | public List selectJobLogList(SysJobLog jobLog); 21 | 22 | /** 23 | * 通过调度任务日志ID查询调度信息 24 | * 25 | * @param jobLogId 调度任务日志ID 26 | * @return 调度任务日志对象信息 27 | */ 28 | public SysJobLog selectJobLogById(Long jobLogId); 29 | 30 | /** 31 | * 新增任务日志 32 | * 33 | * @param jobLog 调度日志信息 34 | */ 35 | public void addJobLog(SysJobLog jobLog); 36 | 37 | /** 38 | * 批量删除调度日志信息 39 | * 40 | * @param logIds 需要删除的日志ID 41 | * @return 结果 42 | */ 43 | public int deleteJobLogByIds(Long[] logIds); 44 | 45 | /** 46 | * 删除任务日志 47 | * 48 | * @param jobId 调度日志ID 49 | * @return 结果 50 | */ 51 | public int deleteJobLogById(Long jobId); 52 | 53 | /** 54 | * 清空任务日志 55 | */ 56 | public void cleanJobLog(); 57 | } 58 | -------------------------------------------------------------------------------- /vms-modules/vms-service-alarm/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms-modules 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | vms-service-alarm 13 | 14 | 15 | 16 | 17 | com.alibaba.cloud 18 | spring-cloud-starter-stream-rocketmq 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-web 23 | 24 | 25 | vms-core 26 | com.dreamcc 27 | 28 | 29 | 30 | cn.hutool 31 | hutool-all 32 | 33 | 34 | -------------------------------------------------------------------------------- /vms-modules/vms-service-file/src/main/java/com/dreamcc/file/RuoYiFileApplication.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.file; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 6 | import springfox.documentation.oas.annotations.EnableOpenApi; 7 | 8 | /** 9 | * 文件服务 10 | * 11 | * @author ruoyi 12 | */ 13 | @EnableOpenApi 14 | @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class }) 15 | public class RuoYiFileApplication 16 | { 17 | public static void main(String[] args) 18 | { 19 | SpringApplication.run(RuoYiFileApplication.class, args); 20 | System.out.println("(♥◠‿◠)ノ゙ 文件服务模块启动成功 ლ(´ڡ`ლ)゙ \n" + 21 | " .-------. ____ __ \n" + 22 | " | _ _ \\ \\ \\ / / \n" + 23 | " | ( ' ) | \\ _. / ' \n" + 24 | " |(_ o _) / _( )_ .' \n" + 25 | " | (_,_).' __ ___(_ o _)' \n" + 26 | " | |\\ \\ | || |(_,_)' \n" + 27 | " | | \\ `' /| `-' / \n" + 28 | " | | \\ / \\ / \n" + 29 | " ''-' `'-' `-..-' "); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/resources/mapper/system/SysRoleMenuMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 17 | delete from sys_role_menu where role_id=#{roleId} 18 | 19 | 20 | 21 | delete from sys_role_menu where role_id in 22 | 23 | #{roleId} 24 | 25 | 26 | 27 | 28 | insert into sys_role_menu(role_id, menu_id) values 29 | 30 | (#{item.roleId},#{item.menuId}) 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/resources/mapper/system/SysUserPostMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | delete from sys_user_post where user_id=#{userId} 14 | 15 | 16 | 19 | 20 | 21 | delete from sys_user_post where user_id in 22 | 23 | #{userId} 24 | 25 | 26 | 27 | 28 | insert into sys_user_post(user_id, post_id) values 29 | 30 | (#{item.userId},#{item.postId}) 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/controller/ServerDeviceController.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.controller; 2 | 3 | import com.dreamcc.common.core.domain.R; 4 | import com.dreamcc.service.device.dto.ServerDeviceDTO; 5 | import com.dreamcc.service.device.service.IServerDeviceService; 6 | import io.swagger.annotations.Api; 7 | import io.swagger.annotations.ApiOperation; 8 | import lombok.AllArgsConstructor; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | /** 15 | * @Title: vms 16 | * @Package: com.dreamcc.service.device.controller 17 | * @Description: 服务器设备controller 18 | * @Author: dreamcc 19 | * @Date: 2019/12/17 16:57 20 | * @Version: V1.0 21 | */ 22 | @Api(tags = "服务器设备模块") 23 | @Slf4j 24 | @AllArgsConstructor 25 | @RestController 26 | @RequestMapping("/server") 27 | public class ServerDeviceController { 28 | 29 | private IServerDeviceService serverDeviceService; 30 | 31 | @ApiOperation("添加服务器设备") 32 | @PostMapping("/add") 33 | public R addServerDevice(ServerDeviceDTO serverDeviceDTO) { 34 | Boolean result = serverDeviceService.addServerDevice(serverDeviceDTO); 35 | return R.ok(result); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-config/vms-datasource/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms-config 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | vms-datasource 13 | 14 | 15 | 16 | 17 | 18 | com.alibaba 19 | druid-spring-boot-starter 20 | ${druid.version} 21 | 22 | 23 | 24 | 25 | com.baomidou 26 | dynamic-datasource-spring-boot-starter 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/resources/mapper/system/SysRoleDeptMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | delete from sys_role_dept where role_id=#{roleId} 14 | 15 | 16 | 19 | 20 | 21 | delete from sys_role_dept where role_id in 22 | 23 | #{roleId} 24 | 25 | 26 | 27 | 28 | insert into sys_role_dept(role_id, dept_id) values 29 | 30 | (#{item.roleId},#{item.deptId}) 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /vms-api/vms-api-system/src/main/java/com/dreamcc/system/api/factory/RemoteLogFallbackFactory.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.api.factory; 2 | 3 | import com.dreamcc.common.core.domain.R; 4 | import com.dreamcc.system.api.RemoteLogService; 5 | import com.dreamcc.system.api.domain.SysLogininfor; 6 | import com.dreamcc.system.api.domain.SysOperLog; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.cloud.openfeign.FallbackFactory; 10 | import org.springframework.stereotype.Component; 11 | 12 | /** 13 | * 日志服务降级处理 14 | * 15 | * @author ruoyi 16 | */ 17 | @Component 18 | public class RemoteLogFallbackFactory implements FallbackFactory { 19 | private static final Logger log = LoggerFactory.getLogger(RemoteLogFallbackFactory.class); 20 | 21 | @Override 22 | public RemoteLogService create(Throwable throwable) { 23 | log.error("日志服务调用失败:{}", throwable.getMessage()); 24 | return new RemoteLogService() { 25 | @Override 26 | public R saveLog(SysOperLog sysOperLog, String source) { 27 | return null; 28 | } 29 | 30 | @Override 31 | public R saveLogininfor(SysLogininfor sysLogininfor, String source) { 32 | return null; 33 | } 34 | }; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-auth/src/main/java/com/dreamcc/auth/RuoYiAuthApplication.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.auth; 2 | 3 | import com.dreamcc.security.annotation.EnableRyFeignClients; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | 8 | /** 9 | * 认证授权中心 10 | * 11 | * @author ruoyi 12 | */ 13 | @EnableRyFeignClients 14 | @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class }) 15 | public class RuoYiAuthApplication 16 | { 17 | public static void main(String[] args) 18 | { 19 | SpringApplication.run(RuoYiAuthApplication.class, args); 20 | System.out.println("(♥◠‿◠)ノ゙ 认证授权中心启动成功 ლ(´ڡ`ლ)゙ \n" + 21 | " .-------. ____ __ \n" + 22 | " | _ _ \\ \\ \\ / / \n" + 23 | " | ( ' ) | \\ _. / ' \n" + 24 | " |(_ o _) / _( )_ .' \n" + 25 | " | (_,_).' __ ___(_ o _)' \n" + 26 | " | |\\ \\ | || |(_,_)' \n" + 27 | " | | \\ `' /| `-' / \n" + 28 | " | | \\ / \\ / \n" + 29 | " ''-' `'-' `-..-' "); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vms-api/vms-api-iot/src/main/java/com/dreamcc/api/iot/controller/DriverController.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.api.iot.controller; 2 | 3 | import com.dreamcc.application.iot.DriverApplication; 4 | import com.dreamcc.application.iot.dto.DriverDTO; 5 | import com.dreamcc.common.core.domain.R; 6 | import com.dreamcc.common.core.web.controller.BaseController; 7 | import io.swagger.annotations.Api; 8 | import io.swagger.annotations.ApiOperation; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | /** 15 | * @author cloud-cc 16 | * @ClassName DriverController 17 | * @Description 驱动API 18 | * @date 2021/12/6 08:25 19 | * @Version 1.0 20 | */ 21 | @Api("驱动管理") 22 | @RestController 23 | @RequestMapping("/driver") 24 | public class DriverController extends BaseController { 25 | 26 | private final DriverApplication driverApplication; 27 | 28 | public DriverController(DriverApplication driverApplication) { 29 | this.driverApplication = driverApplication; 30 | } 31 | 32 | @ApiOperation("添加驱动") 33 | @PostMapping 34 | public R register(@RequestBody DriverDTO driverDTO){ 35 | driverApplication.registry(driverDTO); 36 | return R.ok(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-rpc/src/main/java/com/dreamcc/iot/util/Const.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.iot.util; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * @Title: vms 8 | * @Package: com.dreamcc.vms.gateway.util 9 | * @Description: 常量 10 | * @Author: dreamcc 11 | * @Date: 2019/12/11 17:27 12 | * @Version: V1.0 13 | */ 14 | public class Const { 15 | 16 | /** 17 | * 网关常量 18 | */ 19 | @Getter 20 | @AllArgsConstructor 21 | public enum Gateway{ 22 | /** 23 | * 消息头长度 24 | */ 25 | RPC_HEART_BEAT(4001,"心跳检测"); 26 | /** 27 | * 说明 28 | */ 29 | private Integer code; 30 | /** 31 | * 值 32 | */ 33 | private String value; 34 | } 35 | 36 | /** 37 | * 消息体解码常量 38 | */ 39 | @Getter 40 | @AllArgsConstructor 41 | public enum XMLFramework{ 42 | /** 43 | * 消息头长度 44 | */ 45 | HEAD_LENGTH(28,"消息头长度"), 46 | /** 47 | * 版本信息 48 | */ 49 | VERSION(0x0100,"版本"), 50 | /** 51 | * 指令类型 :二进制 52 | */ 53 | CMDTYPE_BINARY(1,"指令类型"), 54 | /** 55 | * 指令类型 :XML明文 56 | */ 57 | CMDTYPE_XML(0,"指令类型"); 58 | /** 59 | * 值 60 | */ 61 | private Integer code; 62 | /** 63 | * 说明 64 | */ 65 | private String value; 66 | } 67 | 68 | /** 69 | * 厂家 70 | */ 71 | public static final String XMLFRAMEWORK_COMPANY_TYPE= "BST."; 72 | /** 73 | * 设备在线状态 74 | */ 75 | public static final int DEVICE_ONLINE = 1; 76 | } 77 | -------------------------------------------------------------------------------- /vms-domain/vms-domain-iot/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | vms-domain 7 | com.dreamcc 8 | v1.0 9 | 10 | 4.0.0 11 | 12 | vms-domain-iot 13 | 14 | iot domain 15 | 16 | 17 | 18 | 19 | org.hibernate.validator 20 | hibernate-validator 21 | 22 | 23 | 24 | org.projectlombok 25 | lombok 26 | 27 | 28 | 29 | cn.hutool 30 | hutool-all 31 | 32 | 33 | 34 | 35 | com.dreamcc 36 | vms-common 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/java/com/dreamcc/system/mapper/SysNoticeMapper.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.mapper; 2 | 3 | import com.dreamcc.system.domain.SysNotice; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 通知公告表 数据层 9 | * 10 | * @author ruoyi 11 | */ 12 | public interface SysNoticeMapper 13 | { 14 | /** 15 | * 查询公告信息 16 | * 17 | * @param noticeId 公告ID 18 | * @return 公告信息 19 | */ 20 | public SysNotice selectNoticeById(Long noticeId); 21 | 22 | /** 23 | * 查询公告列表 24 | * 25 | * @param notice 公告信息 26 | * @return 公告集合 27 | */ 28 | public List selectNoticeList(SysNotice notice); 29 | 30 | /** 31 | * 新增公告 32 | * 33 | * @param notice 公告信息 34 | * @return 结果 35 | */ 36 | public int insertNotice(SysNotice notice); 37 | 38 | /** 39 | * 修改公告 40 | * 41 | * @param notice 公告信息 42 | * @return 结果 43 | */ 44 | public int updateNotice(SysNotice notice); 45 | 46 | /** 47 | * 批量删除公告 48 | * 49 | * @param noticeId 公告ID 50 | * @return 结果 51 | */ 52 | public int deleteNoticeById(Long noticeId); 53 | 54 | /** 55 | * 批量删除公告信息 56 | * 57 | * @param noticeIds 需要删除的公告ID 58 | * @return 结果 59 | */ 60 | public int deleteNoticeByIds(Long[] noticeIds); 61 | } -------------------------------------------------------------------------------- /vms-modules/vms-service-file/src/main/java/com/dreamcc/file/service/LocalSysFileServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.file.service; 2 | 3 | import com.dreamcc.file.utils.FileUploadUtils; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.context.annotation.Primary; 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.web.multipart.MultipartFile; 8 | 9 | /** 10 | * 本地文件存储 11 | * 12 | * @author ruoyi 13 | */ 14 | @Primary 15 | @Service 16 | public class LocalSysFileServiceImpl implements ISysFileService 17 | { 18 | /** 19 | * 资源映射路径 前缀 20 | */ 21 | @Value("${file.prefix}") 22 | public String localFilePrefix; 23 | 24 | /** 25 | * 域名或本机访问地址 26 | */ 27 | @Value("${file.domain}") 28 | public String domain; 29 | 30 | /** 31 | * 上传文件存储在本地的根路径 32 | */ 33 | @Value("${file.path}") 34 | private String localFilePath; 35 | 36 | /** 37 | * 本地文件上传接口 38 | * 39 | * @param file 上传的文件 40 | * @return 访问地址 41 | * @throws Exception 42 | */ 43 | @Override 44 | public String uploadFile(MultipartFile file) throws Exception 45 | { 46 | String name = FileUploadUtils.upload(localFilePath, file); 47 | String url = domain + localFilePrefix + name; 48 | return url; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/java/com/dreamcc/system/service/ISysNoticeService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.service; 2 | 3 | import com.dreamcc.system.domain.SysNotice; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 公告 服务层 9 | * 10 | * @author ruoyi 11 | */ 12 | public interface ISysNoticeService 13 | { 14 | /** 15 | * 查询公告信息 16 | * 17 | * @param noticeId 公告ID 18 | * @return 公告信息 19 | */ 20 | public SysNotice selectNoticeById(Long noticeId); 21 | 22 | /** 23 | * 查询公告列表 24 | * 25 | * @param notice 公告信息 26 | * @return 公告集合 27 | */ 28 | public List selectNoticeList(SysNotice notice); 29 | 30 | /** 31 | * 新增公告 32 | * 33 | * @param notice 公告信息 34 | * @return 结果 35 | */ 36 | public int insertNotice(SysNotice notice); 37 | 38 | /** 39 | * 修改公告 40 | * 41 | * @param notice 公告信息 42 | * @return 结果 43 | */ 44 | public int updateNotice(SysNotice notice); 45 | 46 | /** 47 | * 删除公告信息 48 | * 49 | * @param noticeId 公告ID 50 | * @return 结果 51 | */ 52 | public int deleteNoticeById(Long noticeId); 53 | 54 | /** 55 | * 批量删除公告信息 56 | * 57 | * @param noticeIds 需要删除的公告ID 58 | * @return 结果 59 | */ 60 | public int deleteNoticeByIds(Long[] noticeIds); 61 | } 62 | -------------------------------------------------------------------------------- /vms-modules/vms-service-job/src/main/java/com/dreamcc/job/RuoYiJobApplication.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.job; 2 | 3 | import com.dreamcc.security.annotation.EnableCustomConfig; 4 | import com.dreamcc.security.annotation.EnableRyFeignClients; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import springfox.documentation.oas.annotations.EnableOpenApi; 8 | 9 | /** 10 | * 定时任务 11 | * 12 | * @author ruoyi 13 | */ 14 | @EnableCustomConfig 15 | @EnableOpenApi 16 | @EnableRyFeignClients 17 | @SpringBootApplication 18 | public class RuoYiJobApplication 19 | { 20 | public static void main(String[] args) 21 | { 22 | SpringApplication.run(RuoYiJobApplication.class, args); 23 | System.out.println("(♥◠‿◠)ノ゙ 定时任务模块启动成功 ლ(´ڡ`ლ)゙ \n" + 24 | " .-------. ____ __ \n" + 25 | " | _ _ \\ \\ \\ / / \n" + 26 | " | ( ' ) | \\ _. / ' \n" + 27 | " |(_ o _) / _( )_ .' \n" + 28 | " | (_,_).' __ ___(_ o _)' \n" + 29 | " | |\\ \\ | || |(_,_)' \n" + 30 | " | | \\ `' /| `-' / \n" + 31 | " | | \\ / \\ / \n" + 32 | " ''-' `'-' `-..-' "); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vms-modules/vms-service-file/src/main/java/com/dreamcc/file/service/FastDfsSysFileServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.file.service; 2 | 3 | import com.github.tobato.fastdfs.domain.fdfs.StorePath; 4 | import com.github.tobato.fastdfs.service.FastFileStorageClient; 5 | import org.apache.commons.io.FilenameUtils; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.beans.factory.annotation.Value; 8 | import org.springframework.stereotype.Service; 9 | import org.springframework.web.multipart.MultipartFile; 10 | 11 | /** 12 | * FastDFS 文件存储 13 | * 14 | * @author ruoyi 15 | */ 16 | @Service 17 | public class FastDfsSysFileServiceImpl implements ISysFileService 18 | { 19 | /** 20 | * 域名或本机访问地址 21 | */ 22 | @Value("${fdfs.domain}") 23 | public String domain; 24 | 25 | @Autowired 26 | private FastFileStorageClient storageClient; 27 | 28 | /** 29 | * FastDfs文件上传接口 30 | * 31 | * @param file 上传的文件 32 | * @return 访问地址 33 | * @throws Exception 34 | */ 35 | @Override 36 | public String uploadFile(MultipartFile file) throws Exception 37 | { 38 | StorePath storePath = storageClient.uploadFile(file.getInputStream(), file.getSize(), 39 | FilenameUtils.getExtension(file.getOriginalFilename()), null); 40 | return domain + "/" + storePath.getFullPath(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vms-api/vms-api-system/src/main/java/com/dreamcc/system/api/factory/RemoteUserFallbackFactory.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.api.factory; 2 | 3 | import com.dreamcc.system.api.RemoteUserService; 4 | import com.dreamcc.system.api.model.LoginUser; 5 | import com.dreamcc.common.core.domain.R; 6 | import com.dreamcc.system.api.domain.SysUser; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.cloud.openfeign.FallbackFactory; 10 | import org.springframework.stereotype.Component; 11 | 12 | /** 13 | * 用户服务降级处理 14 | * 15 | * @author ruoyi 16 | */ 17 | @Component 18 | public class RemoteUserFallbackFactory implements FallbackFactory { 19 | private static final Logger log = LoggerFactory.getLogger(RemoteUserFallbackFactory.class); 20 | 21 | @Override 22 | public RemoteUserService create(Throwable throwable) { 23 | log.error("用户服务调用失败:{}", throwable.getMessage()); 24 | return new RemoteUserService() { 25 | @Override 26 | public R getUserInfo(String username, String source) { 27 | return R.fail("获取用户失败:" + throwable.getMessage()); 28 | } 29 | 30 | @Override 31 | public R registerUserInfo(SysUser sysUser, String source) { 32 | return R.fail("注册用户失败:" + throwable.getMessage()); 33 | } 34 | }; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vms-infrastructure/vms-upms/src/main/java/com/dreamcc/system/RuoYiSystemApplication.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system; 2 | 3 | import com.dreamcc.security.annotation.EnableCustomConfig; 4 | import com.dreamcc.security.annotation.EnableRyFeignClients; 5 | import com.dreamcc.swagger.annotation.EnableCustomSwagger2; 6 | import org.springframework.boot.SpringApplication; 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; 8 | 9 | /** 10 | * 系统模块 11 | * 12 | * @author ruoyi 13 | */ 14 | @EnableCustomConfig 15 | @EnableCustomSwagger2 16 | @EnableRyFeignClients 17 | @SpringBootApplication 18 | public class RuoYiSystemApplication 19 | { 20 | public static void main(String[] args) 21 | { 22 | SpringApplication.run(RuoYiSystemApplication.class, args); 23 | System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n" + 24 | " .-------. ____ __ \n" + 25 | " | _ _ \\ \\ \\ / / \n" + 26 | " | ( ' ) | \\ _. / ' \n" + 27 | " |(_ o _) / _( )_ .' \n" + 28 | " | (_,_).' __ ___(_ o _)' \n" + 29 | " | |\\ \\ | || |(_,_)' \n" + 30 | " | | \\ `' /| `-' / \n" + 31 | " | | \\ / \\ / \n" + 32 | " ''-' `'-' `-..-' "); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vms-application/vms-application-iot/src/main/java/com/dreamcc/application/iot/DriverApplication.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.application.iot; 2 | 3 | import com.dreamcc.application.iot.dto.DriverDTO; 4 | import com.dreamcc.application.iot.mapstruct.DriverMapper; 5 | import com.dreamcc.application.iot.mq.consumer.DriverConsumer; 6 | import com.dreamcc.application.iot.mq.producer.DriverProducer; 7 | import com.dreamcc.domain.iot.repository.DriverRepository; 8 | import org.springframework.stereotype.Component; 9 | 10 | /** 11 | * @author cloud-cc 12 | * @ClassName DriverApplication 13 | * @Description 驱动应用编排 14 | * @date 2021/11/30 09:40 15 | * @Version 1.0 16 | */ 17 | @Component 18 | public class DriverApplication { 19 | 20 | private final DriverRepository driverRepository; 21 | 22 | private final DriverProducer driverProducer; 23 | 24 | private final DriverConsumer driverConsumer; 25 | 26 | private final DriverMapper driverMapper; 27 | 28 | public DriverApplication(DriverRepository driverRepository, DriverProducer driverProducer, DriverConsumer driverConsumer, DriverMapper driverMapper) { 29 | this.driverRepository = driverRepository; 30 | this.driverProducer = driverProducer; 31 | this.driverConsumer = driverConsumer; 32 | this.driverMapper = driverMapper; 33 | } 34 | 35 | /** 36 | * 注册驱动 37 | * 38 | * @param driverDTO 驱动 39 | */ 40 | public void registry(DriverDTO driverDTO) { 41 | 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /vms-api/vms-api-system/src/main/java/com/dreamcc/system/api/RemoteUserService.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.system.api; 2 | 3 | import com.dreamcc.system.api.model.LoginUser; 4 | import com.dreamcc.common.core.constant.SecurityConstants; 5 | import com.dreamcc.common.core.constant.ServiceNameConstants; 6 | import com.dreamcc.common.core.domain.R; 7 | import com.dreamcc.system.api.domain.SysUser; 8 | import com.dreamcc.system.api.factory.RemoteUserFallbackFactory; 9 | import org.springframework.cloud.openfeign.FeignClient; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | /** 13 | * 用户服务 14 | * 15 | * @author ruoyi 16 | */ 17 | @FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) 18 | public interface RemoteUserService 19 | { 20 | /** 21 | * 通过用户名查询用户信息 22 | * 23 | * @param username 用户名 24 | * @param source 请求来源 25 | * @return 结果 26 | */ 27 | @GetMapping("/user/info/{username}") 28 | R getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); 29 | 30 | /** 31 | * 注册用户信息 32 | * 33 | * @param sysUser 用户信息 34 | * @param source 请求来源 35 | * @return 结果 36 | */ 37 | @PostMapping("/user/register") 38 | R registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); 39 | } 40 | -------------------------------------------------------------------------------- /vms-modules/vms-service-job/src/main/java/com/dreamcc/job/mapper/SysJobMapper.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.job.mapper; 2 | 3 | import com.dreamcc.job.domain.SysJob; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 调度任务信息 数据层 9 | * 10 | * @author ruoyi 11 | */ 12 | public interface SysJobMapper 13 | { 14 | /** 15 | * 查询调度任务日志集合 16 | * 17 | * @param job 调度信息 18 | * @return 操作日志集合 19 | */ 20 | public List selectJobList(SysJob job); 21 | 22 | /** 23 | * 查询所有调度任务 24 | * 25 | * @return 调度任务列表 26 | */ 27 | public List selectJobAll(); 28 | 29 | /** 30 | * 通过调度ID查询调度任务信息 31 | * 32 | * @param jobId 调度ID 33 | * @return 角色对象信息 34 | */ 35 | public SysJob selectJobById(Long jobId); 36 | 37 | /** 38 | * 通过调度ID删除调度任务信息 39 | * 40 | * @param jobId 调度ID 41 | * @return 结果 42 | */ 43 | public int deleteJobById(Long jobId); 44 | 45 | /** 46 | * 批量删除调度任务信息 47 | * 48 | * @param ids 需要删除的数据ID 49 | * @return 结果 50 | */ 51 | public int deleteJobByIds(Long[] ids); 52 | 53 | /** 54 | * 修改调度任务信息 55 | * 56 | * @param job 调度任务信息 57 | * @return 结果 58 | */ 59 | public int updateJob(SysJob job); 60 | 61 | /** 62 | * 新增调度任务信息 63 | * 64 | * @param job 调度任务信息 65 | * @return 结果 66 | */ 67 | public int insertJob(SysJob job); 68 | } 69 | -------------------------------------------------------------------------------- /vms-modules/vms-service-device/src/main/java/com/dreamcc/service/device/rpc/connection/ServiceDiscovery.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.service.device.rpc.connection; 2 | 3 | import lombok.AllArgsConstructor; 4 | import org.I0Itec.zkclient.ZkClient; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Component; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | //TODO zookeeper地址 12 | /** 13 | * @Title: vms 14 | * @Package: com.dreamcc.service.device.rpc.client 15 | * @Description: 服务发现 16 | * @Author: dreamcc 17 | * @Date: 2019/12/17 11:37 18 | * @Version: V1.0 19 | */ 20 | 21 | @Component 22 | @AllArgsConstructor 23 | public class ServiceDiscovery { 24 | /** 25 | * zookeeper注册中心地址 26 | */ 27 | private String registryAddress = "127.0.0.1:9888"; 28 | /** 29 | * 连接管理 30 | */ 31 | ConnectManage connectManage; 32 | /** 33 | * 服务器地址 34 | */ 35 | private volatile List addressList = new ArrayList<>(); 36 | /** 37 | * 注册中心地址 38 | */ 39 | private static final String ZK_REGISTRY_PATH = "/rpc"; 40 | /** 41 | * ZK客户端 42 | */ 43 | private ZkClient client; 44 | 45 | @Autowired 46 | public ServiceDiscovery(ConnectManage connectManage) { 47 | this.connectManage = connectManage; 48 | updateConnectedServer(); 49 | } 50 | 51 | /** 52 | * 更新连接服务 53 | */ 54 | private void updateConnectedServer() { 55 | addressList.add(registryAddress); 56 | connectManage.updateConnectServer(addressList); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /vms-modules/vms-service-job/src/main/java/com/dreamcc/job/mapper/SysJobLogMapper.java: -------------------------------------------------------------------------------- 1 | package com.dreamcc.job.mapper; 2 | 3 | import com.dreamcc.job.domain.SysJobLog; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 调度任务日志信息 数据层 9 | * 10 | * @author ruoyi 11 | */ 12 | public interface SysJobLogMapper 13 | { 14 | /** 15 | * 获取quartz调度器日志的计划任务 16 | * 17 | * @param jobLog 调度日志信息 18 | * @return 调度任务日志集合 19 | */ 20 | public List selectJobLogList(SysJobLog jobLog); 21 | 22 | /** 23 | * 查询所有调度任务日志 24 | * 25 | * @return 调度任务日志列表 26 | */ 27 | public List selectJobLogAll(); 28 | 29 | /** 30 | * 通过调度任务日志ID查询调度信息 31 | * 32 | * @param jobLogId 调度任务日志ID 33 | * @return 调度任务日志对象信息 34 | */ 35 | public SysJobLog selectJobLogById(Long jobLogId); 36 | 37 | /** 38 | * 新增任务日志 39 | * 40 | * @param jobLog 调度日志信息 41 | * @return 结果 42 | */ 43 | public int insertJobLog(SysJobLog jobLog); 44 | 45 | /** 46 | * 批量删除调度日志信息 47 | * 48 | * @param logIds 需要删除的数据ID 49 | * @return 结果 50 | */ 51 | public int deleteJobLogByIds(Long[] logIds); 52 | 53 | /** 54 | * 删除任务日志 55 | * 56 | * @param jobId 调度日志ID 57 | * @return 结果 58 | */ 59 | public int deleteJobLogById(Long jobId); 60 | 61 | /** 62 | * 清空任务日志 63 | */ 64 | public void cleanJobLog(); 65 | } 66 | --------------------------------------------------------------------------------