weiwenhai 6 rokov pred
rodič
commit
ba73ca0b1f

+ 1 - 1
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/QuestionProviderService.java

@@ -10,7 +10,7 @@ import cn.com.qmth.examcloud.question.core.question.DefaultQuestion;
  * @author 		weiwenhai
  * @date 		2018.9.10
  * @company		qmth
- * @describle	试题对象服务接口
+ * @description	试题对象服务接口
  */
 public interface QuestionProviderService {
 

+ 4 - 0
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/QuestionProviderServiceImpl.java

@@ -237,6 +237,10 @@ public class QuestionProviderServiceImpl implements QuestionProviderService{
 							throw new StatusException("Q-", "题型格式不对!");
 						}
 					}
+				}else if(entry.getKey().equals("difficulty")){
+					Pattern p = Pattern.compile(entry.getValue());
+					String key = "properties." + entry.getKey();
+					query.addCriteria(Criteria.where(key).regex(p));
 				}else {
 					String la = entry.getValue();
 					la = la.replaceAll(",", "*");

+ 0 - 76
examcloud-core-questions-starter/src/main/java/cn/com/qmth/examcloud/core/questions/starter/config/DefaultWebMvcConfigurerAdapter.java

@@ -1,76 +0,0 @@
-package cn.com.qmth.examcloud.core.questions.starter.config;
-
-import java.util.List;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
-
-import cn.com.qmth.examcloud.commons.base.util.PathUtil;
-import cn.com.qmth.examcloud.commons.base.util.PropertiesUtil;
-import cn.com.qmth.examcloud.commons.web.interceptor.FirstInterceptor;
-import cn.com.qmth.examcloud.commons.web.redis.RedisClient;
-import cn.com.qmth.examcloud.commons.web.security.RequestPermissionInterceptor;
-import cn.com.qmth.examcloud.commons.web.security.bean.Role;
-import cn.com.qmth.examcloud.commons.web.security.bean.User;
-
-/**
- * 默认WebMvcConfigurer
- *
- * @author WANGWEI
- * @date 2018年5月22日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Configuration
-public class DefaultWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {
-
-	@Autowired
-	RedisClient redisClient;
-
-	static {
-		PropertiesUtil.configureAndWatch(PathUtil.getResoucePath("security-mapping.properties"));
-	}
-
-	@Override
-	public void addInterceptors(InterceptorRegistry registry) {
-		registry.addInterceptor(new FirstInterceptor()).addPathPatterns("/**");
-		RequestPermissionInterceptor requestPermissionInterceptor = getRequestPermissionInterceptor();
-		requestPermissionInterceptor.configureAndWatch("security-exclusions.conf");
-		registry.addInterceptor(requestPermissionInterceptor).addPathPatterns("/**");
-		super.addInterceptors(registry);
-	}
-
-	@Bean
-	public RequestPermissionInterceptor getRequestPermissionInterceptor() {
-		return new RequestPermissionInterceptor(redisClient) {
-
-			@Override
-			public boolean hasPermission(String mappingPath, User user) {
-				List<Role> roleList = user.getRoleList();
-				if (CollectionUtils.isEmpty(roleList)) {
-					return false;
-				}
-
-				String roles = PropertiesUtil.getString(mappingPath);
-				if (StringUtils.isBlank(roles)) {
-					return true;
-				}
-
-				roles = "," + roles + ",";
-
-				for (Role role : roleList) {
-					if (roles.contains("," + role.getRoleCode() + ",")) {
-						return true;
-					}
-				}
-
-				return false;
-			}
-
-		};
-	}
-}

+ 0 - 78
examcloud-core-questions-starter/src/main/resources/security-mapping.properties

@@ -1,78 +0,0 @@
-#cn.com.qmth.examcloud.service.core.api.CourseController
-[${api_cqb}/][/course/{curPage}/{pageSize}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/course][PUT]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/course][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/course/{coruse_id}][DELETE]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/course][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/course/{courseNo}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/course/allCourses][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-#cn.com.qmth.examcloud.service.core.api.GenPaperController
-[${api_cqb}/][/genPaper/simple][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/genPaper/normal][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/genPaper/blue][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-#/cn.com.qmth.examcloud.service.core.api.GenPaperController.ImportPaperController
-[${api_cqb}/][/importPaper][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/importPaper/saveBlankPaper/{courseNo}/{courseName}/{paperName}][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/clonePaper/{paperId}/{paperName}/{courseNo}][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-#cn.com.qmth.examcloud.service.core.api.PaperController
-[${api_cqb}/][/paper/{paperId}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paper][PUT]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/importPaper/{curPage}/{pageSize}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/importPaperNotSuccess/{curPage}/{pageSize}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/getImportPaper][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/getGenPaper][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/genPaper/{curPage}/{pageSize}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/genPaper/{ids}/{curPage}/{pageSize}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paper/{paperIds}][DELETE]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paper/pass][PUT]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paper/pass][PUT]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paper/noPass][PUT]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paper/list/{examId}/{courseCode}/{groupCode}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paper/join/{examId}/{courseCode}/{groupCode}/{paperId}][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paper/release/{examId}/{courseCode}/{groupCode}/{paperId}][DELETE]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paper/groupCode/{examId}/{courseCode}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paper/groupCode/{examId}/{courseCode}/{groupCode}][DELETE]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paper/deleteQuestion/{questionId}][DELETE]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paper/addQuestion/{paperId}/{paperDetailId}][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paper/{paperId}/reduplicate-questions][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paper/listNames/{questionId}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paper/listQuestion/{paperId}/{curPage}/{pageSize}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paper/selectQuestions/{paperId}/{paperDetailId}][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/importPaper/{ids}/{curPage}/{pageSize}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/importPaper/course][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/useBasePaper/{paperIds}][PUT]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/uploadRadio/{paperId}][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-#cn.com.qmth.examcloud.service.core.api.PaperDetailController
-[${api_cqb}/][/paperDetail/units/{detail_id}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paperDetail/{detail_id}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/updatePaperDetail/{paperId}][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paperDetail][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paperDetail/{detailId}][DELETE]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paperDetail/paper/{paperId}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-#cn.com.qmth.examcloud.service.core.api.PaperDetailUnitController
-[${api_cqb}/][/paperDetailUnit/question/{unit_id}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paperDetailUnit/{unit_id}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paperDetailUnit][PUT]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paperDetailUnit][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paperDetailUnit/{unitId}][DELETE]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-#cn.com.qmth.examcloud.service.core.api.PaperStructController
-[${api_cqb}/][/paperStruct/{curPage}/{pageSize}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paperStruct][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paperStruct/{id}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paperStruct][PUT]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paperStruct][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paperStruct/{ids}][DELETE]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/paperStruct/quesNames][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-#cn.com.qmth.examcloud.service.core.api.QuesController
-[${api_cqb}/][/question/{id}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/question/{curPage}/{pageSize}][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/question][PUT]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/question][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/question/{id}][DELETE]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/question/{id}/{number}][PUT]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/question/count][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-#cn.com.qmth.examcloud.service.core.api.SettingController
-[${api_cqb}/][/setting][GET]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/setting][PUT]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/setting][POST]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN
-[${api_cqb}/][/setting/{id}][DELETE]=QUESTION_ADMIN,SUPER_ADMIN,ORG_ADMIN