deason 4 rokov pred
rodič
commit
2dd8627650
28 zmenil súbory, kde vykonal 193 pridanie a 212 odobranie
  1. 1 1
      examcloud-core-questions-api-provider/src/main/java/cn/com/qmth/examcloud/core/questions/api/controller/ExportPaperController.java
  2. 10 10
      examcloud-core-questions-api-provider/src/main/java/cn/com/qmth/examcloud/core/questions/api/controller/ExtractConfigController.java
  3. 3 2
      examcloud-core-questions-api-provider/src/main/java/cn/com/qmth/examcloud/core/questions/api/controller/ImportPaperController.java
  4. 4 4
      examcloud-core-questions-api-provider/src/main/java/cn/com/qmth/examcloud/core/questions/api/provider/ExtractConfigCloudServiceProvider.java
  5. 5 5
      examcloud-core-questions-api-provider/src/main/java/cn/com/qmth/examcloud/core/questions/api/provider/HandleSyncCloudServiceProvider.java
  6. 14 14
      examcloud-core-questions-base/src/main/java/cn/com/qmth/examcloud/core/questions/base/FileDisposeUtil.java
  7. 1 1
      examcloud-core-questions-base/src/main/java/cn/com/qmth/examcloud/core/questions/base/converter/utils/Cryptogram.java
  8. 1 1
      examcloud-core-questions-base/src/main/java/cn/com/qmth/examcloud/core/questions/base/converter/utils/FileUtil.java
  9. 7 6
      examcloud-core-questions-base/src/main/java/cn/com/qmth/examcloud/core/questions/base/excel/ExcelWriter.java
  10. 3 3
      examcloud-core-questions-base/src/main/java/cn/com/qmth/examcloud/core/questions/base/excel/ImportUtils.java
  11. 7 7
      examcloud-core-questions-base/src/main/java/cn/com/qmth/examcloud/core/questions/base/word/DocxProcessUtil.java
  12. 1 1
      examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/ClonePaperService.java
  13. 1 1
      examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/ImportDdCollegePaperService.java
  14. 1 1
      examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/ImportPaperFromJsonService.java
  15. 1 1
      examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/ImportPaperService.java
  16. 1 1
      examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/UpYunService.java
  17. 1 1
      examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/converter/PrintExamPaperService.java
  18. 10 10
      examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExportPaperServiceImpl.java
  19. 4 4
      examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExportTemplateServiceImpl.java
  20. 7 7
      examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExportThemisPaperServiceImpl.java
  21. 11 11
      examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExtractConfigFileServiceImpl.java
  22. 14 14
      examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExtractConfigProviderServiceImpl.java
  23. 35 35
      examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExtractConfigServiceImpl.java
  24. 16 16
      examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/GenPaperService.java
  25. 4 4
      examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/PaperProviderServiceImpl.java
  26. 11 11
      examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/PaperServiceImpl.java
  27. 1 1
      examcloud-core-questions-starter/src/main/java/cn/com/qmth/examcloud/core/questions/starter/config/initData.java
  28. 18 39
      examcloud-core-questions-starter/src/main/resources/log4j2.xml

+ 1 - 1
examcloud-core-questions-api-provider/src/main/java/cn/com/qmth/examcloud/core/questions/api/controller/ExportPaperController.java

@@ -33,7 +33,7 @@ import io.swagger.annotations.ApiOperation;
 @RequestMapping("${api_cqb}/")
 public class ExportPaperController extends ControllerSupport {
 
-    protected static final Logger log = LoggerFactory.getLogger(ExportPaperController.class);
+    private static final Logger log = LoggerFactory.getLogger(ExportPaperController.class);
 
     @Autowired
     ExportServiceManageRepo exportServiceManageRepo;

+ 10 - 10
examcloud-core-questions-api-provider/src/main/java/cn/com/qmth/examcloud/core/questions/api/controller/ExtractConfigController.java

@@ -53,7 +53,7 @@ import io.swagger.annotations.ApiOperation;
 @Controller
 @RequestMapping("${api_cqb}/")
 public class ExtractConfigController extends ControllerSupport {
-    private static final Logger logger = LoggerFactory.getLogger(ExtractConfigController.class);
+    private static final Logger LOG = LoggerFactory.getLogger(ExtractConfigController.class);
 
     @Autowired
     private ExtractConfigService extractConfigService;
@@ -75,7 +75,7 @@ public class ExtractConfigController extends ControllerSupport {
             Page<ExtractConfig> extractConfigPageList = extractConfigService.findPageExtractConfig(currentPage, pageSize, examId, courseNo, String.valueOf(user.getRootOrgId()));
             return new ResponseEntity<>(extractConfigPageList, HttpStatus.OK);
         } catch (Exception e) {
-            log.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
             throw new StatusException("Q-050065", e.getMessage());
         }
     }
@@ -196,7 +196,7 @@ public class ExtractConfigController extends ControllerSupport {
                 return new ResponseEntity<>(returnMap.get("errorMsg") + "", HttpStatus.OK);
             }
         } catch (Exception e) {
-            logger.error("抽卷失败", e);
+            LOG.error("抽卷失败", e);
             return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
         }
     }
@@ -212,7 +212,7 @@ public class ExtractConfigController extends ControllerSupport {
             QuestionDto questionDto = extractConfigService.extractExamQuestion(examId, courseCode, groupCode, paperDetailUnitId);
             return new ResponseEntity<>(questionDto, HttpStatus.OK);
         } catch (Exception e) {
-            logger.error("抽题失败", e);
+            LOG.error("抽题失败", e);
             return new ResponseEntity<>("抽题失败:" + e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
         }
 
@@ -234,7 +234,7 @@ public class ExtractConfigController extends ControllerSupport {
             quesMap.put("message", result ? "全为客观题" : "不全为客观题");
             return new ResponseEntity<>(quesMap, HttpStatus.OK);
         } catch (Exception e) {
-            logger.error("调用checkIsAllQbjectiveQuestion失败", e);
+            LOG.error("调用checkIsAllQbjectiveQuestion失败", e);
             quesMap.put("result", "error");
             quesMap.put("message", "调用失败");
             return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
@@ -265,7 +265,7 @@ public class ExtractConfigController extends ControllerSupport {
         try {
             extractConfigFileService.exportExamPaperInfo(exportModel, response, loginName, orgId, psw);
         } catch (Exception e) {
-            log.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         }
     }
 
@@ -281,7 +281,7 @@ public class ExtractConfigController extends ControllerSupport {
             extractConfigFileService.exportExamPaperInfoCheck(exportModel, response);
             return new ResponseEntity<>(HttpStatus.OK);
         } catch (Exception e) {
-            log.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
             throw new StatusException("Q-050200", e.getMessage());
         }
     }
@@ -307,7 +307,7 @@ public class ExtractConfigController extends ControllerSupport {
         try {
             extractConfigFileService.exportExamPaperInfo(exportModel, response, loginName, orgId, null);
         } catch (Exception e) {
-            log.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         }
     }
 
@@ -324,7 +324,7 @@ public class ExtractConfigController extends ControllerSupport {
                 return new ResponseEntity<>(returnMap.get("errorMsg") + "", HttpStatus.OK);
             }
         } catch (Exception e) {
-            logger.error("抽卷失败", e);
+            LOG.error("抽卷失败", e);
             return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
         }
     }
@@ -337,7 +337,7 @@ public class ExtractConfigController extends ControllerSupport {
             PaperDto paperDto = extractConfigService.getPaperDtoByPaperNew(paperId);
             return new ResponseEntity<>(paperDto, HttpStatus.OK);
         } catch (Exception e) {
-            logger.error("获取试卷Dto失败", e);
+            LOG.error("获取试卷Dto失败", e);
             return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
         }
     }

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

