Browse Source

fix 档案和信息请假时间不一

master
巴林闲侠 2 years ago
parent
commit
0459671606
  1. 12
      api/.vscode/launch.json
  2. 16
      api/app/lib/controllers/member/index.js

12
api/.vscode/launch.json

@ -27,26 +27,24 @@
"--qnbkt dev-hr", "--qnbkt dev-hr",
// "--qndmn http://resources.anxinyun.cn", // "--qndmn http://resources.anxinyun.cn",
"--qndmn http://rjkwed13l.hn-bkt.clouddn.com", "--qndmn http://rjkwed13l.hn-bkt.clouddn.com",
// click
"--clickHouseUrl http://10.8.30.71",
// click
// "--clickHouseUrl http://10.8.30.161",
// "--clickHouseUrl https://clickhouse01.anxinyun.cn/play",
"--clickHousePort 30123",
// * 2 // * 2
// "--clickHouseUser ", // "--clickHouseUser ",
// "--clickHousePassword ", // "--clickHousePassword ",
"--clickHousePort 30123",
// //
"--clickHouseUrl http://10.8.30.71",
"--clickHousePepEmis pepca_dev", "--clickHousePepEmis pepca_dev",
"--clickHouseCamworkflow camworkflow", "--clickHouseCamworkflow camworkflow",
"--clickHouseHr hr_dev", "--clickHouseHr hr_dev",
// //
// "--clickHouseUrl http://10.8.30.161",
// "--clickHousePepEmis pepca8", // "--clickHousePepEmis pepca8",
// "--clickHouseCamworkflow camworkflow", // "--clickHouseCamworkflow camworkflow",
// "--clickHouseHr hr_dev", // "--clickHouseHr hrm",
] ]
}, },
{ {

16
api/app/lib/controllers/member/index.js

@ -397,13 +397,23 @@ async function vacateStatistics (ctx) {
const timeOption = [] const timeOption = []
if (startDate) { if (startDate) {
// 按发起时间
// timeOption.push(
// `wpStory.create_at >= '${moment(startDate).startOf('day').format('YYYY-MM-DD HH:mm:ss')}'`
// )
// 按请假开始时间
timeOption.push( timeOption.push(
`wpStory.create_at > '${moment(startDate).startOf('day').format('YYYY-MM-DD HH:mm:ss')}'` `start_time >= '${moment(startDate).startOf('day').format('YYYY-MM-DD HH:mm:ss')}'`
) )
} }
if (endDate) { if (endDate) {
// timeOption.push(
// `wpStory.create_at <= '${moment(endDate).endOf('day').format('YYYY-MM-DD HH:mm:ss')}'`
// )
timeOption.push( timeOption.push(
`wpStory.create_at <= '${moment(endDate).endOf('day').format('YYYY-MM-DD HH:mm:ss')}'` `start_time <= '${moment(endDate).endOf('day').format('YYYY-MM-DD HH:mm:ss')}'`
) )
} }
const dataRes = await clickHouse.hr.query(` const dataRes = await clickHouse.hr.query(`
@ -419,8 +429,8 @@ async function vacateStatistics (ctx) {
vacate vacate
INNER JOIN ${pepEmis}.workflow_process_history AS wpStory INNER JOIN ${pepEmis}.workflow_process_history AS wpStory
ON wpStory.id = vacate.pep_process_story_id ON wpStory.id = vacate.pep_process_story_id
${timeOption.length ? `AND ${timeOption.join(' AND ')}` : ''}
WHERE vacate.pep_user_id = ${pepUserId} WHERE vacate.pep_user_id = ${pepUserId}
${timeOption.length ? `AND ${timeOption.join(' AND ')}` : ''}
`).toPromise() `).toPromise()
const statisticRes = await clickHouse.hr.query(` const statisticRes = await clickHouse.hr.query(`

Loading…
Cancel
Save