严智鑫
2025-11-13 945bc394f40d8af1072a53da9a94f24207124e6d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package com.northglass.web.reportmanage;
 
 
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
 
import com.northglass.entity.BreakReport;
import com.northglass.entity.ReportTask;
import com.northglass.repository.ReportTaskDao;
import com.northglass.service.manage.ManageService;
import com.northglass.service.reportmanage.ReportManageService;
 
/**
 * 任务统计管理
 * @author GO1
 *
 */
@Controller
@RequestMapping(value="/reportmanage")
public class ReportManageController {
    
    private static final Logger LOGGER = LoggerFactory.getLogger(ReportManageController.class);
    
    @Autowired
    ReportTaskDao reportTaskDao;
    
    @Autowired
    ReportManageService reportManageService;
    
    @Autowired
    ManageService manageService;
    /**
     * 进入任务统计界面
     * @return
     */
    @RequestMapping(method=RequestMethod.GET, value="/taskreport/{id}")
    public String getTaskReportPage(Model model,@PathVariable("id") int id){
        //处理id号线的统计任务
        List<ReportTask> reportTask = reportManageService.reportTask((long) id);
        model.addAttribute("reportTasks", reportTask);
        model.addAttribute("groups", id);
        return "reporttask/reportTask";
    }
    
    /**
     * 通过点击optname查看详细信息
     * @return
     */
    @RequestMapping(method=RequestMethod.GET, value="/lookinfobyoptname")
    public String lookInfoByOptname(HttpServletRequest request,Model model){
        //获取点击的optname
        List<ReportTask> reportTasks = reportManageService.lookDetailsByOptname(request);
        model.addAttribute("reportTasks", reportTasks);
        return "reporttask/reportTaskDetails";
    }
    
    
    /**
     * 破损统计页面
     * @return
     */
    @RequestMapping(method=RequestMethod.GET, value="/breakreport")
    public String breakReport(Model model){
        //获取点击的optname
        List<BreakReport> breakReports = reportManageService.breakReport("01");
        model.addAttribute("breakReports", breakReports);
        return "reporttask/breakReports";
    }
    
    /**
     * 破损统计页面(2号)
     * @return
     */
    @RequestMapping(method=RequestMethod.GET, value="/breakreport2")
    public String breakReport2(Model model){
        //获取点击的optname
        List<BreakReport> breakReports = reportManageService.breakReport("02");
        model.addAttribute("breakReports", breakReports);
        return "reporttask/breakReports";
    }
    
    /**
     * 根据条件查询统计信息(1号线)
     * @return
     * @throws ParseException 
     */
    @RequestMapping(method=RequestMethod.POST, value="/selectreport")
    public String selectReport(HttpServletRequest request,Model model) throws ParseException{
        //获取点击的optname
        int groups = Integer.valueOf(request.getParameter("groups"));
        List<ReportTask> reportTasks = reportManageService.selectReport(request, groups);
        model.addAttribute("reportTasks", reportTasks);
        model.addAttribute("groups", groups);
        return "reporttask/reportTask";
    }
    
    
    /**
     * 将查询的统计信息生成Excel表格
     * @param model
     * @param response
     * @param request
     */
    @RequestMapping(method=RequestMethod.GET,value="/downloadExcel")
    public void downloadExcel(Model model,HttpServletResponse response, HttpServletRequest request){
         reportManageService.generateExcelFile(request,response);
    }
}