|
@@ -37,6 +37,8 @@ import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.joda.time.DateTime;
|
|
|
+import org.joda.time.Days;
|
|
|
+import org.joda.time.Months;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -47,10 +49,7 @@ import java.io.ByteArrayInputStream;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
import java.io.InputStream;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.zip.ZipEntry;
|
|
|
import java.util.zip.ZipOutputStream;
|
|
@@ -391,6 +390,21 @@ public class PersonDeviceLogController {
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
+ //起始时间和截止时间不能超过1一个月
|
|
|
+ if(searchParams.get("beginTime")==null || searchParams.get("endTime")==null){
|
|
|
+ throw new Exception("导出时间段不能为空!");
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ DateTime beginTime = new DateTime(sdf.parse(searchParams.get("beginTime").toString()));
|
|
|
+ DateTime endTime = new DateTime(sdf.parse(searchParams.get("endTime").toString()));
|
|
|
+
|
|
|
+ int days = Days.daysBetween(beginTime,endTime).getDays();
|
|
|
+
|
|
|
+ if(days>31){
|
|
|
+ throw new Exception("导出时间段不能超过1个月!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
while(pageNum<=totalPages){
|
|
|
Page<PersonDeviceLog> page = personDeviceLogService.pageSearch(searchParams, pageNum, pageSize, needCount, sortList);
|
|
|
|