Browse Source

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

zhongwei
haungxing 2 months ago
parent
commit
8608ec2116
  1. 52
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/VectorDataController.java
  2. 20
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/VectorDataService.java
  3. 43
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java
  4. 8
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/ZhiPuBigModelServiceImpl.java

52
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/VectorDataController.java

@ -0,0 +1,52 @@
package com.hnac.gglm.bigmodel.business.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.gglm.bigmodel.business.service.VectorDataService;
import com.hnac.hzinfo.api.annotation.ApiInterface;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author: ypj
* @Date: 2024/9/18 10:17
*/
@RestController
@RequestMapping("/data")
@Api(value = "向量数据", tags = "向量数据")
@AllArgsConstructor
@Slf4j
public class VectorDataController {
private final VectorDataService vectorDataService;
@GetMapping("/getModelAttributeData")
@ApiOperation(value = "获取模型属性数据")
@ApiOperationSupport(order = 11)
@ApiInterface
public R getModelAttributeData() {
return R.data(vectorDataService.getModelAttributeData());
}
@GetMapping("/getModelEventData")
@ApiOperation(value = "获取模型事件数据")
@ApiOperationSupport(order = 12)
@ApiInterface
public R getModelEventData() {
return R.data(vectorDataService.getModelEventData());
}
@GetMapping("/getModelFunctionData")
@ApiOperation(value = "获取模型功能数据")
@ApiOperationSupport(order = 13)
@ApiInterface
public R getModelFunctionData() {
return R.data(vectorDataService.getModelFunctionData());
}
}

20
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/VectorDataService.java

@ -0,0 +1,20 @@
package com.hnac.gglm.bigmodel.business.service;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelAttrVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelEventVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelFuncVO;
import java.util.List;
/**
* @Author: ypj
* @Date: 2024/9/16 18:16
*/
public interface VectorDataService {
List<ModelAttrVO> getModelAttributeData();
List<ModelFuncVO> getModelFunctionData();
List<ModelEventVO> getModelEventData();
}

43
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java

@ -0,0 +1,43 @@
package com.hnac.gglm.bigmodel.business.service.impl;
import com.hnac.gglm.bigmodel.business.service.VectorDataService;
import com.hnac.hzinfo.sdk.v5.model.ModelClient;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelAttrVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelEventVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelFuncVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author: ypj
* @Date: 2024/9/16 18:17
*/
@Service
@Slf4j
@AllArgsConstructor
public class VectorDataServiceImpl implements VectorDataService {
private final ModelClient modelClient;
@Override
public List<ModelAttrVO> getModelAttributeData() {
R<List<ModelAttrVO>> response = modelClient.listAttribute();
return response.getData();
}
@Override
public List<ModelFuncVO> getModelFunctionData() {
R<List<ModelFuncVO>> response = modelClient.listFunction();
return response.getData();
}
@Override
public List<ModelEventVO> getModelEventData() {
R<List<ModelEventVO>> response = modelClient.listEvent();
return response.getData();
}
}

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

@ -14,6 +14,7 @@ import com.hnac.hzinfo.inspect.utils.HiKUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Dict;
@ -23,6 +24,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@ -53,14 +55,17 @@ public class ZhiPuBigModelServiceImpl implements IZhiPuBigModelService {
}
List<String> codeList = videoList.stream().map(StationVideoTypeEntity::getPointCode).collect(Collectors.toList());
List<CameraInfoEntity> cameraList = cameraInfoService.list(Wrappers.<CameraInfoEntity>lambdaQuery().in(CameraInfoEntity::getPointCode, codeList));
log.info("cameraList size:{}", Optional.ofNullable(cameraList).map(List::size).orElse(0));
for (CameraInfoEntity cameraInfo : cameraList) {
String[] monitorItems = cameraInfo.getMonitorItems().split(CAMERA_TYPE_SPLIT);
List<String> analysisTypeList = getZhiPuAnalysisType(monitorItems);
if (CollectionUtil.isEmpty(analysisTypeList)) {
log.info("cameraInfo:{} no analysis type", Optional.ofNullable(cameraInfo).map(data -> JsonUtil.toJson(data)).orElse("null"));
continue;
}
String url = HiKUtil.manualCapture(cameraInfo.getPointCode());
if (StringUtil.isBlank(url)) {
log.info("cameraInfo:{} no url", Optional.ofNullable(cameraInfo).map(data -> JsonUtil.toJson(data)).orElse("null"));
continue;
}
BigModelAnalysisRequestDTO zhiPuRequest = new BigModelAnalysisRequestDTO();
@ -68,6 +73,7 @@ public class ZhiPuBigModelServiceImpl implements IZhiPuBigModelService {
zhiPuRequest.setCheckTypeSonList(analysisTypeList);
BigModelAnalysisResponseDTO zhiPuResponse = bigModelClient.analysis(zhiPuRequest);
if (zhiPuResponse.getSuccess()) {
log.info("zhi pu response success:{}", Optional.ofNullable(zhiPuResponse.getData()).map(data -> JsonUtil.toJson(data)).orElse("null"));
ZhiPuImageAnalysisDTO dto = new ZhiPuImageAnalysisDTO();
List<BigModelAnalysisResponseDTO.BigModelAnalysisResult> data = zhiPuResponse.getData();
if (CollectionUtil.isEmpty(data)) {
@ -80,6 +86,8 @@ public class ZhiPuBigModelServiceImpl implements IZhiPuBigModelService {
}
dto.setConclusion(builder.toString());
result.add(dto);
} else {
log.info("zhi pu response fail");
}
}
return result;

Loading…
Cancel
Save