Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
RnhaiWang 7 months ago
parent
commit
79f2ae69b5
  1. 7
      hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FunctionConstants.java
  2. 20
      hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/SelectionVO.java
  3. 12
      hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/StationSelectionVO.java
  4. 19
      hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ExtraVO.java
  5. 10
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClient.java
  6. 11
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClientFallback.java
  7. 10
      hzims-service/hzims-big-model/pom.xml
  8. 13
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/HzimsBigModelApplication.java
  9. 8
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java
  10. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java
  11. 8
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java
  12. 8
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java
  13. 14
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IParamsService.java
  14. 94
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java
  15. 155
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java
  16. 19
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java
  17. 69
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java
  18. 35
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamsServiceImpl.java
  19. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java
  20. 20
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/UpdateStationVO.java
  21. 25
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/UpdateUsualVO.java
  22. 147
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java
  23. 8
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/XxlJobHandlerConstant.java
  24. 45
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java
  25. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java
  26. 24
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/feign/StationVideoTypeClient.java
  27. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java
  28. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java
  29. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java
  30. 9
      pom.xml

7
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FunctionConstants.java

@ -15,7 +15,12 @@ public interface FunctionConstants {
@AllArgsConstructor
enum TypeEnum {
/**跳转页面**/
JUMP("1")
JUMP("1"),
/**链接**/
LINK("2"),
/**参数**/
PARAMS("3"),
CHOOSE("4")
;
@Getter
private String type;

20
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/SelectionVO.java

@ -0,0 +1,20 @@
package com.hnac.hzims.bigmodel.interactive.constants;
import lombok.Data;
import java.io.Serializable;
/**
* @Author: huangxing
* @Date: 2024/05/09 16:30
*/
@Data
public class SelectionVO implements Serializable {
/**选项ID**/
private String id;
/**选项名称**/
private String name;
}

12
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/StationSelectionVO.java

@ -0,0 +1,12 @@
package com.hnac.hzims.bigmodel.interactive.constants;
import lombok.Data;
/**
* @Author: huangxing
* @Date: 2024/05/09 16:32
*/
@Data
public class StationSelectionVO extends SelectionVO {
}

19
hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ExtraVO.java

@ -1,10 +1,14 @@
package com.hnac.hzims.bigmodel.interactive.vo;
import com.hnac.hzims.bigmodel.interactive.constants.SelectionVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.sf.jsqlparser.statement.select.Select;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* @Author: huangxing
@ -14,7 +18,7 @@ import java.io.Serializable;
@ApiModel("响应内容")
public class ExtraVO implements Serializable {
@ApiModelProperty("交互类型")
@ApiModelProperty("交互类型 1:打开页面,2:打开链接,3:参数传递,4:完善选项")
private String type;
@ApiModelProperty("若为弹窗,则返回路由")
@ -23,7 +27,18 @@ public class ExtraVO implements Serializable {
@ApiModelProperty("链接显示文字")
private String label;
@ApiModelProperty("函数编号")
private String funcCode;
@ApiModelProperty("是否立即跳转")
private boolean isImmediatelyJump = true;
private boolean isImmediatelyJump = false;
@ApiModelProperty("附带参数")
private Map<String,Object> params;
@ApiModelProperty("是否为特殊函数")
private boolean isSpecial;
@ApiModelProperty("选项")
private List<? extends SelectionVO> selection;
}

10
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClient.java

@ -4,6 +4,7 @@ import com.hnac.hzims.operational.OperationalConstants;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -16,7 +17,16 @@ import java.util.List;
public interface IStationVideoTypeClient {
String API_PREFIX = "/feign/station/videoType";
String LIST_BY_STATION_ID = API_PREFIX + "/listByStationId";
String LIST = API_PREFIX + "/list";
String GET_BY_ID = API_PREFIX + "/getById";
String GET_RTSP_ADDRESS_BY_ID = API_PREFIX + "/getRtspAddressById";
@PostMapping(LIST_BY_STATION_ID)
List<StationVideoTypeEntity> listByStationId(@RequestParam("stationId") String stationId);
@GetMapping(LIST)
R<List<StationVideoTypeEntity>> list(StationVideoTypeEntity req);
@GetMapping(GET_BY_ID)
R<StationVideoTypeEntity> getById(@RequestParam Long id);
}

11
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/feign/IStationVideoTypeClientFallback.java

@ -16,4 +16,15 @@ public class IStationVideoTypeClientFallback implements IStationVideoTypeClient
log.info("调用{}接口失败",LIST_BY_STATION_ID);
return new ArrayList();
}
@Override
public R<List<StationVideoTypeEntity>> list(StationVideoTypeEntity req) {
return R.fail("远程调用失败!");
}
@Override
public R<StationVideoTypeEntity> getById(Long id) {
return R.fail("远程调用失败!");
}
}

10
hzims-service/hzims-big-model/pom.xml

@ -65,6 +65,16 @@
<groupId>org.springblade</groupId>
<artifactId>blade-system-api</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>hzims-operational-api</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId>
</dependency>
</dependencies>
<build>

13
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/HzimsBigModelApplication.java

@ -1,28 +1,35 @@
package com.hnac.hzims.bigmodel;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springblade.core.cloud.feign.EnableBladeFeign;
import org.springblade.core.jwt.JwtUtil;
import org.springblade.core.launch.BladeApplication;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.data.redis.core.RedisTemplate;
import javax.annotation.Resource;
import static com.hnac.hzims.bigmodel.schedule.XxlJobHandlerConstant.HZIMS_BIGMODEL_ASK_KEY;
@EnableBladeFeign(basePackages = {"org.springblade","com.hnac"})
@SpringCloudApplication
@MapperScan("com.hnac.hzims.**.mapper.**")
@ComponentScan(basePackages = {"com.hnac.hzims.bigmodel.*"})
@Resource
@ComponentScan(basePackages = {"com.hnac.hzims.*"})
@Slf4j
public class HzimsBigModelApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
BladeApplication.run(BigModelConstants.APP_NAME, HzimsBigModelApplication.class, args);
RedisTemplate<String, Object> redisTemplate = JwtUtil.getRedisTemplate();
redisTemplate.delete(HZIMS_BIGMODEL_ASK_KEY);
log.info("服务重启删除问题reids缓存:{}",HZIMS_BIGMODEL_ASK_KEY);
}
@Override

