|
|
@ -2,7 +2,7 @@ |
|
|
|
const moment = require('moment') |
|
|
|
const fs = require('fs'); |
|
|
|
|
|
|
|
async function add (ctx) { |
|
|
|
async function add(ctx) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
const { |
|
|
@ -45,7 +45,7 @@ async function add (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function edit (ctx) { |
|
|
|
async function edit(ctx) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
const { |
|
|
@ -85,7 +85,7 @@ async function edit (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function searchPepMember (ctx) { |
|
|
|
async function searchPepMember(ctx) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
const { clickHouse } = ctx.app.fs |
|
|
@ -116,12 +116,12 @@ async function searchPepMember (ctx) { |
|
|
|
ON user_role.user = user.id |
|
|
|
LEFT JOIN role |
|
|
|
ON role.id = user_role.role |
|
|
|
LEFT JOIN basicdata_post |
|
|
|
ON basicdata_post.id = user.post |
|
|
|
LEFT JOIN department_user |
|
|
|
ON department_user.user = user.id |
|
|
|
LEFT JOIN department |
|
|
|
ON department.id = department_user.department |
|
|
|
LEFT JOIN basicdata_post |
|
|
|
ON basicdata_post.id = user.post |
|
|
|
ON department.id = department_user.department |
|
|
|
WHERE |
|
|
|
user.delete = '0' |
|
|
|
${whereOption.length ? `AND ${whereOption.join(' OR ')}` : ''} |
|
|
@ -149,6 +149,7 @@ async function searchPepMember (ctx) { |
|
|
|
pepUserId: u.pepUserId, |
|
|
|
name: u.userName, |
|
|
|
userCode: u.userCode, |
|
|
|
userPost: u.userPost, |
|
|
|
departmrnt: u.depId ? [{ |
|
|
|
id: u.depId, |
|
|
|
name: u.depName |
|
|
@ -156,8 +157,7 @@ async function searchPepMember (ctx) { |
|
|
|
role: u.roleId ? [{ |
|
|
|
id: u.roleId, |
|
|
|
name: u.roleName |
|
|
|
}] : [], |
|
|
|
userPost:u.userPost |
|
|
|
}] : [] |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
@ -173,7 +173,7 @@ async function searchPepMember (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function del (ctx) { |
|
|
|
async function del(ctx) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
const { pepUserId } = ctx.query |
|
|
@ -185,7 +185,13 @@ async function del (ctx) { |
|
|
|
pepUserId, |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
await models.SalesDistribution.update({//顺便把销售人员删了
|
|
|
|
del: true, |
|
|
|
}, { |
|
|
|
where: { |
|
|
|
pepUserId, |
|
|
|
} |
|
|
|
}) |
|
|
|
ctx.status = 204; |
|
|
|
} catch (error) { |
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|
|
@ -196,7 +202,7 @@ async function del (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function nativePlaceList (ctx) { |
|
|
|
async function nativePlaceList(ctx) { |
|
|
|
// 获取已有的户籍地列表
|
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
@ -220,7 +226,7 @@ async function nativePlaceList (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function workPlaceList (ctx) { |
|
|
|
async function workPlaceList(ctx) { |
|
|
|
// 获取已有的工作地列表
|
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
@ -244,7 +250,7 @@ async function workPlaceList (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function maritalList (ctx) { |
|
|
|
async function maritalList(ctx) { |
|
|
|
// 获取已有的婚育状况列表
|
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
@ -268,7 +274,7 @@ async function maritalList (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function list (ctx) { |
|
|
|
async function list(ctx) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
const { judgeHoliday, memberList, packageUserData } = ctx.app.fs.utils |
|
|
@ -303,7 +309,7 @@ async function list (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function overTimeStatistics (ctx) { |
|
|
|
async function overTimeStatistics(ctx) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
const { clickHouse } = ctx.app.fs |
|
|
@ -379,7 +385,7 @@ async function overTimeStatistics (ctx) { |
|
|
|
let returnD = { |
|
|
|
...(statisticRes.length ? statisticRes[0] : {}), |
|
|
|
data: dataRes, |
|
|
|
dayStatisticData: statisticDayRes.sort((a,b)=>moment(a.day)-moment(b.day)) |
|
|
|
dayStatisticData: statisticDayRes.sort((a, b) => moment(a.day) - moment(b.day)) |
|
|
|
} |
|
|
|
ctx.status = 200; |
|
|
|
ctx.body = returnD |
|
|
@ -392,7 +398,7 @@ async function overTimeStatistics (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function vacateStatistics (ctx) { |
|
|
|
async function vacateStatistics(ctx) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
const { clickHouse } = ctx.app.fs |
|
|
@ -469,7 +475,7 @@ async function vacateStatistics (ctx) { |
|
|
|
let returnD = { |
|
|
|
statistic: statisticRes, |
|
|
|
data: dataRes, |
|
|
|
dayStatisticData: statisticDayRes.sort((a,b)=>moment(a.day)-moment(b.day)) |
|
|
|
dayStatisticData: statisticDayRes.sort((a, b) => moment(a.day) - moment(b.day)) |
|
|
|
} |
|
|
|
ctx.status = 200; |
|
|
|
ctx.body = returnD |
|
|
@ -482,7 +488,7 @@ async function vacateStatistics (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function exportData (ctx) { |
|
|
|
async function exportData(ctx) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
const { clickHouse, opts: { qiniu } } = ctx.app.fs |
|
|
@ -627,7 +633,7 @@ async function exportData (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function addMembersBulk (ctx) { |
|
|
|
async function addMembersBulk(ctx) { |
|
|
|
let errorMsg = { message: '导入员工信息失败' }; |
|
|
|
const transaction = await ctx.fs.dc.orm.transaction(); |
|
|
|
try { |
|
|
|