Commit c1bdb757 by lixinming
parents f963c2c4 63a1dacc
This source diff could not be displayed because it is too large. You can view the blob instead.
import { changeListObjectToListByReflect, changeObjectKey, changeObjectToList, designativListKeyAddUnit, getDesignativByReflect } from "../../dataPackage/interfaceAnalysis";
import { BizError } from "../../util/bizError";
import { getInterfaceByInterfaceName } from "./cronJob";
function changeDataProcess(interfaceName, interfaceData, config) {
let result = {};
for (let dataName in config) {
let { type, operationsType, reflect, unitInfo } = config[dataName];
let fileData = interfaceData[dataName];
let fileType = typeof fileData;
let dataIsArray = Array.isArray(fileData);
if ( (type == "array" && !dataIsArray) || (type == "object" && dataIsArray) ||
(type == "object" && fileType != "object") || (type != "array" && fileType != type) ) {
throw new BizError(`接口 ${interfaceName}中的${dataName}类型错误应该为 ${type} 现在为${fileType}`);
}
let onceData;
switch (operationsType) {
case "object_ToList": onceData= changeObjectToList(fileData, reflect); break;
case "object_changeKey": onceData = changeObjectKey(fileData, reflect); break;
case "list_changeKey": onceData = changeListObjectToListByReflect(fileData, reflect); break;
}
if (unitInfo) onceData = designativListKeyAddUnit(onceData, unitInfo);
result[dataName] = onceData;
}
return result;
}
function jhjdInterfaceData() {
let jhjdinterfaceName = "计划进度";
let jhjdData:any = getInterfaceByInterfaceName(jhjdinterfaceName);
/*
zjbl = 证件办理 ;
zjblxxxl = 证件办理详细线路 ;
dq = 动迁 ;
dqxxxl = 动迁详细线路 ;
yj = 移交 ;
yjxxxl = 移交详细线路 ;
*/
let config = {"zjbl":{"type":"object","operationsType":"object_ToList","reflect":"","unitInfo":{}},"zjblxxxl":{"type":"object","operationsType":"object_ToList","reflect":"","unitInfo":{}},"dq":{"type":"object","operationsType":"object_ToList","reflect":"","unitInfo":{}},"dqxxxl":{"type":"object","operationsType":"object_ToList","reflect":"","unitInfo":{}},"yj":{"type":"object","operationsType":"object_ToList","reflect":"","unitInfo":{}},"yjxxxl":{"type":"object","operationsType":"object_ToList","reflect":"","unitInfo":{}}};
let interfaceData = Object.assign({}, jhjdData );
let changeData = changeDataProcess('计划进度', interfaceData, config);
//todo 剩下的就是将excel定好的数据和interface的数据关联起来了
}
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