Procházet zdrojové kódy

通用推送相关

MaiXinRong před 4 roky
rodič
revize
f0be3f2a15

+ 2 - 0
app/service/change.js

@@ -610,6 +610,8 @@ module.exports = app => {
                     change_update.p_code = postData.p_code;
                     change_update.sin_time = Date.parse(new Date()) / 1000;
 
+                    await this.ctx.service.tenderTag.saveTenderTag(tenderId, {bgl_time: new Date()}, this.transaction);
+
                     // 添加短信通知-审批通过提醒功能
                     // const mobile_array = [];
                     const auditList = await this.ctx.service.changeAudit.getListGroupByTimes(changeData.cid, changeData.times);

+ 1 - 0
app/service/ledger_audit.js

@@ -364,6 +364,7 @@ module.exports = app => {
                             id: tenderId,
                             ledger_status: checkType,
                         });
+                        await this.ctx.service.tenderTag.saveTenderTag(tenderId, {ledger_time: new Date()}, transaction);
                         const users = this._.pull(this._.map(auditList, 'audit_id'), audit.id);
                         await this.ctx.helper.sendAliSms(users, smsTypeConst.const.TZ, smsTypeConst.judge.result.toString(), SmsAliConst.template.ledger_result, {
                             status: SmsAliConst.status.success,

+ 1 - 0
app/service/revise_audit.js

@@ -424,6 +424,7 @@ module.exports = app => {
                             status: checkType,
                             end_time: time,
                         });
+                        await this.ctx.service.tenderTag.saveTenderTag(tenderId, {revise_time: new Date()}, transaction);
                         // 最新一期跟台账相关的缓存数据应过期
                         const lastStage = await this.ctx.service.stage.getLastestStage(revise.tid, true);
                         const cacheTime = new Date();

+ 1 - 0
app/service/stage_audit.js

@@ -444,6 +444,7 @@ module.exports = app => {
                     };
                     await this.ctx.helper.sendWechat(nextAudit.aid, smsTypeConst.const.JL, smsTypeConst.judge.approval.toString(), wxConst.template.stage, wechatData);
                 } else {
+                    await this.ctx.service.tenderTag.saveTenderTag(tenderId, {stage_time: new Date()}, transaction);
                     // 本期结束
                     // 生成截止本期数据 final数据
                     await this.ctx.service.stageBillsFinal.generateFinalData(transaction, this.ctx.tender, this.ctx.stage);

+ 1 - 0
app/service/tender.js

@@ -206,6 +206,7 @@ module.exports = app => {
                 if (!result) {
                     throw '新增合同支付数据失败';
                 }
+                await this.ctx.service.tenderTag.addTenderTag(operate.insertId, sessionProject.id, this.transaction);
                 await this.transaction.commit();
                 const sql = 'SELECT t.`id`, t.`project_id`, t.`name`, t.`status`, t.`category`, t.`ledger_times`, t.`ledger_status`, t.`measure_type`, t.`user_id`, t.`create_time`, t.`total_price`, t.`deal_tp`,' +
                     '    pa.`name` As `user_name`, pa.`role` As `user_role`, pa.`company` As `user_company` ' +

+ 59 - 0
app/service/tender_tag.js

@@ -0,0 +1,59 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Mai
+ * @date 2018/10/30
+ * @version
+ */
+
+module.exports = app => {
+
+    class TenderTag extends app.BaseService {
+
+        /**
+         * 构造函数
+         *
+         * @param {Object} ctx - egg全局变量
+         * @return {void}
+         */
+        constructor(ctx) {
+            super(ctx);
+            this.tableName = 'tender_tag';
+        }
+
+        /**
+         * 新增 标段标记
+         *
+         * @param tenderId - 标段Id
+         * @param projectId - 项目Id
+         * @param transaction - 事务
+         * @return {Promise<void>}
+         */
+        async addTenderTag(tenderId, projectId, transaction) {
+            if (transaction) {
+                await transaction.insert(this.tableName, {tid: tenderId, pid: projectId});
+            } else {
+                await this.db.insert(this.tableName, {tid: tenderId, pid: projectId});
+            }
+        }
+
+        /**
+         * 保存 标段标记
+         *
+         * @param data
+         * @return {Promise<void>}
+         */
+        async saveTenderTag(tenderId, data, transaction) {
+            if (transaction) {
+                await transaction.update(this.tableName, data, { where: { tid: tenderId } });
+            } else {
+                await this.db.update(this.tableName, data, { where: { tid: tenderId } });
+            }
+        }
+
+    }
+
+    return TenderTag;
+};

+ 40 - 0
sql/update.sql

@@ -4,3 +4,43 @@ ADD COLUMN `copy_id` INT(10) NULL COMMENT '被拷贝标段id' AFTER `uuid`;
 
 ALTER TABLE `zh_change_audit_list` ADD `gcl_id` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '台账对应id(非准确)' AFTER `xmj_jldy`;
 UPDATE `zh_change_audit_list` SET `gcl_id`=`lid` WHERE `lid` != '0';
+
+-- sync2bim相关
+ALTER TABLE `zh_s2b_proj`
+ADD COLUMN `merge_code`  tinyint(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `common_option`;
+
+-- ----------------------------
+-- Table structure for zh_tender_tag
+-- ----------------------------
+DROP TABLE IF EXISTS `zh_tender_tag`;
+CREATE TABLE `zh_tender_tag` (
+  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+  `tid` int(11) NOT NULL COMMENT '标段id',
+  `pid` int(11) NOT NULL COMMENT '项目id',
+  `ledger_time` datetime DEFAULT NULL COMMENT '台账分解审批完成时间',
+  `revise_time` datetime DEFAULT NULL COMMENT '最后一次台账修订审批完成时间',
+  `stage_time` datetime DEFAULT NULL COMMENT '最后一次期审批完成时间',
+  `bgl_time` datetime DEFAULT NULL COMMENT '最后一次变更令审批完成时间',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2049 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- ----------------------------
+-- Table structure for zh_s2b_proj_push
+-- ----------------------------
+DROP TABLE IF EXISTS `zh_s2b_proj_push`;
+CREATE TABLE `zh_s2b_proj_push` (
+  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+  `pid` int(11) NOT NULL COMMENT '项目id-zh_s2b_proj中的id',
+  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '名称',
+  `url` varchar(255) CHARACTER SET ascii NOT NULL DEFAULT '' COMMENT '推送的url',
+  `ledger` tinyint(1) NOT NULL DEFAULT '1' COMMENT '台账审批通过-是否推送',
+  `revise` tinyint(1) NOT NULL DEFAULT '1' COMMENT '台账修订审批通过-是否推送',
+  `stage` tinyint(1) NOT NULL DEFAULT '1' COMMENT '期审批通过-是否推送',
+  `bgl` tinyint(1) NOT NULL DEFAULT '1' COMMENT '变更令审批通过-是否需要推送',
+  `add_time` datetime(4) DEFAULT NULL COMMENT '创建时间',
+  `lastest_time` datetime(4) DEFAULT NULL COMMENT '最后修改时间',
+  `push_time` datetime(4) DEFAULT NULL COMMENT '最近一次推送时间',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+Insert Into zh_tender_tag (tid, pid) Select id, project_id From zh_tender Where 1=1;