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