Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java
zhongwei
liwen 6 months ago
parent
commit
878abb1342
  1. 5
      hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FunctionConstants.java
  2. 1
      hzims-service-api/pom.xml
  3. 17
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java
  4. 25
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java
  5. 39
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RemoteParamVO.java
  6. 19
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/SessionContentVO.java
  7. 13
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/constants/RedisKeyConstants.java
  8. 9
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java
  9. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java
  10. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java
  11. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java
  12. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java
  13. 1
      hzims-service/pom.xml
  14. 2
      pom.xml

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

@ -20,7 +20,10 @@ public interface FunctionConstants {
LINK("2"), LINK("2"),
/**参数**/ /**参数**/
PARAMS("3"), PARAMS("3"),
CHOOSE("4") /**选项**/
CHOOSE("4"),
/**确认**/
CONFIRM("5")
; ;
@Getter @Getter
private String type; private String type;

1
hzims-service-api/pom.xml

@ -29,7 +29,6 @@
<module>middle-api</module> <module>middle-api</module>
<module>alarm-api</module> <module>alarm-api</module>
<module>big-model-api</module> <module>big-model-api</module>
<module>suichang-api</module>
</modules> </modules>
<dependencies> <dependencies>

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

@ -12,18 +12,21 @@ import java.util.Optional;
*/ */
@AllArgsConstructor @AllArgsConstructor
public enum FuncRouteEnum { public enum FuncRouteEnum {
OPEN_CANVAS("open_canvas","打开实时画面"), OPEN_CANVAS("open_canvas","打开实时画面",null),
OPEN_VIDEO("open_video","打开视频监控"), OPEN_VIDEO("open_video","打开视频监控",null),
DIAGNOSE("diagnose","智能诊断"), DIAGNOSE("diagnose","智能诊断",null),
CHOOSE_STATION("choose_station","选择站点"), CHOOSE_STATION("choose_station","选择站点",null),
CHOOSE_VIDEO("choose_video","选择视频"), CHOOSE_VIDEO("choose_video","选择视频",null),
CHOOSE_CANVAS("choose_canvas","选择画面"), CHOOSE_CANVAS("choose_canvas","选择画面",null),
CHOOSE_FAULT("choose_fault","选择故障"), CHOOSE_FAULT("choose_fault","选择故障",null),
CONFIRM_YK("confirm_yk","遥控确认", FunctionConstants.TypeEnum.CONFIRM),
; ;
@Getter @Getter
private String funcCode; private String funcCode;
@Getter @Getter
private String funcName; private String funcName;
@Getter
private FunctionConstants.TypeEnum type;
public static FuncRouteEnum getEnumByFuncCode(String funcCode) { public static FuncRouteEnum getEnumByFuncCode(String funcCode) {
Optional<FuncRouteEnum> FuncRoute = Arrays.stream(FuncRouteEnum.class.getEnumConstants()).filter(e -> funcCode.equals(e.getFuncCode())).findFirst(); Optional<FuncRouteEnum> FuncRoute = Arrays.stream(FuncRouteEnum.class.getEnumConstants()).filter(e -> funcCode.equals(e.getFuncCode())).findFirst();

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

@ -6,16 +6,22 @@ import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum; import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum;
import com.hnac.hzims.bigmodel.interactive.constants.FunctionConstants; import com.hnac.hzims.bigmodel.interactive.constants.FunctionConstants;
import com.hnac.hzims.bigmodel.interactive.vo.*; import com.hnac.hzims.bigmodel.interactive.vo.*;
import com.hnac.hzims.bigmodel.websocket.constants.RedisKeyConstants;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity; import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient; import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient;
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceFuncVO;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger; import com.xxl.job.core.log.XxlJobLogger;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.dto.ControlDTO;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
@ -35,6 +41,8 @@ public class ExtraResolveStrategyService {
private final IStationClient stationClient; private final IStationClient stationClient;
private final IStationVideoTypeClient videoTypeClient; private final IStationVideoTypeClient videoTypeClient;
private final JumpRouteJoinStrategy jumpRouteJoinStrategy; private final JumpRouteJoinStrategy jumpRouteJoinStrategy;
private final DeviceClient deviceClient;
private final RedisTemplate redisTemplate;
/** /**
* 解析DFP返回extra * 解析DFP返回extra
@ -59,6 +67,8 @@ public class ExtraResolveStrategyService {
return this.resolveChooseScada(extra); return this.resolveChooseScada(extra);
case CHOOSE_FAULT: case CHOOSE_FAULT:
return this.resolveChooseFault(extra); return this.resolveChooseFault(extra);
case CONFIRM_YK:
return this.resolveConfirmRemote(extra);
default: default:
break; break;
} }
@ -67,6 +77,21 @@ public class ExtraResolveStrategyService {
return JSONObject.parseObject(JSON.toJSONString(extra),ExtraVO.class); return JSONObject.parseObject(JSON.toJSONString(extra),ExtraVO.class);
} }
private ExtraVO resolveConfirmRemote(Map<String,Object> extra) {
ExtraVO result = new ExtraVO();
RemoteParamVO remoteParam = JSONObject.parseObject(JSON.toJSONString(extra.get("data")), RemoteParamVO.class);
result.setFuncCode(FuncRouteEnum.CONFIRM_YK.getFuncCode());
result.setType(FunctionConstants.TypeEnum.CONFIRM.getType());
R<DeviceInstanceFuncVO> funcVOR = deviceClient.getFuncById(remoteParam.getFuncId());
if(funcVOR.isSuccess()) {
Map<String,Object> param = new HashMap(1);
param.put("control",funcVOR.getData());
param.put("value",remoteParam.getValue());
result.setParams(param);
}
return result;
}
private ExtraVO resolveChooseFault(Map<String,Object> extra) { private ExtraVO resolveChooseFault(Map<String,Object> extra) {
ExtraVO result = new ExtraVO(); ExtraVO result = new ExtraVO();
JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data")));

39
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RemoteParamVO.java

@ -0,0 +1,39 @@
package com.hnac.hzims.bigmodel.interactive.vo;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @Author: huangxing
* @Date: 2024/05/20 14:46
*/
@Data
@EqualsAndHashCode
public class RemoteParamVO implements Serializable {
@JSONField(name = "id")
private String funcId;
@JSONField(name = "yk_name")
private String remoteName;
@JSONField(name = "device_id")
private String deviceCode;
@JSONField(name = "device_name")
private String deviceName;
@JSONField(name = "station_id")
private String projectId;
@JSONField(name = "station_name")
private String projectName;
private String signage;
private String value;
}

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

@ -0,0 +1,19 @@
package com.hnac.hzims.bigmodel.interactive.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @Author: huangxing
* @Date: 2024/05/20 19:31
*/
@Data
@EqualsAndHashCode
public class SessionContentVO implements Serializable {
/**机器码**/
private String machineCode;
}

13
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/constants/RedisKeyConstants.java

@ -0,0 +1,13 @@
package com.hnac.hzims.bigmodel.websocket.constants;
import com.hnac.hzims.common.constant.CommonConstant;
/**
* @Author: huangxing
* @Date: 2024/05/20 19:11
*/
public interface RedisKeyConstants {
String SESSION_CONTENT_KEY = CommonConstant.TENANT_ID + ":hzims:bigModel:session:content";
}

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

@ -9,12 +9,14 @@ import com.hnac.hzims.bigmodel.interactive.service.impl.JumpRouteJoinStrategy;
import com.hnac.hzims.bigmodel.interactive.service.impl.ParamStrategy; import com.hnac.hzims.bigmodel.interactive.service.impl.ParamStrategy;
import com.hnac.hzims.bigmodel.interactive.vo.*; import com.hnac.hzims.bigmodel.interactive.vo.*;
import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService; import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService;
import com.hnac.hzims.bigmodel.websocket.constants.RedisKeyConstants;
import com.hnac.hzims.bigmodel.websocket.service.InteractiveWsService; import com.hnac.hzims.bigmodel.websocket.service.InteractiveWsService;
import com.hnac.hzims.bigmodel.websocket.sessionManager.InteractiveSessionManager; import com.hnac.hzims.bigmodel.websocket.sessionManager.InteractiveSessionManager;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.SpringUtil; import org.springblade.core.tool.utils.SpringUtil;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.socket.CloseStatus; import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession; import org.springframework.web.socket.WebSocketSession;
@ -23,6 +25,7 @@ import org.springframework.web.socket.handler.TextWebSocketHandler;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.function.Function; import java.util.function.Function;
/** /**
@ -64,6 +67,12 @@ public class InteractiveHandler extends TextWebSocketHandler {
} }
} else { } else {
String sessionId = InteractiveSessionManager.getEntryBySession(session).getKey(); String sessionId = InteractiveSessionManager.getEntryBySession(session).getKey();
if(Func.isNotEmpty(messageJSON.containsKey("content"))) {
// 将发送参数存入redis
RedisTemplate redisTemplate = SpringUtil.getBean(RedisTemplate.class);
redisTemplate.expire(RedisKeyConstants.SESSION_CONTENT_KEY,30, TimeUnit.MINUTES);
redisTemplate.opsForHash().put(RedisKeyConstants.SESSION_CONTENT_KEY,sessionId,messageJSON.getObject("content", SessionContentVO.class));
}
this.handleMessage(messageJSON, sessionId); this.handleMessage(messageJSON, sessionId);
} }
} }

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java

@ -354,4 +354,10 @@ public class StationVideoTypeController extends BladeController {
return R.data(false); return R.data(false);
} }
@GetMapping ("/getVideoByPointCodes")
@ApiOperationSupport(order = 190)
@ApiOperation(value = "通过视频编号获取视频")
public R<List<StationVideoTypeEntity>> getVideoByPointCodes(@RequestParam @ApiParam("视频设备编号") String pointCodes) {
return R.data(stationVideoTypeService.getVideoByPointCodes(pointCodes));
}
} }

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

@ -10,6 +10,7 @@ import com.hnac.hzims.operational.station.response.HikMonitorResp;
import com.hnac.hzims.operational.station.vo.HikVideoAreaTreeVO; import com.hnac.hzims.operational.station.vo.HikVideoAreaTreeVO;
import com.hnac.hzims.operational.station.vo.StationVideoTypeVO; import com.hnac.hzims.operational.station.vo.StationVideoTypeVO;
import com.hnac.hzims.operational.station.vo.VideoMonitorVO; import com.hnac.hzims.operational.station.vo.VideoMonitorVO;
import io.swagger.annotations.ApiParam;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
@ -83,4 +84,6 @@ public interface IStationVideoTypeService extends BaseService<StationVideoTypeEn
String getRtspAddressByVideo(StationVideoTypeEntity req); String getRtspAddressByVideo(StationVideoTypeEntity req);
List<StationVideoTypeEntity> getVideoByPointCodes(String pointCodes);
} }

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -690,6 +690,14 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
throw new ServiceException("站点两票标识平台已存在,请检查后重新填入!"); throw new ServiceException("站点两票标识平台已存在,请检查后重新填入!");
}); });
} }
// 检查站点编号唯一性
if(StringUtil.isNotBlank(entity.getCode())) {
LambdaQueryWrapper<StationEntity> wq = Wrappers.<StationEntity>lambdaQuery().eq(StationEntity::getCode, entity.getCode());
List<StationEntity> stations = this.getBaseMapper().listWithOutAuth(wq);
Assert.isTrue(CollectionUtil.isEmpty(stations),() -> {
throw new ServiceException("站点编号平台已存在,请检查后重新填入!");
});
}
Integer maxSort = this.baseMapper.getMaxSort(); Integer maxSort = this.baseMapper.getMaxSort();
entity.setSort(Optional.ofNullable(maxSort).map(sort -> sort + 1).orElse(1)); entity.setSort(Optional.ofNullable(maxSort).map(sort -> sort + 1).orElse(1));
// 创建站点机构 // 创建站点机构

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

@ -279,6 +279,14 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl<StationVideoTyp
return null; return null;
} }
@Override
public List<StationVideoTypeEntity> getVideoByPointCodes(String pointCodes) {
List<String> pointCodeList = Func.toStrList(",", pointCodes);
LambdaQueryWrapper<StationVideoTypeEntity> qw = Wrappers.<StationVideoTypeEntity>lambdaQuery().in(StationVideoTypeEntity::getPointCode, pointCodeList);
List<StationVideoTypeEntity> videoList = this.list(qw);
return videoList;
}
private HikVideoAreaTreeVO generateAreaTree(Map<String, List<HikVideoAreaVO>> videoAreaMapByParent,HikVideoAreaVO area) { private HikVideoAreaTreeVO generateAreaTree(Map<String, List<HikVideoAreaVO>> videoAreaMapByParent,HikVideoAreaVO area) {
HikVideoAreaTreeVO parentTree = BeanUtil.copy(area,HikVideoAreaTreeVO.class); HikVideoAreaTreeVO parentTree = BeanUtil.copy(area,HikVideoAreaTreeVO.class);
if(CollectionUtil.isNotEmpty(videoAreaMapByParent.get(area.getIndexCode()))) { if(CollectionUtil.isNotEmpty(videoAreaMapByParent.get(area.getIndexCode()))) {

1
hzims-service/pom.xml

@ -29,7 +29,6 @@
<module>hzims-alarm</module> <module>hzims-alarm</module>
<module>hzims-basic</module> <module>hzims-basic</module>
<module>hzims-big-model</module> <module>hzims-big-model</module>
<module>suichang</module>
<module>hzims-simulate</module> <module>hzims-simulate</module>
</modules> </modules>

2
pom.xml

@ -77,7 +77,7 @@
<groupId>com.hnac.hzinfo.data</groupId> <groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId> <artifactId>hzinfo-data-sdk</artifactId>
<!-- <version>${bladex.project.version}</version>--> <!-- <version>${bladex.project.version}</version>-->
<version>5.1.1.RELEASE.fix.4</version> <version>5.1.1.RELEASE.fix.5</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.xuxueli</groupId> <groupId>com.xuxueli</groupId>

Loading…
Cancel
Save