Просмотр исходного кода

升级SpringBoot 1.5.8 到2.1.1

insomniaLee 5 лет назад
Родитель
Сommit
a9200250cb
29 измененных файлов с 149 добавлено и 101 удалено
  1. 8 2
      pom.xml
  2. 1 1
      src/main/java/com/mooctest/CrowdReviewApplication.java
  3. 25 0
      src/main/java/com/mooctest/config/AbstractMongoConfig.java
  4. 19 19
      src/main/java/com/mooctest/config/MongoOneConfig.java
  5. 21 19
      src/main/java/com/mooctest/config/MongoTwoConfig.java
  6. 4 3
      src/main/java/com/mooctest/config/ThymeleafViewResolverConfig.java
  7. 1 1
      src/main/java/com/mooctest/dao/BugDataDao.java
  8. 1 1
      src/main/java/com/mooctest/dao/FinalReportDao.java
  9. 1 1
      src/main/java/com/mooctest/dao/MasterReportDao.java
  10. 1 1
      src/main/java/com/mooctest/model/MasterReport.java
  11. 1 1
      src/main/java/com/mooctest/service/BugDataService.java
  12. 1 1
      src/main/java/com/mooctest/service/BugReviewService.java
  13. 3 3
      src/main/java/com/mooctest/service/FinalReportService.java
  14. 1 1
      src/main/java/com/mooctest/service/MasterReportService.java
  15. 2 2
      src/main/java/com/mooctest/service/impl/BugReportServiceImpl.java
  16. 2 1
      src/main/resources/templates/addReviewJob.html
  17. 2 1
      src/main/resources/templates/agg_report_list.html
  18. 13 7
      src/main/resources/templates/agg_report_new.html
  19. 7 5
      src/main/resources/templates/aggr_report.html
  20. 10 10
      src/main/resources/templates/changePaper.html
  21. 1 1
      src/main/resources/templates/changeReviewJob.html
  22. 1 1
      src/main/resources/templates/final_report_list.html
  23. 1 1
      src/main/resources/templates/jobDetail.html
  24. 1 1
      src/main/resources/templates/jobList.html
  25. 3 3
      src/main/resources/templates/paper_list.html
  26. 3 3
      src/main/resources/templates/single_report.html
  27. 2 2
      src/main/resources/templates/test.html
  28. 1 1
      src/main/resources/templates/tree_report_list.html
  29. 12 8
      src/main/resources/templates/tree_report_new.html

+ 8 - 2
pom.xml

@@ -7,7 +7,7 @@
     <parent>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
-        <version>1.5.7.RELEASE</version>
+        <version>2.1.1.RELEASE</version>
     </parent>
 
     <groupId>com.mooctest</groupId>
@@ -139,6 +139,12 @@
             <artifactId>poi-ooxml</artifactId>
             <version>3.14</version>
         </dependency>
+        <!--从2开始    layout不再是starter的一部分-->
+        <dependency>
+            <groupId>nz.net.ultraq.thymeleaf</groupId>
+            <artifactId>thymeleaf-layout-dialect</artifactId>
+            <version>2.3.0</version>
+        </dependency>
 
 
         <!-- https://mvnrepository.com/artifact/org.apache.zookeeper/zookeeper -->
@@ -177,7 +183,7 @@
             <dependency>
                 <groupId>org.springframework.cloud</groupId>
                 <artifactId>spring-cloud-dependencies</artifactId>
-                <version>Edgware.RELEASE</version>
+                <version>Greenwich.SR2</version>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>

+ 1 - 1
src/main/java/com/mooctest/CrowdReviewApplication.java

@@ -5,7 +5,7 @@ import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.builder.SpringApplicationBuilder;
 import org.springframework.boot.web.servlet.ServletComponentScan;
-import org.springframework.boot.web.support.SpringBootServletInitializer;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
 import org.springframework.scheduling.annotation.EnableAsync;
 
 @SpringBootApplication

+ 25 - 0
src/main/java/com/mooctest/config/AbstractMongoConfig.java

@@ -0,0 +1,25 @@
+package com.mooctest.config;
+
+import com.mongodb.MongoClient;
+import org.springframework.data.mongodb.MongoDbFactory;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
+
+public abstract class AbstractMongoConfig {
+
+    private String host, database;
+    private int port;
+    //Setter methods go here..
+    /*
+     * 创建MongoDBFactory的方法
+     * 两个MongoDB连接共用
+     */
+    public MongoDbFactory mongoDbFactory() throws Exception {
+        return new SimpleMongoDbFactory(new MongoClient(host, port), database);
+    }
+    /*
+     * Factory method to create the MongoTemplate
+     */
+    abstract public MongoTemplate getMongoTemplate() throws Exception;
+
+}

