diff --git a/.idea/$PRODUCT_WORKSPACE_FILE$ b/.idea/$PRODUCT_WORKSPACE_FILE$ new file mode 100644 index 0000000000000000000000000000000000000000..3733e0d369c0331583e53353e77299dc56783aab --- /dev/null +++ b/.idea/$PRODUCT_WORKSPACE_FILE$ @@ -0,0 +1,19 @@ + + + + + + + 1.8 + + + + + + + + \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..c4b8edeea898e715150df85ec3944a407a607415 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/workspace.xml + +# Editor-based HTTP Client requests +/httpRequests/ \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000000000000000000000000000000000000..1f24d38e0841b5d89ef59feee7b2f513c449d100 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000000000000000000000000000000000000..9e3836888fcd5bc68e3f40c3915ea869f0ce364b --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000000000000000000000000000000000000..6560a98983ec708cf9d8b5c5c3776d7bd39c475b --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,36 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..dc5eb4bc87513c71826285705b0d53df2c37a8ae --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/qaplug_profiles.xml b/.idea/qaplug_profiles.xml new file mode 100644 index 0000000000000000000000000000000000000000..3dfd21f3217524e575f32113c93bdd238a03c1bc --- /dev/null +++ b/.idea/qaplug_profiles.xml @@ -0,0 +1,465 @@ + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000000000000000000000000000000000000..e96534fb27b68192f27f985d3879e173ec77adb8 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..94a25f7f4cb416c083d265558da75d457237d671 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..00e879076a466e507f1ddc533d3e45ff5b1604d8 --- /dev/null +++ b/README.en.md @@ -0,0 +1,36 @@ +# IoT-Plat + +#### Description +物联网平台 + +#### Software Architecture +Software architecture description + +#### Installation + +1. xxxx +2. xxxx +3. xxxx + +#### Instructions + +1. xxxx +2. xxxx +3. xxxx + +#### Contribution + +1. Fork the repository +2. Create Feat_xxx branch +3. Commit your code +4. Create Pull Request + + +#### Gitee Feature + +1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md +2. Gitee blog [blog.gitee.com](https://blog.gitee.com) +3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) +4. The most valuable open source project [GVP](https://gitee.com/gvp) +5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) +6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..b06757519f4d88e37e5e803abbeba7333a2b4110 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# IoT-Monitor + +#### 介绍 +物联网平台-设备报警管理 + +#### 功能 +通过从activeMq获取异常报警信息,通过向用户邮箱发送异常报警邮件 + +【 +系统动态扩展多个邮件代理服务器,系统统计每个代理服务的投递成功率, +每次接收到异常报警信息时从可用的代理服务列表中选择成功率最高的那个, + +】 \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..dd6bcd60d60640fa71801cbdf7143480aa6f2e75 --- /dev/null +++ b/pom.xml @@ -0,0 +1,242 @@ + + + + 4.0.0 + + cn.ljobin.bibi + IoT-monitor + pom + 1.0-SNAPSHOT + + saltice-monitor-common + saltice-monitor-api + saltice-monitor-admin + saltice-monitor-iot + saltice-monitor-feign + + + IoT-monitor + + org.springframework.boot + spring-boot-starter-parent + 2.1.6.RELEASE + + + + 1.8 + UTF-8 + UTF-8 + 1.1.5 + 1.1.5 + Greenwich.RELEASE + 0.9.0.RELEASE + + + + + + + javax.mail + mail + 1.4.7 + + + + + org.springframework.boot + spring-boot-starter-mail + 2.1.0.M3 + + + + cn.stylefeng.roses + roses-system-api + 1.1.6 + + + + cn.stylefeng.roses + kernel-core + ${kernel.version} + + + cn.stylefeng.roses + kernel-jwt + ${kernel.version} + + + cn.stylefeng.roses + kernel-logger + ${kernel.version} + + + cn.stylefeng.roses + kernel-scanner + ${kernel.version} + + + cn.stylefeng.roses + kernel-validator + ${kernel.version} + + + cn.stylefeng.roses + kernel-model + ${kernel.version} + + + cn.stylefeng.roses + kernel-actuator + ${kernel.version} + + + cn.stylefeng.roses + kernel-logger + ${kernel.version} + + + + cn.stylefeng.roses + biz-support-dict + ${biz.version} + + + cn.stylefeng.roses + biz-support-file + ${biz.version} + + + cn.stylefeng.roses + biz-support-log + ${biz.version} + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + org.springframework.cloud + spring-cloud-alibaba-dependencies + ${spring-cloud-alibaba.version} + pom + import + + + + + + + + + + src/main/resources + true + + + src/main/java + + **/*.xml + + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + package + + jar + + + + + -Xdoclint:none + + + + + + + + + + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.1 + + true + + + + compile + + jar + + + + + + + + + + local + + local + + + true + + + + dev + + dev + + + + test + + test + + + + produce + + produce + + + + + + saltice + 2018214546@qq.com + + + + + + center + https://oss.sonatype.org/content/repositories/snapshots + + + center + https://oss.sonatype.org/service/local/staging/deploy/maven2 + + + diff --git a/saltice-monitor-admin/pom.xml b/saltice-monitor-admin/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..1cf431dbd8bd4c485f044167d58704f3fe5c19ad --- /dev/null +++ b/saltice-monitor-admin/pom.xml @@ -0,0 +1,117 @@ + + + + 4.0.0 + + cn.ljobin.bibi + saltice-monitor-admin + 1.0-SNAPSHOT + + + cn.ljobin.bibi + IoT-monitor + 1.0-SNAPSHOT + + + + UTF-8 + 1.8 + 1.8 + + + + + cn.stylefeng.roses + kernel-jwt + + + cn.stylefeng.roses + kernel-model + + + cn.stylefeng.roses + kernel-core + provided + + + cn.stylefeng.roses + kernel-logger + + + cn.ljobin.bibi + saltice-monitor-feign + 1.0-SNAPSHOT + + + cn.ljobin.bibi + saltice-monitor-api + 1.0-SNAPSHOT + + + cn.ljobin.bibi + saltice-monitor-common + 1.0-SNAPSHOT + + + cn.ljobin.bibi + saltice-monitor-iot + 1.0-SNAPSHOT + + + + org.springframework.boot + spring-boot-starter-web + + + + + + + + cn.stylefeng.roses + roses-system-api + + + org.springframework.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + org.springframework.cloud + spring-cloud-starter-alibaba-nacos-config + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + org.springframework.cloud + spring-cloud-starter-netflix-hystrix + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-resources-plugin + + + @ + + false + + + + + diff --git a/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/BibiApplication.java b/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/BibiApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..fbb18cb2da6eec92933dc903d0c0955ab4527e5d --- /dev/null +++ b/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/BibiApplication.java @@ -0,0 +1,58 @@ +package cn.ljobin.bibi; + +import cn.ljobin.bibi.domain.monitor.MonitorMessage; +import cn.ljobin.bibi.domain.monitor.enums.LinkInfoType; +import cn.ljobin.bibi.enums.MessageType; +import cn.ljobin.bibi.send.ActiveMqMessageSender; +import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; +import com.spring4all.swagger.EnableSwagger2Doc; +import org.mybatis.spring.annotation.MapperScan; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; + +/** + * @program: nettyTCP + * @description: + * @author: Mr.Liu + * @create: 2019-08-02 17:56 + **/ +/**如果有其它的包需要被扫描,就在下面添加**/ +/**cn.stylefeng.roses.kernel.logger.api是日志异步操作的**/ +@SpringBootApplication(scanBasePackages = {"cn.ljobin.bibi","cn.stylefeng.roses"},exclude = {DruidDataSourceAutoConfigure.class}) +/**开启定时器任务**/ +@EnableScheduling +@EnableFeignClients +@EnableDiscoveryClient +@MapperScan(basePackages = "cn.ljobin.bibi.mapper") +@EnableSwagger2Doc +public class BibiApplication { + @Autowired + private ActiveMqMessageSender sender; + //@Scheduled(fixedDelay = 3000) + public void schedule(){ + MonitorMessage monitorMessage = new MonitorMessage(); + monitorMessage.setClientId("123778"); + monitorMessage.setMessageType(MessageType.SUCCESS); + monitorMessage.setTitle("有小偷,快跑,测试。。。"); + monitorMessage.setLinkInfo("1337792659@qq.com"); + monitorMessage.setLinkInfoType(LinkInfoType.EMAIL); + monitorMessage.setType(LinkInfoType.EMAIL.getId()); + monitorMessage.setPloy("啦啦啦啦啦啦啦啦啦啦零零零零了"); + sender.sendMessage(monitorMessage); + } + private final static Logger logger = LoggerFactory.getLogger(BibiApplication.class); + public static ConfigurableApplicationContext applicationContext; + public static void main(String[] args) { + applicationContext = SpringApplication.run(BibiApplication.class, args); + logger.info("系统启动成功"); + } + +} diff --git a/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/config/QueueListenerConfig.java b/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/config/QueueListenerConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..4dcf4cf9ea8904747234784638aa5b2c080f61ce --- /dev/null +++ b/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/config/QueueListenerConfig.java @@ -0,0 +1,31 @@ +package cn.ljobin.bibi.config; +import cn.ljobin.bibi.enums.MessageQueueEnum; +import cn.ljobin.bibi.listener.MonitorMessageListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.jms.listener.DefaultMessageListenerContainer; + +import javax.jms.ConnectionFactory; + +/** + * 消息队列监听配置 + * + * @author fengshuonan + * @date 2018-05-06 13:11 + */ +@Configuration +public class QueueListenerConfig { + + @Autowired + private MonitorMessageListener monitorMessageListener; + + @Bean + public DefaultMessageListenerContainer messageListenerContainer(ConnectionFactory connectionFactory) { + DefaultMessageListenerContainer factory = new DefaultMessageListenerContainer(); + factory.setConnectionFactory(connectionFactory); + factory.setDestinationName(MessageQueueEnum.MAKE_MONITOR_MESSAGE.name()); + factory.setMessageListener(monitorMessageListener); + return factory; + } +} diff --git a/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/config/RedisConfig.java b/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/config/RedisConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..44825d092a86eedee758d2b20159d1316dad5f9e --- /dev/null +++ b/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/config/RedisConfig.java @@ -0,0 +1,177 @@ +package cn.ljobin.bibi.config; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; +import org.springframework.cache.annotation.CachingConfigurerSupport; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cache.interceptor.CacheErrorHandler; +import org.springframework.cache.interceptor.KeyGenerator; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.cache.RedisCacheManager; +import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.data.redis.serializer.StringRedisSerializer; +import redis.clients.jedis.JedisPool; +import redis.clients.jedis.JedisPoolConfig; + +/** + * @program: iot + * @description: redis配置类 + * @author: liuyanbin + * @create: 2019-05-08 16:50 + **/ + +@Configuration +/** 必须加,使配置生效**/ +@EnableCaching +/**下面这个注解是可以控制改配置类是否生效,name是配置的名称,havingValue是当对应的值为true时才生效**/ +@ConditionalOnProperty(name="spring.redis.isOpen", havingValue="true") +public class RedisConfig extends CachingConfigurerSupport { + /** + * Logger + */ + private static final Logger lg = LoggerFactory.getLogger(RedisConfig.class); + + + @Autowired + private JedisConnectionFactory jedisConnectionFactory; + + @Bean + @Override + public KeyGenerator keyGenerator() { + // 设置自动key的生成规则,配置spring boot的注解,进行方法级别的缓存 + // 使用:进行分割,可以很多显示出层级关系 + // 这里其实就是new了一个KeyGenerator对象,只是这是lambda表达式的写法,我感觉很好用,大家感兴趣可以去了解下 + return (target, method, params) -> { + StringBuilder sb = new StringBuilder(); + sb.append(target.getClass().getName()); + sb.append(":"); + sb.append(method.getName()); + for (Object obj : params) { + sb.append(":" + String.valueOf(obj)); + } + String rsToUse = String.valueOf(sb); + lg.info("自动生成Redis Key -> [{}]", rsToUse); + return rsToUse; + }; + } + + @Bean + @Override + public CacheManager cacheManager() { + // 初始化缓存管理器,在这里我们可以缓存的整体过期时间什么的,我这里默认没有配置 + lg.info("初始化 -> [{}]", "CacheManager RedisCacheManager Start"); + RedisCacheManager.RedisCacheManagerBuilder builder = RedisCacheManager + .RedisCacheManagerBuilder + .fromConnectionFactory(jedisConnectionFactory); + return builder.build(); + } + + @Bean + public RedisTemplate redisTemplate(JedisConnectionFactory jedisConnectionFactory ) { + //设置序列化 + Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class); + ObjectMapper om = new ObjectMapper(); + om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); + jackson2JsonRedisSerializer.setObjectMapper(om); + // 配置redisTemplate + RedisTemplate redisTemplate = new RedisTemplate(); + redisTemplate.setConnectionFactory(jedisConnectionFactory); + RedisSerializer stringSerializer = new StringRedisSerializer(); + redisTemplate.setKeySerializer(stringSerializer); // key序列化 + redisTemplate.setValueSerializer(jackson2JsonRedisSerializer); // value序列化 + redisTemplate.setHashKeySerializer(stringSerializer); // Hash key序列化 + redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer); // Hash value序列化 + redisTemplate.afterPropertiesSet(); + return redisTemplate; + } + + @Override + @Bean + public CacheErrorHandler errorHandler() { + // 异常处理,当Redis发生异常时,打印日志,但是程序正常走 + lg.info("初始化 -> [{}]", "Redis CacheErrorHandler"); + CacheErrorHandler cacheErrorHandler = new CacheErrorHandler() { + @Override + public void handleCacheGetError(RuntimeException e, Cache cache, Object key) { + lg.error("Redis occur handleCacheGetError:key -> [{}]", key, e); + } + + @Override + public void handleCachePutError(RuntimeException e, Cache cache, Object key, Object value) { + lg.error("Redis occur handleCachePutError:key -> [{}];value -> [{}]", key, value, e); + } + + @Override + public void handleCacheEvictError(RuntimeException e, Cache cache, Object key) { + lg.error("Redis occur handleCacheEvictError:key -> [{}]", key, e); + } + + @Override + public void handleCacheClearError(RuntimeException e, Cache cache) { + lg.error("Redis occur handleCacheClearError:", e); + } + }; + return cacheErrorHandler; + } + + /** + * 此内部类就是把yml的配置数据,进行读取,创建JedisConnectionFactory和JedisPool,以供外部类初始化缓存管理器使用 + * 不了解的同学可以去看@ConfigurationProperties和@Value的作用 + * + */ + @ConfigurationProperties + class DataJedisProperties{ + + @Value("${spring.redis.database}") + private int database; + @Value("${spring.redis.host}") + private String host; + @Value("${spring.redis.password}") + private String password; + @Value("${spring.redis.port}") + private int port; + @Value("${spring.redis.timeout}") + private int timeout; + @Value("${spring.redis.jedis.pool.max-idle}") + private int maxIdle; + @Value("${spring.redis.jedis.pool.max-wait}") + private long maxWaitMillis; + + @Bean + JedisConnectionFactory jedisConnectionFactory() { + lg.info("Create JedisConnectionFactory successful"); + JedisConnectionFactory factory = new JedisConnectionFactory(); + factory.setHostName(host); + factory.setPort(port); + factory.setTimeout(timeout); + factory.setPassword(password); + factory.setDatabase(database); + return factory; + } + @Bean + public JedisPool redisPoolFactory() { + lg.info("JedisPool init successful,host -> [{}];port -> [{}]", host, port); + JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); + jedisPoolConfig.setMaxIdle(maxIdle); + jedisPoolConfig.setMaxWaitMillis(maxWaitMillis); + + JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout, password,database); + return jedisPool; + } + } + +} diff --git a/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/config/UserUtils.java b/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/config/UserUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..3471f774f0ba47059167ab6ed7a8dbdaa1e883ff --- /dev/null +++ b/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/config/UserUtils.java @@ -0,0 +1,31 @@ +package cn.ljobin.bibi.config; + +import cn.stylefeng.roses.core.util.HttpContext; +import cn.stylefeng.roses.system.utils.AccountUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; + +/** + * @program: IoT-Plat + * @description: 用户相关操作 + * @author: Mr.Liu + * @create: 2020-05-07 16:43 + **/ +@Component +public class UserUtils { + @Autowired + private AccountUtils accountUtils; + + /** + * 获得用户id,从token里面 + * @param request + * @return + */ + public Long getUid(HttpServletRequest request) { + String token = HttpContext.getTokenFromRequest(request); + //方法三 + return accountUtils.getAccount(token); + } +} diff --git a/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/listener/MonitorMessageListener.java b/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/listener/MonitorMessageListener.java new file mode 100644 index 0000000000000000000000000000000000000000..7bab698650f7a5123cc451251e0dd6564fb28a4d --- /dev/null +++ b/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/listener/MonitorMessageListener.java @@ -0,0 +1,56 @@ +package cn.ljobin.bibi.listener; + +import cn.ljobin.bibi.domain.monitor.MonitorMessage; +import cn.ljobin.bibi.enums.execption.MessageExceptionEnum; +import cn.ljobin.bibi.service.IEmailService; +import cn.ljobin.bibi.service.IMonitorMessageService; +import cn.ljobin.bibi.service.Impl.MonitorMessageServiceImpl; +import cn.stylefeng.roses.core.util.ToolUtil; +import cn.stylefeng.roses.kernel.model.exception.ServiceException; +import com.alibaba.fastjson.JSON; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageListener; +import javax.jms.TextMessage; + +/** + * @program: Iot-Monitor + * @description: activeMq消费者 + * @author: Mr.Liu + * @create: 2020-06-02 14:51 + **/ +@Component +@Slf4j +public class MonitorMessageListener implements MessageListener { + @Autowired + private IMonitorMessageService monitorMessageService; + @Autowired + private IEmailService iEmailService; + @Override + public void onMessage(Message message) { + if (message instanceof TextMessage) { + try { + String messageBody = ((TextMessage) message).getText(); + if (ToolUtil.isEmpty(messageBody)) { + throw new ServiceException(MessageExceptionEnum.MESSAGE_BODY_CANT_EMPTY); + } + MonitorMessage flowParam = JSON.parseObject(messageBody, MonitorMessage.class); + log.info(flowParam.toString()); + flowParam.setId(null); + if(monitorMessageService.save(flowParam)){ + iEmailService.recodeMonitorMsg(flowParam); + }else { + throw new ServiceException(MessageExceptionEnum.MESSAGE_QUEUE_SAVE_ERROR); + } + } catch (JMSException ex) { + throw new ServiceException(MessageExceptionEnum.MESSAGE_QUEUE_ERROR); + } + } else { + throw new ServiceException(MessageExceptionEnum.MESSAGE_TYPE_ERROR); + } + } +} diff --git a/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/send/ActiveMqMessageSender.java b/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/send/ActiveMqMessageSender.java new file mode 100644 index 0000000000000000000000000000000000000000..4731621d03cf4656945f7b19373d3b3f6e88dd09 --- /dev/null +++ b/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/send/ActiveMqMessageSender.java @@ -0,0 +1,43 @@ +package cn.ljobin.bibi.send; + +import cn.ljobin.bibi.domain.monitor.MonitorMessage; +import cn.ljobin.bibi.enums.MessageQueueEnum; +import com.alibaba.fastjson.JSON; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.jms.JmsProperties; +import org.springframework.jms.core.JmsTemplate; +import org.springframework.jms.core.MessageCreator; +import org.springframework.stereotype.Component; + +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.Session; + +/** + * activemq实现的消息发送器 + * + * @author fengshuonan + * @date 2018-04-22 22:03 + */ +@Component +public class ActiveMqMessageSender { + + @Autowired + private JmsTemplate jmsTemplate; + + public void sendMessage(MonitorMessage reliableMessage) { + + jmsTemplate.setDefaultDestinationName(MessageQueueEnum.MAKE_MONITOR_MESSAGE.name()); + + //设置ack确认为client方式 + jmsTemplate.setSessionAcknowledgeMode(JmsProperties.AcknowledgeMode.CLIENT.getMode()); + + //发送消息 + jmsTemplate.send(new MessageCreator() { + @Override + public Message createMessage(Session session) throws JMSException { + return session.createTextMessage(JSON.toJSONString(reliableMessage)); + } + }); + } +} diff --git a/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/system/controller/StubController.java b/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/system/controller/StubController.java new file mode 100644 index 0000000000000000000000000000000000000000..390cbb848b59e3e23827b351241fe4e42d7dffaf --- /dev/null +++ b/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/system/controller/StubController.java @@ -0,0 +1,148 @@ +package cn.ljobin.bibi.system.controller; + +import cn.ljobin.bibi.domain.monitor.MonitorMessage; +import cn.ljobin.bibi.domain.monitor.enums.LinkInfoType; +import cn.ljobin.bibi.enums.MessageType; +import cn.ljobin.bibi.enums.execption.MessageExceptionEnum; +import cn.ljobin.bibi.service.IMonitorMessageService; +import cn.ljobin.bibi.stub.StubFactory; +import cn.ljobin.bibi.utils.email.BaseMailSend; +import cn.stylefeng.roses.core.reqres.response.ResponseData; +import cn.stylefeng.roses.kernel.model.exception.ServiceException; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; + +/** + * @program: Iot-Monitor + * @description: + * @author: Mr.Liu + * @create: 2020-06-06 23:50 + **/ +@RestController +@Slf4j +@RequestMapping("/stub") +public class StubController { + private static HashMap obj = new HashMap<>(); + @Autowired + private StubFactory stubFactory; + @Autowired + private IMonitorMessageService monitorMessageService; + @GetMapping("/add") + public String addStub(@RequestParam("className") String className){ + String imports = "import cn.ljobin.bibi.domain.monitor.MonitorMessage;\n" + + "import cn.ljobin.bibi.enums.MessageType;\n" + + "import cn.ljobin.bibi.utils.email.BaseMailSend;\n" + + "import lombok.extern.slf4j.Slf4j;\n" + + "import org.apache.commons.lang3.time.DateFormatUtils;\n" + + "import org.slf4j.Logger;\n" + + "import org.slf4j.LoggerFactory;\n" + + "import org.springframework.core.io.ClassPathResource;\n" + + "import org.springframework.mail.javamail.JavaMailSenderImpl;\n" + + "import org.springframework.mail.javamail.MimeMessageHelper;\n" + + "import org.springframework.stereotype.Service;\n" + + "import javax.mail.MessagingException;\n" + + "import javax.mail.internet.MimeMessage;\n" + + "import java.io.BufferedReader;\n" + + "import java.io.IOException;\n" + + "import java.io.InputStream;\n" + + "import java.io.InputStreamReader;\n" + + "import java.text.MessageFormat;\n" + + "import java.util.Date;\n" + + "import java.util.Objects;\n" + + "import java.util.Properties;\n" + + "import java.io.IOException;\n" + + "import java.util.concurrent.Executors;\n" + + "import java.util.concurrent.LinkedBlockingQueue;\n" + + "import java.util.concurrent.ScheduledExecutorService;\n" + + "import java.util.concurrent.TimeUnit;\n"; + String statics="javaMailSender = new JavaMailSenderImpl();\n" + + " javaMailSender.setUsername(sendUserEmail);\n" + + " javaMailSender.setPassword(qqPassword);\n" + + " javaMailSender.setHost(\"smtp.qq.com\");\n" + + " javaMailSender.setPort(587);\n" + + " javaMailSender.setDefaultEncoding(\"UTF-8\");\n" + + " Properties props = new Properties();\n" + + " props.setProperty(\"mail.smtp.host\", \"smtp.qq.com\");\n" + + " props.setProperty(\"mail.transport.protocol\", \"smtp\");\n" + + " props.setProperty(\"mail.smtp.auth\", \"true\");\n" + + " props.setProperty(\"mail.smtp.connectiontimeout\", \"20000\");\n" + + " props.setProperty(\"mail.smtp.timeout\", \"20000\");\n" + + " javaMailSender.setJavaMailProperties(props);\n"; + String param="private static JavaMailSenderImpl javaMailSender;\n"; + String methodContent= "MimeMessage message = javaMailSender.createMimeMessage();\n" + + " MimeMessageHelper helper = null;\n" + + " try {\n" + + " helper = new MimeMessageHelper(message, true, \"UTF-8\");\n" + + " helper.setTo(new String[]{linkInfo});\n" + + " helper.setFrom(sendUserEmail);\n" + + " helper.setSubject(title);\n" + + " helper.setText(buildContent(title,content,type), true);\n" + + " String alarmIconName = \"success-alarm.png\";\n" + + " ClassPathResource img = new ClassPathResource(alarmIconName);\n" + + " helper.addInline(\"icon-alarm\", img);\n" + + " javaMailSender.send(message);\n" + + " } catch (MessagingException | IOException e) {\n" + + " e.printStackTrace();\n" + + " }\n" ; + try { + if(obj.get(className+"Stub")!=null){ + log.info("内存中已经有改实例"); + return "false"; + } + BaseMailSend s = stubFactory.createStub(imports,className,param,statics,methodContent); + obj.put(className+"Stub",s); + log.info("添加实例成功"); + return "true"; + } catch (Exception e) { + log.error("添加实例失败,{},{},{},{}",imports,className,param,methodContent); + e.printStackTrace(); + return "false"; + } + } + @PostMapping("/add2") + public ResponseData addStub2(@RequestParam("className") String className, + @RequestParam("imports") String imports, + @RequestParam("statics") String statics, + @RequestParam("param") String param, + @RequestParam("methodContent") String methodContent){ + try { + if(obj.get(className+"Stub")!=null){ + log.info("内存中已经有该实例"); + return ResponseData.success("内存中已经有该实例"); + } + BaseMailSend s = stubFactory.createStub(imports,className,param,statics,methodContent); + obj.put(className+"Stub",s); + log.info("添加实例成功"); + return ResponseData.success("添加实例成功"); + } catch (Exception e) { + log.error("添加实例失败,{},{},{},{}",imports,className,param,methodContent); + e.printStackTrace(); + return ResponseData.error("添加实例失败"); + } + } + @GetMapping("/send") + public ResponseData send(@RequestParam("className") String className){ + if(obj.get(className+"Stub")==null){ + log.info("内存中没有该实例"); + return ResponseData.success("内存中没有该实例"); + } + MonitorMessage monitorMessage = new MonitorMessage(); + monitorMessage.setClientId("123778"); + monitorMessage.setMessageType(MessageType.SUCCESS); + monitorMessage.setTitle("有小偷,快跑,测试。。。"); + monitorMessage.setLinkInfo("1337792659@qq.com"); + monitorMessage.setLinkInfoType(LinkInfoType.EMAIL); + monitorMessage.setType(LinkInfoType.EMAIL.getId()); + monitorMessage.setPloy("小屁孩"); + if(monitorMessageService.save(monitorMessage)){ + obj.get(className+"Stub").sendEmail(monitorMessage); + return ResponseData.success("发送成功"); + }else { + return ResponseData.error("发送失败"); + } + } +} diff --git a/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/system/provider/MonitorDataProvider.java b/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/system/provider/MonitorDataProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..7c465c9c7f3fe608726891537134d392b8f4e8d9 --- /dev/null +++ b/saltice-monitor-admin/src/main/java/cn/ljobin/bibi/system/provider/MonitorDataProvider.java @@ -0,0 +1,24 @@ +package cn.ljobin.bibi.system.provider; + +import cn.ljobin.bibi.api.MonitorApi; +import cn.ljobin.bibi.domain.monitor.MonitorMessage; +import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RestController; + +/** + * @program: IoT-SC + * @description: + * @author: Mr.Liu + * @create: 2020-04-11 15:28 + **/ +@RestController +@Slf4j +@Api("报警api") +public class MonitorDataProvider implements MonitorApi { + + @Override + public boolean callPolice(MonitorMessage monitorMessage) { + return false; + } +} diff --git a/saltice-monitor-admin/src/main/resources/application.ymll b/saltice-monitor-admin/src/main/resources/application.ymll new file mode 100644 index 0000000000000000000000000000000000000000..cc8e0dcecbe1dcb7a433992756d74f3291349f9e --- /dev/null +++ b/saltice-monitor-admin/src/main/resources/application.ymll @@ -0,0 +1,192 @@ +server: + port: 5054 +jwt: + secret: u47REBDLrxfd79w2 + #24*7*60*60 + expiration: 604800 +#Swagger配置 +swagger: + #Swagger生成文档扫描包的范围 + base-package: cn.ljobin.bibi.system.provider + +## kafka日志收集配置 +saltice: + #生产者配置,开启 + producer: + log: + kafka: true + ##线程数 + nTreads: 10 + ## + #消费者配置 , 开启 + consumer: + log: + kafka: false + +kafka: + consumer: + enable-auto-commit: true + group-id: MonitorGroup + auto-commit-interval: 1000 + auto-offset-reset: latest + bootstrap-servers: "10.112.26.129:9092" + key-deserializer: org.apache.kafka.common.serialization.StringDeserializer + value-deserializer: org.apache.kafka.common.serialization.ByteArrayDeserializer + concurrency: 3 +mybatis-plus: + ##typeAliasesPackage: cn.ljobin.bibi.domain.pot + ##下面必须使用classpath*,以为classpath*:会扫描使用的JAR包及类路径下出现的同名文件 + ##而classpath:只会在第一个加载的类路径下查找 + ## 特别是多模块的,一定要注意,使用classpath*: + mapper-locations: classpath*:cn/ljobin/bibi/**/*.xml + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + #刷新mapper,调试神器 + refresh: true +spring: + kafka: + producer: + bootstrap-servers: 10.112.26.129:9092 + batch-size: 16384 + retries: 0 + buffer-memory: 33554432 + key-serializer: org.apache.kafka.common.serialization.StringSerializer + value-serializer: org.apache.kafka.common.serialization.ByteArraySerializer + application: + name: saltice-monitor + datasource: + druid: + stat-view-servlet: + loginUsername: admin + loginPassword: 123456 + dynamic: + primary: master + druid: #以下是全局默认值,可以全局更改 + minIdle: 5 + maxActive: 20 + filters: stat # 注意这个值和druid原生不一致,默认启动了stat,wall [wall,这个会影响多条sql一起执行] + stat: + merge-sql: true + log-slow-sql: true + datasource: + master: + username: root + password: root + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://47.103.1.210:3306/saltice-monitor?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=UTC&allowMultiQueries=true + slave1: + username: root + password: root + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1:3306/saltice_pot?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=UTC&allowMultiQueries=true + initial-size: 10 # 以下是连接池配置 + max-active: 100 + min-idle: 10 + max-wait: 60000 + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + #validation-query: SELECT 1 + test-while-idle: true + test-on-borrow: false + test-on-return: false + stat-view-servlet: + enabled: true + url-pattern: /druid/* + login-username: druid + login-password: 123456 + filter: + stat: + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: false + wall: + config: + multi-statement-allow: true + #type: com.alibaba.druid.pool.DruidDataSource + #datasource: + #url: jdbc:mysql://127.0.0.1:3306/iotdata?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=UTC + #username: root + #password: root + cloud: + nacos: + discovery: + # 服务注册中心 + server-addr: 47.103.1.210:8848 + # 当由eureka切换到nacos时,可能会出现两个注册中心,影响项目运行,可以通过下面解决,或者暴力输出eureka的依赖 + # 下面是当出现了两个注册中心:eureka和nacos,这样是直接用naoso的,直接忽略eureka + # autoconfigure: + # exclude: org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration + redis: + isOpen: true + ###redis数据库索引(默认为0) + database: 5 + host: 47.103.1.210 + port: 6379 + password: ltbo99lyb + jedis: + pool: + ###连接池最大连接数(负数代表没有限制) + max-active: 8 + ###连接池最大阻塞等待时间(负数代表没有限制) + max-wait: -1 + ###连接池中的最大空间连接 + max-idle: 5 + ###连接池中的最小空闲连接 + min-idle: 0 + ###连接超时时间(毫秒) + timeout: 10000 + +feign: + hystrix: + enabled: true + # sentinel: + # ##feign开启sentinel + # enabled: true + #开启Feign请求压缩 + compression: + request: + enabled: true + mime-types: text/xml,application/xml,application/json + min-request-size: 2048 + response: + enabled: true + #feign 使用 okhttp + httpclient: + enabled: false + max-connections: 200 # 默认值 + max-connections-per-route: 50 # 默认值 + okhttp: + enabled: true + max-connections: 200 # 默认值 + max-connections-per-route: 50 # 默认值 + client: + config: + default: + connectTimeout: 3000 #创建连接的超时时间 单位:毫秒 + readTimeout: 3000 #处理请求的超时时间 单位:毫秒 + errorDecoder: cn.stylefeng.roses.core.feign.RosesFeignErrorDecoder +hystrix: + command: + default: + execution: + isolation: + strategy: SEMAPHORE + thread: + timeoutInMilliseconds: 4000 + semaphore: + maxConcurrentRequests: 500 +###设置feign客户端超时时间 +ribbon: + ###指的是建立连接所用的时间,适用于网络状况正常的情况下,两端连接所用的时间。 + ReadTimeout: 3000 + ###指的是建立连接后从服务器读取到可用资源所用的时间。 + ConnectTimeout: 3000 + +management: + #端点检查(健康检查) + endpoints: + web: + exposure: + include: "*" \ No newline at end of file diff --git a/saltice-monitor-admin/src/main/resources/banner.txt b/saltice-monitor-admin/src/main/resources/banner.txt new file mode 100644 index 0000000000000000000000000000000000000000..cff4b0ce70fde3c884a8b56161f68164cc63ea43 --- /dev/null +++ b/saltice-monitor-admin/src/main/resources/banner.txt @@ -0,0 +1,6 @@ + .__ __ .__ .__ __ + ___________ | |_/ |_|__| ____ ____ _____ ____ ____ |__|/ |_ ___________ + / ___/\__ \ | |\ __\ |/ ___\/ __ \ ______ / \ / _ \ / \| \ __\/ _ \_ __ \ + \___ \ / __ \| |_| | | \ \__\ ___/ /_____/ | Y Y ( <_> ) | \ || | ( <_> ) | \/ +/____ >(____ /____/__| |__|\___ >___ > |__|_| /\____/|___| /__||__| \____/|__| + \/ \/ \/ \/ \/ \/ \ No newline at end of file diff --git a/saltice-monitor-admin/src/main/resources/bootstrap.properties b/saltice-monitor-admin/src/main/resources/bootstrap.properties new file mode 100644 index 0000000000000000000000000000000000000000..76ae977ae2d13a6b8efef4e4556c6dbe4b82da75 --- /dev/null +++ b/saltice-monitor-admin/src/main/resources/bootstrap.properties @@ -0,0 +1,37 @@ +spring.application.name=saltice-monitor +#spring.cloud.nacos.config.server-addr=192.168.1.2:8848 +spring.cloud.nacos.config.server-addr=47.103.1.210:8848 +spring.cloud.nacos.config.file-extension=yml +##໷õģͨļк-localж,ûǶδĬϵģû -localroses-gateway-local-config.yml +##ideaʱѡĻͨ RUN --> Edit Configuration --> Active profiles Ϊ local +##Ӧʱͨ java -jar 1.0.0-SNAPSHOT.jar --spring.profiles.active=local +#spring.profiles.active=local +spring.main.allow-bean-definition-overriding=true +#nacosֻӡ־ +logging.level.com.alibaba.nacos.client.naming=error +#Dzmybatis-plusԼɵidΪݿidֶεֵҪidֶ͸Ϊlong, ܱ֤㹻λɵid +# ָʾݿidֶǵģÿԼ +#ʵ @TableId(value = "id",type = IdType.AUTO) ҲԣͲҪ +#typeͽ + # AUTO : AUTO(0, ݿID), + # INPUT : INPUT(1, ûID), + # ID_WORKER : ID_WORKER(2, ȫΨһID), + # UUID : UUID(3, ȫΨһID), + # NONE : NONE(4, Ϊδ͡), + # ID_WORKER_STR : ID_WORKER_STR(5, ַȫΨһID); +#mybatis-plus.global-config.db-config.id-type=auto + +#java -Dfile.encoding=utf-8 -jar xxx.jar + +######################## activemq\u9ED8\u8BA4\u914D\u7F6E ######################## +spring.activemq.broker-url=tcp://localhost:61616 +## dockerеĵַ +# spring.activemq.broker-url=tcp://10.112.26.129:61616 +#http://localhost:8161(˿) +#tcp://127.0.0.1:61616(˿) +spring.activemq.in-memory=true +spring.activemq.pool.enabled=false +spring.activemq.pool.idle-timeout=30000 +spring.activemq.user=admin +spring.activemq.password=admin +spring.jms.listener.acknowledge-mode=client \ No newline at end of file diff --git a/saltice-monitor-admin/src/main/resources/pod-scale-alarm.html b/saltice-monitor-admin/src/main/resources/pod-scale-alarm.html new file mode 100644 index 0000000000000000000000000000000000000000..7bf1cd9c65c9053857e6bb9ad99470ad4fa445b4 --- /dev/null +++ b/saltice-monitor-admin/src/main/resources/pod-scale-alarm.html @@ -0,0 +1,43 @@ + +
+
+ Confidential - Scale Alarm Use Only +
+
+ +
物联网设备监控{0}通知
+
+
+
+

