Browse Source

webclient

WangRuiLin 1 năm trước cách đây
mục cha
commit
491eb2a923
23 tập tin đã thay đổi với 601 bổ sung58 xóa
  1. 11 0
      cirs-admin/pom.xml
  2. 4 0
      cirs-biz/pom.xml
  3. 58 7
      cirs-biz/src/main/java/com/cirs/biz/controller/SysTrainController.java
  4. 12 6
      cirs-biz/src/main/java/com/cirs/biz/controller/TElectronComponentController.java
  5. 79 0
      cirs-biz/src/main/java/com/cirs/biz/controller/TVerificationTaskDetailController.java
  6. 8 6
      cirs-biz/src/main/java/com/cirs/biz/domain/TVerificationTaskDetail.java
  7. 27 16
      cirs-biz/src/main/java/com/cirs/biz/domain/TrainReturn.java
  8. 139 0
      cirs-biz/src/main/java/com/cirs/biz/domain/VerificationData.java
  9. 1 1
      cirs-biz/src/main/java/com/cirs/biz/mapper/RecommendInfoMapper.java
  10. 3 0
      cirs-biz/src/main/java/com/cirs/biz/mapper/SysTrainMapper.java
  11. 8 0
      cirs-biz/src/main/java/com/cirs/biz/mapper/TVerificationTaskDetailMapper.java
  12. 3 0
      cirs-biz/src/main/java/com/cirs/biz/service/ISysTrainService.java
  13. 8 0
      cirs-biz/src/main/java/com/cirs/biz/service/ITVerificationTaskDetailService.java
  14. 6 0
      cirs-biz/src/main/java/com/cirs/biz/service/impl/SysTrainServiceImpl.java
  15. 18 1
      cirs-biz/src/main/java/com/cirs/biz/service/impl/TVerificationTaskDetailServiceImpl.java
  16. 6 2
      cirs-biz/src/main/resources/mapper/biz/RecommendInfoMapper.xml
  17. 32 0
      cirs-biz/src/main/resources/mapper/biz/SysTrainMapper.xml
  18. 55 0
      cirs-biz/src/main/resources/mapper/biz/TVerificationTaskDetailMapper.xml
  19. 14 0
      cirs-ui/src/api/biz/detail.js
  20. 25 1
      cirs-ui/src/views/biz/recommend/index.vue
  21. 82 17
      cirs-ui/src/views/biz/task/index.vue
  22. 1 1
      cirs-ui/src/views/index.vue
  23. 1 0
      pom.xml

+ 11 - 0
cirs-admin/pom.xml

@@ -74,8 +74,19 @@
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-webflux</artifactId>
+
         </dependency>
 
+        <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-webflux -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-webflux</artifactId>
+
+        </dependency>
+
+
+
+
     </dependencies>
 
     <build>

+ 4 - 0
cirs-biz/pom.xml

@@ -22,6 +22,10 @@
             <groupId>com.cirs</groupId>
             <artifactId>cirs-common</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-webflux</artifactId>
+        </dependency>
 
 
     </dependencies>

+ 58 - 7
cirs-biz/src/main/java/com/cirs/biz/controller/SysTrainController.java

@@ -1,5 +1,9 @@
 package com.cirs.biz.controller;
 
+import com.cirs.biz.domain.VerificationData;
+import org.springframework.http.HttpMethod;
+
+
 import java.io.File;
 import java.sql.Timestamp;
 import java.util.HashMap;
@@ -14,6 +18,7 @@ import com.cirs.biz.domain.TrainReturn;
 import org.apache.commons.io.FileUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration;
+import org.springframework.http.MediaType;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -26,6 +31,9 @@ import com.cirs.biz.service.ISysTrainService;
 import com.cirs.common.utils.poi.ExcelUtil;
 import com.cirs.common.core.page.TableDataInfo;
 import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.reactive.function.BodyInserters;
+import org.springframework.web.reactive.function.client.WebClient;
+import reactor.core.publisher.Mono;
 
 /**
  * 训练集数据列Controller
@@ -41,6 +49,11 @@ public class SysTrainController extends BaseController
     @Autowired
     private ISysTrainService sysTrainService;
 
+    // 创建 WebClient 对象
+    private WebClient webClient = WebClient.builder()
+            .baseUrl("http://jsonplaceholder.typicode.com")
+            .build();
+
     /**
      * 查询训练集数据列列表
      */
@@ -158,19 +171,30 @@ public class SysTrainController extends BaseController
 
     @PreAuthorize("@ss.hasPermi('biz:train:train')")
     @GetMapping("/train")
