|
@@ -129,15 +129,25 @@ public class CheckService {
|
|
|
AlgorithmYml.CheckValid checkValid = algorithmYml.getCheckValid(Integer.valueOf(code));
|
|
AlgorithmYml.CheckValid checkValid = algorithmYml.getCheckValid(Integer.valueOf(code));
|
|
|
MultiValueMap<String, Object> params = getStringObjectMultiValueMap(checkValid, String.valueOf(id));
|
|
MultiValueMap<String, Object> params = getStringObjectMultiValueMap(checkValid, String.valueOf(id));
|
|
|
HttpEntity<MultiValueMap<String, Object>> files = getHttpEntityMap(toFile, params);
|
|
HttpEntity<MultiValueMap<String, Object>> files = getHttpEntityMap(toFile, params);
|
|
|
|
|
+ //TODO 添加一条请求记录到数据库,
|
|
|
|
|
+ Algorithm algorithmFirst = new Algorithm();
|
|
|
|
|
+ R<Algorithm> alg= laboratoryService.saveAlgorithmData(algorithmFirst);
|
|
|
|
|
+ logger.info("===============算法数据添加结果,id="+alg.getData());
|
|
|
logger.info("===============4=================");
|
|
logger.info("===============4=================");
|
|
|
ImgPostResponse<AnalysisReturnData> send = HttpUtils.sendV5(restTemplateLocal, files, algorithmYml);
|
|
ImgPostResponse<AnalysisReturnData> send = HttpUtils.sendV5(restTemplateLocal, files, algorithmYml);
|
|
|
if (send == null || send.getStatus_code() != 1000) {
|
|
if (send == null || send.getStatus_code() != 1000) {
|
|
|
|
|
+ //算法记录更新
|
|
|
|
|
+ algorithmFirst.setRespCode(send.getStatus_code());
|
|
|
|
|
+ algorithmFirst.setId(Long.valueOf(alg.getData().toString()));
|
|
|
|
|
+ laboratoryService.update(algorithmFirst);
|
|
|
|
|
+ logger.info("===============算法请求异常,更新数据,id="+alg.getData().getId());
|
|
|
assert send != null;
|
|
assert send != null;
|
|
|
logger.error("==================4.1==================="+send.getStatus_code()+"==========="+send.getMessage());
|
|
logger.error("==================4.1==================="+send.getStatus_code()+"==========="+send.getMessage());
|
|
|
return R.fail("算法服务错误,请重试!");
|
|
return R.fail("算法服务错误,请重试!");
|
|
|
}
|
|
}
|
|
|
logger.info("===============5=================");
|
|
logger.info("===============5=================");
|
|
|
- R algorithm = saveAlgorithmV5(file,send, checkValid);
|
|
|
|
|
|
|
+ R algorithm = saveAlgorithmV5(Long.valueOf(alg.getData().toString()),file,send, checkValid);
|
|
|
|
|
+ logger.info("===============算法请求正常,更新数据"+algorithm.getData());
|
|
|
if (algorithm.getCode() != 200) {
|
|
if (algorithm.getCode() != 200) {
|
|
|
logger.error("==============="+algorithm.getCode()+"=================");
|
|
logger.error("==============="+algorithm.getCode()+"=================");
|
|
|
return algorithm;
|
|
return algorithm;
|
|
@@ -299,6 +309,7 @@ public class CheckService {
|
|
|
|
|
|
|
|
public Algorithm CovertV5(Map<String, Object> data) {
|
|
public Algorithm CovertV5(Map<String, Object> data) {
|
|
|
Algorithm algorithm = new Algorithm();
|
|
Algorithm algorithm = new Algorithm();
|
|
|
|
|
+ algorithm.setId(Long.valueOf(data.get("id").toString()));
|
|
|
algorithm.setAlgorithmType(data.get("type").toString());
|
|
algorithm.setAlgorithmType(data.get("type").toString());
|
|
|
algorithm.setAlgorithmResult(data.get("src_img").toString());
|
|
algorithm.setAlgorithmResult(data.get("src_img").toString());
|
|
|
algorithm.setSubId(Long.valueOf(data.get("aid").toString()));
|
|
algorithm.setSubId(Long.valueOf(data.get("aid").toString()));
|
|
@@ -306,6 +317,8 @@ public class CheckService {
|
|
|
algorithm.setAlgorithmName(data.get("algorithmName").toString());
|
|
algorithm.setAlgorithmName(data.get("algorithmName").toString());
|
|
|
algorithm.setIsAlarm(Integer.parseInt(data.get("isAlarm").toString()));
|
|
algorithm.setIsAlarm(Integer.parseInt(data.get("isAlarm").toString()));
|
|
|
algorithm.setOriginalImg(data.get("originalImg").toString());
|
|
algorithm.setOriginalImg(data.get("originalImg").toString());
|
|
|
|
|
+ algorithm.setRespData(data.get("requestData").toString());
|
|
|
|
|
+ algorithm.setUpdateTime(new Date());
|
|
|
algorithm.setStatus(0);
|
|
algorithm.setStatus(0);
|
|
|
return algorithm;
|
|
return algorithm;
|
|
|
}
|
|
}
|
|
@@ -568,7 +581,7 @@ public class CheckService {
|
|
|
* @param send
|
|
* @param send
|
|
|
* @param checkValid
|
|
* @param checkValid
|
|
|
*/
|
|
*/
|
|
|
- private R saveAlgorithmV5(MultipartFile file,ImgPostResponse<AnalysisReturnData> send,AlgorithmYml.CheckValid checkValid){
|
|
|
|
|
|
|
+ private R saveAlgorithmV5(Long id,MultipartFile file,ImgPostResponse<AnalysisReturnData> send,AlgorithmYml.CheckValid checkValid){
|
|
|
String picture = send.getData().getRet_image();
|
|
String picture = send.getData().getRet_image();
|
|
|
String header = "data:image/jpeg;base64,"+picture;
|
|
String header = "data:image/jpeg;base64,"+picture;
|
|
|
MultipartFile multipartFile = Base64DecodedMultipartFile.base64ToMultipart(header);
|
|
MultipartFile multipartFile = Base64DecodedMultipartFile.base64ToMultipart(header);
|
|
@@ -595,7 +608,10 @@ public class CheckService {
|
|
|
map.put("originalImg", originalUrl);
|
|
map.put("originalImg", originalUrl);
|
|
|
map.put("type", "image");
|
|
map.put("type", "image");
|
|
|
map.put("algorithmName", checkValid.getAlgorithmName());
|
|
map.put("algorithmName", checkValid.getAlgorithmName());
|
|
|
|
|
+ map.put("id",id);
|
|
|
|
|
+ map.put("requestData", JSONObject.toJSONString(send));
|
|
|
logger.info("=======================map.tostring()"+map.toString());
|
|
logger.info("=======================map.tostring()"+map.toString());
|
|
|
- return laboratoryService.saveAlgorithmData(CovertV5(map));
|
|
|
|
|
|
|
+ //return laboratoryService.saveAlgorithmData(CovertV5(map));
|
|
|
|
|
+ return laboratoryService.update(CovertV5(map));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|