huliguo
15 小时以前 2494e3538d2ca2003f250b3f75283a9444442068
guns-admin/src/main/java/com/stylefeng/guns/modular/api/PatrolTaskController.java
@@ -26,6 +26,9 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.*;
import java.util.stream.Collectors;
@@ -224,8 +227,10 @@
         @ApiImplicitParam(value = "任务类型", name = "type", dataType = "int"),
         @ApiImplicitParam(value = "任务名称", name = "name", dataType = "String"),
         @ApiImplicitParam(value = "系统审核状态(1=未执行,2=正常,3=异常)", name = "sysStatus", dataType = "int"),
         @ApiImplicitParam(value = "执行时间范围(开始时间)", name = "startTime", dataType = "String"),
         @ApiImplicitParam(value = "执行时间范围(结束时间)", name = "endTime", dataType = "String"),
   })
   public void downloadTaskRecord(String ids, String code, String status,Integer type, String name, Integer sysStatus,HttpServletResponse response){
   public void downloadTaskRecord(String ids, String code, String status,Integer type, String name, Integer sysStatus,String startTime ,String endTime,HttpServletResponse response){
      List<String> id = null;
      if(ToolUtil.isNotEmpty(ids)){
         String[] split = ids.split(",");
@@ -239,7 +244,19 @@
               .collect(Collectors.toList());
      }
      taskDetailService.downloadTaskRecord(id, code, statusList,sysStatus,type,name, response);
      LocalDateTime startTime2 = null;
      LocalDateTime endTime2 = null;
      // 定义匹配前端时间格式的解析器(处理带毫秒和Z的情况)
      DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
      try {
         // 解析为LocalDateTime(Z代表UTC时区,这里直接按字符串处理)
         startTime2 = LocalDateTime.parse(startTime, formatter);
         endTime2 = LocalDateTime.parse(endTime, formatter);
      } catch (DateTimeParseException e) {
         System.err.println("时间格式错误 " );
      }
      taskDetailService.downloadTaskRecord(id, code, statusList,sysStatus,type,name,startTime2,endTime2,response);
   }