-    public AjaxResult tojson(String modelPath) {
+    public AjaxResult train(String modelPath) {
         try {
 
 
             Map<String, Object> objectMap=new HashMap<>();
 
 
-            objectMap.put("data", sysTrainService.getComponentids());
-            objectMap.put("modelPath", modelPath);
+            objectMap.put("dataSet", sysTrainService.getComponentids());
 
+            objectMap.put("modelPath", modelPath);
+            // 发送请求
+            Mono<String> mono = webClient
+                    .post() // POST 请求
+                    .uri("/posts")  // 请求路径
+                    .contentType(MediaType.APPLICATION_JSON_UTF8)
+                    .syncBody(objectMap)
+                    .retrieve() // 获取响应体
+                    .bodyToMono(String.class); //响应数据类型转换
 
+            mono.subscribe(result -> {
+                System.out.println(result);
+            });
             //接下来就传入算法即可
-            System.out.println(JSON.toJSONString(objectMap));
+//            System.out.println(JSON.toJSONString(objectMap));
 
             return success("数据处理成功");
         } catch (Exception e) {
@@ -180,13 +204,13 @@ public class SysTrainController extends BaseController
     }
 
     @PreAuthorize("@ss.hasPermi('biz:train:recommend')")
-    @GetMapping("/recommend")
+    @PostMapping ("/recommend")
     public AjaxResult recommend(@RequestBody TrainReturn recommend_args, String modelPath) {
         try {
 
             Map<String, Object> objectMap=new HashMap<>();
             objectMap.put("useScene", recommend_args.getUseScene());
-            objectMap.put("getSearchCondition",recommend_args.getSearchCondition());
+            objectMap.put("SearchCondition",recommend_args.getSearchCondition());
             objectMap.put("modelPath", modelPath);
             objectMap.put("result1Id",recommend_args.getResult1Id());
             objectMap.put("result2Id",recommend_args.getResult2Id());
@@ -194,7 +218,21 @@ public class SysTrainController extends BaseController
             objectMap.put("result4Id",recommend_args.getResult4Id());
             objectMap.put("result5Id",recommend_args.getResult5Id());
             //接下来就传入算法
-            System.out.println(JSON.toJSONString(objectMap));
+//            System.out.println(JSON.toJSONString(objectMap));
+            Mono<String> mono = webClient
+                    .post() // POST 请求
+                    .uri("/posts")  // 请求路径
+                    .contentType(MediaType.APPLICATION_JSON_UTF8)
+                    .syncBody(objectMap)
+                    .retrieve() // 获取响应体
+                    .bodyToMono(String.class); //响应数据类型转换
+
+
+            mono.subscribe(result -> {
+                System.out.println(result);
+            });
+            //暂时赋值
+            recommend_args.setResult1Id((long)53);
 
             return success(recommend_args);
         } catch (Exception e) {
@@ -202,4 +240,17 @@ public class SysTrainController extends BaseController
             return error("推荐元器件失败");
         }
     }
+
+    @GetMapping("/getTraindataset")
+    public AjaxResult getTraindataset(){
+        List<VerificationData> train_dataset = sysTrainService.gettraindataset();
+        for(int i=0;i<train_dataset.size();i++){
+            VerificationData data = train_dataset.get(i);
+            data.setId((long)(i+1));
+            data.setTrained(1);
+            data.setTested(0);
+        }
+        return success(train_dataset);
+
+    }
 }

+ 12 - 6
cirs-biz/src/main/java/com/cirs/biz/controller/TElectronComponentController.java

@@ -4,9 +4,7 @@ import java.util.List;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 
-import com.cirs.biz.domain.RecommendInfo;
-import com.cirs.biz.domain.TElecCompRecord;
-import com.cirs.biz.domain.TVerificationTask;
+import com.cirs.biz.domain.*;
 import com.cirs.biz.mapper.RecommendInfoMapper;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,7 +20,6 @@ import com.cirs.common.annotation.Log;
 import com.cirs.common.core.controller.BaseController;
 import com.cirs.common.core.domain.AjaxResult;
 import com.cirs.common.enums.BusinessType;
-import com.cirs.biz.domain.TElectronComponent;
 import com.cirs.biz.service.ITElectronComponentService;
 import com.cirs.common.utils.poi.ExcelUtil;
 import com.cirs.common.core.page.TableDataInfo;
@@ -91,10 +88,18 @@ public class TElectronComponentController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('biz:recommend:querylist')")
     @GetMapping("/recommend/querylist")
-    public TableDataInfo querylist()
+    public TableDataInfo querylist(TrainReturn recommend_return)
     {
+        Long[] ids = new Long[5];
+
+        ids[0] = recommend_return.getResult1Id();
+        ids[1] = recommend_return.getResult2Id();
+        ids[2] = recommend_return.getResult3Id();
+        ids[3] = recommend_return.getResult4Id();
+        ids[4] = recommend_return.getResult5Id();
+        System.out.println(ids[0]);
         startPage();
-        List<RecommendInfo> list = recommendInfoMapper.RecommendQueryList();
+        List<RecommendInfo> list = recommendInfoMapper.RecommendQueryList(ids);
         return getDataTable(list);
     }
 
@@ -151,4 +156,5 @@ public class TElectronComponentController extends BaseController
     }
 
 
+
 }

+ 79 - 0
cirs-biz/src/main/java/com/cirs/biz/controller/TVerificationTaskDetailController.java

@@ -1,9 +1,14 @@
 package com.cirs.biz.controller;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import javax.servlet.http.HttpServletResponse;
 
+import com.cirs.biz.domain.SysTrain;
 import com.cirs.biz.domain.TVerificationTask;