内容:

+

{2}

+
+
{3}
+
+ + + + {4} + + + + {5} + +
+
+
+ diff --git a/saltice-monitor-admin/src/main/resources/success-alarm.png b/saltice-monitor-admin/src/main/resources/success-alarm.png new file mode 100644 index 0000000000000000000000000000000000000000..7ac3c7a51a10eba3dd7d38c539d4dbfcf48ff90f Binary files /dev/null and b/saltice-monitor-admin/src/main/resources/success-alarm.png differ diff --git a/saltice-monitor-admin/target/classes/application.ymll b/saltice-monitor-admin/target/classes/application.ymll new file mode 100644 index 0000000000000000000000000000000000000000..cc8e0dcecbe1dcb7a433992756d74f3291349f9e --- /dev/null +++ b/saltice-monitor-admin/target/classes/application.ymll @@ -0,0 +1,192 @@ +server: + port: 5054 +jwt: + secret: u47REBDLrxfd79w2 + #24*7*60*60 + expiration: 604800 +#Swagger配置 +swagger: + #Swagger生成文档扫描包的范围 + base-package: cn.ljobin.bibi.system.provider + +## kafka日志收集配置 +saltice: + #生产者配置,开启 + producer: + log: + kafka: true + ##线程数 + nTreads: 10 + ## + #消费者配置 , 开启 + consumer: + log: + kafka: false + +kafka: + consumer: + enable-auto-commit: true + group-id: MonitorGroup + auto-commit-interval: 1000 + auto-offset-reset: latest + bootstrap-servers: "10.112.26.129:9092" + key-deserializer: org.apache.kafka.common.serialization.StringDeserializer + value-deserializer: org.apache.kafka.common.serialization.ByteArrayDeserializer + concurrency: 3 +mybatis-plus: + ##typeAliasesPackage: cn.ljobin.bibi.domain.pot + ##下面必须使用classpath*,以为classpath*:会扫描使用的JAR包及类路径下出现的同名文件 + ##而classpath:只会在第一个加载的类路径下查找 + ## 特别是多模块的,一定要注意,使用classpath*: + mapper-locations: classpath*:cn/ljobin/bibi/**/*.xml + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + #刷新mapper,调试神器 + refresh: true +spring: + kafka: + producer: + bootstrap-servers: 10.112.26.129:9092 + batch-size: 16384 + retries: 0 + buffer-memory: 33554432 + key-serializer: org.apache.kafka.common.serialization.StringSerializer + value-serializer: org.apache.kafka.common.serialization.ByteArraySerializer + application: + name: saltice-monitor + datasource: + druid: + stat-view-servlet: + loginUsername: admin + loginPassword: 123456 + dynamic: + primary: master + druid: #以下是全局默认值,可以全局更改 + minIdle: 5 + maxActive: 20 + filters: stat # 注意这个值和druid原生不一致,默认启动了stat,wall [wall,这个会影响多条sql一起执行] + stat: + merge-sql: true + log-slow-sql: true + datasource: + master: + username: root + password: root + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://47.103.1.210:3306/saltice-monitor?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=UTC&allowMultiQueries=true + slave1: + username: root + password: root + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1:3306/saltice_pot?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=UTC&allowMultiQueries=true + initial-size: 10 # 以下是连接池配置 + max-active: 100 + min-idle: 10 + max-wait: 60000 + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + #validation-query: SELECT 1 + test-while-idle: true + test-on-borrow: false + test-on-return: false + stat-view-servlet: + enabled: true + url-pattern: /druid/* + login-username: druid + login-password: 123456 + filter: + stat: + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: false + wall: + config: + multi-statement-allow: true + #type: com.alibaba.druid.pool.DruidDataSource + #datasource: + #url: jdbc:mysql://127.0.0.1:3306/iotdata?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=UTC + #username: root + #password: root + cloud: + nacos: + discovery: + # 服务注册中心 + server-addr: 47.103.1.210:8848 + # 当由eureka切换到nacos时,可能会出现两个注册中心,影响项目运行,可以通过下面解决,或者暴力输出eureka的依赖 + # 下面是当出现了两个注册中心:eureka和nacos,这样是直接用naoso的,直接忽略eureka + # autoconfigure: + # exclude: org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration + redis: + isOpen: true + ###redis数据库索引(默认为0) + database: 5 + host: 47.103.1.210 + port: 6379 + password: ltbo99lyb + jedis: + pool: + ###连接池最大连接数(负数代表没有限制) + max-active: 8 + ###连接池最大阻塞等待时间(负数代表没有限制) + max-wait: -1 + ###连接池中的最大空间连接 + max-idle: 5 + ###连接池中的最小空闲连接 + min-idle: 0 + ###连接超时时间(毫秒) + timeout: 10000 + +feign: + hystrix: + enabled: true + # sentinel: + # ##feign开启sentinel + # enabled: true + #开启Feign请求压缩 + compression: + request: + enabled: true + mime-types: text/xml,application/xml,application/json + min-request-size: 2048 + response: + enabled: true + #feign 使用 okhttp + httpclient: + enabled: false + max-connections: 200 # 默认值 + max-connections-per-route: 50 # 默认值 + okhttp: + enabled: true + max-connections: 200 # 默认值 + max-connections-per-route: 50 # 默认值 + client: + config: + default: + connectTimeout: 3000 #创建连接的超时时间 单位:毫秒 + readTimeout: 3000 #处理请求的超时时间 单位:毫秒 + errorDecoder: cn.stylefeng.roses.core.feign.RosesFeignErrorDecoder +hystrix: + command: + default: + execution: + isolation: + strategy: SEMAPHORE + thread: + timeoutInMilliseconds: 4000 + semaphore: + maxConcurrentRequests: 500 +###设置feign客户端超时时间 +ribbon: + ###指的是建立连接所用的时间,适用于网络状况正常的情况下,两端连接所用的时间。 + ReadTimeout: 3000 + ###指的是建立连接后从服务器读取到可用资源所用的时间。 + ConnectTimeout: 3000 + +management: + #端点检查(健康检查) + endpoints: + web: + exposure: + include: "*" \ No newline at end of file diff --git a/saltice-monitor-admin/target/classes/banner.txt b/saltice-monitor-admin/target/classes/banner.txt new file mode 100644 index 0000000000000000000000000000000000000000..cff4b0ce70fde3c884a8b56161f68164cc63ea43 --- /dev/null +++ b/saltice-monitor-admin/target/classes/banner.txt @@ -0,0 +1,6 @@ + .__ __ .__ .__ __ + ___________ | |_/ |_|__| ____ ____ _____ ____ ____ |__|/ |_ ___________ + / ___/\__ \ | |\ __\ |/ ___\/ __ \ ______ / \ / _ \ / \| \ __\/ _ \_ __ \ + \___ \ / __ \| |_| | | \ \__\ ___/ /_____/ | Y Y ( <_> ) | \ || | ( <_> ) | \/ +/____ >(____ /____/__| |__|\___ >___ > |__|_| /\____/|___| /__||__| \____/|__| + \/ \/ \/ \/ \/ \/ \ No newline at end of file diff --git a/saltice-monitor-admin/target/classes/bootstrap.properties b/saltice-monitor-admin/target/classes/bootstrap.properties new file mode 100644 index 0000000000000000000000000000000000000000..cb4afa5a9f89f7ebeb59f61dc6a8c533b86d6763 --- /dev/null +++ b/saltice-monitor-admin/target/classes/bootstrap.properties @@ -0,0 +1,37 @@ +spring.application.name=saltice-monitor +#spring.cloud.nacos.config.server-addr=192.168.1.2:8848 +spring.cloud.nacos.config.server-addr=47.103.1.210:8848 +spring.cloud.nacos.config.file-extension=yml +##�໷�������õģ�ͨ���ļ������к����-local���ж�,û�������Ƕδ�������Ĭ�ϵģ�����û�� -local��roses-gateway-local-config.yml +##idea����ʱѡ��Ļ�����ͨ�� RUN --> Edit Configuration --> Active profiles ����Ϊ local +##Ӧ������ʱ��ͨ�� java -jar 1.0.0-SNAPSHOT.jar --spring.profiles.active=local +#spring.profiles.active=local +spring.main.allow-bean-definition-overriding=true +#����nacos���ֻ��ӡ������־ +logging.level.com.alibaba.nacos.client.naming=error +#�����Dz�����mybatis-plus�Լ����ɵ�id��Ϊ���ݿ���id�ֶε�ֵ������Ҫ��id�ֶ����͸�Ϊlong, �������ܱ�֤���㹻λ���������ɵ�id�� +# ������ָʾ���ݿ�id�ֶ��ǵ����ģ����ÿ���Լ����� +#������ʵ������������������ @TableId(value = "id",type = IdType.AUTO) Ҳ���ԣ��Ͳ�Ҫ������� +#����type���ͽ��� + # AUTO : AUTO(0, �����ݿ�ID������), + # INPUT : INPUT(1, ���û�����ID��), + # ID_WORKER : ID_WORKER(2, ��ȫ��ΨһID��), + # UUID : UUID(3, ��ȫ��ΨһID��), + # NONE : NONE(4, ��������Ϊδ�����������͡�), + # ID_WORKER_STR : ID_WORKER_STR(5, ���ַ���ȫ��ΨһID��); +#mybatis-plus.global-config.db-config.id-type=auto + +#java -Dfile.encoding=utf-8 -jar xxx.jar + +######################## activemq\u9ED8\u8BA4\u914D\u7F6E ######################## +spring.activemq.broker-url=tcp://localhost:61616 +## �������������docker�еĵ�ַ +# spring.activemq.broker-url=tcp://10.112.26.129:61616 +#http://localhost:8161(����˿�) +#tcp://127.0.0.1:61616(����˿�) +spring.activemq.in-memory=true +spring.activemq.pool.enabled=false +spring.activemq.pool.idle-timeout=30000 +spring.activemq.user=admin +spring.activemq.password=admin +spring.jms.listener.acknowledge-mode=client \ No newline at end of file diff --git a/saltice-monitor-admin/target/classes/cn/ljobin/bibi/BibiApplication.class b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/BibiApplication.class new file mode 100644 index 0000000000000000000000000000000000000000..cec1b52789abb5654309de62267987c24a30d286 Binary files /dev/null and b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/BibiApplication.class differ diff --git a/saltice-monitor-admin/target/classes/cn/ljobin/bibi/config/QueueListenerConfig.class b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/config/QueueListenerConfig.class new file mode 100644 index 0000000000000000000000000000000000000000..48989d7f169d68ff3a5751b310cb35a5699d566e Binary files /dev/null and b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/config/QueueListenerConfig.class differ diff --git a/saltice-monitor-admin/target/classes/cn/ljobin/bibi/config/RedisConfig$1.class b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/config/RedisConfig$1.class new file mode 100644 index 0000000000000000000000000000000000000000..faf69314be0ded286e7216928ba4dc074ce572f8 Binary files /dev/null and b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/config/RedisConfig$1.class differ diff --git a/saltice-monitor-admin/target/classes/cn/ljobin/bibi/config/RedisConfig$DataJedisProperties.class b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/config/RedisConfig$DataJedisProperties.class new file mode 100644 index 0000000000000000000000000000000000000000..a1dd2c0cb713bca1bde51adfc81810cae46dcb83 Binary files /dev/null and b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/config/RedisConfig$DataJedisProperties.class differ diff --git a/saltice-monitor-admin/target/classes/cn/ljobin/bibi/config/RedisConfig.class b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/config/RedisConfig.class new file mode 100644 index 0000000000000000000000000000000000000000..8c875cc56607ffe90d0cde706008905f08c8ef1d Binary files /dev/null and b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/config/RedisConfig.class differ diff --git a/saltice-monitor-admin/target/classes/cn/ljobin/bibi/config/UserUtils.class b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/config/UserUtils.class new file mode 100644 index 0000000000000000000000000000000000000000..40a2919547e7b37b20e66bbc0b4e3fb359ce2341 Binary files /dev/null and b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/config/UserUtils.class differ diff --git a/saltice-monitor-admin/target/classes/cn/ljobin/bibi/listener/MonitorMessageListener.class b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/listener/MonitorMessageListener.class new file mode 100644 index 0000000000000000000000000000000000000000..f71cd4aa475a2e474d1526c5fcc1d3ba4a2b563e Binary files /dev/null and b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/listener/MonitorMessageListener.class differ diff --git a/saltice-monitor-admin/target/classes/cn/ljobin/bibi/send/ActiveMqMessageSender$1.class b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/send/ActiveMqMessageSender$1.class new file mode 100644 index 0000000000000000000000000000000000000000..08acb1f9dc5d733698b2a4e56dbfeb947d4b5e4d Binary files /dev/null and b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/send/ActiveMqMessageSender$1.class differ diff --git a/saltice-monitor-admin/target/classes/cn/ljobin/bibi/send/ActiveMqMessageSender.class b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/send/ActiveMqMessageSender.class new file mode 100644 index 0000000000000000000000000000000000000000..1d1b7c2de4ec3fde4d9f0993388bf17f41e36bfd Binary files /dev/null and b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/send/ActiveMqMessageSender.class differ diff --git a/saltice-monitor-admin/target/classes/cn/ljobin/bibi/system/provider/MonitorDataProvider.class b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/system/provider/MonitorDataProvider.class new file mode 100644 index 0000000000000000000000000000000000000000..6289c649470306b55dceaaa892646fda6f9bb192 Binary files /dev/null and b/saltice-monitor-admin/target/classes/cn/ljobin/bibi/system/provider/MonitorDataProvider.class differ diff --git a/saltice-monitor-admin/target/classes/pod-scale-alarm.html b/saltice-monitor-admin/target/classes/pod-scale-alarm.html new file mode 100644 index 0000000000000000000000000000000000000000..7bf1cd9c65c9053857e6bb9ad99470ad4fa445b4 --- /dev/null +++ b/saltice-monitor-admin/target/classes/pod-scale-alarm.html @@ -0,0 +1,43 @@ + +
+
+ Confidential - Scale Alarm Use Only +
+
+ +
物联网设备监控{0}通知
+
+
+
+

