Kaynağa Gözat

update logs

deason 1 yıl önce
ebeveyn
işleme
d39c6d80dd

+ 43 - 29
examcloud-core-questions-api-provider/src/main/java/cn/com/qmth/examcloud/core/questions/api/controller/ImportPaperController.java

@@ -86,21 +86,25 @@ public class ImportPaperController extends ControllerSupport {
 			@RequestParam("file") CommonsMultipartFile file) {
 		User user = getAccessUser();
 		UserDataRule ud = getUserDataRule(DataRuleType.COURSE);
-		LOG.info("导入开始");
 		File tempFile = null;
+
 		try {
+			Course course = paper.getCourse();
+			LOG.warn("试卷导入操作!courseCode:{} paperName:{}", course.getCode(), paper.getName());
+
 			tempFile = importPaperService.getUploadFile(file);
 			Paper newPaper = importPaperService.importPaper(paper, user, tempFile, ud);
 			StringBuilder sb = new StringBuilder();
-			sb.append("课程:" + paper.getCourse().getName() + "(" + paper.getCourse().getCode() + ")");
+			sb.append("课程:" + course.getName() + "(" + course.getCode() + ")");
 			sb.append(" 试卷名称:" + paper.getName());
+
 			ReportsUtil.report(new AdminOperateReport(user.getRootOrgId(), user.getUserId(),
 					AdminOperateType.TYPE29.getDesc(), sb.toString()));
 			return new ResponseEntity<>(newPaper, HttpStatus.OK);
 		} catch (StatusException e) {
 			throw e;
 		} catch (Exception e) {
-			LOG.error(e.getMessage(), e);
+			LOG.error("试卷导入异常!"+e.getMessage(), e);
 			throw new StatusException("500", e.getMessage(), e);
 		}
 	}