8
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java

@ -15,6 +15,14 @@ public class BigModelInvokeUrl {
private String assistantAsk;
private String assistantSpecialAsk;
private String assistantStatus;
private String askAbort;
private String updateVideo;
private String updateCanvas;
}

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java

@ -14,6 +14,8 @@ import java.util.Optional;
public enum FuncRouteEnum {
OPEN_SCADA("open_scada","打开实时画面"),
OPEN_VIDEO("open_video","打开视频监控"),
DIAGNOSE("diagnose","智能诊断"),
CHOOSE_STATION("choose_station","选择站点"),
;
@Getter
private String funcCode;

8
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java

@ -59,4 +59,12 @@ public class InteractiveController {
return R.data(IdWorker.get32UUID());
}
@ApiOperation("删除对话sessionId")
@ApiOperationSupport(order = 5)
@GetMapping("/removeSessionId")
public R<Boolean> removeSessionId(@RequestParam(value = "id") String sessionId) {
return R.data(interactiveService.removeSessionId(sessionId));
}
}

8
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java

@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
* @Author: huangxing
@ -19,8 +20,15 @@ public interface IInteractiveService {
R ask(String question,String sessionId,String userId);
R specialAsk(String sessionId,String userId,Map<String,Object> extra);
void updateVideo(Map<String,Object> request);
Boolean updateCanvas(Map<String,Object> request);
List<AnswerVO> getAnswerBySessionIds(String sessionIds);
Boolean authentication(String stationId, String userId, String funcCode);
Boolean removeSessionId(String sessionId);
}

14
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IParamsService.java

@ -0,0 +1,14 @@
package com.hnac.hzims.bigmodel.interactive.service;
import com.hnac.hzims.bigmodel.entity.FunctionEntity;
import java.util.Map;
/**
* @Author: huangxing
* @Date: 2024/05/09 08:50
*/
public interface IParamsService {
String dealJumpTypeFunction(FunctionEntity function, Map<String,String> args);
}

94
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java

@ -0,0 +1,94 @@
package com.hnac.hzims.bigmodel.interactive.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum;
import com.hnac.hzims.bigmodel.interactive.constants.FunctionConstants;
import com.hnac.hzims.bigmodel.interactive.constants.StationSelectionVO;
import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @Author: huangxing
* @Date: 2024/05/08 16:19
*/
@Service
@AllArgsConstructor
public class ExtraResolveStrategyService {
private final IStationClient stationClient;
/**
* 解析DFP返回extra
* @param extraStr DFP返回extra
* @return 与前端交互extra
*/
public ExtraVO resolve(String extraStr) {
JSONObject extra = JSONObject.parseObject(extraStr);
String functionCode = Optional.ofNullable(extra.get("func")).map(String::valueOf).orElse("");
if(StringUtil.isNotBlank(functionCode)) {
FuncRouteEnum funcRouteEnum = FuncRouteEnum.getEnumByFuncCode(functionCode);
switch (funcRouteEnum) {
case DIAGNOSE:
return this.resolveDiagnose(extra);
case CHOOSE_STATION:
return this.resolveChooseStation(extra);
default:
break;
}
}
return JSONObject.parseObject(JSON.toJSONString(extra),ExtraVO.class);
}
private ExtraVO resolveDiagnose(Map<String,Object> extra) {
ExtraVO result = new ExtraVO();
JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data")));
String faultId = data.getString("fault_id");
String faultName = data.getString("fault_name");
result.setLabel(faultName);
// TODO 拼接诊断链接
result.setType(FunctionConstants.TypeEnum.LINK.getType());
return result;
}
/**
*
* @param extra
* @return
*/
private ExtraVO resolveChooseStation(Map<String,Object> extra) {
ExtraVO result = new ExtraVO();
JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data")));
if(data.containsKey("stations")) {
List<String> stations = JSONArray.parseArray(JSON.toJSONString(data.get("stations")), String.class);
List<StationSelectionVO> selectionList = stations.stream().map(stationId -> {
StationSelectionVO selectionVO = new StationSelectionVO();
R<StationEntity> stationR = stationClient.getStationByCode(stationId);
if (stationR.isSuccess() && Func.isNotEmpty(stationR.getData())) {
selectionVO.setId(stationId);
selectionVO.setName(stationR.getData().getName());
}
return selectionVO;
}).collect(Collectors.toList());
result.setSelection(selectionList);
result.setFuncCode(FuncRouteEnum.CHOOSE_STATION.getFuncCode());
result.setSpecial(true);
result.setType(FunctionConstants.TypeEnum.CHOOSE.getType());
}
result.setType(FunctionConstants.TypeEnum.CHOOSE.getType());
return result;
}
}

