feiyu02
2022-07-20 39e208b6b0482a25c77e53590087c02d9d937563
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
package cn.flightfeather.supervision.lightshare.web
 
import cn.flightfeather.supervision.lightshare.service.SearchService
import cn.flightfeather.supervision.lightshare.service.SubtaskService
import cn.flightfeather.supervision.lightshare.vo.ExcelConfigVo
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*
import springfox.documentation.annotations.ApiIgnore
import javax.servlet.http.HttpServletResponse
 
/**
 * @author riku
 * Date: 2020/6/12
 */
@Api(tags = ["SearchController"], description = "统计查询相关API接口")
@RestController
@RequestMapping("/search")
class SearchController(val subtaskService: SubtaskService) {
 
    @Autowired
    lateinit var searchService: SearchService
 
    @GetMapping("/subtask")
    fun searchSubTask(
        @RequestParam("token") token: String,
        @RequestParam("district_code", required = false) districtCode: String?,
        @RequestParam("scene_type", required = false) sceneType: Int?,
        @RequestParam("start_time", required = false) startTime: String?,
        @RequestParam("end_time", required = false) endTime: String?,
        @RequestParam("page", required = false) page: Int?,
        @RequestParam("per_page", required = false) perPage: Int?
    ) = subtaskService.searchSubTask(token, sceneType, districtCode, startTime, endTime, page, perPage)
 
    @GetMapping("/score")
    fun searchScore(
        @RequestParam("token") token: String,
        @RequestParam("year") year: Int,
        @RequestParam("month") month: Int,
        @RequestParam("page", required = false) page: Int?,
        @RequestParam("per_page", required = false) perPage: Int?
    ) = searchService.searchScore4JingAn(token, year, month, page, perPage)
 
    @GetMapping("/subtask/jinshan")
    fun searchSubTask2(
        @RequestParam("token") token: String,
        @RequestParam("update_time", required = false) updateTime: String?,
        @RequestParam("district_code", required = false) districtCode: String?,
        @RequestParam("scene_type", required = false) sceneType: Int?,
        @RequestParam("start_time", required = false) startTime: String?,
        @RequestParam("end_time", required = false) endTime: String?,
        @RequestParam("page", required = false) page: Int?,
        @RequestParam("per_page", required = false) perPage: Int?
    ) = subtaskService.searchSubTask2(token, updateTime, sceneType, districtCode, startTime, endTime, page, perPage)
 
    @GetMapping("/subtask/jinshan2")
    fun searchSubTask3(
        @RequestParam("token") token: String,
        @RequestParam("update_time", required = false) updateTime: String?,
        @RequestParam("district_code", required = false) districtCode: String?,
        @RequestParam("scene_type", required = false) sceneType: Int?,
        @RequestParam("start_time", required = false) startTime: String?,
        @RequestParam("end_time", required = false) endTime: String?,
        @RequestParam("page", required = false) page: Int?,
        @RequestParam("per_page", required = false) perPage: Int?
    ) = subtaskService.searchSubTask3(token, updateTime, sceneType, districtCode, startTime, endTime, page, perPage)
 
    @PostMapping("/subtask/excel")
    fun getExcel(
        @RequestBody config: ExcelConfigVo,
        @ApiIgnore response: HttpServletResponse
    ) = searchService.getExcel(config, response)
 
    @PostMapping("/subtask/detail")
    fun getExcel(
        @RequestBody config: ExcelConfigVo
    ) = searchService.getSubTaskDetail(config)
 
    @PostMapping("/subtask/pic/download")
    fun downloadPic(
        @RequestBody config: ExcelConfigVo,
        @ApiIgnore response: HttpServletResponse
    ) = searchService.downloadPic(config, response)
 
    @GetMapping("/subtask/pic/download2")
    fun downloadPic2(
        @RequestParam("sceneType") sceneType: Int,
        @RequestParam("topTaskId") topTaskId: String,
        @ApiIgnore response: HttpServletResponse
    ) = searchService.downloadPic2(sceneType, topTaskId, response)
 
    @ApiOperation("根据关键词和当前用户搜索子任务")
    @GetMapping("/subtask/keyword")
    fun searchByKeyword(
        @RequestParam("userId") userId: String,
        @RequestParam("keyword") keyword: String,
        @RequestParam("page") page: Int,
        @RequestParam("perPage") perPage: Int
    ) = searchService.searchSubTaskByKeyword(userId, keyword, page, perPage)
}