|
@@ -105,7 +105,7 @@ module.exports = app => {
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
- async createRoleRelationship(tender_id, rpt_id, sid, relArr) {
|
|
|
|
|
|
+ async createRoleRelationship(tender_id, rpt_id, sid, business_id, source_type, relArr) {
|
|
let rst = null;
|
|
let rst = null;
|
|
this.transaction = await this.db.beginTransaction();
|
|
this.transaction = await this.db.beginTransaction();
|
|
try {
|
|
try {
|
|
@@ -113,6 +113,8 @@ module.exports = app => {
|
|
tender_id,
|
|
tender_id,
|
|
rpt_id,
|
|
rpt_id,
|
|
sid,
|
|
sid,
|
|
|
|
+ business_id,
|
|
|
|
+ source_type,
|
|
rel_content: JSON.stringify(relArr),
|
|
rel_content: JSON.stringify(relArr),
|
|
};
|
|
};
|
|
// console.log(data);
|
|
// console.log(data);
|
|
@@ -145,20 +147,19 @@ module.exports = app => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // rst.push(await this.createRoleRelationship(tender_id, rptRoleRel.rpt_id, stage.id, newRelList));
|
|
|
|
- await this.createRoleRelationship(tender_id, rptRoleRel.rpt_id, stage.id, newRelList); // 暂时用不到,就先不返回结果
|
|
|
|
|
|
+ await this.createRoleRelationship(tender_id, rptRoleRel.rpt_id, stage.id, '', 'tender', newRelList); // 暂时用不到,就先不返回结果
|
|
}
|
|
}
|
|
return rst;
|
|
return rst;
|
|
}
|
|
}
|
|
|
|
|
|
- async updateRoleRelationship(id, tender_id, rpt_id, sid, relArr) {
|
|
|
|
|
|
+ async updateRoleRelationship(id, tender_id, rpt_id, sid, business_id, source_type, relArr) {
|
|
let rst = null;
|
|
let rst = null;
|
|
if (id < 0) {
|
|
if (id < 0) {
|
|
- rst = await this.createRoleRelationship(tender_id, rpt_id, sid, relArr);
|
|
|
|
|
|
+ rst = await this.createRoleRelationship(tender_id, rpt_id, sid, business_id, source_type, relArr);
|
|
} else {
|
|
} else {
|
|
this.transaction = await this.db.beginTransaction();
|
|
this.transaction = await this.db.beginTransaction();
|
|
try {
|
|
try {
|
|
- const data = { id, tender_id, rpt_id, sid, rel_content: JSON.stringify(relArr) };
|
|
|
|
|
|
+ const data = { id, tender_id, rpt_id, sid, business_id, source_type, rel_content: JSON.stringify(relArr) };
|
|
rst = await this.transaction.update(this.tableName, data);
|
|
rst = await this.transaction.update(this.tableName, data);
|
|
await this.transaction.commit();
|
|
await this.transaction.commit();
|
|
} catch (ex) {
|
|
} catch (ex) {
|
|
@@ -170,7 +171,7 @@ module.exports = app => {
|
|
return rst;
|
|
return rst;
|
|
}
|
|
}
|
|
|
|
|
|
- async updateMultiRoleRelationship(orgParams, newRelArr) {
|
|
|
|
|
|
+ async updateMultiRoleRelationship(orgParams, bzId, srcKey, newRelArr) {
|
|
for (let idx = 0; idx < orgParams.length; idx++) {
|
|
for (let idx = 0; idx < orgParams.length; idx++) {
|
|
const param = orgParams[idx];
|
|
const param = orgParams[idx];
|
|
const data = { tender_id: param[0], sid: param[1], rpt_id: param[2] };
|
|
const data = { tender_id: param[0], sid: param[1], rpt_id: param[2] };
|
|
@@ -178,7 +179,7 @@ module.exports = app => {
|
|
try {
|
|
try {
|
|
await this.transaction.delete(this.tableName, data);
|
|
await this.transaction.delete(this.tableName, data);
|
|
this.transaction.commit();
|
|
this.transaction.commit();
|
|
- await this.createRoleRelationship(param[0], param[2], param[1], newRelArr);
|
|
|
|
|
|
+ await this.createRoleRelationship(param[0], param[2], param[1], bzId, srcKey, newRelArr);
|
|
} catch (ex) {
|
|
} catch (ex) {
|
|
console.log(ex.toString());
|
|
console.log(ex.toString());
|
|
// 回滚
|
|
// 回滚
|
|
@@ -189,7 +190,7 @@ module.exports = app => {
|
|
}
|
|
}
|
|
|
|
|
|
async checkSignDate(transaction, stage, curAudit, time) {
|
|
async checkSignDate(transaction, stage, curAudit, time) {
|
|
- const rptRole = await this.getAllDataByCondition({ where: { sid: stage.id }});
|
|
|
|
|
|
+ const rptRole = await this.getAllDataByCondition({ where: { sid: stage.id } });
|
|
const period = stage.period.split(' ~ ');
|
|
const period = stage.period.split(' ~ ');
|
|
|
|
|
|
const updateData = [];
|
|
const updateData = [];
|
|
@@ -211,7 +212,7 @@ module.exports = app => {
|
|
bChange = true;
|
|
bChange = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (bChange) updateData.push({ id: rc.id, rel_content: JSON.stringify(roleContent)});
|
|
|
|
|
|
+ if (bChange) updateData.push({ id: rc.id, rel_content: JSON.stringify(roleContent) });
|
|
}
|
|
}
|
|
if (updateData.length > 0) await transaction.updateRows(this.tableName, updateData);
|
|
if (updateData.length > 0) await transaction.updateRows(this.tableName, updateData);
|
|
}
|
|
}
|