@@ -48,7 +48,8 @@ import io.swagger.annotations.ApiOperation;
 @RestController
 @RequestMapping("${api_cqb}/")
 public class ImportPaperController extends ControllerSupport {
-	protected static final Logger LOGGER = LoggerFactory.getLogger(ImportPaperController.class);
+	private static final Logger LOG = LoggerFactory.getLogger(ImportPaperController.class);
+
 	@Autowired
 	private ClonePaperService clonePaperService;
 	@Autowired
@@ -74,7 +75,7 @@ public class ImportPaperController extends ControllerSupport {
 	public ResponseEntity<Object> importPaper(@ModelAttribute Paper paper,
 			@RequestParam("file") CommonsMultipartFile file) {
 		User user = getAccessUser();
-		LOGGER.info("导入开始");
+		LOG.info("导入开始");
 		File tempFile = null;
 		try {
 			tempFile = importPaperService.getUploadFile(file);

+ 4 - 4
examcloud-core-questions-api-provider/src/main/java/cn/com/qmth/examcloud/core/questions/api/provider/ExtractConfigCloudServiceProvider.java

@@ -1,8 +1,6 @@
 package cn.com.qmth.examcloud.core.questions.api.provider;
 
 import cn.com.qmth.examcloud.commons.exception.StatusException;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
 import cn.com.qmth.examcloud.core.questions.api.ExtractConfigCloudService;
 import cn.com.qmth.examcloud.core.questions.api.request.*;
 import cn.com.qmth.examcloud.core.questions.api.response.*;
@@ -12,6 +10,8 @@ import cn.com.qmth.examcloud.question.commons.core.paper.DefaultPaper;
 import cn.com.qmth.examcloud.question.commons.core.question.DefaultQuestion;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -35,7 +35,7 @@ import java.util.Set;
 @RequestMapping("${$rmp.cloud.questions}" + "extract_config")
 public class ExtractConfigCloudServiceProvider implements ExtractConfigCloudService {
 
-    protected ExamCloudLog log = ExamCloudLogFactory.getLog(this.getClass());
+    private static final Logger LOG = LoggerFactory.getLogger(ExtractConfigCloudServiceProvider.class);
 
     private static final long serialVersionUID = 2346453260179681094L;
 
@@ -165,7 +165,7 @@ public class ExtractConfigCloudServiceProvider implements ExtractConfigCloudServ
             resp.setJson(json);
             return resp;
         } catch (Exception e) {
-            log.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         }
         return null;
     }

+ 5 - 5
examcloud-core-questions-api-provider/src/main/java/cn/com/qmth/examcloud/core/questions/api/provider/HandleSyncCloudServiceProvider.java

@@ -101,7 +101,7 @@ public class HandleSyncCloudServiceProvider extends ControllerSupport implements
                 i++;
             }
             extractConfigRepo.saveAll(extractConfigs);
-            log.debug("调卷规则同步完成,已经同步数量:" + i);
+            LOGGER.debug("调卷规则同步完成,已经同步数量:" + i);
         }
         //同步试卷
         List<Paper> papers = paperRepo.findByCourseNoAndOrgId(courseCode, rootOrgId.toString());
@@ -128,7 +128,7 @@ public class HandleSyncCloudServiceProvider extends ControllerSupport implements
                 i++;
             }
             paperRepo.saveAll(papers);
-            log.debug("试卷同步完成,已经同步数量:" + i);
+            LOGGER.debug("试卷同步完成,已经同步数量:" + i);
         }
         //同步试题
         Query query = new Query();
@@ -158,7 +158,7 @@ public class HandleSyncCloudServiceProvider extends ControllerSupport implements
                 i++;
             }
             quesRepo.saveAll(questions);
-            log.debug("试题同步完成,已经同步数量:" + i);
+            LOGGER.debug("试题同步完成,已经同步数量:" + i);
         }
         SyncCourseResp resp = new SyncCourseResp();
         return resp;
@@ -209,7 +209,7 @@ public class HandleSyncCloudServiceProvider extends ControllerSupport implements
         query.addCriteria(Criteria.where("orgId").is(rootOrgId.toString()));
         query.addCriteria(Criteria.where("examId").is(id));
         List<ExtractConfig> extractConfigs = this.mongoTemplate.find(query, ExtractConfig.class);
-        log.debug("调卷规则总数量:" + extractConfigs.size());
+        LOGGER.debug("调卷规则总数量:" + extractConfigs.size());
         if (extractConfigs != null && extractConfigs.size() > 0) {
             int i = 0;
             for (ExtractConfig extractConfig : extractConfigs) {
@@ -219,7 +219,7 @@ public class HandleSyncCloudServiceProvider extends ControllerSupport implements
                 extractConfig.setExamType(examType);
             }
             extractConfigRepo.saveAll(extractConfigs);
-            log.debug("调卷规则同步完成,已经同步数量:" + i);
+            LOGGER.debug("调卷规则同步完成,已经同步数量:" + i);
         }
         SyncExamResp resp = new SyncExamResp();
         return resp;

+ 14 - 14
examcloud-core-questions-base/src/main/java/cn/com/qmth/examcloud/core/questions/base/FileDisposeUtil.java

@@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory;
  */
 public class FileDisposeUtil {
 
-    private static final Logger logger = LoggerFactory.getLogger(FileDisposeUtil.class);
+    private static final Logger LOG = LoggerFactory.getLogger(FileDisposeUtil.class);
 
     /**
      * 将网络文件保存到本地
@@ -52,7 +52,7 @@ public class FileDisposeUtil {
         try {
             url = new URL(fileUrl);
         } catch (MalformedURLException e) {
-            logger.error("fileUrl:"+fileUrl, e);
+            LOG.error("fileUrl:"+fileUrl, e);
             return false;
         }
 
@@ -60,7 +60,7 @@ public class FileDisposeUtil {
         try {
             connection = (HttpURLConnection) url.openConnection();
         } catch (IOException e) {
-            logger.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
             return false;
         }
 
@@ -77,7 +77,7 @@ public class FileDisposeUtil {
             dataOutputStream.flush();
             return true;
         } catch (Exception e) {
-            logger.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
             return false;
         } finally {
             if (connection != null) {
@@ -121,9 +121,9 @@ public class FileDisposeUtil {
 
             response.flushBuffer();
         } catch (FileNotFoundException e) {
-            logger.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         } catch (IOException e) {
-            logger.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         }
     }
 
@@ -139,7 +139,7 @@ public class FileDisposeUtil {
         try {
             type = Files.probeContentType(path);
         } catch (IOException e) {
-            logger.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         }
         return type;
     }
@@ -156,23 +156,23 @@ public class FileDisposeUtil {
      * @return
      */
     public static boolean fileToZip(String sourceFilePath, String zipFilePath, String fileName) {
-        logger.info("压缩" + sourceFilePath + "目录开始");
+        LOG.info("压缩" + sourceFilePath + "目录开始");
 
         File sourceFile = new File(sourceFilePath);
         if (!sourceFile.exists()) {
-            logger.error("待压缩的文件目录:" + sourceFilePath + "不存在.");
+            LOG.error("待压缩的文件目录:" + sourceFilePath + "不存在.");
             return false;
         }
 
         File zipFile = new File(zipFilePath + File.separator + fileName + ".zip");
         if (zipFile.exists()) {
-            logger.error(zipFilePath + "目录下存在名字为:" + fileName + ".zip" + "打包文件.");
+            LOG.error(zipFilePath + "目录下存在名字为:" + fileName + ".zip" + "打包文件.");
             return false;
         }
 
         File[] sourceFiles = sourceFile.listFiles();
         if (null == sourceFiles || sourceFiles.length < 1) {
-            logger.error("待压缩的文件目录:" + sourceFilePath + "里面不存在文件,无需压缩.");
+            LOG.error("待压缩的文件目录:" + sourceFilePath + "里面不存在文件,无需压缩.");
             return false;
         }
 
@@ -204,14 +204,14 @@ public class FileDisposeUtil {
 
                     zos.flush();
                 } catch (Exception e) {
-                    logger.error(e.getMessage(), e);
+                    LOG.error(e.getMessage(), e);
                 }
             }
 
-            logger.info("压缩" + sourceFilePath + "目录完成");
+            LOG.info("压缩" + sourceFilePath + "目录完成");
             return true;
         } catch (Exception e) {
-            logger.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         }
 
         return false;

+ 1 - 1
examcloud-core-questions-base/src/main/java/cn/com/qmth/examcloud/core/questions/base/converter/utils/Cryptogram.java

