Browse Source

#prod代码合并

zhongwei
yang_shj 4 months ago
parent
commit
77f0fbbc1f
  1. 1
      hzims-service/equipment/src/main/resources/template/template.yml
  2. 2
      hzims-service/hzims-alarm/pom.xml
  3. 7
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java
  4. 213
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java
  5. 5
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java
  6. 37
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/data/controller/RemoteController.java
  7. 97
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/data/service/HistoryDataService.java
  8. 31
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/data/service/RemoteService.java
  9. 26
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/controller/DataSourceExecuteController.java
  10. 62
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/DataSourceService.java
  11. 14
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/IDataSourceService.java
  12. 34
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/AnalyseDataController.java
  13. 15
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IParamsService.java
  14. 128
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java
  15. 259
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java
  16. 73
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java
  17. 36
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamsServiceImpl.java
  18. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/XxlJobConfig.java
  19. 12
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java
  20. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/config/XxlJobConfig.java
  21. 9
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/impl/InnerDangerFlowServiceImpl.java
  22. 9
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java
  23. 9
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java
  24. 36
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java
  25. 2
      hzims-service/weather/src/main/java/com/hnac/hzims/weather/config/XxlJobConfig.java
  26. 25
      pom.xml

1
hzims-service/equipment/src/main/resources/template/template.yml

@ -79,7 +79,6 @@ fdp:
tenantId: 200000 tenantId: 200000
service: service:
url: http://192.168.60.70:8086 url: http://192.168.60.70:8086
# url: 140.210.218.236
hzinfo: hzinfo:
model: model:

2
hzims-service/hzims-alarm/pom.xml

@ -32,8 +32,6 @@
<dependency> <dependency>
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<artifactId>alarm-api</artifactId> <artifactId>alarm-api</artifactId>
<version>4.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>

7
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java

@ -1,15 +1,12 @@
package com.hnac.hzims.alarm.show.service; package com.hnac.hzims.alarm.show.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.config.entity.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.config.vo.AlarmCountVo; import com.hnac.hzims.alarm.config.vo.AlarmCountVo;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo; import com.hnac.hzims.alarm.show.vo.AlarmVideoVo;
import com.hnac.hzims.alarm.show.vo.ShowQueryVo; import com.hnac.hzims.alarm.show.vo.ShowQueryVo;
import com.hnac.hzims.business.ws.alart.vo.AlartParamVo; import com.hnac.hzims.business.ws.alart.vo.AlartParamVo;
import org.springblade.core.mp.base.BaseService;
import com.hnac.hzims.equipment.entity.EmVideoBandingEntity;
import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.TextMessage;
import java.util.List; import java.util.List;