155
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java

@ -7,21 +7,22 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.bigmodel.configuration.BigModelInvokeUrl;
import com.hnac.hzims.bigmodel.entity.FunctionEntity;
import com.hnac.hzims.bigmodel.function.service.IFunctionService;
import com.hnac.hzims.bigmodel.interactive.req.ModelFunctionReq;
import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService;
import com.hnac.hzims.bigmodel.interactive.service.IJumpPageService;
import com.hnac.hzims.bigmodel.function.service.IFunctionService;
import com.hnac.hzims.bigmodel.interactive.service.IParamsService;
import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.dto.DeptStationDTO;
import org.springblade.system.feign.IDeptClient;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Value;
@ -29,15 +30,13 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.*;
import java.util.stream.Collectors;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.hnac.hzims.bigmodel.interactive.constants.FunctionConstants.TypeEnum;
import static com.hnac.hzims.bigmodel.schedule.XxlJobHandlerConstant.HZIMS_BIGMODEL_ASK_KEY;
import static com.hnac.hzims.bigmodel.interactive.constants.FunctionConstants.*;
/**
* @Author: huangxing
* @Date: 2024/04/26 14:51
@ -47,12 +46,24 @@ import static com.hnac.hzims.bigmodel.interactive.constants.FunctionConstants.*;
@RequiredArgsConstructor
public class InteractiveServiceImpl implements IInteractiveService {
private final BladeLogger logger;
private final IJumpPageService jumpPageService;
private final IParamsService paramsService;
private final IFunctionService functionService;
private final BigModelInvokeUrl bigModelInvokeUrl;
private final BladeLogger logger;
private final IDeptClient deptClient;
private final IUserClient userClient;
private final RedisTemplate redisTemplate;
private final ExtraResolveStrategyService extraResolveStrategyService;
@Value("${fdp.host}")
private String fdpHost;
@ -64,11 +75,14 @@ public class InteractiveServiceImpl implements IInteractiveService {
switch (typeEnum) {
// 页面跳转
case JUMP:
String extra = jumpPageService.dealJumpTypeFunction(function, req.getFunctionArgs());
Assert.isTrue(StringUtil.isNotBlank(extra) && Func.isNotEmpty(extra), () -> {
String jumpExtra = jumpPageService.dealJumpTypeFunction(function, req.getFunctionArgs());
Assert.isTrue(StringUtil.isNotBlank(jumpExtra) && Func.isNotEmpty(jumpExtra), () -> {
throw new ServiceException("解析" + function.getName() + "函数失败!");
});
return R.data(extra);
return R.data(jumpExtra);
case PARAMS:
String paramExtra = paramsService.dealJumpTypeFunction(function, req.getFunctionArgs());
return R.data(paramExtra);
default:
throw new ServiceException("函数解析失败!");
}
@ -76,21 +90,77 @@ public class InteractiveServiceImpl implements IInteractiveService {
@Override
public R ask(String question,String sessionId,String userId) {
//TODO 保存问题
Map<String,String> params = new HashMap<>();
Map<String,Object> params = new HashMap<>();
params.put("id",sessionId);
params.put("userid",userId.toString());
params.put("userid", userId);
params.put("query",question);
params.put("stationids",this.getStationPermissionsById(userId).stream().map(DeptStationDTO::getStationId).filter(StringUtil::isNotBlank).filter(Func::isNotEmpty).toArray());
params.put("projectids",this.getStationPermissionsById(userId).stream().map(DeptStationDTO::getDeptId).filter(Func::isNotEmpty).map(String::valueOf).toArray());
HttpResponse response = HttpRequest.post(fdpHost + bigModelInvokeUrl.getAssistantAsk())
.body(JSON.toJSONString(params)).execute();
logger.info("interactive:ask","问答传参为:" + JSON.toJSONString(params) + "结果为:" + response.body());
if(response.getStatus() != HttpServletResponse.SC_OK) {
log.error("远程调用大模型【发起问答】接口失败!");
return R.fail("远程调用大模型【发起问答】接口失败!");
}
this.addQuestionSessionId(sessionId);
return R.success("消息发送成功");
}
private void addQuestionSessionId(String sessionId) {
// 添加redis问题会话
Object json = redisTemplate.opsForValue().get(HZIMS_BIGMODEL_ASK_KEY);
if(ObjectUtil.isEmpty(json)){
List<String> asks = Collections.singletonList(sessionId);
redisTemplate.opsForValue().set(HZIMS_BIGMODEL_ASK_KEY,JSONObject.toJSONString(asks));
}else{
List<String> asks = JSONObject.parseArray(json.toString(),String.class);
if(!asks.contains(sessionId)){
asks.add(sessionId);
}
redisTemplate.opsForValue().set(HZIMS_BIGMODEL_ASK_KEY,JSONObject.toJSONString(asks));
}
}
@Override
public R specialAsk(String sessionId, String userId, Map<String, Object> extra) {
Map<String,Object> params = new HashMap<>();
params.put("id",sessionId);
params.put("userid", userId);
params.put("extra",extra);
params.put("stationids",this.getStationPermissionsById(userId).stream().map(DeptStationDTO::getStationId).filter(StringUtil::isNotBlank).filter(Func::isNotEmpty).toArray());
params.put("projectids",this.getStationPermissionsById(userId).stream().map(DeptStationDTO::getDeptId).filter(Func::isNotEmpty).map(String::valueOf).toArray());
HttpResponse response = HttpRequest.post(fdpHost + bigModelInvokeUrl.getAssistantSpecialAsk())
.body(JSON.toJSONString(params)).execute();
if(response.getStatus() != HttpServletResponse.SC_OK) {
log.error("远程调用大模型【发起特殊问答】接口失败!");
return R.fail("远程调用大模型【发起特殊问答】接口失败!");
}
this.addQuestionSessionId(sessionId);
return R.success("消息发送成功");
}
@Override
public void updateVideo(Map<String, Object> request) {
HttpResponse response = HttpRequest.post(fdpHost + bigModelInvokeUrl.getUpdateVideo())
.body(JSON.toJSONString(request)).execute();
Assert.isTrue(response.getStatus() == HttpServletResponse.SC_OK, () -> {
throw new ServiceException("远程调用大模型【更新实时监控】接口失败!");
});
}
@Override
public Boolean updateCanvas(Map<String, Object> request) {
HttpResponse response = HttpRequest.post(fdpHost + bigModelInvokeUrl.getUpdateCanvas())
.body(JSON.toJSONString(request)).execute();
if (response.getStatus() == HttpServletResponse.SC_OK) {
return true;
}
log.error("远程调用大模型【更新实时画面】接口失败!");
return false;
}
@Override
public List<AnswerVO> getAnswerBySessionIds(String sessionIds) {
Map<String,Object> params = new HashMap<>();
params.put("ids",Func.toStrList(",",sessionIds).toArray());
@ -100,18 +170,25 @@ public class InteractiveServiceImpl implements IInteractiveService {
Assert.isTrue(response.getStatus() == HttpServletResponse.SC_OK, () -> {
throw new ServiceException("远程调用大模型【获取问题答案】接口失败!");
});
return JSONArray.parseArray(response.body(),AnswerVO.class);
List<AnswerVO> result = JSONArray.parseArray(response.body(), AnswerVO.class);
result.stream().filter(answerVO -> answerVO.getRunning() == 0).forEach(answerVO -> {
Object[] extras = answerVO.getExtra();
if(ObjectUtil.isEmpty(answerVO.getExtra()) || extras.length == 0){
return;
}
List<String> extraList = Arrays.stream(extras).map(Object::toString).map(extraResolveStrategyService::resolve).map(JSON::toJSONString).collect(Collectors.toList());
answerVO.setExtra(extraList.toArray(new String[extraList.size()]));
});
return result;
}
@Override
public Boolean authentication(String stationId, String userId, String funcCode) {
// 站点鉴权
if(StringUtil.isNotBlank(stationId)) {
R<List<String>> stationsR = deptClient.getStationPermissionsById(Long.valueOf(userId));
Assert.isTrue(stationsR.isSuccess() && CollectionUtil.isNotEmpty(stationsR.getData()),() -> {
throw new ServiceException("获取人员站点权限失败!");
});
List<String> stations = stationsR.getData();
List<String> stations = this.getStationPermissionsById(userId).stream().map(DeptStationDTO::getStationId)
.filter(StringUtil::isNotBlank).filter(Func::isNotEmpty).collect(Collectors.toList());
Assert.isTrue(stations.contains(stationId),() -> {
throw new ServiceException("人员站点鉴权失败!");
});
@ -130,4 +207,38 @@ public class InteractiveServiceImpl implements IInteractiveService {
return true;
}
@Override
public Boolean removeSessionId(String sessionId) {
// 调用大模型删除对话
Map<String,Object> params = new HashMap<>();
params.put("id",sessionId);
HttpResponse response = HttpRequest.post(fdpHost + bigModelInvokeUrl.getAskAbort())
.body(JSON.toJSONString(params)).execute();
if(response.getStatus() != HttpServletResponse.SC_OK) {
log.error("远程调用大模型【删除对话】接口失败!");
throw new ServiceException("远程调用大模型【删除对话】接口失败!");
}
// 移除对应reids中问题标记
Object json = redisTemplate.opsForValue().get(HZIMS_BIGMODEL_ASK_KEY);
if(ObjectUtil.isEmpty(json)) {
return true;
}
List<String> sessionIds = JSONObject.parseArray(json.toString(),String.class);
if(CollectionUtil.isEmpty(sessionIds)){
return true;
}
if(sessionIds.contains(sessionId)){
sessionIds.remove(sessionId);
redisTemplate.opsForValue().set(HZIMS_BIGMODEL_ASK_KEY,JSONObject.toJSONString(sessionIds));
}
return true;
}
private List<DeptStationDTO> getStationPermissionsById(String userId) {
R<List<DeptStationDTO>> deptSattionR = deptClient.getStationPermissionsById(Long.valueOf(userId));
Assert.isTrue(deptSattionR.isSuccess() && CollectionUtil.isNotEmpty(deptSattionR.getData()),() -> {
throw new ServiceException("获取人员站点权限失败!");
});
return deptSattionR.getData();
}
}

19
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java

@ -36,8 +36,6 @@ public class JumpRouteJoinStrategy {
switch(routeEnum) {
case OPEN_SCADA:
return this.getScadaExtra(args,function);
case OPEN_VIDEO:
return this.getVideoExtra(args,function);
default:
break;
}
@ -48,6 +46,7 @@ public class JumpRouteJoinStrategy {
private ExtraVO getScadaExtra(Map<String,String> args,FunctionEntity function) {
// 跳转页面逻辑
ExtraVO extraVO = new ExtraVO();
extraVO.setImmediatelyJump(true);
Map<String, String> params = this.scadaResolve(args);
// 根据hz3000画面版本获取path
Integer picResource = Integer.valueOf(params.get("picResource"));
@ -80,15 +79,6 @@ public class JumpRouteJoinStrategy {
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 大模型解析参数
@ -101,13 +91,6 @@ public class JumpRouteJoinStrategy {
return this.resolve(params,keys);
}
private Map<String,String> videoResolve(Map<String,String> args) {
String params = args.get("canvas_id");
// 参数格式为: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);

69
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java

@ -0,0 +1,69 @@
package com.hnac.hzims.bigmodel.interactive.service.impl;
import com.hnac.hzims.bigmodel.entity.FunctionEntity;
import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum;
import com.hnac.hzims.bigmodel.interactive.constants.FunctionConstants;
import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* @Author: huangxing
* @Date: 2024/05/09 08:56
*/
@Component
@Slf4j
@AllArgsConstructor
public class ParamStrategy {
private final IStationVideoTypeClient videoClient;
/**
* 解析发送参数方式函数
* @param function 函数
* @param args 大模型识别参数
* @return 前端传参EXTRA
*/
public ExtraVO resolve(FunctionEntity function, Map<String,String> args) {
FuncRouteEnum routeEnum = FuncRouteEnum.getEnumByFuncCode(function.getCode());
if(Func.isNotEmpty(routeEnum)) {
switch(routeEnum) {
case OPEN_VIDEO:
return this.getVideoExtra(args);
default:
break;
}
}
return null;
}
private ExtraVO getVideoExtra(Map<String,String> args) {
// 跳转页面逻辑
ExtraVO extraVO = new ExtraVO();
String id = args.get("canvas_id");
if(StringUtil.isNotBlank(id) && Func.isNotEmpty(id)) {
R<StationVideoTypeEntity> videoR = videoClient.getById(Long.valueOf(id));
if(videoR.isSuccess()) {
StationVideoTypeEntity video = videoR.getData();
extraVO.setType(FunctionConstants.TypeEnum.PARAMS.getType());
Map<String,Object> params = new HashMap<>();
params.put("videoHost", video.getVideoHost());
params.put("pointCode", video.getPointCode());
params.put("appKey", video.getAppKey());
params.put("appSecret", video.getAppSecret());
params.put("liveSourceAddress",video.getLiveSourceAddress());
extraVO.setParams(params);
}
}
return extraVO;
}
}

