diff --git a/event_smart/pom.xml b/event_smart/pom.xml index 888ecabb..d37fe80a 100644 --- a/event_smart/pom.xml +++ b/event_smart/pom.xml @@ -64,13 +64,9 @@ 21.6.0.0 - com.oracle.database.nls - orai18n - 21.1.0.0 - @@ -98,6 +94,29 @@ runtime + + com.njcn + common-event + 1.0.0 + + + common-microservice + com.njcn + + + common-web + com.njcn + + + + + + com.google.guava + guava + 32.1.3-jre + + + diff --git a/event_smart/src/main/java/com/njcn/gather/event/EventSmartApplication.java b/event_smart/src/main/java/com/njcn/gather/event/EventSmartApplication.java index 48b6c3ae..c6746a64 100644 --- a/event_smart/src/main/java/com/njcn/gather/event/EventSmartApplication.java +++ b/event_smart/src/main/java/com/njcn/gather/event/EventSmartApplication.java @@ -1,12 +1,17 @@ package com.njcn.gather.event; +import com.njcn.event.file.component.WavePicComponent; import lombok.extern.slf4j.Slf4j; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.FilterType; @Slf4j -@SpringBootApplication +@SpringBootApplication(scanBasePackages = "com.njcn") +//@ComponentScan(excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = WavePicComponent.class)) @MapperScan("com.njcn.**.mapper") public class EventSmartApplication { diff --git a/event_smart/src/main/java/com/njcn/gather/event/devcie/mapper/mapping/PqDeviceMapper.xml b/event_smart/src/main/java/com/njcn/gather/event/devcie/mapper/mapping/PqDeviceMapper.xml index 17045c94..b041b537 100644 --- a/event_smart/src/main/java/com/njcn/gather/event/devcie/mapper/mapping/PqDeviceMapper.xml +++ b/event_smart/src/main/java/com/njcn/gather/event/devcie/mapper/mapping/PqDeviceMapper.xml @@ -32,8 +32,9 @@ select pq_device.dev_index devId, pq_device.name devName, - PQ_SUBVOLTAGE.SUBV_INDEX busBarId, - PQ_SUBVOLTAGE.name busBarName, + pq_device.UpdateTime updateTime, + pq_device.DevFlag devFlag, + pq_device.IP ip, PQ_SUBSTATION.sub_index stationId, PQ_SUBSTATION.name stationName, PQ_GDINFORMATION.Name gdName @@ -43,8 +44,7 @@ PQ_SUBSTATION, PQ_GDINFORMATION where - PQ_SUBVOLTAGE.DEV_INDEX = pq_device.DEV_INDEX - and pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX + pq_device.SUB_INDEX = PQ_SUBSTATION.SUB_INDEX and pq_device.GD_INDEX =PQ_GDINFORMATION.GD_INDEX and pq_device.DEV_INDEX in diff --git a/event_smart/src/main/java/com/njcn/gather/event/devcie/pojo/dto/DeviceDTO.java b/event_smart/src/main/java/com/njcn/gather/event/devcie/pojo/dto/DeviceDTO.java index 5ee6941d..3d2d2500 100644 --- a/event_smart/src/main/java/com/njcn/gather/event/devcie/pojo/dto/DeviceDTO.java +++ b/event_smart/src/main/java/com/njcn/gather/event/devcie/pojo/dto/DeviceDTO.java @@ -1,7 +1,10 @@ package com.njcn.gather.event.devcie.pojo.dto; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import java.time.LocalDateTime; + /** * Description: * Date: 2025/06/27 下午 3:25【需求编号】 @@ -13,10 +16,12 @@ import lombok.Data; public class DeviceDTO { private Integer devId; private String devName; - private Integer busBarId; - private String busBarName; private Integer stationId; private String stationName; private String gdName; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + private String devFlag; + private String ip; private Integer runFlag=0; } diff --git a/event_smart/src/main/java/com/njcn/gather/event/transientes/controller/EventGateController.java b/event_smart/src/main/java/com/njcn/gather/event/transientes/controller/EventGateController.java index 735ab97d..a58041a7 100644 --- a/event_smart/src/main/java/com/njcn/gather/event/transientes/controller/EventGateController.java +++ b/event_smart/src/main/java/com/njcn/gather/event/transientes/controller/EventGateController.java @@ -1,11 +1,25 @@ package com.njcn.gather.event.transientes.controller; +import cn.hutool.core.collection.CollUtil; import cn.hutool.json.JSONObject; import com.njcn.common.pojo.annotation.OperateInfo; +import com.njcn.common.pojo.enums.common.LogEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.response.HttpResult; +import com.njcn.event.file.pojo.dto.WaveDataDTO; +import com.njcn.gather.event.devcie.mapper.PqLineMapper; +import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO; +import com.njcn.gather.event.devcie.pojo.po.PqLine; import com.njcn.gather.event.devcie.pojo.po.PqsDeptsline; import com.njcn.gather.event.devcie.service.PqsDeptslineService; +import com.njcn.gather.event.transientes.pojo.param.MonitorTerminalParam; +import com.njcn.gather.event.transientes.pojo.po.PqsDepts; +import com.njcn.gather.event.transientes.pojo.po.PqsUser; +import com.njcn.gather.event.transientes.pojo.po.PqsUserSet; +import com.njcn.gather.event.transientes.service.EventGateService; +import com.njcn.gather.event.transientes.service.PqsDeptsService; +import com.njcn.gather.event.transientes.service.PqsUserService; +import com.njcn.gather.event.transientes.service.PqsUsersetService; import com.njcn.gather.event.transientes.websocket.WebSocketServer; import com.njcn.web.controller.BaseController; import com.njcn.web.utils.HttpResultUtil; @@ -14,9 +28,18 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.formula.functions.T; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + /** * @Author: cdf * @CreateTime: 2025-06-23 @@ -35,26 +58,105 @@ public class EventGateController extends BaseController { private final PqsDeptslineService pqsDeptslineService; + private final PqsDeptsService pqsDeptsService; + + private final PqsUserService pqsUserService; + + private final PqsUsersetService pqsUsersetService; + + private final PqLineMapper pqLineMapper; + private final EventGateService eventGateService; + + @OperateInfo @GetMapping("/eventMsg") @ApiOperation("接收远程推送的暂态事件") @ApiImplicitParam(name = "eventMsg", value = "暂态事件json字符", required = true) public HttpResult eventMsg(@RequestParam("msg") String msg) { + System.out.println(msg); String methodDescribe = getMethodDescribe("eventMsg"); - webSocketServer.sendMessageToAll(msg); + JSONObject jsonObject; + try { + jsonObject = new JSONObject(msg); + webSocketServer.sendMessageToAll(msg); + + //开始发送短信 + sendMessage(jsonObject); + }catch (Exception e){ + log.error("暂降json格式异常!{}",e.getMessage()); + } return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getTransientAnalyseWave") + @ApiOperation("暂态事件波形分析") + public HttpResult getTransientAnalyseWave(@RequestBody MonitorTerminalParam param){ + String methodDescribe = getMethodDescribe("getTransientAnalyseWave"); + WaveDataDTO wave = eventGateService.getTransientAnalyseWave(param); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, wave, methodDescribe); + } + + private void sendMessage(JSONObject jsonObject){ Integer lineId = Integer.valueOf(jsonObject.get("lineid").toString()); + List pqLineDept = pqsDeptslineService.lambdaQuery().eq(PqsDeptsline::getLineIndex,lineId).eq(PqsDeptsline::getSystype,sysTypeZt).list(); + Set deptIds = pqLineDept.stream().map(PqsDeptsline::getDeptsIndex).collect(Collectors.toSet()); + Set resultIds = getAllParentDeptIds(deptIds); + + List pqsUserSetList = pqsUsersetService.lambdaQuery().eq(PqsUserSet::getIsNotice,1).in(PqsUserSet::getDeptsIndex,resultIds).list(); + if(CollUtil.isEmpty(pqsUserSetList)){ + //当前事件未找到用户信息,判断为不需要发送短信用户 + return; + } + List pqsUserList = pqsUserService.lambdaQuery().select(PqsUser::getUserIndex).in(PqsUser::getUserIndex,pqsUserSetList.stream().map(PqsUserSet::getUserIndex).collect(Collectors.toList())).list(); + List userIds = pqsUserList.stream().map(PqsUser::getUserIndex).collect(Collectors.toList()); + List poList = pqsUserSetList.stream().filter(it->userIds.contains(it.getUserIndex())).collect(Collectors.toList()); + if(CollUtil.isNotEmpty(poList)){ + StringBuilder stringBuilder = new StringBuilder(jsonObject.get("timeid").toString()); + List list = pqLineMapper.getBaseLineInfo(Stream.of(lineId).collect(Collectors.toList())); + LedgerBaseInfoDTO ledgerBaseInfoDTO = list.get(0); + BigDecimal bigDecimal = new BigDecimal(jsonObject.get("eventvalue").toString()).multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP); + stringBuilder.append(".").append(jsonObject.get("ms").toString()).append(", ").append(ledgerBaseInfoDTO.getStationName()).append(ledgerBaseInfoDTO.getLineName()) + .append("发生暂降事件,事件特征幅值").append(bigDecimal).append("%,持续时间:").append(jsonObject.get("persisttime").toString()).append("S"); + //TODO 发送短信 + System.out.println(stringBuilder); + } + } - pqsDeptslineService.lambdaQuery().eq(PqsDeptsline::getLineIndex,lineId).eq(PqsDeptsline::getSystype,sysTypeZt); + public Set getAllParentDeptIds(Set deptIds) { + // 首次获取直接父级 + List allDeptList = pqsDeptsService.lambdaQuery().list(); + // 递归获取所有父级 + Set result = recursivelyGetParentIds(deptIds,allDeptList); + return result; + } + /** + * 递归获取所有父级ID + * @param currentParentIds 当前层级的父级ID集合 + * @return 所有层级的父级ID集合 + */ + private Set recursivelyGetParentIds(Set currentParentIds,List allDeptList) { + Set result = new HashSet<>(currentParentIds); + Set nextLevelParentIds = new HashSet<>(); + List parentDeptList = allDeptList.stream().filter(it->currentParentIds.contains(it.getDeptsIndex())).collect(Collectors.toList()); + for(PqsDepts pqsDepts: parentDeptList){ + if(!pqsDepts.getParentnodeid().equals("0")){ + nextLevelParentIds.add(pqsDepts.getParentnodeid()); + } + } + // 如果有更高层级的父级,继续递归 + if (!nextLevelParentIds.isEmpty()) { + Set deeperParentIds = recursivelyGetParentIds(nextLevelParentIds,allDeptList); + result.addAll(deeperParentIds); + } + return result; } diff --git a/event_smart/src/main/java/com/njcn/gather/event/transientes/handler/GlobalBusinessExceptionHandler.java b/event_smart/src/main/java/com/njcn/gather/event/transientes/handler/GlobalBusinessExceptionHandler.java index 67b60f3b..4f117f15 100644 --- a/event_smart/src/main/java/com/njcn/gather/event/transientes/handler/GlobalBusinessExceptionHandler.java +++ b/event_smart/src/main/java/com/njcn/gather/event/transientes/handler/GlobalBusinessExceptionHandler.java @@ -1,255 +1,255 @@ -package com.njcn.gather.event.transientes.handler; - -import cn.hutool.core.text.StrFormatter; -import cn.hutool.core.util.StrUtil; -import com.njcn.common.pojo.enums.response.CommonResponseEnum; -import com.njcn.common.pojo.exception.BusinessException; -import com.njcn.common.pojo.response.HttpResult; -import com.njcn.common.utils.LogUtil; -import com.njcn.web.utils.HttpResultUtil; -import com.njcn.web.utils.HttpServletUtil; -import com.njcn.web.utils.ReflectCommonUtil; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.json.JSONException; -import org.springframework.validation.ObjectError; -import org.springframework.web.HttpMediaTypeNotSupportedException; -import org.springframework.web.bind.MethodArgumentNotValidException; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.RestControllerAdvice; -import org.springframework.web.util.NestedServletException; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.validation.ConstraintViolation; -import javax.validation.ConstraintViolationException; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - * 全局通用业务异常处理器 - * - * @author hongawen - * @version 1.0.0 - * @date 2021年04月20日 18:04 - */ -@Slf4j -@AllArgsConstructor -@RestControllerAdvice -public class GlobalBusinessExceptionHandler { - - - - private final ThreadPoolExecutor executor = new ThreadPoolExecutor( - 4, 8, 30, TimeUnit.SECONDS, - new LinkedBlockingQueue<>(100), - // 队列满时由主线程执行 - new ThreadPoolExecutor.CallerRunsPolicy() - ); - - - /** - * 捕获业务功能异常,通常为业务数据抛出的异常 - * - * @param businessException 业务异常 - */ - @ExceptionHandler(BusinessException.class) - public HttpResult handleBusinessException(BusinessException businessException) { - String operate = ReflectCommonUtil.getMethodDescribeByException(businessException); - // recodeBusinessExceptionLog(businessException, businessException.getMessage()); - return HttpResultUtil.assembleBusinessExceptionResult(businessException, null, operate); - } - - - /** - * 空指针异常捕捉 - * - * @param nullPointerException 空指针异常 - */ - @ExceptionHandler(NullPointerException.class) - public HttpResult handleNullPointerException(NullPointerException nullPointerException) { - LogUtil.logExceptionStackInfo(CommonResponseEnum.NULL_POINTER_EXCEPTION.getMessage(), nullPointerException); - //recodeBusinessExceptionLog(nullPointerException, CommonResponseEnum.NULL_POINTER_EXCEPTION.getMessage()); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.NULL_POINTER_EXCEPTION, null, ReflectCommonUtil.getMethodDescribeByException(nullPointerException)); - } - - /** - * 算数运算异常 - * - * @param arithmeticException 算数运算异常,由于除数为0引起的异常 - */ - @ExceptionHandler(ArithmeticException.class) - public HttpResult handleArithmeticException(ArithmeticException arithmeticException) { - LogUtil.logExceptionStackInfo(CommonResponseEnum.ARITHMETIC_EXCEPTION.getMessage(), arithmeticException); - // recodeBusinessExceptionLog(arithmeticException, CommonResponseEnum.ARITHMETIC_EXCEPTION.getMessage()); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.ARITHMETIC_EXCEPTION, null, ReflectCommonUtil.getMethodDescribeByException(arithmeticException)); - } - - /** - * 类型转换异常捕捉 - * - * @param classCastException 类型转换异常 - */ - @ExceptionHandler(ClassCastException.class) - public HttpResult handleClassCastException(ClassCastException classCastException) { - LogUtil.logExceptionStackInfo(CommonResponseEnum.CLASS_CAST_EXCEPTION.getMessage(), classCastException); - // recodeBusinessExceptionLog(classCastException, CommonResponseEnum.CLASS_CAST_EXCEPTION.getMessage()); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.CLASS_CAST_EXCEPTION, null, ReflectCommonUtil.getMethodDescribeByException(classCastException)); - } - - - /** - * 索引下标越界异常捕捉 - * - * @param indexOutOfBoundsException 索引下标越界异常 - */ - @ExceptionHandler(IndexOutOfBoundsException.class) - public HttpResult handleIndexOutOfBoundsException(IndexOutOfBoundsException indexOutOfBoundsException) { - LogUtil.logExceptionStackInfo(CommonResponseEnum.INDEX_OUT_OF_BOUNDS_EXCEPTION.getMessage(), indexOutOfBoundsException); - // recodeBusinessExceptionLog(indexOutOfBoundsException, CommonResponseEnum.INDEX_OUT_OF_BOUNDS_EXCEPTION.getMessage()); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.INDEX_OUT_OF_BOUNDS_EXCEPTION, null, ReflectCommonUtil.getMethodDescribeByException(indexOutOfBoundsException)); - } - - /** - * 前端请求后端,请求中参数的媒体方式不支持异常 - * - * @param httpMediaTypeNotSupportedException 请求中参数的媒体方式不支持异常 - */ - @ExceptionHandler(HttpMediaTypeNotSupportedException.class) - public HttpResult httpMediaTypeNotSupportedExceptionHandler(HttpMediaTypeNotSupportedException httpMediaTypeNotSupportedException) { - LogUtil.logExceptionStackInfo(CommonResponseEnum.HTTP_MEDIA_TYPE_NOT_SUPPORTED_EXCEPTION.getMessage(), httpMediaTypeNotSupportedException); - // 然后提取错误提示信息进行返回 - // recodeBusinessExceptionLog(httpMediaTypeNotSupportedException, CommonResponseEnum.HTTP_MEDIA_TYPE_NOT_SUPPORTED_EXCEPTION.getMessage()); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.HTTP_MEDIA_TYPE_NOT_SUPPORTED_EXCEPTION, null, ReflectCommonUtil.getMethodDescribeByException(httpMediaTypeNotSupportedException)); - } - - /** - * 前端请求后端,参数校验异常捕捉 - * RequestBody注解参数异常 - * - * @param methodArgumentNotValidException 参数校验异常 - */ - @ExceptionHandler(MethodArgumentNotValidException.class) - public HttpResult methodArgumentNotValidExceptionHandler(MethodArgumentNotValidException methodArgumentNotValidException) { - // 从异常对象中拿到allErrors数据 - String messages = methodArgumentNotValidException.getBindingResult().getAllErrors() - .stream().map(ObjectError::getDefaultMessage).collect(Collectors.joining(";")); - // 然后提取错误提示信息进行返回 - LogUtil.njcnDebug(log, "参数校验异常,异常为:{}", messages); - // recodeBusinessExceptionLog(methodArgumentNotValidException, CommonResponseEnum.METHOD_ARGUMENT_NOT_VALID_EXCEPTION.getMessage()); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.METHOD_ARGUMENT_NOT_VALID_EXCEPTION, messages, ControllerUtil.getMethodArgumentNotValidException(methodArgumentNotValidException)); - } - - /** - * 前端请求后端,参数校验异常捕捉 - * PathVariable注解、RequestParam注解参数异常 - * - * @param constraintViolationException 参数校验异常 - */ - @ExceptionHandler(ConstraintViolationException.class) - public HttpResult constraintViolationExceptionExceptionHandler(ConstraintViolationException constraintViolationException) { - String exceptionMessage = constraintViolationException.getMessage(); - StringBuilder messages = new StringBuilder(); - if (exceptionMessage.indexOf(StrUtil.COMMA) > 0) { - String[] tempMessage = exceptionMessage.split(StrUtil.COMMA); - Stream.of(tempMessage).forEach(message -> { - messages.append(message.substring(message.indexOf(StrUtil.COLON) + 2)).append(';'); - }); - } else { - messages.append(exceptionMessage.substring(exceptionMessage.indexOf(StrUtil.COLON) + 2)); - } - // 然后提取错误提示信息进行返回 - LogUtil.njcnDebug(log, "参数校验异常,异常为:{}", messages); - // recodeBusinessExceptionLog(constraintViolationException, CommonResponseEnum.METHOD_ARGUMENT_NOT_VALID_EXCEPTION.getMessage()); - List> constraintViolationList = new ArrayList<>(constraintViolationException.getConstraintViolations()); - ConstraintViolation constraintViolation = constraintViolationList.get(0); - Class rootBeanClass = constraintViolation.getRootBeanClass(); - //判断校验参数异常捕获的根源是controller还是service处 - if (rootBeanClass.getName().endsWith("Controller")) { - String methodName = constraintViolation.getPropertyPath().toString().substring(0, constraintViolation.getPropertyPath().toString().indexOf(StrUtil.DOT)); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.METHOD_ARGUMENT_NOT_VALID_EXCEPTION, messages.toString(), ReflectCommonUtil.getMethodDescribeByClassAndMethodName(rootBeanClass, methodName)); - } else { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.METHOD_ARGUMENT_NOT_VALID_EXCEPTION, messages.toString(), ReflectCommonUtil.getMethodDescribeByException(constraintViolationException)); - } - - } - - - /** - * 索引下标越界异常捕捉 - * - * @param illegalArgumentException 参数校验异常 - */ - @ExceptionHandler(IllegalArgumentException.class) - public HttpResult handleIndexOutOfBoundsException(IllegalArgumentException illegalArgumentException) { - LogUtil.logExceptionStackInfo(CommonResponseEnum.ILLEGAL_ARGUMENT_EXCEPTION.getMessage(), illegalArgumentException); - // recodeBusinessExceptionLog(illegalArgumentException, CommonResponseEnum.ILLEGAL_ARGUMENT_EXCEPTION.getMessage()); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.ILLEGAL_ARGUMENT_EXCEPTION, illegalArgumentException.getMessage(), ReflectCommonUtil.getMethodDescribeByException(illegalArgumentException)); - } - - - /** - * 未声明异常捕捉 - * - * @param exception 未声明异常 - */ - @ExceptionHandler(Exception.class) - public HttpResult handleException(Exception exception) { - //针对fallbackFactory降级异常特殊处理 - Exception tempException = exception; - String exceptionCause = CommonResponseEnum.UN_DECLARE.getMessage(); - String code = CommonResponseEnum.UN_DECLARE.getCode(); - if (exception instanceof NestedServletException) { - Throwable cause = exception.getCause(); - if (cause instanceof AssertionError) { - if (cause.getCause() instanceof BusinessException) { - tempException = (BusinessException) cause.getCause(); - BusinessException tempBusinessException = (BusinessException) cause.getCause(); - exceptionCause = tempBusinessException.getMessage(); - code = tempBusinessException.getCode(); - } - } - } - LogUtil.logExceptionStackInfo(exceptionCause, tempException); - // recodeBusinessExceptionLog(exception, exceptionCause); - //判断方法上是否有自定义注解,做特殊处理 -// Method method = ReflectCommonUtil.getMethod(exception); -// if (!Objects.isNull(method)){ -// if(method.isAnnotationPresent(ReturnMsg.class)){ -// return HttpResultUtil.assembleResult(code, null, StrFormatter.format("{}",exceptionCause)); +//package com.njcn.gather.event.transientes.handler; +// +//import cn.hutool.core.text.StrFormatter; +//import cn.hutool.core.util.StrUtil; +//import com.njcn.common.pojo.enums.response.CommonResponseEnum; +//import com.njcn.common.pojo.exception.BusinessException; +//import com.njcn.common.pojo.response.HttpResult; +//import com.njcn.common.utils.LogUtil; +//import com.njcn.web.utils.HttpResultUtil; +//import com.njcn.web.utils.HttpServletUtil; +//import com.njcn.web.utils.ReflectCommonUtil; +//import lombok.AllArgsConstructor; +//import lombok.extern.slf4j.Slf4j; +//import org.json.JSONException; +//import org.springframework.validation.ObjectError; +//import org.springframework.web.HttpMediaTypeNotSupportedException; +//import org.springframework.web.bind.MethodArgumentNotValidException; +//import org.springframework.web.bind.annotation.ExceptionHandler; +//import org.springframework.web.bind.annotation.RestControllerAdvice; +//import org.springframework.web.util.NestedServletException; +// +//import javax.annotation.Resource; +//import javax.servlet.http.HttpServletRequest; +//import javax.validation.ConstraintViolation; +//import javax.validation.ConstraintViolationException; +//import java.util.ArrayList; +//import java.util.List; +//import java.util.concurrent.*; +//import java.util.stream.Collectors; +//import java.util.stream.Stream; +// +///** +// * 全局通用业务异常处理器 +// * +// * @author hongawen +// * @version 1.0.0 +// * @date 2021年04月20日 18:04 +// */ +//@Slf4j +//@AllArgsConstructor +//@RestControllerAdvice +//public class GlobalBusinessExceptionHandler { +// +// +// +// private final ThreadPoolExecutor executor = new ThreadPoolExecutor( +// 4, 8, 30, TimeUnit.SECONDS, +// new LinkedBlockingQueue<>(100), +// // 队列满时由主线程执行 +// new ThreadPoolExecutor.CallerRunsPolicy() +// ); +// +// +// /** +// * 捕获业务功能异常,通常为业务数据抛出的异常 +// * +// * @param businessException 业务异常 +// */ +// @ExceptionHandler(BusinessException.class) +// public HttpResult handleBusinessException(BusinessException businessException) { +// String operate = ReflectCommonUtil.getMethodDescribeByException(businessException); +// // recodeBusinessExceptionLog(businessException, businessException.getMessage()); +// return HttpResultUtil.assembleBusinessExceptionResult(businessException, null, operate); +// } +// +// +// /** +// * 空指针异常捕捉 +// * +// * @param nullPointerException 空指针异常 +// */ +// @ExceptionHandler(NullPointerException.class) +// public HttpResult handleNullPointerException(NullPointerException nullPointerException) { +// LogUtil.logExceptionStackInfo(CommonResponseEnum.NULL_POINTER_EXCEPTION.getMessage(), nullPointerException); +// //recodeBusinessExceptionLog(nullPointerException, CommonResponseEnum.NULL_POINTER_EXCEPTION.getMessage()); +// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.NULL_POINTER_EXCEPTION, null, ReflectCommonUtil.getMethodDescribeByException(nullPointerException)); +// } +// +// /** +// * 算数运算异常 +// * +// * @param arithmeticException 算数运算异常,由于除数为0引起的异常 +// */ +// @ExceptionHandler(ArithmeticException.class) +// public HttpResult handleArithmeticException(ArithmeticException arithmeticException) { +// LogUtil.logExceptionStackInfo(CommonResponseEnum.ARITHMETIC_EXCEPTION.getMessage(), arithmeticException); +// // recodeBusinessExceptionLog(arithmeticException, CommonResponseEnum.ARITHMETIC_EXCEPTION.getMessage()); +// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.ARITHMETIC_EXCEPTION, null, ReflectCommonUtil.getMethodDescribeByException(arithmeticException)); +// } +// +// /** +// * 类型转换异常捕捉 +// * +// * @param classCastException 类型转换异常 +// */ +// @ExceptionHandler(ClassCastException.class) +// public HttpResult handleClassCastException(ClassCastException classCastException) { +// LogUtil.logExceptionStackInfo(CommonResponseEnum.CLASS_CAST_EXCEPTION.getMessage(), classCastException); +// // recodeBusinessExceptionLog(classCastException, CommonResponseEnum.CLASS_CAST_EXCEPTION.getMessage()); +// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.CLASS_CAST_EXCEPTION, null, ReflectCommonUtil.getMethodDescribeByException(classCastException)); +// } +// +// +// /** +// * 索引下标越界异常捕捉 +// * +// * @param indexOutOfBoundsException 索引下标越界异常 +// */ +// @ExceptionHandler(IndexOutOfBoundsException.class) +// public HttpResult handleIndexOutOfBoundsException(IndexOutOfBoundsException indexOutOfBoundsException) { +// LogUtil.logExceptionStackInfo(CommonResponseEnum.INDEX_OUT_OF_BOUNDS_EXCEPTION.getMessage(), indexOutOfBoundsException); +// // recodeBusinessExceptionLog(indexOutOfBoundsException, CommonResponseEnum.INDEX_OUT_OF_BOUNDS_EXCEPTION.getMessage()); +// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.INDEX_OUT_OF_BOUNDS_EXCEPTION, null, ReflectCommonUtil.getMethodDescribeByException(indexOutOfBoundsException)); +// } +// +// /** +// * 前端请求后端,请求中参数的媒体方式不支持异常 +// * +// * @param httpMediaTypeNotSupportedException 请求中参数的媒体方式不支持异常 +// */ +// @ExceptionHandler(HttpMediaTypeNotSupportedException.class) +// public HttpResult httpMediaTypeNotSupportedExceptionHandler(HttpMediaTypeNotSupportedException httpMediaTypeNotSupportedException) { +// LogUtil.logExceptionStackInfo(CommonResponseEnum.HTTP_MEDIA_TYPE_NOT_SUPPORTED_EXCEPTION.getMessage(), httpMediaTypeNotSupportedException); +// // 然后提取错误提示信息进行返回 +// // recodeBusinessExceptionLog(httpMediaTypeNotSupportedException, CommonResponseEnum.HTTP_MEDIA_TYPE_NOT_SUPPORTED_EXCEPTION.getMessage()); +// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.HTTP_MEDIA_TYPE_NOT_SUPPORTED_EXCEPTION, null, ReflectCommonUtil.getMethodDescribeByException(httpMediaTypeNotSupportedException)); +// } +// +// /** +// * 前端请求后端,参数校验异常捕捉 +// * RequestBody注解参数异常 +// * +// * @param methodArgumentNotValidException 参数校验异常 +// */ +// @ExceptionHandler(MethodArgumentNotValidException.class) +// public HttpResult methodArgumentNotValidExceptionHandler(MethodArgumentNotValidException methodArgumentNotValidException) { +// // 从异常对象中拿到allErrors数据 +// String messages = methodArgumentNotValidException.getBindingResult().getAllErrors() +// .stream().map(ObjectError::getDefaultMessage).collect(Collectors.joining(";")); +// // 然后提取错误提示信息进行返回 +// LogUtil.njcnDebug(log, "参数校验异常,异常为:{}", messages); +// // recodeBusinessExceptionLog(methodArgumentNotValidException, CommonResponseEnum.METHOD_ARGUMENT_NOT_VALID_EXCEPTION.getMessage()); +// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.METHOD_ARGUMENT_NOT_VALID_EXCEPTION, messages, ControllerUtil.getMethodArgumentNotValidException(methodArgumentNotValidException)); +// } +// +// /** +// * 前端请求后端,参数校验异常捕捉 +// * PathVariable注解、RequestParam注解参数异常 +// * +// * @param constraintViolationException 参数校验异常 +// */ +// @ExceptionHandler(ConstraintViolationException.class) +// public HttpResult constraintViolationExceptionExceptionHandler(ConstraintViolationException constraintViolationException) { +// String exceptionMessage = constraintViolationException.getMessage(); +// StringBuilder messages = new StringBuilder(); +// if (exceptionMessage.indexOf(StrUtil.COMMA) > 0) { +// String[] tempMessage = exceptionMessage.split(StrUtil.COMMA); +// Stream.of(tempMessage).forEach(message -> { +// messages.append(message.substring(message.indexOf(StrUtil.COLON) + 2)).append(';'); +// }); +// } else { +// messages.append(exceptionMessage.substring(exceptionMessage.indexOf(StrUtil.COLON) + 2)); +// } +// // 然后提取错误提示信息进行返回 +// LogUtil.njcnDebug(log, "参数校验异常,异常为:{}", messages); +// // recodeBusinessExceptionLog(constraintViolationException, CommonResponseEnum.METHOD_ARGUMENT_NOT_VALID_EXCEPTION.getMessage()); +// List> constraintViolationList = new ArrayList<>(constraintViolationException.getConstraintViolations()); +// ConstraintViolation constraintViolation = constraintViolationList.get(0); +// Class rootBeanClass = constraintViolation.getRootBeanClass(); +// //判断校验参数异常捕获的根源是controller还是service处 +// if (rootBeanClass.getName().endsWith("Controller")) { +// String methodName = constraintViolation.getPropertyPath().toString().substring(0, constraintViolation.getPropertyPath().toString().indexOf(StrUtil.DOT)); +// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.METHOD_ARGUMENT_NOT_VALID_EXCEPTION, messages.toString(), ReflectCommonUtil.getMethodDescribeByClassAndMethodName(rootBeanClass, methodName)); +// } else { +// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.METHOD_ARGUMENT_NOT_VALID_EXCEPTION, messages.toString(), ReflectCommonUtil.getMethodDescribeByException(constraintViolationException)); +// } +// +// } +// +// +// /** +// * 索引下标越界异常捕捉 +// * +// * @param illegalArgumentException 参数校验异常 +// */ +// @ExceptionHandler(IllegalArgumentException.class) +// public HttpResult handleIndexOutOfBoundsException(IllegalArgumentException illegalArgumentException) { +// LogUtil.logExceptionStackInfo(CommonResponseEnum.ILLEGAL_ARGUMENT_EXCEPTION.getMessage(), illegalArgumentException); +// // recodeBusinessExceptionLog(illegalArgumentException, CommonResponseEnum.ILLEGAL_ARGUMENT_EXCEPTION.getMessage()); +// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.ILLEGAL_ARGUMENT_EXCEPTION, illegalArgumentException.getMessage(), ReflectCommonUtil.getMethodDescribeByException(illegalArgumentException)); +// } +// +// +// /** +// * 未声明异常捕捉 +// * +// * @param exception 未声明异常 +// */ +// @ExceptionHandler(Exception.class) +// public HttpResult handleException(Exception exception) { +// //针对fallbackFactory降级异常特殊处理 +// Exception tempException = exception; +// String exceptionCause = CommonResponseEnum.UN_DECLARE.getMessage(); +// String code = CommonResponseEnum.UN_DECLARE.getCode(); +// if (exception instanceof NestedServletException) { +// Throwable cause = exception.getCause(); +// if (cause instanceof AssertionError) { +// if (cause.getCause() instanceof BusinessException) { +// tempException = (BusinessException) cause.getCause(); +// BusinessException tempBusinessException = (BusinessException) cause.getCause(); +// exceptionCause = tempBusinessException.getMessage(); +// code = tempBusinessException.getCode(); +// } // } // } - return HttpResultUtil.assembleResult(code, null, StrFormatter.format("{}{}{}", ReflectCommonUtil.getMethodDescribeByException(tempException), StrUtil.C_COMMA, exceptionCause)); - } - - - /** - * json解析异常 - * - * @param jsonException json参数 - */ - @ExceptionHandler(JSONException.class) - public HttpResult handleIndexOutOfBoundsException(JSONException jsonException) { - LogUtil.logExceptionStackInfo(CommonResponseEnum.JSON_CONVERT_EXCEPTION.getMessage(), jsonException); - // recodeBusinessExceptionLog(jsonException, CommonResponseEnum.JSON_CONVERT_EXCEPTION.getMessage()); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.JSON_CONVERT_EXCEPTION, jsonException.getMessage(), ReflectCommonUtil.getMethodDescribeByException(jsonException)); - } -/* - private void recodeBusinessExceptionLog(Exception businessException, String methodDescribe) { - HttpServletRequest httpServletRequest = HttpServletUtil.getRequest(); - Future future = executor.submit(() -> { - HttpServletUtil.setRequest(httpServletRequest); - sysLogAuditService.recodeBusinessExceptionLog(businessException, methodDescribe); - }); - try { - // 抛出 ExecutionException - future.get(); - } catch (ExecutionException | InterruptedException e) { - log.error("保存审计日志异常,异常为:" + e.getMessage()); - } - }*/ - -} +// LogUtil.logExceptionStackInfo(exceptionCause, tempException); +// // recodeBusinessExceptionLog(exception, exceptionCause); +// //判断方法上是否有自定义注解,做特殊处理 +//// Method method = ReflectCommonUtil.getMethod(exception); +//// if (!Objects.isNull(method)){ +//// if(method.isAnnotationPresent(ReturnMsg.class)){ +//// return HttpResultUtil.assembleResult(code, null, StrFormatter.format("{}",exceptionCause)); +//// } +//// } +// return HttpResultUtil.assembleResult(code, null, StrFormatter.format("{}{}{}", ReflectCommonUtil.getMethodDescribeByException(tempException), StrUtil.C_COMMA, exceptionCause)); +// } +// +// +// /** +// * json解析异常 +// * +// * @param jsonException json参数 +// */ +// @ExceptionHandler(JSONException.class) +// public HttpResult handleIndexOutOfBoundsException(JSONException jsonException) { +// LogUtil.logExceptionStackInfo(CommonResponseEnum.JSON_CONVERT_EXCEPTION.getMessage(), jsonException); +// // recodeBusinessExceptionLog(jsonException, CommonResponseEnum.JSON_CONVERT_EXCEPTION.getMessage()); +// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.JSON_CONVERT_EXCEPTION, jsonException.getMessage(), ReflectCommonUtil.getMethodDescribeByException(jsonException)); +// } +///* +// private void recodeBusinessExceptionLog(Exception businessException, String methodDescribe) { +// HttpServletRequest httpServletRequest = HttpServletUtil.getRequest(); +// Future future = executor.submit(() -> { +// HttpServletUtil.setRequest(httpServletRequest); +// sysLogAuditService.recodeBusinessExceptionLog(businessException, methodDescribe); +// }); +// try { +// // 抛出 ExecutionException +// future.get(); +// } catch (ExecutionException | InterruptedException e) { +// log.error("保存审计日志异常,异常为:" + e.getMessage()); +// } +// }*/ +// +//} diff --git a/event_smart/src/main/java/com/njcn/gather/event/transientes/pojo/param/MonitorTerminalParam.java b/event_smart/src/main/java/com/njcn/gather/event/transientes/pojo/param/MonitorTerminalParam.java new file mode 100644 index 00000000..951c7a17 --- /dev/null +++ b/event_smart/src/main/java/com/njcn/gather/event/transientes/pojo/param/MonitorTerminalParam.java @@ -0,0 +1,30 @@ +package com.njcn.gather.event.transientes.pojo.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * <监测点波形入参> + * + * @author wr + * @createTime: 2023-03-23 + */ +@Data +public class MonitorTerminalParam { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id") + @NotBlank(message = "id不能为空") + private String id; + + @ApiModelProperty(value = "区分主配网(0:主网 1:配网)") + @NotNull(message = "区分类别不能为空") + private Integer type; + + @ApiModelProperty(value = "区分系统(0:pq 1:pms)") + @NotNull(message = "区分系统不能为空") + private Integer systemType; +} diff --git a/event_smart/src/main/java/com/njcn/gather/event/transientes/service/EventGateService.java b/event_smart/src/main/java/com/njcn/gather/event/transientes/service/EventGateService.java new file mode 100644 index 00000000..c66e416b --- /dev/null +++ b/event_smart/src/main/java/com/njcn/gather/event/transientes/service/EventGateService.java @@ -0,0 +1,15 @@ +package com.njcn.gather.event.transientes.service; + +import com.njcn.event.file.pojo.dto.WaveDataDTO; +import com.njcn.gather.event.transientes.pojo.param.MonitorTerminalParam; + +public interface EventGateService { + + + /** + * 功能描述: 暂态事件波形分析 + * @param param + * @return + */ + WaveDataDTO getTransientAnalyseWave(MonitorTerminalParam param); +} diff --git a/event_smart/src/main/java/com/njcn/gather/event/transientes/service/impl/EventGateServiceImpl.java b/event_smart/src/main/java/com/njcn/gather/event/transientes/service/impl/EventGateServiceImpl.java new file mode 100644 index 00000000..a6192d6f --- /dev/null +++ b/event_smart/src/main/java/com/njcn/gather/event/transientes/service/impl/EventGateServiceImpl.java @@ -0,0 +1,74 @@ +package com.njcn.gather.event.transientes.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.common.utils.PubUtils; +import com.njcn.event.file.component.WaveFileComponent; +import com.njcn.event.file.pojo.dto.WaveDataDTO; +import com.njcn.event.file.pojo.enums.WaveFileResponseEnum; +import com.njcn.gather.event.devcie.mapper.PqLinedetailMapper; +import com.njcn.gather.event.devcie.pojo.po.PqLine; +import com.njcn.gather.event.devcie.pojo.po.PqLinedetail; +import com.njcn.gather.event.devcie.service.PqLineService; +import com.njcn.gather.event.transientes.pojo.param.MonitorTerminalParam; +import com.njcn.gather.event.transientes.pojo.po.PqsEventdetail; +import com.njcn.gather.event.transientes.service.EventGateService; +import com.njcn.gather.event.transientes.service.PqsEventdetailService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.InputStream; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @Author: cdf + * @CreateTime: 2025-06-30 + * @Description: + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class EventGateServiceImpl implements EventGateService { + + private final PqsEventdetailService pqsEventdetailService; + private final WaveFileComponent waveFileComponent; + private final PqLineService pqLineService; + private final PqLinedetailMapper pqLinedetailMapper; + @Override + public WaveDataDTO getTransientAnalyseWave(MonitorTerminalParam param) { + WaveDataDTO waveDataDTO; + //获取暂降事件 + PqsEventdetail eventDetail = pqsEventdetailService.getById(param.getId()); + String waveName = eventDetail.getWavename(); + String cfgPath, datPath; + if (StrUtil.isBlank(waveName)) { + throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND); + } + cfgPath = "D:\\10.98.182.99\\"+waveName+".CFG"; + datPath = "D:\\10.98.182.99\\"+waveName+".DAT"; + log.info("本地磁盘波形文件路径----" + cfgPath); + InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath); + InputStream datStream = waveFileComponent.getFileInputStreamByFilePath(datPath); + if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) { + throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND); + } + waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1); + + waveDataDTO = waveFileComponent.getValidData(waveDataDTO); + Integer lineid = eventDetail.getLineid(); + PqLine pqLine = pqLineService.getById(lineid); + PqLinedetail pqLinedetail = pqLinedetailMapper.selectById(lineid); + waveDataDTO.setPtType(pqLinedetail.getPttype()); + waveDataDTO.setPt(pqLine.getPt1()/ pqLine.getPt2()); + waveDataDTO.setCt(pqLine.getCt1()/ pqLine.getCt2()); + waveDataDTO.setMonitorName(pqLine.getName()); + return waveDataDTO; + + } +} diff --git a/event_smart/src/main/java/com/njcn/gather/event/transientes/service/impl/LargeScreenCountServiceImpl.java b/event_smart/src/main/java/com/njcn/gather/event/transientes/service/impl/LargeScreenCountServiceImpl.java index 56836390..20a65cc9 100644 --- a/event_smart/src/main/java/com/njcn/gather/event/transientes/service/impl/LargeScreenCountServiceImpl.java +++ b/event_smart/src/main/java/com/njcn/gather/event/transientes/service/impl/LargeScreenCountServiceImpl.java @@ -138,7 +138,8 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService { ledgerBaseInfoDTOS.stream().forEach(temp->temp.setRunFlag(runLineList.contains(temp.getLineId())?1:0)); ledgerCountVO.setAllLineList(ledgerBaseInfoDTOS); List deviceDTOS = pqDeviceService.queryListByIds(devList); - deviceDTOS.forEach(temp->temp.setRunFlag(runDevList.contains(temp.getDevId())?1:0)); + deviceDTOS =deviceDTOS.stream().distinct().collect(Collectors.toList()); + deviceDTOS.forEach(temp-> temp.setRunFlag(runDevList.contains(temp.getDevId())?1:0)); ledgerCountVO.setAllDevList(deviceDTOS); List substationDTOS = pqSubstationService.queryListByIds(allSubList); substationDTOS.forEach(temp->temp.setRunFlag(runSubList.contains(temp.getStationId())?1:0)); @@ -437,15 +438,30 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService { }).collect(Collectors.toList()); Page returnpage = new Page<>(largeScreenCountParam.getPageNum(), largeScreenCountParam.getPageSize()); returnpage.setRecords(collect); + returnpage.setTotal(list.getTotal()); return returnpage; } @Override public List noDealEventList(LargeScreenCountParam largeScreenCountParam) { List result = new ArrayList<>(); - - DateTime end = DateUtil.endOfDay(DateTime.now()); - DateTime start = DateUtil.beginOfMonth(DateTime.now()); + //起始时间 + LocalDateTime startTime; + //结束时间 + LocalDateTime endTime; + if (largeScreenCountParam.getType() == 3) { + //起始时间 + startTime = LocalDateTimeUtil.parse(DateUtil.format(DateUtil.beginOfMonth(new Date()), DatePattern.NORM_DATETIME_FORMATTER), DatePattern.NORM_DATETIME_FORMATTER); + //结束时间 + endTime = LocalDateTimeUtil.parse(DateUtil.format(DateUtil.endOfMonth(new Date()), DatePattern.NORM_DATETIME_FORMATTER), DatePattern.NORM_DATETIME_FORMATTER); + } else if (largeScreenCountParam.getType() == 4) { + //起始时间 + startTime = LocalDateTimeUtil.parse(DateUtil.format(DateUtil.beginOfWeek(new Date()), DatePattern.NORM_DATETIME_FORMATTER), DatePattern.NORM_DATETIME_FORMATTER); + //结束时间 + endTime = LocalDateTimeUtil.parse(DateUtil.format(DateUtil.endOfWeek(new Date()), DatePattern.NORM_DATETIME_FORMATTER), DatePattern.NORM_DATETIME_FORMATTER); + } else { + throw new BusinessException("统计类型有误类型"); + } //根据用户获取当前部门及子部门id List deptAndChildren = pqsDeptsService.findDeptAndChildren(largeScreenCountParam.getDeptId()); //获取对应监测点id @@ -455,7 +471,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService { return result; } LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.between(PqsEventdetail::getTimeid, start, end) + lambdaQueryWrapper.between(PqsEventdetail::getTimeid, startTime, endTime) .in(PqsEventdetail::getLineid, deptslineIds) .and(wrapper -> wrapper.eq(PqsEventdetail::getLookFlag, 0).or().isNull(PqsEventdetail::getLookFlag)); if (Objects.nonNull(largeScreenCountParam.getEventDeep())) { @@ -561,7 +577,6 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService { @Override public EventMsgDetailVO eventMsgDetail(String eventId) { EventMsgDetailVO eventMsgDetailVO = new EventMsgDetailVO(); - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(MessageEventFeedback::getEventIndex, eventId); MessageEventFeedback messageEventFeedback = messageEventFeedbackService.getOne(lambdaQueryWrapper); @@ -573,7 +588,6 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService { eventMsgDetailVO.setObjName(pqLinedetail.getObjname()); } } - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(MsgEventInfo::getEventIndex, eventId); List msgEventInfoList = msgEventInfoService.list(queryWrapper); @@ -658,7 +672,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService { List pqLineList = pqLineMapper.getBaseLineInfo(lineidList); Map ledgerBaseInfoDTOMap = pqLineList.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity())); - List detailVOList = list.stream().map(temp -> { + result = list.stream().map(temp -> { EventDetailVO eventDetailVO = new EventDetailVO(); eventDetailVO.setEventdetail_index(temp.getEventdetailIndex()); eventDetailVO.setTimeid(temp.getTimeid()); diff --git a/event_smart/src/main/java/com/njcn/gather/event/transientes/websocket/WebSocketServer.java b/event_smart/src/main/java/com/njcn/gather/event/transientes/websocket/WebSocketServer.java index 065dde5c..ce838f6b 100644 --- a/event_smart/src/main/java/com/njcn/gather/event/transientes/websocket/WebSocketServer.java +++ b/event_smart/src/main/java/com/njcn/gather/event/transientes/websocket/WebSocketServer.java @@ -103,7 +103,6 @@ public class WebSocketServer { private final Object lock = new Object(); public void sendMessageToAll(String message) { - sessions.forEach((userId, session) -> { System.out.println("给用户推送消息" + userId); if (session.isOpen()) { diff --git a/event_smart/src/main/resources/application.yml b/event_smart/src/main/resources/application.yml index 1cacde3f..d686329e 100644 --- a/event_smart/src/main/resources/application.yml +++ b/event_smart/src/main/resources/application.yml @@ -1,3 +1,7 @@ +#当前服务的基本信息 +microservice: + ename: 12345 + name: 12345 server: port: 18093 spring: @@ -46,9 +50,9 @@ mybatis-plus: #驼峰命名 map-underscore-to-camel-case: true #配置sql日志输出 - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl +# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #关闭日志输出 -# log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl + log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl global-config: db-config: #指定主键生成策略 @@ -60,4 +64,36 @@ SYS_TYPE_WT: 983f9dfe-4f9a-4c96-89d8-7d425a1f1d6c db: type: oracle - +#文件位置配置 +business: + #处理波形数据位置 + # wavePath: D://comtrade + wavePath: /usr/local/comtrade + #处理临时数据 + #tempPath: D://file + tempPath: /usr/local/file + #文件存储的方式 + file: + storage: 3 +#oss服务器配置 +min: + io: + endpoint: http://192.168.1.13:9009 + accessKey: minio + secretKey: minio@123 + bucket: excelreport + #华为obs服务器配置 +huawei: + access-key: J9GS9EA79PZ60OK23LWP + security-key: BirGrAFDSLxU8ow5fffyXgZRAmMRb1R1AdqCI60d + obs: + bucket: test-8601 + endpoint: https://obs.cn-east-3.myhuaweicloud.com + # 单位为秒 + expire: 3600 +#线程池配置信息 +threadPool: + corePoolSize: 10 + maxPoolSize: 20 + queueCapacity: 500 + keepAliveSeconds: 60