辽宁前置接口开发
This commit is contained in:
@@ -11,6 +11,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.event.mapper.majornetwork.EventDetailMapper;
|
||||
import com.njcn.event.pojo.dto.EventDeatilDTO;
|
||||
import com.njcn.event.pojo.param.EventCountParam;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
@@ -231,4 +232,18 @@ public class EventDetailController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventDetailService.list(lambdaQueryWrapper), methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂降事件记录
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/addEventDetail")
|
||||
@ApiOperation("暂降事件记录")
|
||||
public HttpResult<Boolean> addEventDetail(@RequestBody EventDeatilDTO deatilDTO) {
|
||||
String methodDescribe = getMethodDescribe("addEventDetail");
|
||||
Boolean flag = eventDetailService.addEventDetail(deatilDTO);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.event.pojo.dto.EventDeatilDTO;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.RStatEventOrgM;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
@@ -38,4 +39,6 @@ public interface EventDetailService extends IService<RmpEventDetailPO> {
|
||||
* 根据监测点集合以及分页信息获取暂降事件
|
||||
*/
|
||||
List<EventDetail> getEventDetailLimit(List<String> lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum, List<String> waveType);
|
||||
|
||||
Boolean addEventDetail(EventDeatilDTO deatilDTO);
|
||||
}
|
||||
@@ -7,17 +7,23 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.event.mapper.majornetwork.EventDetailMapper;
|
||||
import com.njcn.event.pojo.dto.EventDeatilDTO;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.service.majornetwork.EventDetailService;
|
||||
import com.njcn.influx.utils.InfluxDbUtils;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.impl.InfluxDBResultMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -33,6 +39,8 @@ public class EventDetailServiceImpl extends ServiceImpl<EventDetailMapper, RmpEv
|
||||
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
public List<EventDetail> getEventDetailData(String id, String startTime, String endTime) {
|
||||
@@ -114,4 +122,50 @@ public class EventDetailServiceImpl extends ServiceImpl<EventDetailMapper, RmpEv
|
||||
);
|
||||
return BeanUtil.copyToList(pageInfo.getRecords(), EventDetail.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean addEventDetail(EventDeatilDTO deatilDTO) {
|
||||
RmpEventDetailPO rmpEventDetailPO = new RmpEventDetailPO();
|
||||
// rmpEventDetailPO.setMeasurementPointId(deatilDTO.getMonitorId());
|
||||
rmpEventDetailPO.setLineId(deatilDTO.getMonitorId());
|
||||
DictData data = dicDataFeignClient.getDicDataByCode(eventTypeReflection(deatilDTO.getEventType())).getData();
|
||||
rmpEventDetailPO.setEventType(data.getId());
|
||||
rmpEventDetailPO.setStartTime(deatilDTO.getStartTime());
|
||||
rmpEventDetailPO.setDuration(deatilDTO.getDuration()/1000);
|
||||
rmpEventDetailPO.setFeatureAmplitude(deatilDTO.getAmplitude());
|
||||
rmpEventDetailPO.setPhase(deatilDTO.getPhase());
|
||||
rmpEventDetailPO.setWavePath(deatilDTO.getWavePath());
|
||||
rmpEventDetailPO.setEventDescribe(" ");
|
||||
rmpEventDetailPO.setCreateTime(LocalDateTime.now());
|
||||
|
||||
RmpEventDetailPO one = this.lambdaQuery().eq(RmpEventDetailPO::getLineId, rmpEventDetailPO.getLineId()).eq(RmpEventDetailPO::getStartTime, rmpEventDetailPO.getStartTime()).one();
|
||||
if(Objects.nonNull(one)){
|
||||
rmpEventDetailPO.setEventId(one.getEventId());
|
||||
this.updateById(rmpEventDetailPO);
|
||||
}else {
|
||||
this.save(rmpEventDetailPO);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public String eventTypeReflection(Integer eventType){
|
||||
String result ="";
|
||||
switch (eventType) {
|
||||
case 1210001:
|
||||
result = DicDataEnum.VOLTAGE_RISE.getCode();
|
||||
break;
|
||||
case 1210002:
|
||||
result = DicDataEnum.VOLTAGE_DIP.getCode();
|
||||
break;
|
||||
case 1210003:
|
||||
result = DicDataEnum.OTHER.getCode();
|
||||
case 1210004:
|
||||
result = DicDataEnum.SHORT_INTERRUPTIONS.getCode();
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user