huliguo
16 小时以前 2494e3538d2ca2003f250b3f75283a9444442068
增加导出条件
6个文件已修改
39 ■■■■ 已修改文件
guns-admin/src/main/java/com/stylefeng/guns/modular/api/PatrolTaskController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/TaskDetailMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TaskDetailMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-admin/src/main/java/com/stylefeng/guns/modular/system/filter/WebFilterUtil.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITaskDetailService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TaskDetailServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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);
    }
    
    
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/TaskDetailMapper.java
@@ -9,6 +9,7 @@
import com.stylefeng.guns.modular.system.model.vo.TaskRecordListVo;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@@ -42,5 +43,5 @@
     * @param status
     * @return
     */
    List<Map<String, Object>> getDownloadTaskRecord(@Param("ids") List<String> ids, @Param("code") String code, @Param("status") List<Integer> status,@Param("sysStatus") Integer sysStatus,@Param("type") Integer type,@Param("typeName") String typeName);
    List<Map<String, Object>> getDownloadTaskRecord(@Param("ids") List<String> ids, @Param("code") String code, @Param("status") List<Integer> status, @Param("sysStatus") Integer sysStatus, @Param("type") Integer type, @Param("typeName") String typeName,  @Param("startTime")LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
}
guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TaskDetailMapper.xml
@@ -135,6 +135,12 @@
        <if test="null != typeName and '' != typeName">
            and c.name like CONCAT('%', #{typeName}, '%')
        </if>
        <if test="startTime != null">
            and b.execution_time >= #{startTime}
        </if>
        <if test="endTime != null">
            and b.execution_time &lt; #{endTime}
        </if>
        order by b.execution_time desc
    </select>
</mapper>
guns-admin/src/main/java/com/stylefeng/guns/modular/system/filter/WebFilterUtil.java
@@ -29,7 +29,7 @@
@WebFilter(urlPatterns = "/*")
public class WebFilterUtil implements Filter {
    /**
     * 截止时间 25年6月底
     * 截止时间 25年8月底
     */
    private Long thresholdValue =  1756655999000L;
    
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITaskDetailService.java
@@ -7,6 +7,7 @@
import com.stylefeng.guns.modular.system.util.ResultUtil;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.List;
/**
@@ -77,6 +78,6 @@
     * @param status
     * @param response
     */
    void downloadTaskRecord(List<String> ids, String code,List<Integer>   status,Integer sysStatus,Integer type,String typeName, HttpServletResponse response);
    void downloadTaskRecord(List<String> ids, String code, List<Integer>   status, Integer sysStatus, Integer type, String typeName, LocalDateTime startTime,LocalDateTime endTime, HttpServletResponse response);
}
guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TaskDetailServiceImpl.java
@@ -531,8 +531,8 @@
    }
    */
    @Override
    public void downloadTaskRecord(List<String> ids, String code, List<Integer> status,Integer sysStatus, Integer type,String typeName,HttpServletResponse response){
        List<Map<String, Object>> mapList = this.baseMapper.getDownloadTaskRecord(ids, code, status, sysStatus, type, typeName);
    public void downloadTaskRecord(List<String> ids, String code, List<Integer> status,Integer sysStatus, Integer type,String typeName,LocalDateTime startTime , LocalDateTime endTime,HttpServletResponse response){
        List<Map<String, Object>> mapList = this.baseMapper.getDownloadTaskRecord(ids, code, status, sysStatus, type, typeName,startTime,endTime);
        try {
            HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
            // 1. 按 name 分组(先获取所有唯一 name)