213
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.alarm.config.constants.AlarmConstants; import com.hnac.hzims.alarm.config.constants.AlarmConstants;
import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.config.service.AlarmConfigService; import com.hnac.hzims.alarm.config.service.AlarmConfigService;
@ -12,30 +13,21 @@ import com.hnac.hzims.alarm.config.vo.ChildAlarmCountVo;
import com.hnac.hzims.alarm.show.mapper.AlarmMapper; import com.hnac.hzims.alarm.show.mapper.AlarmMapper;
import com.hnac.hzims.alarm.show.service.AlarmHandleService; import com.hnac.hzims.alarm.show.service.AlarmHandleService;
import com.hnac.hzims.alarm.show.service.AlarmService; import com.hnac.hzims.alarm.show.service.AlarmService;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo;
import com.hnac.hzims.alarm.show.vo.ShowQueryVo;
import com.hnac.hzims.alarm.source.service.MessageService; import com.hnac.hzims.alarm.source.service.MessageService;
import com.hnac.hzims.business.ws.alart.vo.AlartParamVo;
import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.EmVideoBandingEntity; import com.hnac.hzims.equipment.entity.EmVideoBandingEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IEmVideoClient; import com.hnac.hzims.equipment.feign.IEmVideoClient;
import com.hnac.hzims.message.dto.MailMessageDTO; import com.hnac.hzims.fdp.util.HttpRequestUtil;
import com.hnac.hzims.message.fegin.IMessageClient;
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.feign.IStationClient; import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient;
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.alarm.config.service.AlarmConfigService;
import com.hnac.hzims.alarm.config.vo.AlarmCountVo;
import com.hnac.hzims.alarm.config.vo.ChildAlarmCountVo;
import com.hnac.hzims.alarm.show.vo.AlarmVideoVo;
import com.hnac.hzims.alarm.show.vo.ShowQueryVo;
import com.hnac.hzims.business.ws.alart.vo.AlartParamVo;
import com.hnac.hzims.fdp.util.HttpRequestUtil;
import com.hnac.hzims.message.dto.MailMessageDTO;
import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient;
import lombok.AllArgsConstructor;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceEventVO; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceEventVO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceFuncVO; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceFuncVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -46,6 +38,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.message.fegin.IMessageClient;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -252,36 +245,6 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, AlarmEntity> impl
return new TextMessage(JSONObject.toJSONString(alarms.stream().sorted(Comparator.comparing(AlarmEntity::getAlarmTime).reversed()).collect(Collectors.toList()))); return new TextMessage(JSONObject.toJSONString(alarms.stream().sorted(Comparator.comparing(AlarmEntity::getAlarmTime).reversed()).collect(Collectors.toList())));
} }
/* @Override
public List<EmVideoBandingEntity> getVideosByStationAndRealId(String stationCode, String realId) {
R<StationEntity> stationR = stationClient.getStationByCode(stationCode);
Assert.isTrue(stationR.isSuccess() && Func.isNotEmpty(stationR.getData()), () -> {
throw new ServiceException("获取站点信息失败!");
});
EmInfoEntity emReq = new EmInfoEntity();
emReq.setDepartment(stationR.getData().getRefDept());
R<List<EmInfoEntity>> emListR = emInfoClient.emInfoList(emReq);
Assert.isTrue(emListR.isSuccess() && CollectionUtil.isNotEmpty(emListR.getData()), () -> {
throw new ServiceException("该站点未获取到设备!");
});
List<EmInfoEntity> emInfoList = emListR.getData();
String emCodes = emInfoList.stream().parallel()
.filter(this::isBandingVideoByEmCode)
.filter(this::isDeviceCodeExist)
.filter(em -> this.isRealIdBanding(realId, em.getNumber()))
.map(EmInfoEntity::getNumber)
.collect(Collectors.joining(","));
Assert.isTrue(StringUtil.isNotBlank(emCodes) && Func.isNotEmpty(emCodes), () -> {
throw new ServiceException("未获取到设备!");
});
R<List<EmVideoBandingEntity>> videoListR = emVideoClient.getEmBandingVideos(emCodes);
Assert.isTrue(videoListR.isSuccess(), () -> {
throw new ServiceException("获取设备绑定视频列表失败!");
});
return videoListR.getData().stream().distinct().collect(Collectors.toList());
}*/
/** /**
* 验证设备编号是否绑定视频 * 验证设备编号是否绑定视频
* @param emInfo 设备信息 * @param emInfo 设备信息
@ -403,4 +366,164 @@ public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, AlarmEntity> impl
} }
return new ArrayList<>(); return new ArrayList<>();
} }
/**
* 获取告警视频信息
* @param stationCode
* @param deviceCode
* @param realId
* @return
*/
@Override
public List<AlarmVideoVo> alarmVideos(String stationCode, String deviceCode, String realId,Integer alarmType) {
// 步骤1、根据设备编号查询视频信息
if(StringUtil.isNotBlank(deviceCode)){
return this.deviceVideos(stationCode,deviceCode);
}
// 步骤2、根据采集点查询视频信息
if(StringUtil.isNotBlank(realId)){
// 智能预警
if(AlarmConstants.EARLY.equals(alarmType)){
return this.earlyVideos(stationCode,realId);
// 通讯中断、通讯异常查询站点视频
}else if(AlarmConstants.INTERRUPT.equals(alarmType) || AlarmConstants.ABNORMAL.equals(alarmType)){
return this.stationVideos(stationCode);
// 其他告警
}else{
return this.realIdVideos(stationCode,realId);
}
}
// 步骤3.根据站点编号查询视频信息
if(StringUtil.isNotBlank(stationCode)){
return this.stationVideos(stationCode);
}
throw new ServiceException("未查询到告警视频信息!");
}
/**
*查询站点绑定视频信息
* @param stationCode
*/
private List<AlarmVideoVo> stationVideos(String stationCode) {
List<StationVideoTypeEntity> videos = stationVideoTypeClient.listByStationId(stationCode);
if(CollectionUtil.isEmpty(videos)){
throw new ServiceException("站点暂无视频信息!");
}
return videos.stream().distinct().map(video->{
AlarmVideoVo alarmVideo = new AlarmVideoVo();
alarmVideo.setVideoHost(video.getVideoHost());
alarmVideo.setVideoName(video.getName());
alarmVideo.setVideoAppKey(video.getAppKey());
alarmVideo.setVideoAppSecret(video.getAppSecret());
alarmVideo.setPointCode(video.getPointCode());
return alarmVideo;
}).collect(Collectors.toList());
}
/**
* 查询设备绑定视频信息
* @param deviceCode
* @return
*/
private List<AlarmVideoVo> deviceVideos(String stationCode,String deviceCode) {
// 查询设备绑定视频点位
R<List<EmVideoBandingEntity>> videos = emVideoClient.getEmBandingVideos(deviceCode);
if(!videos.isSuccess() || CollectionUtil.isEmpty(videos.getData())){
// 查询站点
R<StationEntity> station = stationClient.getStationByCode(stationCode);
if(!station.isSuccess() || ObjectUtil.isEmpty(station.getData())){
throw new ServiceException("未查询到设备绑定视频信息!");
}
// 查询设备
R<EmInfoEntity> device = emInfoClient.getEmInfoByEmCode(deviceCode);
if(!device.isSuccess() || ObjectUtil.isEmpty(device.getData())){
throw new ServiceException("未查询到设备绑定视频信息!");
}
throw new ServiceException("请在设备信息菜单绑定" + station.getData().getName() + "-" + device.getData().getName() + "视频信息!");
}
return videos.getData().stream().distinct().map(video->{
AlarmVideoVo alarmVideo = new AlarmVideoVo();
alarmVideo.setVideoHost(video.getVideoHost());
alarmVideo.setVideoName(video.getVideoName());
alarmVideo.setVideoAppKey(video.getVideoAppKey());
alarmVideo.setVideoAppSecret(video.getVideoAppSecret());
alarmVideo.setPointCode(video.getPointCode());
return alarmVideo;
}).collect(Collectors.toList());
}
/**
* 查询智能预警视频信息
* @param stationCode
* @param faultId
*/
private List<AlarmVideoVo> earlyVideos(String stationCode, String faultId) {
// 调用FDP接口查询设备编号
Map<String, Object> param = new HashMap<>();
param.put("faultId", faultId);
String result = HttpRequestUtil.postCall(param, FAULTGRAPH_INFO_PATH, "POST");
if (StringUtil.isBlank(result)) {
throw new ServiceException("未查询到智能预警设备信息!");
}
HashMap<String, Object> map = JSONObject.parseObject(result, new TypeReference<HashMap<String, Object>>() {
});
if (ObjectUtil.isEmpty(map)) {
throw new ServiceException("未查询到智能预警设备信息!");
}
List<HashMap<String, Object>> data = JSONObject.parseObject(MapUtils.getString(map, "data"), new TypeReference<List<HashMap<String, Object>>>() {
});
if (CollectionUtil.isEmpty(data)) {
throw new ServiceException("未查询到智能预警设备信息!");
}
String deviceCode = (String) data.get(0).get("TAOS_INSTANCE");
if(StringUtil.isBlank(deviceCode)){
throw new ServiceException("未查询到智能预警设备信息!");
}
return this.deviceVideos(stationCode,deviceCode);
}
/**
* 查询采集点绑定视频信息
* @param stationCode
* @param realId
*/
private List<AlarmVideoVo> realIdVideos(String stationCode, String realId) {
// 查询站点
R<StationEntity> station = stationClient.getStationByCode(stationCode);
if(!station.isSuccess() || ObjectUtil.isEmpty(station)){
throw new ServiceException("未查询到告警采集点绑定视频信息!");
}
EmInfoEntity param = new EmInfoEntity();
param.setDepartment(station.getData().getRefDept());
// 查询设备
R<List<EmInfoEntity>> devices = emInfoClient.emInfoList(param);
if(!devices.isSuccess() || CollectionUtil.isEmpty(devices.getData())){
throw new ServiceException("未查询到告警采集点绑定视频信息!");
}
String deviceCodes = devices.getData().stream().parallel()
.filter(this::isBandingVideoByEmCode)
.filter(this::isDeviceCodeExist)
.map(EmInfoEntity::getNumber)
.filter(number -> this.isRealIdBanding(realId, number))
.collect(Collectors.joining(","));
if(StringUtil.isEmpty(deviceCodes)){
throw new ServiceException("未查询到告警采集点绑定视频信息!");
}
// 查询设备绑定视频点位
R<List<EmVideoBandingEntity>> videos = emVideoClient.getEmBandingVideos(deviceCodes);
if(!videos.isSuccess() || CollectionUtil.isEmpty(videos.getData())){
throw new ServiceException("请在设备信息菜单绑定" + station.getData().getName() + "的设备视频绑定信息!");
}
return videos.getData().stream().distinct().map(video->{
AlarmVideoVo alarmVideo = new AlarmVideoVo();
alarmVideo.setVideoHost(video.getVideoHost());
alarmVideo.setVideoName(video.getVideoName());
alarmVideo.setVideoAppKey(video.getVideoAppKey());
alarmVideo.setVideoAppSecret(video.getVideoAppSecret());
alarmVideo.setPointCode(video.getPointCode());
return alarmVideo;
}).collect(Collectors.toList());
}
} }

