riku
2021-09-24 4f1b7973c53b45f57e451191bfd5a3d2136a004c
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
package cn.flightfeather.supervision.lightshare.web
 
import cn.flightfeather.supervision.domain.entity.Evaluation
import cn.flightfeather.supervision.lightshare.service.EvaluationService
import cn.flightfeather.supervision.lightshare.vo.AssessmentSearchCondition
import io.swagger.annotations.Api
import org.springframework.web.bind.annotation.*
import javax.servlet.http.HttpServletResponse
 
@Api(tags = ["评估总分API接口"])
@RestController
@RequestMapping("/evaluation")
class EvaluationController(val evaluationService: EvaluationService) {
    @GetMapping
    fun getAll() = evaluationService.findAll()
 
    @PutMapping
    fun add(@RequestBody evaluation: Evaluation) = evaluationService.save(evaluation)
 
    @PostMapping
    fun update(@RequestBody evaluation: Evaluation) = evaluationService.update(evaluation)
 
    @GetMapping("/{id}")
    fun getById(@PathVariable id: String) = evaluationService.findOne(id)
 
    @DeleteMapping("/{id}")
    fun delete(@PathVariable id: String) = evaluationService.delete(id)
 
    @GetMapping("/totalPoint/{userId}")
    fun getT(
            @PathVariable("userId") userId: String,
            @RequestParam("evaluatorType") evaluatorType: Int,
            @RequestParam("startTime") startTime: String,
            @RequestParam("endTime") endTime: String,
            @RequestParam("sceneTypeId", required = false) sceneTypeId: Int?,
            @RequestParam("erGuid", required = false) erGuid: String?,
            @RequestParam("eId", required = false) eId: String?
    ) = evaluationService.getTotalPoints(userId, evaluatorType, startTime, endTime, sceneTypeId, erGuid, eId)
 
    @GetMapping("/historyPoint/{userId}")
    fun getHistoryPoint(
            @PathVariable("userId") userId: String,
            @RequestParam(value = "page") page: Int,
            @RequestParam(value = "per_page") perPage: Int,
            response: HttpServletResponse
    ) = evaluationService.getHistoryPoint(userId, page, perPage, response)
 
    @GetMapping("/creditInfo")
    fun getCreditInfo(
            @RequestParam("userId") userId: String
    ) = evaluationService.getCreditInfo(userId)
 
    @PostMapping("/search/{userId}")
    fun getAssessments(
            @PathVariable("userId") userId: String,
            @RequestBody condition: AssessmentSearchCondition,
            @RequestParam(value = "page") page: Int,
            @RequestParam(value = "per_page") perPage: Int,
            response: HttpServletResponse
    ) = evaluationService.getAssessments(userId, condition, page, perPage, response)
 
    fun autoScore(
            @RequestParam(value = "year") year: Int,
            @RequestParam(value = "month") month: Int,
            @RequestParam("sceneType") sceneType: Int,
            response: HttpServletResponse
    ) = evaluationService.autoScore(year, month, sceneType, response)
}