generated-scene: add scheduled monitoring runtime and helper lifecycle hardening
This commit is contained in:
60
tests/fixtures/generated_scene/paginated_enrichment_expansion/index.html
vendored
Normal file
60
tests/fixtures/generated_scene/paginated_enrichment_expansion/index.html
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Paginated Enrichment Expansion Fixture</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
const sourceUrl = "http://yx.gs.sgcc.com.cn";
|
||||
|
||||
async function getTicketList(pageNum, pageSize) {
|
||||
return $.ajax({
|
||||
url: "http://yx.gs.sgcc.com.cn/workorder/ticketList",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify({ pageNum, pageSize, sourceTypes: ["95598", "12398"] })
|
||||
});
|
||||
}
|
||||
|
||||
async function getTicketRiskDetail(ticketNo) {
|
||||
return $.ajax({
|
||||
url: "http://yx.gs.sgcc.com.cn/workorder/ticketRiskDetail",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify({ ticketNo })
|
||||
});
|
||||
}
|
||||
|
||||
async function executeTask() {
|
||||
const pageSize = 50;
|
||||
let pageNum = 1;
|
||||
const rows = [];
|
||||
while (pageNum < 20) {
|
||||
const response = await getTicketList(pageNum, pageSize);
|
||||
const list = response.rows || [];
|
||||
if (!list.length) break;
|
||||
for (const item of list) {
|
||||
const detail = await getTicketRiskDetail(item.ticketNo);
|
||||
const row = { ...item, riskLevel: detail.riskLevel };
|
||||
if (row.riskLevel !== "LOW") {
|
||||
rows.push(row);
|
||||
}
|
||||
}
|
||||
pageNum += 1;
|
||||
}
|
||||
const aggregated = rows.map(row => ({
|
||||
ticketNo: row.ticketNo,
|
||||
riskLevel: row.riskLevel,
|
||||
sourceType: row.sourceType
|
||||
}));
|
||||
exportExcel(aggregated);
|
||||
return aggregated;
|
||||
}
|
||||
|
||||
function exportExcel(rows) {
|
||||
return rows.length;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user