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