|
|
@ -198,12 +198,39 @@ async function nativePlaceList (ctx) { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
|
|
|
|
const nRes = await models.Member.findAll({ |
|
|
|
attributes: [''], |
|
|
|
group: '' |
|
|
|
attributes: ['nativePlace'], |
|
|
|
group: 'nativePlace', |
|
|
|
where: { |
|
|
|
nativePlace: { $ne: null } |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
ctx.status = 200; |
|
|
|
ctx.body = [] |
|
|
|
ctx.body = nRes |
|
|
|
} catch (error) { |
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: error`); |
|
|
|
ctx.status = 400; |
|
|
|
ctx.body = { |
|
|
|
message: typeof error == 'string' ? error : undefined |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function workPlaceList (ctx) { |
|
|
|
// 获取已有的工作地列表
|
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
|
|
|
|
const wRes = await models.Member.findAll({ |
|
|
|
attributes: ['workPlace'], |
|
|
|
group: 'workPlace', |
|
|
|
where: { |
|
|
|
workPlace: { $ne: null } |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
ctx.status = 200; |
|
|
|
ctx.body = wRes |
|
|
|
} catch (error) { |
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: error`); |
|
|
|
ctx.status = 400; |
|
|
@ -217,7 +244,10 @@ async function list (ctx) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
const { judgeHoliday, memberList } = ctx.app.fs.utils |
|
|
|
const { keywordTarget, keyword, limit, page, state } = ctx.query |
|
|
|
const { |
|
|
|
keywordTarget, keyword, limit, page, state, |
|
|
|
|
|
|
|
} = ctx.query |
|
|
|
|
|
|
|
const curDay = moment().format('YYYY-MM-DD') |
|
|
|
const nowTime = moment() |
|
|
@ -366,6 +396,10 @@ async function overTimeStatistics (ctx) { |
|
|
|
INNER JOIN overtime |
|
|
|
ON overtime.id = overtime_day.overtime_id |
|
|
|
AND overtime.pep_user_id = ${pepUserId} |
|
|
|
${startDate && endDate ? ` |
|
|
|
WHERE overtime_day.day >= '${moment(startDate).format('YYYY-MM-DD')}' |
|
|
|
AND overtime_day.day <= '${moment(endDate).format('YYYY-MM-DD')}' |
|
|
|
` : ''}
|
|
|
|
GROUP BY overtime_day.day, overtime.compensate |
|
|
|
`).toPromise()
|
|
|
|
|
|
|
@ -436,6 +470,10 @@ async function vacateStatistics (ctx) { |
|
|
|
INNER JOIN vacate |
|
|
|
ON vacate.id = vacate_day.vacate_id |
|
|
|
AND vacate.pep_user_id = ${pepUserId} |
|
|
|
${startDate && endDate ? ` |
|
|
|
WHERE vacate_day.day >= '${moment(startDate).format('YYYY-MM-DD')}' |
|
|
|
AND vacate_day.day <= '${moment(endDate).format('YYYY-MM-DD')}' |
|
|
|
` : ''}
|
|
|
|
GROUP BY vacate_day.day |
|
|
|
`).toPromise()
|
|
|
|
|
|
|
@ -679,5 +717,7 @@ module.exports = { |
|
|
|
overTimeStatistics, |
|
|
|
vacateStatistics, |
|
|
|
exportData, |
|
|
|
addMembersBulk |
|
|
|
addMembersBulk, |
|
|
|
nativePlaceList, |
|
|
|
workPlaceList, |
|
|
|
} |