feat: AIHR 智能人力资源管理系统初始提交

- 员工花名册管理(加密存储、导入导出)
- 薪酬管理(发薪批次、薪酬模版、加班费计算、工资条)
- 社保公积金(多城市配置、版本管理、基数调整)
- 解聘管理(6步流程、证据链、工作交接)
- AI 助手(合同审查、风险预测、RAG 知识库)
- Dashboard 仪表盘
- 设置与通知
This commit is contained in:
selfrelease
2026-07-24 13:53:11 +08:00
commit 0df8aa77d9
109 changed files with 38190 additions and 0 deletions
+63
View File
@@ -0,0 +1,63 @@
import { Router, Response, NextFunction } from 'express'
import prisma from '../lib/prisma'
import { authMiddleware, AuthRequest } from '../middleware/auth'
import { z } from 'zod'
const router = Router()
router.use(authMiddleware)
// 获取员工附件列表
router.get('/:employeeId', async (req: AuthRequest, res: Response, next: NextFunction) => {
try {
const attachments = await prisma.employeeAttachment.findMany({
where: { orgId: req.user!.orgId, employeeId: req.params.employeeId },
orderBy: { createdAt: 'desc' },
})
res.json({ success: true, data: attachments })
} catch (err) {
next(err)
}
})
// 添加附件记录(文件URL由前端上传后传入)
const attachmentSchema = z.object({
employeeId: z.string().min(1),
fileName: z.string().min(1),
fileType: z.enum(['ID_CARD', 'BANK_CARD', 'CONTRACT_SCAN', 'EDUCATION', 'OTHER']),
fileUrl: z.string().min(1),
fileSize: z.number().int().default(0),
})
router.post('/', async (req: AuthRequest, res: Response, next: NextFunction) => {
try {
const data = attachmentSchema.parse(req.body)
const attachment = await prisma.employeeAttachment.create({
data: {
orgId: req.user!.orgId,
...data,
uploadedBy: req.user!.id,
},
})
res.json({ success: true, data: attachment })
} catch (err) {
next(err)
}
})
// 删除附件
router.delete('/:id', async (req: AuthRequest, res: Response, next: NextFunction) => {
try {
const attachment = await prisma.employeeAttachment.findFirst({
where: { id: req.params.id, orgId: req.user!.orgId },
})
if (!attachment) {
return res.status(404).json({ success: false, error: { code: 'NOT_FOUND', message: '附件不存在' } })
}
await prisma.employeeAttachment.delete({ where: { id: attachment.id } })
res.json({ success: true })
} catch (err) {
next(err)
}
})
export default router