|
@@ -492,13 +492,11 @@ module.exports = app => {
|
|
|
async addAuditor(cid, auditorId, times = 1, is_gdzs = 0) {
|
|
|
const transaction = await this.db.beginTransaction();
|
|
|
try {
|
|
|
- const auditList = await this.getAllDataByCondition({ where: { cid, times } });
|
|
|
- const idList = this._.map(auditList, 'uid');
|
|
|
- let newOrder = idList.length + 1;
|
|
|
+ let newOrder = await transaction.count(this.tableName, { cid, times });
|
|
|
let uSort = await transaction.count(this.tableName, { cid });
|
|
|
// 判断是否存在固定终审,存在则newOrder - 1并使终审order+1
|
|
|
newOrder = is_gdzs === 1 ? newOrder - 1 : newOrder;
|
|
|
- uSort = is_gdzs === 1 ? uSort : uSort + 1;
|
|
|
+ uSort = is_gdzs === 1 ? uSort - 1 : uSort;
|
|
|
if (is_gdzs) await this._syncOrderByDelete(transaction, cid, newOrder, uSort, times, '+');
|
|
|
const userInfo = await this.ctx.service.projectAccount.getDataById(auditorId);
|
|
|
const newAuditor = {
|