35
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamsServiceImpl.java

@ -0,0 +1,35 @@
package com.hnac.hzims.bigmodel.interactive.service.impl;
import com.alibaba.fastjson.JSON;
import com.hnac.hzims.bigmodel.entity.FuncParamEntity;
import com.hnac.hzims.bigmodel.entity.FunctionEntity;
import com.hnac.hzims.bigmodel.interactive.service.IParamsService;
import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
* @Author: huangxing
* @Date: 2024/05/09 08:51
*/
@Service
@Slf4j
@AllArgsConstructor
public class ParamsServiceImpl implements IParamsService {
private final ParamStrategy strategy;
@Override
public String dealJumpTypeFunction(FunctionEntity function, Map<String, String> args) {
// 跳转页面逻辑
ExtraVO extraVO = strategy.resolve(function,args);
return JSON.toJSONString(extraVO);
}
}

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java

@ -45,6 +45,6 @@ public class AnswerVO implements Serializable {
private String answer;
@ApiModelProperty("其它调用的参数")
private String[] extra;
private Object[] extra;
}

20
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/UpdateStationVO.java

@ -0,0 +1,20 @@
package com.hnac.hzims.bigmodel.interactive.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @Author: huangxing
* @Date: 2024/05/09 09:50
*/
@Data
public class UpdateStationVO implements Serializable {
/**站点ID**/
private String id;
/**站点名称**/
private String name;
}

