Browse Source

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

Tony Kang 1 year ago
parent
commit
49612cc59c

+ 37 - 0
app/const/rpt_archive.js

@@ -0,0 +1,37 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Mai
+ * @date
+ * @version
+ */
+
+const BusinessType = [
+    { stageId: -100, type: 'payment_safe'},
+    { stageId: -200, type: 'budget'},
+    { stageId: -300, type: 'change'},
+    { stageId: -301, type: 'change_plan'},
+    { stageId: -302, type: 'change_project'},
+    { stageId: -303, type: 'change_apply'},
+];
+const getBusinessType = function(stageId) {
+    const sid = parseInt(stageId);
+    if (sid > 0) return 'stage';
+    const bType = BusinessType.find(x => { return x.stageId === sid; });
+    return bType ? bType.type : 'other';
+};
+// { payment_safe: -100, budget: -200, change: -300, ... }
+const BusinessStageId = (function(businessType) {
+    const result = {};
+    for (const bt of businessType) {
+        result[bt.type] = bt.stageId;
+    }
+})(BusinessType);
+
+module.exports = {
+    BusinessType,
+    getBusinessType,
+    BusinessStageId,
+};

+ 1 - 1
app/lib/rm/change_apply.js

@@ -18,7 +18,7 @@ class rptMemChange extends RptMemBase {
 
     async doCheckChangeApply(id) {
         if (this.ctx.change_apply) return;
-        this.ctx.change_apply = await this.ctx.service.change.getDataById(id);
+        this.ctx.change_apply = await this.ctx.service.changeApply.getDataById(id);
     }
 
     async doCheckTender(tenderId) {

+ 1 - 1
app/lib/rm/change_plan.js

@@ -18,7 +18,7 @@ class rptMemChange extends RptMemBase {
 
     async doCheckChangePlan(id) {
         if (this.ctx.change_plan) return;
-        this.ctx.change_plan = await this.ctx.service.change.getDataById(id);
+        this.ctx.change_plan = await this.ctx.service.changePlan.getDataById(id);
     }
 
     async doCheckTender(tenderId) {

+ 1 - 1
app/lib/rm/change_project.js

@@ -18,7 +18,7 @@ class rptMemChange extends RptMemBase {
 
     async doCheckChangeProject(id) {
         if (this.ctx.change_project) return;
-        this.ctx.change_project = await this.ctx.service.change.getDataById(id);
+        this.ctx.change_project = await this.ctx.service.changeProject.getDataById(id);
     }
 
     async doCheckTender(tenderId) {

+ 3 - 3
app/service/report.js

@@ -567,7 +567,7 @@ module.exports = app => {
         }
 
         // params = { change_plan_id: int }
-        async changePlan(params, sourceFilters, memFieldKeys, customDefine, customSelect) {
+        async change_plan(params, sourceFilters, memFieldKeys, customDefine, customSelect) {
             const RptPayment = require('../lib/rm/change_plan');
             const rptPayment = new RptPayment(this.ctx);
 
@@ -575,7 +575,7 @@ module.exports = app => {
         }
 
         // params = { change_project_id: int }
-        async changeProject(params, sourceFilters, memFieldKeys, customDefine, customSelect) {
+        async change_project(params, sourceFilters, memFieldKeys, customDefine, customSelect) {
             const RptPayment = require('../lib/rm/change_project');
             const rptPayment = new RptPayment(this.ctx);
 
@@ -583,7 +583,7 @@ module.exports = app => {
         }
 
         // params = { change_apply_id: int }
-        async changeApply(params, sourceFilters, memFieldKeys, customDefine, customSelect) {
+        async change_apply(params, sourceFilters, memFieldKeys, customDefine, customSelect) {
             const RptPayment = require('../lib/rm/change_apply');
             const rptPayment = new RptPayment(this.ctx);
 

+ 3 - 0
app/service/rpt_archive.js

@@ -5,6 +5,7 @@
  */
 
 const BaseService = require('../base/base_service');
+const rptArchiveConst = require('../const/rpt_archive');
 
 module.exports = app => {
 
@@ -82,6 +83,7 @@ module.exports = app => {
                     stage_id,
                     business_id,
                     tender_id,
+                    business_type: rptArchiveConst.getBusinessType(stage_id),
                     content: JSON.stringify(archiveArr),
                 };
                 // console.log(data);
@@ -105,6 +107,7 @@ module.exports = app => {
                     stage_id,
                     business_id,
                     tender_id,
+                    business_type: rptArchiveConst.getBusinessType(stage_id),
                     content: JSON.stringify(archiveArr),
                 };
                 // console.log(data);

+ 3 - 0
app/service/rpt_archive_encryption.js

@@ -5,6 +5,7 @@
  */
 
 const BaseService = require('../base/base_service');
+const rptArchiveConst = require('../const/rpt_archive');
 
 module.exports = app => {
 
@@ -82,6 +83,7 @@ module.exports = app => {
                     stage_id,
                     business_id,
                     tender_id,
+                    business_type: rptArchiveConst.getBusinessType(stage_id),
                     content: JSON.stringify(archiveArr),
                 };
                 // console.log(data);
@@ -105,6 +107,7 @@ module.exports = app => {
                     stage_id,
                     business_id,
                     tender_id,
+                    business_type: rptArchiveConst.getBusinessType(stage_id),
                     content: JSON.stringify(archiveArr),
                 };
                 // console.log(data);

+ 21 - 21
db_script/depart_table.js

@@ -31,27 +31,27 @@ getArrDepartSql(posTables, posDepartKey, orgPosDepart, tableDepart);
 
 BaseUtil.saveBufferFile(sqlArr.join('\n'), BaseUtil.getFileName('depart_table.sql'));
 
-// Select Sum(amount) FROM (
-//     Select Count(*) As amount From zh_settle_bills_bak_0
-//     UNION ALL
-//     Select Count(*) As amount From zh_settle_bills_bak_1
-//     UNION ALL
-//     Select Count(*) As amount From zh_settle_bills_bak_2
-//     UNION ALL
-//     Select Count(*) As amount From zh_settle_bills_bak_3
-//     UNION ALL
-//     Select Count(*) As amount From zh_settle_bills_bak_4
-//     UNION ALL
-//     Select Count(*) As amount From zh_settle_bills_bak_5
-//     UNION ALL
-//     Select Count(*) As amount From zh_settle_bills_bak_6
-//     UNION ALL
-//     Select Count(*) As amount From zh_settle_bills_bak_7
-//     UNION ALL
-//     Select Count(*) As amount From zh_settle_bills_bak_8
-//     UNION ALL
-//     Select Count(*) As amount From zh_settle_bills_bak_9
-// ) As temp;
+Select Sum(amount) FROM (
+    Select Count(*) As amount From zh_settle_bills_bak_0
+    UNION ALL
+    Select Count(*) As amount From zh_settle_bills_bak_1
+    UNION ALL
+    Select Count(*) As amount From zh_settle_bills_bak_2
+    UNION ALL
+    Select Count(*) As amount From zh_settle_bills_bak_3
+    UNION ALL
+    Select Count(*) As amount From zh_settle_bills_bak_4
+    UNION ALL
+    Select Count(*) As amount From zh_settle_bills_bak_5
+    UNION ALL
+    Select Count(*) As amount From zh_settle_bills_bak_6
+    UNION ALL
+    Select Count(*) As amount From zh_settle_bills_bak_7
+    UNION ALL
+    Select Count(*) As amount From zh_settle_bills_bak_8
+    UNION ALL
+    Select Count(*) As amount From zh_settle_bills_bak_9
+) As temp;
 
 // 数据量预估
 // qa执行时间(分表100)

+ 6 - 0
sql/update.sql

@@ -46,3 +46,9 @@ ADD COLUMN `business_id` VARCHAR(45) NULL COMMENT '有其他业务情况,统
 ADD COLUMN `tender_id` INT(11) NULL AFTER `business_id`,
 ADD INDEX `PRJ_STG_BZ` (`prj_id` ASC, `stage_id` ASC, `business_id` ASC);
 ;
+
+ALTER TABLE `zh_rpt_archive_encryption`
+ADD COLUMN `business_type` varchar(30) NOT NULL DEFAULT 'stage' COMMENT 'stage: 变更令;budget: 动态决算,payment_safe: 支付审批-安全生产费,change: 变更令,change_plan: 变更方案,change_project: 变更立项,change_apply: 变更申请' AFTER `stage_id`;
+
+ALTER TABLE `zh_rpt_archive`
+ADD COLUMN `business_type` varchar(30) NOT NULL DEFAULT 'stage' COMMENT 'stage: 变更令;budget: 动态决算,payment_safe: 支付审批-安全生产费,change: 变更令,change_plan: 变更方案,change_project: 变更立项,change_apply: 变更申请' AFTER `stage_id`;