|
|
|
@ -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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|