初始版本提交
This commit is contained in:
@@ -38,6 +38,24 @@
|
||||
<artifactId>mybatis-spring</artifactId>
|
||||
<version>2.0.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn.platform</groupId>
|
||||
<artifactId>message-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn.platform</groupId>
|
||||
<artifactId>data-processing-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn.platform</groupId>
|
||||
<artifactId>event-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.njcn.event.controller;
|
||||
|
||||
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.common.utils.HttpResultUtil;
|
||||
import com.njcn.event.service.EventAnalysisService;
|
||||
import com.njcn.message.messagedto.MessageDataDTO;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2025/01/15 下午 2:10【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/eventAnalysis")
|
||||
@Api(tags = "事件解析")
|
||||
@AllArgsConstructor
|
||||
public class EventAnalysisController extends BaseController {
|
||||
|
||||
private final EventAnalysisService eventAnalysisService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/analysis")
|
||||
@ApiOperation("数据解析")
|
||||
public HttpResult<String> analysis(@RequestBody List<MessageDataDTO> messageList){
|
||||
String methodDescribe = getMethodDescribe("analysis");
|
||||
|
||||
eventAnalysisService.analysis(messageList);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, CommonResponseEnum.SUCCESS.getMessage(), methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.event.service;
|
||||
|
||||
|
||||
import com.njcn.message.messagedto.MessageDataDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2025/01/15 下午 2:51【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface EventAnalysisService {
|
||||
void analysis(List<MessageDataDTO> messageList);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.njcn.event.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.njcn.dataProcess.api.LnDataDealFeignClient;
|
||||
import com.njcn.dataProcess.api.RmpEventDetailFeignClient;
|
||||
import com.njcn.dataProcess.dto.*;
|
||||
import com.njcn.event.messagedto.EventDTO;
|
||||
import com.njcn.event.messagedto.MessageEventDataSet;
|
||||
import com.njcn.event.service.EventAnalysisService;
|
||||
import com.njcn.message.enums.DataTypeEnum;
|
||||
import com.njcn.message.messagedto.MessageDataDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2025/01/15 下午 2:51【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
|
||||
@Autowired
|
||||
private RmpEventDetailFeignClient rmpEventDetailFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
public void analysis(List<MessageDataDTO> messageList) {
|
||||
|
||||
|
||||
messageList.forEach(messageDataDTO->{
|
||||
Integer dataType = messageDataDTO.getDataType();
|
||||
String lineId = messageDataDTO.getMonitor();
|
||||
String value = messageDataDTO.getValue();
|
||||
|
||||
if(Objects.equals(DataTypeEnum.EVENT.getCode(),dataType)){
|
||||
MessageEventDataSet messageEventDataSet = JSONObject.parseObject(value, MessageEventDataSet.class);
|
||||
RmpEventDetailDTO rmpEventDetailDTO = new RmpEventDetailDTO();
|
||||
EventDTO volTage = messageEventDataSet.getVolTage();
|
||||
if(Objects.nonNull(volTage)){
|
||||
rmpEventDetailDTO.setMeasurementPointId(lineId);
|
||||
rmpEventDetailDTO.setEventType(volTage.getDiskind());
|
||||
rmpEventDetailDTO.setAdvanceType(volTage.getDiskind());
|
||||
|
||||
rmpEventDetailDTO.setStartTime(volTage.getStarttime());
|
||||
rmpEventDetailDTO.setDuration(volTage.getDur());
|
||||
rmpEventDetailDTO.setFeatureAmplitude(volTage.getMag());
|
||||
rmpEventDetailDTO.setPhase(volTage.getPhasic());
|
||||
rmpEventDetailDTO.setWavePath(volTage.getCfgFile().substring(0, volTage.getCfgFile().lastIndexOf("/")));
|
||||
|
||||
rmpEventDetailFeignClient.batchInsertion(rmpEventDetailDTO);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user