WangRuiLin 1 年之前
父节点
当前提交
9eefe700ca

+ 4 - 0
cirs-admin/pom.xml

@@ -24,6 +24,7 @@
             <optional>true</optional> <!-- 表示依赖不会传递 -->
         </dependency>
 
+
         <!-- swagger3-->
         <dependency>
             <groupId>io.springfox</groupId>
@@ -37,6 +38,7 @@
             <version>1.6.2</version>
         </dependency>
 
+
          <!-- Mysql驱动包 -->
         <dependency>
             <groupId>mysql</groupId>
@@ -55,6 +57,8 @@
             <artifactId>cirs-quartz</artifactId>
         </dependency>
 
+
+
         <!-- 代码生成-->
         <dependency>
             <groupId>com.cirs</groupId>

+ 2 - 1
cirs-admin/src/main/resources/application.yml

@@ -76,7 +76,7 @@ spring:
     # 数据库索引
     database: 0
     # 密码
-    password:
+    password: 123456
     # 连接超时时间
     timeout: 10s
     lettuce:
@@ -129,3 +129,4 @@ xss:
   excludes: /system/notice
   # 匹配链接
   urlPatterns: /system/*,/monitor/*,/tool/*
+

+ 1 - 0
cirs-biz/pom.xml

@@ -23,6 +23,7 @@
             <artifactId>cirs-common</artifactId>
         </dependency>
 
+
     </dependencies>
 
 

+ 205 - 0
cirs-biz/src/main/java/com/cirs/biz/controller/SysTrainController.java

@@ -0,0 +1,205 @@
+package com.cirs.biz.controller;
+
+import java.io.File;
+import java.sql.Timestamp;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.http.HttpServletResponse;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.cirs.biz.domain.TElectronComponent;
+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.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+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.SysTrain;
+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;
+
+/**
+ * 训练集数据列Controller
+ * 
+ * @author allen
+ * @date 2023-11-28
+ */
+@RestController
+@RequestMapping("/biz/train")
+public class SysTrainController extends BaseController
+{
+
+    @Autowired
+    private ISysTrainService sysTrainService;
+
+    /**
+     * 查询训练集数据列列表
+     */
+    @PreAuthorize("@ss.hasPermi('biz:train:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(SysTrain sysTrain)
+    {
+        startPage();
+        List<SysTrain> list = sysTrainService.selectSysTrainList(sysTrain);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出训练集数据列列表
+     */
+    @PreAuthorize("@ss.hasPermi('biz:train:export')")
+    @Log(title = "训练集数据列", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, SysTrain sysTrain)
+    {
+        List<SysTrain> list = sysTrainService.selectSysTrainList(sysTrain);
+        ExcelUtil<SysTrain> util = new ExcelUtil<SysTrain>(SysTrain.class);
+        util.exportExcel(response, list, "训练集数据列数据");
+    }
+
+    /**
+     * 获取训练集数据列详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('biz:train:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(sysTrainService.selectSysTrainById(id));
+    }
+
+    /**
+     * 新增训练集数据列
+     */
+    @PreAuthorize("@ss.hasPermi('biz:train:add')")
+    @Log(title = "训练集数据列", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody SysTrain sysTrain)
+    {
+        return toAjax(sysTrainService.insertSysTrain(sysTrain));
+    }
+
+    /**
+     * 修改训练集数据列
+     */
+    @PreAuthorize("@ss.hasPermi('biz:train:edit')")
+    @Log(title = "训练集数据列", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody SysTrain sysTrain)
+    {
+        return toAjax(sysTrainService.updateSysTrain(sysTrain));
+    }
+
+    /**
+     * 删除训练集数据列
+     */
+    @PreAuthorize("@ss.hasPermi('biz:train:remove')")
+    @Log(title = "训练集数据列", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(sysTrainService.deleteSysTrainByIds(ids));
+    }
+
+    @PreAuthorize("@ss.hasPermi('biz:train:import')")
+    @PostMapping("/importData")
+    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
+    {
+        ExcelUtil<SysTrain> util = new ExcelUtil<SysTrain>(SysTrain.class);
+        List<SysTrain> trainList = util.importExcel(file.getInputStream());
+
+        String operName = getUsername();
+        String message = sysTrainService.importTrain(trainList, updateSupport, operName);
+        return success(message);
+    }
+
+    @PostMapping("/importTemplate")
+    public void importTemplate(HttpServletResponse response)
+    {
+        ExcelUtil<SysTrain> util = new ExcelUtil<SysTrain>(SysTrain.class);
+        util.importTemplateExcel(response, "训练集数据");
+    }
+
+
+    @GetMapping("/componentIds")
+    public AjaxResult getComponentIds()
+    {
+        List<SysTrain> train_dataset = sysTrainService.alldata();
+        int idx = 0;
+        for(;idx < train_dataset.size(); idx++){
+            SysTrain data = train_dataset.get(idx);
+
+            if(data.getResult1Id()==null){//不改动元器件id时可行
+                Long component_id1 = sysTrainService.getComponentId(data.getResult1());
+                Long component_id2 = sysTrainService.getComponentId(data.getResult2());
+                Long component_id3 = sysTrainService.getComponentId(data.getResult3());
+                Long component_id4 = sysTrainService.getComponentId(data.getResult4());
+                Long component_id5 = sysTrainService.getComponentId(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:train:train')")
+    @GetMapping("/train")
+    public AjaxResult tojson(String modelPath) {
+        try {
+
+
+            Map<String, Object> objectMap=new HashMap<>();
+
+
+            objectMap.put("data", sysTrainService.getComponentids());
+            objectMap.put("modelPath", modelPath);
+
+
+            //接下来就传入算法即可
+            System.out.println(JSON.toJSONString(objectMap));
+
+            return success("数据处理成功");
+        } catch (Exception e) {
+
+            return error("数据处理失败");
+        }
+    }
+
+    @PreAuthorize("@ss.hasPermi('biz:train:recommend')")
+    @GetMapping("/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("modelPath", modelPath);
+            objectMap.put("result1Id",recommend_args.getResult1Id());
+            objectMap.put("result2Id",recommend_args.getResult2Id());
+            objectMap.put("result3Id",recommend_args.getResult3Id());
+            objectMap.put("result4Id",recommend_args.getResult4Id());
+            objectMap.put("result5Id",recommend_args.getResult5Id());
+            //接下来就传入算法
+            System.out.println(JSON.toJSONString(objectMap));
+
+            return success(recommend_args);
+        } catch (Exception e) {
+
+            return error("推荐元器件失败");
+        }
+    }
+}

+ 19 - 0
cirs-biz/src/main/java/com/cirs/biz/domain/RecommendInfo.java

@@ -22,6 +22,9 @@ public class RecommendInfo {
     @Excel(name = "元器件名称")
     private String componentName;
 
+    @Excel(name= "质量等级")
+    private String qualityGrade;
+
     @Excel(name = "国产替代型号")
     private String replaceDomesticModel;
 
@@ -42,6 +45,22 @@ public class RecommendInfo {
         return id;
     }
 
+    public List<Date> getUsedDates() {
+        return usedDates;
+    }
+
+    public void setUsedDates(List<Date> usedDates) {
+        this.usedDates = usedDates;
+    }
+
+    public String getQualityGrade() {
+        return qualityGrade;
+    }
+
+    public void setQualityGrade(String qualityGrade) {
+        this.qualityGrade = qualityGrade;
+    }
+
     public String getComponentName()
     {
         return componentName;

+ 190 - 0
cirs-biz/src/main/java/com/cirs/biz/domain/SysTrain.java

@@ -0,0 +1,190 @@
+package com.cirs.biz.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.cirs.common.annotation.Excel;
+import com.cirs.common.core.domain.BaseEntity;
+
+/**
+ * 训练集数据列对象 sys_train
+ * 
+ * @author allen
+ * @date 2023-11-28
+ */
+public class SysTrain extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 编号 */
+    private Long id;
+
+    /** 使用场景 */
+    @Excel(name = "使用场景")
+    private String useScene;
+
+    /** 查询条件 */
+    @Excel(name = "查询条件")
+    private String searchCondition;
+
+    /** 标准结果1(元器件名称1-型号规格1-质量等级1) */
+    @Excel(name = "标准结果1")
+    private String result1;
+
+    private Long result1Id;
+
+    /** 标准结果2(元器件名称2-型号规格2-质量等级2) */
+    @Excel(name = "标准结果2")
+    private String result2;
+
+    private Long result2Id;
+
+    /** 标准结果3(元器件名称3-型号规格3-质量等级3) */
+    @Excel(name = "标准结果3")
+    private String result3;
+
+    public Long getResult2Id() {
+        return result2Id;
+    }
+
+    public void setResult2Id(Long result2Id) {
+        this.result2Id = result2Id;
+    }
+
+    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 getResult1Id() {
+        return result1Id;
+    }
+
+    public void setResult1Id(Long result1Id) {
+        this.result1Id = result1Id;
+    }
+
+    private Long result3Id;
+
+    /** 标准结果4(元器件名称4-型号规格4-质量等级4) */
+    @Excel(name = "标准结果4")
+    private String result4;
+
+    private Long result4Id;
+
+    public Long getResult3Id() {
+        return result3Id;
+    }
+
+    public void setResult3Id(Long result3Id) {
+        this.result3Id = result3Id;
+    }
+
+    /** 标准结果5(元器件名称5-型号规格5-质量等级5) */
+    @Excel(name = "标准结果5")
+    private String result5;
+
+    private Long result5Id;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setUseScene(String useScene) 
+    {
+        this.useScene = useScene;
+    }
+
+    public String getUseScene() 
+    {
+        return useScene;
+    }
+    public void setSearchCondition(String searchCondition) 
+    {
+        this.searchCondition = searchCondition;
+    }
+
+    public String getSearchCondition() 
+    {
+        return searchCondition;
+    }
+    public void setResult1(String result1) 
+    {
+        this.result1 = result1;
+    }
+
+    public String getResult1() 
+    {
+        return result1;
+    }
+    public void setResult2(String result2) 
+    {
+        this.result2 = result2;
+    }
+
+    public String getResult2() 
+    {
+        return result2;
+    }
+    public void setResult3(String result3) 
+    {
+        this.result3 = result3;
+    }
+
+    public String getResult3() 
+    {
+        return result3;
+    }
+    public void setResult4(String result4) 
+    {
+        this.result4 = result4;
+    }
+
+    public String getResult4() 
+    {
+        return result4;
+    }
+    public void setResult5(String result5) 
+    {
+        this.result5 = result5;
+    }
+
+    public String getResult5() 
+    {
+        return result5;
+    }
+
+    @Override
+    public String toString() {
+        return "SysTrain{" +
+                "id=" + id +
+                ", useScene='" + useScene + '\'' +
+                ", searchCondition='" + searchCondition + '\'' +
+                ", result1='" + result1 + '\'' +
+                ", result1Id=" + result1Id +
+                ", result2='" + result2 + '\'' +
+                ", result2Id=" + result2Id +
+                ", result3='" + result3 + '\'' +
+                ", result3Id=" + result3Id +
+                ", result4='" + result4 + '\'' +
+                ", result4Id=" + result4Id +
+                ", result5='" + result5 + '\'' +
+                ", result5Id=" + result5Id +
+                '}';
+    }
+}

+ 84 - 0
cirs-biz/src/main/java/com/cirs/biz/domain/TrainReturn.java

@@ -0,0 +1,84 @@
+package com.cirs.biz.domain;
+
+import com.cirs.common.annotation.Excel;
+
+public class TrainReturn {
+    /** 使用场景 */
+
+    private String useScene;
+
+    /** 查询条件 */
+
+    private String searchCondition;
+
+
+    private String result1Id;
+
+    private String result2Id;
+
+
+    private String result3Id;
+
+
+    private String result4Id;
+
+    private String result5Id;
+
+    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 String getResult1Id() {
+        return result1Id;
+    }
+
+    public void setResult1Id(String result1Id) {
+        this.result1Id = result1Id;
+    }
+
+    public String getResult2Id() {
+        return result2Id;
+    }
+
+    public void setResult2Id(String result2Id) {
+        this.result2Id = result2Id;
+    }
+
+    public String getResult3Id() {
+        return result3Id;
+    }
+
+    public void setResult3Id(String result3Id) {
+        this.result3Id = result3Id;
+    }
+
+    public String getResult4Id() {
+        return result4Id;
+    }
+
+    public void setResult4Id(String result4Id) {
+        this.result4Id = result4Id;
+    }
+
+    public String getResult5Id() {
+        return result5Id;
+    }
+
+    public void setResult5Id(String result5Id) {
+        this.result5Id = result5Id;
+    }
+
+
+}

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

@@ -0,0 +1,72 @@
+package com.cirs.biz.mapper;
+
+import java.util.List;
+import com.cirs.biz.domain.SysTrain;
+import com.cirs.biz.domain.TrainReturn;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+/**
+ * 训练集数据列Mapper接口
+ * 
+ * @author allen
+ * @date 2023-11-28
+ */
+public interface SysTrainMapper 
+{
+    /**
+     * 查询训练集数据列
+     * 
+     * @param id 训练集数据列主键
+     * @return 训练集数据列
+     */
+    public SysTrain selectSysTrainById(Long id);
+
+    /**
+     * 查询训练集数据列列表
+     * 
+     * @param sysTrain 训练集数据列
+     * @return 训练集数据列集合
+     */
+    public List<SysTrain> selectSysTrainList(SysTrain sysTrain);
+
+    /**
+     * 新增训练集数据列
+     * 
+     * @param sysTrain 训练集数据列
+     * @return 结果
+     */
+    public int insertSysTrain(SysTrain sysTrain);
+
+    /**
+     * 修改训练集数据列
+     * 
+     * @param sysTrain 训练集数据列
+     * @return 结果
+     */
+    public int updateSysTrain(SysTrain sysTrain);
+
+    /**
+     * 删除训练集数据列
+     * 
+     * @param id 训练集数据列主键
+     * @return 结果
+     */
+    public int deleteSysTrainById(Long id);
+
+    /**
+     * 批量删除训练集数据列
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteSysTrainByIds(Long[] ids);
+
+
+    public Long getComponentId(@Param("attr") String attr, @Param("attr1") String attr1, @Param("attr2") String attr2);
+
+    public List<SysTrain> getall_data();
+
+
+    public List<TrainReturn> getComponentids();
+}

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

@@ -0,0 +1,71 @@
+package com.cirs.biz.service;
+
+import java.util.List;
+import com.cirs.biz.domain.SysTrain;
+import com.cirs.biz.domain.TrainReturn;
+
+/**
+ * 训练集数据列Service接口
+ * 
+ * @author allen
+ * @date 2023-11-28
+ */
+public interface ISysTrainService 
+{
+    /**
+     * 查询训练集数据列
+     * 
+     * @param id 训练集数据列主键
+     * @return 训练集数据列
+     */
+    public SysTrain selectSysTrainById(Long id);
+
+    /**
+     * 查询训练集数据列列表
+     * 
+     * @param sysTrain 训练集数据列
+     * @return 训练集数据列集合
+     */
+    public List<SysTrain> selectSysTrainList(SysTrain sysTrain);
+
+    /**
+     * 新增训练集数据列
+     * 
+     * @param sysTrain 训练集数据列
+     * @return 结果
+     */
+    public int insertSysTrain(SysTrain sysTrain);
+
+    /**
+     * 修改训练集数据列
+     * 
+     * @param sysTrain 训练集数据列
+     * @return 结果
+     */
+    public int updateSysTrain(SysTrain sysTrain);
+
+    /**
+     * 批量删除训练集数据列
+     * 
+     * @param ids 需要删除的训练集数据列主键集合
+     * @return 结果
+     */
+    public int deleteSysTrainByIds(Long[] ids);
+
+    /**
+     * 删除训练集数据列信息
+     * 
+     * @param id 训练集数据列主键
+     * @return 结果
+     */
+    public int deleteSysTrainById(Long id);
+
+    public String importTrain(List<SysTrain> trainList, boolean updateSupport, String operName);
+
+    public Long getComponentId(String result);
+
+    public List<SysTrain> alldata();
+
+
+    public List<TrainReturn> getComponentids();
+}

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

@@ -0,0 +1,170 @@
+package com.cirs.biz.service.impl;
+
+import java.util.List;
+
+
+import com.cirs.biz.domain.TrainReturn;
+import com.cirs.common.exception.ServiceException;
+import com.cirs.common.utils.StringUtils;
+import com.cirs.common.utils.bean.BeanValidators;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.cirs.biz.mapper.SysTrainMapper;
+import com.cirs.biz.domain.SysTrain;
+import com.cirs.biz.service.ISysTrainService;
+
+import javax.validation.Validator;
+
+/**
+ * 训练集数据列Service业务层处理
+ * 
+ * @author allen
+ * @date 2023-11-28
+ */
+@Service
+public class SysTrainServiceImpl implements ISysTrainService 
+{
+    @Autowired
+    private SysTrainMapper sysTrainMapper;
+
+    private static final Logger log = LoggerFactory.getLogger(SysTrainServiceImpl.class);
+
+    @Autowired
+    protected Validator validator;
+
+    /**
+     * 查询训练集数据列
+     * 
+     * @param id 训练集数据列主键
+     * @return 训练集数据列
+     */
+    @Override
+    public SysTrain selectSysTrainById(Long id)
+    {
+        return sysTrainMapper.selectSysTrainById(id);
+    }
+
+    /**
+     * 查询训练集数据列列表
+     * 
+     * @param sysTrain 训练集数据列
+     * @return 训练集数据列
+     */
+    @Override
+    public List<SysTrain> selectSysTrainList(SysTrain sysTrain)
+    {
+
+        return sysTrainMapper.selectSysTrainList(sysTrain);
+    }
+
+    /**
+     * 新增训练集数据列
+     * 
+     * @param sysTrain 训练集数据列
+     * @return 结果
+     */
+    @Override
+    public int insertSysTrain(SysTrain sysTrain)
+    {
+        return sysTrainMapper.insertSysTrain(sysTrain);
+    }
+
+    /**
+     * 修改训练集数据列
+     * 
+     * @param sysTrain 训练集数据列
+     * @return 结果
+     */
+    @Override
+    public int updateSysTrain(SysTrain sysTrain)
+    {
+        return sysTrainMapper.updateSysTrain(sysTrain);
+    }
+
+    /**
+     * 批量删除训练集数据列
+     * 
+     * @param ids 需要删除的训练集数据列主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysTrainByIds(Long[] ids)
+    {
+        return sysTrainMapper.deleteSysTrainByIds(ids);
+    }
+
+    /**
+     * 删除训练集数据列信息
+     * 
+     * @param id 训练集数据列主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysTrainById(Long id)
+    {
+        return sysTrainMapper.deleteSysTrainById(id);
+    }
+
+    @Override
+    public String importTrain(List<SysTrain> trainList, boolean updateSupport, String operName) {
+        if (StringUtils.isNull(trainList) || trainList.size() == 0)
+        {
+            throw new ServiceException("导入元器件数据不能为空!");
+        }
+        int successNum = 0;
+        int failureNum = 0;
+        StringBuilder successMsg = new StringBuilder();
+        StringBuilder failureMsg = new StringBuilder();
+
+        for (SysTrain train : trainList)
+        {
+            try
+            {
+
+                BeanValidators.validateWithException(validator, train);
+                train.setCreateBy(operName);
+                sysTrainMapper.insertSysTrain(train);
+                successNum++;
+                successMsg.append("<br/>" + successNum + "、训练数据 " + train.getId() + " 导入成功");
+
+            }
+            catch (Exception e)
+            {
+                failureNum++;
+                String msg = "<br/>" + failureNum + "、训练数据 " + train.getId() + " 导入失败:";
+                failureMsg.append(msg + e.getMessage());
+                log.error(msg, e);
+            }
+        }
+        if (failureNum > 0)
+        {
+            failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
+            throw new ServiceException(failureMsg.toString());
+        }
+        else
+        {
+            successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
+        }
+        return successMsg.toString();
+    }
+
+    @Override
+    public Long getComponentId(String result) {//元器件名称-型号规格-质量等级
+        String[] attrs = result.split("-");//切割不同属性
+        return sysTrainMapper.getComponentId(attrs[0],attrs[1],attrs[2]);
+    }
+
+    @Override
+    public List<SysTrain> alldata() {
+        return sysTrainMapper.getall_data();
+    }
+
+    @Override
+    public List<TrainReturn> getComponentids() {
+        return sysTrainMapper.getComponentids();
+    }
+
+
+}

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

@@ -9,10 +9,10 @@
         <result property="componentName"    column="component_name"    />
         <result property="componentModel"    column="component_model"    />
         <result property="replaceDomesticModel"    column="replace_domestic_model"    />
-
+        <result property="qualityGrade"    column="quality_grade"    />
     </resultMap>
     <select id="RecommendQueryList" resultMap="RecommendInfoResult">
-        select id,component_model,component_name,replace_domestic_model
+        select id,component_model,component_name,quality_grade,replace_domestic_model
             from t_electron_component
 
     </select>

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

@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.cirs.biz.mapper.SysTrainMapper">
+    
+    <resultMap type="SysTrain" id="SysTrainResult">
+        <result property="id"    column="id"    />
+        <result property="useScene"    column="use_scene"    />
+        <result property="searchCondition"    column="search_condition"    />
+        <result property="result1"    column="result1"    />
+        <result property="result1Id"    column="result1_id"    />
+        <result property="result2"    column="result2"    />
+        <result property="result2Id"    column="result2_id"    />
+        <result property="result3"    column="result3"    />
+        <result property="result3Id"    column="result3_id"    />
+        <result property="result4"    column="result4"    />
+        <result property="result4Id"    column="result4_id"    />
+        <result property="result5"    column="result5"    />
+        <result property="result5Id"    column="result5_id"    />
+    </resultMap>
+
+    <resultMap type="TrainReturn" id="TrainReturn">
+
+        <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"    />
+    </resultMap>
+
+    <sql id="selectSysTrainVo">
+        select id, use_scene, search_condition, result1, result2, result3, result4, result5 from sys_train
+    </sql>
+
+    <select id="selectSysTrainList" parameterType="SysTrain" resultMap="SysTrainResult">
+        <include refid="selectSysTrainVo"/>
+        <where>  
+            <if test="useScene != null  and useScene != ''"> and use_scene = #{useScene}</if>
+            <if test="searchCondition != null  and searchCondition != ''"> and search_condition = #{searchCondition}</if>
+            <if test="result1 != null  and result1 != ''"> and result1 = #{result1}</if>
+            <if test="result2 != null  and result2 != ''"> and result2 = #{result2}</if>
+            <if test="result3 != null  and result3 != ''"> and result3 = #{result3}</if>
+            <if test="result4 != null  and result4 != ''"> and result4 = #{result4}</if>
+            <if test="result5 != null  and result5 != ''"> and result5 = #{result5}</if>
+        </where>
+    </select>
+    
+    <select id="selectSysTrainById" parameterType="Long" resultMap="SysTrainResult">
+        <include refid="selectSysTrainVo"/>
+        where id = #{id}
+    </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="getall_data" resultMap="SysTrainResult">
+        select id, use_scene, search_condition, result1,result1_id, result2,result2_id, result3,result3_id, result4,result4_id, result5,result5_id from sys_train
+    </select>
+    <select id="getComponentids" resultMap="TrainReturn">
+        select use_scene, search_condition, result1_id, result2_id, result3_id, result4_id, result5_id from sys_train
+    </select>
+
+
+    <insert id="insertSysTrain" parameterType="SysTrain">
+        insert into sys_train
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="useScene != null">use_scene,</if>
+            <if test="searchCondition != null">search_condition,</if>
+            <if test="result1 != null">result1,</if>
+            <if test="result2 != null">result2,</if>
+            <if test="result3 != null">result3,</if>
+            <if test="result4 != null">result4,</if>
+            <if test="result5 != null">result5,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="useScene != null">#{useScene},</if>
+            <if test="searchCondition != null">#{searchCondition},</if>
+            <if test="result1 != null">#{result1},</if>
+            <if test="result2 != null">#{result2},</if>
+            <if test="result3 != null">#{result3},</if>
+            <if test="result4 != null">#{result4},</if>
+            <if test="result5 != null">#{result5},</if>
+         </trim>
+    </insert>
+
+    <update id="updateSysTrain" parameterType="SysTrain">
+        update sys_train
+        <trim prefix="SET" suffixOverrides=",">
+            <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>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteSysTrainById" parameterType="Long">
+        delete from sys_train where id = #{id}
+    </delete>
+
+    <delete id="deleteSysTrainByIds" parameterType="String">
+        delete from sys_train where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

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

@@ -10,20 +10,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="useScene" column="use_scene"/>
         <result property="searchCondition"    column="search_condition"    />
         <result property="result1"    column="result1"    />
+        <result property="result1Id"    column="result1_id"    />
         <result property="result2"    column="result2"    />
+        <result property="result2Id"    column="result2_id"    />
         <result property="result3"    column="result3"    />
+        <result property="result3Id"    column="result3_id"    />
         <result property="result4"    column="result4"    />
+        <result property="result4Id"    column="result4_id"    />
         <result property="result5"    column="result5"    />
+        <result property="result5Id"    column="result5_id"    />
         <result property="calculate1"    column="calculate1"    />
+        <result property="calculate1Id"    column="calculate1_id"    />
         <result property="calculate2"    column="calculate2"    />
+        <result property="calculate2Id"    column="calculate2_id"    />
         <result property="calculate3"    column="calculate3"    />
+        <result property="calculate3Id"    column="calculate3_id"    />
         <result property="calculate4"    column="calculate4"    />
+        <result property="calculate4Id"    column="calculate4_id"    />
         <result property="calculate5"    column="calculate5"    />
+        <result property="calculate5Id"    column="calculate5_id"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
         <result property="remark"    column="remark"    />
+        <result property="trained"    column="trained"    />
+        <result property="tested"    column="tested"    />
     </resultMap>
 
     <sql id="selectTVerificationTaskDetailVo">

+ 69 - 0
cirs-ui/src/api/biz/train.js

@@ -0,0 +1,69 @@
+import request from '@/utils/request'
+
+// 查询训练集数据列列表
+export function listTrain(query) {
+  return request({
+    url: '/biz/train/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询训练集数据列详细
+export function getTrain(id) {
+  return request({
+    url: '/biz/train/' + id,
+    method: 'get'
+  })
+}
+
+// 新增训练集数据列
+export function addTrain(data) {
+  return request({
+    url: '/biz/train',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改训练集数据列
+export function updateTrain(data) {
+  return request({
+    url: '/biz/train',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除训练集数据列
+export function delTrain(id) {
+  return request({
+    url: '/biz/train/' + id,
+    method: 'delete'
+  })
+}
+
+//由 元器件名称-型号规格-质量等级 得到元器件的id
+export function getComponentIds() {
+  return request({
+    url: '/biz/train/componentIds',
+    method: 'get'
+  })
+}
+//训练按钮
+export function train(modelPath) {
+  return request({
+    url:'/biz/train/train',
+    method:'get',
+    params: modelPath
+  })
+}
+
+export function recommend(recommend_args,modelPath) {
+  return request({
+    url: '/biz/train/recommend',
+    method: 'post',
+    data: recommend_args,
+    params: modelPath,
+  })
+}

+ 1 - 0
cirs-ui/src/components/Breadcrumb/index.vue

@@ -66,6 +66,7 @@ export default {
   line-height: 50px;
   margin-left: 8px;
 
+
   .no-redirect {
     color: #97a8be;
     cursor: text;

+ 3 - 1
cirs-ui/src/layout/components/Navbar.vue

@@ -115,7 +115,8 @@ export default {
   height: 50px;
   overflow: hidden;
   position: relative;
-  background: #fff;
+  background: radial-gradient(circle at 10% 20%, #3A71A8 0%,  #bfcbd9 90%);
+
   box-shadow: 0 1px 4px rgba(0,21,41,.08);
 
   .hamburger-container {
@@ -133,6 +134,7 @@ export default {
 
   .breadcrumb-container {
     float: left;
+
   }
 
   .topmenu-container {

+ 2 - 1
cirs-ui/src/layout/components/TagsView/index.vue

@@ -239,9 +239,10 @@ export default {
 
 <style lang="scss" scoped>
 .tags-view-container {
+
   height: 34px;
   width: 100%;
-  background: #fff;
+  background:  #bfcbd9;
   border-bottom: 1px solid #d8dce5;
   box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
   .tags-view-wrapper {

+ 7 - 4
cirs-ui/src/layout/index.vue

@@ -3,7 +3,7 @@
     <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"/>
     <sidebar v-if="!sidebar.hide" class="sidebar-container"/>
     <div :class="{hasTagsView:needTagsView,sidebarHide:sidebar.hide}" class="main-container">
-      <div :class="{'fixed-header':fixedHeader}">
+      <div :class="{'fixed-header':fixedHeader}" >
         <navbar/>
         <tags-view v-if="needTagsView"/>
       </div>
@@ -63,15 +63,15 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-  @import "~@/assets/styles/mixin.scss";
-  @import "~@/assets/styles/variables.scss";
+  @import "../assets/styles/mixin.scss";
+  @import "../assets/styles/variables.scss";
 
   .app-wrapper {
     @include clearfix;
     position: relative;
+
     height: 100%;
     width: 100%;
-
     &.mobile.openSidebar {
       position: fixed;
       top: 0;
@@ -108,4 +108,7 @@ export default {
   .mobile .fixed-header {
     width: 100%;
   }
+  //.main-container {
+  //  background: radial-gradient(circle at 10% 20%, #3A71A8 0%,  #bfcbd9 90%);
+  //}
 </style>

+ 29 - 5
cirs-ui/src/views/biz/recommend/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
     <div>
-    <el-select v-model="use_scene" placeholder="请选择使用场景">
+    <el-select v-model="use_scene" placeholder="请选择使用场景" style="padding-right: 14px">
       <el-option
         v-for="item in options"
         :key="item.value"
@@ -11,12 +11,13 @@
     </el-select>
     <span>
       <el-input placeholder="请输入查询条件" v-model="searchCondition" style="width:250px"/>
-      <el-button type="primary" @click="getList">推荐</el-button>
+      <el-button type="primary" @click="recommend" style="margin-left: 20px">推荐</el-button>
     </span>
     </div>
     <el-table v-loading="loading" :data="componentList" >
-      <el-table-column label="型号规格" align="center" prop="componentModel" :show-overflow-tooltip="true"/>
       <el-table-column label="元器件名称" align="center" prop="componentName" :show-overflow-tooltip="true"/>
+      <el-table-column label="型号规格" align="center" prop="componentModel" :show-overflow-tooltip="true"/>
+      <el-table-column label="质量等级" align="center" prop="qualityGrade" :show-overflow-tooltip="true"/>
       <el-table-column label="国产替代型号" align="center" prop="replaceDomesticModel" :show-overflow-tooltip="true"/>
 <!--      <el-table-column label="元器件应用" align="center" prop="applications"/>-->
       <el-table-column label="元器件应用" align="center" :show-overflow-tooltip="true">
@@ -187,7 +188,7 @@
 
 <script>
 import { RecommendlistComponent,getComponent,getBycomponentId,addEvaluation,addTime,getscore } from "@/api/biz/recommend";
-
+import { recommend } from "@/api/biz/train";
 export default {
   name: "recommend",
   data() {
@@ -258,7 +259,18 @@ export default {
       ],
       currentTime:0,
       startTime:0,
-      pageviewTime:{}
+      pageviewTime:{},
+      modelPath: 'D:\\checkpoint\\mymodel.pth',
+      recommmend_args:{
+
+        useScene: '',
+        searchCondition: "MOS场效应管,VDSS=35V,ID=35A",
+        result1Id: null,
+        result2Id: null,
+        result3Id: null,
+        result4Id: null,
+        result5Id: null,
+      }
     };
   },
   // created() {
@@ -281,6 +293,18 @@ export default {
 
     },
 
+    //调用推荐算法
+    recommend() {
+      this.recommmend_args.useScene = this.use_scene
+      this.recommmend_args.searchCondition = this.searchCondition
+      recommend(this.recommmend_args, {modelPath: this.modelPath}).then(res=>{
+        if(res.code===200) {
+          this.recommmend_args = res.data
+          this.getList()
+        }
+
+      })
+    },
     /** 查询元器件列表 */
     getList() {
       this.loading = true;

+ 413 - 0
cirs-ui/src/views/biz/train/index.vue

@@ -0,0 +1,413 @@
+<template>
+  <div class="app-container">
+
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+<!--      <el-form-item label="使用场景" prop="useScene">-->
+<!--        <el-input-->
+<!--          v-model="queryParams.useScene"-->
+<!--          placeholder="请输入使用场景"-->
+<!--          clearable-->
+<!--          @keyup.enter.native="handleQuery"-->
+<!--        />-->
+<!--      </el-form-item>-->
+      <el-form-item label="使用场景" prop="useScene">
+        <el-select v-model="queryParams.useScene" placeholder="请选择使用场景">
+          <el-option
+            v-for="item in options"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value">
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="查询条件" prop="searchCondition">
+        <el-input
+          v-model="queryParams.searchCondition"
+          placeholder="请输入元器件查询条件"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['biz:train:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['biz:train:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['biz:train:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="info"
+          icon="el-icon-upload2"
+          size="mini"
+          @click="handleImport"
+          v-hasPermi="['biz:train:import']"
+        >训练数据集导入</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          v-hasPermi="['biz:train:export']"
+        >导出</el-button>
+      </el-col >
+      <el-col :span="1.5" style="padding-left: 500px">
+        <el-button type="primary" @click="mytrain">训练</el-button>
+      </el-col>
+
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="trainList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+<!--      <el-table-column label="编号" align="center" prop="id" />-->
+      <el-table-column label="使用场景" align="center" prop="useScene" />
+      <el-table-column label="查询条件" align="center" prop="searchCondition" />
+      <el-table-column label="标准结果1" align="center" prop="result1" />
+      <el-table-column label="标准结果2" align="center" prop="result2" />
+      <el-table-column label="标准结果3" align="center" prop="result3" />
+      <el-table-column label="标准结果4" align="center" prop="result4" />
+      <el-table-column label="标准结果5" align="center" prop="result5" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['biz:train:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['biz:train:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改训练集数据列对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="使用场景" prop="useScene">
+          <el-input v-model="form.useScene" placeholder="请输入使用场景" />
+        </el-form-item>
+        <el-form-item label="查询条件" prop="searchCondition">
+          <el-input v-model="form.searchCondition" type="textarea" placeholder="请输入内容" />
+        </el-form-item>
+        <el-form-item label="标准结果1" prop="result1">
+          <el-input v-model="form.result1" placeholder="请输入标准结果1" />
+        </el-form-item>
+        <el-form-item label="标准结果2" prop="result2">
+          <el-input v-model="form.result2" placeholder="请输入标准结果2" />
+        </el-form-item>
+        <el-form-item label="标准结果3" prop="result3">
+          <el-input v-model="form.result3" placeholder="请输入标准结果3" />
+        </el-form-item>
+        <el-form-item label="标准结果4" prop="result4">
+          <el-input v-model="form.result4" placeholder="请输入标准结果4" />
+        </el-form-item>
+        <el-form-item label="标准结果5" prop="result5">
+          <el-input v-model="form.result5" placeholder="请输入标准结果5" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+    <!-- 训练数据导入对话框 -->
+    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px">
+      <el-upload
+        ref="upload"
+        :limit="1"
+        accept=".xlsx, .xls"
+        :headers="upload.headers"
+        :action="upload.url + '?updateSupport=' + upload.updateSupport"
+        :disabled="upload.isUploading"
+        :on-progress="handleFileUploadProgress"
+        :on-success="handleFileSuccess"
+        :auto-upload="false"
+        drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          将文件拖到此处,或
+          <em>点击上传</em>
+        </div>
+        <div class="el-upload__tip" slot="tip">
+          <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的数据
+          <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
+        </div>
+        <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFileForm">确 定</el-button>
+        <el-button @click="upload.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listTrain, getTrain, delTrain, addTrain, updateTrain,getComponentIds,train } from "@/api/biz/train";
+import { getToken } from "@/utils/auth";
+export default {
+  name: "Train",
+  data() {
+    return {
+      // 导入参数
+      upload: {
+        // 是否显示弹出层(导入)
+        open: false,
+        // 弹出层标题(导入)
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/biz/train/importData"
+      },
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 训练集数据列表格数据
+      trainList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        useScene: null,
+        searchCondition: null,
+        result1: null,
+        result2: null,
+        result3: null,
+        result4: null,
+        result5: null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      },
+      options:[
+        {
+          value: '质量最优',
+          label: '质量最优'
+        }, {
+          value: '成本最优',
+          label: '成本最优'
+        }, {
+          value: '供货周期最优',
+          label: '供货周期最优'
+        }, {
+          value: '供货量最优',
+          label: '供货量最优'
+        }
+      ],
+      modelPath:'D:\\checkpoint\\mymodel.pth'
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    mytrain() {
+      getComponentIds().then(response=>{
+
+        train({modelPath: this.modelPath}).then(res=>{
+          if(res.code===200)
+            this.$modal.msgSuccess(res.msg);
+          else {
+            this.$modal.msgError(res.msg);
+          }
+        })
+      })
+
+    },
+    /** 查询训练集数据列列表 */
+    getList() {
+      this.loading = true;
+      listTrain(this.queryParams).then(response => {
+        this.trainList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        useScene: null,
+        searchCondition: null,
+        result1: null,
+        result2: null,
+        result3: null,
+        result4: null,
+        result5: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加训练集数据列";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getTrain(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改训练集数据列";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateTrain(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addTrain(this.form).then(response => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal.confirm('是否确认删除训练集数据列编号为"' + ids + '"的数据项?').then(function() {
+        return delTrain(ids);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    /** 下载模板操作 */
+    importTemplate() {
+      this.download('biz/train/importTemplate', {
+      }, `train_dataset_template_${new Date().getTime()}.xlsx`)
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('biz/train/export', {
+        ...this.queryParams
+      }, `train_${new Date().getTime()}.xlsx`)
+    },
+    /** 导入按钮操作 */
+    handleImport() {
+      this.upload.title = "训练数据集导入";
+      this.upload.open = true;
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.upload.open = false;
+      this.upload.isUploading = false;
+      this.$refs.upload.clearFiles();
+      this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
+      this.getList();
+    },
+// 提交上传文件
+    submitFileForm() {
+      this.$refs.upload.submit();
+    }
+  }
+};
+</script>

+ 3 - 2
cirs-ui/src/views/index.vue

@@ -44,7 +44,7 @@
                 >
                 </el-rate>
               </div>
-            </p>
+
           </div>
         </el-card>
       </el-col>
@@ -356,7 +356,8 @@ export default {
 }
 .home {
   background: radial-gradient(circle at 10% 20%, #3A71A8 0%,  rgb(239, 249, 249)90%);
-  border-radius: 20px;
+  //border-radius: 20px;
+
   blockquote {
     padding: 10px 20px;
     margin: 0 0 20px;

+ 2 - 1
pom.xml

@@ -9,7 +9,7 @@
     <version>1.0.0</version>
 
     <name>cirs</name>
-    <url>http://www.cirs.vip</url>
+    <url>http://www.cirs</url>
     <description>元器件智能推荐系统</description>
     
     <properties>
@@ -52,6 +52,7 @@
                 <version>${druid.version}</version>
             </dependency>
 
+
             <!-- 解析客户端操作系统、浏览器等 -->
             <dependency>
                 <groupId>eu.bitwalker</groupId>