+import com.cirs.biz.domain.VerificationData;
+import org.springframework.http.MediaType;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -16,6 +21,8 @@ import com.cirs.biz.service.ITVerificationTaskDetailService;
 import com.cirs.common.utils.poi.ExcelUtil;
 import com.cirs.common.core.page.TableDataInfo;
 import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.reactive.function.client.WebClient;
+import reactor.core.publisher.Mono;
 
 /**
  * 验证任务详情Controller
@@ -30,6 +37,9 @@ public class TVerificationTaskDetailController extends BaseController
     @Autowired
     private ITVerificationTaskDetailService tVerificationTaskDetailService;
 
+    private WebClient webClient = WebClient.builder()
+            .baseUrl("http://jsonplaceholder.typicode.com")
+            .build();
     /**
      * 查询验证任务详情列表
      */
@@ -123,4 +133,73 @@ public class TVerificationTaskDetailController extends BaseController
         ExcelUtil<TVerificationTaskDetail> util = new ExcelUtil<TVerificationTaskDetail>(TVerificationTaskDetail.class);
         util.importTemplateExcel(response, "任务详情数据");
     }
+
+//    @GetMapping("/componentIds/{taskid}")
+    public AjaxResult getComponentIds(Long taskid)
+    {
+
+        List<TVerificationTaskDetail> dataset = tVerificationTaskDetailService.alldata(taskid);
+
+        int idx = 0;
+        for(;idx < dataset.size(); idx++){
+            TVerificationTaskDetail data = dataset.get(idx);
+            System.out.println(data.getResult1());
+            if(data.getResult1Id()==null){//不改动元器件id时可行
+                Long component_id1 = tVerificationTaskDetailService.setComponentId(data.getResult1());
+                System.out.println(component_id1);
+                Long component_id2 = tVerificationTaskDetailService.setComponentId(data.getResult2());
+                Long component_id3 = tVerificationTaskDetailService.setComponentId(data.getResult3());
+                Long component_id4 = tVerificationTaskDetailService.setComponentId(data.getResult4());
+                Long component_id5 = tVerificationTaskDetailService.setComponentId(data.getResult5());
+                data.setResult1Id(component_id1);
+                data.setResult2Id(component_id2);
+                data.setResult3Id(component_id3);
+                data.setResult4Id(component_id4);
+                data.setResult5Id(component_id5);
+                edit(data);//更新数据库
+            }
+
+        }
+
+        return success();
+    }
+
+    @PreAuthorize("@ss.hasPermi('biz:detail:verification')")
+    @GetMapping("/verification")
+    public AjaxResult train(Long taskid,String modelPath) {
+
+        try {
+            System.out.println(taskid);
+            System.out.println(modelPath);
+            getComponentIds(taskid);
+            Map<String, Object> objectMap=new HashMap<>();
+            List<VerificationData> dataset = tVerificationTaskDetailService.getComponentids(taskid);
+            for(int i=0;i<dataset.size();i++){
+                dataset.get(i).setId((long)(i+1));
+            }
+            objectMap.put("dataSet", dataset);
+            objectMap.put("modelPath", modelPath);
+            // 发送请求
+            Mono<String> mono = webClient
+                    .post() // POST 请求
+                    .uri("/posts")  // 请求路径
+                    .contentType(MediaType.APPLICATION_JSON_UTF8)
+                    .syncBody(objectMap)
+                    .retrieve() // 获取响应体
+                    .bodyToMono(String.class); //响应数据类型转换
+
+            AjaxResult res = new AjaxResult();
+            Object result = mono.block();
+            res.put("data",result);
+            res.put("msg","任务"+taskid+"验证算法调用成功");
+            res.put("code",200);
+            System.out.println(result);//返回值有accuracyRate和recallRate属性
+            return res;
+
+//            return success("任务"+taskid+"验证算法调用成功");
+        } catch (Exception e) {
+
+            return error("任务"+taskid+"验证算法调用失败");
+        }
+    }
 }

+ 8 - 6
cirs-biz/src/main/java/com/cirs/biz/domain/TVerificationTaskDetail.java

@@ -2,6 +2,7 @@ package com.cirs.biz.domain;
 
 import com.cirs.common.annotation.Excel;
 import com.cirs.common.core.domain.BaseEntity;
