|
@ -1,10 +1,10 @@ |
|
|
'use strict'; |
|
|
'use strict'; |
|
|
|
|
|
const moment = require('moment') |
|
|
|
|
|
|
|
|
async function edit (ctx) { |
|
|
async function add (ctx) { |
|
|
try { |
|
|
try { |
|
|
const { models } = ctx.fs.dc; |
|
|
const { models } = ctx.fs.dc; |
|
|
const { |
|
|
const { |
|
|
memberId, |
|
|
|
|
|
pepUserId, idNumber, idPhoto, gender, birthday, nativePlace, marital, |
|
|
pepUserId, idNumber, idPhoto, gender, birthday, nativePlace, marital, |
|
|
politicsStatus, phoneNumber, workPlace, graduatedFrom, educationBackground, specialty, graduationDate, hiredate, turnProbationPeriod, regularDate, dimissionDate, experienceYear, occupationalHistory, vitae |
|
|
politicsStatus, phoneNumber, workPlace, graduatedFrom, educationBackground, specialty, graduationDate, hiredate, turnProbationPeriod, regularDate, dimissionDate, experienceYear, occupationalHistory, vitae |
|
|
} = ctx.request.body |
|
|
} = ctx.request.body |
|
@ -15,18 +15,19 @@ async function edit (ctx) { |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
if (existMemberRes && !memberId) { |
|
|
if (existMemberRes && !existMemberRes.del) { |
|
|
throw '当前人员信息已存在' |
|
|
throw '当前人员信息已存在' |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
let storageData = { |
|
|
let storageData = { |
|
|
pepUserId, idNumber, idPhoto, gender, birthday, nativePlace, marital, |
|
|
pepUserId, idNumber, idPhoto, gender, birthday, nativePlace, marital, |
|
|
politicsStatus, phoneNumber, workPlace, graduatedFrom, educationBackground, specialty, graduationDate, hiredate, turnProbationPeriod, regularDate, dimissionDate, experienceYear, occupationalHistory, vitae |
|
|
politicsStatus, phoneNumber, workPlace, graduatedFrom, educationBackground, specialty, graduationDate, hiredate, turnProbationPeriod, regularDate, dimissionDate, experienceYear, occupationalHistory, vitae, |
|
|
|
|
|
del: false |
|
|
} |
|
|
} |
|
|
if (memberId) { |
|
|
if (existMemberRes && existMemberRes.del) { |
|
|
await models.Member.update(storageData, { |
|
|
await models.Member.update(storageData, { |
|
|
where: { |
|
|
where: { |
|
|
id: memberId |
|
|
pepUserId, |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
} else { |
|
@ -43,6 +44,46 @@ async function edit (ctx) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function edit (ctx) { |
|
|
|
|
|
try { |
|
|
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
|
|
const { |
|
|
|
|
|
pepUserId, idNumber, idPhoto, gender, birthday, nativePlace, marital, |
|
|
|
|
|
politicsStatus, phoneNumber, workPlace, graduatedFrom, educationBackground, specialty, graduationDate, hiredate, turnProbationPeriod, regularDate, dimissionDate, experienceYear, occupationalHistory, vitae |
|
|
|
|
|
} = ctx.request.body |
|
|
|
|
|
|
|
|
|
|
|
const existMemberRes = await models.Member.findOne({ |
|
|
|
|
|
where: { |
|
|
|
|
|
pepUserId |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
if (!existMemberRes) { |
|
|
|
|
|
throw '当前人员信息不存在' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let storageData = { |
|
|
|
|
|
pepUserId, idNumber, idPhoto, gender, birthday, nativePlace, marital, |
|
|
|
|
|
politicsStatus, phoneNumber, workPlace, graduatedFrom, educationBackground, specialty, graduationDate, hiredate, turnProbationPeriod, regularDate, dimissionDate, experienceYear, occupationalHistory, vitae, |
|
|
|
|
|
del: false |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await models.Member.update(storageData, { |
|
|
|
|
|
where: { |
|
|
|
|
|
pepUserId: pepUserId |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
ctx.status = 204; |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: error`); |
|
|
|
|
|
ctx.status = 400; |
|
|
|
|
|
ctx.body = { |
|
|
|
|
|
message: typeof error == 'string' ? error : undefined |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
async function searchPepMember (ctx) { |
|
|
async function searchPepMember (ctx) { |
|
|
try { |
|
|
try { |
|
|
const { models } = ctx.fs.dc; |
|
|
const { models } = ctx.fs.dc; |
|
@ -109,7 +150,27 @@ async function searchPepMember (ctx) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function list (ctx) { |
|
|
|
|
|
try { |
|
|
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
|
|
const { clickHouse } = ctx.app.fs |
|
|
|
|
|
const { keywordTarget, keyword, limit, page } = ctx.query |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ctx.status = 200; |
|
|
|
|
|
ctx.body = [] |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: error`); |
|
|
|
|
|
ctx.status = 400; |
|
|
|
|
|
ctx.body = { |
|
|
|
|
|
message: typeof error == 'string' ? error : undefined |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
module.exports = { |
|
|
module.exports = { |
|
|
|
|
|
add, |
|
|
edit, |
|
|
edit, |
|
|
searchPepMember |
|
|
searchPepMember, |
|
|
|
|
|
list, |
|
|
}; |
|
|
}; |