From 772edd26282864e119665deffd96f644538a6714 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Mon, 17 Oct 2022 14:33:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/member/index.js | 20 ++++++++++++++++++++ api/app/lib/utils/member.js | 6 +++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/api/app/lib/controllers/member/index.js b/api/app/lib/controllers/member/index.js index cbeb712..25eed4a 100644 --- a/api/app/lib/controllers/member/index.js +++ b/api/app/lib/controllers/member/index.js @@ -190,6 +190,22 @@ async function list (ctx) { const { judgeHoliday, memberList } = ctx.app.fs.utils const { keywordTarget, keyword, limit, page, state } = ctx.query + const curDay = moment().format('YYYY-MM-DD') + const nowTime = moment() + const holidayJudge = await judgeHoliday(curDay) + let workTime = false + let dayoffTime = false + if (holidayJudge) { + if ( + holidayJudge.workday + && nowTime.isAfter(moment(curDay + ' 08:30')) + && nowTime.isBefore(moment(curDay + ' 17:30')) + ) { + workTime = true + } else if (holidayJudge.dayoff || holidayJudge.festivals) { + dayoffTime = true + } + } const userRes = await memberList({ keywordTarget, keyword, limit, page, state }) let returnD = [] @@ -233,6 +249,10 @@ async function list (ctx) { id: u.roleId, name: u.roleName }] : [], + state: obj['dimissionDate'] ? 'dimission' : + obj['vacateStartTime'] ? 'vacate' : + workTime ? 'inOffice' : + dayoffTime ? 'dayoff' : 'rest', del: undefined, pepuserid: undefined, }) diff --git a/api/app/lib/utils/member.js b/api/app/lib/utils/member.js index 48dc307..b3844d0 100644 --- a/api/app/lib/utils/member.js +++ b/api/app/lib/utils/member.js @@ -23,7 +23,7 @@ module.exports = function (app, opts) { && nowTime.isBefore(moment(curDay + ' 17:30')) ) { // 在工作日的工作时间范围 无请假记录 - whereFromSelectOption.push(`vacateStartTime IS NULL`) + whereFromSelectOption.push(`vacateStartTime = '1970-01-01 00:00:00.000000'`) } else { return [] } @@ -39,7 +39,7 @@ module.exports = function (app, opts) { holidayJudge.dayoff || holidayJudge.festivals ) { // 在休息日范围内且无加班申请 - whereFromSelectOption.push(`overtimeStartTime IS NULL`) + whereFromSelectOption.push(`overtimeStartTime = '1970-01-01 00:00:00.000000'`) } else { return [] } @@ -88,7 +88,7 @@ module.exports = function (app, opts) { LEFT JOIN ( SELECT pep_user_id, - any(start_time) AS overtimeStartTime, + any(toString(start_time)) AS overtimeStartTime, any(end_time) AS overtimeEndTime FROM overtime WHERE