|
@@ -0,0 +1,52 @@
|
|
|
|
+package cn.com.qmth.examcloud.core.questions.api.provider;
|
|
|
|
+
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+
|
|
|
|
+import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
|
+import cn.com.qmth.examcloud.core.questions.api.RandomPaperCloudService;
|
|
|
|
+import cn.com.qmth.examcloud.core.questions.api.bean.RandomPaperBean;
|
|
|
|
+import cn.com.qmth.examcloud.core.questions.api.request.GetRandomPaperBeanReq;
|
|
|
|
+import cn.com.qmth.examcloud.core.questions.api.response.GetRandomPaperBeanResp;
|
|
|
|
+import cn.com.qmth.examcloud.core.questions.dao.RandomPaperRepo;
|
|
|
|
+import cn.com.qmth.examcloud.core.questions.dao.entity.RandomPaper;
|
|
|
|
+import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("${$rmp.cloud.questions}" + "randompaper")
|
|
|
|
+public class RandomPaperCloudServiceProvider implements RandomPaperCloudService {
|
|
|
|
+
|
|
|
|
+ private static final long serialVersionUID = -7354673848303599874L;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private RandomPaperRepo randomPaperRepo;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "获取信息")
|
|
|
|
+ @PostMapping("info")
|
|
|
|
+ @Override
|
|
|
|
+ public GetRandomPaperBeanResp getRandomPaperBean(@RequestBody GetRandomPaperBeanReq req) {
|
|
|
|
+ if (StringUtils.isBlank(req.getRandomPaperId())) {
|
|
|
|
+ throw new StatusException("RandomPaperId is null");
|
|
|
|
+ }
|
|
|
|
+ RandomPaper p = GlobalHelper.getEntity(randomPaperRepo, req.getRandomPaperId(), RandomPaper.class);
|
|
|
|
+ if(p==null) {
|
|
|
|
+ throw new StatusException("未找到抽卷模板信息");
|
|
|
|
+ }
|
|
|
|
+ GetRandomPaperBeanResp res=new GetRandomPaperBeanResp();
|
|
|
|
+ RandomPaperBean bean=new RandomPaperBean();
|
|
|
|
+ bean.setId(p.getId());
|
|
|
|
+ bean.setName(p.getName());
|
|
|
|
+ res.setRandomPaper(bean);
|
|
|
|
+
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|