5
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java

@ -4,11 +4,6 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.alarm.source.service.MessageService; import com.hnac.hzims.alarm.source.service.MessageService;
import com.hnac.hzims.common.constant.CommonConstant; import com.hnac.hzims.common.constant.CommonConstant;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.BusinessMessageDTO;
import com.hnac.hzims.message.dto.SmsImmediatelyPushDTO;
import com.hnac.hzims.message.dto.WxMessageDTO;
import com.hnac.hzims.message.fegin.IMessageClient;
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 lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;

37
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/data/controller/RemoteController.java

@ -1,37 +0,0 @@
package com.hnac.hzims.bigmodel.data.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.bigmodel.BigModelConstants;
import com.hnac.hzims.bigmodel.data.service.RemoteService;
import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.system.dto.ControlDTO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author: huangxing
* @Date: 2024/06/24 14:42
*/
@AllArgsConstructor
@RequestMapping("/remote")
@RestController
@Api(value = "数据平台遥控指令管理",tags = "数据平台遥控指令管理")
@Business(module = BigModelConstants.APP_NAME,value = "数据平台遥控指令管理")
public class RemoteController {
private final RemoteService remoteService;
@ApiOperation("下发遥控指令")
@ApiOperationSupport(order = 1)
@PostMapping("/sendRemoteControl")
public R<Object> sendRemoteControl(ControlDTO controlDTO) {
return remoteService.sendRemoteControl(controlDTO);
}
}

97
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/data/service/HistoryDataService.java

@ -1,97 +0,0 @@
package com.hnac.hzims.bigmodel.data.service;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.hnac.hzims.bigmodel.interactive.constants.DataMethodEnum;
import com.hnac.hzims.bigmodel.interactive.constants.DateEnum;
import com.hnac.hzims.bigmodel.interactive.vo.HistoryDataSearchVO;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient;
import com.hnac.hzinfo.sdk.v5.device.dto.ReductionAttrDataDTO;
import com.hnac.hzinfo.sdk.v5.device.dto.ReductionDataDTO;
import com.hnac.hzinfo.sdk.v5.device.vo.ReductionDataVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
/**
* @Author: huangxing
* @Date: 2024/06/24 14:57
*/
@Service
@Slf4j
@AllArgsConstructor
public class HistoryDataService {
private final DeviceDataClient deviceDataClient;
private final BladeLogger logger;
public static final int DATA_COUNT_MAX = 1000;
public Result<ReductionDataVO> getPolymerizationData(HistoryDataSearchVO searchVO) {
DataMethodEnum enumByMethod = DataMethodEnum.getEnumByMethod(searchVO.getMethod());
Assert.isTrue(Func.isNotEmpty(enumByMethod),() -> {
throw new ServiceException("数据查询聚合方式传参有误,查询失败!");
});
// 聚合数据方式处理
DateEnum dateEnum = DateEnum.getDateEnumByType(searchVO.getDataType());
ReductionDataDTO dataDTO = new ReductionDataDTO();
ReductionAttrDataDTO reductionAttrData = new ReductionAttrDataDTO();
reductionAttrData.setSignage(searchVO.getSignage());
reductionAttrData.setAccessRules(enumByMethod.getAccessRule());
reductionAttrData.setKeepFigures(2);
dataDTO.setBeginTime(LocalDateTime.parse(searchVO.getStartTime(), DateUtil.DATETIME_FORMATTER));
dataDTO.setEndTime(LocalDateTime.parse(searchVO.getEndTime(),DateUtil.DATETIME_FORMATTER));
dataDTO.setDeviceCode(searchVO.getDeviceCode());
dataDTO.setNeedPage(false);
dataDTO.setSaveTimeType(dateEnum.getSaveTimeType());
dataDTO.setTimeInterval(1);
dataDTO.setDtos(Lists.newArrayList(reductionAttrData));
logger.info("interactive:getPolymerizationData","config传参为:" + JSON.toJSONString(dataDTO));
return deviceDataClient.pageDeviceCodeAndSignages(dataDTO);
}
public DateEnum getDateEnumByDuration(String startTime,String endTime,DateEnum dateEnum) {
LocalDateTime start = LocalDateTime.parse(startTime, DateUtil.DATETIME_FORMATTER);
LocalDateTime end = LocalDateTime.parse(endTime, DateUtil.DATETIME_FORMATTER);
Duration duration = Duration.between(start, end);
int count;
switch(dateEnum) {
case YEAR:
count = Long.valueOf(ChronoUnit.YEARS.between(start.toLocalDate(), end.toLocalDate())).intValue();
break;
case MONTH:
count = Long.valueOf(ChronoUnit.MONTHS.between(start.toLocalDate(), end.toLocalDate())).intValue();
break;
case DAY:
count = Long.valueOf(ChronoUnit.DAYS.between(start.toLocalDate(), end.toLocalDate())).intValue();
break;
case HOUR:
count = Long.valueOf(duration.toHours()).intValue();
break;
case MINUTE:
count = Long.valueOf(duration.toMinutes()).intValue();
break;
case SECOND:
count = Long.valueOf(duration.getSeconds()).intValue();
break;
default:
throw new ServiceException("未找到相关时间类型,查询失败!");
}
if(count <= DATA_COUNT_MAX) {
return dateEnum;
}
else {
return getDateEnumByDuration(startTime, endTime, DateEnum.getDateEnumByOrder(dateEnum.getOrder() + 1));
}
}
}

