|
@@ -483,17 +483,41 @@ module.exports = app => {
|
|
|
* @returns {Promise<*>}
|
|
|
*/
|
|
|
async getAuditMaterial(auditorId) {
|
|
|
- const sql = 'SELECT sa.`aid`, sa.`times`, sa.`order`, sa.`begin_time`, sa.`end_time`, sa.`tid`, sa.`mid`,' +
|
|
|
- ' s.`order` As `sorder`, s.`status` As `sstatus`,' +
|
|
|
+ const sql = 'SELECT ma.`aid`, ma.`times`, ma.`order`, ma.`begin_time`, ma.`end_time`, ma.`tid`, ma.`mid`,' +
|
|
|
+ ' m.`order` As `morder`, m.`status` As `mstatus`,' +
|
|
|
' t.`name`, t.`project_id`, t.`type`, t.`user_id` ' +
|
|
|
- ' FROM ?? AS sa, ?? AS s, ?? As t ' +
|
|
|
- ' WHERE ((sa.`aid` = ? and sa.`status` = ?) OR (s.`user_id` = ? and sa.`status` = ? and s.`status` = ? and sa.`times` = (s.`times`-1)))' +
|
|
|
- ' and sa.`mid` = s.`id` and sa.`tid` = t.`id`';
|
|
|
+ ' FROM ?? AS ma, ?? AS m, ?? As t ' +
|
|
|
+ ' WHERE ((ma.`aid` = ? and ma.`status` = ?) OR (m.`user_id` = ? and ma.`status` = ? and m.`status` = ? and ma.`times` = (m.`times`-1)))' +
|
|
|
+ ' and ma.`mid` = m.`id` and ma.`tid` = t.`id`';
|
|
|
const sqlParam = [this.tableName, this.ctx.service.material.tableName, this.ctx.service.tender.tableName, auditorId, auditConst.status.checking, auditorId, auditConst.status.checkNo, auditConst.status.checkNo];
|
|
|
return await this.db.query(sql, sqlParam);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 获取 某时间后 审批进度 更新的期
|
|
|
+ * @param {Number} pid - 查询标段
|
|
|
+ * @param {Number} uid - 查询人
|
|
|
+ * @param {Date} time - 查询时间
|
|
|
+ * @returns {Promise<*>}
|
|
|
+ */
|
|
|
+ async getNoticeMaterial(pid, uid, time) {
|
|
|
+ const sql = 'SELECT t.`name`, t.`project_id`, t.`type`, t.`user_id`, ' +
|
|
|
+ ' m.`order` As `m_order`, m.`status` As `m_status`, ' +
|
|
|
+ ' ma.`aid`, ma.`times`, ma.`order`, ma.`end_time`, ma.`tid`, ma.`mid`, ma.`status`, ' +
|
|
|
+ ' pa.`name` As `su_name`, pa.role As `su_role`, pa.company As `su_company`' +
|
|
|
+ ' FROM ?? As t' +
|
|
|
+ ' LEFT JOIN ?? As m On t.`id` = m.`tid`' +
|
|
|
+ ' LEFT JOIN ?? As ma ON m.`id` = ma.`mid`' +
|
|
|
+ ' LEFT JOIN ?? As pa ON ma.`aid` = pa.`id`' +
|
|
|
+ ' WHERE ma.`aid` <> ? and ma.`end_time` > ? and t.`project_id` = ?' +
|
|
|
+ ' GROUP By t.`id`' +
|
|
|
+ ' ORDER By ma.`end_time`';
|
|
|
+ const sqlParam = [this.ctx.service.tender.tableName, this.ctx.service.material.tableName, this.tableName,
|
|
|
+ this.ctx.service.projectAccount.tableName, uid, time, pid];
|
|
|
+ return await this.db.query(sql, sqlParam);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 获取审核人流程列表
|
|
|
*
|
|
|
* @param auditorId
|