25
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/UpdateUsualVO.java

@ -0,0 +1,25 @@
package com.hnac.hzims.bigmodel.interactive.vo;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.io.Serializable;
/**
* @Author: huangxing
* @Date: 2024/05/09 09:53
*/
@Data
public class UpdateUsualVO implements Serializable {
/**站点ID**/
@JSONField(name = "station_id")
private String stationId;
/**业务ID**/
private String id;
/**业务名称**/
private String name;
}

147
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java

@ -1,28 +1,40 @@
package com.hnac.hzims.bigmodel.schedule;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService;
import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO;
import com.hnac.hzims.bigmodel.websocket.server.InteractiveWsServer;
import com.hnac.hzims.bigmodel.interactive.vo.UpdateStationVO;
import com.hnac.hzims.bigmodel.interactive.vo.UpdateUsualVO;
import com.hnac.hzims.bigmodel.websocket.service.InteractiveWsService;
import com.hnac.hzims.bigmodel.websocket.sessionManager.InteractiveSessionManager;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.project.ProjectClient;
import com.hnac.hzinfo.sdk.v5.project.vo.ProjectVO;
import com.hnac.hzinfo.sdk.v5.scada.ScadaClient;
import com.hnac.hzinfo.sdk.v5.scada.vo.CanvasVO;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.AllArgsConstructor;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.ParamCache;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
@ -37,11 +49,22 @@ import static com.hnac.hzims.bigmodel.schedule.XxlJobHandlerConstant.*;
@AllArgsConstructor
public class InteractiveSchedule {
private final RedisTemplate redisTemplate;
private final InteractiveWsService wsService;
private final IInteractiveService interactiveService;
private final ThreadPoolExecutor getAnswerPoolExecutor;
private final RedisTemplate redisTemplate;
private final IStationVideoTypeClient videoClient;
private final ProjectClient projectClient;
private final ScadaClient scadaClient;
private final IStationClient stationClient;
// @XxlJob(GET_INTERACTIVE_RESULT)
// public ReturnT execute(String params) {
// String resultKey = ParamCache.getValue(GET_INTERACTIVE_RESULT);
@ -66,19 +89,107 @@ public class InteractiveSchedule {
// }
@XxlJob(GET_INTERACTIVE_RESULT)
public ReturnT execute(String params) {
List<String> sessionIds = InteractiveSessionManager.getSessionIds();
XxlJobLogger.log("开始获取到sessionId:"+sessionIds.stream().collect(Collectors.joining(",")));
List<AnswerVO> AnswerList = interactiveService.getAnswerBySessionIds(sessionIds.stream().collect(Collectors.joining(",")));
XxlJobLogger.log("获取到答案:"+JSON.toJSONString(AnswerList));
AnswerList.parallelStream().forEach(answerVO -> {
CompletableFuture.runAsync(() -> {
public ReturnT getInteractiveResult(String params) {
Object json = redisTemplate.opsForValue().get(HZIMS_BIGMODEL_ASK_KEY);
if(ObjectUtil.isEmpty(json)){
XxlJobLogger.log("未获取到问题标识,或者用户未进行提问!");
return ReturnT.SUCCESS;
}
List<String> sessionIds = JSONObject.parseArray(json.toString(),String.class);
if(CollectionUtil.isEmpty(sessionIds)){
XxlJobLogger.log("问题都已经回答完毕!");
return ReturnT.SUCCESS;
}
List<AnswerVO> answerList = interactiveService.getAnswerBySessionIds(String.join(",", sessionIds));
answerList.parallelStream().forEach(answerVO -> CompletableFuture.runAsync(() -> {
XxlJobLogger.log("开始获取" + answerVO.getSessionId() + "答案!");
if(sessionIds.contains(answerVO.getSessionId())){
WebSocketSession session = InteractiveSessionManager.get(answerVO.getSessionId());
TextMessage message = InteractiveSessionManager.getTextMessage("1",JSON.toJSONString(answerVO));
wsService.sendMessage(session,message);
}, getAnswerPoolExecutor);
});
}
// 问题回答完成,去除redis问题标记
if(answerVO.getRunning() == 0){
sessionIds.remove(answerVO.getSessionId());
}
redisTemplate.opsForValue().set(HZIMS_BIGMODEL_ASK_KEY, JSONObject.toJSONString(sessionIds));
}, getAnswerPoolExecutor));
return ReturnT.SUCCESS;
}
@XxlJob(SYNCHRONOUS_VIDEO_INSTRUCT)
public ReturnT synchronousVideoInstruct(String params) {
Map<String,Object> request = new HashMap<>(2);
// 获取站点列表
R<List<StationEntity>> stationsR = stationClient.list(new StationEntity());
if(!stationsR.isSuccess() || CollectionUtil.isEmpty(stationsR.getData())) {
XxlJobLogger.log("获取站点列表失败!");
return ReturnT.FAIL;
}
List<UpdateStationVO> updateStationList = stationsR.getData().stream().map(station -> {
UpdateStationVO stationVO = new UpdateStationVO();
stationVO.setId(station.getCode());
stationVO.setName(station.getName());
return stationVO;
}).collect(Collectors.toList());
request.put("stations", updateStationList);
// 获取视频列表
R<List<StationVideoTypeEntity>> videoListR = videoClient.list(new StationVideoTypeEntity());
if(!videoListR.isSuccess() || CollectionUtil.isEmpty(videoListR.getData())) {
XxlJobLogger.log("获取视频列表失败!");
return ReturnT.FAIL;
}
List<UpdateUsualVO> updateUsualList = videoListR.getData().stream().map(video -> {
UpdateUsualVO usualVO = new UpdateUsualVO();
usualVO.setStationId(video.getStationId());
usualVO.setId(String.valueOf(video.getId()));
usualVO.setName(video.getName());
return usualVO;
}).collect(Collectors.toList());
request.put("videos", updateUsualList);
// 同步指令
interactiveService.updateVideo(request);
return ReturnT.SUCCESS;
}
@XxlJob(SYNCHRONOUS_SCADA_INSTRUCT)
public ReturnT synchronousScadaInstruct(String params) {
// 查询项目数据
Result<List<ProjectVO>> projects = projectClient.getProjectByAppId();
if(!projects.isSuccess() || CollectionUtil.isEmpty(projects.getData())){
return ReturnT.SUCCESS;
}
// 请求fdp同步实时画面方法参数定义
Map<String,Object> param = new HashMap<>(2);
List<UpdateStationVO> stations = projects.getData().stream().map(station -> {
UpdateStationVO updateStation = new UpdateStationVO();
updateStation.setId(station.getId());
updateStation.setName(station.getName());
return updateStation;
}).collect(Collectors.toList());
param.put("stations", stations);
// 查询画面信息
Result<List<CanvasVO>> canvas = scadaClient.getCanvasList(projects.getData().stream().map(ProjectVO::getId).collect(Collectors.toList()));
if(!canvas.isSuccess() || CollectionUtil.isEmpty(canvas.getData())) {
return ReturnT.SUCCESS;
}
List<UpdateUsualVO> updateUsuals = canvas.getData().stream().map(canva -> {
UpdateUsualVO usualVO = new UpdateUsualVO();
usualVO.setStationId(canva.getProjectId());
usualVO.setName(canva.getName());
// 画面id =
String id = Optional.of(canva.getPicSource()).map(String::valueOf).orElse("") + "^" +
Optional.ofNullable(canva.getContext()).orElse("") + "^" +
Optional.ofNullable(canva.getStationNum()).orElse("") + "^" +
Optional.ofNullable(canva.getProjectId()).orElse("") + "^" +
Optional.ofNullable(canva.getTaskId()).map(String::valueOf).orElse("") + "^" +
Optional.ofNullable(canva.getName()).orElse("") + "^" +
Optional.ofNullable(canva.getId()).map(String::valueOf).orElse("") + "^";
usualVO.setId(id);
return usualVO;
}).collect(Collectors.toList());
param.put("canvases", updateUsuals);
Boolean status = interactiveService.updateCanvas(param);
return ReturnT.SUCCESS;
}
}

8
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/XxlJobHandlerConstant.java

@ -6,8 +6,16 @@ package com.hnac.hzims.bigmodel.schedule;
*/
public interface XxlJobHandlerConstant {
/**获取问答结果**/
String GET_INTERACTIVE_RESULT = "getInteractiveResult";
/**同步视频指令**/
String SYNCHRONOUS_VIDEO_INSTRUCT = "synchronousVideoInstruct";
String SYNCHRONOUS_SCADA_INSTRUCT = "synchronousScadaInstruct";
String INTERACTIVE_RESULT_KEY = "hzllm:interactive:result";
String HZIMS_BIGMODEL_ASK_KEY = "hzims:bigmodel:ask:key";
}

45
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java

@ -2,11 +2,14 @@ package com.hnac.hzims.bigmodel.websocket.handler;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum;
import com.hnac.hzims.bigmodel.interactive.constants.StationSelectionVO;
import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService;
import com.hnac.hzims.bigmodel.websocket.sessionManager.InteractiveSessionManager;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.SpringUtil;
import org.springframework.util.Assert;
import org.springframework.web.socket.CloseStatus;
@ -15,6 +18,7 @@ import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
@ -56,14 +60,45 @@ public class InteractiveHandler extends TextWebSocketHandler {
} catch (IOException e) {
throw new RuntimeException(e);
}
}else {
String sessionId = InteractiveSessionManager.getEntryBySession(session).getKey();
this.handleMessage(messageJSON,sessionId);
}
else {
// 发送问题
String context = messageJSON.getString("context");
String userId = messageJSON.getString("userId");
}
private void handleMessage(JSONObject messageContext,String sessionId) {
Boolean isSpecial = messageContext.getBoolean("isSpecial");
if(Func.isEmpty(isSpecial) || !isSpecial) {
String context = messageContext.getString("context");
String userId = messageContext.getString("userId");
IInteractiveService interactiveService = SpringUtil.getBean(IInteractiveService.class);
R askResult = interactiveService.ask(context, InteractiveSessionManager.getEntryBySession(session).getKey(), userId);
R askResult = interactiveService.ask(context, sessionId, userId);
log.info("返回结果为:"+ JSON.toJSONString(askResult));
}
else {
String funcCode = messageContext.getString("funcCode");
FuncRouteEnum funcEnum = FuncRouteEnum.getEnumByFuncCode(funcCode);
switch (funcEnum) {
case CHOOSE_STATION:
this.handleChooseStation(messageContext,sessionId);
break;
default:
break;
}
}
}
private void handleChooseStation(JSONObject messageContext,String sessionId) {
IInteractiveService interactiveService = SpringUtil.getBean(IInteractiveService.class);
String userId = messageContext.getString("userId");
String funcCode = messageContext.getString("funcCode");
StationSelectionVO selectionVO = messageContext.getObject("selection",StationSelectionVO.class);
JSONObject data = new JSONObject();
data.put("station_id",selectionVO.getId());
data.put("station_name",selectionVO.getName());
Map<String, Object> extra = new HashMap<>(2);
extra.put("func",funcCode);
extra.put("data",data);
interactiveService.specialAsk(sessionId,userId,extra);
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java

@ -60,7 +60,7 @@ public class GenerateServiceImpl extends BaseServiceImpl<GenerateMapper, Generat
if(!ObjectUtil.isEmpty(filter.getDataOrigin())){
eq("DATA_ORIGIN",filter.getDataOrigin());
}
orderByDesc("create_time");
orderByDesc("FILL_DATE");
}};
IPage pages = super.page(Condition.getPage(query), queryWrapper);
List list = GenerateWrapper.build().listVO(pages.getRecords());

