|
@@ -0,0 +1,71 @@
|
|
|
+package cn.com.qmth.examcloud.bridge.modules.swjtu.controller;
|
|
|
+
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import com.google.common.collect.Maps;
|
|
|
+
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.ExamScoreDataCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.bean.ScoreDataBean;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.request.GetFinalScoreDataReq;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.response.GetFinalScoreDataResp;
|
|
|
+import cn.com.qmth.examcloud.examwork.api.ExamCloudService;
|
|
|
+import cn.com.qmth.examcloud.web.bootstrap.PropertyHolder;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("swjtu")
|
|
|
+public class SwjtuController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ExamCloudService examCloudService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ExamScoreDataCloudService examScoreDataCloudService;
|
|
|
+
|
|
|
+ @PostMapping("getScore")
|
|
|
+ public ResponseEntity<?> getScore(@RequestParam String studentCode,
|
|
|
+ @RequestParam(required = false) Long examId, @RequestParam String subjectCode,
|
|
|
+ @RequestParam(required = false, defaultValue = "true") boolean encrypt,
|
|
|
+ @RequestParam(required = false, defaultValue = "false") boolean detail) {
|
|
|
+
|
|
|
+ Long rootOrgId = PropertyHolder.getLong("swjtu.rootOrgId", 0);
|
|
|
+
|
|
|
+ Map<String, Object> map = Maps.newHashMap();
|
|
|
+
|
|
|
+ try {
|
|
|
+ GetFinalScoreDataReq gfsdReq = new GetFinalScoreDataReq();
|
|
|
+ gfsdReq.setCourseCode(subjectCode);
|
|
|
+ gfsdReq.setExamId(examId);
|
|
|
+ gfsdReq.setRootOrgId(rootOrgId);
|
|
|
+ gfsdReq.setStudentCode(studentCode);
|
|
|
+
|
|
|
+ GetFinalScoreDataResp gfsdReqResp = examScoreDataCloudService
|
|
|
+ .getFinalScoreData(gfsdReq);
|
|
|
+ ScoreDataBean scoreDataBean = gfsdReqResp.getScoreDataBean();
|
|
|
+ Boolean present = gfsdReqResp.getPresent();
|
|
|
+
|
|
|
+ if (!present) {
|
|
|
+ map.put(" exist", false);
|
|
|
+ } else {
|
|
|
+ map.put(" exist", true);
|
|
|
+ map.put(" totalScore", String.valueOf(scoreDataBean.getTotalScore()));
|
|
|
+ map.put(" examId", String.valueOf(scoreDataBean.getExamId()));
|
|
|
+ map.put(" studentCode", scoreDataBean.getStudentCode());
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ map.put("exception", "500");
|
|
|
+ }
|
|
|
+
|
|
|
+ ResponseEntity<Map<String, Object>> entity = ResponseEntity.status(HttpStatus.OK).body(map);
|
|
|
+ return entity;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|