|
|
@ -52,16 +52,39 @@ async function pomsProject (ctx) { |
|
|
|
|
|
|
|
let pepProjectIds = new Set() |
|
|
|
let anxinProjectIds = new Set() |
|
|
|
let createUsers = new Set() |
|
|
|
for (let p of proRes.rows) { |
|
|
|
if (p.pepProjectId) { |
|
|
|
pepProjectIds.add(p.pepProjectId) |
|
|
|
} |
|
|
|
if(p.createUser){ |
|
|
|
createUsers.add(p.createUser) |
|
|
|
} |
|
|
|
for (let ap of p.anxinProjectId) { |
|
|
|
if (ap) { |
|
|
|
anxinProjectIds.add(ap) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const pomsUser = await models.User.findAll({ |
|
|
|
where: { |
|
|
|
id: { $in: [...createUsers]} |
|
|
|
} |
|
|
|
}) |
|
|
|
let pepUserIds = new Set() |
|
|
|
for (let p of pomsUser) { |
|
|
|
if (p.pepUserId) { |
|
|
|
pepUserIds.add(p.pepUserId) |
|
|
|
} |
|
|
|
} |
|
|
|
const pepcaUser = pepUserIds.size ? |
|
|
|
await clickHouse.pepEmis.query( |
|
|
|
` |
|
|
|
SELECT * FROM user |
|
|
|
WHERE id IN (${[...pepUserIds].join(',')}, -1) |
|
|
|
` |
|
|
|
).toPromise() : |
|
|
|
[] |
|
|
|
const pepProjectRes = pepProjectIds.size ? |
|
|
|
await clickHouse.projectManage.query( |
|
|
|
` |
|
|
@ -89,6 +112,7 @@ async function pomsProject (ctx) { |
|
|
|
|
|
|
|
for (let p of proRes.rows) { |
|
|
|
const corPro = pepProjectRes.find(pp => pp.id == p.pepProjectId) || {} |
|
|
|
const pepUserName = (pepcaUser.find(qq => qq.id == (pomsUser.find(oo => oo.id == p.createUser)||{}).pepUserId)||{}).name ||'' |
|
|
|
p.dataValues.pepProjectName = corPro.project_name |
|
|
|
p.dataValues.pepProjectIsDelete = corPro.isdelete |
|
|
|
p.dataValues.constructionStatusId = corPro.construction_status_id |
|
|
@ -96,6 +120,7 @@ async function pomsProject (ctx) { |
|
|
|
|
|
|
|
let nextAnxinProject = anxinProjectRes.filter(ap => p.anxinProjectId.includes(ap.id)) |
|
|
|
p.dataValues.anxinProject = nextAnxinProject |
|
|
|
p.dataValues.pepUserName = pepUserName |
|
|
|
delete p.dataValues.anxinProjectId |
|
|
|
} |
|
|
|
ctx.status = 200; |
|
|
|