@@ -25,7 +25,7 @@ import java.security.SecureRandom;
  * 支持DES/AES对称加密的工具类
  */
 public class Cryptogram {
-    private static Logger log = LoggerFactory.getLogger(Cryptogram.class);
+    private static final Logger log = LoggerFactory.getLogger(Cryptogram.class);
     private static final String AES = "AES";
     private static final String AES_CBC = "AES/CBC/PKCS5Padding";
     private static final String IV_SPEC = "0102030405060708";

+ 1 - 1
examcloud-core-questions-base/src/main/java/cn/com/qmth/examcloud/core/questions/base/converter/utils/FileUtil.java

@@ -21,7 +21,7 @@ import java.util.zip.ZipFile;
 import java.util.zip.ZipOutputStream;
 
 public class FileUtil {
-    private static Logger log = LoggerFactory.getLogger(FileUtil.class);
+    private static final Logger log = LoggerFactory.getLogger(FileUtil.class);
 
     /**
      * 分隔文件

+ 7 - 6
examcloud-core-questions-base/src/main/java/cn/com/qmth/examcloud/core/questions/base/excel/ExcelWriter.java

@@ -18,7 +18,8 @@ import java.util.regex.Pattern;
  * Created by dizhi on 2016/6/19.
  */
 public class ExcelWriter extends ExcelUtils {
-    private static final Logger log = LoggerFactory.getLogger(ExcelWriter.class);
+
+    private static final Logger LOG = LoggerFactory.getLogger(ExcelWriter.class);
 
     public ExcelWriter(Class<?> dataClass) {
         super(dataClass, false);
@@ -158,20 +159,20 @@ public class ExcelWriter extends ExcelUtils {
                             }
                         }
                     } catch (NoSuchFieldException e) {
-                        log.error(e.getMessage(), e);
+                        LOG.error(e.getMessage(), e);
                     } catch (IllegalAccessException e) {
-                        log.error(e.getMessage(), e);
+                        LOG.error(e.getMessage(), e);
                     } catch (SecurityException e) {
-                        log.error(e.getMessage(), e);
+                        LOG.error(e.getMessage(), e);
                     } catch (IllegalArgumentException e) {
-                        log.error(e.getMessage(), e);
+                        LOG.error(e.getMessage(), e);
                     }
                 }
             }
 
             workbook.write(out);
         } catch (IOException e) {
-            log.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         } finally {
             try {
                 out.close();

+ 3 - 3
examcloud-core-questions-base/src/main/java/cn/com/qmth/examcloud/core/questions/base/excel/ImportUtils.java

@@ -12,7 +12,7 @@ import java.io.*;
  */
 public final class ImportUtils {
 
-    protected static final Logger logger = LoggerFactory.getLogger(ImportUtils.class);
+    private static final Logger LOG = LoggerFactory.getLogger(ImportUtils.class);
 
     public static final String TEMP_FILE_IMP = "fileImport/";
 
@@ -50,9 +50,9 @@ public final class ImportUtils {
              InputStream is = file.getInputStream();) {
             IOUtils.copyLarge(is, os);
         } catch (FileNotFoundException e) {
-            logger.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         } catch (IOException e) {
-            logger.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         }
 
         return tempFile;

+ 7 - 7
examcloud-core-questions-base/src/main/java/cn/com/qmth/examcloud/core/questions/base/word/DocxProcessUtil.java

@@ -75,7 +75,7 @@ import java.util.zip.ZipOutputStream;
  */
 public final class DocxProcessUtil {
 
-    private static final Logger logger = LoggerFactory.getLogger(DocxProcessUtil.class);
+    private static final Logger LOG = LoggerFactory.getLogger(DocxProcessUtil.class);
 
     public static final LayoutContext IMG_LAYOUT = new StyleAttributeLayoutContext(
             LayoutContextImpl.getDefaultLayoutContext(), "2em", java.awt.Color.BLACK);
@@ -471,7 +471,7 @@ public final class DocxProcessUtil {
 
             return textStr.toString();
         } catch (Exception e) {
-            logger.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         }
 
         return htmlStr;
@@ -707,7 +707,7 @@ public final class DocxProcessUtil {
             template.process(dataModel, out);
             out.flush();
         } catch (Exception e) {
-            logger.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
             throw new RuntimeException("Export Word Fail.");
         }
     }
@@ -733,7 +733,7 @@ public final class DocxProcessUtil {
      * @throws Exception
      */
     public static void processImage(String fileName, List<WordprocessingMLPackage> wordMLPackages) throws Exception {
-        logger.info("试卷:“" + fileName + "”导出处理图片开始...");
+        LOG.info("试卷:“" + fileName + "”导出处理图片开始...");
         String filePath = TEMP_FILE_EXP + fileName;
         InputStream mainFile = new FileInputStream(filePath);
         // 取到当前生成的主Word
@@ -779,7 +779,7 @@ public final class DocxProcessUtil {
         OutputStream os = new FileOutputStream(filePath);
         Docx4J.save(wordMLPackage, os, Docx4J.FLAG_SAVE_ZIP_FILE);
         IOUtils.closeQuietly(os);
-        logger.info("试卷:“" + fileName + "”导出处理图片结束");
+        LOG.info("试卷:“" + fileName + "”导出处理图片结束");
     }
 
     public static void copyImage(WordprocessingMLPackage wordMLPackage, byte[] bytes, String relId) throws Exception {
@@ -847,7 +847,7 @@ public final class DocxProcessUtil {
         try {
             wordMLPackage = Docx4J.load(inputStream);
         } catch (Docx4JException e) {
-            logger.error(e.getMessage());
+            LOG.error(e.getMessage());
         }
         return wordMLPackage;
     }
@@ -911,7 +911,7 @@ public final class DocxProcessUtil {
                 response.flushBuffer();
             }
         } catch (IOException e) {
-            logger.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         }
 
         //删除本地文件

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

@@ -52,7 +52,7 @@ import cn.com.qmth.examcloud.web.filestorage.YunPathInfo;
  */
 @Service
 public class ClonePaperService {
-    protected static final Logger log = LoggerFactory.getLogger(ClonePaperService.class);
+    private static final Logger log = LoggerFactory.getLogger(ClonePaperService.class);
     @Autowired
     private PaperService paperService;
     @Autowired

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

@@ -60,7 +60,7 @@ import cn.com.qmth.examcloud.web.config.SystemProperties;
 @Service
 public class ImportDdCollegePaperService {
 
-    protected static final Logger log = LoggerFactory.getLogger(ImportDdCollegePaperService.class);
+    private static final Logger log = LoggerFactory.getLogger(ImportDdCollegePaperService.class);
 
     @Autowired
     private PaperRepo paperRepo;

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

@@ -58,7 +58,7 @@ import cn.com.qmth.examcloud.core.questions.service.impl.CourseService;
 @Service
 public class ImportPaperFromJsonService {
 
-    protected static final Logger log = LoggerFactory.getLogger(ImportPaperFromJsonService.class);
+    private static final Logger log = LoggerFactory.getLogger(ImportPaperFromJsonService.class);
 
     @Autowired
     private PaperRepo paperRepo;

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

@@ -76,7 +76,7 @@ import cn.com.qmth.examcloud.web.filestorage.YunPathInfo;
 @Service
 public class ImportPaperService {
 
-    protected static final Logger log = LoggerFactory.getLogger(ImportPaperService.class);
+    private static final Logger log = LoggerFactory.getLogger(ImportPaperService.class);
 
     private static final String DOC_SUFFIX = ".docx";
 

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

@@ -11,7 +11,7 @@ import cn.com.qmth.examcloud.core.questions.service.config.SysProperty;
 
 @Service
 public class UpYunService {
-    protected static final Logger log = LoggerFactory.getLogger(UpYunService.class);
+    private static final Logger log = LoggerFactory.getLogger(UpYunService.class);
 
     public static final String TEMP_FILE_EXP = "docxExport/";
 

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

@@ -54,7 +54,7 @@ import cn.com.qmth.examcloud.core.questions.service.PaperService;
 @Service
 public class PrintExamPaperService {
 
-    private static Logger log = LoggerFactory.getLogger(PrintExamPaperService.class);
+    private static final Logger log = LoggerFactory.getLogger(PrintExamPaperService.class);
 
     @Autowired
     private PaperService paperService;

+ 10 - 10
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExportPaperServiceImpl.java

@@ -25,6 +25,8 @@ import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.mongodb.core.MongoTemplate;
 import org.springframework.data.mongodb.core.query.Criteria;
@@ -36,8 +38,6 @@ import com.google.gson.Gson;
 
 import cn.com.qmth.examcloud.api.commons.security.bean.User;
 import cn.com.qmth.examcloud.commons.exception.StatusException;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
 import cn.com.qmth.examcloud.core.questions.base.CommonUtils;
 import cn.com.qmth.examcloud.core.questions.base.FileDisposeUtil;
 import cn.com.qmth.examcloud.core.questions.base.IdUtils;
@@ -87,7 +87,7 @@ import cn.com.qmth.examcloud.support.filestorage.FileStorageUtil;
 @Service("exportPaperService")
 public class ExportPaperServiceImpl implements ExportPaperService {
 
-    protected ExamCloudLog log = ExamCloudLogFactory.getLog(this.getClass());
+    private static final Logger LOG = LoggerFactory.getLogger(ExportPaperServiceImpl.class);
 
     public static final String TEMP_FILE_EXP = "docxExport/";
 
@@ -167,7 +167,7 @@ public class ExportPaperServiceImpl implements ExportPaperService {
                     exportPaperAbstractService.downloadPaperAnswer(dto);
                 }
             } catch (Exception e) {
-                log.error(e.getMessage(), e);
+                LOG.error(e.getMessage(), e);
                 throw new StatusException("100001", e.getMessage());
             }
             // 下载考试说明 2018-2-27 weiwehai
@@ -176,20 +176,20 @@ public class ExportPaperServiceImpl implements ExportPaperService {
              * StringUtils.isNotBlank(paper.getExamRemark())){
              * downExamRemark(paper,zipFileName); }
              */
-            log.debug("开始压缩成zip...");
+            LOG.debug("开始压缩成zip...");
             startTime = System.currentTimeMillis();
             FileDisposeUtil.fileToZip(TEMP_FILE_EXP + File.separator + zipFileName, TEMP_FILE_EXP, zipFileName);
             FileDisposeUtil.downloadFile(paper.getName() + "_" + paper.getCourse().getCode() + ".zip",
                     TEMP_FILE_EXP + File.separator + zipFileName + ".zip", response);
             long endTime = System.currentTimeMillis();
-            log.debug("下载zip耗时:" + (endTime - startTime) + "ms");
+            LOG.debug("下载zip耗时:" + (endTime - startTime) + "ms");
         } finally {
             long endTime = System.currentTimeMillis();
 			FileUtil.deleteFolder(TEMP_FILE_EXP+ File.separator + zipFileName);
 			FileUtil.deleteFolder(TEMP_FILE_EXP+ File.separator + zipFileName+ ".zip");
 //            deteleFolder(TEMP_FILE_EXP, zipFileName);
             long deleteTime = System.currentTimeMillis();
-            log.debug("删除文件耗时:" + (deleteTime - endTime) + "ms");
+            LOG.debug("删除文件耗时:" + (deleteTime - endTime) + "ms");
         }
         StringBuilder paperInfo=new StringBuilder();
 		paperInfo.append("课程:"+paper.getCourse().getName()+"("+paper.getCourse().getCode()+")");
@@ -577,9 +577,9 @@ public class ExportPaperServiceImpl implements ExportPaperService {
             outputStream.write(b);
             outputStream.flush();
         } catch (FileNotFoundException e) {
-            log.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         } catch (IOException e) {
-            log.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         } finally {
             IOUtils.closeQuietly(outputStream);
         }
@@ -786,7 +786,7 @@ public class ExportPaperServiceImpl implements ExportPaperService {
             }
         }
 
-        log.info("[WriteExcel] " + filePath);
+        LOG.info("[WriteExcel] " + filePath);
 
         File file = new File(filePath);
         OutputStream out = new FileOutputStream(file);

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

@@ -10,6 +10,8 @@ import java.util.List;
 import javax.persistence.criteria.Predicate;
 
 import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
@@ -24,8 +26,6 @@ import org.springframework.web.multipart.MultipartFile;
 
 import cn.com.qmth.examcloud.api.commons.security.bean.User;
 import cn.com.qmth.examcloud.commons.exception.StatusException;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
 import cn.com.qmth.examcloud.core.questions.base.FileDisposeUtil;
 import cn.com.qmth.examcloud.core.questions.base.IdUtils;
 import cn.com.qmth.examcloud.core.questions.base.dto.ExportTemplateDto;
@@ -40,7 +40,7 @@ import cn.com.qmth.examcloud.web.filestorage.FileStoragePathEnvInfo;
 @Service("exportTemplateService")
 public class ExportTemplateServiceImpl implements ExportTemplateService {
 
-	protected ExamCloudLog log = ExamCloudLogFactory.getLog(this.getClass());
+	private static final Logger LOG = LoggerFactory.getLogger(ExportTemplateServiceImpl.class);
 
 	private static final String ZIP_SUFFIX = "zip";
 
@@ -146,7 +146,7 @@ public class ExportTemplateServiceImpl implements ExportTemplateService {
 				try {
 					is.close();
 				} catch (IOException e1) {
-					log.warn("InputStream close faild!");
+					LOG.warn("InputStream close faild!");
 				}
 			}
 		}

+ 7 - 7
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExportThemisPaperServiceImpl.java

@@ -18,14 +18,14 @@ import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.nodes.Node;
 import org.jsoup.nodes.TextNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.google.gson.Gson;
 import com.google.gson.JsonArray;
 
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
 import cn.com.qmth.examcloud.core.questions.base.CommonUtils;
 import cn.com.qmth.examcloud.core.questions.base.Model;
 import cn.com.qmth.examcloud.core.questions.base.converter.utils.FileUtil;
@@ -57,7 +57,7 @@ import cn.com.qmth.examcloud.support.filestorage.FileStorageUtil;
 @Service("exportThemisPaperService")
 public class ExportThemisPaperServiceImpl implements ExportThemisPaperService {
 
-	protected ExamCloudLog log = ExamCloudLogFactory.getLog(this.getClass());
+	private static final Logger LOG = LoggerFactory.getLogger(ExportThemisPaperServiceImpl.class);
 
 	@Autowired
 	private PaperService paperService;
@@ -169,9 +169,9 @@ public class ExportThemisPaperServiceImpl implements ExportThemisPaperService {
 			outputStream.write(b);
 			outputStream.flush();
 		} catch (FileNotFoundException e) {
-			log.error(e.getMessage(), e);
+			LOG.error(e.getMessage(), e);
 		} catch (IOException e) {
-			log.error(e.getMessage(), e);
+			LOG.error(e.getMessage(), e);
 		} finally {
 			IOUtils.closeQuietly(outputStream);
 		}
@@ -193,9 +193,9 @@ public class ExportThemisPaperServiceImpl implements ExportThemisPaperService {
 			outputStream.write(b);
 			outputStream.flush();
 		} catch (FileNotFoundException e) {
-			log.error(e.getMessage(), e);
+			LOG.error(e.getMessage(), e);
 		} catch (IOException e) {
-			log.error(e.getMessage(), e);
+			LOG.error(e.getMessage(), e);
 		} finally {
 			IOUtils.closeQuietly(outputStream);
 		}

+ 11 - 11
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExtractConfigFileServiceImpl.java

@@ -73,7 +73,7 @@ import cn.com.qmth.examcloud.support.filestorage.FileStorageUtil;
 @Service("extractConfigFileService")
 public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
 
-    private static final Logger logger = LoggerFactory.getLogger(ExtractConfigFileServiceImpl.class);
+    private static final Logger LOG = LoggerFactory.getLogger(ExtractConfigFileServiceImpl.class);
 
     public static final String TEMP_FILE_EXP = "docxExport/";
 
@@ -212,7 +212,7 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
                 }
                 printExamPaperService.downloadPaper(papers, downloadDir, psw);
             } else {
-                logger.info("exportPrintExamPaper fail, extractConfig is not exist!");
+                LOG.info("exportPrintExamPaper fail, extractConfig is not exist!");
             }
         }
 
@@ -488,7 +488,7 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
      * @throws Exception
      */
     private void makePaperStructure(String downloadDir, String examName, Map<String, String> paperIds, ExportStructure exportStructure) throws Exception {
-        logger.info("正在批量生成试卷结构...");
+        LOG.info("正在批量生成试卷结构...");
         List<QuestionTypeNum> questionTypeNums = exportStructure.getQuestionTypeNums();
         //客观题集合
         List<ObjectiveQuestionStructure> objectiveQuestionStructureList = new ArrayList<>();
@@ -504,13 +504,13 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
             Entry<String, String> entry = iterator.next();
             String paperId = entry.getKey();
             String paperType = entry.getValue();
-            logger.info(index + " - 处理试卷:" + paperId);
+            LOG.info(index + " - 处理试卷:" + paperId);
             
             DownloadPaperDto dto=new DownloadPaperDto();
             dto.setPaperId(paperId);
         	dto.setSeqMode(PaperSeqMode.MODE3);
             PaperExp paperExp = initPaperExpService.initPaperExp(dto);//for export test
-            logger.info("处理客观题...");
+            LOG.info("处理客观题...");
             //添加客观题
             List<PaperDetailExp> objectiveDetails = exportPaperAbstractService.getAllObjectiveDetails(paperExp);
             //得到补齐后的客观题大题
@@ -522,9 +522,9 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
                 }
             }
             objectiveQuestionStructureList.addAll(objectiveList);
-            logger.info("处理客观题完成");
+            LOG.info("处理客观题完成");
             //添加主观题
-            logger.info("处理主观题...");
+            LOG.info("处理主观题...");
             List<PaperDetailExp> subjectiveDetails = exportPaperAbstractService.getAllSubjectiveDetails(paperExp);
             List<SubjectiveQuestionStructure> subjectiveList = new ArrayList<>();
             for (PaperDetailExp paperDetailExp : subjectiveDetails) {
@@ -533,7 +533,7 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
                 }
             }
             subjectiveQuestionStructureList.addAll(subjectiveList);
-            logger.info("处理主观题完成");
+            LOG.info("处理主观题完成");
             index++;
         }
 
@@ -543,7 +543,7 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
         try (FileOutputStream out1 = getFileOutputStream(downloadDir, keguanFileName);) {
             objectiveExcelExporter.write(keguanFileName, objectiveQuestionStructureList, out1);
         } catch (IOException e) {
-            logger.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         }
 
         ExcelWriter subjectiveExcelExporter = new ExcelWriter(SubjectiveQuestionStructure.class);
@@ -551,10 +551,10 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
         try (FileOutputStream out2 = getFileOutputStream(downloadDir, zhuguanFileName);) {
             subjectiveExcelExporter.write(zhuguanFileName, subjectiveQuestionStructureList, out2);
         } catch (IOException e) {
-            logger.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         }
 
-        logger.info("批量生成试卷结构完成");
+        LOG.info("批量生成试卷结构完成");
     }
 
     private FileOutputStream getFileOutputStream(String downloadDir, String fileName) throws IOException {

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

@@ -13,13 +13,13 @@ import java.util.stream.Collectors;
 
 import org.apache.commons.collections.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.stereotype.Service;
 
 import cn.com.qmth.examcloud.commons.exception.StatusException;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
 import cn.com.qmth.examcloud.core.questions.base.CommonUtils;
 import cn.com.qmth.examcloud.core.questions.base.Model;
 import cn.com.qmth.examcloud.core.questions.base.question.enums.QuesStructType;
@@ -69,7 +69,7 @@ import cn.com.qmth.examcloud.support.filestorage.FileStorageUtil;
 @Service("extractConfigCloudService")
 public class ExtractConfigProviderServiceImpl implements ExtractConfigProviderService {
 
-    protected ExamCloudLog log = ExamCloudLogFactory.getLog(this.getClass());
+    private static final Logger LOG = LoggerFactory.getLogger(ExtractConfigProviderServiceImpl.class);
 
     @Autowired
     private ExtractConfigService extractConfigService;
@@ -140,7 +140,7 @@ public class ExtractConfigProviderServiceImpl implements ExtractConfigProviderSe
 
     @Override
     public ExtractConfigPaper getDefaultPaper(Long examId, String courseCode, String groupCode) {
-        log.info("调卷开始...");
+        LOG.info("调卷开始...");
 
         ExtractConfigCacheBean extractConfigCache = CacheHelper.getExtractConfig(examId, courseCode);
         if (extractConfigCache == null) {
@@ -158,7 +158,7 @@ public class ExtractConfigProviderServiceImpl implements ExtractConfigProviderSe
             throw new StatusException("500", msg);
         }
 
-        log.info("构建试卷结构..." + basePaperId);
+        LOG.info("构建试卷结构..." + basePaperId);
         ExtractConfigPaperCacheBean extractConfigPaperCache = CacheHelper.getExtractConfigPaper(examId, courseCode, groupCode, basePaperId);
         if (extractConfigPaperCache == null) {
             throw new StatusException("500", msg);
@@ -240,7 +240,7 @@ public class ExtractConfigProviderServiceImpl implements ExtractConfigProviderSe
      * 根据paper对象构建DefaultPaper对象
      */
     public DefaultPaper buildDefaultByBasePaper(Paper basePaper, Long examId, String courseCode, String groupCode) {
-        log.debug("开始包装网考需要的试卷结构...");
+        LOG.debug("开始包装网考需要的试卷结构...");
 
         //获取大题
         List<PaperDetail> paperDetails = paperDetailRepo.findByPaper(basePaper);
@@ -255,7 +255,7 @@ public class ExtractConfigProviderServiceImpl implements ExtractConfigProviderSe
         //根据大题id将小题归类
         Map<String, List<PaperDetailUnit>> pduMap = allPaperDetailUnits.stream().collect(Collectors.groupingBy(PaperDetailUnit::getDetailId));
 
-        log.debug("循环大题,开始组装对象...");
+        LOG.debug("循环大题,开始组装对象...");
 
         //生成新的分组集合
         List<DefaultQuestionGroup> questionGroupList = new ArrayList<>();
@@ -268,7 +268,7 @@ public class ExtractConfigProviderServiceImpl implements ExtractConfigProviderSe
             //获取原小题的集合
             List<PaperDetailUnit> paperDetailUnits = pduMap.get(paperDetail.getId());
             if (CollectionUtils.isEmpty(paperDetailUnits)) {
-                log.warn("试卷大题下面没有小题!");
+                LOG.warn("试卷大题下面没有小题!");
                 throw new StatusException("500", "考试试卷有误,请联系老师!");
             }
 
@@ -381,7 +381,7 @@ public class ExtractConfigProviderServiceImpl implements ExtractConfigProviderSe
 
     @Override
     public DefaultQuestion getDefaultQuestion(Long examId, String courseCode, String groupCode, String questionId) {
-        log.debug("网考根据调卷规则中试题id:" + questionId + "获取单个试题...");
+        LOG.debug("网考根据调卷规则中试题id:" + questionId + "获取单个试题...");
         long beginTime = System.currentTimeMillis();
 
         Question question = Model.of(quesRepo.findById(questionId));
@@ -390,7 +390,7 @@ public class ExtractConfigProviderServiceImpl implements ExtractConfigProviderSe
         }
 
         quesService.formatQues(question);
-        log.debug("查询单个试题耗时:" + (System.currentTimeMillis() - beginTime) + "ms");
+        LOG.debug("查询单个试题耗时:" + (System.currentTimeMillis() - beginTime) + "ms");
 
         //封装成新的题单元集合
         beginTime = System.currentTimeMillis();
@@ -426,11 +426,11 @@ public class ExtractConfigProviderServiceImpl implements ExtractConfigProviderSe
         defaultQuestion.setMasterVersion(defaultQuestionStructure);
 
         if (examId != null) {
-            log.debug("替换试题单元中的音频路径...");
+            LOG.debug("替换试题单元中的音频路径...");
             appendAudioFlag(defaultQuestion, String.valueOf(examId), courseCode, groupCode, question);
         }
 
-        log.debug("封装成新的题单元集合耗时:" + (System.currentTimeMillis() - beginTime) + "ms");
+        LOG.debug("封装成新的题单元集合耗时:" + (System.currentTimeMillis() - beginTime) + "ms");
         return defaultQuestion;
     }
 
@@ -610,7 +610,7 @@ public class ExtractConfigProviderServiceImpl implements ExtractConfigProviderSe
     public DefaultPaper getBaseDefaultPaper(String paperId) {
         Paper basePaper = Model.of(paperRepo.findById(paperId));
         if (basePaper == null) {
-            log.error("该考试和课程下调卷规则中该类型试卷不存在,请检查调卷规则,调卷程序退出");
+            LOG.error("该考试和课程下调卷规则中该类型试卷不存在,请检查调卷规则,调卷程序退出");
             throw new StatusException("Q-020560", "该考试和课程下调卷规则中试卷不存在,请重新制定调卷规则");
         }
 
@@ -624,7 +624,7 @@ public class ExtractConfigProviderServiceImpl implements ExtractConfigProviderSe
         Map<String, DefaultQuestion> map = new HashMap<>();
         List<Question> questions = quesRepo.findByIdIn(questionIds);
         if (CollectionUtils.isEmpty(questions)) {
-            log.error("根据试题id的集合没有查询到试题结合");
+            LOG.error("根据试题id的集合没有查询到试题结合");
             throw new StatusException("Q-020572", "根据试题id的集合没有查询到试题结合");
         }
         for (Question question : questions) {

+ 35 - 35
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExtractConfigServiceImpl.java

@@ -88,7 +88,7 @@ import cn.com.qmth.examcloud.web.redis.RedisClient;
  */
 @Service("extractConfigService")
 public class ExtractConfigServiceImpl implements ExtractConfigService {
-    private static final Logger logger = LoggerFactory.getLogger(ExtractConfigServiceImpl.class);
+    private static final Logger LOG = LoggerFactory.getLogger(ExtractConfigServiceImpl.class);
 
     @Autowired
     private ExtractConfigRepo extractConfigRepo;
@@ -232,61 +232,61 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
     @Override
     public Map<String, Object> extractExamPaper(Long exam_id, String course_code, String group_code) {
         Map<String, Object> returnMap = new HashMap<>();
-        logger.info("调卷开始...");
+        LOG.info("调卷开始...");
         long beginTime = System.currentTimeMillis();
-        logger.info("开始根据examId:" + exam_id + "和courseCode:" + course_code + "获取调卷规则");
+        LOG.info("开始根据examId:" + exam_id + "和courseCode:" + course_code + "获取调卷规则");
         ExtractConfig extractConfig = this.findConfig(new ExtractConfig(exam_id, course_code));
         if (extractConfig == null) {
-            logger.error("该考试和课程下调卷规则未制定,请先制定调卷规则,调卷程序退出");
+            LOG.error("该考试和课程下调卷规则未制定,请先制定调卷规则,调卷程序退出");
             returnMap.put("errorMsg", "该考试和课程下调卷规则未制定,请先制定调卷规则");
             return returnMap;
         }
         long configFinishTime = System.currentTimeMillis();
-        logger.info("获取调卷规则共耗时:" + (configFinishTime - beginTime) + "ms");
-        logger.info("根据调卷规则中设置的概率获取类型为" + group_code + "的试卷");
+        LOG.info("获取调卷规则共耗时:" + (configFinishTime - beginTime) + "ms");
+        LOG.info("根据调卷规则中设置的概率获取类型为" + group_code + "的试卷");
         Map<String, Paper> paperMap = this.getExamPaperByProbability(extractConfig.getExamPaperList());
         if (paperMap.isEmpty()) {
-            logger.error("该考试和课程下调卷规则中试卷不存在,请检查调卷规则,调卷程序退出");
+            LOG.error("该考试和课程下调卷规则中试卷不存在,请检查调卷规则,调卷程序退出");
             returnMap.put("errorMsg", "该考试和课程下调卷规则中试卷不存在,请重新制定调卷规则");
             return returnMap;
         }
 
         long paperMapFinishTime = System.currentTimeMillis();
-        logger.info("获取类型为" + group_code + "的试卷共耗时:" + (paperMapFinishTime - configFinishTime) + "ms");
+        LOG.info("获取类型为" + group_code + "的试卷共耗时:" + (paperMapFinishTime - configFinishTime) + "ms");
 
         Paper basePaper = paperMap.get(group_code);
         if (basePaper == null) {
-            logger.error("该考试和课程下调卷规则中该类型试卷不存在,请检查调卷规则,调卷程序退出");
+            LOG.error("该考试和课程下调卷规则中该类型试卷不存在,请检查调卷规则,调卷程序退出");
             returnMap.put("errorMsg", "该考试和课程下调卷规则中该类型试卷不存在,请重新制定调卷规则");
             return returnMap;
         }
         String basePaperId = basePaper.getId();
-        logger.info("将原始试卷:" + basePaperId + "根据规则重新组卷");
+        LOG.info("将原始试卷:" + basePaperId + "根据规则重新组卷");
         int upSetQuestionOrder = extractConfig.getScrambling_the_question_order();
         int upSetOptionOrder = extractConfig.getScrambling_the_option_order();
         //不乱序直接调卷
         if (upSetQuestionOrder == 0 && upSetOptionOrder == 0) {
             PaperDto paperDto = getPaperDtoByPaper(basePaper, basePaperId);
             long paperDtoFinishTime = System.currentTimeMillis();
-            logger.info("获取试卷Dto共耗时:" + (paperDtoFinishTime - paperMapFinishTime) + "ms");
+            LOG.info("获取试卷Dto共耗时:" + (paperDtoFinishTime - paperMapFinishTime) + "ms");
             returnMap.put("paperDto", paperDto);
-            logger.info("调卷完成");
-            logger.info("总共耗时:" + (System.currentTimeMillis() - beginTime) + "ms");
+            LOG.info("调卷完成");
+            LOG.info("总共耗时:" + (System.currentTimeMillis() - beginTime) + "ms");
         } else {
             //乱序重新生成试卷
             Paper newPaper = this.recombinationPaper(basePaper, PaperType.STUDENT_EXAM, upSetQuestionOrder, upSetOptionOrder);
-            logger.info("根据新试卷 paperId:" + newPaper.getId() + "组装PaperDto后返回");
+            LOG.info("根据新试卷 paperId:" + newPaper.getId() + "组装PaperDto后返回");
 
             long genPaperFinishTime = System.currentTimeMillis();
-            logger.info("组卷共耗时:" + (genPaperFinishTime - paperMapFinishTime) + "ms");
+            LOG.info("组卷共耗时:" + (genPaperFinishTime - paperMapFinishTime) + "ms");
             PaperDto paperDto = getPaperDtoByPaper(newPaper, basePaperId);
 
             long paperDtoFinishTime = System.currentTimeMillis();
-            logger.info("获取试卷Dto共耗时:" + (paperDtoFinishTime - genPaperFinishTime) + "ms");
+            LOG.info("获取试卷Dto共耗时:" + (paperDtoFinishTime - genPaperFinishTime) + "ms");
 
             returnMap.put("paperDto", paperDto);
-            logger.info("调卷完成");
-            logger.info("总共耗时:" + (System.currentTimeMillis() - beginTime) + "ms");
+            LOG.info("调卷完成");
+            LOG.info("总共耗时:" + (System.currentTimeMillis() - beginTime) + "ms");
         }
         return returnMap;
     }
@@ -602,35 +602,35 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
         paperDto.setAllQbjectiveQuestion(checkIsAllQbjectiveQuestion(basePaperId));
 
         long paperDtoEndTime = System.currentTimeMillis();
-        logger.info("单独组装paperDto耗时:" + (paperDtoEndTime - beginTime) + "ms");
+        LOG.info("单独组装paperDto耗时:" + (paperDtoEndTime - beginTime) + "ms");
 
         //将小题全部取出来,只取一次
         List<PaperDetailUnit> allPaperDetailUnits = paperDetailUnitRepo.findByPaper(paper);
         long pduEndTime = System.currentTimeMillis();
-        logger.info("数据库取小题耗时:" + (pduEndTime - paperDtoEndTime) + "ms");
+        LOG.info("数据库取小题耗时:" + (pduEndTime - paperDtoEndTime) + "ms");
         Collections.sort(allPaperDetailUnits);
         long pduSortEndTime = System.currentTimeMillis();
-        logger.info("排序小题耗时:" + (pduSortEndTime - pduEndTime) + "ms");
+        LOG.info("排序小题耗时:" + (pduSortEndTime - pduEndTime) + "ms");
 
         //获取大题
         List<PaperDetail> paperDetails = paperDetailRepo.findByPaper(paper);
         long pdEndTime = System.currentTimeMillis();
-        logger.info("数据库取大题耗时:" + (pdEndTime - pduSortEndTime) + "ms");
+        LOG.info("数据库取大题耗时:" + (pdEndTime - pduSortEndTime) + "ms");
         Collections.sort(paperDetails);
         long pdSortEndTime = System.currentTimeMillis();
-        logger.info("排序大题耗时:" + (pdSortEndTime - pdEndTime) + "ms");
+        LOG.info("排序大题耗时:" + (pdSortEndTime - pdEndTime) + "ms");
 
         //抽取大题Id对应的小题
         Map<String, List<PaperDetailUnit>> pduMap = allPaperDetailUnits.stream()
                 .collect(Collectors.groupingBy(PaperDetailUnit::getDetailId));
         long pduMapEndTime = System.currentTimeMillis();
-        logger.info("获取大题与小题对应关系耗时:" + (pduMapEndTime - pdSortEndTime) + "ms");
+        LOG.info("获取大题与小题对应关系耗时:" + (pduMapEndTime - pdSortEndTime) + "ms");
 
         // 获取大题Dto
         List<PaperDetailDto> paperDetailDtos = paperDetailDtoAssembler.toDtoList(paperDetails);
         paperDto.setPaperDetails(paperDetailDtos);
         long paperDetailDtoEndTime = System.currentTimeMillis();
-        logger.info("单独组装paperDetailDto耗时:" + (paperDetailDtoEndTime - pduMapEndTime) + "ms");
+        LOG.info("单独组装paperDetailDto耗时:" + (paperDetailDtoEndTime - pduMapEndTime) + "ms");
 
         // 封装小题
         for (int i = 0; i < paperDetailDtos.size(); i++) {
@@ -680,7 +680,7 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
             paperDetailDtos.get(i).setCnNum(CommonUtils.toCHNum(paperDetailDtos.get(i).getNumber()));
         }
         long paperDetailUnitDtoEndTime = System.currentTimeMillis();
-        logger.info("单独组装paperDetailUnitDto耗时:" + (paperDetailUnitDtoEndTime - paperDetailDtoEndTime) + "ms");
+        LOG.info("单独组装paperDetailUnitDto耗时:" + (paperDetailUnitDtoEndTime - paperDetailDtoEndTime) + "ms");
 
         //将重新组装的dto放进缓存
         redisClient.set(CACHE_KEY_PAPER_FOR_DTO + paperDto.getId(), paperDto, DEFAULT_TIME_OUT);
@@ -703,43 +703,43 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
         paperDto.setBasePaperId(basePaperId);
 
         long paperDtoEndTime = System.currentTimeMillis();
-        logger.info("单独组装paperDto耗时:" + (paperDtoEndTime - beginTime) + "ms");
+        LOG.info("单独组装paperDto耗时:" + (paperDtoEndTime - beginTime) + "ms");
 
         //将小题全部取出来,只取一次
         // List<PaperDetailUnit> allPaperDetailUnits = detailUnitNativeRepo.findByPaperId(paper.getId());
         List<PaperDetailUnit> allPaperDetailUnits = new ArrayList<>();
 
         long pduEndTime = System.currentTimeMillis();
-        logger.info("数据库取小题耗时:" + (pduEndTime - paperDtoEndTime) + "ms");
+        LOG.info("数据库取小题耗时:" + (pduEndTime - paperDtoEndTime) + "ms");
         Collections.sort(allPaperDetailUnits);
         long pduSortEndTime = System.currentTimeMillis();
-        logger.info("排序小题耗时:" + (pduSortEndTime - pduEndTime) + "ms");
+        LOG.info("排序小题耗时:" + (pduSortEndTime - pduEndTime) + "ms");
 
 
         paperDto.setAllQbjectiveQuestion(checkIsAllQbjectiveByPdu(allPaperDetailUnits));
         long isAllObjEndtime = System.currentTimeMillis();
-        logger.info("设置客观题耗时:" + (isAllObjEndtime - pduSortEndTime) + "ms");
+        LOG.info("设置客观题耗时:" + (isAllObjEndtime - pduSortEndTime) + "ms");
 
 
         //获取大题
         List<PaperDetail> paperDetails = paperDetailRepo.findByPaper(paper);
         long pdEndTime = System.currentTimeMillis();
-        logger.info("数据库取大题耗时:" + (pdEndTime - isAllObjEndtime) + "ms");
+        LOG.info("数据库取大题耗时:" + (pdEndTime - isAllObjEndtime) + "ms");
         Collections.sort(paperDetails);
         long pdSortEndTime = System.currentTimeMillis();
-        logger.info("排序大题耗时:" + (pdSortEndTime - pdEndTime) + "ms");
+        LOG.info("排序大题耗时:" + (pdSortEndTime - pdEndTime) + "ms");
 
         //抽取大题Id对应的小题
         Map<String, List<PaperDetailUnit>> pduMap = allPaperDetailUnits.stream()
                 .collect(Collectors.groupingBy(PaperDetailUnit::getDetailId));
         long pduMapEndTime = System.currentTimeMillis();
-        logger.info("获取大题与小题对应关系耗时:" + (pduMapEndTime - pdSortEndTime) + "ms");
+        LOG.info("获取大题与小题对应关系耗时:" + (pduMapEndTime - pdSortEndTime) + "ms");
 
         // 获取大题Dto
         List<PaperDetailDto> paperDetailDtos = paperDetailDtoAssembler.toDtoList(paperDetails);
         paperDto.setPaperDetails(paperDetailDtos);
         long paperDetailDtoEndTime = System.currentTimeMillis();
-        logger.info("单独组装paperDetailDto耗时:" + (paperDetailDtoEndTime - pduMapEndTime) + "ms");
+        LOG.info("单独组装paperDetailDto耗时:" + (paperDetailDtoEndTime - pduMapEndTime) + "ms");
 
         // 封装小题
         for (int i = 0; i < paperDetailDtos.size(); i++) {
@@ -789,7 +789,7 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
             paperDetailDtos.get(i).setCnNum(CommonUtils.toCHNum(paperDetailDtos.get(i).getNumber()));
         }
         long paperDetailUnitDtoEndTime = System.currentTimeMillis();
-        logger.info("单独组装paperDetailUnitDto耗时:" + (paperDetailUnitDtoEndTime - paperDetailDtoEndTime) + "ms");
+        LOG.info("单独组装paperDetailUnitDto耗时:" + (paperDetailUnitDtoEndTime - paperDetailDtoEndTime) + "ms");
         return paperDto;
     }
 

+ 16 - 16
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/GenPaperService.java

@@ -13,12 +13,12 @@ import java.util.stream.Collectors;
 
 import org.apache.commons.collections.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.stereotype.Service;
 
 import cn.com.qmth.examcloud.api.commons.security.bean.User;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
 import cn.com.qmth.examcloud.core.questions.base.CommonUtils;
 import cn.com.qmth.examcloud.core.questions.base.IdUtils;
 import cn.com.qmth.examcloud.core.questions.base.Model;
@@ -50,7 +50,7 @@ import cn.com.qmth.examcloud.core.questions.service.util.PaperUtil;
 @Service
 public class GenPaperService {
 
-    protected ExamCloudLog log = ExamCloudLogFactory.getLog(this.getClass());
+    private static final Logger LOG = LoggerFactory.getLogger(GenPaperService.class);
 
     @Autowired
     PaperRepo paperRepo;
@@ -80,7 +80,7 @@ public class GenPaperService {
      */
     @SuppressWarnings("unchecked")
     public Map<String, Object> genPaper(GenPaperDto genPaperDto) {
-        log.debug("开始组卷.....");
+        LOG.debug("开始组卷.....");
         String msg = "";
         Map<String, Object> paperMsgMap = new HashMap<>();
         LinkedList<Question> questions = new LinkedList<>();
@@ -108,7 +108,7 @@ public class GenPaperService {
         Set<PaperDetailUnit> spareUnits = new HashSet<>();
         spareUnits.addAll(unitList);
         long total = (System.currentTimeMillis() - start) / 1000;
-        log.debug("total:" + total);
+        LOG.debug("total:" + total);
     	
     	/*for (PaperDetailUnit unit : spareUnits) {
             Question question = unit.getQuestion();
@@ -129,11 +129,11 @@ public class GenPaperService {
         for (PaperDetailUnit unit : spareUnits) {
             oIds.add(unit.getQuestion().getId());
         }
-        log.debug("total2.....--------实际原题数量:" + oIds.size());
+        LOG.debug("total2.....--------实际原题数量:" + oIds.size());
         long start2 = System.currentTimeMillis();
         List<PaperDetailUnit> oDetailUnits = paperDetailUnitService.findByQuestionsAndPaperType(oIds, PaperType.IMPORT);
         long total2 = (System.currentTimeMillis() - start2) / 1000;
-        log.debug("total2....." + total2 + "--------查询原题数量:" + oDetailUnits.size());
+        LOG.debug("total2....." + total2 + "--------查询原题数量:" + oDetailUnits.size());
         long start4 = System.currentTimeMillis();
         for (PaperDetailUnit oldUnit : oDetailUnits) {
             if (oldUnit.getPaper().getPaperType() == PaperType.IMPORT) {
@@ -150,7 +150,7 @@ public class GenPaperService {
             }
         }
         long total4 = (System.currentTimeMillis() - start4) / 1000;
-        log.debug("循环耗时....." + total4 + "--------最终原题数量:" + questions.size());
+        LOG.debug("循环耗时....." + total4 + "--------最终原题数量:" + questions.size());
         Collections.shuffle(questions);
         int maxLoopCount = questions.size() * 2;
         int selectCount = 0;
@@ -204,7 +204,7 @@ public class GenPaperService {
             long start3 = System.currentTimeMillis();
             paper = this.persistentPaper(PaperStructType.EXACT, paperDetailunits, paperDetails, paper);
             long total3 = (System.currentTimeMillis() - start3) / 1000;
-            log.debug("total3....." + total3);
+            LOG.debug("total3....." + total3);
             msg = "success";
             paperMsgMap.put("paper", paper);
             paperMsgMap.put("msg", msg);
@@ -944,7 +944,7 @@ public class GenPaperService {
                                  List<PaperDetailUnit> selectedUnits,
                                  List<PaperDetail> details,
                                  Paper paper) {
-        log.debug("3.....");
+        LOG.debug("3.....");
         paper = paperRepo.save(paper);
         for (PaperDetail pd : details) {
             pd.setPaper(paper);
@@ -1023,7 +1023,7 @@ public class GenPaperService {
      */
     @SuppressWarnings("unchecked")
     public Map<String, Object> genBluePaper(GenPaperDto genPaperDto) {
-        log.debug("开始蓝图组卷.....");
+        LOG.debug("开始蓝图组卷.....");
         String msg = "";
         Map<String, Object> paperMsgMap = new HashMap<>();
         LinkedList<Question> questions = new LinkedList<>();
@@ -1051,7 +1051,7 @@ public class GenPaperService {
         Set<PaperDetailUnit> spareUnits = new HashSet<>();
         spareUnits.addAll(unitList);
         long total = (System.currentTimeMillis() - start) / 1000;
-        log.debug("total:" + total);
+        LOG.debug("total:" + total);
     	
     	/*for (PaperDetailUnit unit : spareUnits) {
             Question question = unit.getQuestion();
@@ -1072,11 +1072,11 @@ public class GenPaperService {
         for (PaperDetailUnit unit : spareUnits) {
             oIds.add(unit.getQuestion().getId());
         }
-        log.debug("total2.....--------实际原题数量:" + oIds.size());
+        LOG.debug("total2.....--------实际原题数量:" + oIds.size());
         long start2 = System.currentTimeMillis();
         List<PaperDetailUnit> oDetailUnits = paperDetailUnitService.findByQuestionsAndPaperType(oIds, PaperType.IMPORT);
         long total2 = (System.currentTimeMillis() - start2) / 1000;
-        log.debug("total2....." + total2 + "--------查询原题数量:" + oDetailUnits.size());
+        LOG.debug("total2....." + total2 + "--------查询原题数量:" + oDetailUnits.size());
         long start4 = System.currentTimeMillis();
         for (PaperDetailUnit oldUnit : oDetailUnits) {
             if (oldUnit.getPaper().getPaperType() == PaperType.IMPORT) {
@@ -1086,7 +1086,7 @@ public class GenPaperService {
             }
         }
         long total4 = (System.currentTimeMillis() - start4) / 1000;
-        log.debug("循环耗时....." + total4 + "--------最终原题数量:" + questions.size());
+        LOG.debug("循环耗时....." + total4 + "--------最终原题数量:" + questions.size());
         /*for (Paper oldPaper : papers) {
             List<PaperDetailUnit> unitList = unitRepo.findByPaperOrderByNumber(oldPaper);
             for (PaperDetailUnit unit : unitList) {
@@ -1224,7 +1224,7 @@ public class GenPaperService {
     }
 
 	public Map<String, Object> genPaperManual(GenPaperDto genPaperDto) {
-		log.debug("开始组卷.....");
+		LOG.debug("开始组卷.....");
         String msg = "";
         Map<String, Object> paperMsgMap = new HashMap<>();
         //查询试卷结构

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

@@ -1,8 +1,6 @@
 package cn.com.qmth.examcloud.core.questions.service.impl;
 
 import cn.com.qmth.examcloud.commons.exception.StatusException;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
 import cn.com.qmth.examcloud.core.questions.api.bean.PaperK12Bean;
 import cn.com.qmth.examcloud.core.questions.base.CommonUtils;
 import cn.com.qmth.examcloud.core.questions.base.Model;
@@ -14,6 +12,8 @@ import cn.com.qmth.examcloud.core.questions.service.PaperProviderService;
 import cn.com.qmth.examcloud.question.commons.core.paper.DefaultPaper;
 import org.apache.commons.collections.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.stereotype.Service;
 
@@ -33,7 +33,7 @@ import java.util.Set;
 @Service("paperProviderServiceImpl")
 public class PaperProviderServiceImpl implements PaperProviderService {
 
-    protected ExamCloudLog log = ExamCloudLogFactory.getLog(this.getClass());
+    private static final Logger LOG = LoggerFactory.getLogger(PaperProviderServiceImpl.class);
 
     @Autowired
     private QuesRepo quesRepo;
@@ -67,7 +67,7 @@ public class PaperProviderServiceImpl implements PaperProviderService {
         //查询所有试题集合
         List<Question> questions = quesRepo.findByIdIn(questionIds);
         if (CollectionUtils.isEmpty(questions)) {
-            log.error("根据试题id的集合没有查询到试题结合");
+            LOG.error("根据试题id的集合没有查询到试题结合");
             throw new StatusException("Q-014041", "根据试题id的集合没有查询到试题结合");
         }
         //构建试卷对象

+ 11 - 11
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/PaperServiceImpl.java

@@ -33,6 +33,8 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.nlpcn.commons.lang.util.StringUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Example;
@@ -53,8 +55,6 @@ import com.google.gson.Gson;
 
 import cn.com.qmth.examcloud.api.commons.security.bean.User;
 import cn.com.qmth.examcloud.commons.exception.StatusException;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
 import cn.com.qmth.examcloud.commons.util.JsonUtil;
 import cn.com.qmth.examcloud.core.print.api.CoursePaperCloudService;
 import cn.com.qmth.examcloud.core.print.api.bean.SyncCoursePaperBean;
@@ -124,7 +124,7 @@ import cn.com.qmth.examcloud.web.support.SpringContextHolder;
 @Service("paperService")
 public class PaperServiceImpl implements PaperService {
 
-    protected ExamCloudLog log = ExamCloudLogFactory.getLog(this.getClass());
+    private static final Logger LOG = LoggerFactory.getLogger(PaperServiceImpl.class);
 
     @Autowired
     PaperRepo paperRepo;
@@ -1368,7 +1368,7 @@ public class PaperServiceImpl implements PaperService {
             File mp3Directory = new File(mp3DirectoryPath);
             FileUtils.deleteDirectory(mp3Directory);
         } catch (IOException e) {
-            log.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
         }
     }
 
@@ -1392,7 +1392,7 @@ public class PaperServiceImpl implements PaperService {
         try {
             outputStream = new FileOutputStream(mp3File);
         } catch (FileNotFoundException e) {
-            log.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
             throw new StatusException("500", "音频文件处理失败!");
         }
 
@@ -1417,7 +1417,7 @@ public class PaperServiceImpl implements PaperService {
             QuestionAudio audio = new QuestionAudio(questionId, file.getOriginalFilename(), pi.getRelativePath());
             questionAudioService.saveQuestionAudio(audio, user);
         } catch (Exception e) {
-            log.error(e.getMessage(), e);
+            LOG.error(e.getMessage(), e);
             throw new StatusException("500", "音频文件保存失败!");
         } finally {
             try {
@@ -1592,7 +1592,7 @@ public class PaperServiceImpl implements PaperService {
         dto.setPaperId(paperId);
     	dto.setSeqMode(PaperSeqMode.MODE3);
         PaperExp paperExp = exportPaperAbstractService.initPaperExp(dto);
-        log.info("已经获取试卷");
+        LOG.info("已经获取试卷");
         //得到试卷中的客观大题
         List<PaperDetailExp> objectiveDetails = exportPaperAbstractService.getAllObjectiveDetails(paperExp);
         //客观题中如果有套题,要拆开
@@ -1604,7 +1604,7 @@ public class PaperServiceImpl implements PaperService {
                 objectiveQuestionStructureList.add(new ObjectiveQuestionStructure(paperExp, paperDetailExp, unit, null));
             }
         }
-        log.info("生成客观题数集合");
+        LOG.info("生成客观题数集合");
         //得到试卷中的主观大题
         List<PaperDetailExp> subjectiveDetails = exportPaperAbstractService.getAllSubjectiveDetails(paperExp);
         //生成主观题数集合
@@ -1614,12 +1614,12 @@ public class PaperServiceImpl implements PaperService {
                 subjectiveQuestionStructureList.add(new SubjectiveQuestionStructure(paperExp, paperDetailExp, unit, null));
             }
         }
-        log.info("生成主观题数集合");
+        LOG.info("生成主观题数集合");
         PaperQuestionStructureInfo info = new PaperQuestionStructureInfo();
         info.setObjectives(objectiveQuestionStructureList);
         info.setSubjectives(subjectiveQuestionStructureList);
         String jsonResp = JsonUtil.toJson(info);
-        log.info("jsonResp:" + jsonResp);
+        LOG.info("jsonResp:" + jsonResp);
         return jsonResp;
     }
 
@@ -2128,7 +2128,7 @@ public class PaperServiceImpl implements PaperService {
 				try {
 					wb.close();
 				} catch (IOException e) {
-					log.debug("wb.close() error "+e);
+					LOG.debug("wb.close() error "+e);
 				}
 			}
 		}

+ 1 - 1
examcloud-core-questions-starter/src/main/java/cn/com/qmth/examcloud/core/questions/starter/config/initData.java

@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
 @Component
 public class initData implements CommandLineRunner {
 
-    protected static final Logger log = LoggerFactory.getLogger(initData.class);
+    private static final Logger log = LoggerFactory.getLogger(initData.class);
 
     @Autowired
     SettingService settingService;

+ 18 - 39
examcloud-core-questions-starter/src/main/resources/log4j2.xml

@@ -2,47 +2,31 @@
 <Configuration status="WARN" monitorInterval="30">
 
     <Properties>
-        <Property name="commonLevel" value="${sys:log.commonLevel}"/>
-        <Property name="logPattern">
+        <Property name="LOG_LEVEL" value="${sys:log.commonLevel}"/>
+        <Property name="LOG_DIR" value="./logs/examcloud-core-questions"/>
+        <Property name="LOG_PATTERN">
             %d{yyyy-MM-dd HH:mm:ss.SSS} | %clr{%level} | %X{TRACE_ID} %X{CALLER} | %clr{%c{1.1}:%L}{cyan} | %m%n
         </Property>
     </Properties>
 
     <Appenders>
-        <!-- 控制台 日志 -->
-        <Console name="Console" target="SYSTEM_OUT">
-            <PatternLayout pattern="${logPattern}" charset="UTF-8"/>
+        <Console name="CONSOLE_APPENDER" target="SYSTEM_OUT">
+            <PatternLayout pattern="${LOG_PATTERN}" charset="UTF-8"/>
         </Console>
 
-        <!-- debug 日志 -->
-        <RollingFile name="DEBUG_APPENDER"
-                     fileName="./logs/debug/debug.log"
-                     filePattern="./logs/debug/debug-%d{yyyy.MM.dd.HH}-%i.log">
-            <PatternLayout pattern="${logPattern}" charset="UTF-8"/>
-            <Policies>
-                <TimeBasedTriggeringPolicy interval="1" modulate="false"/>
-                <SizeBasedTriggeringPolicy size="100 MB"/>
-            </Policies>
-            <DefaultRolloverStrategy max="1000">
-                <Delete basePath="./logs/debug" maxDepth="1">
-                    <IfFileName glob="debug-*.log">
-                        <IfAccumulatedFileSize exceeds="2 GB"/>
-                    </IfFileName>
-                </Delete>
-            </DefaultRolloverStrategy>
-        </RollingFile>
+        <RollingFile name="FILE_APPENDER"
+                     fileName="${LOG_DIR}/debug.log"
+                     filePattern="${LOG_DIR}/debug-%d{yyyyMMdd}-%i.log">
+            <PatternLayout pattern="${LOG_PATTERN}" charset="UTF-8"/>
 
-        <!-- 接口日志 -->
-        <RollingFile name="INTERFACE_APPENDER" fileName="./logs/interface/interface.log"
-                     filePattern="./logs/interface/interface-%d{yyyy.MM.dd.HH}-%i.log">
-            <PatternLayout pattern="${logPattern}" charset="UTF-8"/>
             <Policies>
                 <TimeBasedTriggeringPolicy interval="1" modulate="false"/>
                 <SizeBasedTriggeringPolicy size="100 MB"/>
             </Policies>
+
             <DefaultRolloverStrategy max="1000">
-                <Delete basePath="./logs/interface" maxDepth="1">
-                    <IfFileName glob="interface-*.log">
+                <Delete basePath="${LOG_DIR}" maxDepth="1">
+                    <IfFileName glob="debug-*.log">
                         <IfAccumulatedFileSize exceeds="10 GB"/>
                     </IfFileName>
                 </Delete>
@@ -67,19 +51,14 @@
         <!--<logger name="org.springframework.data.mongodb" level="DEBUG"/>-->
         <!--<logger name="org.springframework.data.redis" level="DEBUG"/>-->
 
-        <Logger name="cn.com.qmth" level="${commonLevel}" additivity="false">
-            <AppenderRef ref="DEBUG_APPENDER"/>
-            <AppenderRef ref="Console"/>
-        </Logger>
-
-        <Logger name="INTERFACE_LOGGER" level="${commonLevel}" additivity="false">
-            <AppenderRef ref="INTERFACE_APPENDER"/>
-            <AppenderRef ref="Console"/>
+        <Logger name="cn.com.qmth" level="${LOG_LEVEL}" additivity="false">
+            <AppenderRef ref="CONSOLE_APPENDER"/>
+            <AppenderRef ref="FILE_APPENDER"/>
         </Logger>
 
-        <Root level="${commonLevel}">
-            <AppenderRef ref="Console"/>
-            <AppenderRef ref="DEBUG_APPENDER"/>
+        <Root level="${LOG_LEVEL}">
+            <AppenderRef ref="CONSOLE_APPENDER"/>
+            <AppenderRef ref="FILE_APPENDER"/>
         </Root>
     </Loggers>