|
|
|
@ -8,9 +8,11 @@ import com.hnac.gglm.bigmodel.interactive.factory.AnswerResolveFactory;
|
|
|
|
|
import com.hnac.gglm.bigmodel.interactive.service.IAnswerResolveService; |
|
|
|
|
import com.hnac.gglm.bigmodel.interactive.vo.AnswerVO; |
|
|
|
|
import com.hnac.gglm.bigmodel.interactive.vo.ExtraVO; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.system.cache.ParamCache; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import com.hnac.gglm.bigmodel.interactive.constants.ParamKeyConstants; |
|
|
|
|
|
|
|
|
@ -23,8 +25,14 @@ import java.util.Map;
|
|
|
|
|
*/ |
|
|
|
|
@Service(AnswerResolveFactory.CONTROL_DEVICE_SERVICE) |
|
|
|
|
@Slf4j |
|
|
|
|
@RequiredArgsConstructor |
|
|
|
|
public class ControlAnswerResolveServiceImpl implements IAnswerResolveService { |
|
|
|
|
|
|
|
|
|
@Value("${gglm.remote.initiateRobotPlan}") |
|
|
|
|
private String initiateRobotPlanUrl; |
|
|
|
|
@Value("${gglm.remote.initiateVideoTask}") |
|
|
|
|
private String initiateVideoTaskUrl; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public AnswerVO resolve(AnswerVO answer) { |
|
|
|
|
Object[] extraArray = this.extraStream(answer).map(this::getExtra).toArray(); |
|
|
|
@ -38,14 +46,14 @@ public class ControlAnswerResolveServiceImpl implements IAnswerResolveService {
|
|
|
|
|
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) |
|
|
|
|
//String url = ParamCache.getValue(ParamKeyConstants.VIDEO_INSPECTION_URL);
|
|
|
|
|
if(Func.isNotEmpty(itemId) && Func.isNotEmpty(initiateVideoTaskUrl) |
|
|
|
|
&& itemId.equals(params.getString("itemId")) && Func.isNotEmpty(params.getString("stationId"))) { |
|
|
|
|
log.info("控制指令传参为:{}", JSON.toJSONString(originExtra)); |
|
|
|
|
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(); |
|
|
|
|
String body = HttpRequest.post(initiateVideoTaskUrl).body(JSON.toJSONString(param)).execute().body(); |
|
|
|
|
params.put("data",body); |
|
|
|
|
log.info("识别结果为:{}", body); |
|
|
|
|
ExtraVO result = originExtra.toJavaObject(ExtraVO.class); |
|
|
|
@ -55,7 +63,7 @@ public class ControlAnswerResolveServiceImpl implements IAnswerResolveService {
|
|
|
|
|
HashMap<String, String> param = new HashMap<>(1); |
|
|
|
|
param.put("itemName", params.getString("itemName")); |
|
|
|
|
log.info("机器人巡检传参为:{}", JSON.toJSONString(param)); |
|
|
|
|
String body = HttpRequest.post("http://192.168.60.29:8080/api/hzinfo-inspect/plan/initiateRobotPlan").body(JSON.toJSONString(param)).execute().body(); |
|
|
|
|
String body = HttpRequest.post(initiateRobotPlanUrl).body(JSON.toJSONString(param)).execute().body(); |
|
|
|
|
log.info("结果为:{}",body); |
|
|
|
|
ExtraVO result = originExtra.toJavaObject(ExtraVO.class); |
|
|
|
|
result.setType(FunctionConstants.TypeEnum.PARAMS.getType()); |
|
|
|
|