|
|
@ -1,16 +1,18 @@ |
|
|
|
package com.hnac.hzims.bigmodel.interactive.service.impl; |
|
|
|
package com.hnac.hzims.bigmodel.interactive.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum; |
|
|
|
import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum; |
|
|
|
import com.hnac.hzims.bigmodel.interactive.constants.ParamKeyConstants; |
|
|
|
import com.hnac.hzims.bigmodel.interactive.constants.ParamKeyConstants; |
|
|
|
|
|
|
|
import com.hnac.hzims.bigmodel.interactive.factory.ResolveFactory; |
|
|
|
import com.hnac.hzims.bigmodel.interactive.req.ModelFunctionReq; |
|
|
|
import com.hnac.hzims.bigmodel.interactive.req.ModelFunctionReq; |
|
|
|
import com.hnac.hzims.bigmodel.interactive.service.IResolveService; |
|
|
|
import com.hnac.hzims.bigmodel.interactive.service.IResolveService; |
|
|
|
import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO; |
|
|
|
import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.feign.IStationClient; |
|
|
|
import com.hnac.hzims.operational.station.feign.IStationClient; |
|
|
|
import groovy.util.logging.Slf4j; |
|
|
|
import com.hnac.hzinfo.exception.HzServiceException; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
// import org.springblade.core.log.logger.BladeLogger;
|
|
|
|
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.ResultCode; |
|
|
|
import org.springblade.core.tool.api.ResultCode; |
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
@ -18,7 +20,6 @@ import org.springblade.core.tool.utils.StringUtil; |
|
|
|
import org.springblade.system.cache.ParamCache; |
|
|
|
import org.springblade.system.cache.ParamCache; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import com.hnac.hzims.bigmodel.interactive.factory.ResolveFactory; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.IntStream; |
|
|
|
import java.util.stream.IntStream; |
|
|
@ -33,7 +34,6 @@ import java.util.stream.IntStream; |
|
|
|
public class CanvasResolveServiceImpl implements IResolveService { |
|
|
|
public class CanvasResolveServiceImpl implements IResolveService { |
|
|
|
|
|
|
|
|
|
|
|
private final IStationClient stationClient; |
|
|
|
private final IStationClient stationClient; |
|
|
|
// private final BladeLogger logger;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public ExtraVO resolve(ModelFunctionReq req) { |
|
|
|
public ExtraVO resolve(ModelFunctionReq req) { |
|
|
@ -41,8 +41,8 @@ public class CanvasResolveServiceImpl implements IResolveService { |
|
|
|
String id = args.get("itemId"); |
|
|
|
String id = args.get("itemId"); |
|
|
|
String name = args.get("itemName"); |
|
|
|
String name = args.get("itemName"); |
|
|
|
Assert.isTrue(StringUtil.isNotBlank(id) && StringUtil.isNotBlank(name),() -> { |
|
|
|
Assert.isTrue(StringUtil.isNotBlank(id) && StringUtil.isNotBlank(name),() -> { |
|
|
|
// logger.error("hzims:video:resolve","解析传参错误,缺少必要参数video_id,传参内容为:" + JSON.toJSONString(req));
|
|
|
|
log.error("解析传参错误,缺少必要参数video_id,传参内容为:{}", JSON.toJSONString(req)); |
|
|
|
throw new ServiceException(ResultCode.FAILURE,"解析传参错误,缺少必要参数video_id"); |
|
|
|
throw new HzServiceException(ResultCode.FAILURE,"解析传参错误,缺少必要参数video_id"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
return this.resolve(id); |
|
|
|
return this.resolve(id); |
|
|
|
} |
|
|
|
} |
|
|
@ -82,7 +82,7 @@ public class CanvasResolveServiceImpl implements IResolveService { |
|
|
|
extraVO.setRoute(this.replacePath("other/v4/canvas/index.html?hzinfowebkit=true&taskId={taskId}&stationNum={stationNum}&projectId={projectId}&source=app&picName={context}&itemName={itemName}", resolveMap)); |
|
|
|
extraVO.setRoute(this.replacePath("other/v4/canvas/index.html?hzinfowebkit=true&taskId={taskId}&stationNum={stationNum}&projectId={projectId}&source=app&picName={context}&itemName={itemName}", resolveMap)); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
throw new ServiceException(ResultCode.FAILURE,"解析出来的画面类型在云组态、v3、v4类型之外,无法解析路由"); |
|
|
|
throw new HzServiceException(ResultCode.FAILURE,"解析出来的画面类型在云组态、v3、v4类型之外,无法解析路由"); |
|
|
|
} |
|
|
|
} |
|
|
|
return extraVO; |
|
|
|
return extraVO; |
|
|
|
} |
|
|
|
} |
|
|
@ -91,7 +91,7 @@ public class CanvasResolveServiceImpl implements IResolveService { |
|
|
|
Map<String,String> result = new HashMap<>(); |
|
|
|
Map<String,String> result = new HashMap<>(); |
|
|
|
List<String> params = Func.toStrList("\\^", paramsStr); |
|
|
|
List<String> params = Func.toStrList("\\^", paramsStr); |
|
|
|
Assert.isTrue(params.size() == keys.length, () -> { |
|
|
|
Assert.isTrue(params.size() == keys.length, () -> { |
|
|
|
throw new ServiceException(ResultCode.FAILURE,"大模型传参params长度错误,传参为:" + paramsStr); |
|
|
|
throw new HzServiceException(ResultCode.FAILURE, "大模型传参params长度错误,传参为:" + paramsStr); |
|
|
|
}); |
|
|
|
}); |
|
|
|
IntStream.iterate(0, index -> index + 1).limit(params.size()).forEach(index -> result.put(keys[index],params.get(index))); |
|
|
|
IntStream.iterate(0, index -> index + 1).limit(params.size()).forEach(index -> result.put(keys[index],params.get(index))); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|