31
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/data/service/RemoteService.java

@ -1,31 +0,0 @@
package com.hnac.hzims.bigmodel.data.service;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.system.dto.ControlDTO;
import org.springblade.system.feign.IRemoteClient;
import org.springframework.stereotype.Service;
/**
* @Author: huangxing
* @Date: 2024/06/24 14:36
* @Descirbe: 数据平台 - 遥控服务类
*/
@Service
@Slf4j
@AllArgsConstructor
public class RemoteService {
private final IRemoteClient remoteClient;
/**
* 发送遥控指令
* @param controlDTO 遥控指令
* @return 结果
*/
public R<Object> sendRemoteControl(ControlDTO controlDTO) {
return remoteClient.sendCtrl(controlDTO);
}
}

26
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/controller/DataSourceExecuteController.java

@ -1,26 +0,0 @@
package com.hnac.hzims.bigmodel.datasource.controller;
import com.hnac.hzims.bigmodel.datasource.service.DataSourceService;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author: huangxing
* @Date: 2024/06/28 14:07
*/
@RestController
@RequestMapping("/dataSource/execute")
@AllArgsConstructor
public class DataSourceExecuteController {
private final DataSourceService dataSourceService;
@GetMapping("/executeQuery")
public R executeQuery(String sql,String dataSourceName) {
return R.data(dataSourceService.queryListOnSpecificDataSource(sql,dataSourceName));
}
}

62
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/DataSourceService.java

@ -1,62 +0,0 @@
package com.hnac.hzims.bigmodel.datasource.service;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
/**
* @Author: huangxing
* @Date: 2024/06/28 15:24
*/
@Service
@AllArgsConstructor
@Slf4j
public class DataSourceService {
private final JdbcTemplate jdbcTemplate;
private static final Pattern UPDATE_PATTERN = Pattern.compile("^UPDATE\\s", Pattern.CASE_INSENSITIVE);
private static final Pattern DELETE_PATTERN = Pattern.compile("^DELETE\\s", Pattern.CASE_INSENSITIVE);
/**
* 指定
* @param sql
* @param dataSourceName
* @return
*/
public List<Map<String, Object>> queryListOnSpecificDataSource(String sql,String dataSourceName) {
// 切换到指定的数据源
DynamicDataSourceContextHolder.push(dataSourceName);
try {
return jdbcTemplate.queryForList(sql);
} finally {
// 清除,恢复默认数据源
DynamicDataSourceContextHolder.clear();
}
}
public Integer updateOnSpecificDataSource(String sql,String dataSourceName) {
// 切换到指定的数据源
DynamicDataSourceContextHolder.push(dataSourceName);
try {
return jdbcTemplate.update(sql);
} finally {
// 清除,恢复默认数据源
DynamicDataSourceContextHolder.clear();
}
}
public static boolean isUpdateOrDelete(String sql) {
if (sql == null) {
return false;
}
return UPDATE_PATTERN.matcher(sql).find() || DELETE_PATTERN.matcher(sql).find();
}
}

14
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/IDataSourceService.java

@ -1,14 +0,0 @@
package com.hnac.hzims.bigmodel.datasource.service;
import java.util.List;
import java.util.Map;
/**
* @Author: huangxing
* @Date: 2024/06/28 14:22
*/
public interface IDataSourceService {
List<Map<String,Object>> queryList(String sql);
}

34
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/AnalyseDataController.java

@ -1,34 +0,0 @@
package com.hnac.hzims.bigmodel.interactive.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.bigmodel.interactive.service.IAnalyseDataService;
import com.hnac.hzims.bigmodel.interactive.vo.HistoryDataSearchVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author: huangxing
* @Date: 2024/05/29 09:22
*/
@RequestMapping("/analyse/data")
@AllArgsConstructor
@Api(value = "数据查询管理",tags = "数据查询管理")
@RestController
@Deprecated
public class AnalyseDataController {
private final IAnalyseDataService analyseDataService;
@GetMapping("/getHistoryData")
@ApiOperation("获取历史数据")
@ApiOperationSupport(order = 1)
public R getHistoryData(@Validated HistoryDataSearchVO searchVO) {
return R.data(analyseDataService.getHistoryData(searchVO));
}
}

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

@ -1,15 +0,0 @@
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
*/
@Deprecated
public interface IParamsService {
String dealJumpTypeFunction(FunctionEntity function, Map<String,String> args);
}

128
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java

