浏览代码

0508 修改

fuyanting 1 年之前
父节点
当前提交
6194d4eb9c

+ 11 - 23
cirs-biz/src/main/java/com/cirs/biz/controller/SysTrainController.java

@@ -1,7 +1,7 @@
 package com.cirs.biz.controller;
 
 import com.cirs.biz.DTO.ResponseDTO;
-import com.cirs.biz.domain.TEvaluation;
+import com.cirs.biz.domain.*;
 import com.cirs.biz.service.ITElectronComponentService;
 import com.cirs.biz.service.ITEvaluationService;
 import com.cirs.common.utils.DictUtils;
@@ -14,8 +14,6 @@ import java.util.stream.Collectors;
 import javax.servlet.http.HttpServletResponse;
 
 import com.alibaba.fastjson2.JSON;
-import com.cirs.biz.domain.TElectronComponent;
-import com.cirs.biz.domain.TrainReturn;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
@@ -26,7 +24,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.SysTrain;
 import com.cirs.biz.service.ISysTrainService;
 import com.cirs.common.utils.poi.ExcelUtil;
 import com.cirs.common.core.page.TableDataInfo;
@@ -210,7 +207,6 @@ public class SysTrainController extends BaseController
 
             String res = mono.block();
             logger.info(res);
-
             //接下来就传入算法即可
 //            System.out.println(JSON.toJSONString(objectMap));
             AjaxResult result = new AjaxResult();
@@ -233,14 +229,8 @@ public class SysTrainController extends BaseController
         tEvaluationpara.setMark(5);
         tEvaluationpara.setUseScene(recommend_args.getUseScene());
         tEvaluationpara.setSearchCondition(recommend_args.getSearchCondition());
-        List<Long> x = itEvaluationService.selectTEvaluationListbymark(tEvaluationpara);
-
-        for(Long conid:x){
-            TElectronComponent tElectronComponent = electronComponentService.selectTElectronComponentById(conid);
-            if(tElectronComponent!=null){
-                resultListend.add(tElectronComponent);
-            }
-        }
+        List<TElectronComponent> electronComponentList = itEvaluationService.selectTEvaluationListbymark(tEvaluationpara);
+        resultListend.addAll(electronComponentList);
         try {
             String recommend_uri = DictUtils.getDictValue("biz_algorithm_config","recommend_uri");
             String model_path = DictUtils.getDictValue("biz_algorithm_config","model_path");
@@ -255,10 +245,8 @@ public class SysTrainController extends BaseController
             objectMap.put("result5Id",recommend_args.getResult5Id());
             logger.info("request payload: {}",JSON.toJSONString(objectMap));
             //接下来就传入算法
-
             // 使用 ParameterizedTypeReference 定义泛型类型
             ParameterizedTypeReference<ResponseDTO<SysTrain>> responseType = new ParameterizedTypeReference<ResponseDTO<SysTrain>>() {};
-
             // 发起 GET 请求,并解析为带有泛型的 ResponseEntity 返回值
             ResponseEntity<ResponseDTO<SysTrain>> responseEntity = webClient
                     .post()
@@ -296,29 +284,29 @@ public class SysTrainController extends BaseController
                         Map<Long, TElectronComponent> idToCompMap = list.stream().collect(Collectors.toMap(TElectronComponent::getId, obj -> obj));
                         HashSet idSet = new HashSet();
                         for (Long id : ids) {
-                            // 放入有数据的并且未添加的数据
-                            if(idToCompMap.get(id) != null && !idSet.contains(id)){
+                            boolean idExistsInResultList = false;
+                            for (TElectronComponent result : resultListend) {
+                                if (result.getId().equals(id)) {
+                                    idExistsInResultList = true;
+                                    break;
+                                }
+                            }
+                            if (!idExistsInResultList && idToCompMap.get(id) != null  && !idSet.contains(id)) {
                                 idSet.add(id);
                                 resultListend.add(idToCompMap.get(id));
                             }
                         }
                     }
-
                 } else {
                     return error("推荐元器件结果为空");
                 }
             } else {
                 return error("推荐元器件失败");
             }
-
-
-
         } catch (Exception e) {
             logger.error("推荐元器件失败", e);
             return error("推荐元器件失败");
         }
-
-
         return success(resultListend);
     }
 

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

@@ -2,6 +2,9 @@ package com.cirs.biz.mapper;
 
 import java.util.HashMap;
 import java.util.List;
+
+import com.cirs.biz.domain.ElectronComponent;
+import com.cirs.biz.domain.TElectronComponent;
 import com.cirs.biz.domain.TEvaluation;
 import com.cirs.biz.domain.avgEvaluation;
 import org.apache.ibatis.annotations.Param;
