feiyu02
2025-09-30 6904763f0e74d9a9fa4dbc39f635d2aee39416c6
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
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 cn.flightfeather.supervision.lightshare.vo.UserSearchCondition
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
import javax.servlet.http.HttpServletResponse
 
@Api(tags = ["评估总分API接口"])
@RestController
@RequestMapping("/evaluation")
class EvaluationController(val evaluationService: EvaluationService) {
    @ApiOperation(value = "获取所有评估总分")
    @GetMapping
    fun getAll() = evaluationService.findAll()
 
    @ApiOperation(value = "上传一条评估总分记录")
    @PutMapping
    fun add(
        @ApiParam(value = "评估数据") @RequestBody evaluation: Evaluation,
    ) = evaluationService.save(evaluation)
 
    @ApiOperation(value = "更新一条评估总分记录")
    @PostMapping
    fun update(@ApiParam(value = "评估数据") @RequestBody evaluation: Evaluation) = evaluationService.update(evaluation)
 
    @ApiOperation(value = "查找一条评估总分记录")
    @GetMapping("/{id}")
    fun getById(@ApiParam(value = "评估信息主键id") @PathVariable id: String) = evaluationService.findOne(id)
 
    @ApiOperation(value = "删除一条评估总分记录")
    @DeleteMapping("/{id}")
    fun delete(@ApiParam(value = "评估信息主键id") @PathVariable id: String) = evaluationService.delete(id)
 
    @ApiOperation(value = "根据条件查询评估总分")
    @GetMapping("/totalPoint/{userId}")
    fun getT(
        @ApiParam(value = "用户id") @PathVariable("userId") userId: String,
        @ApiParam(value = "评估类型") @RequestParam("evaluatorType") evaluatorType: Int,
        @ApiParam(value = "开始时间") @RequestParam("startTime") startTime: String,
        @ApiParam(value = "结束时间") @RequestParam("endTime") endTime: String,
        @ApiParam(value = "场景类型id") @RequestParam("sceneTypeId", required = false) sceneTypeId: Int?,
        @ApiParam(value = "子任务id") @RequestParam("erGuid", required = false) erGuid: String?,
        @ApiParam(value = "评估信息主键id") @RequestParam("eId", required = false) eId: String?,
    ) = evaluationService.getTotalPoints(userId, evaluatorType, startTime, endTime, sceneTypeId, erGuid, eId)
 
    @ApiOperation(value = "获取用户评估总分")
    @GetMapping("/historyPoint/{userId}")
    fun getHistoryPoint(
        @ApiParam(value = "用户id") @PathVariable("userId") userId: String,
        @ApiParam(value = "页码") @RequestParam(value = "page") page: Int,
        @ApiParam(value = "单页数据量") @RequestParam(value = "per_page") perPage: Int,
        @ApiParam(value = "前端平台") @RequestParam("platform", required = false) platform: String?,
        @ApiParam(value = "评分周期") @RequestParam("period", required = false) period: String?,
        response: HttpServletResponse,
    ) = evaluationService.getHistoryPoint(userId, page, perPage, platform, period, response)
 
    @ApiOperation(value = "获取信用评估结果")
    @GetMapping("/creditInfo")
    fun getCreditInfo(
        @ApiParam(value = "用户id") @RequestParam("userId") userId: String,
        @ApiParam(value = "周期") @RequestParam(value = "period", required = false) period: String?,
    ) = evaluationService.getCreditInfo(userId, period)
 
    @ApiOperation(value = "获取信用评估结果")
    @PostMapping("/credit/count")
    fun getCreditCount(
        @ApiParam(value = "用户id") @RequestParam("userId") userId: String,
        @ApiParam("查询条件") @RequestBody condition: UserSearchCondition,
    ) = evaluationService.getCreditCount(userId, condition)
 
    @ApiOperation(value = "获取某个用户的信用评估结果")
    @PostMapping("/search/{userId}")
    fun getAssessments(
        @ApiParam(value = "用户id") @PathVariable("userId") userId: String,
        @ApiParam(value = "查询条件") @RequestBody condition: AssessmentSearchCondition,
        @ApiParam(value = "页码") @RequestParam(value = "page") page: Int,
        @ApiParam(value = "单页数据量") @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)
 
 
    @ApiOperation(value = "上传自评得分")
    @PostMapping("/upload")
    fun uploadScore(
        @ApiParam(value = "用户id") @RequestParam("userId") userId: String,
        @ApiParam(value = "评分周期") @RequestParam("period") period: String,
        @ApiParam(value = "评分规则id") @RequestParam(value = "ruleId", required = false) ruleId: String?,
        @ApiParam(value = "具体扣分条目(只传最小级别的评估项)") @RequestBody itemList: List<Pair<String, String>>,
    ) = evaluationService.uploadScore(userId, period, ruleId, itemList)
 
    @ApiOperation(value = "获取测评详情")
    @GetMapping("/detail")
    fun getDetail(
        @ApiParam(value = "用户id") @RequestParam("userId") userId: String,
        @ApiParam(value = "评分周期") @RequestParam("period") period: String,
    ) = evaluationService.getDetail(userId, period)
 
    @ApiOperation(value = "获取用户评分信息,自评或环形码评估")
    @PostMapping("/gradeList")
    fun searchGradeList(
        @ApiParam("用户id") @RequestParam("userId") userId: String,
        @ApiParam("查询条件") @RequestBody condition: UserSearchCondition,
        @ApiParam("页码") @RequestParam(value = "page") page: Int,
        @ApiParam("单页数据量") @RequestParam(value = "per_page") perPage: Int,
    ) = evaluationService.searchGradeList(userId, condition, page, perPage)
}