@ -1,128 +0,0 @@
package com.hnac.hzims.bigmodel.interactive.service.impl;
import com.google.common.collect.Lists;
import com.hnac.hzims.bigmodel.entity.FunctionEntity;
import com.hnac.hzims.bigmodel.function.service.IFunctionService;
import com.hnac.hzims.bigmodel.interactive.constants.ProjectRemoteTypeEnum;
import com.hnac.hzims.bigmodel.interactive.vo.SessionContentVO;
import com.hnac.hzims.bigmodel.websocket.constants.RedisKeyConstants;
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 lombok.AllArgsConstructor;
import org.springblade.core.log.exception.ServiceException;
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.StringUtil;
import org.springblade.system.dto.DeptStationDTO;
import org.springblade.system.entity.CtrlAuth;
import org.springblade.system.feign.IDeptClient;
import org.springblade.system.feign.IRemoteClient;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @Author: huangxing
* @Date: 2024/05/21 16:10
*/
@Service
@AllArgsConstructor
public class AuthenticationService {
private final IDeptClient deptClient;
private final IFunctionService functionService;
private final IUserClient userClient;
private final ProjectClient projectClient;
private final IRemoteClient remoteClient;
private final RedisTemplate redisTemplate;
/**
* 站点鉴权
* @param stationId 站点ID
* @param userId 用户ID
*/
public void stationAuthentication(String stationId, String userId) {
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("人员站点鉴权失败!");
});
}
/**
* 菜单鉴权
* @param userId 用户ID
* @param func 函数编号
*/
public void menuAuthentication(String userId, String func) {
FunctionEntity function = functionService.getFunctionByCode(func);
if(Func.isNotEmpty(function) && Func.isNotEmpty(function.getRoute()) && StringUtil.isNotBlank(function.getRoute())) {
R<Boolean> authenticationR = userClient.permissionMenuById(Long.valueOf(userId), function.getRoute());
Assert.isTrue(authenticationR.isSuccess() && authenticationR.getData(), () -> {
throw new ServiceException("人员菜单鉴权失败!");
});
}
}
/**
* 遥控鉴权
* @param stationId 站点ID
* @param userId 用户ID
*/
public void remoteAuthentication(String stationId, String userId,String sessionId) {
// 查询数据平台站点是否可被遥控
Result<List<ProjectVO>> projectR = projectClient.getProjectIds(Lists.newArrayList(stationId));
Assert.isTrue(projectR.isSuccess() && CollectionUtil.isNotEmpty(projectR.getData()) && projectR.getData().size() == 1,() -> {
throw new ServiceException("未查询到站点,鉴权失败!");
});
ProjectVO project = projectR.getData().get(0);
if(ProjectRemoteTypeEnum.NOT_ALLOW.getCtrlType().equals(project.getCtrlType())) {
// 不允许发送遥控
throw new ServiceException("该站点不允许发送遥控指令,校验失败!");
}
else if(ProjectRemoteTypeEnum.VALID.getCtrlType().equals(project.getCtrlType())) {
// 运行发送遥控并且需要校验权限
R<List<CtrlAuth>> ctrlAuthR = remoteClient.getCtrlAuth(Optional.ofNullable(userId).filter(StringUtil::isNotBlank).map(Long::parseLong).orElse(null));
Assert.isTrue(ctrlAuthR.isSuccess(),() -> {
throw new ServiceException("该站点未设置鉴权用户,校验失败!");
});
List<CtrlAuth> ctrlAuthList = ctrlAuthR.getData();
Optional<CtrlAuth> authOptional = ctrlAuthList.stream().filter(c -> c.getProjectId().equals(stationId)).findFirst();
Assert.isTrue(authOptional.isPresent() && Func.isNotEmpty(authOptional.get().getIsLimitMachine()), () -> {
throw new ServiceException("该用户不存在相应站点权限,校验不通过!");
});
CtrlAuth ctrlAuth = authOptional.get();
// 如限制机器发送遥控指令
if(ctrlAuth.getIsLimitMachine().intValue() == 1) {
SessionContentVO sessionContent = (SessionContentVO) redisTemplate.opsForHash().get(RedisKeyConstants.SESSION_CONTENT_KEY, sessionId);
Assert.isTrue(Func.isNotEmpty(sessionContent),() -> {
throw new ServiceException("获取问题机器码失败,校验不通过!");
});
String machineCode = sessionContent.getMachineCode();
Assert.isTrue(StringUtil.isNotBlank(machineCode) && Func.isNotEmpty(machineCode) ,() -> {
throw new ServiceException("获取问题机器码失败,校验不通过!");
});
Assert.isTrue(machineCode.equals(ctrlAuth.getMachineCode()),() -> {
throw new ServiceException("站点校验码校验失败,校验不通过!");
});
}
}
}
public 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();
}
}

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