@@ -135,7 +139,10 @@ public class ImportPaperController extends ControllerSupport {
 			@PathVariable String courseNo) {
 		User user = getAccessUser();
 		Map<String, Object> map = new HashMap<>();
+
 		try {
+			LOG.warn("克隆试卷操作!courseCode:{} paperName:{} paperId:{}", courseNo, paperName, paperId);
+
 			clonePaperService.clonePaper(paperId, paperName, courseNo, user);
 			Paper paper = Model.of(paperRepo.findById(paperId));
 
@@ -151,41 +158,45 @@ public class ImportPaperController extends ControllerSupport {
 			return new ResponseEntity<>(map, HttpStatus.OK);
 		} catch (PaperException e) {
 			map.put("msg", e.getMessage());
+
+			LOG.error("试卷克隆异常!" + e.getMessage());
 			return new ResponseEntity<>(map, HttpStatus.INTERNAL_SERVER_ERROR);
 		}
 	}
 
-	@ApiOperation(value = "导入地大试卷", notes = "导入地大试卷")
-	@PostMapping(value = "/importDdCollegePaper")
-	public ResponseEntity<Object> importDdCollegePaper(
-			@RequestPart @NotNull(message = "上传文件不能为空!") MultipartFile dataFile, @RequestParam Long rootOrgId,
-			@RequestParam String courseCode, @RequestParam(required = false) String suff) {
-		User user = getAccessUser();
-		importDdCollegePaperService.importDdCollegePaper(dataFile, user, rootOrgId, courseCode, suff);
-		return new ResponseEntity<>(HttpStatus.OK);
-	}
-
-	@ApiOperation(value = "导入重庆试卷", notes = "导入重庆试卷")
-	@PostMapping(value = "/importCqCollegePaper")
-	public ResponseEntity<Object> importCqCollegePaper(
-			@RequestPart @NotNull(message = "上传文件不能为空!") MultipartFile dataFile, @RequestParam Long rootOrgId,
-			@RequestParam String paperNameSuffix, @RequestParam String impType) {
-		User user = getAccessUser();
-		cqdxService.bulidPaper(dataFile, user, rootOrgId, paperNameSuffix, impType);
-		return new ResponseEntity<>(HttpStatus.OK);
-	}
-
-//	@ApiOperation(value = "云开导入前清理课程属性、试题属性")
-//	@PostMapping(value = "/importYunkaiProp/clear")
-//	public void importYunkaiPropClear(Long rootOrgId, @RequestParam String batch) {
-//		yunkaiService.propClear(rootOrgId, batch);
-//	}
+	// @ApiOperation(value = "导入地大试卷", notes = "导入地大试卷")
+	// @PostMapping(value = "/importDdCollegePaper")
+	// public ResponseEntity<Object> importDdCollegePaper(
+	// 		@RequestPart @NotNull(message = "上传文件不能为空!") MultipartFile dataFile, @RequestParam Long rootOrgId,
+	// 		@RequestParam String courseCode, @RequestParam(required = false) String suff) {
+	// 	User user = getAccessUser();
+	// 	importDdCollegePaperService.importDdCollegePaper(dataFile, user, rootOrgId, courseCode, suff);
+	// 	return new ResponseEntity<>(HttpStatus.OK);
+	// }
+
+	// @ApiOperation(value = "导入重庆试卷", notes = "导入重庆试卷")
+	// @PostMapping(value = "/importCqCollegePaper")
+	// public ResponseEntity<Object> importCqCollegePaper(
+	// 		@RequestPart @NotNull(message = "上传文件不能为空!") MultipartFile dataFile, @RequestParam Long rootOrgId,
+	// 		@RequestParam String paperNameSuffix, @RequestParam String impType) {
+	// 	User user = getAccessUser();
+	// 	cqdxService.bulidPaper(dataFile, user, rootOrgId, paperNameSuffix, impType);
+	// 	return new ResponseEntity<>(HttpStatus.OK);
+	// }
+
+	//	@ApiOperation(value = "云开导入前清理课程属性、试题属性")
+	//	@PostMapping(value = "/importYunkaiProp/clear")
+	//	public void importYunkaiPropClear(Long rootOrgId, @RequestParam String batch) {
+	//		yunkaiService.propClear(rootOrgId, batch);
+	//	}
 
 	@ApiOperation(value = "云开导入课程属性、试题属性")
 	@PostMapping(value = "/importYunkaiProp")
 	public void importYunkaiProp(@RequestPart @NotNull(message = "上传文件不能为空!") MultipartFile dataFile,
 			@RequestParam Long rootOrgId, @RequestParam String courseCodes, @RequestParam String batch) {
 		User user = getAccessUser();
+		LOG.warn("云开-课程和试题属性导入操作!courseCodes:{} batch:{}", courseCodes, batch);
+
 		List<String> cs = Arrays.asList(courseCodes.split(","));
 		yunkaiService.saveProp(user, dataFile, rootOrgId, cs, batch);
 
@@ -196,9 +207,12 @@ public class ImportPaperController extends ControllerSupport {
 	public void importYunkaiPaper(@RequestPart @NotNull(message = "上传文件不能为空!") MultipartFile dataFile,
 			@RequestParam Long rootOrgId, @RequestParam String courseCodes,@RequestParam String batch) {
 		User user = getAccessUser();
+		LOG.warn("云开-试卷导入操作!courseCodes:{} batch:{}", courseCodes, batch);
+
 		List<String> cs = Arrays.asList(courseCodes.split(","));
 		YunkaiImportPaperParam p = new YunkaiImportPaperParam(user, dataFile, rootOrgId, cs);
 		p.setBatch(batch);
 		yunkaiService.importYunkaiPaper(p);
 	}
-}
+
+}

+ 8 - 0
examcloud-core-questions-api-provider/src/main/java/cn/com/qmth/examcloud/core/questions/api/controller/PaperController.java

@@ -17,6 +17,8 @@ import javax.validation.constraints.NotNull;
 
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Example;
 import org.springframework.data.domain.Page;
@@ -91,6 +93,8 @@ import io.swagger.annotations.ApiOperation;
 @RequestMapping("${api_cqb}/")
 public class PaperController extends ControllerSupport {
 
+    private static final Logger log = LoggerFactory.getLogger(PaperController.class);
+
     private final static String BASE_PAGE = "base_page";
 
     @Autowired
@@ -494,6 +498,8 @@ public class PaperController extends ControllerSupport {
     @ApiOperation(value = "获取试卷的重复试题", notes = "获取试卷的重复试题")
     @GetMapping(value = "/paper/{paperId}/reduplicate-questions")
     public ResponseEntity<Object> reduplicateQuestions(@PathVariable String paperId) {
+        long start = System.currentTimeMillis();
+
         List<PaperDetailUnitExp> allPaperDetailUnitList = new ArrayList<>();
         List<Set<String>> reduplicateId = new ArrayList<>();
         PaperExp paperExp = paperService.getPaperDto(paperId);
@@ -551,6 +557,8 @@ public class PaperController extends ControllerSupport {
                 }
             }
         }
+
+        log.warn("试卷查重操作!paperId:{} cost:{}ms", paperId, System.currentTimeMillis() - start);
         return new ResponseEntity<>(reduplicateId, HttpStatus.OK);
     }
 

+ 5 - 1
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExtractConfigProviderServiceImpl.java

@@ -421,7 +421,11 @@ public class ExtractConfigProviderServiceImpl implements ExtractConfigProviderSe
         }
 
         // 获取试题信息带答案(敏感信息日志,用于排查调用者)
-        LOG.warn("$$$getQuestionWithAnswer fromBy:{} questionId:{} {}_{}_{} ", fromBy, questionId, examId, courseCode, groupCode);
+        if(!"cache".equals(fromBy)) {
+            LOG.warn("$$$getQuestionWithAnswer fromBy:{} questionId:{} {}_{}_{} ",
+                    fromBy, questionId, examId, courseCode, groupCode);
+        }
+
         return defaultQuestion;
     }