diff --git a/hzims-service/equipment/src/main/resources/template/template.yml b/hzims-service/equipment/src/main/resources/template/template.yml index 9a1ce0d..034416c 100644 --- a/hzims-service/equipment/src/main/resources/template/template.yml +++ b/hzims-service/equipment/src/main/resources/template/template.yml @@ -79,7 +79,6 @@ fdp: tenantId: 200000 service: url: http://192.168.60.70:8086 - # url: 140.210.218.236 hzinfo: model: diff --git a/hzims-service/hzims-alarm/pom.xml b/hzims-service/hzims-alarm/pom.xml index 29d6fbc..5cba776 100644 --- a/hzims-service/hzims-alarm/pom.xml +++ b/hzims-service/hzims-alarm/pom.xml @@ -32,8 +32,6 @@ com.hnac.hzims alarm-api - 4.0.0-SNAPSHOT - compile com.hnac.hzims diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java index 9f0c30f..b114c17 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java +++ b/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; -import com.baomidou.mybatisplus.core.metadata.IPage; 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.show.vo.AlarmVideoVo; import com.hnac.hzims.alarm.show.vo.ShowQueryVo; 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 java.util.List; diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java index 4258fa6..d976531 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java +++ b/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.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.entity.AlarmEntity; 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.service.AlarmHandleService; 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.business.ws.alart.vo.AlartParamVo; import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.EmVideoBandingEntity; import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzims.equipment.feign.IEmVideoClient; -import com.hnac.hzims.message.dto.MailMessageDTO; -import com.hnac.hzims.message.fegin.IMessageClient; +import com.hnac.hzims.fdp.util.HttpRequestUtil; 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.v5.device.client.DeviceClient; 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.DeviceInstanceFuncVO; 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.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; +import org.springblade.message.fegin.IMessageClient; import org.springblade.system.user.feign.IUserClient; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -252,36 +245,6 @@ public class AlarmServiceImpl extends ServiceImpl impl return new TextMessage(JSONObject.toJSONString(alarms.stream().sorted(Comparator.comparing(AlarmEntity::getAlarmTime).reversed()).collect(Collectors.toList()))); } - - /* @Override - public List getVideosByStationAndRealId(String stationCode, String realId) { - R 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> emListR = emInfoClient.emInfoList(emReq); - Assert.isTrue(emListR.isSuccess() && CollectionUtil.isNotEmpty(emListR.getData()), () -> { - throw new ServiceException("该站点未获取到设备!"); - }); - List 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> videoListR = emVideoClient.getEmBandingVideos(emCodes); - Assert.isTrue(videoListR.isSuccess(), () -> { - throw new ServiceException("获取设备绑定视频列表失败!"); - }); - return videoListR.getData().stream().distinct().collect(Collectors.toList()); - }*/ - /** * 验证设备编号是否绑定视频 * @param emInfo 设备信息 @@ -403,4 +366,164 @@ public class AlarmServiceImpl extends ServiceImpl impl } return new ArrayList<>(); } + + /** + * 获取告警视频信息 + * @param stationCode + * @param deviceCode + * @param realId + * @return + */ + @Override + public List 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 stationVideos(String stationCode) { + List 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 deviceVideos(String stationCode,String deviceCode) { + // 查询设备绑定视频点位 + R> videos = emVideoClient.getEmBandingVideos(deviceCode); + if(!videos.isSuccess() || CollectionUtil.isEmpty(videos.getData())){ + // 查询站点 + R station = stationClient.getStationByCode(stationCode); + if(!station.isSuccess() || ObjectUtil.isEmpty(station.getData())){ + throw new ServiceException("未查询到设备绑定视频信息!"); + } + // 查询设备 + R 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 earlyVideos(String stationCode, String faultId) { + // 调用FDP接口查询设备编号 + Map param = new HashMap<>(); + param.put("faultId", faultId); + String result = HttpRequestUtil.postCall(param, FAULTGRAPH_INFO_PATH, "POST"); + if (StringUtil.isBlank(result)) { + throw new ServiceException("未查询到智能预警设备信息!"); + } + HashMap map = JSONObject.parseObject(result, new TypeReference>() { + }); + if (ObjectUtil.isEmpty(map)) { + throw new ServiceException("未查询到智能预警设备信息!"); + } + List> data = JSONObject.parseObject(MapUtils.getString(map, "data"), new TypeReference>>() { + }); + 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 realIdVideos(String stationCode, String realId) { + // 查询站点 + R station = stationClient.getStationByCode(stationCode); + if(!station.isSuccess() || ObjectUtil.isEmpty(station)){ + throw new ServiceException("未查询到告警采集点绑定视频信息!"); + } + EmInfoEntity param = new EmInfoEntity(); + param.setDepartment(station.getData().getRefDept()); + // 查询设备 + R> 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> 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()); + } } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java index 2e68772..21a8d5d 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/MessageServiceImpl.java +++ b/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.source.service.MessageService; 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.feign.IStationClient; import lombok.RequiredArgsConstructor; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/data/controller/RemoteController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/data/controller/RemoteController.java deleted file mode 100644 index c420ba7..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/data/controller/RemoteController.java +++ /dev/null @@ -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 sendRemoteControl(ControlDTO controlDTO) { - return remoteService.sendRemoteControl(controlDTO); - } - -} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/data/service/HistoryDataService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/data/service/HistoryDataService.java deleted file mode 100644 index a9f854c..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/data/service/HistoryDataService.java +++ /dev/null @@ -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 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)); - } - } - -} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/data/service/RemoteService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/data/service/RemoteService.java deleted file mode 100644 index 551a10b..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/data/service/RemoteService.java +++ /dev/null @@ -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 sendRemoteControl(ControlDTO controlDTO) { - return remoteClient.sendCtrl(controlDTO); - } - -} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/controller/DataSourceExecuteController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/controller/DataSourceExecuteController.java deleted file mode 100644 index 84172fe..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/controller/DataSourceExecuteController.java +++ /dev/null @@ -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)); - } - -} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/DataSourceService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/DataSourceService.java deleted file mode 100644 index d858de3..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/DataSourceService.java +++ /dev/null @@ -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> 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(); - } - -} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/IDataSourceService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/IDataSourceService.java deleted file mode 100644 index 1f0e802..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/datasource/service/IDataSourceService.java +++ /dev/null @@ -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> queryList(String sql); - -} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/AnalyseDataController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/AnalyseDataController.java deleted file mode 100644 index d09637f..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/AnalyseDataController.java +++ /dev/null @@ -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)); - } -} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IParamsService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IParamsService.java deleted file mode 100644 index f39a0fb..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IParamsService.java +++ /dev/null @@ -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 args); - -} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java deleted file mode 100644 index f34088b..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java +++ /dev/null @@ -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 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 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> 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> ctrlAuthR = remoteClient.getCtrlAuth(Optional.ofNullable(userId).filter(StringUtil::isNotBlank).map(Long::parseLong).orElse(null)); - Assert.isTrue(ctrlAuthR.isSuccess(),() -> { - throw new ServiceException("该站点未设置鉴权用户,校验失败!"); - }); - List ctrlAuthList = ctrlAuthR.getData(); - Optional 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 getStationPermissionsById(String userId) { - R> deptSattionR = deptClient.getStationPermissionsById(Long.valueOf(userId)); - Assert.isTrue(deptSattionR.isSuccess() && CollectionUtil.isNotEmpty(deptSattionR.getData()),() -> { - throw new ServiceException("获取人员站点权限失败!"); - }); - return deptSattionR.getData(); - } - -} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java deleted file mode 100644 index 05f54db..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java +++ /dev/null @@ -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 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 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 param = new HashMap(1); - param.put("data", data); - result.setParams(param); - return result; - } - - @Deprecated - private ExtraVO resolveConfirmRemote(Map 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 funcVOR = deviceClient.getFuncById(remoteParam.getFuncId()); - if(funcVOR.isSuccess()) { - Map 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 extra) { -// ExtraVO result = new ExtraVO(); -// JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); -// if(data.containsKey("faults")) { -// List 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 extra) { - ExtraVO result = new ExtraVO(); - JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); - Map 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 extra) { -// ExtraVO result = new ExtraVO(); -// JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); -// if(data.containsKey("stations")) { -// List stations = JSONArray.parseArray(JSON.toJSONString(data.get("stations")), String.class); -// List selectionList = stations.stream().map(stationId -> { -// StationSelectionVO selectionVO = new StationSelectionVO(); -// R 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 extra) { - ExtraVO result = new ExtraVO(); - JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); - if(data.containsKey("videos")) { - List videoIds = JSONArray.parseArray(JSON.toJSONString(data.get("videos")), JSONObject.class); - List selections = videoIds.stream().map(video -> { - R 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 extra) { - ExtraVO result = new ExtraVO(); - JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); - if(data.containsKey("canvases")) { - List canvases = JSONArray.parseArray(JSON.toJSONString(data.get("canvases")), JSONObject.class); - List selections = canvases.stream().map(canvas -> { - ScadaSelectionVO selectionVO = new ScadaSelectionVO(); - Map 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; - } -} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java deleted file mode 100644 index e2a37b2..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java +++ /dev/null @@ -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 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 args) { - // 跳转页面逻辑 - ExtraVO extraVO = new ExtraVO(); - String id = args.get("canvas_id"); - if(StringUtil.isNotBlank(id) && Func.isNotEmpty(id)) { - R 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 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; - } -} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamsServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamsServiceImpl.java deleted file mode 100644 index 7d134e1..0000000 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamsServiceImpl.java +++ /dev/null @@ -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 args) { - // 跳转页面逻辑 - ExtraVO extraVO = strategy.resolve(function,args); - return JSON.toJSONString(extraVO); - } -} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/XxlJobConfig.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/XxlJobConfig.java index 93d9e3a..0c5a7a2 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/config/XxlJobConfig.java +++ b/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."); XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); xxlJobSpringExecutor.setAdminAddresses(adminAddresses); - xxlJobSpringExecutor.setAppname(appName); + xxlJobSpringExecutor.setAppName(appName); xxlJobSpringExecutor.setIp(ip); xxlJobSpringExecutor.setPort(port); System.out.println(">>>>>>>>>>> xxl-rpc, port " + port); diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java index 3e740ea..60a9e55 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java +++ b/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.JSONObject; -import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.collect.Lists; 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.entity.ImsMonCameraInfoEntity; import com.hnac.hzims.safeproduct.feign.IImsMonCameraInfoClient; @@ -39,9 +38,6 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; 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.Query; 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.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -66,7 +61,6 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; -import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; /** @@ -104,8 +98,6 @@ public class TaskServiceImpl extends ServiceImpl impleme @Autowired private PlanMapper planMapper; @Autowired - private BladeLogger logger; - @Autowired private TaskNoUserDataScopeMapper taskNoUserDataScopeMapper; /** @@ -251,7 +243,7 @@ public class TaskServiceImpl extends ServiceImpl impleme TaskUserEntity userEntity = CollectionUtil.isNotEmpty(claimUsers) ? claimUsers.get(0) : null; if (Func.isNotEmpty(userEntity)) { 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 { removeStartTaskId(id); diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/config/XxlJobConfig.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/config/XxlJobConfig.java index 5b8c3d2..bdde330 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/config/XxlJobConfig.java +++ b/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."); XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); xxlJobSpringExecutor.setAdminAddresses(adminAddresses); -// xxlJobSpringExecutor.setAppName(appName); - xxlJobSpringExecutor.setAppname(appName); + xxlJobSpringExecutor.setAppName(appName); xxlJobSpringExecutor.setIp(ip); xxlJobSpringExecutor.setPort(port); System.out.println(">>>>>>>>>>> xxl-rpc, port " + port); diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/impl/InnerDangerFlowServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/impl/InnerDangerFlowServiceImpl.java index 6efee20..b7a69b8 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/impl/InnerDangerFlowServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/flow/service/impl/InnerDangerFlowServiceImpl.java @@ -118,6 +118,15 @@ public class InnerDangerFlowServiceImpl extends ServiceImpl variables = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(workTask, DateUtil.PATTERN_DATETIME), Map.class); variables.put("head", TaskUtil.getTaskUser(String.valueOf(workTask.getHead()))); diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java index 06955a9..ae1a55d 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java +++ b/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("服务器异常,请联系管理员"); } //启动流程 - return this.startProcess(standardTicketInfoVoBySave, dictValue); + return this.startProcess(standardTicketInfoVoBySave, dictValue,""); } @Override public String saveEntity(String entity) { @@ -167,7 +167,7 @@ public class OperationTicketServiceImpl implements OperationTicketService , Star @Override - public R startProcess(String entity, String dictValue) { + public R startProcess(String entity, String dictValue,String param) { StandardTicketInfoVo standardTicketInfoVo= JSONObject.parseObject(entity, StandardTicketInfoVo.class); StandardTicketInfoEntity standardTicketInfoEntity = getStandardTicketInfoEntity(standardTicketInfoVo); Instant start = Instant.now(); @@ -197,6 +197,11 @@ public class OperationTicketServiceImpl implements OperationTicketService , Star return R.success("启动流程成功"); } + @Override + public R compensationProcess(String id) { + return null; + } + /** * 待处理 * diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java index 5c47f1e..a5fe953 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java +++ b/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("服务器异常,请联系管理员"); } //开启动作流 - R r = this.startProcess(saveEntity, dictValue); -// //处理任务--老版本业务要求,2024/07/05弃用 -// this.returnTicket(workTicketVo); + R r = this.startProcess(saveEntity, dictValue,""); return r; } @@ -235,8 +233,9 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc return JSONObject.toJSONString(workTicketVo); } + @Override - public R startProcess(String entity, String dictValue) { + public R startProcess(String entity, String dictValue, String param) { WorkTicketVo workTicketVo= JSONObject.parseObject(entity, WorkTicketVo.class); WorkTicketInfoEntity workTicket = getWorkTicketInfo(workTicketVo.getWorkTicket()); workTicketVo.setWorkTicket(workTicket); @@ -283,6 +282,12 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc log.info("================================================================"); return R.success("启动流程成功"); } + + @Override + public R compensationProcess(String id) { + return null; + } + /** * 验证是走那种工作票流程,默认走第一种工作票 * @@ -307,29 +312,6 @@ public class TicketProcessServiceImpl implements TicketProcessService, StartProc 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); -// } - /** * 待处理 diff --git a/hzims-service/weather/src/main/java/com/hnac/hzims/weather/config/XxlJobConfig.java b/hzims-service/weather/src/main/java/com/hnac/hzims/weather/config/XxlJobConfig.java index 1d65b1e..2c12319 100644 --- a/hzims-service/weather/src/main/java/com/hnac/hzims/weather/config/XxlJobConfig.java +++ b/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."); XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); xxlJobSpringExecutor.setAdminAddresses(adminAddresses); - xxlJobSpringExecutor.setAppname(appName); + xxlJobSpringExecutor.setAppName(appName); xxlJobSpringExecutor.setIp(ip); xxlJobSpringExecutor.setPort(port); System.out.println(">>>>>>>>>>> xxl-rpc, port " + port); diff --git a/pom.xml b/pom.xml index bcb7efb..0e1de2d 100644 --- a/pom.xml +++ b/pom.xml @@ -58,11 +58,11 @@ ${data.sdk.version} - - - - - + + com.xuxueli + xxl-job-core + 2.1.2 + com.baomidou dynamic-datasource-spring-boot-starter @@ -77,6 +77,16 @@ com.hnac.hzims + alarm-api + ${hzims.project.version} + + + com.hnac.hzims + big-model-api + ${hzims.project.version} + + + com.hnac.hzims basic-api ${hzims.project.version} @@ -200,11 +210,6 @@ org.projectlombok lombok - - org.springblade - blade-core-test - test -