@ -1,259 +0,0 @@
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.SearchTypeEnum;
import com.hnac.hzims.bigmodel.interactive.service.IAnalyseDataService;
import com.hnac.hzims.bigmodel.interactive.vo.*;
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.v5.device.client.DeviceClient;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceFuncVO;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*;
import org.springframework.stereotype.Service;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author: huangxing
* @Date: 2024/05/08 16:19
*/
@Service
@AllArgsConstructor
@Deprecated
public class ExtraResolveStrategyService {
public static final String PATTERN_DATETIME = "yyyy-MM-dd HH:mm:ss.SSS";
public static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(PATTERN_DATETIME);
private final IStationClient stationClient;
private final IStationVideoTypeClient videoTypeClient;
private final JumpRouteJoinStrategy jumpRouteJoinStrategy;
private final DeviceClient deviceClient;
private final IAnalyseDataService analyseDataService;
/**
* 解析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)) {
XxlJobLogger.log("函数编号为:" + functionCode);
FuncRouteEnum funcRouteEnum = FuncRouteEnum.getEnumByFuncCode(functionCode);
if(Func.isNotEmpty(funcRouteEnum)) {
switch (funcRouteEnum) {
case DIAGNOSE:
return this.resolveDiagnose(extra);
case CHOOSE_VIDEO:
case CHOOSE_CANVAS:
case CHOOSE_STATION:
case CHOOSE_FAULT:
case CHOOSE_YC:
case CHOOSE_YK:
return this.resolveChooseSelection(extra,funcRouteEnum);
case CONFIRM_YK:
return this.resolveConfirmRemote(extra);
case SHOW_PARAM:
return this.resolveShowParam(extra);
default:
break;
}
}
}
else if(extra.containsKey("extra")){
return extra.getObject("extra",ExtraVO.class);
}
return JSONObject.parseObject(JSON.toJSONString(extra),ExtraVO.class);
}
private ExtraVO resolveChooseSelection(JSONObject extra,FuncRouteEnum funcRouteEnum) {
ExtraVO result = new ExtraVO();
JSONArray selections = JSONArray.parseArray(JSON.toJSONString(extra.get("data")));
result.setFunc(funcRouteEnum.getFuncCode());
result.setSpecial(true);
result.setSelection(selections);
result.setType(funcRouteEnum.getType().getType());
return result;
}
// private ExtraVO resolveChooseYc(JSONObject extra) {
// ExtraVO result = new ExtraVO();
// JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data")));
// if(data.containsKey("yks")) {
//
//
// List<AttrSelectionVO> attrs = JSONArray.parseArray(JSON.toJSONString(data.get("yks")), AttrSelectionVO.class);
// result.setSelection(attrs);
// }
// result.setFuncCode(FuncRouteEnum.CHOOSE_YC.getFuncCode());
// result.setSpecial(true);
// result.setType(FuncRouteEnum.CHOOSE_YC.getType().getType());
// return result;
// }
private ExtraVO resolveShowParam(Map<String,Object> extra) {
DataVO data = JSONObject.parseObject(JSON.toJSONString(extra.get("data")),DataVO.class);
if(Func.isNotEmpty(data)) {
if(Func.isNotEmpty(data.getReal())) {
if(Func.isNotEmpty(data.getReal().getTime()) && StringUtil.isNotBlank(data.getReal().getTime())) {
RealDataVO real = data.getReal();
Date date = DateUtil.parse(real.getTime(), PATTERN_DATETIME);
real.setTime(DateUtil.format(date,DateUtil.PATTERN_DATETIME));
}
}
if(Func.isNotEmpty(data.getItem()) && StringUtil.isNotBlank(data.getMethod())) {
if(SearchTypeEnum.HISTORY.getSearchType().equals(data.getType()) && Func.isNotEmpty(data.getItem())) {
DataItemVO item = data.getItem();
HistoryDataSearchVO searchVO = new HistoryDataSearchVO();
searchVO.setDataType(data.getDataType());
searchVO.setAttrName(item.getAttrName());
searchVO.setDeviceCode(item.getDeviceId());
searchVO.setDeviceName(item.getDeviceName());
searchVO.setStationName(item.getProjectName());
searchVO.setMethod(data.getMethod());
searchVO.setSignage(item.getSignage());
searchVO.setStartTime(data.getStartTime());
searchVO.setEndTime(data.getEndTime());
return analyseDataService.getHistoryData(searchVO);
}
}
}
ExtraVO result = new ExtraVO();
result.setFunc(FuncRouteEnum.SHOW_PARAM.getFuncCode());
result.setType(FuncRouteEnum.SHOW_PARAM.getType().getType());
Map<String,Object> param = new HashMap(1);
param.put("data", data);
result.setParams(param);
return result;
}
@Deprecated
private ExtraVO resolveConfirmRemote(Map<String,Object> extra) {
ExtraVO result = new ExtraVO();
RemoteParamVO remoteParam = JSONObject.parseObject(JSON.toJSONString(extra.get("data")), RemoteParamVO.class);
result.setFunc(FuncRouteEnum.CONFIRM_YK.getFuncCode());
result.setType(FuncRouteEnum.CONFIRM_YK.getType().getType());
R<DeviceInstanceFuncVO> funcVOR = deviceClient.getFuncById(remoteParam.getFuncId());
if(funcVOR.isSuccess()) {
Map<String,Object> param = new HashMap();
param.put("control",funcVOR.getData());
param.put("deviceName",remoteParam.getDeviceName());
param.put("projectName",remoteParam.getProjectName());
param.put("deviceCode",remoteParam.getDeviceId());
param.put("value",remoteParam.getValue());
result.setParams(param);
}
return result;
}
// private ExtraVO resolveChooseFault(Map<String,Object> extra) {
// ExtraVO result = new ExtraVO();
// JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data")));
// if(data.containsKey("faults")) {
// List<FaultSelectionVO> faults = JSONArray.parseArray(JSON.toJSONString(data.get("faults")), FaultSelectionVO.class);
// result.setSelection(faults);
// }
// result.setFuncCode(FuncRouteEnum.CHOOSE_FAULT.getFuncCode());
// result.setSpecial(true);
// result.setType(FunctionConstants.TypeEnum.CHOOSE.getType());
// return result;
// }
private ExtraVO resolveDiagnose(Map<String,Object> extra) {
ExtraVO result = new ExtraVO();
JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data")));
Map<String,Object> params = new HashMap<>(5);
params.put("faultId",data.getString("fault_id"));
params.put("name",data.getString("fault_name"));
params.put("station",data.getString("station_id"));
params.put("fdpDeviceName",data.getString("device_name"));
params.put("fdpOrd",data.getString("ord"));
result.setParams(params);
result.setFunc(FuncRouteEnum.DIAGNOSE.getFuncCode());
result.setType(FunctionConstants.TypeEnum.PARAMS.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;
// }
private ExtraVO resolveChooseVideo(Map<String,Object> extra) {
ExtraVO result = new ExtraVO();
JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data")));
if(data.containsKey("videos")) {
List<JSONObject> videoIds = JSONArray.parseArray(JSON.toJSONString(data.get("videos")), JSONObject.class);
List<VideoSelectionVO> selections = videoIds.stream().map(video -> {
R<StationVideoTypeEntity> videoR = videoTypeClient.getById(Long.valueOf(video.getString("id")));
VideoSelectionVO selectionVO = new VideoSelectionVO();
if (videoR.isSuccess() && Func.isNotEmpty(videoR.getData())) {
selectionVO.setId(video.getString("id"));
selectionVO.setName(videoR.getData().getName());
}
return selectionVO;
}).collect(Collectors.toList());
result.setFunc(FuncRouteEnum.CHOOSE_VIDEO.getFuncCode());
result.setSpecial(true);
result.setSelection(selections);
}
result.setType(FunctionConstants.TypeEnum.CHOOSE.getType());
return result;
}
private ExtraVO resolveChooseScada(Map<String,Object> extra) {
ExtraVO result = new ExtraVO();
JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data")));
if(data.containsKey("canvases")) {
List<JSONObject> canvases = JSONArray.parseArray(JSON.toJSONString(data.get("canvases")), JSONObject.class);
List<ScadaSelectionVO> selections = canvases.stream().map(canvas -> {
ScadaSelectionVO selectionVO = new ScadaSelectionVO();
Map<String, String> resolve = jumpRouteJoinStrategy.resolve(canvas.getString("id"), JumpRouteJoinStrategy.SCADA_PARAMS_SOLVE);
selectionVO.setId(canvas.getString("id"));
selectionVO.setName(resolve.get("name"));
return selectionVO;
}).collect(Collectors.toList());
result.setFunc(FuncRouteEnum.CHOOSE_CANVAS.getFuncCode());
result.setSpecial(true);
result.setSelection(selections);
}
result.setType(FunctionConstants.TypeEnum.CHOOSE.getType());
return result;
}
}

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

@ -1,73 +0,0 @@
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
@Deprecated
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;
}
public 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());
extraVO.setImmediatelyJump(true);
extraVO.setFunc(FuncRouteEnum.OPEN_VIDEO.getFuncCode());
Map<String,Object> params = new HashMap<>();
params.put("name", video.getName());
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;
}
}

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

@ -1,36 +0,0 @@
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
@Deprecated
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/inspect/src/main/java/com/hnac/hzinfo/inspect/config/XxlJobConfig.java

@ -41,7 +41,7 @@ public class XxlJobConfig {
log.info(">>>>>>>>>>> xxl-job config init."); log.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses); xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppname(appName); xxlJobSpringExecutor.setAppName(appName);
xxlJobSpringExecutor.setIp(ip); xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port); xxlJobSpringExecutor.setPort(port);
System.out.println(">>>>>>>>>>> xxl-rpc, port " + port); System.out.println(">>>>>>>>>>> xxl-rpc, port " + port);

12
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java

@ -2,7 +2,6 @@ package com.hnac.hzinfo.inspect.task.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -10,9 +9,9 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.safeproduct.Constants; import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.entity.ImsMonCameraInfoEntity; import com.hnac.hzims.safeproduct.entity.ImsMonCameraInfoEntity;
import com.hnac.hzims.safeproduct.feign.IImsMonCameraInfoClient; import com.hnac.hzims.safeproduct.feign.IImsMonCameraInfoClient;
@ -39,9 +38,6 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
@ -56,7 +52,6 @@ import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -66,7 +61,6 @@ import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -104,8 +98,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, TaskEntity> impleme
@Autowired @Autowired
private PlanMapper planMapper; private PlanMapper planMapper;
@Autowired @Autowired
private BladeLogger logger;
@Autowired
private TaskNoUserDataScopeMapper taskNoUserDataScopeMapper; private TaskNoUserDataScopeMapper taskNoUserDataScopeMapper;
/** /**
@ -251,7 +243,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, TaskEntity> impleme
TaskUserEntity userEntity = CollectionUtil.isNotEmpty(claimUsers) ? claimUsers.get(0) : null; TaskUserEntity userEntity = CollectionUtil.isNotEmpty(claimUsers) ? claimUsers.get(0) : null;
if (Func.isNotEmpty(userEntity)) { if (Func.isNotEmpty(userEntity)) {
if(AuthUtil.getUserId().equals(userEntity.getUserId())) { if(AuthUtil.getUserId().equals(userEntity.getUserId())) {
logger.error("hzims:inspect:startTask:taskUser","任务id[" +id+ "]领用人员为:" + JSON.toJSONString(claimUsers)); //logger.error("hzims:inspect:startTask:taskUser","任务id[" +id+ "]领用人员为:" + JSON.toJSONString(claimUsers));
} }
else { else {
removeStartTaskId(id); removeStartTaskId(id);

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/config/XxlJobConfig.java

@ -42,8 +42,7 @@ public class XxlJobConfig {
log.info(">>>>>>>>>>> xxl-job config init."); log.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses); xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
// xxlJobSpringExecutor.setAppName(appName); xxlJobSpringExecutor.setAppName(appName);
xxlJobSpringExecutor.setAppname(appName);
xxlJobSpringExecutor.setIp(ip); xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port); xxlJobSpringExecutor.setPort(port);
System.out.println(">>>>>>>>>>> xxl-rpc, port " + port); System.out.println(">>>>>>>>>>> xxl-rpc, port " + port);

9
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/impl/InnerDangerFlowServiceImpl.java

@ -118,6 +118,15 @@ public class InnerDangerFlowServiceImpl extends ServiceImpl<InnerDangerMapper, I
} }
@Override @Override
public R startProcess(String entity, String dictValue, String param) {
return null;
}
@Override
public R compensationProcess(String id) {
return null;
}
public R startProcess(String entity, String dictValue) { public R startProcess(String entity, String dictValue) {
InnerDangerVo innerDangerVo = JSONObject.parseObject(entity, InnerDangerVo.class); InnerDangerVo innerDangerVo = JSONObject.parseObject(entity, InnerDangerVo.class);
InnerDangerEntity innerDangerEntity = new InnerDangerEntity(); InnerDangerEntity innerDangerEntity = new InnerDangerEntity();

9
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/repair/service/impl/WorkTaskServiceImpl.java

@ -83,7 +83,7 @@ public class WorkTaskServiceImpl extends ServiceImpl<WorkTaskMapper, WorkTaskEnt
// 步骤1.保存工作任务单 // 步骤1.保存工作任务单
String saved = this.saveEntity(JSON.toJSONString(workTask)); String saved = this.saveEntity(JSON.toJSONString(workTask));
// 步骤2.开启检修计划流程 // 步骤2.开启检修计划流程
R r = this.startProcess(saved, "work_task"); R r = this.startProcess(saved, "work_task","");
return r; return r;
} }
@ -121,7 +121,12 @@ public class WorkTaskServiceImpl extends ServiceImpl<WorkTaskMapper, WorkTaskEnt
} }
@Override @Override
public R startProcess(String entity, String dictValue) { public R compensationProcess(String id) {
return null;
}
@Override
public R startProcess(String entity, String dictValue,String param) {
WorkTaskVO workTask= JSONObject.parseObject(entity, WorkTaskVO.class); WorkTaskVO workTask= JSONObject.parseObject(entity, WorkTaskVO.class);
Map<String, Object> variables = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(workTask, DateUtil.PATTERN_DATETIME), Map.class); Map<String, Object> variables = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(workTask, DateUtil.PATTERN_DATETIME), Map.class);
variables.put("head", TaskUtil.getTaskUser(String.valueOf(workTask.getHead()))); variables.put("head", TaskUtil.getTaskUser(String.valueOf(workTask.getHead())));

9
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java

@ -111,7 +111,7 @@ public class OperationTicketServiceImpl implements OperationTicketService , Star
throw new ServiceException("服务器异常,请联系管理员"); throw new ServiceException("服务器异常,请联系管理员");
} }
//启动流程 //启动流程
return this.startProcess(standardTicketInfoVoBySave, dictValue); return this.startProcess(standardTicketInfoVoBySave, dictValue,"");
} }
@Override @Override
public String saveEntity(String entity) { public String saveEntity(String entity) {
@ -167,7 +167,7 @@ public class OperationTicketServiceImpl implements OperationTicketService , Star
@Override @Override
public R startProcess(String entity, String dictValue) { public R startProcess(String entity, String dictValue,String param) {
StandardTicketInfoVo standardTicketInfoVo= JSONObject.parseObject(entity, StandardTicketInfoVo.class); StandardTicketInfoVo standardTicketInfoVo= JSONObject.parseObject(entity, StandardTicketInfoVo.class);
StandardTicketInfoEntity standardTicketInfoEntity = getStandardTicketInfoEntity(standardTicketInfoVo); StandardTicketInfoEntity standardTicketInfoEntity = getStandardTicketInfoEntity(standardTicketInfoVo);
Instant start = Instant.now(); Instant start = Instant.now();
@ -197,6 +197,11 @@ public class OperationTicketServiceImpl implements OperationTicketService , Star
return R.success("启动流程成功"); return R.success("启动流程成功");
} }
@Override
public R compensationProcess(String id) {
return null;
}
/** /**
* 待处理 * 待处理
* *

36
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java

@ -176,9 +176,7 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
throw new ServiceException("服务器异常,请联系管理员"); throw new ServiceException("服务器异常,请联系管理员");
} }
//开启动作流 //开启动作流
R r = this.startProcess(saveEntity, dictValue); R r = this.startProcess(saveEntity, dictValue,"");
// //处理任务--老版本业务要求,2024/07/05弃用
// this.returnTicket(workTicketVo);
return r; return r;
} }
@ -235,8 +233,9 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
return JSONObject.toJSONString(workTicketVo); return JSONObject.toJSONString(workTicketVo);
} }
@Override @Override
public R startProcess(String entity, String dictValue) { public R startProcess(String entity, String dictValue, String param) {
WorkTicketVo workTicketVo= JSONObject.parseObject(entity, WorkTicketVo.class); WorkTicketVo workTicketVo= JSONObject.parseObject(entity, WorkTicketVo.class);
WorkTicketInfoEntity workTicket = getWorkTicketInfo(workTicketVo.getWorkTicket()); WorkTicketInfoEntity workTicket = getWorkTicketInfo(workTicketVo.getWorkTicket());
workTicketVo.setWorkTicket(workTicket); workTicketVo.setWorkTicket(workTicket);
@ -283,6 +282,12 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
log.info("================================================================"); log.info("================================================================");
return R.success("启动流程成功"); return R.success("启动流程成功");
} }
@Override
public R compensationProcess(String id) {
return null;
}
/** /**
* 验证是走那种工作票流程默认走第一种工作票 * 验证是走那种工作票流程默认走第一种工作票
* *
@ -307,29 +312,6 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc
return dictValue; return dictValue;
} }
// @Transactional
// public void findPendingV2(ProcessWorkFlowResponse response) {
// FristWorkTicketVo ticketResponse = JSONObject.parseObject(JSON.toJSONString(response.getVariables()), FristWorkTicketVo.class);
// // 获取工作票信息
// WorkTicketVo workTicketVo = ticketResponse.getWorkTicketVo();
// // 基础信息获取
// WorkTicketInfoEntity workTicket = workTicketVo.getWorkTicket();
// this.
// }
//
// private void updateTicketByFlow(WorkTicketInfoEntity workTicket,ProcessWorkFlowResponse response) {
// //更新工作票
// WorkTicketInfoEntity info = ticketInfoService.getById(Long.valueOf(response.getBusinessKey()));
// workTicket.setId(info.getId());
// workTicket.setCreateDept(info.getCreateDept());
// workTicket.setCreateDept(info.getCreateDept());
// workTicket.setCreateUser(info.getCreateUser());
// workTicket.setTenantId(info.getTenantId());
// workTicket.setProcessInstanceId(response.getProcessInstanceId());
//
// workTicketInfoService.updateById(workTicket);
// }
/** /**
* 待处理 * 待处理

2
hzims-service/weather/src/main/java/com/hnac/hzims/weather/config/XxlJobConfig.java

@ -42,7 +42,7 @@ public class XxlJobConfig {
log.info(">>>>>>>>>>> xxl-job config init."); log.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses); xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppname(appName); xxlJobSpringExecutor.setAppName(appName);
xxlJobSpringExecutor.setIp(ip); xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port); xxlJobSpringExecutor.setPort(port);
System.out.println(">>>>>>>>>>> xxl-rpc, port " + port); System.out.println(">>>>>>>>>>> xxl-rpc, port " + port);

25
pom.xml

@ -58,11 +58,11 @@
<version>${data.sdk.version}</version> <version>${data.sdk.version}</version>
</dependency> </dependency>
<!-- <dependency>--> <dependency>
<!-- <groupId>com.xuxueli</groupId>--> <groupId>com.xuxueli</groupId>
<!-- <artifactId>xxl-job-core</artifactId>--> <artifactId>xxl-job-core</artifactId>
<!-- <version>2.1.2</version>--> <version>2.1.2</version>
<!-- </dependency>--> </dependency>
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId> <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
@ -77,6 +77,16 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<artifactId>alarm-api</artifactId>
<version>${hzims.project.version}</version>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>big-model-api</artifactId>
<version>${hzims.project.version}</version>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>basic-api</artifactId> <artifactId>basic-api</artifactId>
<version>${hzims.project.version}</version> <version>${hzims.project.version}</version>
</dependency> </dependency>
@ -200,11 +210,6 @@
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

Loading…
Cancel
Save