rpt_calculation_data_util.js 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089
  1. 'use strict';
  2. /**
  3. * Created by Tony on 2019/6/18.
  4. * 计量报表数据提取class,是协助报表模板里指标字段自主提取数据的工具类
  5. */
  6. const JV = require('../rpt_component/jpc_value_define');
  7. const $JE = require('../rpt_component/jpc_rte');
  8. const fs = require('fs');
  9. const fsUtil = require('../../public/js/fsUtil');
  10. const stringUtil = require('../../public/js/stringUtil');
  11. const scMathUtil = require('../../public/js/scMathUtil');
  12. const data_analyze_util = require('../../lib/rpt_data_analysis').analysisObj;
  13. const _ = require('lodash');
  14. const treeUtil = require('../public/treeUtil');
  15. const RELATION_TABLES_KEYS = {
  16. project: { main_key: 'id' },
  17. tender: { main_key: 'id', foreign_key: { project: 'project_id' } },
  18. tender_info: { main_key: 'id', foreign_key: { project: 'pid', tender: 'tid' } },
  19. ledger: { main_key: 'id', isTree: true, tree_pid: 'ledger_pid', tree_id: 'ledger_id', foreign_key: { tender: 'tender_id' } },
  20. };
  21. class Rpt_Common {
  22. initialize(rpt_tpl, currentDataObj) {
  23. this.template = rpt_tpl;
  24. this.currentDataObj = currentDataObj;
  25. }
  26. Multiply(val1, val2, fixFormat) {
  27. const rst = [];
  28. let maxLen = val1.length;
  29. let minLen = val2.length;
  30. if (minLen > maxLen) {
  31. maxLen = maxLen + minLen; minLen = maxLen - minLen; maxLen = maxLen - minLen;
  32. }
  33. for (let i = 0; i < maxLen; i++) {
  34. let value = ((i < val1.length) ? val1[i] : val1[minLen - 1]) * ((i < val2.length) ? val2[i] : val2[minLen - 1]);
  35. if (value === null || value === undefined) {
  36. value = '0';
  37. }
  38. if (fixFormat) value = value.toFixed(fixFormat);
  39. rst.push(value);
  40. }
  41. return rst;
  42. }
  43. Divide(val1, val2, fixFormat) {
  44. const rst = [];
  45. let maxLen = val1.length;
  46. let minLen = val2.length;
  47. if (minLen > maxLen) {
  48. maxLen = maxLen + minLen; minLen = maxLen - minLen; maxLen = maxLen - minLen;
  49. }
  50. for (let i = 0; i < maxLen; i++) {
  51. let value = ((i < val1.length) ? val1[i] : val1[minLen - 1]) / ((i < val2.length) ? val2[i] : val2[minLen - 1]);
  52. if (fixFormat) value = value.toFixed(fixFormat);
  53. rst.push(value);
  54. }
  55. return rst;
  56. }
  57. Plus(val1, val2, fixFormat) {
  58. const rst = [];
  59. let maxLen = val1.length;
  60. let minLen = val2.length;
  61. if (minLen > maxLen) {
  62. maxLen = maxLen + minLen; minLen = maxLen - minLen; maxLen = maxLen - minLen;
  63. }
  64. for (let i = 0; i < maxLen; i++) {
  65. let value = ((i < val1.length) ? val1[i] : val1[minLen - 1]) + ((i < val2.length) ? val2[i] : val2[minLen - 1]);
  66. if (fixFormat) value = value.toFixed(fixFormat);
  67. rst.push(value);
  68. }
  69. return rst;
  70. }
  71. MultiPlus(arrVal, fixFormat) {
  72. const rst = [];
  73. for (let i = 0; i < arrVal.length; i++) {
  74. const valItem = arrVal[i];
  75. if (i === 0) {
  76. for (const dtl of valItem) {
  77. let value = parseFloat(dtl);
  78. if (fixFormat) value = value.toFixed(fixFormat);
  79. rst.push(value);
  80. }
  81. } else {
  82. for (let j = 0; j < valItem.length; j++) {
  83. if (j < rst.length) {
  84. let value = rst[j] + valItem[j];
  85. if (fixFormat) value = value.toFixed(fixFormat);
  86. rst[j] = value;
  87. } else {
  88. let value = parseFloat(valItem[j]);
  89. if (fixFormat) value = value.toFixed(fixFormat);
  90. rst.push(value);
  91. }
  92. }
  93. }
  94. }
  95. return rst;
  96. }
  97. Minus(val1, val2, fixFormat) {
  98. const rst = [];
  99. let maxLen = val1.length;
  100. let minLen = val2.length;
  101. if (minLen > maxLen) {
  102. maxLen = maxLen + minLen; minLen = maxLen - minLen; maxLen = maxLen - minLen;
  103. }
  104. for (let i = 0; i < maxLen; i++) {
  105. let value = ((i < val1.length) ? val1[i] : val1[minLen - 1]) - ((i < val2.length) ? val2[i] : val2[minLen - 1]);
  106. if (fixFormat) value = value.toFixed(fixFormat);
  107. rst.push(value);
  108. }
  109. return rst;
  110. }
  111. FormatString(arrVal, formatStr) {
  112. const rst = [];
  113. for (const val of arrVal) {
  114. rst.push(stringUtil.replaceAll(formatStr, '%S', val));
  115. }
  116. return rst;
  117. }
  118. }
  119. class Rpt_Data_Extractor {
  120. constructor() {
  121. this.COMMON = new Rpt_Common();
  122. }
  123. initialize(tpl) {
  124. this.rptTpl = tpl;
  125. }
  126. // 因为计量是采用传统的关系数据库(MySQL), 有一些表关系是需要先约定(如上下级关系,外键关系等)
  127. // 根据报表模板映射指标(非离散指标)的定义,罗列出所有需要用到的data对象key,作为数据请求的过滤依据
  128. getDataRequestFilter() {
  129. const rst = {};
  130. const memFieldKeys = {}; // 内存表优化用,需要获得相关内存表的指标请求,因为有些额外指标需要花资源去获得
  131. const tables = []; // 记录需要查询哪些表
  132. // const filters = []; // 记录过滤条件(预处理中的过滤),目前先不处理
  133. const tpl = this.rptTpl;
  134. const pri_func_split_mem_fieldKey = function(field) {
  135. // 计量需要获取所有内存表指标的key,优化用
  136. if (memFieldKeys[field.TableName] === undefined) {
  137. memFieldKeys[field.TableName] = [];
  138. }
  139. const strs = field[JV.PROP_FIELD_EXP_MAP].split("', '");
  140. if (strs.length === 2) {
  141. const codeKey = strs[1].slice(0, strs[1].indexOf("'"));
  142. if (field.TableName.indexOf('mem_') === 0 && memFieldKeys[field.TableName].indexOf(codeKey) < 0) {
  143. memFieldKeys[field.TableName].push(codeKey);
  144. }
  145. }
  146. };
  147. const pri_func_chk_filter = function(field) {
  148. // 计量的机制有所不同,数据分开保存在不同的表里,
  149. if (field.TableName && tables.indexOf(field.TableName) < 0) {
  150. tables.push(field.TableName);
  151. }
  152. pri_func_split_mem_fieldKey(field);
  153. };
  154. const pri_setup_filter = function(FIELD_LIST_KEY) {
  155. // console.log(tpl[JV.NODE_FIELD_MAP][FIELD_LIST_KEY]);
  156. if (tpl[JV.NODE_FIELD_MAP][FIELD_LIST_KEY]) {
  157. for (const field of tpl[JV.NODE_FIELD_MAP][FIELD_LIST_KEY]) {
  158. pri_func_chk_filter(field);
  159. }
  160. }
  161. };
  162. pri_setup_filter(JV.NODE_DISCRETE_FIELDS);
  163. pri_setup_filter(JV.NODE_MASTER_FIELDS);
  164. pri_setup_filter(JV.NODE_DETAIL_FIELDS);
  165. pri_setup_filter(JV.NODE_MASTER_FIELDS_EX);
  166. pri_setup_filter(JV.NODE_DETAIL_FIELDS_EX);
  167. if (tpl[JV.NODE_MAP_DATA_HANDLE_INFO] && tpl[JV.NODE_MAP_DATA_HANDLE_INFO].length > 0) {
  168. // 计量的预处理会有所变化,没有那么多方式,这里只记录过滤
  169. for (const preHandle of tpl[JV.NODE_MAP_DATA_HANDLE_INFO]) {
  170. if (preHandle[JV.PROP_HANDLE_TYPE] === JV.PROP_HANDLE_TYPE_FILTER) {
  171. if (tables.indexOf(preHandle[JV.PROP_DATA_KEY]) < 0) {
  172. tables.push(preHandle[JV.PROP_DATA_KEY]);
  173. }
  174. // 目前还没想好有哪些过滤,骑驴找马吧
  175. }
  176. }
  177. }
  178. rst.tables = tables;
  179. rst.memFieldKeys = memFieldKeys;
  180. return rst;
  181. }
  182. // 装配数据(把收集到的数据,依据报表模板的指示,预处理(如:排序、过滤、合计)及装配到相关指标)
  183. assembleData(ctx, rawDataObj, baseDir, $CURRENT_RPT) {
  184. const $PROJECT = { REPORT: {} };
  185. const tpl = this.rptTpl;
  186. this.COMMON.initialize(tpl, rawDataObj);
  187. $PROJECT.COMMON = this.COMMON;
  188. // console.log(rawDataObj);
  189. setupFunc($PROJECT.REPORT, rawDataObj, baseDir);
  190. if (tpl[JV.NODE_MAP_DATA_HANDLE_INFO]) {
  191. for (const preHandle of tpl[JV.NODE_MAP_DATA_HANDLE_INFO]) {
  192. const srcData = getModuleDataByKey(rawDataObj.prjData, preHandle[JV.PROP_DATA_KEY]);
  193. switch (preHandle[JV.PROP_HANDLE_TYPE]) {
  194. case JV.PROP_HANDLE_TYPE_SORT:
  195. // sortData(srcData, preHandle, rawDataObj.prjData);
  196. break;
  197. case JV.PROP_HANDLE_TYPE_FILTER:
  198. // filterData(srcData, preHandle, rawDataObj.prjData);
  199. break;
  200. case JV.PROP_HANDLE_TYPE_PRE_DEFINED:
  201. preDefineProcess(ctx, tpl, preHandle, rawDataObj, $CURRENT_RPT);
  202. break;
  203. default:
  204. break;
  205. }
  206. }
  207. }
  208. const rptDataObj = {};
  209. rptDataObj[JV.DATA_DISCRETE_DATA] = [];
  210. rptDataObj[JV.DATA_MASTER_DATA] = [];
  211. rptDataObj[JV.DATA_DETAIL_DATA] = [];
  212. rptDataObj[JV.DATA_MASTER_DATA_EX] = [];
  213. rptDataObj[JV.DATA_DETAIL_DATA_EX] = [];
  214. assembleFields(tpl[JV.NODE_FIELD_MAP][JV.NODE_DISCRETE_FIELDS], rptDataObj[JV.DATA_DISCRETE_DATA], $PROJECT);
  215. // console.log(JV.DATA_DISCRETE_DATA);
  216. // console.log(rptDataObj[JV.DATA_DISCRETE_DATA]);
  217. assembleFields(tpl[JV.NODE_FIELD_MAP][JV.NODE_MASTER_FIELDS], rptDataObj[JV.DATA_MASTER_DATA], $PROJECT);
  218. // console.log(JV.DATA_MASTER_DATA);
  219. // console.log(rptDataObj[JV.DATA_MASTER_DATA]);
  220. assembleFields(tpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS], rptDataObj[JV.DATA_DETAIL_DATA], $PROJECT);
  221. // console.log(JV.DATA_DETAIL_DATA);
  222. // console.log(rptDataObj[JV.DATA_DETAIL_DATA]);
  223. assembleFields(tpl[JV.NODE_FIELD_MAP][JV.NODE_MASTER_FIELDS_EX], rptDataObj[JV.DATA_MASTER_DATA_EX], $PROJECT);
  224. // console.log(JV.DATA_MASTER_DATA_EX);
  225. // console.log(rptDataObj[JV.DATA_MASTER_DATA_EX]);
  226. assembleFields(tpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS_EX], rptDataObj[JV.DATA_DETAIL_DATA_EX], $PROJECT);
  227. // console.log(JV.DATA_DETAIL_DATA_EX);
  228. // console.log(rptDataObj[JV.DATA_DETAIL_DATA_EX]);
  229. // fsUtil.writeObjToFile(rptDataObj, 'D:/GitHome/temp/insertedOriginalData.jsp');
  230. // fsUtil.writeObjToFile(rawDataObj, 'D:/GitHome/temp/insertedRawDataData.jsp');
  231. // fsUtil.writeObjToFile($PROJECT, 'D:/GitHome/temp/$PROJECTData.jsp');
  232. // fsUtil.writeObjToFile(tpl[JV.NODE_FIELD_MAP][JV.NODE_MASTER_FIELDS], 'D:/GitHome/temp/masterFieldsAfterAssemble.jsp');
  233. // fsUtil.writeObjToFile(tpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS], 'D:/GitHome/temp/detailFieldsAfterAssemble.jsp');
  234. // fsUtil.writeObjToFile(tpl[JV.NODE_FIELD_MAP][JV.NODE_DISCRETE_FIELDS], 'D:/GitHome/temp/discreteFieldsAfterAssemble.jsp');
  235. return rptDataObj;
  236. }
  237. }
  238. function getModuleDataByKey(prjData, key) {
  239. let rst = null;
  240. if (prjData) {
  241. for (const item of prjData) {
  242. if (item.moduleName === key) {
  243. rst = item;
  244. break;
  245. }
  246. }
  247. }
  248. return rst;
  249. }
  250. function filterData(sourceData, handleCfg, prjData) {
  251. let rstArr = [];
  252. const tempRstArr = [];
  253. for (const item of getActDataArr(sourceData)) {
  254. if (item._doc) {
  255. tempRstArr.push(item._doc);
  256. } else {
  257. tempRstArr.push(item);
  258. }
  259. }
  260. const private_chkVal = function(src, compVal, compStr) {
  261. let rst = true;
  262. switch (compStr) {
  263. case '==' :
  264. rst = (src == compVal);
  265. break;
  266. case '===' :
  267. rst = (src === compVal);
  268. break;
  269. case '>' :
  270. rst = (src > compVal);
  271. break;
  272. case '>=' :
  273. rst = (src >= compVal);
  274. break;
  275. case '<' :
  276. rst = (src < compVal);
  277. break;
  278. case '<=' :
  279. rst = (src <= compVal);
  280. break;
  281. case '!=' :
  282. rst = (src != compVal);
  283. break;
  284. case '!==' :
  285. rst = (src !== compVal);
  286. break;
  287. case 'in' :
  288. if (compVal instanceof Array) {
  289. rst = compVal.indexOf(src) >= 0;
  290. } else {
  291. // string,需要转类型
  292. const newInCv = JSON.parse(compVal);
  293. if (newInCv instanceof Array) {
  294. rst = newInCv.indexOf(src) >= 0;
  295. } else {
  296. rst = false;
  297. }
  298. }
  299. break;
  300. case 'not in':
  301. if (compVal instanceof Array) {
  302. rst = compVal.indexOf(src) < 0;
  303. } else {
  304. // string,需要转类型
  305. const newNotInCv = JSON.parse(compVal);
  306. if (newNotInCv instanceof Array) {
  307. rst = (newNotInCv.indexOf(src) < 0);
  308. } else {
  309. rst = true;
  310. }
  311. }
  312. break;
  313. default:
  314. rst = true;
  315. }
  316. return rst;
  317. };
  318. const private_chkArrVal = function(arr, key, compVal, compStr) {
  319. let rst = false;
  320. if (arr.length > 0) {
  321. for (const arrItem of arr) {
  322. if (arrItem[key] !== undefined) {
  323. // 可以为null值去判断
  324. rst = private_chkVal(arrItem[key], compVal, compStr);
  325. }
  326. if (rst) {
  327. break;
  328. }
  329. }
  330. } else {
  331. // 在某些判断条件下(含有'非'判断),如arr没有数组项,默认结果反而是true
  332. switch (compStr) {
  333. case '!=' :
  334. case '!==' :
  335. case 'not in':
  336. rst = true;
  337. break;
  338. default:
  339. break;
  340. }
  341. }
  342. return rst;
  343. };
  344. const private_filter_compare = function(item, filterCfg) {
  345. const compareObj = {};
  346. let compRst = true;
  347. let curComparePrjData = null;
  348. let startIdx = 0;
  349. const private_ref_join = function(refKey, targetDataKey, targetPropertyKey) {
  350. let rst = null;
  351. let objDataArr = null;
  352. curComparePrjData = getModuleDataByKey(prjData, targetDataKey);
  353. try {
  354. if (curComparePrjData !== null) {
  355. objDataArr = getActDataArr(curComparePrjData);
  356. for (const dtl of objDataArr) {
  357. if (item[refKey] === dtl[targetPropertyKey]) {
  358. rst = dtl;
  359. break;
  360. }
  361. }
  362. }
  363. } finally {
  364. curComparePrjData = null;
  365. }
  366. return rst;
  367. };
  368. for (const cfg of filterCfg[JV.PROP_FILTER_KEYS]) {
  369. if (cfg[JV.PROP_FILTER_COMPARE_VAL]) {
  370. // 比较key值
  371. const keys = cfg.key.split('.');
  372. if (keys.length > 1) {
  373. let lastObj = item;
  374. for (let i = 0; i < keys.length - 1; i++) {
  375. if (keys[i].indexOf('ref_join(') === 0) {
  376. const params = keys[i].slice(9, keys[i].length - 1).split(',');
  377. if (params.length === 3) {
  378. lastObj = private_ref_join(params[0], params[1], params[2]);
  379. }
  380. if (!(lastObj)) {
  381. compRst = false;
  382. break;
  383. }
  384. } else {
  385. lastObj = item[keys[i]];
  386. if (!(lastObj)) {
  387. compRst = false;
  388. break;
  389. }
  390. }
  391. }
  392. if (lastObj) {
  393. if (lastObj instanceof Array) {
  394. compRst = private_chkArrVal(lastObj, keys[keys.length - 1], cfg[JV.PROP_FILTER_COMPARE_VAL], cfg[JV.PROP_FILTER_CONDITION]);
  395. } else {
  396. compRst = private_chkVal(lastObj[keys[keys.length - 1]], cfg[JV.PROP_FILTER_COMPARE_VAL], cfg[JV.PROP_FILTER_CONDITION]);
  397. }
  398. }
  399. } else {
  400. compRst = private_chkVal(item[cfg.key], cfg[JV.PROP_FILTER_COMPARE_VAL], cfg[JV.PROP_FILTER_CONDITION]);
  401. }
  402. } else if (cfg[JV.PROP_FILTER_COMPARE_OBJ] && cfg[JV.PROP_FILTER_COMPARE_OBJ_KEY]) {
  403. // 通过其他对象来过滤
  404. if (!curComparePrjData) {
  405. curComparePrjData = getModuleDataByKey(prjData, cfg[JV.PROP_FILTER_COMPARE_OBJ]);
  406. }
  407. if (cfg[JV.PROP_FILTER_CONDITION] === 'in' || cfg[JV.PROP_FILTER_CONDITION] === 'not in') {
  408. let compareArr = null;
  409. if (!compareObj.hasOwnProperty(cfg[JV.PROP_FILTER_COMPARE_OBJ_KEY] + startIdx.toString())) {
  410. compareObj[cfg[JV.PROP_FILTER_COMPARE_OBJ_KEY] + startIdx.toString()] = [];
  411. compareArr = compareObj[cfg[JV.PROP_FILTER_COMPARE_OBJ_KEY] + startIdx.toString()];
  412. for (const data of getActDataArr(curComparePrjData)) {
  413. if (compareArr.indexOf(data[cfg[JV.PROP_FILTER_COMPARE_OBJ_KEY]]) < 0) {
  414. compareArr.push(data[cfg[JV.PROP_FILTER_COMPARE_OBJ_KEY]]);
  415. }
  416. }
  417. } else {
  418. compareArr = compareObj[cfg[JV.PROP_FILTER_COMPARE_OBJ_KEY] + startIdx.toString()];
  419. }
  420. compRst = private_chkVal(item[cfg.key], compareArr, cfg[JV.PROP_FILTER_CONDITION]);
  421. } else {
  422. for (const data of getActDataArr(curComparePrjData)) {
  423. compRst = private_chkVal(item[cfg.key], data[cfg[JV.PROP_FILTER_COMPARE_OBJ_KEY]], cfg[JV.PROP_FILTER_CONDITION]);
  424. if (compRst) break;
  425. }
  426. }
  427. }
  428. startIdx++;
  429. if (!compRst) {
  430. break; // 有不符合条件的数据则退出(这里的判断条件是and关系)
  431. }
  432. }
  433. return compRst;
  434. };
  435. const private_sub_filter_compare = function(dtlItem, subFilters) {
  436. let cmpRst = false;
  437. for (const dtlCfg of subFilters) {
  438. cmpRst = private_filter_compare(dtlItem, dtlCfg);
  439. if (cmpRst) {
  440. if (dtlCfg[JV.PROP_OTHER_SUB_FILTER] && dtlCfg[JV.PROP_OTHER_SUB_FILTER].length > 0) {
  441. cmpRst = private_sub_filter_compare(dtlItem, dtlCfg[JV.PROP_OTHER_SUB_FILTER]);
  442. if (cmpRst) break;
  443. } else {
  444. break;
  445. }
  446. }
  447. }
  448. return cmpRst;
  449. };
  450. for (const item of tempRstArr) {
  451. if (private_filter_compare(item, handleCfg)) {
  452. rstArr.push(item);
  453. }
  454. }
  455. if (handleCfg[JV.PROP_OTHER_SUB_FILTER] && handleCfg[JV.PROP_OTHER_SUB_FILTER].length > 0) {
  456. const newRstArr = [];
  457. for (const dtlItem of rstArr) {
  458. const cmpRst = private_sub_filter_compare(dtlItem, handleCfg[JV.PROP_OTHER_SUB_FILTER]);
  459. if (cmpRst) {
  460. newRstArr.push(dtlItem);
  461. }
  462. }
  463. rstArr = newRstArr;
  464. }
  465. replaceActDataArr(sourceData, rstArr);
  466. // fsUtil.writeObjToFile(sourceData.data, 'D:/GitHome/ConstructionCost/tmp/filteredRst.jsp');
  467. }
  468. function getOrgFieldDefine(fieldId, tpl) {
  469. let rst = null;
  470. if (tpl[JV.NODE_FIELD_MAP][JV.NODE_DISCRETE_FIELDS]) {
  471. for (const field of tpl[JV.NODE_FIELD_MAP][JV.NODE_DISCRETE_FIELDS]) {
  472. if (field[JV.PROP_ID] === fieldId) {
  473. rst = field;
  474. break;
  475. }
  476. }
  477. }
  478. if (rst === null && tpl[JV.NODE_FIELD_MAP][JV.NODE_MASTER_FIELDS]) {
  479. for (const field of tpl[JV.NODE_FIELD_MAP][JV.NODE_MASTER_FIELDS]) {
  480. if (field[JV.PROP_ID] === fieldId) {
  481. rst = field;
  482. break;
  483. }
  484. }
  485. }
  486. if (rst === null && tpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS]) {
  487. for (const field of tpl[JV.NODE_FIELD_MAP][JV.NODE_DETAIL_FIELDS]) {
  488. if (field[JV.PROP_ID] === fieldId) {
  489. rst = field;
  490. break;
  491. }
  492. }
  493. }
  494. // 不会让用户选择独立离散指标的
  495. return rst;
  496. }
  497. function preDefineProcess(ctx, tpl, preDefineCfg, rawDataObj, $CURRENT_RPT) {
  498. // 依据约定,需要提供如右所示格式的数据:[{field: 'b_code', table: 'mem_stage_bills'}, {field: 'id', table: 'mem_stage_bills'}]
  499. // 指标对象的mapExpression 格式类似于: "$PROJECT.REPORT.getProperty('mem_stage_im_zl', 'calc_memo')"
  500. const fields = [];
  501. // console.log($CURRENT_RPT);
  502. if (preDefineCfg.fields) {
  503. for (const field of preDefineCfg.fields) {
  504. const tplF = getOrgFieldDefine(field[JV.PROP_FIELD_ID], tpl);
  505. const mapStr = tplF[JV.PROP_FIELD_EXP_MAP].split(','); // 如上,用逗号分割
  506. let start = 0;
  507. let end = 0;
  508. let cnt = 0;
  509. for (let idx = 0; idx < mapStr[1].length; idx++) {
  510. if (mapStr[1][idx] === '\'') {
  511. cnt++;
  512. if (cnt === 1) {
  513. start = idx;
  514. } else {
  515. end = idx;
  516. break;
  517. }
  518. }
  519. }
  520. const codeKey = mapStr[1].slice(start + 1, end);
  521. // console.log('field codeKey: ' + codeKey);
  522. const rstF = { field: codeKey, table: tplF.TableName };
  523. fields.push(rstF);
  524. }
  525. }
  526. const analysisKey = preDefineCfg[JV.PROP_HANDLE_TYPE_PRE_DEFINED_KEY];
  527. if (analysisKey && analysisKey !== '') {
  528. if (data_analyze_util[analysisKey]) {
  529. try {
  530. // 在预定义方式中,小麦处理原始数据,不需要
  531. let preSetup = preDefineCfg[JV.PROP_HANDLE_SELF_SETUP];
  532. try {
  533. if (preSetup) {
  534. preSetup = JSON.parse(preSetup);
  535. }
  536. } catch (ex) {
  537. console.log(ex);
  538. }
  539. data_analyze_util[analysisKey].fun(ctx, rawDataObj, fields, preSetup);
  540. } catch (err) {
  541. throw '报表预处理数据出错';
  542. }
  543. } else {
  544. throw '报表预处理方法不存在';
  545. }
  546. }
  547. }
  548. function adjustData(sourceData, adjustCfg) {
  549. const rstArr = [];
  550. for (const item of getActDataArr(sourceData)) {
  551. if (item._doc) {
  552. rstArr.push(item._doc);
  553. } else {
  554. rstArr.push(item);
  555. }
  556. }
  557. for (const item of adjustCfg[JV.PROP_ADJUST_COLLECTION]) {
  558. for (const rec of rstArr) {
  559. if (item[JV.PROP_ADJUST_ACTION] === 'prefix') {
  560. rec[item.key] = item[JV.PROP_ADJUST_ACTION_VAL] + rec[item.key];
  561. } else if (item[JV.PROP_ADJUST_ACTION] === 'suffix') {
  562. rec[item.key] = rec[item.key] + item[JV.PROP_ADJUST_ACTION_VAL];
  563. }
  564. }
  565. }
  566. replaceActDataArr(sourceData, rstArr);
  567. }
  568. function sortData(sourceData, sortCfg, prjData) {
  569. let rst = getActDataArr(sourceData);
  570. const tempRstArr = [];
  571. const sortType = sortCfg[JV.PROP_SORT_TYPE];
  572. const srcData = getActDataArr(sourceData);
  573. for (const item of srcData) {
  574. if (item._doc) {
  575. tempRstArr.push(item._doc);
  576. } else {
  577. tempRstArr.push(item);
  578. }
  579. }
  580. function private_normal_sort(destArr, sortKeys) {
  581. destArr.sort(function(a, b) {
  582. let compRst = 0;
  583. for (const comp of sortKeys) {
  584. const reverse = (comp.order === 'ascend') ? 1 : (-1);
  585. //
  586. if (a[comp.key] > b[comp.key]) {
  587. compRst = reverse;
  588. break;
  589. } else if (a[comp.key] < b[comp.key]) {
  590. compRst = -reverse;
  591. break;
  592. }
  593. }
  594. return compRst;
  595. });
  596. }
  597. function private_parent_sort(parentArr, parentKeys, childArr, childKeys) {
  598. const tmpRst = {};
  599. const rst = [];
  600. for (const pItem of parentArr) {
  601. let pKey = 'key';
  602. for (const key of parentKeys) {
  603. pKey += '_' + pItem[key];
  604. }
  605. tmpRst[pKey] = [];
  606. }
  607. for (const cItem of childArr) {
  608. let cKey = 'key';
  609. for (const key of childKeys) {
  610. cKey += '_' + cItem[key];
  611. }
  612. if (tmpRst[cKey]) {
  613. tmpRst[cKey].push(cItem);
  614. } else {
  615. // unknown child value! should be filtered!
  616. }
  617. }
  618. // childArr.splice(0);
  619. for (const pItem of parentArr) {
  620. let pKey = 'key';
  621. for (const key of parentKeys) {
  622. pKey += '_' + pItem[key];
  623. }
  624. rst.push(tmpRst[pKey]);
  625. // for (let rItem of tmpRst[pKey]) {
  626. // childArr.push(rItem);
  627. // }
  628. }
  629. return rst;
  630. }
  631. switch (sortType) {
  632. case 'tree':
  633. const addLevel = true;
  634. rst = treeUtil.buildTreeNodeDirectly(tempRstArr, addLevel);
  635. let newTopArr = [];
  636. if ((sortCfg[JV.PROP_FILTER_TOP_BILLS_NODES] && sortCfg[JV.PROP_FILTER_TOP_BILLS_NODES].length > 0) ||
  637. (sortCfg[JV.PROP_FILTER_OTHER_BILLS_NODES] && sortCfg[JV.PROP_FILTER_OTHER_BILLS_NODES].length > 0)) {
  638. const local_check_bills = function(tItem) {
  639. let chkDtl = false;
  640. if (tItem.flags && tItem.flags.length > 0) {
  641. for (const flagItem of tItem.flags) {
  642. if (sortCfg[JV.PROP_FILTER_OTHER_BILLS_NODES].indexOf(flagItem.flag) >= 0) {
  643. newTopArr.push(tItem);
  644. chkDtl = true;
  645. break;
  646. }
  647. }
  648. }
  649. if (!chkDtl && tItem.items && tItem.items.length > 0) {
  650. for (const dtlItem of tItem.items) {
  651. local_check_bills(dtlItem);
  652. }
  653. }
  654. };
  655. for (const topItem of rst) {
  656. let chkTop = false;
  657. if (topItem.flags && topItem.flags.length > 0) {
  658. for (const flagItem of topItem.flags) {
  659. if (sortCfg[JV.PROP_FILTER_TOP_BILLS_NODES].indexOf(flagItem.flag) >= 0) {
  660. newTopArr.push(topItem);
  661. chkTop = true;
  662. break;
  663. }
  664. }
  665. }
  666. if (!chkTop && sortCfg[JV.PROP_FILTER_OTHER_BILLS_NODES] && sortCfg[JV.PROP_FILTER_OTHER_BILLS_NODES].length > 0) {
  667. local_check_bills(topItem);
  668. }
  669. }
  670. } else {
  671. newTopArr = rst;
  672. }
  673. const destArr = [];
  674. // fsUtil.writeObjToFile(newTopArr, 'D:/GitHome/ConstructionCost/tmp/sortedAndFlattedRstBefore.jsp');
  675. treeUtil.getFlatArray(newTopArr, destArr, true);
  676. // console.log(destArr);
  677. replaceActDataArr(sourceData, destArr);
  678. // fsUtil.writeObjToFile(sourceData.data, 'D:/GitHome/ConstructionCost/tmp/sortedAndFlattedRst.jsp');
  679. break;
  680. case 'normal':
  681. private_normal_sort(tempRstArr, sortCfg[JV.PROP_SORT_KEYS]);
  682. replaceActDataArr(sourceData, tempRstArr);
  683. // fsUtil.writeObjToFile(sourceData.data, 'D:/GitHome/ConstructionCost/tmp/normalSortedRst.jsp');
  684. break;
  685. case 'accord_to_parent':
  686. const pcKey = sortCfg[JV.PROP_PARENT_CHILD_SORT_KEY];
  687. const parentSrcData = getModuleDataByKey(prjData, pcKey[JV.PROP_PARENT_DATA_KEY]);
  688. if (parentSrcData) {
  689. const tempParentArr = [];
  690. for (const item of getActDataArr(parentSrcData)) {
  691. if (item._doc) {
  692. tempParentArr.push(item._doc);
  693. } else {
  694. tempParentArr.push(item);
  695. }
  696. }
  697. const sortedRstArr = private_parent_sort(tempParentArr, pcKey[JV.PROP_PARENT_SORT_KEYS], tempRstArr, pcKey[JV.PROP_CHILD_SORT_KEYS]);
  698. if (sortCfg[JV.PROP_OTHER_SUB_SORT] && sortCfg[JV.PROP_OTHER_SUB_SORT].length > 0) {
  699. for (const sort of sortCfg[JV.PROP_OTHER_SUB_SORT]) {
  700. if (sort[JV.PROP_SORT_TYPE] === 'normal') {
  701. for (const subArr of sortedRstArr) {
  702. private_normal_sort(subArr, sort[JV.PROP_SORT_KEYS]);
  703. }
  704. } else if (sort[JV.PROP_SORT_TYPE] === 'self_define') {
  705. for (const subArr of sortedRstArr) {
  706. // console.log(subArr);
  707. const selfDefFunc = null;
  708. eval('selfDefFunc = ' + sort[JV.PROP_SORT_TYPE_SELF_DEFINE_LOGIC]);
  709. subArr.sort(selfDefFunc);
  710. // console.log(subArr);
  711. }
  712. }
  713. }
  714. }
  715. tempRstArr.splice(0);
  716. for (const item of sortedRstArr) {
  717. for (const subItem of item) {
  718. tempRstArr.push(subItem);
  719. }
  720. }
  721. }
  722. replaceActDataArr(sourceData, tempRstArr);
  723. break;
  724. case 'self_define':
  725. if (sortCfg[JV.PROP_SORT_TYPE_SELF_DEFINE_LOGIC]) {
  726. let selfDefFuncA = null;
  727. eval('selfDefFuncA = ' + sortCfg[JV.PROP_SORT_TYPE_SELF_DEFINE_LOGIC]);
  728. if (selfDefFuncA !== null) {
  729. tempRstArr.sort(selfDefFuncA);
  730. } else {
  731. console.log('sorting function is null!!!');
  732. }
  733. }
  734. replaceActDataArr(sourceData, tempRstArr);
  735. break;
  736. default:
  737. //
  738. }
  739. return rst;
  740. }
  741. function setupFunc(obj, ownRawObj, baseDir) {
  742. obj.myOwnRawDataObj = ownRawObj;
  743. obj.baseDir = baseDir;
  744. obj.getProperty = ext_getProperty;
  745. obj.getSplitProperty = ext_getSplitProperty;
  746. obj.getPicProperty = ext_getPicProperty;
  747. // obj.getPropertyByForeignId = ext_getPropertyByForeignId;
  748. obj.getPreferPrecisionProperty = ext_getPreferPrecisionProperty;
  749. obj.getArrayProperty = ext_getArrayValues;
  750. obj.getBlank = ext_getBlank;
  751. }
  752. function assembleFields(fieldList, rstDataArr, $PROJECT) {
  753. if (fieldList) {
  754. for (const field of fieldList) {
  755. shielded_exec_env($PROJECT, field, rstDataArr);
  756. if ('Precision' in field) {
  757. if (field.Precision.type === 'fixed') {
  758. // console.log('field.Precision.fixedMapExpression: ' + field.Precision.fixedMapExpression);
  759. const vrst = eval(field.Precision.fixedMapExpression);
  760. // console.log(vrst);
  761. if (vrst && vrst.length === 1) {
  762. field.fixedPrecisionNum = vrst[0];
  763. vrst.splice(0,1);
  764. }
  765. // console.log(field);
  766. } else if (field.Precision.type === 'flexible') {
  767. // console.log('field.Precision.flexibleMapExpression: ' + field.Precision.flexibleMapExpression);
  768. const vrst = eval(field.Precision.flexibleMapExpression);
  769. if (vrst && vrst.length === 1) {
  770. const tmpFlexObj = []; // 计量的动态精度对象与建筑/养护有所不同,需要重新生成
  771. for (const uKey in vrst[0]) {
  772. const tmpFObj = { unit: vrst[0][uKey].unit, decimal: vrst[0][uKey].value };
  773. if (uKey === 'other') {
  774. tmpFObj.unit = '其他未列单位';
  775. }
  776. tmpFlexObj.push(tmpFObj);
  777. }
  778. field.flexiblePrecisionRefObj = tmpFlexObj;
  779. vrst.splice(0, 1);
  780. }
  781. }
  782. }
  783. }
  784. }
  785. }
  786. function shielded_exec_env($PROJECT, $ME, rptDataItemObj) {
  787. if ($ME[JV.PROP_FIELD_EXP_MAP]) {
  788. rptDataItemObj.push(eval($ME[JV.PROP_FIELD_EXP_MAP]));
  789. }
  790. }
  791. function getActPropertyVal(firstPropKey, secPropKey, orgObj) {
  792. let rst = null;
  793. if (orgObj[firstPropKey]) {
  794. rst = orgObj[firstPropKey];
  795. } else if (orgObj[secPropKey]) {
  796. rst = orgObj[secPropKey];
  797. }
  798. return rst;
  799. }
  800. function getDeepProperty(propKey, orgObj, destArr) {
  801. const keys = propKey.split('.');
  802. const dftPropKey = 'key';
  803. const dftPropVal = 'value';
  804. const secDftPropVal = 'items';
  805. let parent = orgObj;
  806. let lastVal = null;
  807. for (const key of keys) {
  808. if (parent instanceof Array) {
  809. for (const item of parent) {
  810. if (item[dftPropKey] === key) {
  811. lastVal = getActPropertyVal(dftPropVal, secDftPropVal, item);
  812. break;
  813. }
  814. }
  815. } else {
  816. lastVal = null;
  817. if (parent[key] !== undefined) {
  818. lastVal = parent[key];
  819. } else if (parent[secDftPropVal]) {
  820. for (const item of parent[secDftPropVal]) {
  821. if (item[dftPropKey] === key) {
  822. // lastVal = item[dftPropVal];
  823. lastVal = getActPropertyVal(dftPropVal, secDftPropVal, item);
  824. break;
  825. }
  826. }
  827. }
  828. }
  829. parent = lastVal;
  830. if (parent === null) break;
  831. }
  832. if (destArr && destArr instanceof Array) {
  833. destArr.push(lastVal);
  834. }
  835. }
  836. function ext_getPreferPrecisionProperty(dataKey, preferKey, preferPropKey, dftPropKey) {
  837. // 通过一个开关(preferKey)来控制精度,如为true,则选择preferPropKey,否则选择dftPropKey
  838. const rst = [];
  839. const parentObj = this;
  840. const dtObj = parentObj.myOwnRawDataObj[dataKey];
  841. if (preferKey && preferPropKey && dftPropKey && dtObj) {
  842. const da = getActDataArr(dtObj);
  843. if (da.length === 1) {
  844. const pKey = [];
  845. pri_push_property(preferKey, da[0], pKey);
  846. if (pKey.length > 0 && pKey[0]) {
  847. pri_push_property(preferPropKey, da[0], rst);
  848. } else {
  849. pri_push_property(dftPropKey, da[0], rst);
  850. }
  851. }
  852. }
  853. return rst;
  854. }
  855. function ext_getProperty(dataKey, propKey) {
  856. const rst = [];
  857. const parentObj = this;
  858. const dtObj = parentObj.myOwnRawDataObj[dataKey];
  859. // console.log('dataKey: ' + dataKey);
  860. // console.log(dtObj);
  861. if (propKey && dtObj) {
  862. // console.log('---- dtObj[' + dataKey + '] ----');
  863. // console.log(dtObj[dataKey]);
  864. const da = getActDataArr(dtObj);
  865. // console.log(da);
  866. for (const dItem of da) {
  867. // const doc = (dItem._doc === null || dItem._doc === undefined) ? dItem : dItem._doc;
  868. pri_push_property(propKey, dItem, rst);
  869. }
  870. }
  871. // console.log('---- result ----');
  872. // console.log(rst);
  873. return rst;
  874. }
  875. function ext_getSplitProperty(dataKey, propKey, splitChar, index, dftValue) {
  876. const rst = [];
  877. const parentObj = this;
  878. const dtObj = parentObj.myOwnRawDataObj[dataKey];
  879. if (propKey && dtObj) {
  880. const da = getActDataArr(dtObj);
  881. for (const dItem of da) {
  882. pri_push_property(propKey, dItem, rst);
  883. }
  884. }
  885. // const rst = ext_getProperty(dataKey, propKey);
  886. for (let idx = 0; idx < rst.length; idx++) {
  887. if (typeof rst[idx] === 'string') {
  888. const splitArr = rst[idx].split(splitChar);
  889. if (splitArr.length > index) {
  890. rst[idx] = splitArr[index];
  891. } else {
  892. rst[idx] = dftValue;
  893. }
  894. }
  895. }
  896. return rst;
  897. }
  898. async function ext_getPicProperty(dataKey, propKey, isPath) {
  899. const rst = [];
  900. const parentObj = this;
  901. const dtObj = parentObj.myOwnRawDataObj[dataKey];
  902. if (propKey && dtObj) {
  903. const da = getActDataArr(dtObj);
  904. for (const dItem of da) {
  905. pri_push_property(propKey, dItem, rst);
  906. }
  907. if (isPath) {
  908. for (let picIdx = 0; picIdx < rst.length; picIdx++) {
  909. if (rst[picIdx] !== undefined && rst[picIdx] !== null && rst[picIdx] !== '') {
  910. const filePath = parentObj.baseDir + '/app/' + rst[picIdx];
  911. try {
  912. fs.accessSync(filePath, fs.constants.R_OK);
  913. const bData = fs.readFileSync(filePath);
  914. const base64Str = bData.toString('base64');
  915. const datauri = 'data:image/png;base64,' + base64Str;
  916. rst[picIdx] = datauri;
  917. // const res = await isFileExisted(filePath);
  918. // if (res) {
  919. // const bData = fs.readFileSync(filePath);
  920. // const base64Str = bData.toString('base64');
  921. // const datauri = 'data:image/png;base64,' + base64Str;
  922. // rst[picIdx] = datauri;
  923. // } else {
  924. // rst[picIdx] = ''; // 不存在图片,则设置为空,后续的方法就不会当作图片来处理了
  925. // }
  926. } catch (err) {
  927. rst[picIdx] = ''; // 不存在图片,则设置为空,后续的方法就不会当作图片来处理了
  928. console.error(err);
  929. }
  930. }
  931. }
  932. } else {
  933. // 不是路径,那么必须是image data,不用处理,正常走即可
  934. }
  935. }
  936. return rst;
  937. }
  938. function ext_getArrayValues(dataKey, itemKey) {
  939. const rst = [];
  940. const parentObj = this;
  941. const dtObj = parentObj.myOwnRawDataObj[dataKey];
  942. // 计量需要重写
  943. const keysArr = itemKey.split('.');
  944. const da = getActDataArr(dtObj);
  945. // console.log(keysArr);
  946. for (const dataItem of da) {
  947. let itemArr = [];
  948. if (keysArr.length <= 2) {
  949. if (dataItem[keysArr[0]] instanceof Array) {
  950. if (keysArr.length === 2) {
  951. for (const item of dataItem[keysArr[0]]) {
  952. itemArr.push(item[keysArr[1]]);
  953. }
  954. } else {
  955. itemArr = itemArr.concat(dataItem[keysArr[0]]);
  956. }
  957. } else {
  958. if (keysArr.length === 2) {
  959. const subProperty = dataItem[keysArr[0]][keysArr[1]];
  960. if (subProperty instanceof Array) {
  961. itemArr = itemArr.concat(subProperty);
  962. } else {
  963. itemArr.push(subProperty);
  964. }
  965. } else {
  966. itemArr.push(dataItem[keysArr[0]]);
  967. }
  968. }
  969. }
  970. rst.push(itemArr);
  971. // console.log(itemArr);
  972. }
  973. return rst;
  974. }
  975. function ext_getBlank(dataKey, dftVal) {
  976. const rst = [];
  977. const parentObj = this;
  978. const dtObj = parentObj.myOwnRawDataObj[dataKey]; // dataKey是有必要的,必须知道是哪个Table
  979. // 计量需要重写
  980. if (dtObj) {
  981. const dtData = getActDataArr(dtObj);
  982. for (let i = 0; i < dtData.length; i++) {
  983. if (dftVal !== null && dftVal !== undefined) {
  984. rst.push(dftVal)
  985. } else rst.push('');
  986. }
  987. }
  988. return rst;
  989. }
  990. function ext_getPropertyByForeignId(foreignIdVal, adHocIdKey, propKey, dftValIfNotFound) {
  991. const rst = [];
  992. // 计量需要重写
  993. return rst;
  994. }
  995. function getActDataArr(dtObj) {
  996. let rst = [];
  997. if (dtObj) {
  998. if (dtObj instanceof Array) {
  999. rst = rst.concat(dtObj);
  1000. } else {
  1001. rst.push(dtObj);
  1002. }
  1003. }
  1004. return rst;
  1005. }
  1006. function replaceActDataArr(dtObj, newArr) {
  1007. if (dtObj.moduleName === 'projectGLJ') {
  1008. delete dtObj.data.gljList;
  1009. dtObj.data.gljList = newArr;
  1010. } else {
  1011. delete dtObj.data;
  1012. dtObj.data = newArr;
  1013. }
  1014. }
  1015. function pri_push_property(propKey, doc, rst) {
  1016. if (propKey instanceof Array) {
  1017. // 备注:这里的key数组表示取value的优先级
  1018. for (let pi = 0; pi < propKey.length; pi++) {
  1019. if (doc.hasOwnProperty('property')) {
  1020. if (doc['property'].hasOwnProperty(propKey[pi])) {
  1021. rst.push(doc['property'][propKey[pi]]);
  1022. break;
  1023. }
  1024. } else if (doc.hasOwnProperty(propKey[pi])) {
  1025. rst.push(doc[propKey[pi]]);
  1026. break;
  1027. } else {
  1028. const lenBefore = rst.length;
  1029. getDeepProperty(propKey[pi], doc, rst);
  1030. if (rst.length === (lenBefore + 1)) {
  1031. if (rst[lenBefore] !== null && rst[lenBefore] !== undefined && rst[lenBefore] !== '') {
  1032. break;
  1033. } else {
  1034. rst.splice(-1, 1); // 删除末尾一条数据,给后面留空间
  1035. }
  1036. }
  1037. }
  1038. if (pi === propKey.length - 1) rst.push('');
  1039. }
  1040. } else {
  1041. if (doc.hasOwnProperty('property') && doc['property'].hasOwnProperty(propKey)) {
  1042. rst.push(doc['property'][propKey]);
  1043. } else if (doc.hasOwnProperty(propKey)) {
  1044. rst.push(doc[propKey]);
  1045. } else {
  1046. getDeepProperty(propKey, doc, rst);
  1047. }
  1048. }
  1049. }
  1050. // export default Rpt_Data_Extractor;
  1051. module.exports = Rpt_Data_Extractor;