// 添加每日一练试卷内容
 private void addDailyPapers(Paper paper, ItemType[] itemTypes) throws Exception {
   if (paper == null || itemTypes == null || itemTypes.length == 0) return;
   String msg = null;
   for (int i = 0; i < itemTypes.length; i++) {
     // 构建试卷结构。
     Structure structure = new Structure(paper);
     structure.setTitle(this.itemService.loadTypeName(itemTypes[i].getValue()));
     structure.setType(itemTypes[i].getValue());
     structure.setTotal(
         (this.avgStructureItemsCount == null || this.avgStructureItemsCount <= 0)
             ? avg_structure_items_count
             : this.avgStructureItemsCount);
     structure.setOrderNo(i + 1);
     structure.setScore(BigDecimal.ONE); // 每题一分 用来计数
     // 随机选题。
     int total = this.randomItemService.addRandomItem(structure, false);
     if (total <= 0) {
       logger.error(msg = String.format("试卷结构[%s]下未能成功随机选择出试题!", structure));
       throw new Exception(msg);
     }
     if (total != structure.getTotal()) structure.setTotal(total);
     paper.getStructures().add(structure);
   }
   // 试卷试题重新排序
   this.randomItemService.updateItemOrder(paper);
   paper.setStatus(PaperStatus.AUDIT.getValue());
   this.paperDao.save(paper);
 }
 // 构建试卷对象。
 private Paper buildPaper(Subject subject, Area area) {
   Paper paper = new Paper();
   String examName = subject.getExam().getName();
   if (!StringUtils.isEmpty(examName) && !examName.endsWith("考试")) {
     examName = String.format("%s考试", examName);
   }
   paper.setName(
       String.format(
           "%1$s《%2$s》%3$s每日一练[%4$s]",
           examName,
           subject.getName(),
           (area == null ? "" : "[" + area.getName() + "]"),
           new SimpleDateFormat("yyyy-MM-dd").format(paper.getCreateTime())));
   paper.setSubject(subject);
   paper.setType(PaperType.DAILY.getValue());
   paper.setScore(null);
   paper.setTime(null);
   paper.setYear(Integer.parseInt(new SimpleDateFormat("yyyy").format(paper.getCreateTime())));
   paper.setArea(area);
   paper.setStructures(new TreeSet<Structure>());
   return paper;
 }