浏览代码

1. 速度优化相关
2. 修复树结构问题

MaiXinRong 5 年之前
父节点
当前提交
bb43b6b7d8

+ 148 - 78
app/base/base_tree_service.js

@@ -1,10 +1,7 @@
 'use strict';
 
 /**
- * 提供基础操作:
- * 1. 增删改查
- * 2. 粘贴整块
- * 3. 简易导入
+ * 提供基础操作:增删改查
  *
  * @author Mai
  * @date
@@ -14,6 +11,7 @@
 const Service = require('./base_service');
 // sql拼装器
 const SqlBuilder = require('../lib/sql_builder');
+const rootId = -1;
 
 class TreeService extends Service {
     /**
@@ -53,7 +51,7 @@ class TreeService extends Service {
         if (condition.mid) result[this.setting.mid] = condition.mid;
         if (condition.kid) result[this.setting.kid] = condition.kid;
         if (condition.pid) result[this.setting.pid] = condition.pid;
-        if (condition[this.setting.order]) result[this.setting.order] = condition[this.setting.order];
+        if (condition.order) result[this.setting.order] = condition.order;
         if (condition.level) result[this.setting.level] = condition.level;
         if (condition.fullPath) result[this.setting.fullPath] = condition.fullPath;
         if (condition.isLeaf) result[this.setting.isLeaf] = condition.isLeaf;
@@ -65,10 +63,24 @@ class TreeService extends Service {
      * @param {Number} mid - masterId
      * @returns {Promise<void>}
      */
