Browse Source

人员编码

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

16
api/.vscode/launch.json

@ -28,9 +28,9 @@
// "--qndmn http://resources.anxinyun.cn",
"--qndmn http://rjkwed13l.hn-bkt.clouddn.com",
// click
"--clickHouseUrl http://10.8.30.71",
// "--clickHouseUrl http://10.8.30.71",
// click
// "--clickHouseUrl http://10.8.30.161",
"--clickHouseUrl http://10.8.30.161",
// "--clickHouseUrl https://clickhouse01.anxinyun.cn/play",
"--clickHousePort 30123",
@ -39,14 +39,14 @@
// "--clickHousePassword ",
//
"--clickHousePepEmis pepca10",
"--clickHouseCamworkflow camworkflow",
"--clickHouseHr hr_dev",
//
// "--clickHousePepEmis pepca8",
// "--clickHousePepEmis pepca10",
// "--clickHouseCamworkflow camworkflow",
// "--clickHouseHr hr_dev",
//
"--clickHousePepEmis pepca8",
"--clickHouseCamworkflow camworkflow",
"--clickHouseHr hr_dev",
]
},
{

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

@ -89,17 +89,21 @@ async function searchPepMember (ctx) {
try {
const { models } = ctx.fs.dc;
const { clickHouse } = ctx.app.fs
const { keyword } = ctx.query
const { keyword, code } = ctx.query
let whereOption = []
if (keyword) {
whereOption.push(`user.id = ${keyword}`)
whereOption.push(`user.name LIKE '${keyword}'`)
// whereOption.push(`user.id = ${keyword}`)
// whereOption.push(`user.name LIKE '${keyword}'`)
}
if (code) {
whereOption.push(`user.people_code = '${code}'`)
}
const userRes = await clickHouse.pepEmis.query(`
SELECT
user.id AS pepUserId,
user.people_code AS userCode,
user.name AS userName,
role.name AS roleName,
role.id AS roleId,
@ -115,7 +119,10 @@ async function searchPepMember (ctx) {
ON department_user.user = user.id
LEFT JOIN department
ON department.id = department_user.department
${whereOption.length ? `WHERE ${whereOption.join(' OR ')}` : ''}
WHERE
user.delete = 0
${whereOption.length ? `AND ${whereOption.join(' OR ')}` : ''}
`).toPromise()
let returnD = []
@ -138,6 +145,7 @@ async function searchPepMember (ctx) {
returnD.push({
pepUserId: u.pepUserId,
name: u.userName,
userCode: u.userCode,
departmrnt: u.depId ? [{
id: u.depId,
name: u.depName

15
api/app/lib/utils/member.js

@ -13,6 +13,7 @@ module.exports = function (app, opts) {
const nowTime = moment()
let whereOption = []
let whereFromSelectOption = []
let returnEmpty = false
if (state == 'inOffice') {
// 在岗
const holidayJudge = await judgeHoliday(curDay)
@ -25,10 +26,10 @@ module.exports = function (app, opts) {
// 在工作日的工作时间范围 无请假记录
whereFromSelectOption.push(`vacateStartTime = '1970-01-01 00:00:00.000000'`)
} else {
return []
returnEmpty = true
}
} else {
return []
returnEmpty = true
}
}
if (state == 'dayoff') {
@ -41,10 +42,16 @@ module.exports = function (app, opts) {
// 在休息日范围内且无加班申请
whereFromSelectOption.push(`overtimeStartTime = '1970-01-01 00:00:00.000000'`)
} else {
return []
returnEmpty = true
}
} else {
return []
returnEmpty = true
}
}
if (returnEmpty) {
return {
count: 0,
rows: []
}
}

Loading…
Cancel
Save