diff --git a/pom.xml b/pom.xml
index 64356c66..aa023c96 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
1.8
1.9.5
- 1.2.2
+ 1.12.0
2.2.1
7.6.11.v20130520
2.4
@@ -128,11 +128,11 @@
${junit.version}
test
-
- com.alibaba
- fastjson
- ${fastjson.version}
-
+
+
+
+
+
org.slf4j
diff --git a/src/main/java/com/emr/controller/TestController.java b/src/main/java/com/emr/controller/TestController.java
index 5712354b..e662aa01 100644
--- a/src/main/java/com/emr/controller/TestController.java
+++ b/src/main/java/com/emr/controller/TestController.java
@@ -1,11 +1,20 @@
package com.emr.controller;
import com.emr.service.ipml.CaSignServiceImpl;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
+import org.springframework.util.FileSystemUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
+import java.io.File;
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
/**
* @author 曾文和
@@ -16,13 +25,57 @@ import javax.annotation.Resource;
public class TestController {
@Resource
private CaSignServiceImpl caSignService;
+ @Value("${caCopyPath}")
+ private String caCopyPath;
+
@RequestMapping("font/test")
@ResponseBody
- public String test(String masterId) throws Exception{
+ public String test(String masterId) throws Exception {
long start = System.currentTimeMillis();
caSignService.caSignByMasterId(masterId);
long end = System.currentTimeMillis();
- System.out.println("执行后:"+(end-start));
+ System.out.println("执行后:" + (end - start));
return "完成";
}
+
+
+ /**
+ * 删除指定数据段的文件,
+ *
+ * @param args liuyu
+ */
+ public static void main(String[] args) {
+ Date date1 = new Date();
+ Calendar calendar = Calendar.getInstance(); //得到日历
+ calendar.setTime(date1);//把当前时间赋给日历
+ calendar.add(calendar.DATE, -15); //设置为前15天
+ Date date2 = calendar.getTime();//获取15天前的时间
+ DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+ Date date;
+ //转换成时间戳
+ long t1 = date2.getTime();
+ try {
+ File f = new File("D:\\docus\\caCopy");
+ File[] files = f.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ //获取文件路径
+ String filePath = files[i].getCanonicalPath();
+ //获取文件名,文件名为yyyy--mm--dd格式时间
+ String lastTime = files[i].getName();
+ //将lastTime时间转为long类型
+ try {
+ date = format.parse(lastTime);
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ Long timestamp = date.getTime();
+ if (timestamp < t1) {
+ //删除
+ FileSystemUtils.deleteRecursively(new File(filePath));
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
}
diff --git a/src/main/java/com/emr/controller/taskController.java b/src/main/java/com/emr/controller/taskController.java
index ad1dfe2a..785f71cd 100644
--- a/src/main/java/com/emr/controller/taskController.java
+++ b/src/main/java/com/emr/controller/taskController.java
@@ -46,6 +46,9 @@ public class taskController {
@Value("${autoPdfUrl}")
private String autoPdfUrl;
+ @Value("${waterTifToJpgPath}")
+ private String waterTifToJpgPath;
+
//@Scheduled(cron="0/1 * * * * ? ") //每1秒执行一次
@Scheduled(cron="${fileDelay}")//每天4点触发cron="0 0 4 * * ?"
public void task() throws IOException {
@@ -107,6 +110,13 @@ public class taskController {
} catch (IOException e) {
e.printStackTrace();
}
+ File file = new File(waterTifToJpgPath);
+ if (file.isDirectory()) {
+ for (File f : file.listFiles()) {
+ f.delete();
+ }
+ }
+
}
diff --git a/src/main/resources/config/jdbc.properties b/src/main/resources/config/jdbc.properties
index ace8683f..8fbdb9e8 100644
--- a/src/main/resources/config/jdbc.properties
+++ b/src/main/resources/config/jdbc.properties
@@ -72,4 +72,6 @@ pdfWater = \u5E7F\u4E1C\u533B\u79D1\u5927\u5B66\u9644\u5C5E\u533B\u9662
#POWER_URLHEAD=http://120.27.212.36:8888/power
#power\u6743\u9650\u7CFB\u7EDF\u7684\u670D\u52A1\u5668\u5730\u5740\u5934\u5982\uFF1Ahttp://192.168.1.3:8081/power
-PdfIsError = C:\\Users\\Administrator\\Desktop\\test\\test070802
\ No newline at end of file
+PdfIsError = C:\\Users\\Administrator\\Desktop\\test\\test070802
+
+waterTifToJpgPath = D:/jiashi/tifToJpgLoad/
\ No newline at end of file