24
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/feign/StationVideoTypeClient.java

@ -1,18 +1,19 @@
package com.hnac.hzims.operational.station.feign;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.support.utils.Condition;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzims.operational.station.service.IStationVideoTypeService;
import lombok.AllArgsConstructor;
import org.springblade.core.log.annotation.ApiLog;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/feign/station/videoType")
@AllArgsConstructor
public class StationVideoTypeClient implements IStationVideoTypeClient {
@ -20,11 +21,24 @@ public class StationVideoTypeClient implements IStationVideoTypeClient {
@ApiLog
@Override
@PostMapping("/listByStationId")
@PostMapping(LIST_BY_STATION_ID)
public List<StationVideoTypeEntity> listByStationId(String stationId) {
List<StationVideoTypeEntity> result = stationVideoTypeService.list(new LambdaQueryWrapper<StationVideoTypeEntity>(){{
eq(StationVideoTypeEntity::getStationId,stationId);
}});
return result;
}
@Override
@GetMapping(LIST)
public R<List<StationVideoTypeEntity>> list(StationVideoTypeEntity req) {
QueryWrapper<StationVideoTypeEntity> queryWrapper = Condition.getQueryWrapper(req);
return R.data(stationVideoTypeService.list(queryWrapper));
}
@Override
@GetMapping(GET_BY_ID)
public R<StationVideoTypeEntity> getById(@RequestParam Long id) {
return R.data(stationVideoTypeService.getById(id,0));
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java

@ -81,4 +81,6 @@ public interface IStationVideoTypeService extends BaseService<StationVideoTypeEn
Map getVideoPointByRegion(Long refDept,String regionCode);
String getRtspAddressByVideo(StationVideoTypeEntity req);
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java

@ -343,7 +343,7 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
}
if(station.getWaterLevelMax() < station.getWaterLevel()){
station.setWaterColor(2);
}else if((station.getWaterLevel() / station.getWaterLevelMax()) > 0.9){
}else if((station.getWaterLevel() / station.getWaterLevelMax()) > 0.8){
station.setWaterColor(1);
}
}

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java

@ -274,6 +274,11 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl<StationVideoTyp
return cameras.stream().collect(Collectors.groupingBy(c -> deviceMap.get(c.getString("encodeDevIndexCode"))));
}
@Override
public String getRtspAddressByVideo(StationVideoTypeEntity req) {
return null;
}
private HikVideoAreaTreeVO generateAreaTree(Map<String, List<HikVideoAreaVO>> videoAreaMapByParent,HikVideoAreaVO area) {
HikVideoAreaTreeVO parentTree = BeanUtil.copy(area,HikVideoAreaTreeVO.class);
if(CollectionUtil.isNotEmpty(videoAreaMapByParent.get(area.getIndexCode()))) {

9
pom.xml

@ -49,12 +49,14 @@
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-system-api</artifactId>
<version>${bladex.project.version}</version>
<!-- <version>${bladex.project.version}</version>-->
<version>5.1.1.RELEASE.fix.4</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-user-api</artifactId>
<version>${bladex.project.version}</version>
<!-- <version>${bladex.project.version}</version>-->
<version>5.1.1.RELEASE.fix.4</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
@ -74,7 +76,8 @@
<dependency>
<groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId>
<version>${bladex.project.version}</version>
<!-- <version>${bladex.project.version}</version>-->
<version>5.1.1.RELEASE.fix.4</version>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>

Loading…
Cancel
Save