feiyu02
2022-09-23 497475defd5d0ebf90ae6a8e2b080a16d78043ab
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
package cn.flightfeather.supervision.lightshare.web
 
import cn.flightfeather.supervision.domain.entity.OnLineQuestion
import cn.flightfeather.supervision.lightshare.service.OnLineQuestionService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
 
@Api(tags = ["在线咨询API接口"])
@RestController
@RequestMapping("/consultation")
class ConsultationController(val onLineQuestionService: OnLineQuestionService) {
 
    @ApiOperation(value = "提出咨询问题")
    @PostMapping("/add/{userId}")
    fun add(
        @ApiParam(value = "用户id") @PathVariable userId: String,
        @ApiParam(value = "咨询问题") @RequestBody questions: List<OnLineQuestion>
    ) = onLineQuestionService.addQuestions(userId, questions)
 
    @ApiOperation(value = "根据关键字搜索法律法规")
    @GetMapping("/search/law")
    fun searchLaw(
        @ApiParam(value = "用户id") @RequestParam userId: String,
        @ApiParam(value = "关键字") @RequestParam keyword: String,
        @ApiParam(value = "搜索结果的类型", required = false) @RequestParam type: Byte?,
        @ApiParam(value = "页码") @RequestParam page: Int,
        @ApiParam(value = "单页数据量") @RequestParam perPage: Int,
    ) = onLineQuestionService.searchLaw(userId, keyword, type, page, perPage)
 
    @ApiOperation(value = "获取热门法律法规")
    @GetMapping("/topic/law")
    fun getTopicLaw(
        @ApiParam(value = "用户id") @RequestParam userId: String,
    ) = onLineQuestionService.getTopicLaw(userId)
 
    @ApiOperation(value = "获取热门法律法规条目")
    @GetMapping("/topic/item")
    fun getTopicMgtItems(
        @ApiParam(value = "用户id") @RequestParam userId: String,
    ) = onLineQuestionService.getTopicMgtItems(userId)
 
    @ApiOperation(value = "获取热门问答")
    @GetMapping("/topic/qa")
    fun getTopicQA(
        @ApiParam(value = "用户id") @RequestParam userId: String,
    ) = onLineQuestionService.getTopicQA(userId)
 
    @ApiOperation(value = "获取热门案例")
    @GetMapping("/topic/case")
    fun getTopicCase(
        @ApiParam(value = "用户id") @RequestParam userId: String,
    ) = onLineQuestionService.getTopicCase(userId)
 
    @ApiOperation(value = "获取法律法规文件")
    @GetMapping("/law/file")
    fun getMgtFile(
            @ApiParam(value = "用户id") @RequestParam userId: String,
            @ApiParam(value = "文件id") @RequestParam fileId: String,
    ) = onLineQuestionService.getMgtFile(userId, fileId)
 
    @ApiOperation(value = "获取法律法规条目")
    @GetMapping("/law/item")
    fun getMgtItem(
        @ApiParam(value = "用户id") @RequestParam userId: String,
        @ApiParam(value = "条目id") @RequestParam itemId: String,
    ) = onLineQuestionService.getMgtItem(userId, itemId)
 
    @ApiOperation(value = "获取问题")
    @GetMapping("/law/question")
    fun getQuestion(
        @ApiParam(value = "用户id") @RequestParam userId: String,
        @ApiParam(value = "问题id") @RequestParam qId: String,
    ) = onLineQuestionService.getQuestion(userId, qId)
 
    @ApiOperation(value = "获取答案")
    @GetMapping("/law/answer")
    fun getAnswers(
        @ApiParam(value = "用户id") @RequestParam userId: String,
        @ApiParam(value = "问题id") @RequestParam qId: String,
    ) = onLineQuestionService.getAnswers(userId, qId)
 
    @ApiOperation(value = "获取案例")
    @GetMapping("/law/case")
    fun getCase(
        @ApiParam(value = "用户id") @RequestParam userId: String,
        @ApiParam(value = "案例id") @RequestParam caseId: String,
    ) = onLineQuestionService.getCase(userId, caseId)
 
    @ApiOperation(value = "获取问题")
    @GetMapping("/question/type")
    fun getQuestionsByType(
        @ApiParam(value = "用户id") @RequestParam userId: String,
        @ApiParam(value = "要素大类", required = false) @RequestParam kind: Byte?,
        @ApiParam(value = "要素小类", required = false) @RequestParam subKind: Byte?,
        @ApiParam(value = "页码") @RequestParam page: Int,
        @ApiParam(value = "单页数据量") @RequestParam perPage: Int,
    ) = onLineQuestionService.getQuestionsByType(userId, kind, subKind, page, perPage)
 
    @ApiOperation(value = "获取环保要素大类")
    @GetMapping("/elementtype")
    fun getEnElementTypes(
        @ApiParam(value = "用户id") @RequestParam userId: String,
    ) = onLineQuestionService.getEnElementTypes(userId)
 
    @ApiOperation(value = "获取环保要素小类")
    @GetMapping("/elementsubtype")
    fun getEnElementSubTypes(
        @ApiParam(value = "用户id") @RequestParam userId: String,
    ) = onLineQuestionService.getEnElementSubTypes(userId)
}