新增磁盘SMART检测汇报功能
This commit is contained in:
parent
fe10c4b686
commit
4bcf56207d
20
pom.xml
20
pom.xml
@ -41,7 +41,7 @@
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.22</version>
|
||||
<version>1.18.24</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@ -60,14 +60,14 @@
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>4.2.0</version>
|
||||
<version>4.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.80</version>
|
||||
<version>2.0.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.jcraft/jsch -->
|
||||
<dependency>
|
||||
@ -89,7 +89,7 @@
|
||||
<dependency>
|
||||
<groupId>net.bramp.ffmpeg</groupId>
|
||||
<artifactId>ffmpeg</artifactId>
|
||||
<version>0.6.2</version>
|
||||
<version>0.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.iflytek</groupId>
|
||||
@ -113,7 +113,12 @@
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>3.14.0</version>
|
||||
<version>3.14.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.drewnoakes</groupId>
|
||||
<artifactId>metadata-extractor</artifactId>
|
||||
<version>2.17.0</version>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@ -136,7 +141,10 @@
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
|
||||
<tasks>
|
||||
<echo>复制正式文件</echo>
|
||||
<copy file="src/main/resources/application.properties.release" tofile="${project.build.outputDirectory}/application.properties" overwrite="true"/>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
30
src/main/java/com/yutou/nas/Controllers/HHDController.java
Normal file
30
src/main/java/com/yutou/nas/Controllers/HHDController.java
Normal file
@ -0,0 +1,30 @@
|
||||
package com.yutou.nas.Controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.nas.utils.QQBotManager;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Controller
|
||||
public class HHDController {
|
||||
@ResponseBody
|
||||
@RequestMapping("/nas/hhd.do")
|
||||
public String hddSMART(@RequestBody JSONObject json){
|
||||
Pattern pattern=Pattern.compile(".(?<=(result: )).*");
|
||||
for (String key : json.keySet()) {
|
||||
Matcher matcher=pattern.matcher(json.getString(key));
|
||||
if(matcher.find()){
|
||||
String result=matcher.group(0).trim();
|
||||
if(!"PASSED".equals(result)){
|
||||
QQBotManager.getInstance().sendMessage("硬盘异常警告:"+key+":"+result);
|
||||
}
|
||||
}
|
||||
}
|
||||
return "服务已接收";
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@ import org.springframework.context.annotation.Import;
|
||||
@Import(BTDownloadManager.class)
|
||||
@SpringBootApplication
|
||||
public class NasApplication {
|
||||
public static final String version="1.2.11";
|
||||
public static final String version="1.2.12";
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(NasApplication.class, args);
|
||||
AppData.defaultMusicPath = (String) ConfigTools.load(ConfigTools.CONFIG, "musicDir");
|
||||
|
@ -4,4 +4,12 @@ public class StringUtils {
|
||||
public static boolean isEmpty(String str) {
|
||||
return str == null || str.trim().length() == 0;
|
||||
}
|
||||
|
||||
public static String toLowerCaseFirstOne(String s) {
|
||||
if (Character.isLowerCase(s.charAt(0))) {
|
||||
return s;
|
||||
} else {
|
||||
return Character.toLowerCase(s.charAt(0)) + s.substring(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user