generated-scene: add scheduled monitoring runtime and helper lifecycle hardening
This commit is contained in:
136
tests/fixtures/generated_scene/g1e_light_enrichment/index.html
vendored
Normal file
136
tests/fixtures/generated_scene/g1e_light_enrichment/index.html
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
<!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>高低压新增报装容量月度统计表</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
const workUrl =
|
||||
"http://yxgateway.gs.sgcc.com.cn/emss-cmnf-common-front/member/workOrderQuery/getWkorderAll";
|
||||
const headers = { "Content-Type": "application/json" };
|
||||
|
||||
async function report() {
|
||||
const mode = "month";
|
||||
const month = "04";
|
||||
const reportType = "capacity";
|
||||
const groupedData = {};
|
||||
const requests = [];
|
||||
requests.push(
|
||||
axios.post(
|
||||
workUrl,
|
||||
window.encrypt_old({
|
||||
wkOrderNo: "",
|
||||
pageNo: 1,
|
||||
pageSize: 1000
|
||||
}),
|
||||
{ headers }
|
||||
)
|
||||
);
|
||||
|
||||
const queryElectCustInfoApi = async (data) => {
|
||||
const url =
|
||||
"http://yxgateway.gs.sgcc.com.cn/emss-busexpengaccsf-busexpaccssrv-front/member/workorder/queryElectCustInfo";
|
||||
const response = await axios.post(
|
||||
url,
|
||||
window.encrypt_old({
|
||||
appNo: data.wkOrderNo
|
||||
}),
|
||||
{ headers }
|
||||
);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const queryBusAcptApi = async (data) => {
|
||||
const url =
|
||||
"http://yxgateway.gs.sgcc.com.cn/emss-busexpengaccsf-busexpaccssrvacc-front/member/commonBusAcpt97/queryBusAcpt";
|
||||
const response = await axios.post(
|
||||
url,
|
||||
window.encrypt_old({
|
||||
appNo: data.wkOrderNo
|
||||
}),
|
||||
{ headers }
|
||||
);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getBatchPerCust97Api = async (data) => {
|
||||
const url =
|
||||
"http://yxgateway.gs.sgcc.com.cn/emss-busexpengaccsf-busexpaccssrvacc-front/member/lvbatchnewinstBusAcpt97/getBatchPerCust97";
|
||||
const response = await axios.post(
|
||||
url,
|
||||
window.encrypt_old({
|
||||
pageNo: 1,
|
||||
pageSize: 20,
|
||||
baseNewFlag: "01",
|
||||
appNo: data.wkOrderNo
|
||||
}),
|
||||
{ headers }
|
||||
);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
for (const item of combinedData) {
|
||||
const { countyCodeName } = item;
|
||||
if (!groupedData[countyCodeName]) {
|
||||
groupedData[countyCodeName] = {
|
||||
countyCodeName,
|
||||
hightPressureTotalThisMonth: 0,
|
||||
hightPressureTotalOtherMonth: 0,
|
||||
hightVolTotalThisMonth: 0,
|
||||
hightVolTotalOtherMonth: 0,
|
||||
lowPressureTotalThisMonth: 0,
|
||||
lowPressureTotalOtherMonth: 0,
|
||||
lowVolTotalThisMonth: 0,
|
||||
lowVolTotalOtherMonth: 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
for (const item of Object.values(groupedData)) {
|
||||
const {
|
||||
countyCodeName,
|
||||
hightAppListThisMonth,
|
||||
lowAppListThisMonth,
|
||||
batchAppListThisMonth
|
||||
} = item;
|
||||
const hightThis = await this.asyncPool(20, hightAppListThisMonth, queryElectCustInfoApi);
|
||||
const lowThis = await this.asyncPool(20, lowAppListThisMonth[1], queryElectCustInfoApi);
|
||||
const volBatchThis = await this.asyncPool(20, lowAppListThisMonth[0], queryBusAcptApi);
|
||||
const preBatchThis = await this.asyncPool(20, batchAppListThisMonth, getBatchPerCust97Api);
|
||||
if (hightThis && hightThis.status === 200 && mode === "month" && reportType) {
|
||||
groupedData[countyCodeName].month = month;
|
||||
}
|
||||
await com(hightThis, countyCodeName, "hightVolTotalThisMonth", "hightPressureTotalThisMonth");
|
||||
await com(lowThis, countyCodeName, "lowVolTotalThisMonth", "lowPressureTotalThisMonth");
|
||||
await batchCom(volBatchThis, preBatchThis, countyCodeName, "lowVolTotalThisMonth", "lowPressureTotalThisMonth");
|
||||
}
|
||||
|
||||
const titleList = [
|
||||
["index", "序号", ""],
|
||||
["countyCodeName", "单位", ""],
|
||||
["hightPressureTotalOtherMonth", "月前累计新增接入", "高压户数"],
|
||||
["hightVolTotalOtherMonth", "月前累计新增接入", "高压容量"],
|
||||
["lowPressureTotalOtherMonth", "月前累计新增接入", "低压户数"],
|
||||
["lowVolTotalOtherMonth", "月前累计新增接入", "低压容量"],
|
||||
["otherMonthShare", "月前累计新增接入", "容量占比"],
|
||||
["hightPressureTotalThisMonth", "本月新增接入", "高压户数"],
|
||||
["hightVolTotalThisMonth", "本月新增接入", "高压容量"],
|
||||
["lowPressureTotalThisMonth", "本月新增接入", "低压户数"],
|
||||
["lowVolTotalThisMonth", "本月新增接入", "低压容量"],
|
||||
["thisMonthShare", "本月新增接入", "容量占比"],
|
||||
["yearHightPressureTotal", "年累计新增接入", "高压户数"],
|
||||
["yearHightVolTotal", "年累计新增接入", "高压容量"],
|
||||
["yearLowPressureTotal", "年累计新增接入", "低压户数"],
|
||||
["yearLowVolTotal", "年累计新增接入", "低压容量"],
|
||||
["yearShare", "年累计新增接入", "容量占比"]
|
||||
];
|
||||
|
||||
return { groupedData, titleList };
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user