|  | @@ -275,21 +275,16 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                      hs_m_tp: this.ctx.helper.add(this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), material_decimal.tp), this.ctx.helper.round(this.ctx.helper.mul(materialInfo.ex_tp, 1+materialInfo.exponent_rate/100), material_decimal.tp)),
 | 
	
		
			
				|  |  |                  };
 | 
	
		
			
				|  |  |                  await this.ctx.helper.sendWechat(audit.aid, smsTypeConst.const.TC, smsTypeConst.judge.approval.toString(), wxConst.template.material, wechatData);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                // 添加短信通知-需要审批提醒功能
 | 
	
		
			
				|  |  | -                // const smsUser = await this.ctx.service.projectAccount.getDataById(audit.aid);
 | 
	
		
			
				|  |  | -                // if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
 | 
	
		
			
				|  |  | -                //     const smsType = JSON.parse(smsUser.sms_type);
 | 
	
		
			
				|  |  | -                //     if (smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
 | 
	
		
			
				|  |  | -                //         const tenderInfo = await this.ctx.service.tender.getDataById(audit.tid);
 | 
	
		
			
				|  |  | -                //         const stageInfo = await this.ctx.service.stage.getDataById(audit.sid);
 | 
	
		
			
				|  |  | -                //         const sms = new SMS(this.ctx);
 | 
	
		
			
				|  |  | -                //         const tenderName = await sms.contentChange(tenderInfo.name);
 | 
	
		
			
				|  |  | -                //         const content = '【纵横计量支付】' + tenderName + '第' + stageInfo.order + '期,需要您审批。';
 | 
	
		
			
				|  |  | -                //         sms.send(smsUser.auth_mobile, content);
 | 
	
		
			
				|  |  | -                //     }
 | 
	
		
			
				|  |  | -                // }
 | 
	
		
			
				|  |  | +                await this.ctx.service.noticeAgain.addNoticeAgain(transaction, smsTypeConst.const.TC, {
 | 
	
		
			
				|  |  | +                    pid: this.ctx.session.sessionProject.id,
 | 
	
		
			
				|  |  | +                    tid: this.ctx.tender.id,
 | 
	
		
			
				|  |  | +                    uid: audit.aid,
 | 
	
		
			
				|  |  | +                    sp_type: 'material',
 | 
	
		
			
				|  |  | +                    sp_id: audit.id,
 | 
	
		
			
				|  |  | +                    table_name: this.tableName,
 | 
	
		
			
				|  |  | +                    template: wxConst.template.material,
 | 
	
		
			
				|  |  | +                    wx_data: wechatData,
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  // todo 更新标段tender状态 ?
 | 
	
		
			
				|  |  |                  // 检查三方特殊推送
 | 
	
	
		
			
				|  | @@ -323,7 +318,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  // 获取当前总金额及独立单价期的金额,添加到tp_data中,报表使用
 | 
	
		
			
				|  |  |                  const tp_data = await this.getTpData(transaction, materialId);
 | 
	
		
			
				|  |  |                  await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time, tp_data: JSON.stringify(tp_data) });
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +                await this.ctx.service.noticeAgain.stopNoticeAgain(transaction, this.tableName, audit.id);
 | 
	
		
			
				|  |  |                  // 获取推送必要信息
 | 
	
		
			
				|  |  |                  const noticeContent = await this.getNoticeContent(pid, audit.tid, materialId, audit.aid, checkData.opinion);
 | 
	
		
			
				|  |  |                  // 添加推送
 | 
	
	
		
			
				|  | @@ -361,22 +356,18 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                          hs_m_tp: this.ctx.helper.add(this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), material_decimal.tp), this.ctx.helper.round(this.ctx.helper.mul(materialInfo.ex_tp, 1+materialInfo.exponent_rate/100), material_decimal.tp)),
 | 
	
		
			
				|  |  |                      };
 | 
	
		
			
				|  |  |                      await this.ctx.helper.sendWechat(nextAudit.aid, smsTypeConst.const.TC, smsTypeConst.judge.approval.toString(), wxConst.template.material, wechatData);
 | 
	
		
			
				|  |  | +                    await this.ctx.service.noticeAgain.addNoticeAgain(transaction, smsTypeConst.const.TC, {
 | 
	
		
			
				|  |  | +                        pid: this.ctx.session.sessionProject.id,
 | 
	
		
			
				|  |  | +                        tid: this.ctx.tender.id,
 | 
	
		
			
				|  |  | +                        uid: nextAudit.aid,
 | 
	
		
			
				|  |  | +                        sp_type: 'material',
 | 
	
		
			
				|  |  | +                        sp_id: nextAudit.id,
 | 
	
		
			
				|  |  | +                        table_name: this.tableName,
 | 
	
		
			
				|  |  | +                        template: wxConst.template.material,
 | 
	
		
			
				|  |  | +                        wx_data: wechatData,
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  |                      // 检查三方特殊推送
 | 
	
		
			
				|  |  |                      await this.ctx.service.specMsg.addMaterialMsg(transaction, pid, materialInfo, pushOperate.material.flow);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                    // 添加短信通知-需要审批提醒功能
 | 
	
		
			
				|  |  | -                    // const smsUser = await this.ctx.service.projectAccount.getDataById(nextAudit.aid);
 | 
	
		
			
				|  |  | -                    // if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
 | 
	
		
			
				|  |  | -                    //     const smsType = JSON.parse(smsUser.sms_type);
 | 
	
		
			
				|  |  | -                    //     if (smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
 | 
	
		
			
				|  |  | -                    //         const tenderInfo = await this.ctx.service.tender.getDataById(nextAudit.tid);
 | 
	
		
			
				|  |  | -                    //         const stageInfo = await this.ctx.service.stage.getDataById(nextAudit.sid);
 | 
	
		
			
				|  |  | -                    //         const sms = new SMS(this.ctx);
 | 
	
		
			
				|  |  | -                    //         const tenderName = await sms.contentChange(tenderInfo.name);
 | 
	
		
			
				|  |  | -                    //         const content = '【纵横计量支付】' + tenderName + '第' + stageInfo.order + '期,需要您审批。';
 | 
	
		
			
				|  |  | -                    //         sms.send(smsUser.auth_mobile, content);
 | 
	
		
			
				|  |  | -                    //     }
 | 
	
		
			
				|  |  | -                    // }
 | 
	
		
			
				|  |  |                  } else {
 | 
	
		
			
				|  |  |                      // 本期结束
 | 
	
		
			
				|  |  |                      // 同步 期信息
 | 
	
	
		
			
				|  | @@ -509,6 +500,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |              try {
 | 
	
		
			
				|  |  |                  const tp_data = await this.getTpData(transaction, materialId);
 | 
	
		
			
				|  |  |                  await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time, tp_data: JSON.stringify(tp_data), });
 | 
	
		
			
				|  |  | +                await this.ctx.service.noticeAgain.stopNoticeAgain(transaction, this.tableName, audit.id);
 | 
	
		
			
				|  |  |                  // 添加到消息推送表
 | 
	
		
			
				|  |  |                  const noticeContent = await this.getNoticeContent(pid, audit.tid, materialId, audit.aid, checkData.opinion);
 | 
	
		
			
				|  |  |                  const records = [{ pid, type: pushType.material, uid: this.ctx.material.user_id, status: auditConst.status.checkNo, content: noticeContent }];
 | 
	
	
		
			
				|  | @@ -614,6 +606,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  });
 | 
	
		
			
				|  |  |                  await transaction.insert('zh_notice', records);
 | 
	
		
			
				|  |  |                  await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time, tp_data: JSON.stringify(tp_data) });
 | 
	
		
			
				|  |  | +                await this.ctx.service.noticeAgain.stopNoticeAgain(transaction, this.tableName, audit.id);
 | 
	
		
			
				|  |  |                  // 顺移气候审核人流程顺序
 | 
	
		
			
				|  |  |                  this.initSqlBuilder();
 | 
	
		
			
				|  |  |                  this.sqlBuilder.setAndWhere('mid', { value: materialId, operate: '=' });
 | 
	
	
		
			
				|  | @@ -621,17 +614,18 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  this.sqlBuilder.setUpdateData('order', { value: 2, selfOperate: '+' });
 | 
	
		
			
				|  |  |                  const [sql, sqlParam] = this.sqlBuilder.build(this.tableName, 'update');
 | 
	
		
			
				|  |  |                  const data = await transaction.query(sql, sqlParam);
 | 
	
		
			
				|  |  | -                const newAuditors = [];
 | 
	
		
			
				|  |  | -                newAuditors.push({
 | 
	
		
			
				|  |  | +                const newAuditors = {
 | 
	
		
			
				|  |  |                      tid: audit.tid, mid: audit.mid, aid: preAuditor.aid,
 | 
	
		
			
				|  |  |                      times: audit.times, order: audit.order + 1, status: auditConst.status.checking,
 | 
	
		
			
				|  |  |                      begin_time: time,
 | 
	
		
			
				|  |  |                      tp_data: JSON.stringify(tp_data),
 | 
	
		
			
				|  |  | -                });
 | 
	
		
			
				|  |  | -                newAuditors.push({
 | 
	
		
			
				|  |  | +                };
 | 
	
		
			
				|  |  | +                const checking_result = await transaction.insert(this.tableName, newAuditors);
 | 
	
		
			
				|  |  | +                const uncheckNewAuditors = {
 | 
	
		
			
				|  |  |                      tid: audit.tid, mid: audit.mid, aid: audit.aid,
 | 
	
		
			
				|  |  |                      times: audit.times, order: audit.order + 2, status: auditConst.status.uncheck,
 | 
	
		
			
				|  |  | -                });
 | 
	
		
			
				|  |  | +                };
 | 
	
		
			
				|  |  | +                await transaction.insert(this.tableName, uncheckNewAuditors);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  // 微信模板通知
 | 
	
		
			
				|  |  |                  const begin_audit = await this.getDataByCondition({
 | 
	
	
		
			
				|  | @@ -649,10 +643,18 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                      hs_m_tp: this.ctx.helper.add(this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), material_decimal.tp), this.ctx.helper.round(this.ctx.helper.mul(materialInfo.ex_tp, 1+materialInfo.exponent_rate/100), material_decimal.tp)),
 | 
	
		
			
				|  |  |                  };
 | 
	
		
			
				|  |  |                  await this.ctx.helper.sendWechat(preAuditor.aid, smsTypeConst.const.TC, smsTypeConst.judge.approval.toString(), wxConst.template.material, wechatData);
 | 
	
		
			
				|  |  | +                await this.ctx.service.noticeAgain.addNoticeAgain(transaction, smsTypeConst.const.TC, {
 | 
	
		
			
				|  |  | +                    pid: this.ctx.session.sessionProject.id,
 | 
	
		
			
				|  |  | +                    tid: this.ctx.tender.id,
 | 
	
		
			
				|  |  | +                    uid: preAuditor.aid,
 | 
	
		
			
				|  |  | +                    sp_type: 'material',
 | 
	
		
			
				|  |  | +                    sp_id: checking_result.id,
 | 
	
		
			
				|  |  | +                    table_name: this.tableName,
 | 
	
		
			
				|  |  | +                    template: wxConst.template.material,
 | 
	
		
			
				|  |  | +                    wx_data: wechatData,
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  |                  // 检查三方特殊推送
 | 
	
		
			
				|  |  |                  await this.ctx.service.specMsg.addMaterialMsg(transaction, pid, materialInfo, pushOperate.material.flow);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                await transaction.insert(this.tableName, newAuditors);
 | 
	
		
			
				|  |  |                  await transaction.commit();
 | 
	
		
			
				|  |  |              } catch (error) {
 | 
	
		
			
				|  |  |                  await transaction.rollback();
 | 
	
	
		
			
				|  | @@ -729,19 +731,19 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  const material_decimal = materialInfo && materialInfo.decimal ? JSON.parse(materialInfo.decimal) : materialConst.decimal;
 | 
	
		
			
				|  |  |                  const tp_data = await this.getTpData(transaction, materialId, material_decimal);
 | 
	
		
			
				|  |  |                  // 当前审批人2次添加至流程中
 | 
	
		
			
				|  |  | -                const newAuditors = [];
 | 
	
		
			
				|  |  | -                newAuditors.push({
 | 
	
		
			
				|  |  | +                const newAuditors = {
 | 
	
		
			
				|  |  |                      tid: audit.tid, mid: audit.mid, aid: audit.aid,
 | 
	
		
			
				|  |  |                      times: audit.times, order: audit.order + 1, status: auditConst.status.checkAgain,
 | 
	
		
			
				|  |  |                      begin_time: time, end_time: time, opinion: '',
 | 
	
		
			
				|  |  | -                });
 | 
	
		
			
				|  |  | -                newAuditors.push({
 | 
	
		
			
				|  |  | +                };
 | 
	
		
			
				|  |  | +                await transaction.insert(this.tableName, newAuditors);
 | 
	
		
			
				|  |  | +                const checkingNewAuditors = {
 | 
	
		
			
				|  |  |                      tid: audit.tid, mid: audit.mid, aid: audit.aid,
 | 
	
		
			
				|  |  |                      times: audit.times, order: audit.order + 2, status: auditConst.status.checking,
 | 
	
		
			
				|  |  |                      begin_time: time,
 | 
	
		
			
				|  |  |                      tp_data: JSON.stringify(tp_data),
 | 
	
		
			
				|  |  | -                });
 | 
	
		
			
				|  |  | -                await transaction.insert(this.tableName, newAuditors);
 | 
	
		
			
				|  |  | +                };
 | 
	
		
			
				|  |  | +                const checking_result = await transaction.insert(this.tableName, checkingNewAuditors);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  // 本期结束
 | 
	
		
			
				|  |  |                  // 同步 期信息
 | 
	
	
		
			
				|  | @@ -759,6 +761,16 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                      hs_m_tp: this.ctx.helper.add(this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), material_decimal.tp), this.ctx.helper.round(this.ctx.helper.mul(materialInfo.ex_tp, 1+materialInfo.exponent_rate/100), material_decimal.tp)),
 | 
	
		
			
				|  |  |                  };
 | 
	
		
			
				|  |  |                  await this.ctx.helper.sendWechat(audit.aid, smsTypeConst.const.TC, smsTypeConst.judge.approval.toString(), wxConst.template.material, wechatData);
 | 
	
		
			
				|  |  | +                await this.ctx.service.noticeAgain.addNoticeAgain(transaction, smsTypeConst.const.TC, {
 | 
	
		
			
				|  |  | +                    pid: this.ctx.session.sessionProject.id,
 | 
	
		
			
				|  |  | +                    tid: this.ctx.tender.id,
 | 
	
		
			
				|  |  | +                    uid: audit.aid,
 | 
	
		
			
				|  |  | +                    sp_type: 'material',
 | 
	
		
			
				|  |  | +                    sp_id: checking_result.insertId,
 | 
	
		
			
				|  |  | +                    table_name: this.tableName,
 | 
	
		
			
				|  |  | +                    template: wxConst.template.material,
 | 
	
		
			
				|  |  | +                    wx_data: wechatData,
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  |                  // 检查三方特殊推送
 | 
	
		
			
				|  |  |                  await this.ctx.service.specMsg.addMaterialMsg(transaction, pid, materialInfo, pushOperate.material.flow);
 | 
	
		
			
				|  |  |                  await transaction.commit();
 |