|
@@ -6,6 +6,9 @@ import java.util.Collection;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.request.GetCourseReq;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.response.GetCourseResp;
|
|
|
import cn.com.qmth.examcloud.core.questions.base.question.enums.QuesStructType;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.QuesTypeNameRepo;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.dto.CoursePropertyNumberDto;
|
|
@@ -45,6 +48,9 @@ public class PaperStructService {
|
|
|
|
|
|
@Autowired
|
|
|
MongoTemplate mongoTemplate;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ CourseCloudService courseCloudService;
|
|
|
|
|
|
/**
|
|
|
* 获取所有试卷结构(分页)
|
|
@@ -55,17 +61,6 @@ public class PaperStructService {
|
|
|
* @return
|
|
|
*/
|
|
|
public Page<PaperStruct> getPaperStructs(PaperStructSearchInfo searchInfo, int curPage, int pageSize) {
|
|
|
- /*formatSearchInfo(searchInfo);
|
|
|
- PaperStruct paperStruct = BeanCopierUtil.copyProperties(searchInfo, PaperStruct.class);
|
|
|
- formatPaperStruct(paperStruct);
|
|
|
- ExampleMatcher matcher = ExampleMatcher.matching()
|
|
|
- .withMatcher("name",contains())
|
|
|
- .withMatcher("creator",contains())
|
|
|
- .withMatcher("orgId",exact())
|
|
|
- .withIgnoreNullValues();
|
|
|
- return paperStructRepo.findAll(Example.of(paperStruct, matcher), new PageRequest(curPage - 1, pageSize));*/
|
|
|
-
|
|
|
- //create by weiwenhai
|
|
|
Query query = new Query();
|
|
|
query.addCriteria(Criteria.where("orgId").is(searchInfo.getOrgId()));
|
|
|
query.addCriteria(Criteria.where("type").is(searchInfo.getType()));
|
|
@@ -94,6 +89,20 @@ public class PaperStructService {
|
|
|
query.limit(pageSize);
|
|
|
query.skip((curPage - 1) * pageSize);
|
|
|
List<PaperStruct> paperList = this.mongoTemplate.find(query, PaperStruct.class);
|
|
|
+ //远程调用rmi,查询课程名称
|
|
|
+ if(paperList != null && paperList.size()>0){
|
|
|
+ for(PaperStruct paperStruct:paperList){
|
|
|
+ if(StringUtils.isBlank(paperStruct.getCourseNo())){
|
|
|
+ paperStruct.setCourseName("公用");
|
|
|
+ }else {
|
|
|
+ GetCourseReq req = new GetCourseReq();
|
|
|
+ req.setRootOrgId(Long.valueOf(paperStruct.getOrgId()));
|
|
|
+ req.setCode(paperStruct.getCourseNo());
|
|
|
+ GetCourseResp resp = courseCloudService.getCourse(req);
|
|
|
+ paperStruct.setCourseName(resp.getCourseBean().getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return new PageImpl<PaperStruct>(paperList, new PageRequest(curPage - 1, pageSize), count);
|
|
|
}
|
|
|
|
|
@@ -366,12 +375,11 @@ public class PaperStructService {
|
|
|
}
|
|
|
|
|
|
public PaperStruct checkNameUnique(String name, String orgId, String type) {
|
|
|
- PaperStruct paperTemp = new PaperStruct();
|
|
|
- paperTemp.setCreateTime(null);
|
|
|
- paperTemp.setName(name.trim());
|
|
|
- paperTemp.setOrgId(orgId);
|
|
|
- paperTemp.setType(type);
|
|
|
- PaperStruct paperStruct = paperStructRepo.findOne(Example.of(paperTemp));
|
|
|
+ Query query = new Query();
|
|
|
+ query.addCriteria(Criteria.where("orgId").is(orgId));
|
|
|
+ query.addCriteria(Criteria.where("name").is(name.trim()));
|
|
|
+ query.addCriteria(Criteria.where("type").is(type));
|
|
|
+ PaperStruct paperStruct = this.mongoTemplate.findOne(query, PaperStruct.class);
|
|
|
return paperStruct;
|
|
|
}
|
|
|
|