-    async getData(mid) {
-        return await this.db.select(this.tableName, {
-            where: this.getCondition({mid: mid})
-        });
+    async getData(mid, level) {
+        if (level) {
+            this.initSqlBuilder();
+            this.sqlBuilder.setAndWhere('list_id', {
+                operate: '=',
+                value: mid,
+            });
+            this.sqlBuilder.setAndWhere('level', {
+                operate: '<=',
+                value: level,
+            });
+            const [sql, sqlParam] = this.sqlBuilder.build(this.tableName);
+            return await this.db.query(sql, sqlParam);
+        } else {
+            return await this.db.select(this.tableName, {
+                where: this.getCondition({mid: mid})
+            });
+        }
     }
 
     /**
@@ -77,7 +89,7 @@ class TreeService extends Service {
      * @param {Number} id
      * @returns {Promise<void>}
      */
-    async getDataByLid (mid, kid) {
+    async getDataByKid (mid, kid) {
         return await this.db.get(this.tableName, this.getCondition({
             mid: mid, kid: kid,
         }));
@@ -163,6 +175,52 @@ class TreeService extends Service {
     }
 
     /**
+     * 根据full_path获取数据 full_path Like ‘1.2.3%’(传参full_path = '1.2.3%')
+     * @param {Number} tenderId - 标段id
+     * @param {String} full_path - 路径
+     * @return {Promise<void>}
+     */
+    async getDataByFullPath(mid, full_path) {
+        this.initSqlBuilder();
+        this.sqlBuilder.setAndWhere(this.setting.mid, {
+            value: mid,
+            operate: '=',
+        });
+        this.sqlBuilder.setAndWhere(this.setting.fullPath, {
+            value: this.db.escape(full_path),
+            operate: 'Like',
+        });
+        const [sql, sqlParam] = this.sqlBuilder.build(this.tableName);
+        const resultData = await this.db.query(sql, sqlParam);
+        return resultData;
+    }
+    /**
+     * 根据full_path检索自己及所有父项
+     * @param {Number} tenderId - 标段id
+     * @param {Array|String} fullPath - 节点完整路径
+     * @return {Promise<*>}
+     * @private
+     */
+    async getFullLevelDataByFullPath(mid, fullPath) {
+        const explodePath = this.ctx.helper.explodePath(fullPath);
+
+        this.initSqlBuilder();
+        this.sqlBuilder.setAndWhere(this.setting.mid, {
+            value: mid,
+            operate: '=',
+        });
+        this.sqlBuilder.setAndWhere(this.setting.fullPath, {
+            value: explodePath,
+            operate: 'in',
+        });
+
+        const [sql, sqlParam] = this.sqlBuilder.build(this.tableName);
+        const data = await this.db.query(sql, sqlParam);
+
+        return data;
+    }
+
+    /**
      * 获取最大节点id
      *
      * @param {Number} mid - master id
@@ -174,7 +232,7 @@ class TreeService extends Service {
         let maxId = parseInt(await this.cache.get(cacheKey));
         if (!maxId) {
             const sql = 'SELECT Max(??) As max_id FROM ?? Where ' + this.setting.mid + ' = ?';
-            const sqlParam = ['ledger_id', this.tableName, mid];
+            const sqlParam = [this.setting.kid, this.tableName, mid];
             const queryResult = await this.db.queryOne(sql, sqlParam);
             maxId = queryResult.max_id || 0;
             this.cache.set(cacheKey, maxId, 'EX', this.ctx.app.config.cacheTime);
@@ -230,7 +288,7 @@ class TreeService extends Service {
     /**
      * 新增数据(新增为selectData的后项,该方法不可单独使用)
      *
-     * @param {Number} mid - master-id
+     * @param {Number} mid - 台账id
      * @param {Object} select - 选中节点的数据
      * @param {Object} data - 新增节点的初始数据
      * @return {Object} - 新增结果
@@ -242,13 +300,13 @@ class TreeService extends Service {
         }
         const maxId = await this._getMaxLid(mid);
 
-        data.id = this.uuid.v4();
+        if (this.setting.uuid) data.id = this.uuid.v4();
         data[this.setting.kid] = maxId + 1;
-        data[this.setting.pid] = select[this.setting.pid];
+        data[this.setting.pid] = select ? select[this.setting.pid] : rootId;
         data[this.setting.mid] = mid;
-        data[this.setting.level] = select[this.setting.level];
-        data[this.setting.order] = select[this.setting.order] + 1;
-        data[this.setting.fullPath] = select[this.setting.fullPath].replace('.' + select[this.setting.kid], '.' + data[this.setting.kid]);
+        data[this.setting.level] = select ? select[this.setting.level] : 1;
+        data[this.setting.order] = select ? select[this.setting.order] + 1 : 1;
+        data[this.setting.fullPath] = data[this.setting.level] > 1 ? select[this.setting.fullPath].replace('.' + select[this.setting.kid], '.' + data[this.setting.kid]) : data[this.setting.kid] + '';
         data[this.setting.isLeaf] = true;
         const result = await this.transaction.insert(this.tableName, data);
 
@@ -259,24 +317,20 @@ class TreeService extends Service {
 
     /**
      * 新增节点
-     * @param {Number} mid - master id
+     * @param {Number} mid - 台账id
      * @param {Number} kid - 清单节点id
      * @returns {Promise<void>}
      */
     async addNode(mid, kid, data) {
-        if (!mid || !kid) return null;
-        const select = await this.getDataByLid(mid, kid);
-        if (!select) {
-            throw '新增节点数据错误';
-        }
+        if (!mid) return null;
+        const select = kid ? await this.getDataByKid(mid, kid) : null;
+        if (kid && !select) throw '新增节点数据错误';
 
         this.transaction = await this.db.beginTransaction();
         try {
-            await this._updateChildrenOrder(mid, select[this.setting.pid], select[this.setting.order]+1);
+            if (select) await this._updateChildrenOrder(mid, select[this.setting.pid], select[this.setting.order]+1);
             const newNode = await this._addNodeData(mid, select, data);
-            if (newNode.affectedRows !== 1) {
-                throw '新增节点数据额错误';
-            }
+            if (newNode.affectedRows !== 1) throw '新增节点数据额错误';
             await this.transaction.commit();
             this.transaction = null;
         } catch (err) {
@@ -285,15 +339,20 @@ class TreeService extends Service {
             throw err;
         }
 
-        const createData = await this.getDataByParentAndOrder(mid, select[this.setting.pid], [select[this.setting.order] + 1]);
-        const updateData = await this.getNextsData(mid, select[this.setting.pid], select[this.setting.order] + 1);
-        return {create: createData, update: updateData};
+        if (select) {
+            const createData = await this.getDataByParentAndOrder(mid, select[this.setting.pid], [select[this.setting.order] + 1]);
+            const updateData = await this.getNextsData(mid, select[this.setting.pid], select[this.setting.order] + 1);
+            return {create: createData, update: updateData};
+        } else {
+            const createData = await this.getDataByParentAndOrder(mid, -1, [1]);
+            return {create: createData};
+        }
     }
 
     /**
      * 删除节点
-     * @param {Number} mid - master id
-     * @param {Object} deleteNode - 删除节点数据
+     * @param {Number} tenderId - 标段id
+     * @param {Object} deleteData - 删除节点数据
      * @return {Promise<*>}
      * @private
      */
@@ -314,17 +373,17 @@ class TreeService extends Service {
     }
 
     /**
-     *  删除选中节点及其子节点
+     *  tenderId标段中, 删除选中节点及其子节点
      *
-     * @param {Number} mid - master id
-     * @param {Number} kid - 选中节点id
+     * @param {Number} tenderId - 标段id
+     * @param {Number} selectId - 选中节点id
      * @return {Array} - 被删除的数据
      */
     async deleteNode(mid, kid) {
         if ((mid <= 0) || (kid <= 0)) return [];
-        const select = await this.getDataByNodeId(mid, kid);
+        const select = await this.getDataByKid(mid, kid);
         if (!select) throw '删除节点数据错误';
-        const parent = await this.getDataByNodeId(mid, select[this.setting.pid]);
+        const parent = await this.getDataByKid(mid, select[this.setting.pid]);
         // 获取将要被删除的数据
         const deleteData = await this.getDataByFullPath(mid, select[this.setting.fullPath] + '%');
         if (deleteData.length === 0) throw '删除节点数据错误';
@@ -343,18 +402,21 @@ class TreeService extends Service {
                 }
             }
             // 选中节点--全部后节点 order--
-            await this._updateSelectNextsOrder(select, -1);
+            await this._updateChildrenOrder(mid, select[this.setting.pid], select[this.setting.order] + 1, -1);
+            //await this._updateSelectNextsOrder(select, -1);
             // 删除部位明细
             //await this.ctx.service.pos.deletePosData(this.transaction, tenderId, this._.map(deleteData, 'id'));
             await this.transaction.commit();
+            this.transaction = null;
         } catch (err) {
             await this.transaction.rollback();
+            this.transaction = null;
             throw err;
         }
         // 查询结果
         const updateData = await this.getNextsData(mid, select[this.setting.pid], select[this.setting.order] - 1);
         if (parent) {
-            const updateData1 = await this.getDataByNodeId(mid, select[this.setting.pid]);
+            const updateData1 = await this.getDataByKid(mid, select[this.setting.pid]);
             if (updateData1[this.setting.isLeaf]) {
                 updateData.push(updateData1);
             }
@@ -371,7 +433,7 @@ class TreeService extends Service {
      */
     async upMoveNode(mid, kid) {
         if (!mid || !kid) return null;
-        const select = await this.getDataByLid(mid, kid);
+        const select = await this.getDataByKid(mid, kid);
         if (!select) {
             throw '上移节点数据错误';
         }
@@ -385,8 +447,10 @@ class TreeService extends Service {
             const sData = await this.transaction.update(this.tableName, { id: select.id, order: select[this.setting.order] - 1 });
             const pData = await this.transaction.update(this.tableName, { id: pre.id, order: pre[this.setting.order] + 1 });
             await this.transaction.commit();
+            this.transaction = null;
         } catch (err) {
             await this.transaction.rollback();
+            this.transaction = null;
             throw err;
         }
 
@@ -403,7 +467,7 @@ class TreeService extends Service {
      */
     async downMoveNode(mid, kid) {
         if (!mid || !kid) return null;
-        const select = await this.getDataByLid(mid, kid);
+        const select = await this.getDataByKid(mid, kid);
         if (!select) {
             throw '下移节点数据错误';
         }
@@ -417,8 +481,10 @@ class TreeService extends Service {
             const sData = await this.transaction.update(this.tableName, { id: select.id, order: select[this.setting.order] + 1 });
             const pData = await this.transaction.update(this.tableName, { id: next.id, order: next[this.setting.order] - 1 });
             await this.transaction.commit();
+            this.transaction = null;
         } catch (err) {
             await this.transaction.rollback();
+            this.transaction = null;
             throw err;
         }
 
@@ -435,11 +501,11 @@ class TreeService extends Service {
     async _syncUplevelChildren(select) {
         this.initSqlBuilder();
         this.sqlBuilder.setAndWhere(this.setting.mid, {
-            value: selectData.tender_id,
+            value: select[this.setting.mid],
             operate: '=',
         });
         this.sqlBuilder.setAndWhere(this.setting.fullPath, {
-            value: this.db.escape(select[this.setting.fullPath] + '.%'),
+            value: this.db.escape(select[this.setting.fullPath] + '-%'),
             operate: 'like',
         });
         this.sqlBuilder.setUpdateData(this.setting.level, {
@@ -521,16 +587,16 @@ class TreeService extends Service {
     /**
      * 升级节点
      *
-     * @param {Number} mid - master id
-     * @param {Number} kid - 选中节点id
+     * @param {Number} tenderId - 标段id
+     * @param {Number} selectId - 选中节点id
      * @return {Array} - 发生改变的数据
      */
     async upLevelNode(mid, kid) {
         if ((mid <= 0) || (kid <= 0)) return [];
 
-        const select = await this.getDataByNodeId(mid, kid);
+        const select = await this.getDataByKid(mid, kid);
         if (!select) throw '升级节点数据错误';
-        const parent = await this.getDataByNodeId(mid, select[this.setting.pid]);
+        const parent = await this.getDataByKid(mid, select[this.setting.pid]);
         if (!parent) throw '升级节点数据错误';
 
         this.transaction = await this.db.beginTransaction();
@@ -544,12 +610,13 @@ class TreeService extends Service {
                 });
             }
             // 选中节点--父节点--全部后兄弟节点 order+1
-            await this._updateSelectNextsOrder(parent);
+            await this._updateChildrenOrder(mid, parent[this.setting.pid], parent[this.setting.order] + 1);
+            //await this._updateSelectNextsOrder(parent);
             // 选中节点 修改pid, order, full_path, level, is_leaf, 清空计算项
             const updateData = { id: select.id };
             updateData[this.setting.pid] = parent[this.setting.pid];
             updateData[this.setting.order] = parent[this.setting.order] + 1;
-            updateData[this.setting.level] = select[this.setting.level] + 1;
+            updateData[this.setting.level] = select[this.setting.level] - 1;
             updateData[this.setting.fullPath] = newFullPath;
 
             const nexts = await this.getNextsData(mid, parent[this.setting.kid], select[this.setting.order]);
@@ -567,14 +634,16 @@ class TreeService extends Service {
             // 选中节点--全部后兄弟节点 收编为子节点 修改pid, order, full_path
             await this._syncUpLevelNexts(select);
             await this.transaction.commit();
+            this.transaction = null;
         } catch (err) {
             await this.transaction.rollback();
+            this.transaction = null;
             throw err;
         }
 
         // 查询修改的数据
         const resultData1 = await this.getDataByFullPath(mid, newFullPath + '%');
-        const resultData2 = await this.getNextsData(mid, parent[this.setting.pid], parent[this.setting.order] + 1);
+        const resultData2 = await this.getNextsData(mid, parent[this.setting.pid], parent[this.setting.order] - 1);
         return { update: resultData1.concat(resultData2) };
     }
 
@@ -592,7 +661,7 @@ class TreeService extends Service {
             operate: '=',
         });
         this.sqlBuilder.setAndWhere(this.setting.fullPath, {
-            value: this.db.escape(select[this.setting.fullPath] + '.%'),
+            value: this.db.escape(select[this.setting.fullPath] + '-%'),
             operate: 'like',
         });
         this.sqlBuilder.setUpdateData(this.setting.level, {
@@ -600,7 +669,7 @@ class TreeService extends Service {
             selfOperate: '+',
         });
         this.sqlBuilder.setUpdateData(this.setting.fullPath, {
-            value: [this.setting.fullPath, this.db.escape('.' + select[this.setting.kid]), this.db.escape('.' + pre[this.setting.kid] + '.' + select[this.setting.kid])],
+            value: [this.setting.fullPath, this.db.escape(select[this.setting.kid] + '.'), this.db.escape(pre[this.setting.kid] + '.' + select[this.setting.kid] + '.')],
             literal: 'Replace',
         });
         const [sql, sqlParam] = this.sqlBuilder.build(this.tableName, 'update');
@@ -612,13 +681,13 @@ class TreeService extends Service {
     /**
      * 降级节点
      *
-     * @param {Number} mid - master id
-     * @param {Number} kid - 选中节点id
+     * @param {Number} tenderId - 标段id
+     * @param {Number} selectId - 选中节点id
      * @return {Array} - 发生改变的数据
      */
     async downLevelNode(mid, kid) {
         if ((mid <= 0) || (kid <= 0)) return [];
-        const select = await this.getDataByNodeId(mid, kid);
+        const select = await this.getDataByKid(mid, kid);
         if (!select) throw '降级节点数据错误';
         const pre = await this.getDataByParentAndOrder(mid, select[this.setting.pid], select[this.setting.order] - 1);
         if (!pre) throw '节点不可降级';
@@ -630,10 +699,10 @@ class TreeService extends Service {
         const newFullPath = select.full_path.replace(orgLastPath, newLastPath);
         try {
             // 选中节点--全部后节点 order--
-            await this._updateSelectNextsOrder(select, -1);
+            await this._updateChildrenOrder(mid, select[this.setting.pid], select[this.setting.order] + 1, -1);
             // 选中节点 修改pid, level, order, full_path
             const updateData = { id: select.id };
-            updateData[this.setting.kid] = pre[this.setting.kid];
+            updateData[this.setting.pid] = pre[this.setting.kid];
             updateData[this.setting.order] = preLastChild ? preLastChild[this.setting.order] + 1 : 1;
             updateData[this.setting.level] = select[this.setting.level] + 1;
             updateData[this.setting.fullPath] = newFullPath;
@@ -650,8 +719,10 @@ class TreeService extends Service {
             // updateData2.deal_tp = null;
             await this.transaction.update(this.tableName, updateData2);
             await this.transaction.commit();
+            this.transaction = null;
         } catch (err) {
             await this.transaction.rollback();
+            this.transaction = null;
             throw err;
         }
 
@@ -659,7 +730,7 @@ class TreeService extends Service {
         // 选中节点及子节点
         const resultData1 = await this.getDataByFullPath(mid, newFullPath + '%');
         // 选中节点--原前兄弟节点&全部后兄弟节点
-        const resultData2 = await this.getNextsData(mid, pre[this.setting.pid], pre[this.setting.order]);
+        const resultData2 = await this.getNextsData(mid, pre[this.setting.pid], pre[this.setting.order] - 1);
         return { update: resultData1.concat(resultData2) };
     }
 
@@ -682,34 +753,33 @@ class TreeService extends Service {
 
     /**
      * 提交多条数据 - 不影响计算等未提交项
-     * @param {Number} mid - master id
+     * @param {Number} tenderId - 标段id
      * @param {Array} datas - 提交数据
      * @return {Array} - 提交后的数据
      */
     async updateInfos(mid, datas) {
         if (mid <= 0) throw '数据错误';
-        for (const data of datas) {
-            if (mid !== data[this.setting.mid]) throw '提交数据错误';
-        }
 
-        this.transaction = await this.db.beginTransaction();
-        try {
-            for (const data of datas) {
-                const updateNode = await this.getDataById(data.id);
-                if (!updateNode || mid !== updateNode[this.setting.mid] || data.kid !== updateNode[this.setting.kid]) {
-                    throw '提交数据错误';
-                }
-                const updateData = this._filterUpdateInvalidField(updateNode.id, data);
-                await this.transaction.update(this.tableName, updateData);
+        if (Array.isArray(datas)) {
+            const updateDatas = [];
+            for (const d of datas) {
+                if (mid !== d[this.setting.mid]) throw '提交数据错误';
+                const node = await this.getDataById(d.id);
+                if (!node || mid !== node[this.setting.mid] || d[this.setting.kid] !== node[this.setting.kid]) throw '提交数据错误';
+                updateDatas.push(this._filterUpdateInvalidField(node.id, d));
             }
-            await this.transaction.commit();
-        } catch (err) {
-            await this.transaction.rollback();
-            throw err;
-        }
+            await this.db.updateRows(this.tableName, updateDatas);
 
-        const resultData = await this.getDataById(this._.map(datas, 'id'));
-        return resultData;
+            const resultData = await this.getDataById(this._.map(datas, 'id'));
+            return resultData;
+        } else {
+            if (mid !== datas[this.setting.mid]) throw '提交数据错误';
+            const node = await this.getDataById(datas.id);
+            if (!node || mid !== node[this.setting.mid] || datas[this.setting.kid] !== node[this.setting.kid]) throw '提交数据错误';
+            const updateData = this._filterUpdateInvalidField(node.id, datas);
+            await this.db.update(this.tableName, updateData);
+            return await this.getDataById(datas.id);
+        }
     }
 }
 

+ 4 - 4
app/controller/stage_controller.js

@@ -156,7 +156,7 @@ module.exports = app => {
                 }
                 // 查询截止上期数据
                 if (ctx.stage.order > 1) {
-                    preStageData = await ctx.service.stageBillsFinal.getFinalData(ctx.tender.data, ctx.stage);
+                    preStageData = await ctx.service.stageBillsFinal.getFinalData(ctx.tender.data, ctx.stage.order - 1);
                     //renderData.preStageData = await ctx.service.stageBills.getEndStageData(ctx.tender.id, ctx.stage.order - 1);
                 } else {
                     preStageData = [];
@@ -206,13 +206,15 @@ module.exports = app => {
                 // 查询截止上期数据
                 //console.time('pre');
                 if (ctx.stage.order > 1) {
-                    preStageData = await ctx.service.stagePosFinal.getFinalData(ctx.tender.data, ctx.stage);
+                    preStageData = await ctx.service.stagePosFinal.getFinalData(ctx.tender.data, ctx.stage.order - 1);
                     //responseData.data.preStageData = await ctx.service.stagePos.getEndStageData(ctx.tender.id, ctx.stage.order - 1);
                 } else {
                     preStageData = [];
                 }
                 //console.timeEnd('pre');
                 //console.time('assign');
+                console.log('cur: ' + curStageData.length);
+                console.log('pre: ' + preStageData.length);
                 this.ctx.helper.assignRelaData(responseData.data, [
                     {data: curStageData, fields: ['contract_qty', 'qc_qty', 'postil'], prefix: '', relaId: 'pid'},
                     {data: preStageData, fields: ['contract_qty', 'qc_qty'], prefix: 'pre_', relaId: 'pid'}
@@ -405,7 +407,6 @@ module.exports = app => {
                         ]);
                         result.stageDetail = await ctx.service.stageDetail.getLastestStageData(ctx.tender.id, ctx.stage.id);
                     }
-                    console.log(result.length);
                     ctx.body = { err: 0, msg: '', data: result };
                 }
             } catch (err) {
@@ -908,7 +909,6 @@ module.exports = app => {
                 }
 
                 await ctx.service.stageAudit.check(ctx.stage.id, data, ctx.stage.times);
-                console.log('success');
 
                 ctx.redirect(ctx.request.header.referer);
             } catch (err) {

+ 4 - 2
app/lib/analysis_excel.js

@@ -42,9 +42,9 @@ class ImportBaseTree {
      */
     _loadTemplateTree(data) {
         for (const node of data) {
-            node.ledger_id = node.id;
+            node.ledger_id = node.template_id;
             node.ledger_pid = node.pid;
-            delete node.id;
+            node.id = this.ctx.app.uuid.v4();
             delete node.pid;
             if (node.code) {
                 this.codeNodes[node.code] = node;
@@ -97,6 +97,7 @@ class ImportBaseTree {
      * @returns {*}
      */
     addNodeWithParent(node, parent) {
+        node.id = this.ctx.app.uuid.v4();
         node.ledger_id = this.keyNodeId;
         this.keyNodeId += 1;
         node.ledger_pid = parent ? parent.ledger_id : -1;
@@ -176,6 +177,7 @@ class ImportBaseTree {
     addPos (pos){
         if (this.finalNode && this.finalNode.pos) {
             pos.id = this.ctx.app.uuid.v4();
+            pos.lid = this.finalNode.id;
             pos.tid = this.ctx.tender.id;
             pos.add_stage = 0;
             pos.add_times = 0;

+ 4 - 3
app/public/js/path_tree.js

@@ -348,7 +348,7 @@ const createNewPathTree = function (type, setting) {
         getAllParents (node) {
             const parents = [];
             if (node.full_path && node.full_path !== '') {
-                const parentIds = node.full_path.split('.');
+                const parentIds = node.full_path.split('-');
                 for (const id of parentIds) {
                     if (id !== node[this.setting.id]) {
                         parents.push(this.getItems(id));
@@ -397,7 +397,7 @@ const createNewPathTree = function (type, setting) {
          * @param {Number} path
          */
         getFullPathNodes (path) {
-            const self = this, ids = path.split('.');
+            const self = this, ids = path.split('-');
             if (ids.length > 0) {
                 return this.nodes.filter((x) => {
                     return ids.indexOf('' + x[self.setting.id]) >= 0;
@@ -443,7 +443,8 @@ const createNewPathTree = function (type, setting) {
          */
         getPosterity (node) {
             if (node.full_path !== '') {
-                const reg = new RegExp('^' + node.full_path + '.');
+                const reg = new RegExp('^' + node.full_path + '-');
+                console.log(reg);
                 return this.datas.filter(function (x) {
                     return reg.test(x.full_path);
                 });

+ 4 - 1
app/public/js/stage.js

@@ -693,6 +693,9 @@ $(document).ready(() => {
         },
         measureAllPosInNode(node, ratio = 1) {
             const posterity = stageTree.getPosterity(node);
+            console.log(node);
+            console.log(posterity.length);
+            console.log(posterity);
             const data = {updateType: 'update', updateData: []};
             for (const p of posterity) {
                 if (p.children && p.children.length > 0) continue;
@@ -711,7 +714,7 @@ $(document).ready(() => {
                         data.updateData.push(pData);
                     }
                 }
-                if (data.updateData.length > 1000 || _.map(data.updateData, 'lid').length > 200) {
+                if (data.updateData.length > 1000 || _.map(data.updateData, 'lid').length > 500) {
                     toastr.warning('选中的数据过多,仅计量' + data.updateData.length + '条,请稍后');
                     break;
                 }

+ 32 - 77
app/service/ledger.js

@@ -349,7 +349,7 @@ module.exports = app => {
                 operate: '=',
             });
             this.sqlBuilder.setAndWhere('full_path', {
-                value: this.db.escape(node.full_path + '.%'),
+                value: this.db.escape(node.full_path + '-%'),
                 operate: 'like',
             });
 
@@ -633,7 +633,7 @@ module.exports = app => {
             data.ledger_pid = selectData.ledger_pid;
             data.level = selectData.level;
             data.order = selectData.order + 1;
-            data.full_path = selectData.full_path.replace('.' + selectData.ledger_id, '.' + data.ledger_id);
+            data.full_path = selectData.full_path.replace('-' + selectData.ledger_id, '-' + data.ledger_id);
             data.is_leaf = true;
             const result = await this.transaction.insert(this.tableName, data);
 
@@ -673,7 +673,7 @@ module.exports = app => {
                 data.order = 1;
             }
             data.level = parentData ? parentData.level + 1 : 1;
-            data.full_path = parentData ? parentData.full_path + '.' + data.ledger_id : '' + data.ledger_id;
+            data.full_path = parentData ? parentData.full_path + '-' + data.ledger_id : '' + data.ledger_id;
             if (data.is_leaf === undefined) {
                 data.is_leaf = true;
             }
@@ -816,7 +816,7 @@ module.exports = app => {
             data.ledger_pid = selectData.ledger_id;
             data.level = selectData.level + 1;
             data.order = children.length + 1;
-            data.full_path = selectData.full_path + '.' + data.ledger_id;
+            data.full_path = selectData.full_path + '-' + data.ledger_id;
             data.is_leaf = true;
 
             this.transaction = await this.db.beginTransaction();
@@ -1097,7 +1097,7 @@ module.exports = app => {
                 operate: '=',
             });
             this.sqlBuilder.setAndWhere('full_path', {
-                value: this.db.escape(selectData.full_path + '.%'),
+                value: this.db.escape(selectData.full_path + '-%'),
                 operate: 'like',
             });
             this.sqlBuilder.setUpdateData('level', {
@@ -1105,7 +1105,7 @@ module.exports = app => {
                 selfOperate: '-',
             });
             this.sqlBuilder.setUpdateData('full_path', {
-                value: ['`full_path`', this.db.escape(selectData.ledger_pid + '.'), this.db.escape('')],
+                value: ['`full_path`', this.db.escape(selectData.ledger_pid + '-'), this.db.escape('')],
                 literal: 'Replace',
             });
             const [sql, sqlParam] = this.sqlBuilder.build(this.tableName, 'update');
@@ -1159,8 +1159,8 @@ module.exports = app => {
                 }
 
                 // 修改nextsData及其子节点的full_path
-                const oldSubStr = this.db.escape(selectData.ledger_pid + '.');
-                const newSubStr = this.db.escape(selectData.ledger_id + '.');
+                const oldSubStr = this.db.escape(selectData.ledger_pid + '-');
+                const newSubStr = this.db.escape(selectData.ledger_id + '-');
                 const sqlArr = [];
                 sqlArr.push('Update ?? SET `full_path` = Replace(`full_path`,' + oldSubStr + ',' + newSubStr + ') Where');
                 sqlArr.push('(`tender_id` = ' + selectData.tender_id + ')');
@@ -1199,7 +1199,7 @@ module.exports = app => {
             }
 
             this.transaction = await this.db.beginTransaction();
-            const newFullPath = selectData.full_path.replace(selectData.ledger_pid + '.', '');
+            const newFullPath = selectData.full_path.replace(selectData.ledger_pid + '-', '');
             try {
                 // 选中节点--父节点 选中节点为firstChild时,修改is_leaf
                 if (selectData.order === 1) {
@@ -1261,7 +1261,7 @@ module.exports = app => {
                 operate: '=',
             });
             this.sqlBuilder.setAndWhere('full_path', {
-                value: this.db.escape(selectData.full_path + '.%'),
+                value: this.db.escape(selectData.full_path + '-%'),
                 operate: 'like',
             });
             this.sqlBuilder.setUpdateData('level', {
@@ -1269,7 +1269,7 @@ module.exports = app => {
                 selfOperate: '+',
             });
             this.sqlBuilder.setUpdateData('full_path', {
-                value: ['`full_path`', this.db.escape('.' + selectData.ledger_id), this.db.escape('.' + preData.ledger_id + '.' + selectData.ledger_id)],
+                value: ['`full_path`', this.db.escape('-' + selectData.ledger_id), this.db.escape('-' + preData.ledger_id + '-' + selectData.ledger_id)],
                 literal: 'Replace',
             });
             const [sql, sqlParam] = this.sqlBuilder.build(this.tableName, 'update');
@@ -1300,8 +1300,8 @@ module.exports = app => {
             const preLastChildData = await this.getLastChildData(tenderId, preData.ledger_id);
 
             this.transaction = await this.db.beginTransaction();
-            const orgLastPath = selectData.level === 1 ? selectData.ledger_id : '.' + selectData.ledger_id;
-            const newLastPath = selectData.level === 1 ? preData.ledger_id + '.' + selectData.ledger_id : '.' + preData.ledger_id + '.' + selectData.ledger_id;
+            const orgLastPath = selectData.level === 1 ? selectData.ledger_id : '-' + selectData.ledger_id;
+            const newLastPath = selectData.level === 1 ? preData.ledger_id + '-' + selectData.ledger_id : '-' + preData.ledger_id + '-' + selectData.ledger_id;
             const newFullPath = selectData.full_path.replace(orgLastPath, newLastPath);
             try {
                 // 选中节点--全部后节点 order--
@@ -1548,13 +1548,13 @@ module.exports = app => {
                         data.tender_id = this.ctx.tender.id;
                         if (!data.is_leaf) {
                             for (const children of datas) {
-                                children.full_path = children.full_path.replace('.' + data.ledger_id, '.' + newId);
+                                children.full_path = children.full_path.replace('-' + data.ledger_id, '-' + newId);
                                 if (children.ledger_pid === data.ledger_id) {
                                     children.ledger_pid = newId;
                                 }
                             }
                         } else {
-                            data.full_path = data.full_path.replace('.' + data.ledger_id, '.' + newId);
+                            data.full_path = data.full_path.replace('-' + data.ledger_id, '-' + newId);
                         }
                         data.ledger_id = newId;
                         data.full_path = data.full_path.replace(orgParentPath, newParentPath);
@@ -1750,7 +1750,7 @@ module.exports = app => {
                 level: parentData.level + 1,
                 name: xmj.name,
             };
-            parent.full_path = parentData.full_path + '.' + parent.ledger_id;
+            parent.full_path = parentData.full_path + '-' + parent.ledger_id;
             // 添加gcl数据
             for (let i = 0, iLen = xmj.children.length; i < iLen; i++) {
                 const gcl = xmj.children[i];
@@ -1767,7 +1767,7 @@ module.exports = app => {
                     unit_price: gcl.unit_price,
                     quantity: gcl.quantity,
                 };
-                child.full_path = parent.full_path + '.' + child.ledger_id;
+                child.full_path = parent.full_path + '-' + child.ledger_id;
                 child.total_price = this.ctx.helper.mul(child.unit_price, child.quantity, this.ctx.tender.info.decimal.tp);
                 tp = this.ctx.helper.add(tp, child.total_price);
                 result.push(child);
@@ -1836,7 +1836,7 @@ module.exports = app => {
                         unit: data[i].unit,
                         unit_price: data[i].price,
                     };
-                    qd.full_path = selectData.full_path + '.' + qd.ledger_id;
+                    qd.full_path = selectData.full_path + '-' + qd.ledger_id;
                     const insertResult = await this.transaction.insert(this.tableName, qd);
                     newIds.push(qd.id);
                     if (data[i].pos.length > 0) {
@@ -1909,7 +1909,7 @@ module.exports = app => {
                         unit: data[i].unit,
                         unit_price: data[i].price,
                     };
-                    qd.full_path = parentData.full_path + '.' + qd.ledger_id;
+                    qd.full_path = parentData.full_path + '-' + qd.ledger_id;
                     const insertResult = await this.transaction.insert(this.tableName, qd);
                     newIds.push(qd.id);
                     if (data[i].pos.length > 0) {
@@ -1982,58 +1982,17 @@ module.exports = app => {
             if (!node) {
                 throw '查询数据有误';
             }
-            const expandIds = node.full_path.split('.');
+            const expandIds = node.full_path.split('-');
             expandIds.pop();
             const expandData = await this.getChildrenByParentId(tenderId, expandIds);
             return { expand: expandData };
         }
 
-        async _importCacheTreeNode(transaction, node) {
-            const data = {
-                id: this.uuid.v4(),
-                tender_id: this.ctx.tender.id,
-                ledger_id: node.ledger_id,
-                ledger_pid: node.ledger_pid,
-                level: node.level,
-                order: node.order,
-                is_leaf: !node.children || node.children.length === 0,
-                full_path: node.full_path,
-                code: node.code,
-                b_code: node.b_code,
-                name: node.name,
-                unit: node.unit,
-                sgfh_qty: node.sgfh_qty,
-                sgfh_tp: node.sgfh_tp,
-                quantity: node.quantity,
-                unit_price: node.unit_price,
-                total_price: node.total_price,
-                dgn_qty1: node.dgn_qty1,
-                dgn_qty2: node.dgn_qty2,
-                memo: node.memo,
-                drawing_code: node.drawing_code,
-            };
-            const result = await transaction.insert(this.tableName, data);
-            //data.id = result.insertId;
-            if (node.children && node.children.length > 0) {
-                for (const child of node.children) {
-                    await this._importCacheTreeNode(transaction, child);
-                }
-            } else if (node.pos && node.pos.length > 0) {
-                await this.ctx.service.pos.insertLedgerPosData(transaction, this.ctx.tender.id, data, node.pos);
-            }
-            if (node.pos && node.pos.length > 0) {
-                for (const p of node.pos) {
-                    //p.lid = result.insertId;
-                    p.lid = node.id;
-                }
-            }
-        }
-
         async _importCacheTreeNodes(transaction, nodes) {
             const datas = [];
             for (const node of nodes) {
                 datas.push({
-                    id: this.uuid.v4(),
+                    id: node.id,
                     tender_id: this.ctx.tender.id,
                     ledger_id: node.ledger_id,
                     ledger_pid: node.ledger_pid,
@@ -2057,17 +2016,6 @@ module.exports = app => {
                 });
             }
             await transaction.insert(this.tableName, datas);
-            const sql = 'SELECT id, ledger_id FROM ' + this.tableName + ' WHERE tender_id = ?';
-            const sqlParam = [this.ctx.tender.id];
-            const insertDatas = await transaction.query(sql, sqlParam);
-            for (const iD of insertDatas) {
-                const node = this.ctx.helper._.find(nodes, {ledger_id: iD.ledger_id});
-                if (node.pos && node.pos.length > 0) {
-                    for (const p of node.pos) {
-                        p.lid = iD.id;
-                    }
-                }
-            }
         }
 
         /**
@@ -2076,27 +2024,34 @@ module.exports = app => {
          * @returns {Promise<void>}
          */
         async importExcel(excelData) {
+            //console.time('analysis');
             const AnalysisExcel = require('../lib/analysis_excel');
             const analysisExcel = new AnalysisExcel(this.ctx);
             const tempData = await this.ctx.service.tenderNodeTemplate.getData(true);
             const cacheTree = analysisExcel.analysisData(excelData, tempData);
             const cacheKey = keyPre + this.ctx.tender.id;
             const orgMaxId = parseInt(await this.cache.get(cacheKey));
+            //console.timeEnd('analysis');
             const transaction = await this.db.beginTransaction();
             try {
+                //console.time('deleteBills');
                 await transaction.delete(this.tableName, {tender_id: this.ctx.tender.id});
+                //console.timeEnd('deleteBills');
+                //console.time('deletePos');
                 await transaction.delete(this.ctx.service.pos.tableName, {tid: this.ctx.tender.id});
-                // for (const node of cacheTree.roots) {
-                //     await this._importCacheTreeNode(transaction, node);
-                // }
+                //console.timeEnd('deletePos');
+                //console.time('insertBills');
                 await this._importCacheTreeNodes(transaction, cacheTree.items);
+                //console.timeEnd('insertBills');
+                //console.time('insertPos');
                 await transaction.insert(this.ctx.service.pos.tableName, cacheTree.pos);
+                //console.timeEnd('insertPos');
                 await transaction.commit();
                 this.cache.set(cacheKey, cacheTree.items.length + 1, 'EX', this.ctx.app.config.cacheTime);
             } catch (err) {
                 await transaction.rollback();
                 if (orgMaxId) {
-                    this.cache.set(cacheKey, orgMaxId, 'EX', this.ctx.app.config.cacheTime);
+                    this.cache.set(cacheKey, cacheTree.keyNodeId, 'EX', this.ctx.app.config.cacheTime);
                 }
                 throw err;
             }

+ 2 - 2
app/service/revise_bills.js

@@ -97,7 +97,7 @@ module.exports = app => {
                     qd.sgfh_qty = this.ctx.helper.add(qd.sgfh_qty, inP.sgfh_qty);
                     pos.push(inP);
                 }
-                qd.full_path = select.full_path + '.' + qd.ledger_id;
+                qd.full_path = select.full_path + '-' + qd.ledger_id;
                 qd.sgfh_tp = this.ctx.helper.mul(qd.sgfh_qty, qd.unit_price, this.ctx.tender.info.decimal.tp);
                 qd.quantity = qd.sgfh_qty;
                 qd.total_price = qd.sgfh_tp;
@@ -195,7 +195,7 @@ module.exports = app => {
                     qd.sgfh_qty = this.ctx.helper.add(qd.sgfh_qty, inP.sgfh_qty);
                     pos.push(inP);
                 }
-                qd.full_path = parentData.full_path + '.' + qd.ledger_id;
+                qd.full_path = parentData.full_path + '-' + qd.ledger_id;
                 qd.sgfh_tp = this.ctx.helper.mul(qd.sgfh_qty, qd.unit_price, this.ctx.tender.info.decimal.tp);
                 qd.quantity = qd.sgfh_qty;
                 qd.total_price = qd.sgfh_tp;

+ 2 - 0
app/service/stage_audit.js

@@ -261,8 +261,10 @@ module.exports = app => {
                 } else {
                     // 本期结束
                     // 生成截止本期数据 final数据
+                    console.time('generatePre');
                     await this.ctx.service.stageBillsFinal.generateFinalData(transaction, this.ctx.tender, this.ctx.stage);
                     await this.ctx.service.stagePosFinal.generateFinalData(transaction, this.ctx.tender, this.ctx.stage);
+                    console.timeEnd('generatePre');
                     // 同步 期信息
                     await transaction.update(this.ctx.service.stage.tableName, {
                         id: stageId, status: checkData.checkType,

+ 23 - 12
app/service/stage_bills_final.js

@@ -29,16 +29,20 @@ module.exports = app => {
          * @param {Object} stage - 本期
          * @returns {Promise<void>}
          */
-        async getFinalData(tender, stage) {
-            const sql = 'SELECT * FROM ' + this.tableName + ' As Bills' +
-                '  INNER JOIN ( ' +
-                '    SELECT MAX(`sorder`) As `sorder`, `lid` From ' + this.tableName +
-                '      WHERE tid = ? AND sorder < ?' +
-                '      GROUP BY `lid`' +
-                '  ) As MaxFilter ' +
-                '  ON Bills.sorder = MaxFilter.sorder And Bills.lid = MaxFilter.lid';
-            const sqlParam = [tender.id, stage.order, tender.id];
-            return await this.db.query(sql, sqlParam);
+        async getFinalData(tender, stageOrder) {
+            // const sql = 'SELECT * FROM ' + this.tableName + ' As Bills' +
+            //     '  INNER JOIN ( ' +
+            //     '    SELECT MAX(`sorder`) As `sorder`, `lid` From ' + this.tableName +
+            //     '      WHERE tid = ? AND sorder < ?' +
+            //     '      GROUP BY `lid`' +
+            //     '  ) As MaxFilter ' +
+            //     '  ON Bills.sorder = MaxFilter.sorder And Bills.lid = MaxFilter.lid';
+            // const sqlParam = [tender.id, stage.order, tender.id];
+            // return await this.db.query(sql, sqlParam);
+            return await this.getAllDataByCondition({
+                //columns: ['lid', 'contract_qty', 'qc_qty', 'contract_tp', 'qc_tp'],
+                where: {tid: tender.id, sorder: stageOrder},
+            });
         }
 
         /**
@@ -74,7 +78,7 @@ module.exports = app => {
             if (stage.order > 1) {
                 const cur = await this.ctx.service.stageBills.getLastestStageData(tender.id, stage.id);
                 if (!cur || cur.length === 0) return;
-                const pre = await this.getFinalData(tender, stage);
+                const pre = await this.getFinalData(tender, stage.order - 1);
                 for (const c of cur) {
                     delete c.id;
                     delete c.said;
@@ -90,8 +94,15 @@ module.exports = app => {
                     c.contract_tp = this.ctx.helper.add(c.contract_tp, p.contract_tp);
                     c.qc_qty = this.ctx.helper.add(c.qc_qty, p.qc_qty);
                     c.qc_tp = this.ctx.helper.add(c.qc_tp, p.qc_tp);
+                    pre.splice(pre.indexOf(p), 1);
+                }
+
+                //await transaction.insert(this.tableName, cur);
+                for (const p of pre) {
+                    p.sid = stage.id;
+                    p.sorder = stage.order;
                 }
-                await transaction.insert(this.tableName, cur);
+                await transaction.insert(this.tableName, cur.concat(pre));
             } else {
                 const sql = 'Insert Into ??(tid, sid, lid, sorder, contract_qty, contract_tp, qc_qty, qc_tp)' +
                     '  SELECT b.tid, b.sid, b.lid, ? As `sorder`, b.contract_qty, b.contract_tp, b.qc_qty, b.qc_tp' +

+ 2 - 2
app/service/stage_pos.js

@@ -96,12 +96,12 @@ module.exports = app => {
                 if (spi) {
                     if ((spi.times * timesLen + spi.order) < (sp.times * timesLen + spi.order)) stagePosIndex[key] = sp;
                 } else {
-                    stagePosIndex[key] = spi;
+                    stagePosIndex[key] = sp;
                 }
             }
             const result = [];
             for (const prop in stagePosIndex) {
-                if (stagePosIndex[prop] && stagePosIndex[prop].id) result.push(stagePosIndex[prop]);
+                result.push(stagePosIndex[prop]);
             }
             return result;
         }

+ 23 - 16
app/service/stage_pos_final.js

@@ -30,19 +30,22 @@ module.exports = app => {
          * @param {Object} stage - 本期
          * @returns {Promise<void>}
          */
-        async getFinalData(tender, stage) {
-            const sql = 'SELECT Pos.* FROM ' +
-                //'  (SELECT pid, contract_qty, qc_qty, sorder FROM ' + this.tableName + ' WHERE tid = ?) As Pos' +
-                this.tableName + ' As Pos' +
-                '  INNER JOIN ( ' +
-                '    SELECT MAX(`sorder`) As `sorder`, `pid` From ' + this.tableName +
-                '      WHERE tid = ? AND sorder < ?' +
-                '      GROUP BY `pid`' +
-                '  ) As MaxFilter ' +
-                '  ON Pos.sorder = MaxFilter.sorder And Pos.pid = MaxFilter.pid';
-            //const sqlParam = [tender.id, tender.id, stage.order];
-            const sqlParam = [tender.id, stage.order];
-            return await this.db.query(sql, sqlParam);
+        async getFinalData(tender, stageOrder) {
+            // const sql = 'SELECT Pos.* FROM ' +
+            //     //'  (SELECT pid, contract_qty, qc_qty, sorder FROM ' + this.tableName + ' WHERE tid = ?) As Pos' +
+            //     this.tableName + ' As Pos' +
+            //     '  INNER JOIN ( ' +
+            //     '    SELECT MAX(`sorder`) As `sorder`, `pid` From ' + this.tableName +
+            //     '      WHERE tid = ? AND sorder < ?' +
+            //     '      GROUP BY `pid`' +
+            //     '  ) As MaxFilter ' +
+            //     '  ON Pos.sorder = MaxFilter.sorder And Pos.pid = MaxFilter.pid';
+            // //const sqlParam = [tender.id, tender.id, stage.order];
+            // const sqlParam = [tender.id, stage.order];
+            return await this.getAllDataByCondition({
+                //columns: ['pid', 'contract_qty', 'qc_qty'],
+                where: {tid: tender.id, sorder: stageOrder},
+            });
         }
 
         /**
@@ -59,7 +62,7 @@ module.exports = app => {
             if (stage.order > 1) {
                 const cur = await this.ctx.service.stagePos.getLastestStageData2(tender.id, stage.id);
                 if (!cur || cur.length === 0) return;
-                const pre = await this.getFinalData(tender, stage);
+                const pre = await this.getFinalData(tender, stage.order - 1);
                 for (const c of cur) {
                     delete c.id;
                     delete c.said;
@@ -75,8 +78,12 @@ module.exports = app => {
                     c.qc_qty = this.ctx.helper.add(c.qc_qty, p.qc_qty);
                     pre.splice(pre.indexOf(p), 1);
                 }
-                await transaction.insert(this.tableName, cur);
-                //await transaction.insert(this.tableName, cur.concat(pre));
+                //await transaction.insert(this.tableName, cur);
+                for (const p of pre) {
+                    p.sid = stage.id;
+                    p.sorder = stage.order;
+                }
+                await transaction.insert(this.tableName, cur.concat(pre));
             } else {
                 const sql = 'Insert Into ??(tid, sid, lid, pid, sorder, contract_qty, qc_qty)' +
                             '  SELECT p.tid, p.sid, p.lid, p.pid, ? As `sorder`, p.contract_qty, p.qc_qty' +

+ 0 - 1
app/service/tender.js

@@ -130,7 +130,6 @@ module.exports = app => {
                     this.ctx.service.stageAudit.tableName, session.sessionUser.accountId,
                     this.ctx.service.changeAudit.tableName, session.sessionUser.accountId];
             }
-            // console.log(this.db.format(sql, sqlParam));
             const list = await this.db.query(sql, sqlParam);
             for (const l of list) {
                 l.category = l.category && l.category !== '' ? JSON.parse(l.category) : null;

+ 2 - 2
test/app/service/ledger.test.js

@@ -465,13 +465,13 @@ describe('test/app/service/ledger.test.js', () => {
         const node1 = _.find(create, {code: '1-1-1'});
         assert(node1.order === 2);
         assert(node1.level === 3);
-        assert(node1.full_path === node.full_path.replace('.' + node.ledger_id, '.' + node1.ledger_id));
+        assert(node1.full_path === node.full_path.replace('-' + node.ledger_id, '-' + node1.ledger_id));
         const node2 = _.find(create, function (c) {
             return c.ledger_pid === node.ledger_pid && c.ledger_id !== node1.ledger_id;
         });
         assert(node2.order === 3);
         assert(node2.level === 3);
-        assert(node2.full_path === node.full_path.replace('.' + node.ledger_id, '.' + node2.ledger_id));
+        assert(node2.full_path === node.full_path.replace('-' + node.ledger_id, '-' + node2.ledger_id));
 
         assert(resultData.ledger.update.length === 1);
         assert(resultData.ledger.update[0].order === 4);

+ 1 - 1
test/app/service/std_bills.test.js

@@ -47,7 +47,7 @@ describe('test/app/service/std_bills.test.js', () => {
         assert(result.length === 6);
 
         // 查询1-10-1的子孙节点
-        const result1 = yield ctx.service.stdBills.getDataByFullPath(1, node.full_path + '.%');
+        const result1 = yield ctx.service.stdBills.getDataByFullPath(1, node.full_path + '-%');
         assert(result1.length === 5);
     });
     it('test getFullLevelDataByFullPath', function* () {