@@ -32,7 +35,7 @@ public interface TEvaluationMapper
 
 
 
-    public List<Long> selectTEvaluationListbymark(TEvaluation tEvaluation);
+    public List<TElectronComponent> selectTEvaluationListbymark(TEvaluation tEvaluation);
     /**
      * 新增评价
      * 

+ 4 - 1
cirs-biz/src/main/java/com/cirs/biz/service/ITEvaluationService.java

@@ -2,6 +2,9 @@ package com.cirs.biz.service;
 
 import java.util.HashMap;
 import java.util.List;
+
+import com.cirs.biz.domain.ElectronComponent;
+import com.cirs.biz.domain.TElectronComponent;
 import com.cirs.biz.domain.TEvaluation;
 import com.cirs.biz.domain.avgEvaluation;
 
@@ -31,7 +34,7 @@ public interface ITEvaluationService
 
 
 
-    public List<Long> selectTEvaluationListbymark(TEvaluation tEvaluation);
+    public List<TElectronComponent> selectTEvaluationListbymark(TEvaluation tEvaluation);
     /**
      * 新增评价
      * 

+ 3 - 1
cirs-biz/src/main/java/com/cirs/biz/service/impl/TEvaluationServiceImpl.java

@@ -3,6 +3,8 @@ package com.cirs.biz.service.impl;
 import java.util.HashMap;
 import java.util.List;
 
+import com.cirs.biz.domain.ElectronComponent;
+import com.cirs.biz.domain.TElectronComponent;
 import com.cirs.biz.domain.avgEvaluation;
 import com.cirs.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -48,7 +50,7 @@ public class TEvaluationServiceImpl implements ITEvaluationService
     }
 
     @Override
-    public List<Long> selectTEvaluationListbymark(TEvaluation tEvaluation) {
+    public List<TElectronComponent> selectTEvaluationListbymark(TEvaluation tEvaluation) {
         return tEvaluationMapper.selectTEvaluationListbymark(tEvaluation);
     }
 

+ 65 - 3
cirs-biz/src/main/resources/mapper/biz/TEvaluationMapper.xml

@@ -18,6 +18,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="useScene" column="use_scene"/>
     </resultMap>
 
+
+    <resultMap type="TElectronComponent" id="TElectronComponentResult">
+        <result property="id"    column="id"    />
+        <result property="componentCategory"    column="component_category"    />
+        <result property="componentCategoryCode"    column="component_category_code"    />
+        <result property="componentName"    column="component_name"    />
+        <result property="manufacturer"    column="manufacturer"    />
+        <result property="componentModel"    column="component_model"    />
+        <result property="replaceDomesticModel"    column="replace_domestic_model"    />
+        <result property="qualityGrade"    column="quality_grade"    />
+        <result property="qualityProblem"    column="quality_problem"    />
+        <result property="deliveryCycle"    column="delivery_cycle"    />
+        <result property="supplyQuantity"    column="supply_quantity"    />
+        <result property="unitPrice"    column="unit_price"    />
+        <result property="zzkkLevel"    column="zzkk_level"    />
+        <result property="wkbInfo"    column="wkb_info"    />
+        <result property="inPreference"    column="in_preference"    />
+        <result property="qualityInspection"    column="quality_inspection"    />
+        <result property="shutdownDate"    column="shutdown_date"    />
+        <result property="forbidden"    column="forbidden"    />
+        <result property="appValidationData"    column="app_validation_data"    />
+        <result property="riskEvaluationIndex"    column="risk_evaluation_index"    />
+        <result property="resistanceValue"    column="resistance_value"    />
+        <result property="resistancePrecision"    column="resistance_precision"    />
+        <result property="resistanceTemperature"    column="resistance_temperature"    />
+        <result property="resistancePower"    column="resistance_power"    />
+        <result property="encapsulationMode"    column="encapsulation_mode"    />
+        <result property="capacitanceValue"    column="capacitance_value"    />
+        <result property="capacitanceLoss"    column="capacitance_loss"    />
+        <result property="temperatureCoefficient"    column="temperature_coefficient"    />
+        <result property="ratedVoltage"    column="rated_voltage"    />
+        <result property="inductance"    column="inductance"    />
+        <result property="qualityFactor"    column="quality_factor"    />
+        <result property="dcResistance"    column="dc_resistance"    />
+        <result property="ratedCurrent"    column="rated_current"    />
+        <result property="paramIfm"    column="param_ifm"    />
+        <result property="paramVrrm"    column="param_vrrm"    />
+        <result property="paramIfsm"    column="param_ifsm"    />
+        <result property="paramZz"    column="param_zz"    />
+        <result property="paramPcm"    column="param_pcm"    />
+        <result property="paramIcm"    column="param_icm"    />
+        <result property="paramVcbo"    column="param_vcbo"    />
+        <result property="paramVceo"    column="param_vceo"    />
+        <result property="paramVebo"    column="param_vebo"    />
+        <result property="paramVdss"    column="param_vdss"    />
+        <result property="paramId"    column="param_id"    />
+        <result property="paramRdsOn"    column="param_RDS_on"    />
+        <result property="boundaryDimension"    column="boundary_dimension"    />
+        <result property="antistaticCapacity"    column="antistatic_capacity"    />
+        <result property="radiationResistance"    column="radiation_resistance"    />
+        <result property="materials"    column="materials"    />
+        <result property="craft"    column="craft"    />
+        <result property="weight"    column="weight"    />
+        <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"    />
+    </resultMap>
+
     <sql id="selectTEvaluationVo">
         select id, search_condition, component_id, mark, used_by, create_by, create_time, update_by, update_time, remark,use_scene from t_evaluation
     </sql>
@@ -35,7 +95,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
 
-    <select id="selectTEvaluationListbymark" parameterType="TEvaluation" resultType="java.lang.Long">
+
+    <select id="selectTEvaluationListbymark" parameterType="TEvaluation" resultMap="TElectronComponentResult">
+        select * from t_electron_component where id in (
         SELECT DISTINCT component_id
         FROM (
         SELECT component_id
@@ -47,8 +109,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="useScene != null"> and use_scene = #{useScene}</if>
         </where>
         ORDER BY create_time DESC
-        )AS subquery
-
+        ) AS evaluation
+        )
     </select>
 
 

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

@@ -280,15 +280,13 @@ export default {
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-
         useScene: '',
         searchCondition: '',
         result1Id: null,
         result2Id: null,
         result3Id: null,
         result4Id: null,
-        result5Id: null
-
+        result5Id: null,
       },
       use_scene: '',
       evaluation: {
@@ -328,7 +326,6 @@ export default {
       currentTime: 0,
       startTime: 0,
       pageviewTime: {},
-
       recommmend_args: {
         useScene: '',
         searchCondition: '',
@@ -359,12 +356,10 @@ export default {
         this.evaluation.usedBy = row.applications.toString()
       })
     },
-
     // 调用推荐算法
     recommend() {
       this.recommmend_args.useScene = this.use_scene
       this.recommmend_args.searchCondition = this.searchCondition
-
       recommend(this.recommmend_args).then(res => {
         if (res.code === 200) {
           this.componentList = res.data
@@ -375,7 +370,6 @@ export default {
               for (const one of res.data) {
                 apps.push(one.usedBy)
               }
-
               if (apps && apps.length > 3) {
                 this.$set(this.componentList[i], 'applications', apps.slice(0, 3).join(', ') + '...')
               } else {
@@ -392,10 +386,8 @@ export default {
     getList() {
       // console.log(this.queryParams)
       this.loading = true
-
       RecommendlistComponent(this.queryParams).then(response => { // queryParams中分页的信息应该是在session中保存,在请求的时候通过session封装到了pagedomain中了
         this.componentList = response.rows
-
         const clist = response.rows
         for (let i = 0; i < clist.length; i++) {
           getBycomponentId(clist[i].id).then(res => {
@@ -420,10 +412,8 @@ export default {
       this.evaluation.remark = this.eremark
       this.evaluation.useScene = this.use_scene
       this.evaluation.searchCondition = this.searchCondition
-
       addEvaluation(this.evaluation).then(response => {
         // this.$modal.msgSuccess("评分成功");
-
         this.showevalatedialog = false
       })
     },

+ 8 - 8
cirs-ui/src/views/biz/sqd/index.vue

@@ -48,7 +48,7 @@
           v-hasPermi="['biz:sqd:remove']"
         >删除</el-button>
       </el-col>
-      <el-col :span="1.5">
+      <!-- <el-col :span="1.5">
         <el-button
           type="warning"
           plain
@@ -57,7 +57,7 @@
           @click="handleExport"
           v-hasPermi="['biz:sqd:export']"
         >导出</el-button>
-      </el-col>
+      </el-col> -->
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -77,7 +77,7 @@
           <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="备注" align="center" prop="remark" />
+      <!-- <el-table-column label="备注" align="center" prop="remark" /> -->
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -458,11 +458,11 @@ export default {
       // }).catch(() => {});
     },
     /** 导出按钮操作 */
-    handleExport() {
-      this.download('biz/sqd/export', {
-        ...this.queryParams
-      }, `sqd_${new Date().getTime()}.xlsx`)
-    }
+    // handleExport() {
+    //   this.download('biz/sqd/export', {
+    //     ...this.queryParams
+    //   }, `sqd_${new Date().getTime()}.xlsx`)
+    // }
   }
 };
 </script>