+import org.springframework.boot.context.properties.bind.DefaultValue;
 
 /**
  * 验证任务详情对象 t_verification_task_detail
@@ -83,8 +84,9 @@ public class TVerificationTaskDetail extends BaseEntity
     private String calculate5;
 
     private Long calculate5Id;
-    private Long trained;
-    private Long tested;
+
+    private Integer trained;
+    private Integer tested;
 
     public Long getId() {
         return id;
@@ -278,19 +280,19 @@ public class TVerificationTaskDetail extends BaseEntity
         this.calculate5Id = calculate5Id;
     }
 
-    public Long getTrained() {
+    public Integer getTrained() {
         return trained;
     }
 
-    public void setTrained(Long trained) {
+    public void setTrained(Integer trained) {
         this.trained = trained;
     }
 
-    public Long getTested() {
+    public Integer getTested() {
         return tested;
     }
 
-    public void setTested(Long tested) {
+    public void setTested(Integer tested) {
         this.tested = tested;
     }
 

+ 27 - 16
cirs-biz/src/main/java/com/cirs/biz/domain/TrainReturn.java

@@ -12,17 +12,17 @@ public class TrainReturn {
     private String searchCondition;
 
 
-    private String result1Id;
+    private Long result1Id;
 
-    private String result2Id;
+    private Long result2Id;
 
 
-    private String result3Id;
+    private Long result3Id;
 
 
-    private String result4Id;
+    private Long result4Id;
 
-    private String result5Id;
+    private Long result5Id;
 
     public String getUseScene() {
         return useScene;
@@ -40,45 +40,56 @@ public class TrainReturn {
         this.searchCondition = searchCondition;
     }
 
-    public String getResult1Id() {
+    public Long getResult1Id() {
         return result1Id;
     }
 
-    public void setResult1Id(String result1Id) {
+    public void setResult1Id(Long result1Id) {
         this.result1Id = result1Id;
     }
 
-    public String getResult2Id() {
+    public Long getResult2Id() {
         return result2Id;
     }
 
-    public void setResult2Id(String result2Id) {
+    public void setResult2Id(Long result2Id) {
         this.result2Id = result2Id;
     }
 
-    public String getResult3Id() {
+    public Long getResult3Id() {
         return result3Id;
     }
 
-    public void setResult3Id(String result3Id) {
+    public void setResult3Id(Long result3Id) {
         this.result3Id = result3Id;
     }
 
-    public String getResult4Id() {
+    public Long getResult4Id() {
         return result4Id;
     }
 
-    public void setResult4Id(String result4Id) {
+    public void setResult4Id(Long result4Id) {
         this.result4Id = result4Id;
     }
 
-    public String getResult5Id() {
+    public Long getResult5Id() {
         return result5Id;
     }
 
-    public void setResult5Id(String result5Id) {
+    public void setResult5Id(Long result5Id) {
         this.result5Id = result5Id;
     }
 
-
+    @Override
+    public String toString() {
+        return "TrainReturn{" +
+                "useScene='" + useScene + '\'' +
+                ", searchCondition='" + searchCondition + '\'' +
+                ", result1Id=" + result1Id +
+                ", result2Id=" + result2Id +
+                ", result3Id=" + result3Id +
+                ", result4Id=" + result4Id +
+                ", result5Id=" + result5Id +
+                '}';
+    }
 }

+ 139 - 0
cirs-biz/src/main/java/com/cirs/biz/domain/VerificationData.java

@@ -0,0 +1,139 @@
+package com.cirs.biz.domain;
+
+public class VerificationData {
+    Long id;
+    String useScene;
+    String searchCondition;
+    Long result1Id;
+    Long result2Id;
+    Long result3Id;
+    Long result4Id;
+    Long result5Id;
+    Long calculate1Id;
+    Long calculate2Id;
+    Long calculate3Id;
+    Long calculate4Id;
+    Long calculate5Id;
+    Integer trained;
+    Integer tested;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getUseScene() {
+        return useScene;
+    }
+
+    public void setUseScene(String useScene) {
+        this.useScene = useScene;
+    }
+
+    public String getSearchCondition() {
+        return searchCondition;
+    }
+
+    public void setSearchCondition(String searchCondition) {
+        this.searchCondition = searchCondition;
+    }
+
+    public Long getResult1Id() {
+        return result1Id;
+    }
+
+    public void setResult1Id(Long result1Id) {
+        this.result1Id = result1Id;
+    }
+
+    public Long getResult2Id() {
+        return result2Id;
+    }
+
+    public void setResult2Id(Long result2Id) {
+        this.result2Id = result2Id;
+    }
+
+    public Long getResult3Id() {
+        return result3Id;
+    }
+
+    public void setResult3Id(Long result3Id) {
+        this.result3Id = result3Id;
+    }
+
+    public Long getResult4Id() {
+        return result4Id;
+    }
+
+    public void setResult4Id(Long result4Id) {
+        this.result4Id = result4Id;
+    }
+
+    public Long getResult5Id() {
+        return result5Id;
+    }
+
+    public void setResult5Id(Long result5Id) {
+        this.result5Id = result5Id;
+    }
+
+    public Long getCalculate1Id() {
+        return calculate1Id;
+    }
+
+    public void setCalculate1Id(Long calculate1Id) {
+        this.calculate1Id = calculate1Id;
+    }
+
+    public Long getCalculate2Id() {
+        return calculate2Id;
+    }
+
+    public void setCalculate2Id(Long calculate2Id) {
+        this.calculate2Id = calculate2Id;
+    }
+
+    public Long getCalculate3Id() {
+        return calculate3Id;
+    }
+
+    public void setCalculate3Id(Long calculate3Id) {
+        this.calculate3Id = calculate3Id;
+    }
+
+    public Long getCalculate4Id() {
+        return calculate4Id;
+    }
+
+    public void setCalculate4Id(Long calculate4Id) {
+        this.calculate4Id = calculate4Id;
+    }
+
+    public Long getCalculate5Id() {
+        return calculate5Id;
+    }
+
+    public void setCalculate5Id(Long calculate5Id) {
+        this.calculate5Id = calculate5Id;
+    }
+
+    public Integer getTrained() {
+        return trained;
+    }
+
+    public void setTrained(Integer trained) {
+        this.trained = trained;
+    }
+
+    public Integer getTested() {
+        return tested;
+    }
+
+    public void setTested(Integer tested) {
+        this.tested = tested;
+    }
+}

+ 1 - 1
cirs-biz/src/main/java/com/cirs/biz/mapper/RecommendInfoMapper.java

@@ -5,5 +5,5 @@ import com.cirs.biz.domain.TElectronComponent;
 import java.util.List;
 public interface RecommendInfoMapper {
 
-    public List<RecommendInfo> RecommendQueryList();
+    public List<RecommendInfo> RecommendQueryList(Long [] ids);
 }

+ 3 - 0
cirs-biz/src/main/java/com/cirs/biz/mapper/SysTrainMapper.java

@@ -3,6 +3,7 @@ package com.cirs.biz.mapper;
 import java.util.List;
 import com.cirs.biz.domain.SysTrain;
 import com.cirs.biz.domain.TrainReturn;
+import com.cirs.biz.domain.VerificationData;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
@@ -69,4 +70,6 @@ public interface SysTrainMapper
 
 
     public List<TrainReturn> getComponentids();
+
+    public List<VerificationData> gettraindataset();
 }

+ 8 - 0
cirs-biz/src/main/java/com/cirs/biz/mapper/TVerificationTaskDetailMapper.java

@@ -2,6 +2,7 @@ package com.cirs.biz.mapper;
 
 import java.util.List;
 import com.cirs.biz.domain.TVerificationTaskDetail;
+import com.cirs.biz.domain.VerificationData;
 import org.apache.ibatis.annotations.Param;
 
 /**
@@ -61,4 +62,11 @@ public interface TVerificationTaskDetailMapper
     public int deleteTVerificationTaskDetailByIds(Long[] ids);
 
     public List<TVerificationTaskDetail> selectTVerificationTaskDetailByTaskIds(@Param("taskids") List<Long> taskids);
+
+    public List<TVerificationTaskDetail> alldata(Long taskid);
+
+
+    public Long getComponentId(@Param("attr")String attr, @Param("attr1")String attr1, @Param("attr2")String attr2);
+
+    public List<VerificationData> getComponentids(Long taskid);
 }

+ 3 - 0
cirs-biz/src/main/java/com/cirs/biz/service/ISysTrainService.java

@@ -3,6 +3,7 @@ package com.cirs.biz.service;
 import java.util.List;
 import com.cirs.biz.domain.SysTrain;
 import com.cirs.biz.domain.TrainReturn;
+import com.cirs.biz.domain.VerificationData;
 
 /**
  * 训练集数据列Service接口
@@ -68,4 +69,6 @@ public interface ISysTrainService
 
 
     public List<TrainReturn> getComponentids();
+
+    public List<VerificationData> gettraindataset();
 }

+ 8 - 0
cirs-biz/src/main/java/com/cirs/biz/service/ITVerificationTaskDetailService.java

@@ -1,7 +1,9 @@
 package com.cirs.biz.service;
 
 import java.util.List;
+
 import com.cirs.biz.domain.TVerificationTaskDetail;
+import com.cirs.biz.domain.VerificationData;
 
 /**
  * 验证任务详情Service接口
@@ -64,4 +66,10 @@ public interface ITVerificationTaskDetailService
     String importTaskDetail(List<TVerificationTaskDetail> taskDetailList, boolean updateSupport, String operName, String fileName);
 
     public List<TVerificationTaskDetail> selectTVerificationTaskDetailByTaskIds(List<Long> taskids);
+
+    public List<TVerificationTaskDetail> alldata(Long taskid);
+
+    public Long setComponentId(String result);
+
+    List<VerificationData> getComponentids(Long taskid);
 }

+ 6 - 0
cirs-biz/src/main/java/com/cirs/biz/service/impl/SysTrainServiceImpl.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 
 import com.cirs.biz.domain.TrainReturn;
+import com.cirs.biz.domain.VerificationData;
 import com.cirs.common.exception.ServiceException;
 import com.cirs.common.utils.StringUtils;
 import com.cirs.common.utils.bean.BeanValidators;
@@ -166,5 +167,10 @@ public class SysTrainServiceImpl implements ISysTrainService
         return sysTrainMapper.getComponentids();
     }
 
+    @Override
+    public List<VerificationData> gettraindataset() {
+        return sysTrainMapper.gettraindataset();
+    }
+
 
 }

+ 18 - 1
cirs-biz/src/main/java/com/cirs/biz/service/impl/TVerificationTaskDetailServiceImpl.java

@@ -4,6 +4,7 @@ import java.util.Date;
 import java.util.List;
 
 import com.cirs.biz.domain.TVerificationTask;
+import com.cirs.biz.domain.VerificationData;
 import com.cirs.biz.mapper.TVerificationTaskMapper;
 import com.cirs.common.exception.ServiceException;
 import com.cirs.common.utils.DateUtils;
@@ -159,7 +160,7 @@ public class TVerificationTaskDetailServiceImpl implements ITVerificationTaskDet
                 BeanValidators.validateWithException(validator, taskDetail);
                 taskDetail.setCreateBy(operName);
 
-                taskDetail.setTaskId(task.getId());
+                taskDetail.setTaskId(task.getId());//任务标识
 
                 tVerificationTaskDetailMapper.insertTVerificationTaskDetail(taskDetail);
                 successNum++;
@@ -194,4 +195,20 @@ public class TVerificationTaskDetailServiceImpl implements ITVerificationTaskDet
         return tVerificationTaskDetailMapper.selectTVerificationTaskDetailByTaskIds(taskids);
 
     }
+
+    @Override
+    public List<TVerificationTaskDetail> alldata(Long taskid) {
+        return tVerificationTaskDetailMapper.alldata(taskid);
+    }
+
+    @Override
+    public Long setComponentId(String result) {
+        String[] attrs = result.split("-");//切割不同属性
+        return tVerificationTaskDetailMapper.getComponentId(attrs[0],attrs[1],attrs[2]);
+    }
+
+    @Override
+    public List<VerificationData> getComponentids(Long taskid) {
+        return tVerificationTaskDetailMapper.getComponentids(taskid);
+    }
 }

+ 6 - 2
cirs-biz/src/main/resources/mapper/biz/RecommendInfoMapper.xml

@@ -13,7 +13,11 @@
     </resultMap>
     <select id="RecommendQueryList" resultMap="RecommendInfoResult">
         select id,component_model,component_name,quality_grade,replace_domestic_model
-            from t_electron_component
-
+        from t_electron_component where id in
+        <foreach collection="array" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
     </select>
+
+
 </mapper>

+ 32 - 0
cirs-biz/src/main/resources/mapper/biz/SysTrainMapper.xml

@@ -36,6 +36,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="result5Id"    column="result5_id"    />
     </resultMap>
 
+    <resultMap type="VerificationData" id="VerificationData">
+        <result property="id"    column="id"    />
+
+        <result property="useScene" column="use_scene"/>
+        <result property="searchCondition"    column="search_condition"    />
+
+        <result property="result1Id"    column="result1_id"    />
+
+        <result property="result2Id"    column="result2_id"    />
+
+        <result property="result3Id"    column="result3_id"    />
+
+        <result property="result4Id"    column="result4_id"    />
+
+        <result property="result5Id"    column="result5_id"    />
+
+        <result property="calculate1Id"    column="calculate1_id"    />
+
+        <result property="calculate2Id"    column="calculate2_id"    />
+
+        <result property="calculate3Id"    column="calculate3_id"    />
+
+        <result property="calculate4Id"    column="calculate4_id"    />
+
+        <result property="calculate5Id"    column="calculate5_id"    />
+
+        <result property="trained"    column="trained"    />
+        <result property="tested"    column="tested"    />
+    </resultMap>
     <sql id="selectSysTrainVo">
         select id, use_scene, search_condition, result1, result2, result3, result4, result5 from sys_train
     </sql>
@@ -70,6 +99,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="getComponentids" resultMap="TrainReturn">
         select use_scene, search_condition, result1_id, result2_id, result3_id, result4_id, result5_id from sys_train
     </select>
+    <select id="gettraindataset" resultMap="VerificationData">
+        select use_scene, search_condition, result1_id, result2_id, result3_id, result4_id, result5_id from sys_train
+    </select>
 
 
     <insert id="insertSysTrain" parameterType="SysTrain">

+ 55 - 0
cirs-biz/src/main/resources/mapper/biz/TVerificationTaskDetailMapper.xml

@@ -38,6 +38,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="tested"    column="tested"    />
     </resultMap>
 
+    <resultMap type="VerificationData" id="VerificationData">
+        <result property="id"    column="id"    />
+
+        <result property="useScene" column="use_scene"/>
+        <result property="searchCondition"    column="search_condition"    />
+
+        <result property="result1Id"    column="result1_id"    />
+
+        <result property="result2Id"    column="result2_id"    />
+
+        <result property="result3Id"    column="result3_id"    />
+
+        <result property="result4Id"    column="result4_id"    />
+
+        <result property="result5Id"    column="result5_id"    />
+
+        <result property="calculate1Id"    column="calculate1_id"    />
+
+        <result property="calculate2Id"    column="calculate2_id"    />
+
+        <result property="calculate3Id"    column="calculate3_id"    />
+
+        <result property="calculate4Id"    column="calculate4_id"    />
+
+        <result property="calculate5Id"    column="calculate5_id"    />
+
+        <result property="trained"    column="trained"    />
+        <result property="tested"    column="tested"    />
+    </resultMap>
+
     <sql id="selectTVerificationTaskDetailVo">
         select id, task_id, use_scene,search_condition, result1, result2, result3, result4, result5, calculate1, calculate2, calculate3,calculate4,calculate5, create_by, create_time, update_by, update_time, remark from t_verification_task_detail
     </sql>
@@ -73,6 +103,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{item}
         </foreach>
     </select>
+    <select id="alldata" resultMap="TVerificationTaskDetailResult">
+        select id,task_id, use_scene,search_condition, result1,result1_id, result2,result2_id, result3,result3_id, result4,result4_id, result5,result5_id, calculate1,calculate1_id, calculate2,calculate2_id, calculate3,calculate3_id,calculate4,calculate4_id,calculate5,calculate5_id, create_by, create_time, update_by, update_time, remark,trained,tested from t_verification_task_detail
+            where task_id=#{taskid}
+    </select>
+    <select id="getComponentId" resultType="java.lang.Long">
+        select id from t_electron_component where t_electron_component.component_name=#{attr}
+                                              AND t_electron_component.component_model=#{attr1}
+                                              AND t_electron_component.quality_grade=#{attr2}
+    </select>
+    <select id="getComponentids" resultMap="VerificationData">
+        select use_scene, search_condition, result1_id, result2_id, result3_id, result4_id, result5_id,calculate1_id,calculate2_id,calculate3_id,calculate4_id,calculate5_id,trained,tested from t_verification_task_detail
+            where task_id = #{taskid}
+    </select>
 
     <insert id="insertTVerificationTaskDetail" parameterType="TVerificationTaskDetail" useGeneratedKeys="true" keyProperty="id">
         insert into t_verification_task_detail
@@ -125,20 +168,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="useScene != null">use_scene = #{useScene},</if>
             <if test="searchCondition != null">search_condition = #{searchCondition},</if>
             <if test="result1 != null">result1 = #{result1},</if>
+            <if test="result1Id != null">result1_id = #{result1Id},</if>
             <if test="result2 != null">result2 = #{result2},</if>
+            <if test="result2Id != null">result2_id = #{result2Id},</if>
             <if test="result3 != null">result3 = #{result3},</if>
+            <if test="result3Id != null">result3_id = #{result3Id},</if>
             <if test="result4 != null">result4 = #{result4},</if>
+            <if test="result4Id != null">result4_id = #{result4Id},</if>
             <if test="result5 != null">result5 = #{result5},</if>
+            <if test="result5Id != null">result5_id = #{result5Id},</if>
             <if test="calculate1 != null">calculate1 = #{calculate1},</if>
+            <if test="calculate1Id != null">calculate1_id = #{calculate1Id},</if>
             <if test="calculate2 != null">calculate2 = #{calculate2},</if>
+            <if test="calculate2Id != null">calculate2_id = #{calculate2Id},</if>
             <if test="calculate3 != null">calculate3 = #{calculate3},</if>
+            <if test="calculate3Id != null">calculate3_id = #{calculate3Id},</if>
             <if test="calculate4 != null">calculate4 = #{calculate4},</if>
+            <if test="calculate4Id != null">calculate4_id = #{calculate4Id},</if>
             <if test="calculate5 != null">calculate5 = #{calculate5},</if>
+            <if test="calculate5Id != null">calculate5_id = #{calculate5Id},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="remark != null">remark = #{remark},</if>
+            <if test="trained != null">trained = #{trained},</if>
+            <if test="tested != null">tested = #{tested}</if>
         </trim>
         where id = #{id}
     </update>

+ 14 - 0
cirs-ui/src/api/biz/detail.js

@@ -42,3 +42,17 @@ export function delDetail(id) {
     method: 'delete'
   })
 }
+
+export function verification(taskid,modelPath) {
+  return request({
+    url: '/biz/detail/verification',
+    method: 'get',
+    params: {taskid,modelPath},
+  })
+}
+export function getTraindataset(){
+  return request({
+    url:'/biz/train/getTraindataset',
+    method:'get'
+  })
+}

+ 25 - 1
cirs-ui/src/views/biz/recommend/index.vue

@@ -220,6 +220,14 @@ export default {
         pageNum: 1,
         pageSize: 10,
 
+          useScene: '',
+          searchCondition: '',
+          result1Id: null,
+          result2Id: null,
+          result3Id: null,
+          result4Id: null,
+          result5Id: null,
+
 
       },
       use_scene:'',
@@ -264,7 +272,7 @@ export default {
       recommmend_args:{
 
         useScene: '',
-        searchCondition: "MOS场效应管,VDSS=35V,ID=35A",
+        searchCondition: '',
         result1Id: null,
         result2Id: null,
         result3Id: null,
@@ -293,6 +301,7 @@ export default {
 
     },
 
+
     //调用推荐算法
     recommend() {
       this.recommmend_args.useScene = this.use_scene
@@ -300,16 +309,31 @@ export default {
       recommend(this.recommmend_args, {modelPath: this.modelPath}).then(res=>{
         if(res.code===200) {
           this.recommmend_args = res.data
+          // this.queryParams.result1Id = this.recommmend_args.result1Id
+          this.queryParams.result1Id = this.recommmend_args.result1Id
+          this.queryParams.result2Id = this.recommmend_args.result2Id
+          this.queryParams.result3Id = this.recommmend_args.result3Id
+          this.queryParams.result4Id = this.recommmend_args.result4Id
+          this.queryParams.result5Id = this.recommmend_args.result5Id
+
+          this.$modal.msgSuccess("调用推荐算法成功")
+          console.log(this.recommmend_args)
           this.getList()
+
+
+        } else {
+          this.$modal.msgError(res.msg)
         }
 
       })
     },
     /** 查询元器件列表 */
     getList() {
+      console.log(this.queryParams)
       this.loading = true;
       this.evaluation.searchCondition = this.searchCondition
       RecommendlistComponent(this.queryParams).then(response => {//queryParams中分页的信息应该是在session中保存,在请求的时候通过session封装到了pagedomain中了
+
         this.componentList = response.rows;
         let clist = response.rows;
         for(let i=0; i< clist.length;i++){

+ 82 - 17
cirs-ui/src/views/biz/task/index.vue

@@ -124,7 +124,29 @@
           icon="el-icon-video-play"
           size="mini"
           @click="handleRun"
-        >运行</el-button>
+        >验证运行</el-button>
+
+      </el-col>
+      <el-col :span="1.5" >
+        <el-button
+
+          type='info'
+          plain
+          icon="el-icon-document"
+          size="mini"
+          @click="traindata"
+        >查询训练数据</el-button>
+
+      </el-col>
+      <el-col :span="1.5" >
+        <el-button
+
+          type='info'
+          plain
+          icon="el-icon-document"
+          size="mini"
+          @click="verificationdata"
+        >查询验证数据</el-button>
 
       </el-col>
 <!--      <el-col :span="1.5" >-->
@@ -265,11 +287,26 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+    <el-dialog title="训练数据" :visible.sync="traindatavisible" width="500px" append-to-body>
+      <div style="white-space: pre-wrap;font-size: 17px">
+        {{traindataset}}
+      </div>
+    </el-dialog>
+    <el-dialog title="验证数据" :visible.sync="verificationdatavisible" width="500px" append-to-body>
+      <div style="white-space: pre-wrap;font-size: 17px">
+        {{verificationdataset}}
+      </div>
+    </el-dialog>
   </div>
+
+
+
+
 </template>
 
 <script>
 import { listTask, getTask, delTask, addTask, updateTask } from "@/api/biz/task";
+import { verification,getTraindataset } from "@/api/biz/detail";
 import { getToken } from "@/utils/auth";
 import {Loading, Message} from "element-ui";
 import service from "../../../utils/request";
@@ -330,36 +367,64 @@ export default {
         // 上传的地址
         url: process.env.VUE_APP_BASE_API + "/biz/detail/importData"
       },
-
-
+      traindatavisible:false,
+      verificationdatavisible:false,
+      traindataset:[],
+      verificationdataset:[]
     };
+
   },
   created() {
     this.getList();
   },
   methods: {
 
+    traindata(){
+      getTraindataset().then(res=>{
+        console.log(res)
+        this.traindataset = res.data
+        this.traindataset.id = undefined
+      })
+      this.traindatavisible = true
+    },
+    verificationdata(){
+
+      this.verificationdatavisible = true
+    },
     handleRun(){
       let taskids = this.ids;
 
       const dayjs = require('dayjs');
       for(let taskid of taskids){
-        getTask(taskid).then(response => {
-
-          let task = response.data;
-          task.startTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
-          setTimeout(()=>{
-            task.taskStatus = "运行成功"
-            task.endTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
-            updateTask(task).then(res => {
-              this.$message.success("任务"+taskid+"运行成功!")
-
-              this.getList();
-            });
-          }, 3000);
+        // getTask(taskid).then(response => {
+        //
+        //   let task = response.data;
+        //   task.startTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
+        //   setTimeout(()=>{
+        //     task.taskStatus = "运行成功"
+        //     task.endTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
+        //     updateTask(task).then(res => {
+        //       this.$message.success("任务"+taskid+"运行成功!")
+        //
+        //       this.getList();
+        //     });
+        //   }, 3000);
+        //
+        // });
+        console.log(taskid)
+        verification(taskid,'D:\\checkpoint\\mymodel.pth').then(res=>{
+          console.log(res)
+          if(res.code===200){
+            this.$modal.msgSuccess(res.msg)
+            this.verificationdataset = res.data
+            this.verificationdataset.id = undefined
+          }
 
+          else {
+            this.$modal.msgError(res.msg)
+          }
+        })
 
-        });
 
       }
     },

+ 1 - 1
cirs-ui/src/views/index.vue

@@ -20,7 +20,7 @@
     <div align="center"  style="font-size: 18px;"> 评分最高的10个元器件
 
     <el-row>
-      <el-col :span="6" v-for="(idx,index) in topten.length" :key="idx" :offset="index%3 > 0 ? 2 : 1">
+      <el-col :span="11" v-for="(idx,index) in topten.length" :key="idx" :offset="index%2 > 0 ? 1 : 0">
         <el-card class="bgimg" :body-style="{ padding: '0px' }" style="font-size: 20px;background-color: revert;margin-bottom: 20px;">
 
           <div style="padding: 34px;">

+ 1 - 0
pom.xml

@@ -129,6 +129,7 @@
                 <version>${jwt.version}</version>
             </dependency>
 
+
             <!-- 验证码 -->
             <dependency>
                 <groupId>pro.fessional</groupId>