+ 19 - 19
src/main/java/com/mooctest/config/MongoOneConfig.java

@@ -1,8 +1,10 @@
 package com.mooctest.config;
 
+import com.mongodb.MongoClient;
 import com.mongodb.MongoClientOptions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.autoconfigure.mongo.MongoProperties;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.context.annotation.Bean;
@@ -18,29 +20,27 @@ import org.springframework.core.env.Environment;
 @EnableMongoRepositories(
         basePackages = "com.mooctest.dao",
         mongoTemplateRef = "mongoTemplate1")
-public class MongoOneConfig {
-    @Autowired
-    private Environment environment;
+public class MongoOneConfig extends AbstractMongoConfig {
+    @Value("${mongodb1.host}")
+    private String host;
+    @Value("${mongodb1.database}")
+    private String database;
+    @Value("${mongodb1.port}")
+    private int port;
+    //Setter methods go here..
+    /*
+     * 创建MongoDBFactory的方法
+     * 两个MongoDB连接共用
+     */
+    public MongoDbFactory mongoDbFactory() throws Exception {
+        return new SimpleMongoDbFactory(new MongoClient(host, port), database);
+    }
 
 
     @Primary
-    @Bean(name = "mongoTemplate1")
-    public MongoTemplate mongoTemplate(@Qualifier("mongoFactory1") MongoDbFactory mongoFactory) throws Exception {
-        return new MongoTemplate(mongoFactory);
+    public @Bean(name = "mongoTemplate1") MongoTemplate getMongoTemplate() throws Exception {
+        return new MongoTemplate(mongoDbFactory());
     }
 
-    @Primary
-    @Bean("mongoFactory1")
-    public MongoDbFactory mongoFactory(@Qualifier("mongoProperties1") MongoProperties mongoProperties) throws Exception {
-        return new SimpleMongoDbFactory(
-                mongoProperties.createMongoClient(MongoClientOptions.builder().build(), environment),
-                mongoProperties.getDatabase());
-    }
 
-    @Bean(name = "mongoProperties1")
-    @ConfigurationProperties(prefix = "mongodb1")
-    @Primary
-    public MongoProperties properties() throws Exception {
-        return new MongoProperties();
-    }
 }

+ 21 - 19
src/main/java/com/mooctest/config/MongoTwoConfig.java

@@ -1,12 +1,15 @@
 package com.mooctest.config;
 
+import com.mongodb.MongoClient;
 import com.mongodb.MongoClientOptions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.autoconfigure.mongo.MongoProperties;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
 import org.springframework.core.env.Environment;
 import org.springframework.data.mongodb.MongoDbFactory;
 import org.springframework.data.mongodb.core.MongoTemplate;
@@ -18,30 +21,29 @@ import org.springframework.data.mongodb.repository.config.EnableMongoRepositorie
 @EnableMongoRepositories(
         basePackages = "com.mooctest.dao2",
         mongoTemplateRef = "mongoTemplate2")
-public class MongoTwoConfig {
-
-    @Autowired
-    private Environment environment;
+public class MongoTwoConfig{
+
+    @Value("${mongodb2.host}")
+    private String host;
+    @Value("${mongodb2.database}")
+    private String database;
+    @Value("${mongodb2.port}")
+    private int port;
+    //Setter methods go here..
+    /*
+     * 创建MongoDBFactory的方法
+     * 两个MongoDB连接共用
+     */
+    public MongoDbFactory mongoDbFactory2() throws Exception {
+        return new SimpleMongoDbFactory(new MongoClient(host, port), database);
+    }
 
 
-    @Bean(name = "mongoTemplate2")
-    public MongoTemplate mongoTemplate(@Qualifier("mongoFactory2") MongoDbFactory mongoFactory) throws Exception {
-        return new MongoTemplate(mongoFactory);
-    }
 
-    @Bean("mongoFactory2")
-    public MongoDbFactory mongoFactory(
-            @Qualifier("mongoProperties2") MongoProperties mongoProperties) throws Exception {
-        return new SimpleMongoDbFactory(
-                mongoProperties.createMongoClient(MongoClientOptions.builder().build(), environment),
-                mongoProperties.getDatabase());
+    public @Bean(name = "mongoTemplate2") MongoTemplate getMongoTemplate() throws Exception {
+        return new MongoTemplate(mongoDbFactory2());
     }
 
-    @Bean(name = "mongoProperties2")
-    @ConfigurationProperties(prefix = "mongodb2")
-    public MongoProperties properties() {
-        return new MongoProperties();
-    }
 
 }
 

+ 4 - 3
src/main/java/com/mooctest/config/ThymeleafViewResolverConfig.java

@@ -1,12 +1,13 @@
 package com.mooctest.config;
 
+
 import nz.net.ultraq.thymeleaf.LayoutDialect;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.servlet.ViewResolver;
-import org.thymeleaf.spring4.SpringTemplateEngine;
-import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver;
-import org.thymeleaf.spring4.view.ThymeleafViewResolver;
+import org.thymeleaf.spring5.SpringTemplateEngine;
+import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
+import org.thymeleaf.spring5.view.ThymeleafViewResolver;
 import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
 import org.thymeleaf.templateresolver.ITemplateResolver;
 

+ 1 - 1
src/main/java/com/mooctest/dao/BugDataDao.java

@@ -8,7 +8,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.util.List;
 
 @Transactional
-public interface BugDataDao extends MongoRepository<BugData, Long> {
+public interface BugDataDao extends  MongoRepository<BugData, Long> {
 
     // check if there is data in mongo, instead of check all num of the data set
     boolean existsByExamIdAndCaseId(long examId,long caseId);

+ 1 - 1
src/main/java/com/mooctest/dao/FinalReportDao.java

@@ -7,7 +7,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.util.List;
 
 @Transactional
-public interface FinalReportDao extends MongoRepository<FinalReport, Long> {
+public interface FinalReportDao extends  MongoRepository<FinalReport, Long> {
 
     List<FinalReport> findByExamIdAndCaseId(long examId, long caseId);
     List<FinalReport> findBySourceId(String sourceId);

+ 1 - 1
src/main/java/com/mooctest/dao/MasterReportDao.java

@@ -7,7 +7,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.util.List;
 
 @Transactional
-public interface MasterReportDao extends MongoRepository<MasterReport, Long> {
+public interface MasterReportDao extends  MongoRepository<MasterReport, Long> {
 
     List<MasterReport> findByMasterId(String masterId);
 

+ 1 - 1
src/main/java/com/mooctest/model/MasterReport.java

@@ -8,7 +8,7 @@ import lombok.NoArgsConstructor;
 import org.springframework.data.annotation.Id;
 import org.springframework.data.mongodb.core.mapping.Document;
 
-import javax.persistence.*;
+
 
 @Data
 @Builder

+ 1 - 1
src/main/java/com/mooctest/service/BugDataService.java

@@ -96,7 +96,7 @@ public class BugDataService {
                     .bugId(s.getId()).build();
             toSave.add(tempData);
         });
-        bugDataDao.save(toSave); // 将信息存到数据库
+        bugDataDao.saveAll(toSave); // 将信息存到数据库
     }
 
     public List<BugData> getBugDataByIds(List<String> bugIds){

+ 1 - 1
src/main/java/com/mooctest/service/BugReviewService.java

@@ -137,7 +137,7 @@ public class BugReviewService {
             mr.setStatus(1);
             mr.setReviewerId(1l);
         });
-        masterReportDao.save(mrs);
+        masterReportDao.saveAll(mrs);
     }
 
 

+ 3 - 3
src/main/java/com/mooctest/service/FinalReportService.java

@@ -48,7 +48,7 @@ public class FinalReportService {
     }
 
     public FinalReportDTO update(long reportId, FinalReportDTO dto) {
-        FinalReport report = finalReportDao.findOne(reportId);
+        FinalReport report = finalReportDao.findById(reportId).orElse(null);
         dto.setCreateTime(report.getCreateTime());
         BeanUtils.copyProperties(dto, report);
         report.setImgUrls(String.join(",", dto.getImgUrls()));
@@ -79,7 +79,7 @@ public class FinalReportService {
     }
 
     public void delete(long reportId) {
-        finalReportDao.delete(reportId);
+        finalReportDao.deleteById(reportId);
     }
 
     public String getExportReportAddr(TaskDTO task) {
@@ -165,7 +165,7 @@ public class FinalReportService {
             return finalReport;
         }).collect(Collectors.toList());
 
-        finalReportDao.save(finalReports);
+        finalReportDao.saveAll(finalReports);
     }
 
 

+ 1 - 1
src/main/java/com/mooctest/service/MasterReportService.java

@@ -70,7 +70,7 @@ public class MasterReportService {
                     .build();
             mrs.add(mr);
         });
-        masterReportDao.save(mrs);
+        masterReportDao.saveAll(mrs);
     }
 
     public long[] getExamIdAndCaseIdByMasterId(String masterId) {

+ 2 - 2
src/main/java/com/mooctest/service/impl/BugReportServiceImpl.java

@@ -110,12 +110,12 @@ public class BugReportServiceImpl implements BugReportService {
 
     @Override
     public BugDTO getBugById(String bugId) {
-        return wrap(bugDao.findOne(bugId));
+        return wrap(bugDao.findById(bugId).orElse(null));
     }
 
 
     public BugDTO getBugById(String bugId, long examId, long caseId) {
-        Bug bug = bugDao.findOne(bugId);
+        Bug bug = bugDao.findById(bugId).orElse(null);
         return wrap(bug);
     }
 

+ 2 - 1
src/main/resources/templates/addReviewJob.html

@@ -163,7 +163,8 @@
                         <div class="form-group">
                             <label class="col-sm-2 control-label">采用的Paper</label>
                             <div class="col-sm-10">
-                                <a type="button"  th:onclick="'showPaperDetail('+${paperId}+')'"  id="paperId" th:text="${paperName}" ></a>
+                                <a type="button"  th:paperId="${paperId}" th:onclick="javascript:showPaperDetail(this.getAttribute('paperId'))"
+                                   id="paperId" th:text="${paperName}" ></a>
                             </div>
                         </div>
                         <div class="form-group">

+ 2 - 1
src/main/resources/templates/agg_report_list.html

@@ -112,7 +112,8 @@
                                 <span th:text="${bugMap.get(masterBug.key).description}"></span><br/>
                                 <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
                                      th:each="imgUrl,iterStat : ${bugMap.get(masterBug.key).getImgUrls()}"
-                                     th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
+                                     th:imgUrl="${imgUrl}"
+                                     th:onclick="javascript:showimage(this.getAttribute('imgUrl'));"/>
                             </div>
                             <ul class="list-group collapse" th:id="'dup-list-' + ${masterBug.key}"
                                 style="max-height: 161px; min-height: 161px; overflow: scroll;" >

+ 13 - 7
src/main/resources/templates/agg_report_new.html

@@ -188,7 +188,8 @@
                                 <span th:text="${masterReport.getDescription()}"></span><br/>
                                 <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
                                      th:each="imgUrl,iterStat : ${masterReport.getImgUrls()}"
-                                     th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
+                                     th:imgUrl="${imgUrl}"
+                                     th:onclick="javascript : showimage(this.getAttribute('imgUrl'))"/>
 
                             </td>
                         </tr>
@@ -215,7 +216,8 @@
 
                                             <img th:if="${!supplement.hasTxt}" class="my-img-thumbnail pointer to-add"
                                                  th:src="${imgUrl}" th:each="imgUrl,iterStat : ${supplement.top3Img}"
-                                                 th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
+                                                 th:imgUrl="${imgUrl}" th:onclick="javascript : showimage(this.getAttribute('imgUrl'))"
+                                                 />
 
 
                                         </div>
@@ -227,7 +229,9 @@
                                                       style="color: #3c8dbc; margin-right: 5px;"></span>
                                                     <a th:href="'/report/'+${report.id}+'?examId=' + ${examId} + '&amp;caseId=' + ${caseId}" style="margin-right: 5px;" th:text="${report.id}"></a>
                                                     <!--查看树状报告-->
-                                                    <span th:if="${single2root.get(report.id)!=null} and ${showReference}"  th:onclick="'changeToTree(\''+${single2root.get(report.id)}+'\')'"
+                                                    <span th:if="${single2root.get(report.id)!=null} and ${showReference}"
+                                                          th:treeId="${single2root.get(report.id)}"
+                                                          th:onclick="javascript:changeToTree(this.getAttribute('treeId'))"
                                                            class="glyphicon glyphicon-tree-conifer"
                                                            style="color: #07b309; margin-right: 5px;" >
                                                     </span>
@@ -249,7 +253,8 @@
                                                         <img class="my-img-thumbnail pointer to-add"
                                                              th:style="${img.isDiff()? 'border: 2px solid red;' : ''}"
                                                              th:src="${img.imgUrl}"
-                                                             th:onclick="'javascript:showimage(\''+${img.imgUrl}+'\');'"/>
+                                                             th:imgUrl="${img.imgUrl}" th:onclick="javascript : showimage(this.getAttribute('imgUrl'))"
+                                                             />
 
                                                     </th:block>
                                                 </li>
@@ -352,8 +357,8 @@
                                         <div style="overflow: auto;">
                                             <span th:text="${finalReport.id}"></span>
                                             <span class="pull-right">
-                                            <a href="#" th:onclick="'editReport('+${finalReport.id}+')'" >编辑</a>
-                                            <a href="#" th:onclick="'deleteReport('+ ${finalReport.id} +')'">删除</a>
+                                            <a href="#" th:finalId="${finalReport.id}" th:onclick="editReport(this.getAttribute('finalId'))" >编辑</a>
+                                            <a href="#" th:finalId="${finalReport.id}" th:onclick="deleteReport(this.getAttribute('finalId'))">删除</a>
                                         </span>
                                         </div>
 
@@ -373,7 +378,8 @@
                                         <br/>
                                         <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
                                              th:each="imgUrl,iterStat : ${finalReport.getImgUrls()}"
-                                             th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
+                                             th:imgUrl="${imgUrl}" th:onclick="javascript : showimage(this.getAttribute('imgUrl'))"
+                                             />
                                     </li>
                                 </th:block>
                             </ul>

+ 7 - 5
src/main/resources/templates/aggr_report.html

@@ -127,7 +127,8 @@
                                 <span th:text="${masterReport.getDescription()}"></span><br/>
                                 <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
                                      th:each="imgUrl,iterStat : ${masterReport.getImgUrls()}"
-                                     th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
+                                     th:imgUrl="${imgUrl}"
+                                     th:onclick="javascript:showimage(this.getAttribute('imgUrl'));"/>
 
                             </td>
                         </tr>
@@ -154,7 +155,8 @@
 
                                             <img th:if="${!supplement.hasTxt}" class="my-img-thumbnail pointer to-add"
                                                  th:src="${imgUrl}" th:each="imgUrl,iterStat : ${supplement.top3Img}"
-                                                 th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
+                                                 th:imgUrl="${imgUrl}"
+                                                 th:onclick="javascript:showimage(this.getAttribute('imgUrl'));"/>
 
 
                                         </div>
@@ -185,7 +187,7 @@
                                                         <img class="my-img-thumbnail pointer to-add"
                                                              th:style="${img.isDiff()? 'border: 2px solid red;' : ''}"
                                                              th:src="${img.imgUrl}"
-                                                             th:onclick="'javascript:showimage(\''+${img.imgUrl}+'\');'"/>
+                                                             th:onclick="javascript:showimage(this.getAttribute('src'));"/>
 
                                                     </th:block>
                                                 </li>
@@ -286,7 +288,7 @@
                                         <span class="pull-right">
 
                                             <a th:href="'report?masterId='+${finalReport.sourceId}+'&amp;examId='+${examId}+'&amp;caseId='+${caseId}+'&amp;finalReportId='+${finalReport.id}">编辑</a>
-                                            <a href="#" th:onclick="'deleteReport('+ ${finalReport.id} +')'">删除</a>
+                                            <a href="#" th:finalId="${finalReport.id}" th:onclick="javascript:deleteReport(this.getAttribute('finalId'))">删除</a>
                                         </span>
                                     </div>
 
@@ -306,7 +308,7 @@
                                     <br/>
                                     <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
                                          th:each="imgUrl,iterStat : ${finalReport.getImgUrls()}"
-                                         th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
+                                         th:onclick="javascript:showimage(this.getAttribute('src'));"/>
                                 </li>
 
                             </th:block>

+ 10 - 10
src/main/resources/templates/changePaper.html

@@ -279,11 +279,11 @@
             <div class="box box-info rule" th:id="'rule'+${ruleStat.index}" th:each="rule,ruleStat : ${data.get('item_group_list')}">
                 <div class="box-header with-border">
                     <h3 class="box-title">定制审查选项</h3>
-                    <button type="submit" th:onclick="'addCheck('+${ruleStat.index}+')'" class="btn btn-success pull-right">新建多选框</button>
-                    <button type="submit" th:onclick="'addRatio('+${ruleStat.index}+')'" class="btn btn-success pull-right">新建单选框</button>
-                    <button type="submit" th:onclick="'addSingleCheck('+${ruleStat.index}+')'" class="btn btn-success pull-right">新建单复选框</button>
-                    <button type="submit" th:onclick="'addText('+${ruleStat.index}+')'" class="btn btn-success pull-right">新建文本框</button>
-                    <button type="submit" th:onclick="'addUpload('+${ruleStat.index}+')'" class="btn btn-success pull-right">新建文件上传</button>
+                    <button type="submit" th:index="${ruleStat.index}" th:onclick="javascript:addCheck(this.getAttribute('index')) " class="btn btn-success pull-right">新建多选框</button>
+                    <button type="submit" th:index="${ruleStat.index}" th:onclick="javascript:addRatio(this.getAttribute('index')) " class="btn btn-success pull-right">新建单选框</button>
+                    <button type="submit" th:index="${ruleStat.index}" th:onclick="javascript:addSingleCheck(this.getAttribute('index')) " class="btn btn-success pull-right">新建单复选框</button>
+                    <button type="submit" th:index="${ruleStat.index}" th:onclick="javascript:addText(this.getAttribute('index')) " class="btn btn-success pull-right">新建文本框</button>
+                    <button type="submit" th:index="${ruleStat.index}" th:onclick="javascript:addUpload(this.getAttribute('index')) " class="btn btn-success pull-right">新建文件上传</button>
                 </div>
                 <!-- /.box-header -->
                 <!-- form start -->
@@ -336,7 +336,7 @@
                                             </td>
                                             <td>
                                                 <button onclick="upTr(this)" class="btn btn-default">上移</button>
-                                                <button th:onclick="'downTr(this,'+${ruleStat.index}+')'" class="btn btn-default">下移</button>
+                                                <button th:index="${ruleStat.index}" th:onclick="javascript:downTr(this,this.getAttribute('index'))" class="btn btn-default">下移</button>
                                                 <button onclick="deleteTr(this)" class="btn btn-warning">删除</button>
                                             </td>
                                         </tr>
@@ -355,7 +355,7 @@
                                             </td>
                                             <td>
                                                 <button onclick="upTr(this)" class="btn btn-default">上移</button>
-                                                <button th:onclick="'downTr(this,'+${ruleStat.index}+')'" class="btn btn-default">下移</button>
+                                                <button th:index="${ruleStat.index}" th:onclick="javascript:downTr(this,this.getAttribute('index'))" class="btn btn-default">下移</button>
                                                 <button onclick="deleteTr(this)" class="btn btn-warning">删除</button>
                                             </td>
                                         </tr>
@@ -374,7 +374,7 @@
                                             </td>
                                             <td>
                                                 <button onclick="upTr(this)" class="btn btn-default">上移</button>
-                                                <button th:onclick="'downTr(this,'+${ruleStat.index}+')'" class="btn btn-default">下移</button>
+                                                <button th:index="${ruleStat.index}" th:onclick="javascript : downTr(this,this.getAttribute('index'))" class="btn btn-default">下移</button>
                                                 <button onclick="deleteTr(this)" class="btn btn-warning">删除</button>
                                             </td>
                                         </tr>
@@ -401,7 +401,7 @@
                                             </td>
                                             <td>
                                                 <button onclick="upTr(this)" class="btn btn-default">上移</button>
-                                                <button th:onclick="'downTr(this,'+${ruleStat.index}+')'" class="btn btn-default">下移</button>
+                                                <button th:index="${ruleStat.index}" th:onclick="javascript:downTr(this,this.getAttribute('index'))" class="btn btn-default">下移</button>
                                                 <button onclick="deleteTr(this)" class="btn btn-warning">删除</button>
                                             </td>
                                         </tr>
@@ -427,7 +427,7 @@
                                             </td>
                                             <td>
                                                 <button onclick="upTr(this)" class="btn btn-default">上移</button>
-                                                <button th:onclick="'downTr(this,'+${ruleStat.index}+')'" class="btn btn-default">下移</button>
+                                                <button th:index="${ruleStat.index}" th:onclick="javascript:downTr(this,this.getAttribute('index'))" class="btn btn-default">下移</button>
                                                 <button onclick="deleteTr(this)" class="btn btn-warning">删除</button>
                                             </td>
                                         </tr>

+ 1 - 1
src/main/resources/templates/changeReviewJob.html

@@ -154,7 +154,7 @@
                         <div class="form-group">
                             <label class="col-sm-2 control-label">采用的Paper</label>
                             <div class="col-sm-10">
-                                <a type="button"  th:onclick="'showPaperDetail(\''+${paper.get('paperId')}+'\')'"  id="paperId" th:text="${paper.get('name')}" ></a>
+                                <a type="button"  th:paperId="${paper.get('paperId')}" th:onclick="javascript:showPaperDetail(this.getAttribute('paperId'))"  id="paperId" th:text="${paper.get('name')}" ></a>
                             </div>
                         </div>
                         <div class="form-group">

+ 1 - 1
src/main/resources/templates/final_report_list.html

@@ -165,7 +165,7 @@
                     </td>
                     <td>
                         <a th:if="${report.sourceId}" th:href="'report?masterId='+${report.sourceId}+'&amp;examId='+${examId}+'&amp;caseId='+${caseId}+'&amp;finalReportId='+${report.id}">编辑</a>
-                        <a href="#" th:onclick="'deleteReport('+ ${report.id} +')'">删除</a>
+                        <a href="#" th:reportId="${report.id}" th:onclick="javascript:deleteReport(this.getAttribute('reportId'))">删除</a>
                     </td>
                 </tr>
             </th:block>

+ 1 - 1
src/main/resources/templates/jobDetail.html

@@ -189,7 +189,7 @@
                             <div class="form-group">
                                 <label class="col-sm-2 control-label">使用试卷</label>
                                 <div class="col-sm-10">
-                                    <a type="button" class="control-label" style="text-align: left"  th:onclick="'showPaperDetail(\''+${paper.get('paperId')}+'\')'"  id="paperId" th:text="${paper.get('name')}" ></a>
+                                    <a type="button" class="control-label" style="text-align: left" th:paperId="${paper.get('paperId')}"  th:onclick="javascript:showPaperDetail(this.getAttribute('paperId'))"  id="paperId" th:text="${paper.get('name')}" ></a>
                                 </div>
                             </div>
 

+ 1 - 1
src/main/resources/templates/jobList.html

@@ -123,7 +123,7 @@
                         <td>
 <!--                            <button th:onclick="'showYulan( \''+${task.get('id')}+'\' )'" class="btn btn-default">预览</button>-->
                             <a type="button" class="btn btn-default" th:href="'/review/changeJob?id='+${task.get('id')}">修改</a>
-                            <button  th:onclick="'delJob( this, \''+${task.get('id')}+'\' )'"  class="btn btn-default">删除</button>
+                            <button th:jobId="${task.get('id')}" th:onclick="javascript:delJob( this, this.getAttribute('jobId'))"  class="btn btn-default">删除</button>
                         </td>
 
                         <!--<td th:text="${task.version}"></td>-->

+ 3 - 3
src/main/resources/templates/paper_list.html

@@ -127,9 +127,9 @@
 <!--                            <span  class=" " th:text="${task.get('create_time')}" ></span>-->
                         </td>
                         <td>
-                            <button th:onclick="'showYulan( \''+${task.get('id')}+'\' )'" class="btn btn-default">预览</button>
-                            <a type="button" class="btn btn-default" th:href="'/changePaper?id='+${task.get('id')}">修改</a>
-                            <button  th:onclick="'delPaper( this, \''+${task.get('id')}+'\' )'"  class="btn btn-default">删除</button>
+                            <button th:paperId="${task.get('id')}" th:onclick="javascript:showYulan( this.getAttribute('paperId') )" class="btn btn-default">预览</button>
+                            <a type="button" th:paperId="${task.get('id')}" class="btn btn-default" th:href="'/changePaper?id='+${task.get('id')}">修改</a>
+                            <button th:paperId="${task.get('id')}" th:onclick="javascript:delPaper( this, this.getAttribute('paperId')) "  class="btn btn-default">删除</button>
                         </td>
                         <!--<td th:text="${task.version}"></td>-->
                         <!--                        <td th:if="${task.numOfUndeal > 0}"><span  class="label label-info">审核中</span></td>-->

+ 3 - 3
src/main/resources/templates/single_report.html

@@ -190,8 +190,7 @@
                                 <span th:text="${singleReport.getDescription()}"></span><br/>
                                 <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
                                      th:each="imgUrl,iterStat : ${singleReport.getImgUrls()}"
-                                     th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
-
+                                     th:imgUrl="${imgUrl}" th:onclick="javascript : showimage(this.getAttribute('imgUrl'))"/>
                             </td>
                         </tr>
                         </tbody>
@@ -300,7 +299,8 @@
                                         <br/>
                                         <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
                                              th:each="imgUrl,iterStat : ${finalReport.getImgUrls()}"
-                                             th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
+                                             th:imgUrl = "${imgUrl}"
+                                             th:onclick="'javascript:showimage(this.getAttribute('imgUrl'));'"/>
                                     </li>
 
                                 </th:block>

+ 2 - 2
src/main/resources/templates/test.html

@@ -205,7 +205,7 @@
                                         <span th:text="${bugMap.get(masterBug.key).description}"></span><br/>
                                         <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
                                              th:each="imgUrl,iterStat : ${bugMap.get(masterBug.key).getImgUrls()}"
-                                             th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
+                                             th:onclick="javascript : showimage(this.getAttribute('src'));"/>
                                     </div>
                                     <ul class="list-group collapse" th:id="'dup-list-' + ${masterBug.key}"
                                         style="max-height: 161px; min-height: 161px; overflow: scroll;" >
@@ -266,7 +266,7 @@
                                         <span th:text="${bugMap.get(masterBug.key).description}"></span><br/>
                                         <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
                                              th:each="imgUrl,iterStat : ${bugMap.get(masterBug.key).getImgUrls()}"
-                                             th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
+                                             th:onclick="javascript:showimage(this.getAttribute('src'));"/>
                                     </div>
                                     <ul class="list-group collapse" th:id="'dup-list-' + ${masterBug.key}"
                                         style="max-height: 161px; min-height: 161px; overflow: scroll;" >

+ 1 - 1
src/main/resources/templates/tree_report_list.html

@@ -113,7 +113,7 @@
                                 <span th:text="${bugMap.get(masterBug.key).description}"></span><br/>
                                 <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
                                      th:each="imgUrl,iterStat : ${bugMap.get(masterBug.key).getImgUrls()}"
-                                     th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
+                                     th:onclick="javascript:showimage(this.getAttribute('src'));"/>
                             </div>
                             <ul class="list-group collapse" th:id="'dup-list-' + ${masterBug.key}"
                                 style="max-height: 161px; min-height: 161px; overflow: scroll;" >

+ 12 - 8
src/main/resources/templates/tree_report_new.html

@@ -183,8 +183,8 @@
                                 <span th:text="${masterReport.getDescription()}"></span><br/>
                                 <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
                                      th:each="imgUrl,iterStat : ${masterReport.getImgUrls()}"
-                                     th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
-
+                                     th:imgUrl="${imgUrl}"
+                                     th:onclick="javascript:showimage(this.getAttribute('imgUrl'));"/>
                             </td>
                         </tr>
                         <tr>
@@ -210,7 +210,8 @@
 
                                             <img  class="my-img-thumbnail pointer to-add"
                                                  th:src="${imgUrl}" th:each="imgUrl,iterStat : ${supplement.taggedImgs}"
-                                                 th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
+                                                  th:imgUrl="${imgUrl}"
+                                                 th:onclick="javascript:showimage(this.getAttribute('imgUrl'));"/>
 
 
                                         </div>
@@ -224,7 +225,8 @@
                                                     <!--查看聚合报告-->
                                                      <span th:if="(${report2master.get(supplement.getId())!=null }) and ${showReference}"
                                                           class="fa fa-sitemap text-warning"
-                                                           th:onclick="'changeToAgg( \''+${report2master.get(supplement.getId())}+'\')'"
+                                                           th:aggId="${report2master.get(supplement.getId())}"
+                                                           th:onclick="changeToAgg(this.getAttribute('aggId'))"
                                                           style="color: #8a6d3b; margin-right: 5px;" >
                                                     </span>
 
@@ -242,7 +244,8 @@
 
                                                         <img class="my-img-thumbnail pointer to-add"
                                                              th:src="${img}"
-                                                             th:onclick="'javascript:showimage(\''+${img}+'\');'"/>
+                                                             th:imgUrl = "${img}"
+                                                             th:onclick="javascript:showimage(this.getAttribute('imgUrl'));"/>
 
                                                     </th:block>
                                                 </li>
@@ -343,8 +346,8 @@
                                         <div style="overflow: auto;">
                                             <span th:text="${finalReport.id}"></span>
                                             <span class="pull-right">
-                                            <a href="#" th:onclick="'editReport('+${finalReport.id}+')'" >编辑</a>
-                                            <a href="#" th:onclick="'deleteReport('+ ${finalReport.id} +')'">删除</a>
+                                            <a href="#" th:onclick="javascript:editReport(this.getAttribute('finalId'))" th:finalId="${finalReport.id}" >编辑</a>
+                                            <a href="#" th:onclick="javascript:deleteReport(this.getAttribute('finalId')) " th:finalId="${finalReport.id}">删除</a>
                                         </span>
                                         </div>
 
@@ -364,7 +367,8 @@
                                         <br/>
                                         <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
                                              th:each="imgUrl,iterStat : ${finalReport.getImgUrls()}"
-                                             th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
+                                             th:imgUrl ="${imgUrl}"
+                                             th:onclick="javascript:showimage(this.getAttribute('imgUrl'));"/>
                                     </li>
 
                                 </th:block>