Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
yang_shj 3 months ago
parent
commit
0515a1edab
  1. 3
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/feign/IImageAnalysisClient.java
  2. 25
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/service/WeaviateService.java
  3. 4
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FunctionConstants.java
  4. 4
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/ParamKeyConstants.java
  5. 26
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ControlAnswerResolveServiceImpl.java
  6. 6
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/feign/ImageAnalysisClient.java
  7. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/IZhiPuBigModelService.java
  8. 4
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/ZhiPuBigModelServiceImpl.java
  9. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.java

3
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/feign/IImageAnalysisClient.java

@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import java.util.Map;
/**
* @Author: ypj
@ -18,5 +19,5 @@ public interface IImageAnalysisClient {
String ANALYSIS_BY_STATION_ID = "/analysisByStationId";
@PostMapping(API_PREFIX + ANALYSIS_BY_STATION_ID)
List<ZhiPuImageAnalysisDTO> analysisByStationId(@RequestBody Long stationId);
List<ZhiPuImageAnalysisDTO> analysisByStationId(@RequestBody Map<String,String> request);
}

25
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/service/WeaviateService.java

@ -90,19 +90,24 @@ public class WeaviateService {
List<Map<String, Float[]>> vector = this.splitVector(entities.size(), attrsMap, vectors);
for(int i = 0; i < entities.size(); i++) {
// log.info("vector:{}",JSON.toJSONString(vector.get(i)));
JSONObject object = JSONObject.parseObject(JSON.toJSONString(entities.get(i)));
Map<String,Object> properties = new HashMap<>();
object.forEach((k,v) -> properties.put(k,v));
Map<String, Object> properties = this.objectToMap(entities.get(i));
log.info("properties:{}",JSON.toJSONString(properties));
creator.withProperties(properties).withVectors(vector.get(i)).run();
}
} else {
entities.forEach(entity -> creator.withProperties(BeanUtil.toMap(entity)).run());
entities.forEach(entity -> creator.withProperties(this.objectToMap(entity)).run());
return true;
}
return false;
}
private Map<String,Object> objectToMap(Object object) {
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(object));
Map<String,Object> properties = new HashMap<>();
jsonObject.forEach((k,v) -> properties.put(k,v));
return properties;
}
/**
* 删除向量数据库表名
* @param className 表名
@ -204,16 +209,8 @@ public class WeaviateService {
private String getFieldValue(String fields,Object object) {
Class clazz = object.getClass();
return Func.toStrList(",", fields).stream().map(field -> {
try {
Field declaredField = clazz.getDeclaredField(field);
declaredField.setAccessible(true);
return declaredField.get(object).toString();
} catch (NoSuchFieldException | IllegalAccessException e) {
return null;
}
}).collect(Collectors.joining(" "));
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(object));
return Func.toStrList(",", fields).stream().map(field -> jsonObject.getString(field)).collect(Collectors.joining(" "));
}
/**

4
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FunctionConstants.java

@ -24,7 +24,9 @@ public interface FunctionConstants {
CHOOSE("4"),
/**确认**/
CONFIRM("5"),
CHART("6");
CHART("6"),
IMAGE_TEXT("7")
;
;
@Getter
private String type;

4
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/ParamKeyConstants.java

@ -15,5 +15,9 @@ public interface ParamKeyConstants {
String CANVAS_V4_PATH = "hzims:bigModel:canvas:v4:path";
/**实时画面云组态路径 hzinfo-data-scada/view/{projectId}/{id}?source=app**/
String CANVAS_YZT_PATH = "hzims:bigModel:canvas:yzt:path";
/**视频巡检指令编号**/
String VIDEO_INSPECTION_CODE = "gglm:bigModel:video:inspection:code";
/**视频巡检识别url**/
String VIDEO_INSPECTION_URL = "gglm:bigModel:video:inspection:url";
}

26
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ControlAnswerResolveServiceImpl.java

