diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/VectorDataController.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/controller/VectorDataController.java new file mode 100644 index 0000000..cbc3b03 --- /dev/null +++ b/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()); + } +} diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/VectorDataService.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/VectorDataService.java new file mode 100644 index 0000000..24e1ebc --- /dev/null +++ b/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 getModelAttributeData(); + + List getModelFunctionData(); + + List getModelEventData(); +} diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java new file mode 100644 index 0000000..916570f --- /dev/null +++ b/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 getModelAttributeData() { + R> response = modelClient.listAttribute(); + return response.getData(); + } + + @Override + public List getModelFunctionData() { + R> response = modelClient.listFunction(); + return response.getData(); + } + + @Override + public List getModelEventData() { + R> response = modelClient.listEvent(); + return response.getData(); + } +} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/ZhiPuBigModelServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/ZhiPuBigModelServiceImpl.java index 23188ba..906df22 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/ZhiPuBigModelServiceImpl.java +++ b/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 codeList = videoList.stream().map(StationVideoTypeEntity::getPointCode).collect(Collectors.toList()); List cameraList = cameraInfoService.list(Wrappers.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 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 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;