Merge remote-tracking branch 'origin/master'

This commit is contained in:
2023-04-28 10:18:13 +08:00
3 changed files with 69 additions and 4 deletions

View File

@@ -0,0 +1,20 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.event.pojo.param.WaveTypeParam;
import com.njcn.event.pojo.vo.DetailVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 暂态报告
*
* @author zbj
* @date 2023/04/28
*/
@Mapper
public interface ReportMapper {
List<DetailVO> getBreakTimes(Page<DetailVO> page, @Param("lineIds") List<String> lineIds, @Param("startTime") String startTime, @Param("endTime") String endTime);
}

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.event.mapper.majornetwork.ReportMapper">
<select id="getBreakTimes" resultType="com.njcn.event.pojo.vo.DetailVO">
SELECT
rmed.measurement_point_id lineId,
count(*) times
FROM r_mp_event_detail rmed
left join sys_dict_data sdd on sdd.id = rmed.event_type and sdd.`Code` = 'Short_Interruptions'
WHERE
rmed.measurement_point_id IN
<foreach collection="lineIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">
and date_format(rmed.start_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''">
and date_format(rmed.start_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if>
GROUP BY rmed.measurement_point_id
</select>
</mapper>

View File

@@ -40,6 +40,7 @@ import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
import com.njcn.event.enums.EventResponseEnum;
import com.njcn.event.mapper.majornetwork.ReportMapper;
import com.njcn.event.pojo.constant.Param;
import com.njcn.event.pojo.param.*;
import com.njcn.event.pojo.po.EventDetail;
@@ -137,6 +138,8 @@ public class ReportServiceImpl implements ReportService {
private final FreemarkerUtil freemarkerUtil;
private final ReportMapper reportMapper;
public List<EventDetail> getED(DeviceInfoParam.BusinessParam businessParam) {
List<EventDetail> info = new ArrayList<>();
List<GeneralDeviceDTO> deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(businessParam).getData();
@@ -627,11 +630,15 @@ public class ReportServiceImpl implements ReportService {
if (CollectionUtil.isEmpty(lineIds)) {
throw new BusinessException(DeviceResponseEnum.DEPT_LINE_EMPTY);
}
Page<RmpEventDetailPO> pageInfo = eventDetailService.page(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), new LambdaQueryWrapper<RmpEventDetailPO>()
List<DetailVO> detailVO = reportMapper.getBreakTimes(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()),lineIds,waveTypeParam.getSearchBeginTime(),waveTypeParam.getSearchEndTime());
/* Page<RmpEventDetailPO> pageInfo = eventDetailService.page(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), new LambdaQueryWrapper<RmpEventDetailPO>()
.in(RmpEventDetailPO::getMeasurementPointId, lineIds)
.ge(StringUtils.isNotBlank(waveTypeParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(waveTypeParam.getSearchBeginTime())))
.le(StringUtils.isNotBlank(waveTypeParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(waveTypeParam.getSearchEndTime())))
);
List<EventDetailNew> info =BeanUtil.copyToList(pageInfo.getRecords(),EventDetailNew.class);
HashMap<String, Integer> countMap = new HashMap<>();
for (EventDetailNew eventDetail : info) {
@@ -650,10 +657,16 @@ public class ReportServiceImpl implements ReportService {
BeanUtils.copyProperties(eventDetail, vo);
result.add(vo);
idlist.add(eventDetail.getLineId());
}*/
//id集合
ArrayList<String> idlist = new ArrayList<>();
for (DetailVO vo : detailVO) {
idlist.add(vo.getLineId());
}
HttpResult<List<AreaLineInfoVO>> AreaInfo = lineFeignClient.getBaseLineAreaInfo(idlist);
List<AreaLineInfoVO> data = AreaInfo.getData();
for (DetailVO detailVO : result) {
/* for (DetailVO detailVO : result) {
for (AreaLineInfoVO vo : data) {
if (vo.getLineId().equals(detailVO.getLineId())) {
BeanUtils.copyProperties(vo, detailVO);
@@ -664,9 +677,16 @@ public class ReportServiceImpl implements ReportService {
detailVO.setTimes(countMap.get(s));
}
}
}*/
for (DetailVO v : detailVO) {
for (AreaLineInfoVO vo : data) {
if (vo.getLineId().equals(v.getLineId())) {
BeanUtils.copyProperties(vo, v);
}
}
}
Page<DetailVO> page = BeanUtil.copyProperties(pageInfo,Page.class);
page.setRecords(result);
Page<DetailVO> page = BeanUtil.copyProperties(detailVO,Page.class);
page.setRecords(detailVO);
return page;