|
|
@ -16,6 +16,7 @@ import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
import java.util.stream.IntStream; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @Author: huangxing |
|
|
|
* @Author: huangxing |
|
|
@ -35,6 +36,8 @@ public class JumpRouteJoinStrategy { |
|
|
|
switch(routeEnum) { |
|
|
|
switch(routeEnum) { |
|
|
|
case OPEN_SCADA: |
|
|
|
case OPEN_SCADA: |
|
|
|
return this.getScadaExtra(args,function); |
|
|
|
return this.getScadaExtra(args,function); |
|
|
|
|
|
|
|
case OPEN_VIDEO: |
|
|
|
|
|
|
|
return this.getVideoExtra(args,function); |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
@ -77,28 +80,41 @@ public class JumpRouteJoinStrategy { |
|
|
|
return extraVO; |
|
|
|
return extraVO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ExtraVO getVideoExtra(Map<String,String> args,FunctionEntity function) { |
|
|
|
|
|
|
|
// 跳转页面逻辑
|
|
|
|
|
|
|
|
ExtraVO extraVO = new ExtraVO(); |
|
|
|
|
|
|
|
Map<String, String> params = this.videoResolve(args); |
|
|
|
|
|
|
|
String path = this.replacePath(function.getPath(), params); |
|
|
|
|
|
|
|
extraVO.setRoute(path); |
|
|
|
|
|
|
|
return extraVO; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 打开实时画面 |
|
|
|
* 解析实时画面参数 |
|
|
|
* @param args 大模型解析参数 |
|
|
|
* @param args 大模型解析参数 |
|
|
|
* @return 实时画面路径拼接所需参数 |
|
|
|
* @return 实时画面路径拼接所需参数 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Map<String,String> scadaResolve(Map<String,String> args) { |
|
|
|
private Map<String,String> scadaResolve(Map<String,String> args) { |
|
|
|
Map<String,String> result = new HashMap<>(); |
|
|
|
String params = args.get("params"); |
|
|
|
Assert.isTrue(args.containsKey("params"), () -> { |
|
|
|
|
|
|
|
throw new ServiceException("大模型传参缺少params参数"); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
// 参数格式为:picResource^context^stationNum^projectId^taskId^name^id
|
|
|
|
// 参数格式为:picResource^context^stationNum^projectId^taskId^name^id
|
|
|
|
List<String> params = Func.toStrList("\\^", args.get("params")); |
|
|
|
String[] keys = new String[]{"picResource","context","stationNum","projectId","taskId","name","id"}; |
|
|
|
Assert.isTrue(params.size() == 7,() -> { |
|
|
|
return this.resolve(params,keys); |
|
|
|
throw new ServiceException("大模型传参params长度错误,传参为:" + args.get("params")); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String,String> videoResolve(Map<String,String> args) { |
|
|
|
|
|
|
|
String params = args.get("params"); |
|
|
|
|
|
|
|
// 参数格式为:id^name^stationCode^pointCode^host^appKey^appSecret
|
|
|
|
|
|
|
|
String[] keys = new String[]{"id","name","stationCode","pointCode","host","appKey","appSecret"}; |
|
|
|
|
|
|
|
return this.resolve(params,keys); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String,String> resolve(String paramsStr,String... keys) { |
|
|
|
|
|
|
|
Map<String,String> result = new HashMap<>(); |
|
|
|
|
|
|
|
List<String> params = Func.toStrList("\\^", paramsStr); |
|
|
|
|
|
|
|
Assert.isTrue(params.size() == keys.length, () -> { |
|
|
|
|
|
|
|
throw new ServiceException("大模型传参params长度错误,传参为:" + paramsStr); |
|
|
|
}); |
|
|
|
}); |
|
|
|
result.put("picResource",params.get(0)); |
|
|
|
IntStream.iterate(0,index -> index + 1).limit(params.size()).forEach(index -> result.put(keys[index],params.get(index))); |
|
|
|
result.put("context",params.get(1)); |
|
|
|
|
|
|
|
result.put("stationNum",params.get(2)); |
|
|
|
|
|
|
|
result.put("projectId",params.get(3)); |
|
|
|
|
|
|
|
result.put("taskId",params.get(4)); |
|
|
|
|
|
|
|
result.put("name",params.get(5)); |
|
|
|
|
|
|
|
result.put("id",params.get(6)); |
|
|
|
|
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|