generated-scene: add scheduled monitoring runtime and helper lifecycle hardening
This commit is contained in:
100
tests/fixtures/generated_scene/g1e_light_enrichment_additional/index.html
vendored
Normal file
100
tests/fixtures/generated_scene/g1e_light_enrichment_additional/index.html
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="sgclaw-scene-kind" content="report_collection" />
|
||||
<meta name="sgclaw-target-url" content="http://yx.gs.sgcc.com.cn/" />
|
||||
<meta name="sgclaw-expected-domain" content="yx.gs.sgcc.com.cn" />
|
||||
<title>G1-E Additional Light Enrichment Fixture</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
const sourceUrl = "http://yx.gs.sgcc.com.cn/report";
|
||||
const headers = { "Content-Type": "application/json" };
|
||||
const workUrl =
|
||||
"http://yx.gs.sgcc.com.cn/report/customerApply/getWkorderAll";
|
||||
|
||||
async function reportAdditional() {
|
||||
const mode = "month";
|
||||
const month = "04";
|
||||
const reportType = "capacity";
|
||||
const groupedData = {};
|
||||
|
||||
const mainResponse = await axios.post(
|
||||
workUrl,
|
||||
window.encrypt_old({
|
||||
wkOrderNo: "",
|
||||
countyCodeName: "",
|
||||
pageNo: 1,
|
||||
pageSize: 500
|
||||
}),
|
||||
{ headers }
|
||||
);
|
||||
|
||||
const queryBusAcptApi = async (data) => {
|
||||
const url =
|
||||
"http://yx.gs.sgcc.com.cn/report/customerApply/queryBusAcpt";
|
||||
const response = await axios.post(
|
||||
url,
|
||||
window.encrypt_old({
|
||||
appNo: data.wkOrderNo,
|
||||
countyCodeName: data.countyCodeName
|
||||
}),
|
||||
{ headers }
|
||||
);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const queryCapacityInfoApi = async (data) => {
|
||||
const url =
|
||||
"http://yx.gs.sgcc.com.cn/report/customerApply/queryCapacityInfo";
|
||||
const response = await axios.post(
|
||||
url,
|
||||
window.encrypt_old({
|
||||
appNo: data.wkOrderNo
|
||||
}),
|
||||
{ headers }
|
||||
);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const rows = mainResponse.data || [];
|
||||
for (const item of rows) {
|
||||
const { countyCodeName } = item;
|
||||
if (!groupedData[countyCodeName]) {
|
||||
groupedData[countyCodeName] = {
|
||||
countyCodeName,
|
||||
batchTotalThisMonth: 0,
|
||||
batchCapacityThisMonth: 0,
|
||||
customerTotalThisMonth: 0,
|
||||
customerCapacityThisMonth: 0,
|
||||
thisMonthShare: 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
for (const item of rows) {
|
||||
const busAcpt = await queryBusAcptApi(item);
|
||||
const capacityInfo = await queryCapacityInfoApi(item);
|
||||
if (busAcpt && busAcpt.status === 200 && mode === "month" && reportType) {
|
||||
groupedData[item.countyCodeName].month = month;
|
||||
}
|
||||
await com(busAcpt, item.countyCodeName, "batchCapacityThisMonth", "batchTotalThisMonth");
|
||||
await com(capacityInfo, item.countyCodeName, "customerCapacityThisMonth", "customerTotalThisMonth");
|
||||
}
|
||||
|
||||
const titleList = [
|
||||
["index", "Index", ""],
|
||||
["countyCodeName", "Org", ""],
|
||||
["batchTotalThisMonth", "This Month", "Batch Count"],
|
||||
["batchCapacityThisMonth", "This Month", "Batch Capacity"],
|
||||
["customerTotalThisMonth", "This Month", "Customer Count"],
|
||||
["customerCapacityThisMonth", "This Month", "Customer Capacity"],
|
||||
["thisMonthShare", "This Month", "Capacity Share"]
|
||||
];
|
||||
|
||||
return { groupedData, titleList };
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user