内容:

+

{2}

+
+
{3}
+
+ + + + {4} + + + + {5} + +
+
+
+ diff --git a/saltice-monitor-admin/target/classes/success-alarm.png b/saltice-monitor-admin/target/classes/success-alarm.png new file mode 100644 index 0000000000000000000000000000000000000000..7ac3c7a51a10eba3dd7d38c539d4dbfcf48ff90f Binary files /dev/null and b/saltice-monitor-admin/target/classes/success-alarm.png differ diff --git a/saltice-monitor-api/pom.xml b/saltice-monitor-api/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..e56cd93b6e7f537bcdbd23c591e7bdfd343869a3 --- /dev/null +++ b/saltice-monitor-api/pom.xml @@ -0,0 +1,61 @@ + + + + 4.0.0 + + cn.ljobin.bibi + saltice-monitor-api + 1.0-SNAPSHOT + + + cn.ljobin.bibi + IoT-monitor + 1.0-SNAPSHOT + ../pom.xml + + + + UTF-8 + 1.8 + 1.8 + + + + + cn.stylefeng.roses + kernel-model + + + cn.stylefeng.roses + kernel-core + provided + + + org.springframework + spring-web + provided + + + javax.servlet + javax.servlet-api + provided + + + + + roses-message-api + + + org.apache.maven.plugins + maven-resources-plugin + + + @ + + false + + + + + diff --git a/saltice-monitor-api/src/main/java/cn/ljobin/bibi/api/MonitorApi.java b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/api/MonitorApi.java new file mode 100644 index 0000000000000000000000000000000000000000..13035fc23d5d1507cd18661ebc1628f887821ab6 --- /dev/null +++ b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/api/MonitorApi.java @@ -0,0 +1,21 @@ +package cn.ljobin.bibi.api; + +import cn.ljobin.bibi.domain.monitor.MonitorMessage; +import org.springframework.web.bind.annotation.*; + +/** + * @program: IoT-Plat + * @description: + * @author: Mr.Liu + * @create: 2020-04-11 15:26 + **/ +@RequestMapping("/monitor") +public interface MonitorApi { + /** + * 报警 + * @param monitorMessage 报警消息 + * @return 成功与否 + */ + @GetMapping("/callPolice") + public boolean callPolice(MonitorMessage monitorMessage); +} diff --git a/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/monitor/MonitorEmail.java b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/monitor/MonitorEmail.java new file mode 100644 index 0000000000000000000000000000000000000000..a70baf7ee30dda34e99d00b01a7b41c23f072a8d --- /dev/null +++ b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/monitor/MonitorEmail.java @@ -0,0 +1,53 @@ +package cn.ljobin.bibi.domain.monitor; + +import cn.ljobin.bibi.domain.monitor.enums.LinkInfoType; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.ToString; + +import java.util.Date; + +/** + * @program: Iot-Monitor + * @description: email类 + * @author: Mr.Liu + * @create: 2020-06-02 10:50 + **/ +@Data +@ToString +@TableName("emails") +public class MonitorEmail { + /** + * id + * */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + /** + * 联系信息 + * **/ + @TableField("linkInfo") + private String linkInfo; + /** + * 联系信息类型 枚举 + * **/ + @TableField(exist = false) + private LinkInfoType linkInfoType; + /** + * 联系信息类型 + */ + @TableField("type") + private Integer type; + /** + * 消息体 + * **/ + @TableField("body") + private String body; + /** + * 发送时间 + * **/ + @TableField("pushTime") + private Date pushTime; +} diff --git a/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/monitor/MonitorEmailRepush.java b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/monitor/MonitorEmailRepush.java new file mode 100644 index 0000000000000000000000000000000000000000..f62bc94477f85a273633cc7ee0006f306887bb07 --- /dev/null +++ b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/monitor/MonitorEmailRepush.java @@ -0,0 +1,63 @@ +package cn.ljobin.bibi.domain.monitor; + +import cn.ljobin.bibi.domain.monitor.enums.LinkInfoType; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.ToString; + +import java.util.Date; + +/** + * @program: Iot-Monitor + * @description: 发送失败的进行重试 + * @author: Mr.Liu + * @create: 2020-06-02 11:46 + **/ +@Data +@ToString +@TableName("emails_repush") +public class MonitorEmailRepush { + /** + * id + * */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + /** + * 联系信息 + * **/ + @TableField("linkInfo") + private String linkInfo; + /** + * 联系信息类型 枚举 + * **/ + @TableField(exist = false) + private LinkInfoType linkInfoType; + /** + * 联系信息类型 + */ + @TableField("type") + private Integer type; + /** + * 消息体 + **/ + @TableField("body") + private String body; + /** + * 上次发送时间 + * **/ + @TableField("oldPushTime") + private Date oldPushTime; + /** + * 重试次数 + */ + @TableField("num") + private Integer num; + /** + * 是否死亡 0-未 1,已死 + */ + @TableField("already_dead") + private String alreadyDead; +} diff --git a/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/monitor/MonitorMessage.java b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/monitor/MonitorMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..53ec2bab26c69b79afad652a1e0d14e94fc702b3 --- /dev/null +++ b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/monitor/MonitorMessage.java @@ -0,0 +1,69 @@ +package cn.ljobin.bibi.domain.monitor; + +import cn.ljobin.bibi.domain.monitor.enums.LinkInfoType; +import cn.ljobin.bibi.enums.MessageType; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.Getter; +import lombok.ToString; + +import java.util.Date; + +/** + * @program: Iot-Monitor + * @description: 报警消息实体 + * @author: Mr.Liu + * @create: 2020-06-02 10:31 + **/ +@Data +@ToString +@TableName("monitor") +public class MonitorMessage { + /**消息id**/ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + /** + * 客户端id + */ + @TableField("clientId") + private String clientId; + /** + * 联系信息 + */ + @TableField("linkInfo") + private String linkInfo; + /** + * 联系信息类型 枚举 + * **/ + @TableField(exist = false) + private LinkInfoType linkInfoType; + /** + * 消息类型 + **/ + @TableField("messageType") + private Integer messageType; + /** + * 联系信息类型 + */ + @TableField("type") + private Integer type; + /** + * 消息标题 + **/ + @TableField("title") + private String title; + /** + * 消息内容 + * utf-8 + */ + @TableField("ploy") + private String ploy; + /** + * 插入的时间 + * **/ + @TableField("insertTime") + private Date insertTime; +} diff --git a/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/monitor/enums/LinkInfoType.java b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/monitor/enums/LinkInfoType.java new file mode 100644 index 0000000000000000000000000000000000000000..251f5fd7a592dbaddd9c11e8c452d5c59d789bd7 --- /dev/null +++ b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/monitor/enums/LinkInfoType.java @@ -0,0 +1,33 @@ +package cn.ljobin.bibi.domain.monitor.enums; + +/** + * @program: Iot-Monitor + * @description: 联系信息类型 + * @author: Mr.Liu + * @create: 2020-06-02 10:36 + **/ +public enum LinkInfoType { + PHONE(1,"phone"), + EMAIL(2,"email"); + /** + * 类型id + */ + private int id; + /** + * 类型名称 + */ + private String type; + private LinkInfoType(int id,String type){ + this.id=id; + this.type=type; + } + + public int getId() { + return id; + } + + + public String getType() { + return type; + } +} diff --git a/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/pot/TbIoterminal.java b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/pot/TbIoterminal.java new file mode 100644 index 0000000000000000000000000000000000000000..314b914880aa9f5125d14014d997b2c16d8898d5 --- /dev/null +++ b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/pot/TbIoterminal.java @@ -0,0 +1,271 @@ +package cn.ljobin.bibi.domain.pot; + +import cn.ljobin.bibi.domain.pot.group.PotGroup; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import java.util.Date; + +/** + * 盆栽信息对象 tb_ioterminal + * + * @author lyb + * @date 2020-04-21 + */ +@TableName("tb_ioterminal") +@ApiModel(value = "盆栽对象", description = "pot") +public class TbIoterminal +{ + private static final long serialVersionUID = 1L; + + /** 编号 */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + + /** 盆栽终端IMEI号 */ + @TableField("imei") + //@Length(min = 10,max = 20,message = "盆栽IMEI长度不合格",groups = {PotGroup.class}) + @Pattern(regexp = "^[A-Za-z0-9]{10,20}$", message = "盆栽IMEI限制:最多20字符,包含字母和数字",groups = {PotGroup.class}) + @ApiModelProperty(value = "盆栽终端IMEI号", required = true) + private String imei; + + /** 类型 */ + private Integer ctype; + + /** IP地址 */ + private String conip; + + /** 当前数据接收状态,0-关 1-开 */ + private String status; + + /** 产出时间 */ + private Date protime; + + /** 启用时间 */ + private Date starttime; + + /** 存放位置编号 */ + private Long deptid; + + /** 使用人编号 */ + private Long uid; + + /** 备注 */ + @ApiModelProperty(value = "盆栽介绍", required = true) + private String demo; + + /** 0-无效,1-有效 */ + private String delflag; + + /** 最后通信时间 */ + private Date enddate; + + /** 0-离线,1-在线 */ + private String online; + /** + * 盆栽自定义名称 + */ + @ApiModelProperty(value = "盆栽名称", required = true) + @TableField("pot_name") + private String potName; + /** + * 用户名称 + * 不是数据库中的字段 + */ + @TableField(exist = false) + private String uname; + /** + * 类型名称 + * 不是数据库中的字段 + */ + @TableField(exist = false) + private String typeName; + + /** + * 是否是享受来的盆栽 + */ + @TableField(exist = false) + private Boolean enjoyPot; + + public Boolean getEnjoyPot() { + return enjoyPot; + } + + public void setEnjoyPot(Boolean enjoyPot) { + this.enjoyPot = enjoyPot; + } + + public String getPotName() { + return potName; + } + + public void setPotName(String potName) { + this.potName = potName; + } + + public String getUname() { + return uname; + } + + public void setUname(String uname) { + this.uname = uname; + } + + public String getTypeName() { + return typeName; + } + + public void setTypeName(String typeName) { + this.typeName = typeName; + } + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setImei(String imei) + { + this.imei = imei; + } + + public String getImei() + { + return imei; + } + public void setCtype(Integer ctype) + { + this.ctype = ctype; + } + + public Integer getCtype() + { + return ctype; + } + public void setConip(String conip) + { + this.conip = conip; + } + + public String getConip() + { + return conip; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setProtime(Date protime) + { + this.protime = protime; + } + + public Date getProtime() + { + return protime; + } + public void setStarttime(Date starttime) + { + this.starttime = starttime; + } + + public Date getStarttime() + { + return starttime; + } + public void setDeptid(Long deptid) + { + this.deptid = deptid; + } + + public Long getDeptid() + { + return deptid; + } + public void setUid(Long uid) + { + this.uid = uid; + } + + public Long getUid() + { + return uid; + } + public void setDemo(String demo) + { + this.demo = demo; + } + + public String getDemo() + { + return demo; + } + public void setDelflag(String delflag) + { + this.delflag = delflag; + } + + public String getDelflag() + { + return delflag; + } + public void setEnddate(Date enddate) + { + this.enddate = enddate; + } + + public Date getEnddate() + { + return enddate; + } + public void setOnline(String online) + { + this.online = online; + } + + public String getOnline() + { + return online; + } + + @Override + public String toString() { + return "TbIoterminal{" + + "id=" + id + + ", imei='" + imei + '\'' + + ", ctype=" + ctype + + ", conip='" + conip + '\'' + + ", status='" + status + '\'' + + ", protime=" + protime + + ", starttime=" + starttime + + ", deptid=" + deptid + + ", uid=" + uid + + ", demo='" + demo + '\'' + + ", delflag='" + delflag + '\'' + + ", enddate=" + enddate + + ", online='" + online + '\'' + + ", uname='" + uname + '\'' + + ", typeName='" + typeName + '\'' + + '}'; + } +} diff --git a/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/pot/group/PotGroup.java b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/pot/group/PotGroup.java new file mode 100644 index 0000000000000000000000000000000000000000..fcc3fe10cca582ef391a810e069353e5af4e3f04 --- /dev/null +++ b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/pot/group/PotGroup.java @@ -0,0 +1,13 @@ +package cn.ljobin.bibi.domain.pot.group; + +import javax.validation.groups.Default; + +/** + * @program: IoT-Plat + * @description: 用户分组 + * @author: Mr.Liu + * @create: 2020-04-29 16:37 + **/ + +public interface PotGroup extends Default { +} diff --git a/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/wapper/TbIoterminalWapper.java b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/wapper/TbIoterminalWapper.java new file mode 100644 index 0000000000000000000000000000000000000000..8950b48a27c72320c133211cb47c8aa9d12c3ae4 --- /dev/null +++ b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/domain/wapper/TbIoterminalWapper.java @@ -0,0 +1,90 @@ +package cn.ljobin.bibi.domain.wapper; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +import java.util.Date; + +/** + * @program: IoT-Plat + * @description: 包装类 + * @author: Mr.Liu + * @create: 2020-04-22 11:10 + **/ +@Data +@ToString +@AllArgsConstructor +@NoArgsConstructor +public class TbIoterminalWapper { + private static final long serialVersionUID = 1L; + + + /** 盆栽终端IMEI号 */ + private String imei; + + /** IP地址 */ + private String conip; + + /** 当前数据接收状态,0-关 1-开 */ + private String status; + + /** 产出时间 */ + private Date protime; + + /** 启用时间 */ + private Date starttime; + + /** 存放位置 */ + private String address; + + /** 备注 */ + private String demo; + + /** 最后通信时间 */ + private Date enddate; + + /** 0-离线,1-在线 */ + private String online; + /** + * 盆栽自定义名称 + */ + private String potName; + /** + * 用户名称 + * 不是数据库中的字段 + */ + private String uname; + /** + * 类型名称 + * 不是数据库中的字段 + */ + private String typeName; + /** + * 盆栽类型id + */ + private Integer pType; + /** + * 是否是享受来的盆栽 + */ + private Boolean enjoyPot; + + public TbIoterminalWapper(String imei, String conip, String status, Date protime, Date starttime, String address, String demo, Date enddate, String online, String potName, String uname, String typeName, Integer pType) { + this.imei = imei; + this.conip = conip; + this.status = status; + this.protime = protime; + this.starttime = starttime; + this.address = address; + this.demo = demo; + this.enddate = enddate; + this.online = online; + this.potName = potName; + this.uname = uname; + this.typeName = typeName; + this.pType = pType; + } +} diff --git a/saltice-monitor-api/src/main/java/cn/ljobin/bibi/enums/MessageQueueEnum.java b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/enums/MessageQueueEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..583a76c0b5d182b0770e1961f4e112c30e361987 --- /dev/null +++ b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/enums/MessageQueueEnum.java @@ -0,0 +1,15 @@ +package cn.ljobin.bibi.enums; + +/** + * 消息队列的枚举 + * + * @author lyb + * @Date 2020年5月6日 12:30:48 + */ +public enum MessageQueueEnum { + + /** + * 下单的消息队列,用于保存需要下发的邮箱 + */ + MAKE_MONITOR_MESSAGE +} diff --git a/saltice-monitor-api/src/main/java/cn/ljobin/bibi/enums/MessageStatusEnum.java b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/enums/MessageStatusEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..13c2dbd8d8faa390eecf05f544aff82cf8844657 --- /dev/null +++ b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/enums/MessageStatusEnum.java @@ -0,0 +1,29 @@ +package cn.ljobin.bibi.enums; + +/** + * 消息状态 + * + * @author lyb + * @Date 2020/4/16 22:31 + */ +public enum MessageStatusEnum { + + WAIT_VERIFY("待确认"), + + SENDING("发送中"); + + private String desc; + + MessageStatusEnum(String desc) { + this.desc = desc; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + +} diff --git a/saltice-monitor-api/src/main/java/cn/ljobin/bibi/enums/MessageType.java b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/enums/MessageType.java new file mode 100644 index 0000000000000000000000000000000000000000..5b40d1198e52bb4663fc48aad96e17e8ee616758 --- /dev/null +++ b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/enums/MessageType.java @@ -0,0 +1,13 @@ +package cn.ljobin.bibi.enums; + +/** + * @program: Iot-Monitor + * @description: 消息类型 + * @author: Mr.Liu + * @create: 2020-06-06 16:02 + **/ +public class MessageType { + public static final int SUCCESS = 0; + public static final int ERROR = 1; + public static final int WANNER = 2; +} diff --git a/saltice-monitor-api/src/main/java/cn/ljobin/bibi/enums/execption/MessageExceptionEnum.java b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/enums/execption/MessageExceptionEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..f37fca4f31653366179038dd6822b790bade44c0 --- /dev/null +++ b/saltice-monitor-api/src/main/java/cn/ljobin/bibi/enums/execption/MessageExceptionEnum.java @@ -0,0 +1,50 @@ +package cn.ljobin.bibi.enums.execption; + + +import cn.stylefeng.roses.kernel.model.exception.AbstractBaseExceptionEnum; + +/** + * 消息服务异常集合 + * + * @author stylefeng + * @Date 2018年4月18日 22:51:31 + */ +public enum MessageExceptionEnum implements AbstractBaseExceptionEnum { + + + QUEUE_CANT_EMPTY(600, "消息队列不能为空"), + MESSAGE_ID_CANT_EMPTY(601, "消息id不能为空"), + MESSAGE_BODY_CANT_EMPTY(602, "消息body不能为空"), + CANT_FIND_MESSAGE(603, "查找不到消息"), + MESSAGE_NUMBER_WRONG(604, "消息数量错误"), + MESSAGE_QUEUE_ERROR(605,"消息队列服务器处理异常"), + MESSAGE_QUEUE_SAVE_ERROR(606,"消息保存异常"), + MESSAGE_TYPE_ERROR(607,"消息接收到的格式错误,非TEXT类型"); + + MessageExceptionEnum(int code, String message) { + this.code = code; + this.message = message; + } + + private Integer code; + + private String message; + + @Override + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + @Override + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/saltice-monitor-api/target/classes/cn/ljobin/bibi/api/MonitorApi.class b/saltice-monitor-api/target/classes/cn/ljobin/bibi/api/MonitorApi.class new file mode 100644 index 0000000000000000000000000000000000000000..749e8eb67d47bba8e6f16d4793f9a7c1aa3e9d15 Binary files /dev/null and b/saltice-monitor-api/target/classes/cn/ljobin/bibi/api/MonitorApi.class differ diff --git a/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/monitor/MonitorEmail.class b/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/monitor/MonitorEmail.class new file mode 100644 index 0000000000000000000000000000000000000000..3f481ba46abb14cd5f727cb87ef350da427e3b62 Binary files /dev/null and b/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/monitor/MonitorEmail.class differ diff --git a/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/monitor/MonitorEmailRepush.class b/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/monitor/MonitorEmailRepush.class new file mode 100644 index 0000000000000000000000000000000000000000..c0062e50aa1e007055a6cfd5084aac7d985f073e Binary files /dev/null and b/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/monitor/MonitorEmailRepush.class differ diff --git a/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/monitor/MonitorMessage.class b/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/monitor/MonitorMessage.class new file mode 100644 index 0000000000000000000000000000000000000000..3ea09b47f99ab1087cd3ba9bd222ceb86a5aab50 Binary files /dev/null and b/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/monitor/MonitorMessage.class differ diff --git a/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/monitor/enums/LinkInfoType.class b/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/monitor/enums/LinkInfoType.class new file mode 100644 index 0000000000000000000000000000000000000000..59c07160efef87f2cd84a3246ffa4696a16ccf60 Binary files /dev/null and b/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/monitor/enums/LinkInfoType.class differ diff --git a/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/pot/TbIoterminal.class b/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/pot/TbIoterminal.class new file mode 100644 index 0000000000000000000000000000000000000000..7073abf8125c2d8e7e913883dffaa2446c223f8d Binary files /dev/null and b/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/pot/TbIoterminal.class differ diff --git a/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/pot/group/PotGroup.class b/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/pot/group/PotGroup.class new file mode 100644 index 0000000000000000000000000000000000000000..993c7444189393e8357ebe56351b4648df8e8ef0 Binary files /dev/null and b/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/pot/group/PotGroup.class differ diff --git a/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/wapper/TbIoterminalWapper.class b/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/wapper/TbIoterminalWapper.class new file mode 100644 index 0000000000000000000000000000000000000000..6e5158b74ed714cd37d966b9f7b4ed989c2f8d20 Binary files /dev/null and b/saltice-monitor-api/target/classes/cn/ljobin/bibi/domain/wapper/TbIoterminalWapper.class differ diff --git a/saltice-monitor-common/pom.xml b/saltice-monitor-common/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..78f5a1a389ea75a6adca43b721b1fe1e3edf60ca --- /dev/null +++ b/saltice-monitor-common/pom.xml @@ -0,0 +1,152 @@ + + + + 4.0.0 + + cn.ljobin.bibi + saltice-monitor-common + 1.0-SNAPSHOT + + + cn.ljobin.bibi + IoT-monitor + 1.0-SNAPSHOT + + + + UTF-8 + 1.8 + 1.8 + 1.0 + + + + + javax.mail + mail + + + + org.springframework.boot + spring-boot-starter-mail + + + + com.itranswarp + compiler + ${com.itranswarp.compiler.version} + + + + + + + org.springframework.kafka + spring-kafka + + + cn.ljobin.bibi + saltice-monitor-api + 1.0-SNAPSHOT + + + cn.stylefeng.roses + kernel-model + + + cn.stylefeng.roses + kernel-core + provided + + + cn.stylefeng.roses + kernel-logger + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + redis.clients + jedis + + + io.lettuce + lettuce-core + + + + + + + redis.clients + jedis + + + + + + + org.apache.commons + commons-pool2 + 2.5.0 + + + + + com.alibaba + fastjson + 1.2.47 + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + + + diff --git a/saltice-monitor-common/src/main/java/cn/ljobin/bibi/constant/Status.java b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/constant/Status.java new file mode 100644 index 0000000000000000000000000000000000000000..1e4e96ddf7386607ccc180601a619b64c878a1fc --- /dev/null +++ b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/constant/Status.java @@ -0,0 +1,14 @@ +package cn.ljobin.bibi.constant; + +/** + * @program: IoT-Plat + * @description: 状态常量 + * @author: Mr.Liu + * @create: 2020-04-24 23:13 + **/ +public class Status { + public static String isEnable = "1"; + public static String noEnable = "0"; + public static String noDel = "0"; + public static String isDel = "1"; +} diff --git a/saltice-monitor-common/src/main/java/cn/ljobin/bibi/stub/StubFactory.java b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/stub/StubFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..9ae58222f9886eb3c1e36cdfd5d61dfe8b882c44 --- /dev/null +++ b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/stub/StubFactory.java @@ -0,0 +1,12 @@ +package cn.ljobin.bibi.stub; + +/** + * @program: Iot-Monitor + * @description: 动态创建邮件代理服务 + * @author: Mr.Liu + * @create: 2020-06-06 22:52 + **/ + +public interface StubFactory { + T createStub(String imports ,String className,String parem,String statics , String methodContent) throws Exception; +} diff --git a/saltice-monitor-common/src/main/java/cn/ljobin/bibi/stub/TemplateStub.java b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/stub/TemplateStub.java new file mode 100644 index 0000000000000000000000000000000000000000..36699a0d7a74a1d926b6c771a9990f435326e101 --- /dev/null +++ b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/stub/TemplateStub.java @@ -0,0 +1,153 @@ +package cn.ljobin.bibi.stub; + +import cn.ljobin.bibi.utils.email.BaseMailSend; +import com.itranswarp.compiler.JavaStringCompiler; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.util.Map; + +/** + * @program: Iot-Monitor + * @description: 模板 + * @author: Mr.Liu + * @create: 2020-06-06 23:03 + **/ +@Service +@Slf4j +public class TemplateStub implements StubFactory{ + private final static String STUB_SOURCE_TEMPLATE = + "package cn.ljobin.bibi.utils.email.impl;\n" + + "import cn.ljobin.bibi.utils.email.impl.*;\n" + + "import cn.ljobin.bibi.domain.monitor.MonitorMessage;\n" + + "import cn.ljobin.bibi.enums.MessageType;\n" + + "import java.util.concurrent.Executors;\n" + + "import java.util.concurrent.LinkedBlockingQueue;\n" + + "import java.util.concurrent.ScheduledExecutorService;\n" + + "import java.util.concurrent.TimeUnit;\n" + + //TODO Import + "%s\n"+ + //TODO ClassName + "public class %s implements BaseMailSend {\n" + + "private static String buffer;\n" + + "private static String sendUserEmail = \"2018214546@qq.com\";\n" + + " private static String qqPassword = \"ujpiarknosuybadb\";\n" + + "/**保存从activemq获取的消息*1024*1024 = 1048576*/\n" + + " private static final LinkedBlockingQueue monitorMessages = new LinkedBlockingQueue<>(2<<20);\n" + + " /**上面那个满了就保存到下面这个**/\n" + + " private static final LinkedBlockingQueue monitorMessages2 = new LinkedBlockingQueue<>(2<<20);\n" + + " private static final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(10);\n" + + //TODO Parem + "%s\n" + + //TODO Static + "static{%s}\n" + + " static {\n" + + " String fileName = \"pod-scale-alarm.html\";\n" + + " InputStream inputStream = ClassLoader.getSystemResourceAsStream(fileName);\n" + + " if(inputStream==null){\n" + + " System.err.println(\"文件读取失败\"+fileName);\n" + + " }else {\n" + + " BufferedReader fileReader = new BufferedReader(new InputStreamReader(inputStream));\n" + + " StringBuilder buffers = new StringBuilder();\n" + + " String line = \"\";\n" + + " try {\n" + + " while ((line = fileReader.readLine()) != null) {\n" + + " buffers.append(line);\n" + + " }\n" + + " buffer = buffers.toString();\n" + + " } catch (Exception e) {\n" + + " System.err.println(\"读取文件失败,fileName:\"+fileName+ e.toString());\n" + + " } finally {\n" + + " try {\n" + + " inputStream.close();\n" + + " fileReader.close();\n" + + " } catch (IOException e) {\n" + + " e.printStackTrace();\n" + + " }\n" + + " }\n" + + " }" + + " for (int i = 0; i < 10; i++) {\n" + + " scheduledExecutorService.scheduleWithFixedDelay(()->{\n" + + " //弹出队顶元素,队列为空时返回null\n" + + " MonitorMessage monitorMessage = monitorMessages.poll();\n" + + " if(monitorMessage!=null){\n" + + " send(monitorMessage.getTitle(),\n" + + " monitorMessage.getPloy(),\n" + + " monitorMessage.getLinkInfo(),\n" + + " monitorMessage.getMessageType());\n" + + " }\n" + + " },0,1000, TimeUnit.MILLISECONDS);\n" + + " }\n" + + " scheduledExecutorService.scheduleWithFixedDelay(()->{\n" + + " //弹出队顶元素,队列为空时返回null\n" + + " MonitorMessage monitorMessage = monitorMessages2.poll();\n" + + " if(monitorMessage!=null){\n" + + " send(monitorMessage.getTitle(),\n" + + " monitorMessage.getPloy(),\n" + + " monitorMessage.getLinkInfo(),\n" + + " monitorMessage.getMessageType());\n" + + " }\n" + + " },0,10, TimeUnit.SECONDS);\n" + + " }" + + " @Override\n" + + " public void sendEmail(MonitorMessage monitorMessage) {\n" + + " try {\n" + + " monitorMessages.add(monitorMessage);\n" + + " }catch (IllegalStateException e){\n" + + " monitorMessages2.offer(monitorMessage);\n" + + " }" + + " }\n" + + //TODO 下面是要添加的方法 MethodContent + " public static void send(String title, String content, String linkInfo, int type) {\n" + + "System.err.println(\"send begin\");\n" + + " %s\n" + + "System.err.println(\"send ok\");\n" + + " }\n" + + "private static String buildContent(String title,String body,int isDanger) throws IOException {\n" + + " String contentText = body+\"
以下是物联网设备详细信息, 敬请查看.
below is the information of service instance scale, please check. \";\n" + + " String header = \"分区(Namespace)服务(Service)伸缩结果(Scale Result)伸缩原因(Scale Reason)当前实例数(Pod instance number)\";\n" + + " String emailHeadColor;\n" + + " switch (isDanger){\n" + + " case MessageType.ERROR:\n" + + " emailHeadColor = \"#cc1d0c\";\n" + + " break;\n" + + " case MessageType.SUCCESS:\n" + + " emailHeadColor = \"#10fa81\";\n" + + " break;\n" + + " case MessageType.WANNER:\n" + + " emailHeadColor = \"yellow\";\n" + + " break;\n" + + " default:\n" + + " emailHeadColor = \"#aaa\";\n" + + " }\n" + + " String date = DateFormatUtils.format(new Date(), \"yyyy/MM/dd HH:mm:ss\");\n" + + " String linesBuffer = \"湖南分区集群服务服务暂停异常2\";\n" + + " String htmlText = MessageFormat.format(buffer, title,emailHeadColor, contentText, date, header, linesBuffer);\n" + + " htmlText = htmlText.replaceAll(\"\", \"\");\n" + + " htmlText = htmlText.replaceAll(\"\", \"\");" + + " return htmlText;\n" + + " }" + + "}"; + + @Override + public T createStub(String imports ,String className,String parem,String statics , String methodContent) throws Exception{ + className = className + "Stub"; + String source = String.format(STUB_SOURCE_TEMPLATE, imports, className, parem,statics, methodContent); + String stubFullName = "cn.ljobin.bibi.utils.email.impl." + className; + //编译源代码 + JavaStringCompiler compiler = new JavaStringCompiler(); + try { + Map results = compiler.compile(className + ".java", source); + // 加载编译好的类 + Class clazz = compiler.loadClass(stubFullName, results); + // 把实例化 + BaseMailSend stubInstance = (BaseMailSend) clazz.newInstance(); + log.info(stubInstance.toString()); + // 返回这个桩 + return (T) stubInstance; + } catch (IOException | ClassNotFoundException | IllegalAccessException | InstantiationException e) { + throw new RuntimeException(e); + } + } +} diff --git a/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/AnnotationUtils.java b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/AnnotationUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..9412d1f8cc13d95492db0f1fbf89889df5b38554 --- /dev/null +++ b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/AnnotationUtils.java @@ -0,0 +1,158 @@ +package cn.ljobin.bibi.utils; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Date; +import java.util.Objects; + +/** + * @program: IoT-Plat + * @description: 包装验证类 + * @author: Mr.Liu + * @create: 2020-04-11 16:25 + **/ +public class AnnotationUtils { + /** + * 反射包装QueryWrapper,自动将简单的条件查询 映射好 + * 构建where后面的条件 + */ + public QueryWrapper wapperData (QueryWrapper queryWrapper,T o){ + Class clazz = o.getClass(); + Field[] fields = clazz.getDeclaredFields(); + for (Field f : fields) { + TableField tableField = f.getAnnotation(TableField.class); + //没有注解表示肯定存在这个字段在数据库 + if(tableField==null){ + TableId tableId = f.getAnnotation(TableId.class); + String name = ""; + if(tableId != null){ + String n = tableId.value(); + if("".equals(n)){ + name = f.getName(); + }else { + name = n; + } + }else { + name = f.getName(); + } + Object value = getValue(o,f); + if(value!=null && value != ""){ + //System.out.println(name+"---"+value); + queryWrapper.eq(name,value); + } + continue; + } + //如果注解明确说明是不存在的,就不管了 + if(!tableField.exist()){ + continue; + } + //获取注解中的value值,及数据库中字段名称 + String name = tableField.value(); + if(!"".equals(name)){ + Object value = getValue(o,f); + if(Objects.nonNull(value)){ + //System.out.println(name+"---"+value); + queryWrapper.eq(name,value); + } + } + } + return queryWrapper; + } + private Object getValue(T model,Field f){ + f.setAccessible(true); + // 获取属性的类型 + String type = f.getGenericType().toString(); + try { + // 如果type是类类型,则前面包含"class ",后面跟类名 + if ("class java.lang.String".equals(type)) { + //获取属性值 + String value = (String) f.get(model); + if("".equals(value)){ + return null; + } + return value; + } + if ("class java.lang.Integer".equals(type)) { + //获取属性值 + return (Integer) f.get(model); + } + if ("class java.lang.Long".equals(type)) { + //获取属性值 + return (Long) f.get(model); + } + if ("class java.lang.Double".equals(type)) { + return (Double) f.get(model); + } + if ("class java.lang.Float".equals(type)) { + return (Float) f.get(model); + } + if ("class java.lang.Boolean".equals(type)) { + return (Boolean) f.get(model); + } + if ("class java.util.Date".equals(type)) { + return (Date) f.get(model); + } + // 如果有需要,可以仿照上面继续进行扩充,再增加对其它类型的判断 + } catch (SecurityException | IllegalAccessException | IllegalArgumentException e) { + e.printStackTrace(); + } + return null; + //下面是通过getXXX()方法获取的,不太灵活 +// // 获取属性的名字 +// String name = f.getName(); +// // 将属性的首字符大写,方便构造get,set方法 +// name = name.substring(0, 1).toUpperCase() + name.substring(1); +// // 获取属性的类型 +// String type = f.getGenericType().toString(); +// try { +// // 如果type是类类型,则前面包含"class ",后面跟类名 +// if ("class java.lang.String".equals(type)) { +// Method m = model.getClass().getMethod("get" + name); +// System.out.println((String) m.invoke(model)); +// return (String) m.invoke(model); +// } +// if ("class java.lang.Integer".equals(type)) { +// Method m = model.getClass().getMethod("get" + name); +// return (Integer) m.invoke(model); +// } +// if ("class java.lang.Long".equals(type)) { +// Method m = model.getClass().getMethod("get" + name); +// System.out.println((Long) m.invoke(model)); +// return (Long) m.invoke(model); +// } +// if ("class java.lang.Double".equals(type)) { +// Method m = model.getClass().getMethod("get" + name); +// return (Double) m.invoke(model); +// } +// if ("class java.lang.Float".equals(type)) { +// Method m = model.getClass().getMethod("get" + name); +// return (Float) m.invoke(model); +// } +// if ("class java.lang.Boolean".equals(type)) { +// Method m = model.getClass().getMethod("get" + name); +// return (Boolean) m.invoke(model); +// } +// if ("class java.util.Date".equals(type)) { +// Method m = model.getClass().getMethod("get" + name); +// return (Date) m.invoke(model); +// } +// // 如果有需要,可以仿照上面继续进行扩充,再增加对其它类型的判断 +// }catch (NoSuchMethodException e) { +// e.printStackTrace(); +// } catch (SecurityException e) { +// e.printStackTrace(); +// } catch (IllegalAccessException e) { +// e.printStackTrace(); +// } catch (IllegalArgumentException e) { +// e.printStackTrace(); +// } catch (InvocationTargetException e) { +// e.printStackTrace(); +// } +// return null; + } +} diff --git a/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/Log4JavaMail.java b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/Log4JavaMail.java new file mode 100644 index 0000000000000000000000000000000000000000..8b1adc0564938e6c8bed7169a9bdc28ece92b41e --- /dev/null +++ b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/Log4JavaMail.java @@ -0,0 +1,88 @@ +package cn.ljobin.bibi.utils; + + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import org.slf4j.Logger; +import java.io.PrintStream; + +/** + * @program: Iot-Monitor + * @description: + * @author: Mr.Liu + * @create: 2020-06-02 21:02 + **/ +public class Log4JavaMail extends PrintStream { + private static byte[] CRLF = new byte[] { 13, 10 }; + private ByteArrayOutputStream bos = new ByteArrayOutputStream(); + private Logger actualLog; + private String charset; + private boolean hitData; + + public String getCharset() { + return charset; + } + + public void setCharset(String charset) { + this.charset = charset; + } + + public Log4JavaMail(Logger log) { + super(System.out); + this.actualLog = log; + } + + public Log4JavaMail(Logger log, String charset) { + super(System.out); + this.actualLog = log; + this.charset = charset; + } + + @Override + public void write(byte buf[], int off, int len) { + bos.write(buf, off, len); + //到过一行末尾,输出日志 + if (len > 1) { + if (buf[off + len - 2] == CRLF[0] + && buf[off + len - 1] == CRLF[1]) { + flush(); + } + } + } + + @Override + public void flush() { + if (charset == null) { + charset = "utf-8"; + } + try { + String msg = new String(bos.toByteArray(), charset); + //debug输出会加上换行符,所以去掉javamail加上的换行符。 + if (msg.endsWith("\r\n")) { + msg = msg.substring(0, msg.length() - 2); + } + + if (msg.equals("DATA")) { + hitData = true; + } else if (msg.equals(".\r\n")) { + hitData = false; + } + + if (hitData) { + //data阶段输出邮件内容,设置为trace级别. + actualLog.trace(msg); + } else { + actualLog.debug(msg); + } + } catch (Exception e) { + e.printStackTrace(); + } + bos.reset(); + } + + @Override + public void println(String x) { + actualLog.debug(x); + } +} diff --git a/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/email/BaseMailSend.java b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/email/BaseMailSend.java new file mode 100644 index 0000000000000000000000000000000000000000..617acb48f46dd7dddddb258c5189e10caadcc24f --- /dev/null +++ b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/email/BaseMailSend.java @@ -0,0 +1,18 @@ +package cn.ljobin.bibi.utils.email; + +import cn.ljobin.bibi.domain.monitor.MonitorMessage; + +/** + * @program: Iot-Monitor + * @description: + * @author: Mr.Liu + * @create: 2020-06-02 15:34 + **/ + +public interface BaseMailSend { + /** + * 发送邮件 + * @param monitorMessage 邮件标题 + */ + public void sendEmail(MonitorMessage monitorMessage); +} diff --git a/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/email/impl/SendQqMailUtil.java b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/email/impl/SendQqMailUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..4cdf9b74b9e97c7ade916ba6a6584eeda7488717 --- /dev/null +++ b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/email/impl/SendQqMailUtil.java @@ -0,0 +1,104 @@ +package cn.ljobin.bibi.utils.email.impl; + +/** + * @program: guns + * @description: + * @author: Mr.Liu + * @create: 2019-09-12 18:02 + **/ + +import cn.ljobin.bibi.domain.monitor.MonitorMessage; +import cn.ljobin.bibi.utils.Log4JavaMail; +import cn.ljobin.bibi.utils.email.BaseMailSend; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; +import java.util.Properties; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadPoolExecutor; + +@Service("sendQqMailUtil") +@Slf4j +public class SendQqMailUtil implements BaseMailSend { + private String sendUserEmail = "2018214546@qq.com"; + private String qqPassword = "ujpiarknosuybadb"; + private static volatile Properties properties; + private static Properties getPropertiesInstance(){ + if(properties==null){ + synchronized (Properties.class){ + if(properties==null){ + Properties properties2 = new Properties(); + // 连接协议 + properties2.put("mail.transport.protocol", "smtp"); + // 主机名 + properties2.put("mail.smtp.host", "smtp.qq.com"); + // 端口号 + properties2.put("mail.smtp.port", 465); + properties2.put("mail.smtp.auth", "true"); + // 设置是否使用ssl安全连接 ---一般都使用 + properties2.put("mail.smtp.ssl.enable", "true"); + // 设置是否显示debug信息 true 会在控制台显示相关信息 + properties2.put("mail.debug", "false"); + properties = properties2; + } + } + } + return properties; + } + private ExecutorService executorService = Executors.newFixedThreadPool(15); + + /** + * TODO 这里应该对相同标题和内容的邮箱进行整合,一起发送 + * @param title 邮件标题 + * @param content 邮件类容 + * @param linkInfo 邮件接收端地址 + */ + @Override + public void sendEmail(MonitorMessage monitorMessage){ + executorService.submit(()->{ + Transport transport=null; + Session session=null; + try { + // 得到回话对象 + session = Session.getInstance(getPropertiesInstance()); + session.setDebug(false); + session.setDebugOut(new Log4JavaMail(log,"utf-8")); + // 获取邮件对象 + Message message = new MimeMessage(session); + // 设置发件人邮箱地址 + message.setFrom(new InternetAddress(sendUserEmail)); + // 设置收件人邮箱地址 + message.setRecipients(Message.RecipientType.TO, new InternetAddress[]{new InternetAddress(monitorMessage.getLinkInfo())}); + //message.setRecipient(Message.RecipientType.TO, new InternetAddress("xxx@qq.com"));//一个收件人 + // 设置邮件标题 + message.setSubject(monitorMessage.getTitle()); + // 设置邮件内容 + message.setText(monitorMessage.getPloy()); + // 得到邮差对象 + transport = session.getTransport(); + // 连接自己的邮箱账户 + // 密码为QQ邮箱开通的stmp服务后得到的客户端授权码 + //授权码申请参考:https://baijiahao.baidu.com/s?id=1552315463915496&wfr=spider&for=pc + transport.connect(sendUserEmail, qqPassword); + // 发送邮件 + transport.sendMessage(message, message.getAllRecipients()); + }catch (MessagingException e){ + log.error(e.toString()); + }finally { + if(transport!=null){ + try { + transport.close(); + } catch (MessagingException e) { + log.error(e.toString()); + } + } + } + }); + } +} diff --git a/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/email/impl/SprBooEmailUtil.java b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/email/impl/SprBooEmailUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..b8d740c87d7f12600b6f32cd11bcf877f9ac0edb --- /dev/null +++ b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/email/impl/SprBooEmailUtil.java @@ -0,0 +1,179 @@ +package cn.ljobin.bibi.utils.email.impl; + +import cn.ljobin.bibi.domain.monitor.MonitorMessage; +import cn.ljobin.bibi.enums.MessageType; +import cn.ljobin.bibi.utils.email.BaseMailSend; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.time.DateFormatUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.io.ClassPathResource; +import org.springframework.mail.javamail.JavaMailSenderImpl; +import org.springframework.mail.javamail.MimeMessageHelper; +import org.springframework.stereotype.Service; + +import javax.mail.MessagingException; +import javax.mail.internet.MimeMessage; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.text.MessageFormat; +import java.util.Date; +import java.util.Objects; +import java.util.Properties; +import java.io.IOException; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +/** + * @program: Iot-Monitor + * @description: + * @author: Mr.Liu + * @create: 2020-06-02 21:23 + **/ +@Service("sprBooEmailUtil") +@Slf4j +public class SprBooEmailUtil implements BaseMailSend { + private static String sendUserEmail = "2018214546@qq.com"; + private static String qqPassword = "ujpiarknosuybadb"; + private static JavaMailSenderImpl javaMailSender; + private static String buffer; + /**保存从activemq获取的消息*1024*1024 = 1048576*/ + public static final LinkedBlockingQueue monitorMessages = new LinkedBlockingQueue<>(2<<20); + /**上面那个满了就保存到下面这个**/ + public static final LinkedBlockingQueue monitorMessages2 = new LinkedBlockingQueue<>(2<<20); + public static final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(10); + static { + //加载邮件html模板 + String fileName = "pod-scale-alarm.html"; + InputStream inputStream = ClassLoader.getSystemResourceAsStream(fileName); + if(inputStream==null){ + log.error("{}文件读取失败",fileName); + }else { + BufferedReader fileReader = new BufferedReader(new InputStreamReader(inputStream)); + StringBuilder buffers = new StringBuilder(); + String line = ""; + try { + while ((line = fileReader.readLine()) != null) { + buffers.append(line); + } + buffer = buffers.toString(); + } catch (Exception e) { + log.error("读取文件失败,fileName:{}", fileName, e); + } finally { + try { + inputStream.close(); + fileReader.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + static { + javaMailSender = new JavaMailSenderImpl(); + javaMailSender.setUsername(sendUserEmail); + javaMailSender.setPassword(qqPassword); + javaMailSender.setHost("smtp.qq.com"); + javaMailSender.setPort(587); + javaMailSender.setDefaultEncoding("UTF-8"); + Properties props = new Properties(); + props.setProperty("mail.smtp.host", "smtp.qq.com"); + props.setProperty("mail.transport.protocol", "smtp"); + props.setProperty("mail.smtp.auth", "true"); + props.setProperty("mail.smtp.connectiontimeout", "20000"); + props.setProperty("mail.smtp.timeout", "20000"); + javaMailSender.setJavaMailProperties(props); + } + static { + for (int i = 0; i < 10; i++) { + scheduledExecutorService.scheduleWithFixedDelay(()->{ + //弹出队顶元素,队列为空时返回null + MonitorMessage monitorMessage = monitorMessages.poll(); + if(monitorMessage!=null){ + send(monitorMessage.getTitle(), + monitorMessage.getPloy(), + monitorMessage.getLinkInfo(), + monitorMessage.getMessageType()); + } + },0,100, TimeUnit.MILLISECONDS); + } + scheduledExecutorService.scheduleWithFixedDelay(()->{ + //弹出队顶元素,队列为空时返回null + MonitorMessage monitorMessage = monitorMessages2.poll(); + if(monitorMessage!=null){ + send(monitorMessage.getTitle(), + monitorMessage.getPloy(), + monitorMessage.getLinkInfo(), + monitorMessage.getMessageType()); + } + },0,10, TimeUnit.SECONDS); + } + @Override + public void sendEmail(MonitorMessage monitorMessage) { + //send(monitorMessage.getTitle(), monitorMessage.getPloy(), monitorMessage.getLinkInfo(),monitorMessage.getMessageType()); + try { + monitorMessages.add(monitorMessage); + }catch (IllegalStateException e){ + monitorMessages2.offer(monitorMessage); + } + } + public static void send(String title, String content, String linkInfo, int type){ + MimeMessage message = javaMailSender.createMimeMessage(); + MimeMessageHelper helper = null; + try { + helper = new MimeMessageHelper(message, true, "UTF-8"); + helper.setTo(new String[]{linkInfo}); +// helper.setCc("抄送人邮箱"); + helper.setFrom(sendUserEmail); + helper.setSubject(title); + helper.setText(buildContent(title,content,type), true); + String alarmIconName = "success-alarm.png"; + ClassPathResource img = new ClassPathResource(alarmIconName); + //设置图标 + helper.addInline("icon-alarm", img); + /**邮件发送时间较久**/ + long st1 = System.currentTimeMillis(); + javaMailSender.send(message); + long st2 = System.currentTimeMillis(); + log.info("发送耗时:{}",(st2-st1)); + } catch (MessagingException | IOException e) { + e.printStackTrace(); + } + } + + private static String buildContent(String title,String body,int isDanger) throws IOException { + + String contentText = body+"
以下是物联网设备详细信息, 敬请查看.
below is the information of service instance scale, please check. "; + //邮件表格header + String header = "分区(Namespace)服务(Service)伸缩结果(Scale Result)伸缩原因(Scale Reason)当前实例数(Pod instance number)"; + //绿色 + String emailHeadColor; + switch (isDanger){ + case MessageType.ERROR: + emailHeadColor = "#cc1d0c"; + break; + case MessageType.SUCCESS: + emailHeadColor = "#10fa81"; + break; + case MessageType.WANNER: + emailHeadColor = "yellow"; + break; + default: + emailHeadColor = "#aaa"; + } + String date = DateFormatUtils.format(new Date(), "yyyy/MM/dd HH:mm:ss"); + //填充html模板中的五个参数 + String linesBuffer = "" + "湖南分区" + "" + "集群服务" + "" + "服务暂停" + "" + + "" + "异常" + "" + "2" + ""; + String htmlText = MessageFormat.format(buffer, title,emailHeadColor, contentText, date, header, linesBuffer); + + //改变表格样式 + htmlText = htmlText.replaceAll("", ""); + htmlText = htmlText.replaceAll("", ""); + return htmlText; + } + +} diff --git a/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/kafkaconfig/ComsumerConfig.java b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/kafkaconfig/ComsumerConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..b0f61b9bd071b02d6552a0f04c2bb2fd388e270e --- /dev/null +++ b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/kafkaconfig/ComsumerConfig.java @@ -0,0 +1,22 @@ +package cn.ljobin.bibi.utils.kafkaconfig; + +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import static cn.stylefeng.roses.kernel.model.constants.ConfigPrefixConstants.LOG_PREFIX; + +/** + * @program: IoT-Plat + * @description: kafka消费者监听器 + * @author: Mr.Liu + * @create: 2020-04-14 17:06 + **/ +@Configuration +@ConditionalOnProperty(prefix = LOG_PREFIX, value = "kafka", havingValue = "true") +public class ComsumerConfig { + @Bean + public Listener listener() { + return new Listener(); + } +} diff --git a/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/kafkaconfig/Listener.java b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/kafkaconfig/Listener.java new file mode 100644 index 0000000000000000000000000000000000000000..9b6230f1e06a2e99b7e30a9a0f59fd0e3a64ebb9 --- /dev/null +++ b/saltice-monitor-common/src/main/java/cn/ljobin/bibi/utils/kafkaconfig/Listener.java @@ -0,0 +1,61 @@ +package cn.ljobin.bibi.utils.kafkaconfig; + +import lombok.extern.slf4j.Slf4j; +import org.apache.kafka.clients.consumer.ConsumerRecord; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.kafka.annotation.TopicPartition; +import org.springframework.stereotype.Service; + +import java.util.List; + +import static cn.stylefeng.roses.kernel.logger.constants.KafkaConstants.*; +import static cn.stylefeng.roses.kernel.model.constants.ConfigPrefixConstants.LOG_PREFIX; + +/** + * @program: IoT-Plat + * @description: + * @author: Mr.Liu + * @create: 2020-04-14 11:07 + **/ +@Service +@Slf4j +public class Listener { +// /** +// * LOG_TOPIC 消息接收 +// * @param recordList +// */ +// @KafkaListener(id=LOG_TOPIC, +// topicPartitions ={@TopicPartition(topic = LOG_TOPIC, partitions = { "0"})}) +// public void listen(List> recordList) { +// recordList.forEach((record)->{ +// log.info("kafka的key: " + record.key()); +// log.info("kafka的value: " + new String(record.value())); +// }); +// } +// +// /** +// * TRACE_LOG_TOPIC 消息接收 +// * @param recordList +// */ +// @KafkaListener(id=TRACE_LOG_TOPIC, +// topicPartitions ={@TopicPartition(topic = TRACE_LOG_TOPIC, partitions = { "0"})}) +// public void listen2(List> recordList) { +// recordList.forEach((record)->{ +// log.info("kafka的key: " + record.key()); +// log.info("kafka的value: " + new String(record.value())); +// }); +// } +// +// /** +// * TC_LOG_TOPIC 消息接收 +// * @param recordList +// */ +// @KafkaListener(id=TC_LOG_TOPIC, +// topicPartitions ={@TopicPartition(topic = TC_LOG_TOPIC, partitions = { "0"})}) +// public void listen3(List> recordList) { +// recordList.forEach((record)->{ +// log.info("kafka的key: " + record.key()); +// log.info("kafka的value: " + new String(record.value())); +// }); +// } +} diff --git a/saltice-monitor-common/target/classes/cn/ljobin/bibi/constant/Status.class b/saltice-monitor-common/target/classes/cn/ljobin/bibi/constant/Status.class new file mode 100644 index 0000000000000000000000000000000000000000..b8756e2e8a988f9e5327981ef867304d432f1d8c Binary files /dev/null and b/saltice-monitor-common/target/classes/cn/ljobin/bibi/constant/Status.class differ diff --git a/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/AnnotationUtils.class b/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/AnnotationUtils.class new file mode 100644 index 0000000000000000000000000000000000000000..5016c084c88db19752c47870b0ee181e2c7da353 Binary files /dev/null and b/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/AnnotationUtils.class differ diff --git a/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/Log4JavaMail.class b/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/Log4JavaMail.class new file mode 100644 index 0000000000000000000000000000000000000000..8e2ef7a1ae3bfc1501b53cd722996cba9d4fb614 Binary files /dev/null and b/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/Log4JavaMail.class differ diff --git a/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/email/BaseMailSend.class b/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/email/BaseMailSend.class new file mode 100644 index 0000000000000000000000000000000000000000..97519594124014c3e9b9ff9935e462062cb37525 Binary files /dev/null and b/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/email/BaseMailSend.class differ diff --git a/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/email/impl/SendQqMailUtil.class b/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/email/impl/SendQqMailUtil.class new file mode 100644 index 0000000000000000000000000000000000000000..5408c8bc970cbd81ccf1fee147645d5690593384 Binary files /dev/null and b/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/email/impl/SendQqMailUtil.class differ diff --git a/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/email/impl/SprBooEmailUtil.class b/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/email/impl/SprBooEmailUtil.class new file mode 100644 index 0000000000000000000000000000000000000000..0baa0f9b55980ab68b4f7d022ff716a77d7a4121 Binary files /dev/null and b/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/email/impl/SprBooEmailUtil.class differ diff --git a/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/kafkaconfig/ComsumerConfig.class b/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/kafkaconfig/ComsumerConfig.class new file mode 100644 index 0000000000000000000000000000000000000000..2c79d75135f02d79dc9ecde7c9ef6be8c2e4f314 Binary files /dev/null and b/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/kafkaconfig/ComsumerConfig.class differ diff --git a/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/kafkaconfig/Listener.class b/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/kafkaconfig/Listener.class new file mode 100644 index 0000000000000000000000000000000000000000..a2fcc7be945413a8bdfc185c5351da3853c0a800 Binary files /dev/null and b/saltice-monitor-common/target/classes/cn/ljobin/bibi/utils/kafkaconfig/Listener.class differ diff --git a/saltice-monitor-feign/pom.xml b/saltice-monitor-feign/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..c7b3fe76692556685f9f8400cf3298c4c81a3e7d --- /dev/null +++ b/saltice-monitor-feign/pom.xml @@ -0,0 +1,107 @@ + + + + 4.0.0 + + cn.ljobin.bibi + saltice-monitor-feign + 1.0-SNAPSHOT + + + cn.ljobin.bibi + IoT-monitor + 1.0-SNAPSHOT + + + + UTF-8 + 1.8 + 1.8 + + + + + cn.stylefeng.roses + kernel-model + + + cn.stylefeng.roses + kernel-core + provided + + + + + + + + cn.stylefeng.roses + roses-system-api + 1.1.6 + + + cn.stylefeng.roses + kernel-logger + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + + org.springframework.cloud + spring-cloud-starter-netflix-hystrix + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + + + diff --git a/saltice-monitor-feign/src/main/java/cn/ljobin/bibi/feign/AuthUserComsumer.java b/saltice-monitor-feign/src/main/java/cn/ljobin/bibi/feign/AuthUserComsumer.java new file mode 100644 index 0000000000000000000000000000000000000000..f61ff2fabd9ae003f656860e2f39cb8a33797d20 --- /dev/null +++ b/saltice-monitor-feign/src/main/java/cn/ljobin/bibi/feign/AuthUserComsumer.java @@ -0,0 +1,15 @@ +package cn.ljobin.bibi.feign; + +import cn.ljobin.bibi.feign.fallback.AuthUserComsumeuFallback; +import cn.stylefeng.roses.kernel.model.api.AuthService; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * @program: IoT-Plat + * @description: 获取用户信息的 + * @author: Mr.Liu + * @create: 2020-04-12 16:23 + **/ +@FeignClient(value = "roses-system" , fallback = AuthUserComsumeuFallback.class) +public interface AuthUserComsumer extends AuthService { +} diff --git a/saltice-monitor-feign/src/main/java/cn/ljobin/bibi/feign/fallback/AuthUserComsumeuFallback.java b/saltice-monitor-feign/src/main/java/cn/ljobin/bibi/feign/fallback/AuthUserComsumeuFallback.java new file mode 100644 index 0000000000000000000000000000000000000000..baa615824796b8693bdb04809979d489d13633f7 --- /dev/null +++ b/saltice-monitor-feign/src/main/java/cn/ljobin/bibi/feign/fallback/AuthUserComsumeuFallback.java @@ -0,0 +1,88 @@ +package cn.ljobin.bibi.feign.fallback; + +import cn.ljobin.bibi.feign.AuthUserComsumer; +import cn.stylefeng.roses.core.reqres.response.ResponseData; +import cn.stylefeng.roses.kernel.logger.api.common.annotion.IotLog; +import cn.stylefeng.roses.kernel.logger.api.common.state.LogType; +import cn.stylefeng.roses.kernel.model.api.AuthService; +import cn.stylefeng.roses.kernel.model.api.base.AppUserWarpper; +import cn.stylefeng.roses.kernel.model.api.base.RpcBaseResponse; +import cn.stylefeng.roses.kernel.model.auth.AbstractLoginUser; +import cn.stylefeng.roses.kernel.model.auth.SysUser; +import cn.stylefeng.roses.kernel.model.enums.SystemMenu; +import cn.stylefeng.roses.system.api.context.LoginUser; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import java.util.Date; + +/** + * @program: IoT-Plat + * @description: 失败回调 + * @author: Mr.Liu + * @create: 2020-04-12 16:31 + **/ +@Component +@RequestMapping("/fallback/auth/api") +public class AuthUserComsumeuFallback implements AuthUserComsumer { + + @Override + @IotLog(value = "注册失败",type = LogType.FEIGN_DEFEAT) + public RpcBaseResponse register(AppUserWarpper appUserWarpper) { + return RpcBaseResponse.error("请稍后再试"); + } + + @Override + @IotLog(value = "更新头像失败",type = LogType.FEIGN_DEFEAT) + public RpcBaseResponse updateAvatar(MultipartFile files, String token) { + return RpcBaseResponse.error("请稍后再试"); + } + + @Override + @IotLog(value = "登陆失败",type = LogType.FEIGN_DEFEAT) + public RpcBaseResponse login(String account, String password, SystemMenu systemMenu) { + return RpcBaseResponse.error("请稍后再试"); + } + + @Override + @IotLog(value = "校验失败",type = LogType.FEIGN_DEFEAT) + public boolean checkToken(String token) { + return false; + } + + @Override + @IotLog(value = "退出失败",type = LogType.FEIGN_DEFEAT) + public void logout(String token) { + + } + + @Override + @IotLog(value = "获取用户信息失败",type = LogType.FEIGN_DEFEAT) + public RpcBaseResponse getLoginUserByToken(String token) { + return RpcBaseResponse.error("请稍后再试"); + } + + @Override + public SysUser getUserByToken(String token) { + return null; + } + + @Override + @IotLog(value = "获取用户ID失败",type = LogType.FEIGN_DEFEAT) + public Long getLoginUserIdByToken(String token) { + return null; + } + + @Override + @IotLog(value = "更新用户信息失败",type = LogType.FEIGN_DEFEAT) + public RpcBaseResponse updateLoginUserByToken(String token, AppUserWarpper userWarpper) { + return RpcBaseResponse.error("请稍后再试"); + } + + @Override + public RpcBaseResponse updatePasswordByToken(String token, String password) { + return null; + } +} diff --git a/saltice-monitor-feign/target/classes/cn/ljobin/bibi/feign/AuthUserComsumer.class b/saltice-monitor-feign/target/classes/cn/ljobin/bibi/feign/AuthUserComsumer.class new file mode 100644 index 0000000000000000000000000000000000000000..08d2b06a015e86ff7989fc4b6fee81da4a585561 Binary files /dev/null and b/saltice-monitor-feign/target/classes/cn/ljobin/bibi/feign/AuthUserComsumer.class differ diff --git a/saltice-monitor-feign/target/classes/cn/ljobin/bibi/feign/fallback/AuthUserComsumeuFallback.class b/saltice-monitor-feign/target/classes/cn/ljobin/bibi/feign/fallback/AuthUserComsumeuFallback.class new file mode 100644 index 0000000000000000000000000000000000000000..a85a1a80d62f65fac860eb6cb7217fece84eaedc Binary files /dev/null and b/saltice-monitor-feign/target/classes/cn/ljobin/bibi/feign/fallback/AuthUserComsumeuFallback.class differ diff --git a/saltice-monitor-iot/pom.xml b/saltice-monitor-iot/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..22292c838b09409aab939f719afd23cf5b74b834 --- /dev/null +++ b/saltice-monitor-iot/pom.xml @@ -0,0 +1,98 @@ + + + + 4.0.0 + + cn.ljobin.bibi + saltice-monitor-iot + 1.0-SNAPSHOT + + + cn.ljobin.bibi + IoT-monitor + 1.0-SNAPSHOT + + + + UTF-8 + 1.8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-activemq + + + cn.stylefeng.roses + kernel-model + + + cn.stylefeng.roses + kernel-core + provided + + + org.springframework.boot + spring-boot-starter-web + + + cn.ljobin.bibi + saltice-monitor-api + 1.0-SNAPSHOT + + + cn.ljobin.bibi + saltice-monitor-common + 1.0-SNAPSHOT + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + + + diff --git a/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/EmailMapper.java b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/EmailMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..a2397993e81e9699c69ab756062b37f081ea5a1b --- /dev/null +++ b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/EmailMapper.java @@ -0,0 +1,18 @@ +package cn.ljobin.bibi.mapper; + +import cn.ljobin.bibi.domain.monitor.MonitorEmail; +import cn.ljobin.bibi.domain.pot.TbIoterminal; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 盆栽信息Mapper接口 + * + * @author lyb + * @date 2020-04-21 + */ +@Mapper +public interface EmailMapper extends BaseMapper +{ +} diff --git a/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/EmailRePushMapper.java b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/EmailRePushMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..69c3e5184b32d216a351621a79498fcd99862700 --- /dev/null +++ b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/EmailRePushMapper.java @@ -0,0 +1,17 @@ +package cn.ljobin.bibi.mapper; + +import cn.ljobin.bibi.domain.monitor.MonitorEmail; +import cn.ljobin.bibi.domain.monitor.MonitorEmailRepush; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 盆栽信息Mapper接口 + * + * @author lyb + * @date 2020-04-21 + */ +@Mapper +public interface EmailRePushMapper extends BaseMapper +{ +} diff --git a/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/MonitorMessageMapper.java b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/MonitorMessageMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..1b2887e75f34476b0eddefd6866c279ff67218e1 --- /dev/null +++ b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/MonitorMessageMapper.java @@ -0,0 +1,17 @@ +package cn.ljobin.bibi.mapper; + +import cn.ljobin.bibi.domain.monitor.MonitorEmail; +import cn.ljobin.bibi.domain.monitor.MonitorMessage; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 盆栽信息Mapper接口 + * + * @author lyb + * @date 2020-04-21 + */ +@Mapper +public interface MonitorMessageMapper extends BaseMapper +{ +} diff --git a/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/EmailMapper.xml b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/EmailMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..c0a53df721c73c022f1afc39e530e8b669fb1a16 --- /dev/null +++ b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/EmailMapper.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + id, linkInfo, `type`, body, pushTime + + + \ No newline at end of file diff --git a/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/EmailRePushMapper.xml b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/EmailRePushMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..62a2bd814ccd6594be67a8a8321e2e454cbea191 --- /dev/null +++ b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/EmailRePushMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + id, linkInfo, `type`, body, oldPushTime,num,already_dead + + + \ No newline at end of file diff --git a/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/MonitorMessageMapper.xml b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/MonitorMessageMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..2f2acd6e843bd477cd0ced4b979d07ebc95f8c5a --- /dev/null +++ b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/mapper/mapping/MonitorMessageMapper.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + id,clientId, linkInfo, `type`, ploy, insertTime,title,messageType + + + \ No newline at end of file diff --git a/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/IEmailRePushService.java b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/IEmailRePushService.java new file mode 100644 index 0000000000000000000000000000000000000000..0f6a899d8080371e67cc3ecb4a010b36102c15b5 --- /dev/null +++ b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/IEmailRePushService.java @@ -0,0 +1,15 @@ +package cn.ljobin.bibi.service; + +import cn.ljobin.bibi.domain.monitor.MonitorEmail; +import cn.ljobin.bibi.domain.monitor.MonitorEmailRepush; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * 盆栽信息Service接口 + * + * @author lyb + * @date 2020-04-21 + */ +public interface IEmailRePushService extends IService +{ +} diff --git a/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/IEmailService.java b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/IEmailService.java new file mode 100644 index 0000000000000000000000000000000000000000..62eaf2416404c7b1cdd57c2d32ddb2a95f621fa9 --- /dev/null +++ b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/IEmailService.java @@ -0,0 +1,20 @@ +package cn.ljobin.bibi.service; + +import cn.ljobin.bibi.domain.monitor.MonitorEmail; +import cn.ljobin.bibi.domain.monitor.MonitorMessage; +import cn.ljobin.bibi.domain.pot.TbIoterminal; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * email发送服务 + * + * @author lyb + * @date 2020-04-21 + */ +public interface IEmailService extends IService { + /** + * 消费消息 + * @param monitorMessage + */ + public void recodeMonitorMsg(MonitorMessage monitorMessage); +} diff --git a/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/IMonitorMessageService.java b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/IMonitorMessageService.java new file mode 100644 index 0000000000000000000000000000000000000000..fe73a2dbd8d10aecdd9a92c24dd9fccdeb16a565 --- /dev/null +++ b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/IMonitorMessageService.java @@ -0,0 +1,15 @@ +package cn.ljobin.bibi.service; + +import cn.ljobin.bibi.domain.monitor.MonitorEmail; +import cn.ljobin.bibi.domain.monitor.MonitorMessage; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * 盆栽信息Service接口 + * + * @author lyb + * @date 2020-04-21 + */ +public interface IMonitorMessageService extends IService +{ +} diff --git a/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/Impl/EmailRePushServiceImpl.java b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/Impl/EmailRePushServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..c6261bc54997ee7bdab2caabfbca6a970ac8b473 --- /dev/null +++ b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/Impl/EmailRePushServiceImpl.java @@ -0,0 +1,18 @@ +package cn.ljobin.bibi.service.Impl; + +import cn.ljobin.bibi.domain.monitor.MonitorEmailRepush; +import cn.ljobin.bibi.mapper.EmailRePushMapper; +import cn.ljobin.bibi.service.IEmailRePushService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * 盆栽信息Service业务层处理 + * + * @author lyb + * @date 2020-04-21 + */ +@Service +public class EmailRePushServiceImpl extends ServiceImpl implements IEmailRePushService +{ +} diff --git a/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/Impl/EmailServiceImpl.java b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/Impl/EmailServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..8a2506c30d211a332c84dd446d5cc74fca5fe434 --- /dev/null +++ b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/Impl/EmailServiceImpl.java @@ -0,0 +1,31 @@ +package cn.ljobin.bibi.service.Impl; + +import cn.ljobin.bibi.domain.monitor.MonitorEmail; +import cn.ljobin.bibi.domain.monitor.MonitorMessage; +import cn.ljobin.bibi.mapper.EmailMapper; +import cn.ljobin.bibi.service.IEmailService; +import cn.ljobin.bibi.utils.email.BaseMailSend; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; + +/** + * 盆栽信息Service业务层处理 + * + * @author lyb + * @date 2020-04-21 + */ +@Service +public class EmailServiceImpl extends ServiceImpl implements IEmailService { + /** + * 发送邮件 + */ + //@Resource(name = "sendQqMailUtil") + @Resource(name = "sprBooEmailUtil") + private BaseMailSend sendQQMailUtil; + + @Override + public void recodeMonitorMsg(MonitorMessage monitorMessage) { + sendQQMailUtil.sendEmail(monitorMessage); + } +} diff --git a/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/Impl/MonitorMessageServiceImpl.java b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/Impl/MonitorMessageServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..f9dd4a1891982ee9eee10eec7afe51543eaabe5e --- /dev/null +++ b/saltice-monitor-iot/src/main/java/cn/ljobin/bibi/service/Impl/MonitorMessageServiceImpl.java @@ -0,0 +1,21 @@ +package cn.ljobin.bibi.service.Impl; + +import cn.ljobin.bibi.domain.monitor.MonitorEmail; +import cn.ljobin.bibi.domain.monitor.MonitorMessage; +import cn.ljobin.bibi.mapper.EmailMapper; +import cn.ljobin.bibi.mapper.MonitorMessageMapper; +import cn.ljobin.bibi.service.IEmailService; +import cn.ljobin.bibi.service.IMonitorMessageService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * 盆栽信息Service业务层处理 + * + * @author lyb + * @date 2020-04-21 + */ +@Service +public class MonitorMessageServiceImpl extends ServiceImpl implements IMonitorMessageService +{ +} diff --git a/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/EmailMapper.class b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/EmailMapper.class new file mode 100644 index 0000000000000000000000000000000000000000..01f284c8e9ffda7c5457ca009d2d7442a4bb732b Binary files /dev/null and b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/EmailMapper.class differ diff --git a/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/EmailRePushMapper.class b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/EmailRePushMapper.class new file mode 100644 index 0000000000000000000000000000000000000000..739449d3dfa7dc32caf28c13159950be4f6a01f5 Binary files /dev/null and b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/EmailRePushMapper.class differ diff --git a/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/MonitorMessageMapper.class b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/MonitorMessageMapper.class new file mode 100644 index 0000000000000000000000000000000000000000..e12154073bf0a7e2b2aab8746c7a5ffc7fbfdc86 Binary files /dev/null and b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/MonitorMessageMapper.class differ diff --git a/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/mapping/EmailMapper.xml b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/mapping/EmailMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..c0a53df721c73c022f1afc39e530e8b669fb1a16 --- /dev/null +++ b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/mapping/EmailMapper.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + id, linkInfo, `type`, body, pushTime + + + \ No newline at end of file diff --git a/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/mapping/EmailRePushMapper.xml b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/mapping/EmailRePushMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..62a2bd814ccd6594be67a8a8321e2e454cbea191 --- /dev/null +++ b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/mapping/EmailRePushMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + id, linkInfo, `type`, body, oldPushTime,num,already_dead + + + \ No newline at end of file diff --git a/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/mapping/MonitorMessageMapper.xml b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/mapping/MonitorMessageMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..2f2acd6e843bd477cd0ced4b979d07ebc95f8c5a --- /dev/null +++ b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/mapper/mapping/MonitorMessageMapper.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + id,clientId, linkInfo, `type`, ploy, insertTime,title,messageType + + + \ No newline at end of file diff --git a/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/IEmailRePushService.class b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/IEmailRePushService.class new file mode 100644 index 0000000000000000000000000000000000000000..10ef66cb10d01a85542b7fcbfac59b8c25146fa5 Binary files /dev/null and b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/IEmailRePushService.class differ diff --git a/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/IEmailService.class b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/IEmailService.class new file mode 100644 index 0000000000000000000000000000000000000000..522cbcbb2f75d9bda11ed52ab3c8fd613a074c03 Binary files /dev/null and b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/IEmailService.class differ diff --git a/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/IMonitorMessageService.class b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/IMonitorMessageService.class new file mode 100644 index 0000000000000000000000000000000000000000..fcee397eb0a3cc88a70ca0ccd9c2888d2955a1aa Binary files /dev/null and b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/IMonitorMessageService.class differ diff --git a/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/Impl/EmailRePushServiceImpl.class b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/Impl/EmailRePushServiceImpl.class new file mode 100644 index 0000000000000000000000000000000000000000..461da0921a9e137a1e19cf57b165a1ee242128b1 Binary files /dev/null and b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/Impl/EmailRePushServiceImpl.class differ diff --git a/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/Impl/EmailServiceImpl.class b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/Impl/EmailServiceImpl.class new file mode 100644 index 0000000000000000000000000000000000000000..54e8d5e02877c633730a44ad7922cd33dbc64ffc Binary files /dev/null and b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/Impl/EmailServiceImpl.class differ diff --git a/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/Impl/MonitorMessageServiceImpl.class b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/Impl/MonitorMessageServiceImpl.class new file mode 100644 index 0000000000000000000000000000000000000000..50b6debf9d365788ca77646cfe383418d830fd4e Binary files /dev/null and b/saltice-monitor-iot/target/classes/cn/ljobin/bibi/service/Impl/MonitorMessageServiceImpl.class differ