Commit 0f329ba6 by 孙香冬

删除测试代码

parent 94024ada
import { get智慧电眼_城市群协同发展 } from "../../data/analysisExcelData";
import { getArea, getCsqxtfz } from "../../data/interface/csqxtfz";
import { getChartData, getKeyValue, getListData, getSingleYAndMoreData, getMoreYChartData, objKeyReplace, getKeyStringValue }from "../../util/tools";
export async function getData(req, res) {
let ret:any = {};
let excelData:any = get智慧电眼_城市群协同发展();
let interfaceData = await getCsqxtfz();
let 基础数据DataAndUnit = objKeyReplace(interfaceData.basicInfo);
......
import { get智慧电眼_规上企业生产运行状况 } from "../../data/analysisExcelData";
import { getGsqyscyx, getIndustrial } from "../../data/interface/gsqyscyx";
import { getChartData, getKeyValue, getListData, getSingleYAndMoreData, getMoreYChartData, objKeyReplace, getKeyStringValue }from "../../util/tools";
......@@ -6,7 +5,6 @@ import { getChartData, getKeyValue, getListData, getSingleYAndMoreData, getMoreY
export async function getData(req, res) {
let ret:any = {};
let excelData:any = get智慧电眼_规上企业生产运行状况();
let interfaceData = await getGsqyscyx();
let 基础数据DataAndUnit = objKeyReplace(interfaceData.basicInfo);
......
import { get智慧电眼_行业用电分布 } from "../../data/analysisExcelData";
import { getElectricity, getHyydfb } from "../../data/interface/hyydfb";
import { getChartData, getKeyValue, getListData, getSingleYAndMoreData, getMoreYChartData, objKeyReplace, getKeyStringValue }from "../../util/tools";
......@@ -6,7 +5,6 @@ import { getChartData, getKeyValue, getListData, getSingleYAndMoreData, getMoreY
export async function getData(req, res) {
let ret:any = {};
let excelData:any = get智慧电眼_行业用电分布();
let interfaceData = await getHyydfb();
let electricityInterface = await getElectricity();
......
import { get智慧电眼_经济景气度 } from "../../data/analysisExcelData";
import { getJjjqd } from "../../data/interface/jjjcd";
import { getChartData, getKeyValue, getListData, getSingleYAndMoreData, getMoreYChartData, objKeyReplace, getKeyStringValue }from "../../util/tools";
......
import { get智慧电眼_企业贷中信用评估 } from "../../data/analysisExcelData";
import { getindustryCredit, getQydzxypg } from "../../data/interface/qydzxypg";
import { getChartData, getKeyValue, getListData, getSingleYAndMoreData, getMoreYChartData, objKeyReplace, getKeyStringValue }from "../../util/tools";
......
import { get智慧电眼_商圈经济活力 } from "../../data/analysisExcelData";
import { getSqjjhl } from "../../data/interface/sqjjhl";
import { getChartData, getKeyValue, getListData, getSingleYAndMoreData, getMoreYChartData, objKeyReplace, getDecimalForN, getKeyStringValue }from "../../util/tools";
......
import { get智慧电眼_疑似空壳企业监测 } from "../../data/analysisExcelData";
import { getYskkqyjc } from "../../data/interface/yskkqyjc";
import { getChartData, getKeyValue, getListData, getSingleYAndMoreData, getMoreYChartData, objKeyReplace, getKeyStringValue }from "../../util/tools";
......
import { get智慧电眼_重点污染企业生产 } from "../../data/analysisExcelData";
import { getZdwrqysc } from "../../data/interface/zdwrqysc";
import { getChartData, getKeyValue, getListData, getSingleYAndMoreData, getMoreYChartData, objKeyReplace, analysisAddOrRMData, getKeyStringValue }from "../../util/tools";
......
import { get智慧电眼_住宅空置率 } from "../../data/analysisExcelData";
import { getHousingVacancyRate, getIdleUserPower, getResidentialVacancyRate, getTypicalResidentialVacancyTrends, getVacantHouseholdsInKeyAreas, getZzkzl } from "../../data/interface/zzkzl";
import { getChartData, getKeyValue, getListData, getSingleYAndMoreData, getMoreYChartData, objKeyReplace, analysisAddOrRMData, getKeyStringValue }from "../../util/tools";
......
......@@ -18,8 +18,6 @@
ret["api3"] = getMoreYChartData("环比趋势分析", checkNumber(excelData.环比趋势分析), false, {"绿电指数":"","环比增长":"%"})
// ret["api4"] = getSingleYAndMoreData("各指数成分趋势分析", excelData.各指数成分趋势分析, false, false);
let 绿电指数折线图保留小数数据 = getDataMapDecimalForN(excelData.绿电指数折线图);
ret["api5"] = getChartData("绿电指数折线图", 绿电指数折线图保留小数数据, false, false );
ret["api5"].yMinValue = 100;
......@@ -32,17 +30,6 @@
ret["api7"] = getKeyValue("服务车次", 服务车次DataAndUnit.dataMap,服务车次DataAndUnit.unitMap , false, false );
ret["api8"] = getChartData("每月服务车次", excelData.每月服务车次, '次', false);
// ret["api9"] = getChartData("设施安全服务", excelData.设施安全服务, '%', false );
// let 设施安全服务充电桩使用率DataAndUnit = objKeyReplace(excelData.设施安全服务充电桩使用率);
// ret["api10"] = getKeyValue("设施安全服务充电桩使用率", 设施安全服务充电桩使用率DataAndUnit.dataMap, '%', false, false );
// ret["api11"] = getSingleYAndMoreData("各指数成分趋势分析", excelData.各指数成分趋势分析, false, false);
// ret["api12"] = getMoreYChartData("同比趋势分析", checkNumber(excelData.同比趋势分析), false, {"同比增长":"%"});
// ret["api13"] = getMoreYChartData("环比趋势分析", checkNumber(excelData.环比趋势分析), false, {"同比增长":"%"});
ret["api14"] = getDropMoreData(excelData.绿电指数与经济指数相关分析_2017_2020_, "绿电指数与经济指数相关分析(2017-2020)", "绿电指数与经济指数相关分析(2017-2020)");
ret["api15"] = getDropMoreData(excelData.上海市空气质量AQI优良率, "绿电指数与环境指数相关分析(2017-2020)", "上海市空气质量AQI优良率");
......
......@@ -14,19 +14,9 @@
let 当期绿电指数DataAndUnit = objKeyReplace(特化数据);
ret["api1"] = getKeyValue("当期绿电指数", 当期绿电指数DataAndUnit.dataMap, 当期绿电指数DataAndUnit.unitMap, false, false );
// let 客户总量DataAndUnit = objKeyReplace(excelData.客户总量);
// ret["api2"] = getKeyValue("客户总量", 客户总量DataAndUnit.dataMap, 客户总量DataAndUnit.unitMap, false, false );
let 各类污染物减排占比DataAndUnit = objKeyReplace(excelData.各类污染物减排占比);
ret["api3"] = getKeyValue("各类污染物减排占比", 各类污染物减排占比DataAndUnit.dataMap, 各类污染物减排占比DataAndUnit.unitMap, true, false );
// let 清洁能源光伏接入情况DataAndUnit = objKeyReplace(excelData.清洁能源光伏接入情况);
// let 清洁能源光伏接入情况数据 = {};
// for (let key in 清洁能源光伏接入情况DataAndUnit.dataMap) {
// let value = Math.ceil(清洁能源光伏接入情况DataAndUnit.dataMap[key] * 100)/100;
// 清洁能源光伏接入情况数据[key] = value;
// }
// getKeyValue("清洁能源光伏接入情况", 清洁能源光伏接入情况数据, 清洁能源光伏接入情况DataAndUnit.unitMap, false, false );
const 分布式光伏客户DataAndUnit = objKeyReplace(excelData.分布式光伏客户);
const 总发电量DataAndUnit = objKeyReplace(excelData.总发电量);
const 装机容量DataAndUnit = objKeyReplace(excelData.装机容量);
......@@ -41,10 +31,6 @@
ret["api7"] = getSingleYAndMoreData("近12个月电量分析", excelData.12个月电量分析, false, '万千瓦时');
ret["api8"] = getSingleYAndMoreData("各指数成分趋势分析", excelData.各指数成分趋势分析, false, false);
// ret["api9"] = getMoreYChartData("同比趋势分析", excelData.同比趋势分析, false, {"绿电指数":"单位","同比增长":"%"});
// ret["api10"] = getMoreYChartData("环比趋势分析", excelData.环比趋势分析, false, {"绿电指数":"单位","同比增长":"%"});
const 指标数据 = [];
excelData.当期指数分四象限分析指标.forEach(info => {
......@@ -60,11 +46,6 @@
}
ret["api11"] = getDropMoreData(当期指数分四象限分析数据, "当期指数分四象限分析", "当期指数分四象限分析", 指标数据);
// ret["api12"] = getKeyValue("分布式光伏客户", 分布式光伏客户DataAndUnit.dataMap, 分布式光伏客户DataAndUnit.unitMap, false, false);
// ret["api13"] = getKeyValue("总发电量", 总发电量DataAndUnit.dataMap, 总发电量DataAndUnit.unitMap, false, false);
// ret["api14"] = getKeyValue("装机容量", 装机容量DataAndUnit.dataMap, 装机容量DataAndUnit.unitMap, false, false);
res.send(ret);
}
......
......@@ -13,10 +13,6 @@ export function getData(req, res) {
let excelData:any = get区域融合();
// ret["api1"] = getSingleYAndMoreData("各区受理量对比", excelData.各区受理量对比, false, '次');
// ret["api2"] = getSingleYAndMoreData("各区办结量对比", excelData.各区办结量对比, false, '次');
let 一体化电网运行管理DataAndUnit = objKeyReplace(excelData.一体化电网运行管理);
ret["api3"] = getKeyValue("一体化电网运行管理", 一体化电网运行管理DataAndUnit.dataMap, 一体化电网运行管理DataAndUnit.unitMap, true, false );
ret["api3"].list.forEach(info => {
......@@ -26,37 +22,11 @@ export function getData(req, res) {
ret["api4"] = getListData("工程进度",excelData.工程进度,["工程名称","开始时间","预计完成时间","工程进度"],{"工程名称":"name","开始时间":"startTime","预计完成时间":"endTime","工程进度":"rate"});
// ret["api5"] = getListData("调度日志",excelData.调度日志,["状态","序号","时间","申请人","所属区域","管理单位","业务分类"],{"状态":"state","序号":"number","时间":"time","申请人":"name","所属区域":"area","管理单位":"department","业务分类":"type"});
ret["api6"] = getSingleYAndMoreData("电网作业风险事件", excelData.电网作业风险事件, false, 'false');
let 一体化新型电力系统DataAndUnit = objKeyReplace(excelData.一体化新型电力系统);
ret["api7"] = getKeyValue("一体化新型电力系统", 一体化新型电力系统DataAndUnit.dataMap, 一体化新型电力系统DataAndUnit.unitMap, false, false );
//ret["api8"]
// let 企业客户_一码通识_DataAndUnit = objKeyReplace(excelData.企业客户_一码通识_);
// ret["api9"] = getKeyValue("企业客户“一码通识”", 企业客户_一码通识_DataAndUnit.dataMap, 企业客户_一码通识_DataAndUnit.unitMap, false, false );
// let 用电状态可_分色识别_DataAndUnit = objKeyReplace(excelData.用电状态可_分色识别_);
// ret["api10"] = getKeyValue("用电状态可“分色识别”", 用电状态可_分色识别_DataAndUnit.dataMap, 用电状态可_分色识别_DataAndUnit.unitMap, false, false );
// let 针对性供电服务_随码跟进_DataAndUnit = objKeyReplace(excelData.针对性供电服务_随码跟进_);
// ret["api11"] = getKeyValue("针对性供电服务“_随码跟进”", 针对性供电服务_随码跟进_DataAndUnit.dataMap, 针对性供电服务_随码跟进_DataAndUnit.unitMap, false, false );
// let 营商业务便利性DataAndUnit = objKeyReplace(excelData.营商业务便利性);
// ret["api12"] = getKeyValue("营商业务便利性", 营商业务便利性DataAndUnit.dataMap, 营商业务便利性DataAndUnit.unitMap, false, false );
// let 供电可靠性DataAndUnit = objKeyReplace(excelData.供电可靠性);
// ret["api13"] = getKeyValue("供电可靠性", 供电可靠性DataAndUnit.dataMap, 供电可靠性DataAndUnit.unitMap, false, false );
// let 营商业务及时性DataAndUnit = objKeyReplace(excelData.营商业务及时性);
// ret["api14"] = getKeyValue("营商业务及时性", 营商业务及时性DataAndUnit.dataMap, 营商业务及时性DataAndUnit.unitMap, false, false );
// let 业务三地对标DataAndUnit = objKeyReplace(excelData.业务三地对标);
// ret["api15"] = getKeyValue("业务三地对标", 业务三地对标DataAndUnit.dataMap, 业务三地对标DataAndUnit.unitMap, false, false );
let 嘉善县DataAndUnit = objKeyReplace(excelData.嘉善县);
ret["api16"] = getKeyValue("嘉善县", 嘉善县DataAndUnit.dataMap, 嘉善县DataAndUnit.unitMap, false, false );
let 吴江区DataAndUnit = objKeyReplace(excelData.吴江区);
......@@ -77,11 +47,6 @@ export function getData(req, res) {
地图链接数据.list.push({"key":key, "value": excelData.地图链接[key] });
}
ret["api20"] = 地图链接数据;
// for (let key in excelData.营商业务互动性) {
// excelData.营商业务互动性[key] = "";
// }
// ret["api21"] = getKeyValue("营商业务互动性", excelData.营商业务互动性, false, false,false);
ret["api22"] = { title:"图片", data:{
"img1":"img/qyrh1.png",
......
//数据来源
import { get数据来源 } from "../data/analysisExcelData";
import { getStringMoreData } from "../util/tools";
export function getData(req, res) {
let ret:any = {};
......
......@@ -19,7 +19,6 @@
let 系统效果DataAndUnit = objKeyReplace(excelData.系统效果);
ret["api4"] = getKeyValue("系统效果", 系统效果DataAndUnit.dataMap, 系统效果DataAndUnit.unitMap, false, false );
//10-27日 晚上十一点 李旭要求加个单位
ret["api5"] = getChartData("储能用户月分析(青浦区)", excelData.储能用户月分析_青浦区_, "户", false );
ret["api6"] = getChartData("储能用户季度分析(青浦区)", excelData.储能用户季度分析_青浦区_, "户", false );
......@@ -32,7 +31,6 @@
ret["api10"] = getSingleYAndMoreData("用户类型(青浦区)", excelData.用户类型_青浦区_, false, '户');
//10-27日 晚上十一点 李旭要求 行业分类用户(青浦区) 改为 产业类型(青浦区) excel没有改
ret["api11"] = getSingleYAndMoreData("产业类型(青浦区)", excelData.行业分类用户_青浦区_, false, '户');
ret["api12"] = getStringMoreData("综合能源智能匹配文本", excelData.综合能源智能匹配文本);
......
let fs = require('fs');
let apiInfoList = [
{name:"FuHuaZaiTi", dataList:[
{name:"孵化载体", len:4, type:"键值", strType:"c",strLen:4, valLen:2, haveUnit:false},
{name:"孵化载体占比数据", len:2, type:"键值", strType:"c", strLen:5, valLen:1, haveUnit:true},
{name:"孵化载体数量趋势", len:11, type:"柱状"},
{name:"孵化载体投资主体", len:3, type:"键值", strType:"c",strLen:2, valLen:2, haveUnit:false},
{name:"孵化载体行业分类", len:5, type:"键值", strType:"c",strLen:4, valLen:2, haveUnit:false},
{name:"孵化载体运营", len:5, type:"键值", strType:"c",strLen:2, valLen:3, haveUnit:false},
{name:"平均营收趋势", len:7, type:"柱状"},
{name:"重要评价指标", len:4, type:"键值", strType:"c",strLen:5, valLen:3, haveUnit:false},
{name:"服务资源", len:8, type:"键值", strType:"c",strLen:10, valLen:3, haveUnit:false},
{name:"政策服务", len:2, type:"键值", strType:"c",strLen:3, valLen:4, haveUnit:false},
{name:"地图数据", len:100, type:"地图"}
]},
{name:"KeJiJinRong", dataList:[
{name:"上市企业板块分布", len:8, type:"键值", strType:"c",strLen:4, valLen:3, haveUnit:true},
{name:"科创版企业", len:10, type:"键值", strType:"c",strLen:6, valLen:2, haveUnit:true},
{name:"挂牌企业", len:4, type:"键值", strType:"c",strLen:4, valLen:2, haveUnit:false},
{name:"2020年企业融资情况", len:3, type:"键值", strType:"c",strLen:4, valLen:2, haveUnit:false},
{name:"2020年企业上市情况", len:3, type:"键值", strType:"c",strLen:5, valLen:2, haveUnit:false},
{name:"融资金额趋势", len:17, type:"柱状"},
{name:"上市企业行业分布", len:5, type:"键值", strType:"c",strLen:4, valLen:2, haveUnit:false},
{name:"创投机构", len:4, type:"键值", strType:"c",strLen:4, valLen:2, haveUnit:true},
{name:"融资企业行业分布", len:8, type:"键值", strType:"c",strLen:7, valLen:2, haveUnit:true},
{name:"企业融资阶段分布", len:12, type:"键值", strType:"c",strLen:6, valLen:3, haveUnit:true},
{name:"金融产品担保方式占比", len:7, type:"键值", strType:"c",strLen:6, valLen:2, haveUnit:true},
{name:"中央球展示数据", len:5, type:"键值", strType:"c",strLen:5, valLen:3, haveUnit:true}
]},
{name:"QiYePeiYu", dataList:[
{name:"企业特征", len:5, type:"键值", strType:"c",strLen:4, valLen:3, haveUnit:false},
{name:"代表企业", len:0, type:""},
{name:"海外项目", len:7, type:"键值", strType:"c",strLen:4, valLen:2, haveUnit:true},
{name:"人才引进", len:7, type:"键值", strType:"c",strLen:6, valLen:4, haveUnit:true},
{name:"营业收入TOP5", len:5, type:"键值", strType:"c",strLen:12, valLen:1, haveUnit:true},
{name:"净利润TOP5", len:5, type:"键值", strType:"c",strLen:12, valLen:1, haveUnit:true},
{name:"研发投入TOP5", len:5, type:"键值", strType:"c",strLen:12, valLen:1, haveUnit:true},
{name:"入孵企业数量趋势", len:11, type:"柱状"},
{name:"孵化器2020入驻企业数量排名", len:5, type:"键值", strType:"c",strLen:10, valLen:3, haveUnit:false},
{name:"运营指标趋势", len:17, type:"柱状"},
{name:"企业运营情况", len:5, type:"键值", strType:"c",strLen:5, valLen:3, haveUnit:true},
{name:"企业运营概况", len:5, type:"键值", strType:"c",strLen:4, valLen:5, haveUnit:true},
{name:"科技创新", len:5, type:"键值", strType:"c",strLen:4, valLen:5, haveUnit:false},
{name:"发明专利申请与授权数比例", len:6, type:"柱状"},
{name:"高新技术企业数据概况", len:3, type:"键值", strType:"c",strLen:4, valLen:3, haveUnit:true},
{name:"高新技术企业培育", len:5, type:"柱状"},
{name:"企业融资", len:4, type:"键值", strType:"c",strLen:4, valLen:3, haveUnit:false},
{name:"2020四季度重大融资事件", len:5, type:"键值", strType:"c",strLen:8, valLen:3, haveUnit:true}
]},
{name:"RongTongHua", dataList:[
{name: "大中小企业融通发展联盟", len:2, type:"键值", strType:"c",strLen:4, valLen:3, haveUnit:false},
{name: "主要成效", len:5, type:"键值", strType:"c",strLen:10, valLen:3, haveUnit:false},
{name: "创业加速营", len:1, type:"键值", strType:"c",strLen:7, valLen:1, haveUnit:false},
{name: "大企业开放式创新平台", len:3, type:"键值", strType:"c",strLen:3, valLen:1, haveUnit:false},
{name: "大企业服务和成果", len:4, type:"键值", strType:"c",strLen:4, valLen:2, haveUnit:false},
{name: "地图数据", len:22, type:"地图"}
]},
{name:"ShuangChuangShengTai", dataList:[
{name:"双创集群", len:7, type:"键值", strType:"c",strLen:8, valLen:3, haveUnit:true},
{name:"孵化器增长趋势", len:6, type:"柱状"},
{name:"企业培育", len:3, type:"键值", strType:"c",strLen:6, valLen:3, haveUnit:true},
{name:"行业分布", len:5, type:"键值", strType:"c",strLen:4, valLen:3, haveUnit:true},
{name:"张江大中小企业融通发展联盟", len:2, type:"键值", strType:"c",strLen:4, valLen:2, haveUnit:false},
{name:"大企业开放式创新平台", len:3, type:"键值", strType:"c",strLen:6, valLen:1, haveUnit:true},
{name:"科技金融", len:3, type:"键值", strType:"c",strLen:6, valLen:3, haveUnit:true},
{name:"股权融资趋势", len:6, type:"柱状"},
{name:"地图数据", len:8, type:"地图"}
]}
];
function createBiz() {
apiInfoList.forEach(apiInfo=>{
let path = `./biz/${apiInfo.name}.ts`;
fs.access(path, (err) => {
if (!err) {
console.error(path, "文件已存在");
return;
}
fs.writeFileSync(path, getBizFileData(apiInfo.dataList));
console.log(path, "创建文件成功")
});
})
}
function createRouter() {
let path = `./routers/router.ts`;
fs.access(path, (err) => {
if (!err) {
console.error(path, "文件已存在");
return;
}
fs.writeFileSync(path, getRouterFileData(apiInfoList));
console.log(path, "创建文件成功")
});
}
function getBizFileData(dataList) {
let funStr = "";
let runFunStr = "";
let mockFunStr = "";
dataList.forEach(dataInfo=>{
let subFunStr = ``;
switch(dataInfo.type) {
case "键值" : subFunStr = `mock键值数据模板(${dataInfo.len}, ${dataInfo.strLen}, '${dataInfo.strType}', ${dataInfo.valLen}, ${dataInfo.haveUnit})`; break;
case "柱状" : subFunStr = `mock柱状图数据模板(${dataInfo.len})`; break;
case "地图" : subFunStr = `mock地图数据模板(${dataInfo.len})`; break;
};
funStr +=
`function get${dataInfo.name}() {
return ${subFunStr};
}
`;
runFunStr +=
` ret["${dataInfo.name}"] = get${dataInfo.name}();
`
});
let allData =
`import { mock柱状图数据模板, mock键值数据模板, mock地图数据模板} from "../util/mockData";
export async function getData(req, res) {
let ret:any = {};
${runFunStr}
res.send(ret);
}
${funStr}
`
return allData;
}
function getRouterFileData(apiInfoList) {
let importStr = "";
let listenStr = "";
apiInfoList.forEach(apiInfo=>{
importStr +=
`import * as ${apiInfo.name}Biz from '../biz/${apiInfo.name}';
`
listenStr +=
` httpServer.get('/${apiInfo.name}', asyncHandler(${apiInfo.name}Biz.getData));
`
})
let allDataStr =
`import * as asyncHandler from 'express-async-handler'
${importStr}
export function setRouter(httpServer) {
${listenStr}
}`
return allDataStr;
}
createBiz();
createRouter();
\ No newline at end of file
......@@ -4,11 +4,7 @@ import { getInterfaceByInterfaceName } from "./cronJob";
export async function getCdssfzjk() {
let interfaceName = "绿色电力充电设施发展监控";
let {chargingFacilities, realTimeMonitoring, monthlyService} = await getInterfaceByInterfaceName(interfaceName);
// let chargingFacilities:any = {};
// let realTimeMonitoring:any = {};
// let monthlyService = [{"dateTime":"202202","frequency":11081},{"dateTime":"202203","frequency":9480},{"dateTime":"202204","frequency":2833},{"dateTime":"202205","frequency":4830},{"dateTime":"202206","frequency":16926}];
if (JSON.stringify(chargingFacilities) === '{}') chargingFacilities = {chargingStationNumber:0, chargingPileNumber:0, prioritiesInTheSite:0};
if (JSON.stringify(realTimeMonitoring) === '{}') realTimeMonitoring = {theTotalChargeOn:0, totalCharge:0, chargeAmount:0};
if (!chargingFacilities) throw new BizError(`${interfaceName} 缺少参数 chargingFacilities` );
......
......@@ -4,11 +4,6 @@ import { getInterfaceByInterfaceName } from "./cronJob";
export async function getCsqxtfz() {
let interfaceName = "城市群协同发展";
let {basicData, demonstrationAreaIndexTrend, rangeData} = await getInterfaceByInterfaceName(interfaceName);
// ------------test----------
// let basicData:any = {"regionalIndex":116.6800,"economic":114.4600,"nonAgriculturalIndustries":114.3100,"resourcesEndowment":120.0800};
// let demonstrationAreaIndexTrend = [{"month":"202101","value":113.2200},{"month":"202102","value":114.2700},{"month":"202103","value":110.6700},{"month":"202104","value":109.2500},{"month":"202105","value":113.6700},{"month":"202106","value":110.4300},{"month":"202107","value":108.5300},{"month":"202108","value":107.8500},{"month":"202109","value":107.6900},{"month":"202110","value":106.2300},{"month":"202111","value":104.5900},{"month":"202112","value":103.7000},{"month":"202201","value":127.1400},{"month":"202202","value":134.9100},{"month":"202203","value":122.9900},{"month":"202204","value":116.6800}];
// ------------end------------
if (JSON.stringify(basicData) === '{}') basicData = {regionalIndex:0, economic:0, nonAgriculturalIndustries:0, resourcesEndowment:0};
if (JSON.stringify(rangeData) === '{}') rangeData = {regionalScope:"", timeRange:""};
......@@ -45,12 +40,6 @@ export async function getCsqxtfz() {
export async function getArea(area) {
let interfaceName = "城市群协同发展";
let {wujiangDistriceData, qinpuDistriceData, jiashanDistriceData} = await getInterfaceByInterfaceName(interfaceName);
// ------------test----------
// let wujiangDistriceData:any = {"deJurePopulation":0.0000,"ardeJurePopulationea":0.0000,"GDP":0.0000,"totalElectricityConsumption":0.0000,"cumulativeInstallationCapacity":0.0000,"maximumSociallload":0.0000};
// let qinpuDistriceData:any = {"deJurePopulation":0.0000,"ardeJurePopulationea":0.0000,"GDP":0.0000,"totalElectricityConsumption":0.0000,"cumulativeInstallationCapacity":0.0000,"maximumSociallload":0.0000};
// let jiashanDistriceData:any = {"deJurePopulation":0.0000,"ardeJurePopulationea":0.0000,"GDP":0.0000,"totalElectricityConsumption":0.0000,"cumulativeInstallationCapacity":0.0000,"maximumSociallload":0.0000};
// ------------end------------
if (JSON.stringify(wujiangDistriceData) === '{}') wujiangDistriceData = {deJurePopulation:0, ardeJurePopulationea:0, GDP:0, totalElectricityConsumption:0, cumulativeInstallationCapacity:0, maximumSociallload:0};
if (JSON.stringify(qinpuDistriceData) === '{}') qinpuDistriceData = {deJurePopulation:0, ardeJurePopulationea:0, GDP:0, totalElectricityConsumption:0, cumulativeInstallationCapacity:0, maximumSociallload:0};
......
......@@ -4,11 +4,6 @@ import { getInterfaceByInterfaceName } from "./cronJob";
export async function getGsqyscyx() {
let interfaceName = "规上企业生产运行状况";
let {basicData, productionIndexTrend, rangeData} = await getInterfaceByInterfaceName(interfaceName);
// ------------------test------------
// let basicData:any = {};
// let productionIndexTrend = [{"year":"2020","productionIndices":102.59},{"year":"2021","productionIndices":119.69},{"year":"2022","productionIndices":103.65}];
// ------------------end------------
if (JSON.stringify(basicData) === '{}') basicData = {productionIndex:0};
if (JSON.stringify(rangeData) === '{}') rangeData = {regionalScope:"", timeRange:""};
......@@ -40,11 +35,6 @@ export async function getGsqyscyx() {
export async function getIndustrial(name) {
let interfaceName = "规上企业生产运行状况";
let {industryProductionIndex, industrialDistribution} = await getInterfaceByInterfaceName(interfaceName);
// ----------------test------------
// let industryProductionIndex:any = {"industrial":0.00,"transportationAndWarehousingAndPostalServices":0.00,"wholesaleAndRetail":0.00,"leasingAndBusinessService":0.00,"publicServiceAndManagementOrganization":0.00};
// let industrialDistribution:any = {"industrial":0,"transportationAndWarehousingAndPostalServices":0,"wholesaleAndRetail":0,"leasingAndBusinessService":0,"publicServiceAndManagementOrganization":0};
// ----------------end-------------
if (JSON.stringify(industryProductionIndex) === '{}') industryProductionIndex= {industrial:0, wholesaleAndRetail:0, leasingAndBusinessService:0, transportationAndWarehousingAndPostalServices:0, publicServiceAndManagementOrganization:0};
if (JSON.stringify(industrialDistribution) === '{}') industrialDistribution = {industrial:0, wholesaleAndRetail:0, leasingAndBusinessService:0, transportationAndWarehousingAndPostalServices:0, publicServiceAndManagementOrganization:0};
......
......@@ -3,15 +3,7 @@ import { getInterfaceByInterfaceName } from "./cronJob";
export async function getHyydfb() {
let interfaceName = "行业用电分布";
let {basicData, demonstrationAreaIndustryElectricity, concentrationAnalysisOfKeyIndustries, electricityConsumptionByIndustry, rangeData} = await getInterfaceByInterfaceName(interfaceName);
// ------------------test------------
// let basicData:any = {demonstrationAreaIndustryElectricity:""};
// let demonstrationAreaIndustryElectricity:any = {"fisheries":0.35,"industrial":17.25,"constructionIndustry":0.67,"transportationAndWarehousingAndPostalServices":1.03,"informationTechnologyServices":2.64,"wholesaleAndRetail":2.01,"accommodationAndCatering":0.28,"financialIndustry":0.07,"realEstate":3.78,"leasingAndBusinessService":0.35,"publicServiceAndManagementOrganization":2.50};
// let concentrationAnalysisOfKeyIndustries = [{"month":"202109","travel":68.0200,"informationTechnology":75.1300,"modernLogistics":89.9300},{"month":"202110","travel":66.8200,"informationTechnology":75.4800,"modernLogistics":67.5900}];
// let electricityConsumptionByIndustry:any = {"qingPuArea":{"农,林,牧,渔业":0.00,"工业":0.00,"建筑业":0.00,"交通运输,仓储和邮政业":0.00,"信息传输,软件和信息技术服务业":0.00,"批发和零售业":0.00,"住宿和餐饮业":0.00,"金融业":0.00,"房地产业":0.00,"租赁和商务服务业":0.00,"公共服务及管理组织":0.00},"wuJiangArea":{"农,林,牧,渔业":0.00,"工业":0.00,"建筑业":0.00,"交通运输,仓储和邮政业":0.00,"信息传输,软件和信息技术服务业":0.00,"批发和零售业":0.00,"住宿和餐饮业":0.00,"金融业":0.00,"房地产业":0.00,"租赁和商务服务业":0.00,"公共服务及管理组织":0.00},"jiaShanCounty":{"农,林,牧,渔业":0.00,"工业":0.00,"建筑业":0.00,"交通运输,仓储和邮政业":0.00,"信息传输,软件和信息技术服务业":0.00,"批发和零售业":0.00,"住宿和餐饮业":0.00,"金融业":0.00,"房地产业":0.00,"租赁和商务服务业":0.00,"公共服务及管理组织":0.00}};
// let rangeData = {regionalScope:"", timeRange:""};
// ------------------end------------
let {basicData, concentrationAnalysisOfKeyIndustries, electricityConsumptionByIndustry, rangeData} = await getInterfaceByInterfaceName(interfaceName);
if (JSON.stringify(basicData) === '{}') basicData = {demonstrationAreaIndustryElectricity:0};
if (JSON.stringify(electricityConsumptionByIndustry) === '{}') electricityConsumptionByIndustry = {"qingPuArea":{"农,林,牧,渔业":0.00,"工业":0.00,"建筑业":0.00,"交通运输,仓储和邮政业":0.00,"信息传输,软件和信息技术服务业":0.00,"批发和零售业":0.00,"住宿和餐饮业":0.00,"金融业":0.00,"房地产业":0.00,"租赁和商务服务业":0.00,"公共服务及管理组织":0.00},"wuJiangArea":{"农,林,牧,渔业":0.00,"工业":0.00,"建筑业":0.00,"交通运输,仓储和邮政业":0.00,"信息传输,软件和信息技术服务业":0.00,"批发和零售业":0.00,"住宿和餐饮业":0.00,"金融业":0.00,"房地产业":0.00,"租赁和商务服务业":0.00,"公共服务及管理组织":0.00},"jiaShanCounty":{"农,林,牧,渔业":0.00,"工业":0.00,"建筑业":0.00,"交通运输,仓储和邮政业":0.00,"信息传输,软件和信息技术服务业":0.00,"批发和零售业":0.00,"住宿和餐饮业":0.00,"金融业":0.00,"房地产业":0.00,"租赁和商务服务业":0.00,"公共服务及管理组织":0.00}};
......@@ -38,19 +30,9 @@ export async function getHyydfb() {
//三地各行业用电量
let electricityInfo;
let qingPuAreaData = {};
let wuJiangAreaData = {};
let jiaShanCountyData = {};
// electricityConsumptionByIndustry.forEach( info => {
// let {industryName, qingPuArea, wuJiangArea, jiaShanCounty} = info;
// qingPuAreaData[industryName] = qingPuArea;
// wuJiangAreaData[industryName] = wuJiangArea;
// jiaShanCountyData[industryName] = jiaShanCounty;
// })
let {qingPuArea, wuJiangArea, jiaShanCounty} = electricityConsumptionByIndustry;
electricityInfo = {青浦区: qingPuArea, 吴江区: wuJiangArea, 嘉善县: jiaShanCounty};
// electricityInfo = {青浦区: qingPuAreaData, 吴江区: wuJiangAreaData, 嘉善县: jiaShanCountyData};
//范围数据
let {regionalScope, timeRange} = rangeData;
......@@ -65,10 +47,6 @@ export async function getHyydfb() {
export async function getElectricity() {
let interfaceName = "行业用电分布";
let {demonstrationAreaIndustryElectricity} = await getInterfaceByInterfaceName(interfaceName);
// -----------------test---------------------
// let demonstrationAreaIndustryElectricity:any = {"fisheries":0.35,"industrial":17.25,"constructionIndustry":0.67,"transportationAndWarehousingAndPostalServices":1.03,"informationTechnologyServices":2.64,"wholesaleAndRetail":2.01,"accommodationAndCatering":0.28,"financialIndustry":0.07,"realEstate":3.78,"leasingAndBusinessService":0.35,"publicServiceAndManagementOrganization":2.50};
// ------------------end--------------------
if (JSON.stringify(demonstrationAreaIndustryElectricity) === '{}') demonstrationAreaIndustryElectricity = {industrial:0, publicServiceAndManagementOrganization:0, realEstate:0, wholesaleAndRetail:0, informationTechnologyServices:0, transportationAndWarehousingAndPostalServices:0, constructionIndustry:0, accommodationAndCatering:0, fisheries:0, leasingAndBusinessService:0, financialIndustry:0};
......
......@@ -4,13 +4,6 @@ import { getInterfaceByInterfaceName } from "./cronJob";
export async function getJjjqd() {
let interfaceName = "经济景气度";
let {basicData, prosperityIndexOfKeyRegions, industrialDistribution, economicSentimentIndex, rangeData} = await getInterfaceByInterfaceName(interfaceName);
// -----------------test-----------------
// let basicData:any = {demonstrationAreaEconomicProsperity:89.0300, wuJiangDistrict:0.0000, qingPuDistrict:103.6485, jiaShanCounty:0.0000};
// let prosperityIndexOfKeyRegions:any = {"xiHongQiao":143.8673,"xianXingQiDongArea":149.3286,"qingPuNewTown":112.9732};
// let industrialDistribution:any = {"constructionIndustry":113.4870,"leasingAndBusinessService":149.7152,"wholesaleAndRetail":108.2574,"financialIndustry":82.8192,"realEstate":113.0102,"informationTechnologyServices":157.9385,"transportationAndWarehousingAndPostalServices":90.0323,"fisheries":121.9266,"industrial":101.3097,"accommodationAndCatering":109.9809,"publicServiceAndManagementOrganization":83.5883};
// let economicSentimentIndex = [{"year":"2020","trend":102.5900},{"year":"2021","trend":119.6900},{"year":"2022","trend":103.6485}];
// -----------------end-----------------
if (JSON.stringify(basicData) === '{}') basicData = {demonstrationAreaEconomicProsperity:0, wuJiangDistrict:0, qingPuDistrict:0, jiaShanCounty:0}
if (JSON.stringify(prosperityIndexOfKeyRegions) === '{}') prosperityIndexOfKeyRegions = {xiHongQiao:0, xianXingQiDongArea:0, qingPuNewTown:0};
......
......@@ -5,14 +5,6 @@ export async function getQjnygfjr() {
let interfaceName = "绿色电力清洁能源光伏接入";
let {totalCustomer, realTimeMonitoring, distributedPvCustomerTrends, distributedPhotovoltaicCustomer, powerAnalysis} = await getInterfaceByInterfaceName(interfaceName);
// -----------------test---------------
// let totalCustomer:any = {"nonResidentCustomer":144,"residentCustomer":2156};
// let realTimeMonitoring:any = {"NO2":136.0100,"SO2":272.0100,"CO2":9039.8100};
// let distributedPvCustomerTrends = [{"year":"2013","value":52},{"year":"2014","value":38},{"year":"2015","value":103},{"year":"2016","value":230},{"year":"2017","value":647},{"year":"2018","value":551},{"year":"2019","value":208},{"year":"2020","value":216},{"year":"2021","value":222}];
// let distributedPhotovoltaicCustomer:any = {"distributedPvCustomer":2300,"proportionOfNonResidents":6.26};
// let powerAnalysis = [{"month":"202109","powerGeneration":678.26,"theInternetCharge":283.06},{"month":"202110","powerGeneration":545.48,"theInternetCharge":261.63},{"month":"202111","powerGeneration":817.33,"theInternetCharge":391.54},{"month":"202112","powerGeneration":565.76,"theInternetCharge":221.11},{"month":"202201","powerGeneration":499.96,"theInternetCharge":171.82},{"month":"202202","powerGeneration":586.67,"theInternetCharge":241.58},{"month":"202203","powerGeneration":676.75,"theInternetCharge":306.13},{"month":"202204","powerGeneration":767.72,"theInternetCharge":520.13},{"month":"202205","powerGeneration":806.03,"theInternetCharge":451.83},{"month":"202206","powerGeneration":906.70,"theInternetCharge":331.05}];
// ----------------end------------------
if (JSON.stringify(totalCustomer) === '{}') totalCustomer = {residentCustomer:0, nonResidentCustomer:0};
if (JSON.stringify(realTimeMonitoring) === '{}') realTimeMonitoring = {NO2:0, SO2:0, CO2:0};
if (JSON.stringify(distributedPhotovoltaicCustomer) === '{}') distributedPhotovoltaicCustomer = {distributedPvCustomer:0, proportionOfNonResidents:0};
......@@ -70,10 +62,6 @@ export async function getPowerGeneration() {
let interfaceName = "绿色电力清洁能源光伏接入";
let {totalGeneratingCapacity} = await getInterfaceByInterfaceName(interfaceName);
// -------------------test---------------------
// let totalGeneratingCapacity:any = {"grossGeneration":0.09,"proportionOfNonResidents":0.00};
// -------------------end----------------------
if (JSON.stringify(totalGeneratingCapacity) === '{}') totalGeneratingCapacity = {grossGeneration:0, proportionOfNonResidents:0};
if (!totalGeneratingCapacity) throw new BizError(`${interfaceName} 缺少参数 totalGeneratingCapacity` );
......@@ -92,10 +80,6 @@ export async function getInstalledCapacity() {
let interfaceName = "绿色电力清洁能源光伏接入";
let {theInstalledCapacity} = await getInterfaceByInterfaceName(interfaceName);
// ------------------test--------------
// let theInstalledCapacity:any = {"installedCapacity":123, "proportionOfNonResidents":4589};
// ------------------end---------------
if (JSON.stringify(theInstalledCapacity) === '{}') theInstalledCapacity = {installedCapacity:0, proportionOfNonResidents:0};
if (!theInstalledCapacity) throw new BizError(`${interfaceName} 缺少参数 theInstalledCapacity` );
......
......@@ -4,14 +4,6 @@ import { getInterfaceByInterfaceName } from "./cronJob";
export async function getQydzxypg() {
let interfaceName = "企业贷中信用评估";
let {distributionOfEachCreditRating, highQualityCreditEnterprise, ventureEnterprise, monthlyBusinessCreditChanges, industryCreditDistribution, rangeData} = await getInterfaceByInterfaceName(interfaceName);
// -----------------test-----------------
// let distributionOfEachCreditRating:any = {"excellentCredit":0.0000,"goodCredit":0.0000,"generalCredit":0.0000,"poorCredit":0.0000};
// let highQualityCreditEnterprise = [{"companyName":"上海幼儿园","value":100}];
// let ventureEnterprise = [{"companyName":"深圳市花样年国际物业服务有限公司上海分公司","value":65.000},{"companyName":"融信世欧物业服务集团有限公司上海分公司","value":65.000},{"companyName":"地下1层防火分区二车库排烟风机(常备用)","value":65.000},{"companyName":"上海伯爵厨房设备有限公司","value":63.330},{"companyName":"上海甫多电气有限公司","value":54.390}];
// let monthlyBusinessCreditChanges = [{"month":"202109","excellentCredit":2535.0000,"goodCredit":876.0000,"generalCredit":607.0000,"poorCredit":405.0000},{"month":"202110","excellentCredit":2684.0000,"goodCredit":767.0000,"generalCredit":569.0000,"poorCredit":393.0000},{"month":"202111","excellentCredit":2342.0000,"goodCredit":894.0000,"generalCredit":695.0000,"poorCredit":475.0000},{"month":"202112","excellentCredit":2474.0000,"goodCredit":868.0000,"generalCredit":602.0000,"poorCredit":483.0000},{"month":"202201","excellentCredit":2203.0000,"goodCredit":1064.0000,"generalCredit":637.0000,"poorCredit":550.0000},{"month":"202202","excellentCredit":2096.0000,"goodCredit":1001.0000,"generalCredit":624.0000,"poorCredit":699.0000},{"month":"202203","excellentCredit":2014.0000,"goodCredit":1129.0000,"generalCredit":638.0000,"poorCredit":714.0000},{"month":"202204","excellentCredit":2026.0000,"goodCredit":1150.0000,"generalCredit":678.0000,"poorCredit":657.0000},{"month":"202205","excellentCredit":1595.0000,"goodCredit":1279.0000,"generalCredit":851.0000,"poorCredit":788.0000},{"month":"202206","excellentCredit":1459.0000,"goodCredit":1313.0000,"generalCredit":984.0000,"poorCredit":757.0000}];
// let rangeData = {"regionalScope":"青浦区","timeRange":"2022年7月"};
// ------------------end-----------------
if (JSON.stringify(distributionOfEachCreditRating) === '{}') distributionOfEachCreditRating = {excellentCredit:0, goodCredit:0, generalCredit:0, poorCredit:0};
if (JSON.stringify(rangeData) === '{}') rangeData = {regionalScope:"", timeRange:""};
......@@ -48,7 +40,6 @@ export async function getQydzxypg() {
});
ventureEnterprise.forEach( info => {
let {companyName, value} = info;
// companyName = companyName.slice(0, 5);
venture[companyName] = value;
})
......@@ -60,7 +51,6 @@ export async function getQydzxypg() {
let poorCreditData = {};
monthlyBusinessCreditChanges.forEach( info => {
let {month, excellentCredit, goodCredit, generalCredit, poorCredit} = info;
// let monthly = month.slice(month.length - 2, month.length) + "月";
let monthly = month;
excellentCreditData[monthly] = excellentCredit;
goodCreditData[monthly] = goodCredit;
......@@ -82,7 +72,6 @@ export async function getQydzxypg() {
export async function getindustryCredit() {
let interfaceName = "企业贷中信用评估";
let {industryCreditDistribution} = await getInterfaceByInterfaceName(interfaceName);
// let industryCreditDistribution = [{"industryName":"农,林,牧,渔业","excellentCredit":0.0000,"goodCredit":0.0000,"generalCredit":0.0000,"poorCredit":0.0000},{"industryName":"工业","excellentCredit":0.0000,"goodCredit":0.0000,"generalCredit":0.0000,"poorCredit":0.0000},{"industryName":"建筑业","excellentCredit":0.0000,"goodCredit":0.0000,"generalCredit":0.0000,"poorCredit":0.0000},{"industryName":"交通运输,仓储和邮政业","excellentCredit":0.0000,"goodCredit":0.0000,"generalCredit":0.0000,"poorCredit":0.0000},{"industryName":"信息传输,软件和信息技术服务业","excellentCredit":0.0000,"goodCredit":0.0000,"generalCredit":0.0000,"poorCredit":0.0000},{"industryName":"批发和零售业","excellentCredit":0.0000,"goodCredit":0.0000,"generalCredit":0.0000,"poorCredit":0.0000},{"industryName":"住宿和餐饮业","excellentCredit":0.0000,"goodCredit":0.0000,"generalCredit":0.0000,"poorCredit":0.0000},{"industryName":"金融业","excellentCredit":0.0000,"goodCredit":0.0000,"generalCredit":0.0000,"poorCredit":0.0000},{"industryName":"房地产业","excellentCredit":0.0000,"goodCredit":0.0000,"generalCredit":0.0000,"poorCredit":0.0000},{"industryName":"租赁和商务服务业","excellentCredit":0.0000,"goodCredit":0.0000,"generalCredit":0.0000,"poorCredit":0.0000},{"industryName":"公共服务及管理组织","excellentCredit":0.0000,"goodCredit":0.0000,"generalCredit":0.0000,"poorCredit":0.0000}];
if (!industryCreditDistribution) throw new BizError(`${interfaceName} 缺少参数 industryCreditDistribution` );
......
......@@ -5,117 +5,6 @@ export async function getQyrh() {
let interfaceName = "区域融合";
let {dutyManagement, realTimeMonitoring, monitoringResults, businessDefecation, businessTimeliness, businessInteractivity, schedulingLogOverhaulSchedule,
schedulingLogTroubleshooting, schedulingLogPowerOutage, schedulingLogDeviceDefect, schedulingLogAccidentException} = await getInterfaceByInterfaceName(interfaceName);
// ------------------------test--------------------------
// let dutyManagement = [
// {
// "name":"青浦-周佳佳",
// "required":"是"
// },
// {
// "name":"青浦-赵璐璐",
// "required":"否"
// }
// ];
// let realTimeMonitoring = {
// "redCode":"1797",
// "blackCode":"5990",
// "blueCode":"0",
// "redBlueCode":"0"
// };
// let monitoringResults = {
// "uneconomicalElectricity":"276",
// "electricalTestAre":"688",
// "excessCapacity":"1367",
// "reactiveCompensation":"1307"
// };
// let businessDefecation = {
// "businessLineApplication":"1757",
// "onlinePayment":"42.09",
// "doElectricityCut":"2",
// "reductionOfApplicationMaterials":"3"
// };
// let businessTimeliness = {
// "highElectricityAverageLength":"63.15",
// "LowElectricityAverageLength":"2.79"
// };
// let businessInteractivity = {
// "value":"无",
// "ItsChineseOnline":"无",
// "FreeNetPhoneDo":"无",
// "BusinessHall":"无"
// };
// let schedulingLogOverhaulSchedule = [
// {
// "serialNumber":"01",
// "area":"青浦",
// "jobContent":"35千伏干俞8199线路迁改工程......",
// "dateTime":"2021/9/24"
// },
// {
// "serialNumber":"02",
// "area":"青浦",
// "jobContent":"练5泗联03843四农12队配变220v低压电压过低......",
// "dateTime":"2021/9/18"
// }
// ];
// let schedulingLogTroubleshooting = [
// {
// "serialNumber":"01",
// "area":"嘉善",
// "jobContent":"【客户内部故障】下发为低压故障......",
// "dateTime":"2021/8/29"
// },
// {
// "serialNumber":"02",
// "area":"嘉善",
// "jobContent":"【客户内部故障】下发为低压故障......",
// "dateTime":"2021/8/25"
// }
// ];
// let schedulingLogPowerOutage = [
// {
// "serialNumber":"01",
// "area":"青浦",
// "jobContent":"35千伏干俞8199线路迁改工程......",
// "dateTime":"2021/8/29"
// },
// {
// "serialNumber":"02",
// "area":"青浦",
// "jobContent":"练5泗联03843四农12队配变220v低压电压过低......",
// "dateTime":"2021/8/25"
// }
// ];
// let schedulingLogDeviceDefect = [
// {
// "serialNumber":"01",
// "area":"嘉善",
// "jobContent":"保测装置通信中断......",
// "dateTime":"2020/10/19"
// },
// {
// "serialNumber":"02",
// "area":"嘉善",
// "jobContent":"练5泗联18-6#位于村水泥路中间......",
// "dateTime":"2020/8/1"
// }
// ];
// let schedulingLogAccidentException = [
// {
// "serialNumber":"01",
// "area":"嘉善",
// "jobContent":"嘉善地区 110kV云寺变......",
// "dateTime":"2021/9/20"
// },
// {
// "serialNumber":"02",
// "area":"嘉善",
// "jobContent":"嘉善地区 110kV陶庄变......",
// "dateTime":"2021/9/16"
// }
// ];
// ------------------------end--------------------------
if (JSON.stringify(realTimeMonitoring) === '{}') realTimeMonitoring = {redCode:"0", blackCode:"0", blueCode:"0", redBlueCode:"0"};
if (JSON.stringify(monitoringResults) === '{}') monitoringResults = {uneconomicalElectricity:"0", electricalTestAre:"0", excessCapacity:"0", reactiveCompensation:"0"};
......
......@@ -4,7 +4,6 @@ import { getInterfaceByInterfaceName } from "./cronJob";
export async function getSfqztgk() {
let interfaceName = "示范区总体概况";
let {rangeData} = await getInterfaceByInterfaceName(interfaceName);
// let rangeData = {"regionalScope":"青浦区", "timeRange": "2021年1月-2022年1月"}
if (JSON.stringify(rangeData) === '{}') rangeData = {regionalScope:"", timeRange:""};
......
......@@ -6,22 +6,7 @@ export async function getSqjjhl() {
let {basicData, CIIEHolidayVitalityIndex, zhaoXiangDistrictHolidayVitalityIndex, qingPuNewTownHolidayVitalityIndex, zhuJiaJiaoHolidayVitalityIndex,
qingPuKeyBusinessDistrictIndex, CIIEConsumptionTypeAnalysis, zhaoXiangConsumptionTypeAnalysis, zhuJiaJiaoConsumptionTypeAnalysis,
qingPuNewTownConsumptionTypeAnalysis, qingPuEconomicVitalityTrend, rangeData} = await getInterfaceByInterfaceName(interfaceName);
// ----------------test-------------------
// let basicData = {overallEconomicVitalityIndex:""};
// let CIIEHolidayVitalityIndex = [{"holidayName":"春节","eat":0.0000,"live":186.4200,"game":104.6200,"entertainment":0.0000,"shopping":102.4300}];
// let zhaoXiangDistrictHolidayVitalityIndex = [{"holidayName":"春节","eat":0.0000,"live":0.0000,"game":99.0600,"entertainment":0.0000,"shopping":180.5600}];
// let qingPuNewTownHolidayVitalityIndex = [{"holidayName":"春节","eat":107.0100,"live":117.4700,"game":109.8000,"entertainment":127.9600,"shopping":100.3200}];
// let zhuJiaJiaoHolidayVitalityIndex = [{"holidayName":"春节","eat":182.1800,"live":103.8200,"game":90.8900,"entertainment":110.1000,"shopping":177.8700}];
// let qingPuKeyBusinessDistrictIndex = [];
// let CIIEConsumptionTypeAnalysis = [{"month":"202109","eat":0.0000,"live":97.1500,"game":81.4600,"entertainment":77.4200,"shopping":99.4700},{"month":"202110","eat":0.0000,"live":113.9700,"game":84.0200,"entertainment":108.4100,"shopping":100.4100},{"month":"202111","eat":0.0000,"live":95.9700,"game":96.1000,"entertainment":118.2700,"shopping":74.1400},{"month":"202112","eat":0.0000,"live":117.9500,"game":85.7900,"entertainment":119.3000,"shopping":114.3800},{"month":"202201","eat":0.0000,"live":131.7000,"game":78.7600,"entertainment":90.0000,"shopping":88.1600},{"month":"202202","eat":0.0000,"live":132.5400,"game":87.1900,"entertainment":126.8000,"shopping":82.3000},{"month":"202203","eat":0.0000,"live":151.5800,"game":93.8200,"entertainment":71.3300,"shopping":124.7600},{"month":"202204","eat":0.0000,"live":18.5500,"game":69.8300,"entertainment":18.5500,"shopping":31.5800},{"month":"202205","eat":0.0000,"live":112.5900,"game":76.5900,"entertainment":20.7800,"shopping":40.8400},{"month":"202206","eat":0.0000,"live":103.4612,"game":44.4928,"entertainment":0.0000,"shopping":88.2199}];
// let zhaoXiangConsumptionTypeAnalysis = [{"month":"202109","eat":0.0000,"live":12.5000,"game":97.3500,"entertainment":0.0000,"shopping":67.8300},{"month":"202110","eat":0.0000,"live":100.0000,"game":98.0900,"entertainment":0.0000,"shopping":76.9700},{"month":"202111","eat":0.0000,"live":1.1100,"game":99.5600,"entertainment":0.0000,"shopping":50.5000},{"month":"202112","eat":0.0000,"live":1.3800,"game":76.8500,"entertainment":0.0000,"shopping":125.9400},{"month":"202201","eat":0.0000,"live":87.5000,"game":68.9100,"entertainment":0.0000,"shopping":94.2500},{"month":"202202","eat":0.0000,"live":5.1700,"game":92.1000,"entertainment":0.0000,"shopping":94.3000},{"month":"202203","eat":0.0000,"live":100.0000,"game":89.8300,"entertainment":0.0000,"shopping":80.4600},{"month":"202204","eat":0.0000,"live":87.5000,"game":82.8700,"entertainment":0.0000,"shopping":10.9500},{"month":"202205","eat":0.0000,"live":100.0000,"game":77.7900,"entertainment":0.0000,"shopping":40.2400},{"month":"202206","eat":0.0000,"live":716.6667,"game":124.0882,"entertainment":0.0000,"shopping":71.6589}];
// let zhuJiaJiaoConsumptionTypeAnalysis = [{"month":"202109","eat":76.9500,"live":101.5500,"game":73.1600,"entertainment":0.0000,"shopping":87.4700},{"month":"202110","eat":95.6700,"live":112.2600,"game":95.3000,"entertainment":0.0000,"shopping":81.2500},{"month":"202111","eat":82.0000,"live":101.6600,"game":117.6100,"entertainment":0.0000,"shopping":79.4000},{"month":"202112","eat":101.2600,"live":105.6900,"game":119.7200,"entertainment":0.0000,"shopping":97.4800},{"month":"202201","eat":88.8500,"live":86.3100,"game":90.2000,"entertainment":0.0000,"shopping":87.6500},{"month":"202202","eat":86.6200,"live":98.9200,"game":92.5800,"entertainment":0.0000,"shopping":95.1300},{"month":"202203","eat":47.8300,"live":83.0100,"game":63.5100,"entertainment":0.0000,"shopping":59.0500},{"month":"202204","eat":20.9300,"live":45.8100,"game":33.6700,"entertainment":0.0000,"shopping":26.6200},{"month":"202205","eat":29.4300,"live":73.9400,"game":59.2700,"entertainment":0.0000,"shopping":18.7100},{"month":"202206","eat":38.1160,"live":96.7222,"game":64.3525,"entertainment":82.2432,"shopping":53.0803}];
// let qingPuNewTownConsumptionTypeAnalysis = [{"month":"202109","eat":103.6200,"live":70.0600,"game":93.9500,"entertainment":95.3100,"shopping":94.7700},{"month":"202110","eat":115.3200,"live":103.2600,"game":95.2300,"entertainment":101.3100,"shopping":103.3900},{"month":"202111","eat":90.3300,"live":91.2900,"game":80.1400,"entertainment":105.6700,"shopping":98.9400},{"month":"202112","eat":111.9600,"live":110.6000,"game":95.4200,"entertainment":102.4500,"shopping":114.2900},{"month":"202201","eat":110.7000,"live":101.2100,"game":88.3200,"entertainment":108.0600,"shopping":93.2900},{"month":"202202","eat":91.6600,"live":109.8600,"game":85.3200,"entertainment":92.8300,"shopping":75.1600},{"month":"202203","eat":110.2900,"live":108.6000,"game":106.3600,"entertainment":106.9000,"shopping":110.3100},{"month":"202204","eat":28.0100,"live":39.2900,"game":77.9800,"entertainment":82.8900,"shopping":30.6200},{"month":"202205","eat":52.1500,"live":76.0500,"game":80.6100,"entertainment":92.2400,"shopping":43.9900},{"month":"202206","eat":80.4087,"live":60.1710,"game":87.2616,"entertainment":77.6029,"shopping":91.0826}];
// let qingPuEconomicVitalityTrend = [{"month":"202111","qingPuNewTown":973.5985,"CIIECoreArea":889.1356,"zhaoXiangCommercialBusiness":725.8034,"zhuJiaJiaoAncientTown":775.9753}];
// let rangeData = {regionalScope:"", timeRange:""};
// ---------------end------------------------
if (JSON.stringify(basicData) === '{}') basicData = {overallEconomicVitalityIndex:"0"};
if (JSON.stringify(rangeData) === '{}') rangeData = {regionalScope:"", timeRange:""};
......
......@@ -4,14 +4,6 @@ import { getInterfaceByInterfaceName } from "./cronJob";
export async function getYskkqyjc() {
let interfaceName = "疑似空壳企业监测";
let {basicData, enterpriseDistributionDifferentCapacities, industrialDistribution, changesNumberShellCompanies, changesTrendShellCompanies, rangeData} = await getInterfaceByInterfaceName(interfaceName);
// ----------------test----------------
// let basicData:any = {"numberOfShellEnterprises":454,"suspectedShellRate":10.09};
// let enterpriseDistributionDifferentCapacities:any = {"within100":21,"mithin315":377,"more315":56};
// let industrialDistribution:any = {"fisheries":11,"industrial":59,"transportationAndWarehousingAndPostalServices":1,"informationTechnologyServices":1,"wholesaleAndRetail":14,"financialIndustry":1,"realEstate":341,"leasingAndBusinessService":6,"publicServiceAndManagementOrganization":20};
// let changesNumberShellCompanies = [{"year":"2018","numberOfShellCompanies":308},{"year":"2019","numberOfShellCompanies":351},{"year":"2020","numberOfShellCompanies":394},{"year":"2021","numberOfShellCompanies":432},{"year":"2022","numberOfShellCompanies":454}];
// let changesTrendShellCompanies = [{"year":"2018","changeTrend":8.87},{"year":"2019","changeTrend":8.89},{"year":"2020","changeTrend":9.76},{"year":"2021","changeTrend":9.80},{"year":"2022","changeTrend":10.09}];
// ---------------end-------------------
if (JSON.stringify(basicData) === '{}') basicData = {numberOfShellEnterprises:0, suspectedShellRate:0};
if (JSON.stringify(enterpriseDistributionDifferentCapacities) === '{}') enterpriseDistributionDifferentCapacities = {within100:0, mithin315:0, more315:0};
......
......@@ -5,10 +5,6 @@ export async function getZhdy() {
let interfaceName = "智慧电眼首页";
let {basicData} = await getInterfaceByInterfaceName(interfaceName);
// --------------test-------------
// let basicData:any = {"economicSentimentIndex":103.6485,"suspectedShellCompanyRate":0.0000,"coordinatedDevelopmentOfCityClusters":0.0000,"pollutingEnterpriseProductionIndex":0.0000};
// --------------end--------------
if (JSON.stringify(basicData) === '{}') basicData = {economicSentimentIndex:0, suspectedShellCompanyRate:0, coordinatedDevelopmentOfCityClusters:0, pollutingEnterpriseProductionIndex:0};
if (!basicData) throw new BizError(`${interfaceName} 缺少参数 basicData` );
......
......@@ -5,18 +5,6 @@ export async function getZzkzl() {
let interfaceName = "住宅空置率";
let {vacantHouseholdData, housingVacancyRateData, IdleUserPowerData, qingPuDistrictHousingVacancyRateTrend, housingVacancyRateInKeyAreas,
typicalResidentialVacancyRate, vacantHouseholdsInKeyAreas, typicalResidentialVacancyTrends, rangeData} = await getInterfaceByInterfaceName(interfaceName);
// ----------------test---------------------
// let vacantHouseholdData:any = {"numberOfVacantHouseholds":31924,"yoy":-2.77,"chainRatio":0.13,"statCycle":"202206"};
// let housingVacancyRateData:any = {"housingVacancyRate":7.76,"yoy":-6.27,"chainRatio":-0.11};
// let IdleUserPowerData:any = {"averagePowerConsumptionOfVacantUsers":0.47,"yoy":4.44,"chainRatio":58.33};
// let qingPuDistrictHousingVacancyRateTrend = [{"month":"202109","quantity":7.73},{"month":"202110","quantity":7.52},{"month":"202111","quantity":7.43},{"month":"202112","quantity":7.10},{"month":"202201","quantity":7.28},{"month":"202202","quantity":7.29},{"month":"202203","quantity":7.20},{"month":"202204","quantity":7.32},{"month":"202205","quantity":7.77},{"month":"202206","quantity":7.76}];
// let housingVacancyRateInKeyAreas = [{"keyAreaName":"青浦新城","userNum":7025,"vacancyRate":6.76},{"keyAreaName":"西虹桥","userNum":1195,"vacancyRate":6.87},{"keyAreaName":"先行启动区","userNum":6812,"vacancyRate":13.07}];
// let typicalResidentialVacancyRate = [{"keyAreaName":"界泾港新村","userNum":0,"vacancyRate":0.00},{"keyAreaName":"桂花园","userNum":0,"vacancyRate":0.00},{"keyAreaName":"观湖御景","userNum":0,"vacancyRate":0.00},{"keyAreaName":"恒大御澜庭","userNum":0,"vacancyRate":0.00},{"keyAreaName":"崧泽华城","userNum":0,"vacancyRate":0.00},{"keyAreaName":"首创禧悦晴朗","userNum":0,"vacancyRate":0.00}];
// let vacantHouseholdsInKeyAreas = [{"month":"202101","quantity":10.50},{"month":"202102","quantity":10.30},{"month":"202103","quantity":10.70},{"month":"202104","quantity":10.60},{"month":"202105","quantity":10.30},{"month":"202106","quantity":10.00},{"month":"202107","quantity":9.80},{"month":"202108","quantity":9.30},{"month":"202109","quantity":8.80},{"month":"202110","quantity":7.97},{"month":"202111","quantity":7.77},{"month":"202112","quantity":7.41},{"month":"202201","quantity":8.00},{"month":"202202","quantity":8.13},{"month":"202203","quantity":8.23},{"month":"202204","quantity":8.31},{"month":"202205","quantity":8.74},{"month":"202206","quantity":8.66}];
// let typicalResidentialVacancyTrends = [];
// let rangeData = {"regionalScope":"青浦区","timeRange":"2022年7月"};
// ----------------test---------------------
if (JSON.stringify(vacantHouseholdData) === '{}') vacantHouseholdData = {numberOfVacantHouseholds:0, chainRatio:0, yoy:0};
if (JSON.stringify(housingVacancyRateData) === '{}') housingVacancyRateData = {housingVacancyRate:0, chainRatio:0, yoy:0};
......@@ -73,9 +61,6 @@ export async function getZzkzl() {
export async function getHousingVacancyRate() {
let interfaceName = "住宅空置率";
let zzkzlData = await getInterfaceByInterfaceName(interfaceName);
// let zzkzlData:any = {housingVacancyRateData:{"housingVacancyRate":7.76,"yoy":-6.27,"chainRatio":-0.11}};
// -------------------test------------------------
if (JSON.stringify(zzkzlData.housingVacancyRateData) === '{}') zzkzlData.housingVacancyRateData = {housingVacancyRate:0, chainRatio:0, yoy:0};
if (!zzkzlData.housingVacancyRateData) throw new BizError(`${interfaceName} 缺少参数 housingVacancyRateData` );
......@@ -94,9 +79,6 @@ export async function getHousingVacancyRate() {
export async function getIdleUserPower() {
let interfaceName = "住宅空置率";
let zzkzlData = await getInterfaceByInterfaceName(interfaceName);
// let zzkzlData:any = {IdleUserPowerData:{"averagePowerConsumptionOfVacantUsers":0.47,"yoy":4.44,"chainRatio":58.33}};
// -------------------test------------------------
if (JSON.stringify(zzkzlData.IdleUserPowerData) === '{}') zzkzlData.IdleUserPowerData = {averagePowerConsumptionOfVacantUsers:0, chainRatio:0, yoy:0};
if (!zzkzlData.IdleUserPowerData) throw new BizError(`${interfaceName} 缺少参数 IdleUserPowerData` );
......@@ -115,10 +97,6 @@ export async function getIdleUserPower() {
export async function getResidentialVacancyRate() {
let interfaceName = "住宅空置率";
let zzkzlData = await getInterfaceByInterfaceName(interfaceName);
// -------------------test------------------------
// let zzkzlData = {typicalResidentialVacancyRate:[{"keyAreaName":"界泾港新村","userNum":83,"vacancyRate":3.25},{"keyAreaName":"桂花园","userNum":18,"vacancyRate":2.41},{"keyAreaName":"观湖御景","userNum":66,"vacancyRate":37.71},{"keyAreaName":"恒大御澜庭","userNum":154,"vacancyRate":10.93},{"keyAreaName":"崧泽华城","userNum":1060,"vacancyRate":13.20},{"keyAreaName":"首创禧悦晴朗","userNum":422,"vacancyRate":13.89}]};
if (!zzkzlData.typicalResidentialVacancyRate) throw new BizError(`${interfaceName} 缺少参数 typicalResidentialVacancyRate` );
//典型小区住房空置率
......@@ -140,8 +118,6 @@ export async function getResidentialVacancyRate() {
export async function getVacantHouseholdsInKeyAreas() {
let interfaceName = "住宅空置率";
let zzkzlData = await getInterfaceByInterfaceName(interfaceName);
// let zzkzlData = {vacantHouseholdsInKeyAreas:[{"month":"202101","quantity":10.50},{"month":"202102","quantity":10.30},{"month":"202103","quantity":10.70},{"month":"202104","quantity":10.60},{"month":"202105","quantity":10.30},{"month":"202106","quantity":10.00},{"month":"202107","quantity":9.80},{"month":"202108","quantity":9.30},{"month":"202109","quantity":8.80},{"month":"202110","quantity":7.97},{"month":"202111","quantity":7.77},{"month":"202112","quantity":7.41},{"month":"202201","quantity":8.00},{"month":"202202","quantity":8.13},{"month":"202203","quantity":8.23},{"month":"202204","quantity":8.31},{"month":"202205","quantity":8.74},{"month":"202206","quantity":8.66}]};
if (!zzkzlData.vacantHouseholdsInKeyAreas) throw new BizError(`${interfaceName} 缺少参数 vacantHouseholdsInKeyAreas` );
//重点区域空置户趋势
......@@ -158,8 +134,6 @@ export async function getVacantHouseholdsInKeyAreas() {
export async function getTypicalResidentialVacancyTrends() {
let interfaceName = "住宅空置率";
let zzkzlData = await getInterfaceByInterfaceName(interfaceName);
// let zzkzlData = {typicalResidentialVacancyTrends:[{"month":"202101","quantity":13.80},{"month":"202102","quantity":14.00},{"month":"202103","quantity":14.50},{"month":"202104","quantity":17.60},{"month":"202105","quantity":17.00},{"month":"202106","quantity":17.40},{"month":"202107","quantity":16.90},{"month":"202108","quantity":15.10},{"month":"202109","quantity":14.30},{"month":"202110","quantity":18.49},{"month":"202111","quantity":18.23},{"month":"202112","quantity":17.00},{"month":"202201","quantity":11.23},{"month":"202202","quantity":10.56},{"month":"202203","quantity":10.98},{"month":"202204","quantity":11.13},{"month":"202205","quantity":11.62},{"month":"202206","quantity":11.30}]};
if (!zzkzlData.typicalResidentialVacancyTrends) throw new BizError(`${interfaceName} 缺少参数 typicalResidentialVacancyTrends` );
//典型小区空置户趋势
......
let fs = require('fs');
const xlsx = require('node-xlsx');
const path = require('path');
//excel的名字
//const excelName = "其他数据模板.xlsx";
// const excelAnalysisName = "其他数据规则.xlsx";
const excelName = "绿色电力数据模板.xlsx";
const excelAnalysisName = "绿色电力解析规则.xlsx";
let typeEnum = {
"柱状数据":1,
"列表数据":1,
"单轴多柱状数据":1,
"双轴多柱状数据":1,
}
function changeDataName(str) {
let result = str.replace(/[()""“”()]/, "_");
for (let i =0; i < 10; i++) {
result = result.replace(/[()""“”()]/, "_");
}
return result;
}
let createBizAndDataConfigMap = {
// "page1": {
// sheetName:"智慧电眼_电力用户数",
// apiList:[
// { type:"键值数据", dataName:"基础数据", title:"基础数据", unit:"inData", total:true, percent:false},
// { type:"双轴多柱状数据", dataName:"用电趋势", title:"用电趋势", unit:{"用户数":"家", "空置率":"%"}, total:true, percent:false},
// { type:"柱状数据", dataName:"用电排序趋势", title:"用电排序趋势", unit:"户", total:true, percent:false},
// { type:"柱状数据", dataName:"企业生产指数", title:"企业生产指数", unit:"户", total:true, percent:false}
// ]
// }
};
//配置解析excel
function analysisConfigExcel() {
const workSheetsFromFile = xlsx.parse(`../res/${excelAnalysisName}`);
let sheetMap = {};
let sheetList = [];
for (let i = 0; i < workSheetsFromFile.length; i++) {
let sheetInfo = workSheetsFromFile[i];
sheetMap[sheetInfo.name] = sheetInfo.data;
sheetList.push(sheetInfo);
}
return sheetMap
}
function createConfig() {
let excelData = analysisConfigExcel();
for (let configSheetName in excelData) {
let data = excelData[configSheetName];
for (let y = 1; y < data.length; y++) {
let valueList = data[y];
let pageName = valueList[0];
let sheetName = valueList[1];
let type = valueList[2];
let dataName = changeDataName(valueList[3]);
let title = valueList[4];
let unit = valueList[5];
let total = valueList[6];
let percent = valueList[7];
let titleList = valueList[8] ? JSON.parse(valueList[8]) : "";
let keyValueObj = valueList[9] ? JSON.parse(valueList[9]) : "" ;
if (!createBizAndDataConfigMap[pageName] ) createBizAndDataConfigMap[pageName] = {sheetName, apiList:[]};
createBizAndDataConfigMap[pageName].apiList.push({ type ,dataName ,title ,unit ,total ,percent, titleList, keyValueObj });
}
}
}
createConfig();
//创建data层
function createData() {
let str = `
import * as path from "path";
import * as fs from "fs";
import { BizError } from "../util/bizError";
import { limitEnteNameString, changeDataName } from "../util/tools";
import { getExcelDataBySheetName, analysisExcelDataOfObject, analysisExcelDataOfMoreObject, analysisExcelDataOfList } from "../util/analysisExcel";`;
for (let pangeName in createBizAndDataConfigMap) {
let { sheetName } = createBizAndDataConfigMap[pangeName];
let ofMoreObjList = [];
let ofObjList = [];
let listDataAnalysisInfo = {};
createBizAndDataConfigMap[pangeName].apiList.forEach( info => {
if (info.type == "双轴多柱状数据" || info.type == "单轴多柱状数据") ofMoreObjList.push(info.dataName);
else if (info.type == "列表数据") listDataAnalysisInfo[info.dataName] = {titleList:info.titleList, keyValueObj:info.keyValueObj};
else ofObjList.push(info.dataName);
});
str += `
export function get${sheetName}() {;
let bolckDataList = getExcelDataBySheetName('${excelName}', '${sheetName}');
let result = {};
let ofMoreObjList = ${JSON.stringify(ofMoreObjList)};
let ofObjList = ${JSON.stringify(ofObjList)};
let listDataAnalysisInfo = ${JSON.stringify(listDataAnalysisInfo)};
for (let i = 0; i < bolckDataList.length; i++) {
let {blockData, blockTitle} = bolckDataList[i];
let changeName = changeDataName(blockTitle);
if (ofMoreObjList.indexOf(changeName) > -1) result[changeName] = analysisExcelDataOfMoreObject(blockData, false);
if (ofObjList.indexOf(changeName) > -1) result[changeName] = analysisExcelDataOfObject(blockData, true, false);
if (listDataAnalysisInfo[changeName]) result[changeName] = analysisExcelDataOfList(blockData, listDataAnalysisInfo[blockTitle].keyValueObj, false);
}
return result;
}`;
}
let path = `./data/analysisExcelData.ts`;
fs.access(path, (err) => {
if (!err) {
console.error(path, "文件已存在");
return;
}
fs.writeFileSync(path, str);
console.log(path, "创建文件成功")
});
}
//创建biz层
function createBiz(){
for (let pageName in createBizAndDataConfigMap) {
let { apiList, sheetName } = createBizAndDataConfigMap[pageName];
let thisBizData = getBizStr(apiList, sheetName);
let path = `./biz/${pageName}.ts`;
fs.access(path, (err) => {
if (!err) {
console.error(path, "文件已存在");
return;
}
fs.writeFileSync(path, thisBizData);
console.log(path, "创建文件成功")
});
}
}
function getBizStr(apiList, sheetName) {
let str = `
import { getChartData, getKeyValue, getListData, getSingleYAndMoreData, getMoreYChartData, objKeyReplace }from "../util/tools";
import { get${sheetName} } from "../data/analysisExcelData";
`;
str += `
export function getData(req, res) {
let ret:any = {};
let excelData:any = get${sheetName}();
`;
apiList.forEach((info, index) => {
let {dataName, unit, total, percent, type, titleList, keyValueObj} = info;
const apiName = `api${index+1}`;
let subStr;
let chartUnit;
switch(type) {
case "键值数据":
subStr = `
let ${dataName}DataAndUnit = objKeyReplace(excelData.${dataName});`;
if (unit == 'inData') {
subStr += `
ret["${apiName}"] = getKeyValue("${dataName}", ${dataName}DataAndUnit.dataMap, ${dataName}DataAndUnit.unitMap, ${total}, ${percent} );`;
} else {
subStr += `
ret["${apiName}"] = getKeyValue("${dataName}", ${dataName}DataAndUnit.dataMap, ${typeof unit == 'boolean' ? unit : `'${unit}'`}, ${total}, ${percent} );`;
}
break;
case "柱状数据":
chartUnit = typeof unit == 'boolean' ? unit : `'${unit}'`;
subStr = `
ret["${apiName}"] = getChartData("${dataName}", excelData.${dataName}, ${chartUnit}, ${percent} );`;
break;
case "列表数据":
subStr = `
ret["${apiName}"] = getListData("${dataName}",excelData.${dataName},${JSON.stringify(titleList)},${JSON.stringify(keyValueObj)});`;
break;
case "单轴多柱状数据":
chartUnit = typeof unit == 'boolean' ? unit : `'${unit}'`;
subStr = `
ret["${apiName}"] = getSingleYAndMoreData("${dataName}", excelData.${dataName}, ${percent}, ${chartUnit});`;
break;
case "双轴多柱状数据":
subStr = `
ret["${apiName}"] = getMoreYChartData("${dataName}", excelData.${dataName}, ${percent}, ${unit})`;
break;
};
str+=
`${subStr}
`
});
str += `
res.send(ret);
}
`
return str;
}
//创建Router层
function createRouter() {
let importName =``;
let routergetName=``;
let routerpostName=``;
for (let pageName in createBizAndDataConfigMap) {
importName+=`
import * as ${pageName}Biz from '../biz/${pageName}';`;
routergetName+=`
httpServer.get('/${pageName}', asyncHandler(${pageName}Biz.getData));`;
routerpostName+=`
httpServer.post('/${pageName}', asyncHandler(${pageName}Biz.getData));`;
}
let str=`
import * as asyncHandler from 'express-async-handler'
${importName}
export function setRouter(httpServer){
${routergetName}
${routerpostName}
}`;
let path = `./routers/router.ts`;
fs.access(path, (err) => {
if (!err) {
console.error(path, "文件已存在");
return;
}
fs.writeFileSync(path, str);
console.log(path, "创建router文件成功")
});
}
createData();
createBiz();
createRouter();
......@@ -5,7 +5,7 @@ import { getPort } from "./serverConfig";
async function lanuch() {
// await initInterfaceData();
await initInterfaceData();
httpServer.createServer(getPort());
console.log('This indicates that the server is started successfully.');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment