|
@@ -272,16 +272,14 @@ module.exports = app => {
|
|
|
id: cpId, status: auditConst.status.checking,
|
|
|
});
|
|
|
// 微信模板通知
|
|
|
- // const materialInfo = await this.ctx.service.material.getDataById(materialId);
|
|
|
- // const wechatData = {
|
|
|
- // qi: materialInfo.order,
|
|
|
- // status: wxConst.status.check,
|
|
|
- // tips: wxConst.tips.check,
|
|
|
- // begin_time: Date.parse(new Date()),
|
|
|
- // m_tp: this.ctx.helper.add(this.ctx.helper.round(materialInfo.m_tp, 2), this.ctx.helper.round(materialInfo.ex_tp, 2)),
|
|
|
- // hs_m_tp: this.ctx.helper.add(this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), 2), this.ctx.helper.round(this.ctx.helper.mul(materialInfo.ex_tp, 1+materialInfo.rate/100), 2)),
|
|
|
- // };
|
|
|
- // await this.ctx.helper.sendWechat(audit.aid, smsTypeConst.const.TC, smsTypeConst.judge.approval.toString(), wxConst.template.material, wechatData);
|
|
|
+ const wechatData = {
|
|
|
+ type: 'project',
|
|
|
+ status: wxConst.status.check,
|
|
|
+ tips: wxConst.tips.check,
|
|
|
+ code: this.ctx.session.sessionProject.code,
|
|
|
+ c_name: this.ctx.change.name,
|
|
|
+ };
|
|
|
+ await this.ctx.helper.sendWechat(audit.aid, smsTypeConst.const.BG, smsTypeConst.judge.approval.toString(), wxConst.template.change, wechatData);
|
|
|
|
|
|
// todo 更新标段tender状态 ?
|
|
|
await transaction.commit();
|
|
@@ -397,15 +395,14 @@ module.exports = app => {
|
|
|
});
|
|
|
|
|
|
// 微信模板通知
|
|
|
- // const wechatData = {
|
|
|
- // qi: materialInfo.order,
|
|
|
- // status: wxConst.status.check,
|
|
|
- // tips: wxConst.tips.check,
|
|
|
- // begin_time: Date.parse(begin_audit.begin_time),
|
|
|
- // m_tp: this.ctx.helper.add(this.ctx.helper.round(materialInfo.m_tp, 2), this.ctx.helper.round(materialInfo.ex_tp, 2)),
|
|
|
- // hs_m_tp: this.ctx.helper.add(this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), 2), this.ctx.helper.round(this.ctx.helper.mul(materialInfo.ex_tp, 1+materialInfo.rate/100), 2)),
|
|
|
- // };
|
|
|
- // await this.ctx.helper.sendWechat(nextAudit.aid, smsTypeConst.const.TC, smsTypeConst.judge.approval.toString(), wxConst.template.material, wechatData);
|
|
|
+ const wechatData = {
|
|
|
+ type: 'project',
|
|
|
+ status: wxConst.status.check,
|
|
|
+ tips: wxConst.tips.check,
|
|
|
+ code: this.ctx.session.sessionProject.code,
|
|
|
+ c_name: this.ctx.change.name,
|
|
|
+ };
|
|
|
+ await this.ctx.helper.sendWechat(nextAudit.aid, smsTypeConst.const.BG, smsTypeConst.judge.approval.toString(), wxConst.template.change, wechatData);
|
|
|
} else {
|
|
|
// 本期结束
|
|
|
// 生成截止本期数据 final数据
|
|
@@ -415,16 +412,15 @@ module.exports = app => {
|
|
|
});
|
|
|
|
|
|
// 微信模板通知
|
|
|
- // const users = this._.uniq(this._.concat(this._.map(auditors, 'aid'), materialInfo.user_id));
|
|
|
- // const wechatData = {
|
|
|
- // qi: materialInfo.order,
|
|
|
- // status: wxConst.status.success,
|
|
|
- // tips: wxConst.tips.success,
|
|
|
- // begin_time: Date.parse(begin_audit.begin_time),
|
|
|
- // m_tp: this.ctx.helper.add(this.ctx.helper.round(materialInfo.m_tp, 2), this.ctx.helper.round(materialInfo.ex_tp, 2)),
|
|
|
- // hs_m_tp: this.ctx.helper.add(this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), 2), this.ctx.helper.round(this.ctx.helper.mul(materialInfo.ex_tp, 1+materialInfo.rate/100), 2)),
|
|
|
- // };
|
|
|
- // await this.ctx.helper.sendWechat(users, smsTypeConst.const.TC, smsTypeConst.judge.result.toString(), wxConst.template.material, wechatData);
|
|
|
+ const users = this._.uniq(this._.concat(this._.map(auditors, 'aid'), this.ctx.change.uid));
|
|
|
+ const wechatData = {
|
|
|
+ type: 'project',
|
|
|
+ status: wxConst.status.success,
|
|
|
+ tips: wxConst.tips.success,
|
|
|
+ code: this.ctx.session.sessionProject.code,
|
|
|
+ c_name: this.ctx.change.name,
|
|
|
+ };
|
|
|
+ await this.ctx.helper.sendWechat(users, smsTypeConst.const.BG, smsTypeConst.judge.result.toString(), wxConst.template.change, wechatData);
|
|
|
}
|
|
|
await transaction.commit();
|
|
|
} catch (err) {
|
|
@@ -468,21 +464,15 @@ module.exports = app => {
|
|
|
// 拷贝新一次审核流程列表
|
|
|
await transaction.insert(this.tableName, auditors);
|
|
|
// 微信模板通知
|
|
|
- // const begin_audit = await this.getDataByCondition({
|
|
|
- // mid: materialId,
|
|
|
- // order: 1,
|
|
|
- // });
|
|
|
- // const materialInfo = await this.ctx.service.material.getDataById(materialId);
|
|
|
- // const users = this._.uniq(this._.concat(this._.map(auditors, 'aid'), materialInfo.user_id));
|
|
|
- // const wechatData = {
|
|
|
- // qi: materialInfo.order,
|
|
|
- // status: wxConst.status.back,
|
|
|
- // tips: wxConst.tips.back,
|
|
|
- // begin_time: Date.parse(begin_audit.begin_time),
|
|
|
- // m_tp: this.ctx.helper.add(this.ctx.helper.round(materialInfo.m_tp, 2), this.ctx.helper.round(materialInfo.ex_tp, 2)),
|
|
|
- // hs_m_tp: this.ctx.helper.add(this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), 2), this.ctx.helper.round(this.ctx.helper.mul(materialInfo.ex_tp, 1+materialInfo.rate/100), 2)),
|
|
|
- // };
|
|
|
- // await this.ctx.helper.sendWechat(users, smsTypeConst.const.TC, smsTypeConst.judge.result.toString(), wxConst.template.material, wechatData);
|
|
|
+ const users = this._.uniq(this._.concat(this._.map(auditors, 'aid'), this.ctx.change.uid));
|
|
|
+ const wechatData = {
|
|
|
+ type: 'project',
|
|
|
+ status: wxConst.status.back,
|
|
|
+ tips: wxConst.tips.back,
|
|
|
+ code: this.ctx.session.sessionProject.code,
|
|
|
+ c_name: this.ctx.change.name,
|
|
|
+ };
|
|
|
+ await this.ctx.helper.sendWechat(users, smsTypeConst.const.BG, smsTypeConst.judge.result.toString(), wxConst.template.change, wechatData);
|
|
|
await transaction.commit();
|
|
|
} catch (err) {
|
|
|
await transaction.rollback();
|
|
@@ -523,16 +513,15 @@ module.exports = app => {
|
|
|
});
|
|
|
|
|
|
// 微信模板通知
|
|
|
- // const users = this._.uniq(this._.concat(this._.map(auditors, 'aid'), materialInfo.user_id));
|
|
|
- // const wechatData = {
|
|
|
- // qi: materialInfo.order,
|
|
|
- // status: wxConst.status.success,
|
|
|
- // tips: wxConst.tips.success,
|
|
|
- // begin_time: Date.parse(begin_audit.begin_time),
|
|
|
- // m_tp: this.ctx.helper.add(this.ctx.helper.round(materialInfo.m_tp, 2), this.ctx.helper.round(materialInfo.ex_tp, 2)),
|
|
|
- // hs_m_tp: this.ctx.helper.add(this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), 2), this.ctx.helper.round(this.ctx.helper.mul(materialInfo.ex_tp, 1+materialInfo.rate/100), 2)),
|
|
|
- // };
|
|
|
- // await this.ctx.helper.sendWechat(users, smsTypeConst.const.TC, smsTypeConst.judge.result.toString(), wxConst.template.material, wechatData);
|
|
|
+ const users = this._.uniq(this._.concat(this._.map(auditors, 'aid'), this.ctx.change.uid));
|
|
|
+ const wechatData = {
|
|
|
+ type: 'project',
|
|
|
+ status: wxConst.status.stop,
|
|
|
+ tips: wxConst.tips.stop,
|
|
|
+ code: this.ctx.session.sessionProject.code,
|
|
|
+ c_name: this.ctx.change.name,
|
|
|
+ };
|
|
|
+ await this.ctx.helper.sendWechat(users, smsTypeConst.const.BG, smsTypeConst.judge.result.toString(), wxConst.template.change, wechatData);
|
|
|
await transaction.commit();
|
|
|
} catch (err) {
|
|
|
await transaction.rollback();
|