@ -1,13 +1,20 @@
package com.hnac.hzims.bigmodel.interactive.service.impl;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.bigmodel.interactive.constants.FunctionConstants;
import com.hnac.hzims.bigmodel.interactive.factory.AnswerResolveFactory;
import com.hnac.hzims.bigmodel.interactive.service.IAnswerResolveService;
import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO;
import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.ParamCache;
import org.springframework.stereotype.Service;
import com.hnac.hzims.bigmodel.interactive.constants.ParamKeyConstants;
import java.util.HashMap;
/**
* @Author: huangxing
@ -26,7 +33,24 @@ public class ControlAnswerResolveServiceImpl implements IAnswerResolveService {
@Override
public ExtraVO getExtra(JSONObject originExtra) {
// 若extra中 itemId 为 spxj 则为视频巡检需特殊处理
JSONObject params = originExtra.getJSONObject("params");
if(Func.isNotEmpty(params) && Func.isNotEmpty(params.getString("itemId"))) {
String itemId = ParamCache.getValue(ParamKeyConstants.VIDEO_INSPECTION_CODE);
String url = ParamCache.getValue(ParamKeyConstants.VIDEO_INSPECTION_URL);
if(Func.isNotEmpty(itemId) && Func.isNotEmpty(url)
&& itemId.equals(params.getString("itemId")) && Func.isNotEmpty(params.getString("stationId"))) {
log.info("控制指令传参为:{}", JSON.toJSONString(originExtra));
return null;
String stationId = params.getString("stationId");
HashMap<String, String> param = new HashMap<>(1);
param.put("stationId",stationId);
String body = HttpRequest.post(url).body(JSON.toJSONString(param)).execute().body();
params.put("data",body);
log.info("识别结果为:{}", body);
}
}
ExtraVO result = originExtra.toJavaObject(ExtraVO.class);
result.setType(FunctionConstants.TypeEnum.IMAGE_TEXT.getType());
return result;
}
}

6
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/feign/ImageAnalysisClient.java

@ -4,10 +4,12 @@ import com.hnac.hzinfo.inspect.ai.service.IZhiPuBigModelService;
import com.hnac.hzinfo.inspect.ai.vo.ZhiPuImageAnalysisDTO;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* @Author: ypj
@ -21,7 +23,7 @@ public class ImageAnalysisClient implements IImageAnalysisClient {
@Override
@PostMapping(ANALYSIS_BY_STATION_ID)
public List<ZhiPuImageAnalysisDTO> analysisByStationId(Long stationId) {
return zhiPuBigModelService.analysisImgByStationId(stationId);
public List<ZhiPuImageAnalysisDTO> analysisByStationId(@RequestBody Map<String,String> request) {
return zhiPuBigModelService.analysisImgByStationId(request.get("stationId"));
}
}

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/IZhiPuBigModelService.java

@ -9,7 +9,7 @@ import java.util.List;
* @Date: 2024/8/29 13:58
*/
public interface IZhiPuBigModelService {
List<ZhiPuImageAnalysisDTO> analysisImgByStationId(Long stationId);
List<ZhiPuImageAnalysisDTO> analysisImgByStationId(String stationId);
List<String> getZhiPuAnalysisType(String[] originalCode);
}

4
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/ZhiPuBigModelServiceImpl.java

@ -45,9 +45,9 @@ public class ZhiPuBigModelServiceImpl implements IZhiPuBigModelService {
private static final String CAMERA_TYPE_SPLIT = "\\^";
@Override
public List<ZhiPuImageAnalysisDTO> analysisImgByStationId(Long stationId) {
public List<ZhiPuImageAnalysisDTO> analysisImgByStationId(String stationId) {
List<ZhiPuImageAnalysisDTO> result = new ArrayList<>();
List<StationVideoTypeEntity> videoList = stationVideoTypeClient.listByStationId(stationId.toString());
List<StationVideoTypeEntity> videoList = stationVideoTypeClient.listByStationId(stationId);
if (CollectionUtil.isEmpty(videoList)) {
return result;
}

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.java

@ -129,5 +129,5 @@ public interface TaskMapper extends UserDataScopeBaseMapper<TaskEntity> {
List<TaskEntity> getSameDayTask(@Param("taskIds") List<Long> taskIds, @Param("status") String status,@Param("startDate") String startDate,@Param("endDate") String endDate);
List<TaskEntity> getListByUserIdAndStatus(Long userId, String autoVideo, List<String> taskStatus,String time);
List<TaskEntity> getListByUserIdAndStatus(@Param("userId") Long userId, @Param("autoVideo") String autoVideo, @Param("taskStatus") List<String> taskStatus, @Param("time") String time);
}

Loading…
Cancel
Save