1.数据完整性列表调整

This commit is contained in:
wr
2024-04-03 09:28:32 +08:00
parent 542cdbc9b3
commit 438c21880f
3 changed files with 85 additions and 1 deletions

View File

@@ -25,4 +25,6 @@ public interface IntegrityMapper extends Mapper<Integrity> {
//查询监测点时间范围内详细的数据完整性 //查询监测点时间范围内详细的数据完整性
List<IntergralityTable> selectIntegrityData(@Param("list") List<Integer> tempIndexs,@Param("startTime")Date startTime,@Param("endTime") Date endTime); List<IntergralityTable> selectIntegrityData(@Param("list") List<Integer> tempIndexs,@Param("startTime")Date startTime,@Param("endTime") Date endTime);
List<IntergralityTable> selectGWIntegrityData(@Param("list") List<Integer> tempIndexs,@Param("startTime")Date startTime,@Param("endTime") Date endTime);
} }

View File

@@ -325,7 +325,7 @@ public class DeviceServiceImpl implements DeviceService {
//国网监测点 //国网监测点
List<Integer> countryLineIndexs = getGwLine(lineIndexs); List<Integer> countryLineIndexs = getGwLine(lineIndexs);
if (!CollectionUtils.isEmpty(countryLineIndexs)) { if (!CollectionUtils.isEmpty(countryLineIndexs)) {
intergralityData.setCountryNets(getIntegralityTable(startTime, endTime, countryLineIndexs)); intergralityData.setCountryNets(getGWIntegralityTable(startTime, endTime, countryLineIndexs));
} }
return intergralityData; return intergralityData;
} }
@@ -359,6 +359,35 @@ public class DeviceServiceImpl implements DeviceService {
return intergralityTables; return intergralityTables;
} }
/**
* 分片处理获取监测点数据完整性所有数据
*
* @param startTime 起始时间
* @param endTime 截止时间
* @param lineIndexs 监测点索引
*/
private List<IntergralityTable> getGWIntegralityTable(Date startTime, Date endTime, List<Integer> lineIndexs) {
List<IntergralityTable> intergralityTables = new ArrayList<>();
//分片1000个监测点
if (lineIndexs.size() > 1000) {
int times = lineIndexs.size() / 1000 + 1;
for (int i = 1; i <= times; i++) {
if (lineIndexs.size() > 1000) {
List<Integer> tempIndexs = lineIndexs.subList(0, 1000);
List<IntergralityTable> tempTables = integrityMapper.selectGWIntegrityData(tempIndexs, startTime, endTime);
intergralityTables.addAll(tempTables);
tempIndexs.clear();
} else {
List<IntergralityTable> tempTables = integrityMapper.selectGWIntegrityData(lineIndexs, startTime, endTime);
intergralityTables.addAll(tempTables);
}
}
} else {
intergralityTables = integrityMapper.selectGWIntegrityData(lineIndexs, startTime, endTime);
}
return intergralityTables;
}
/** /**
* 根据装置索引,查询出需要展示的数据 * 根据装置索引,查询出需要展示的数据
*/ */

View File

@@ -121,4 +121,57 @@
AND T9.DIC_INDEX = T3.DEVTYPE AND T9.DIC_INDEX = T3.DEVTYPE
</select> </select>
<select id="selectGWIntegrityData" resultType="intergralityTable" >
SELECT
T6. NAME powerCompany,
T7. NAME substation,
T3. NAME device,
T3.IP deviceIp,
T3.UpdateTime updateTime,
T3.dev_index devId,
T3.Status status,
T3.DevFlag devFlag,
T5.DIC_NAME company,
T8.DIC_NAME voltage,
T2.NAME lineName,
T2.line_index lineId,
T1.integrity integrity,
T9.dic_name devType
FROM
(
SELECT
T1.LINE_INDEX,
ROUND (
SUM (T1.REAL) / (
SUM (T1.DUE)
),
4
) * 100 integrity
FROM
PQS_NGCPINTEGRITY T1
WHERE
T1.LINE_INDEX IN <foreach collection="list" item="item" open="(" close=")" separator=",">#{item}</foreach>
AND t1.TIMEID BETWEEN #{startTime} AND #{endTime}
GROUP BY
T1.LINE_INDEX
) T1,
PQ_LINE T2,
PQ_DEVICE T3,
PQ_DEVICEDETAIL T4,
PQS_DICDATA T5,
PQ_GDINFORMATION T6,
PQ_SUBSTATION T7,
PQS_DICDATA T8,
PQS_DICDATA T9
WHERE
T1.LINE_INDEX = T2.LINE_INDEX
AND T2.DEV_INDEX = T3.DEV_INDEX
AND T3.DEV_INDEX =T4.DEV_INDEX
AND T4.MANUFACTURER=T5.DIC_INDEX
AND T2.GD_INDEX=T6.GD_INDEX
AND T2.SUB_INDEX=T7.SUB_INDEX
AND T2.SCALE=T8.DIC_INDEX
AND T9.DIC_INDEX = T3.DEVTYPE
</select>
</mapper> </mapper>