package cn.seecoder.data.server.controller; import cn.seecoder.data.server.repository.GeneralRecordRepository; import cn.seecoder.data.server.service.EvaluateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.Map; @RestController public class AnalysisController { @Autowired GeneralRecordRepository generalRecordRepository; @Autowired EvaluateService evaluateService; @RequestMapping("/score/{id}") public Map getEvaluate(@PathVariable("id") Integer id){ HashMap ans = new HashMap<>(); ans.put("helper",evaluateService.getQuestionScore(id,"helper")); ans.put("evaluate",evaluateService.getQuestionScore(id,"evaluate")); ans.put("playground",evaluateService.getQuestionScore(id,"playground")); ans.put("helper-week",evaluateService.getQuestionScoreByWeek(id,"helper")); ans.put("evaluate-week",evaluateService.getQuestionScoreByWeek(id,"evaluate")); ans.put("playground-week",evaluateService.getQuestionScoreByWeek(id,"playground")); return ans; } }