diff --git a/admin/mock/salary.js b/admin/mock/salary.js new file mode 100644 index 00000000..90f61ff9 --- /dev/null +++ b/admin/mock/salary.js @@ -0,0 +1,167 @@ +import Mock from 'mockjs' + +// 工资条列表Mock +Mock.mock(/\/adminapi\/salary\/payroll\/list/, 'get', { + code: 1, + msg: '操作成功', + data: { + 'list|10': [{ + 'id|+1': 1, + 'staff_id|1-100': 1, + 'staff_name': '@cname', + 'campus_name|1': ['海淀校区', '朝阳校区', '丰台校区'], + 'salary_month': '2025-01', + 'base_salary|3000-8000.2': 5000, + 'full_attendance_days|20-24': 22, + 'attendance|15-22.1': 20, + 'work_salary|2000-7000.2': 4545.45, + 'mgr_performance|0-1000.2': 500, + 'performance_bonus|0-2000.2': 1000, + 'other_subsidies|0-500.2': 200, + 'deductions|0-200.2': 0, + 'gross_salary|4000-10000.2': 6245.45, + 'social_security|500-1200.2': 800, + 'individual_income_tax|0-500.2': 125, + 'net_salary|3000-9000.2': 5320.45, + 'status|0-2': 1, + 'created_at': '@datetime' + }], + total: 156, + page: 1, + limit: 10 + } +}) + +// 工资条详情Mock +Mock.mock(/\/adminapi\/salary\/payroll\/info/, 'get', { + code: 1, + msg: '操作成功', + data: { + id: '@id', + staff_id: '@integer(1, 100)', + staff_name: '@cname', + campus_name: '海淀校区', + salary_month: '2025-01', + base_salary: 6000.00, + full_attendance_days: 22, + attendance: 20.5, + work_salary: 5590.91, + mgr_performance: 800.00, + performance_bonus: 1200.00, + other_subsidies: 300.00, + deductions: 100.00, + gross_salary: 7790.91, + social_security: 960.00, + individual_income_tax: 285.00, + net_salary: 6545.91, + status: 1, + remarks: '本月表现优秀,给予额外奖励', + created_at: '@datetime', + updated_at: '@datetime' + } +}) + +// 创建工资条Mock +Mock.mock(/\/adminapi\/salary\/payroll\/add/, 'post', { + code: 1, + msg: '添加成功', + data: { + id: '@id' + } +}) + +// 更新工资条Mock +Mock.mock(/\/adminapi\/salary\/payroll\/edit/, 'post', { + code: 1, + msg: '更新成功', + data: null +}) + +// 删除工资条Mock +Mock.mock(/\/adminapi\/salary\/payroll\/delete/, 'post', { + code: 1, + msg: '删除成功', + data: null +}) + +// 导入工资条Mock +Mock.mock(/\/adminapi\/salary\/payroll\/import/, 'post', { + code: 1, + msg: '导入成功', + data: { + success_count: 25, + error_count: 2, + error_list: [ + { row: 3, error: '员工不存在' }, + { row: 8, error: '校区信息错误' } + ] + } +}) + +// 导出工资条Mock +Mock.mock(/\/adminapi\/salary\/payroll\/export/, 'get', { + code: 1, + msg: '导出成功', + data: 'blob_data_here' +}) + +// 统计摘要Mock +Mock.mock(/\/adminapi\/salary\/statistics\/summary/, 'get', { + code: 1, + msg: '操作成功', + data: { + total_staff: 65, + total_amount: 445480.70, + average_salary: 6853.55, + cost_rate: 78.5 + } +}) + +// 趋势数据Mock +Mock.mock(/\/adminapi\/salary\/statistics\/trend/, 'get', { + code: 1, + msg: '操作成功', + data: { + 'months|12': [{ + 'month': '@date("yyyy-MM")', + 'total_amount|30000-50000.2': 40000, + 'average_salary|6000-8000.2': 7000, + 'staff_count|50-80': 65 + }] + } +}) + +// 员工列表Mock +Mock.mock(/\/adminapi\/personnel\/list/, 'get', { + code: 1, + msg: '操作成功', + data: { + 'list|50': [{ + 'id|+1': 1, + 'name': '@cname', + 'campus_id|1-3': 1, + 'campus_name|1': ['海淀校区', '朝阳校区', '丰台校区'], + 'department': '@ctitle(2, 4)', + 'position': '@ctitle(3, 6)', + 'status|0-1': 1 + }] + } +}) + +// 校区列表Mock +Mock.mock(/\/adminapi\/campus\/list/, 'get', { + code: 1, + msg: '操作成功', + data: { + 'list|5': [{ + 'id|+1': 1, + 'name|1': ['海淀校区', '朝阳校区', '丰台校区', '昌平校区', '大兴校区'], + 'address': '@county(true)', + 'manager': '@cname', + 'phone': /^1[3-9]\d{9}$/, + 'status|0-1': 1 + }] + } +}) + +export default {} \ No newline at end of file diff --git a/admin/src/app/api/salary.ts b/admin/src/app/api/salary.ts index 5a942e1d..46359e1f 100644 --- a/admin/src/app/api/salary.ts +++ b/admin/src/app/api/salary.ts @@ -1,71 +1,132 @@ import request from '@/utils/request' +// 工资条数据类型 +export interface SalaryItem { + id: number + staff_id: number + staff_name: string + campus_name: string + salary_month: string + base_salary: number + full_attendance_days: number + attendance: number + work_salary: number + mgr_performance: number + performance_bonus: number + other_subsidies: number + deductions: number + gross_salary: number + social_security: number + individual_income_tax: number + net_salary: number + status: number + created_at: string +} +// 表单数据类型 +export interface SalaryFormData { + staff_id?: number + campus_id?: number + salary_month?: string + base_salary: number + full_attendance_days: number + attendance: number + mgr_performance: number + performance_bonus: number + other_subsidies: number + deductions: number + social_security: number + individual_income_tax: number + remarks?: string +} +// 查询参数类型 +export interface QueryParams { + page: number + limit: number + campus_id?: number + salary_month?: string + staff_name?: string + status?: number +} +// 统计数据类型 +export interface StatisticsSummary { + total_staff: number + total_amount: number + average_salary: number + cost_rate: number +} +// 工资计算逻辑函数 +export const calculateWorkSalary = (baseSalary: number, fullDays: number, attendance: number): number => { + if (!baseSalary || !fullDays) return 0 + return Number(((baseSalary / fullDays) * attendance).toFixed(2)) +} +export const calculateGrossSalary = (workSalary: number, mgr: number, bonus: number, subsidies: number, deductions: number): number => { + return Number((workSalary + mgr + bonus + subsidies - deductions).toFixed(2)) +} +export const calculateNetSalary = (grossSalary: number, socialSecurity: number, tax: number): number => { + return Number((grossSalary - socialSecurity - tax).toFixed(2)) +} - -// USER_CODE_BEGIN -- salary -/** - * 获取工资列表 - * @param params - * @returns - */ -export function getSalaryList(params: Record) { - return request.get(`salary/salary`, {params}) +// 工资条列表 +export const getSalaryList = (params: QueryParams) => { + return request.get('/adminapi/salary/payroll/list', { params }) } -/** - * 获取工资详情 - * @param id 工资id - * @returns - */ -export function getSalaryInfo(id: number) { - return request.get(`salary/salary/${id}`); +// 创建工资条 +export const createSalary = (data: SalaryFormData) => { + return request.post('/adminapi/salary/payroll/add', data) } -/** - * 添加工资 - * @param params - * @returns - */ -export function addSalary(params: Record) { - return request.post('salary/salary', params, { showErrorMessage: true, showSuccessMessage: true }) +// 更新工资条 +export const updateSalary = (data: SalaryFormData & { id: number }) => { + return request.post('/adminapi/salary/payroll/edit', data) } -/** - * 编辑工资 - * @param id - * @param params - * @returns - */ -export function editSalary(params: Record) { - return request.put(`salary/salary/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true }) +// 删除工资条 +export const deleteSalary = (id: number) => { + return request.post('/adminapi/salary/payroll/delete', { id }) } -/** - * 删除工资 - * @param id - * @returns - */ -export function deleteSalary(id: number) { - return request.delete(`salary/salary/${id}`, { showErrorMessage: true, showSuccessMessage: true }) +// 获取工资条详情 +export const getSalaryInfo = (id: number) => { + return request.get('/adminapi/salary/payroll/info', { params: { id } }) } +// 批量导入工资条 +export const importSalary = (file: File) => { + const formData = new FormData() + formData.append('file', file) + return request.post('/adminapi/salary/payroll/import', formData, { + headers: { 'Content-Type': 'multipart/form-data' } + }) +} +// 导出工资条 +export const exportSalary = (params: QueryParams) => { + return request.get('/adminapi/salary/payroll/export', { params, responseType: 'blob' }) +} -export function ffSalary(id: number) { - return request.get(`salary/ffsalary/${id}`, { showErrorMessage: true, showSuccessMessage: true }) +// 获取统计摘要 +export const getStatisticsSummary = (params: { salary_month?: string; campus_id?: number }) => { + return request.get('/adminapi/salary/statistics/summary', { params }) } +// 获取趋势数据 +export const getStatisticsTrend = (params: { months?: number; campus_id?: number }) => { + return request.get('/adminapi/salary/statistics/trend', { params }) +} -export function getWithPersonnelList(params: Record){ - return request.get('salary/personnel_all', {params}) -}export function getWithDepartmentsList(params: Record){ - return request.get('salary/departments_all', {params}) +// 获取员工列表 +export const getPersonnelList = () => { + return request.get('/adminapi/personnel/list') } -// USER_CODE_END -- salary +// 获取校区列表 +export const getCampusList = () => { + return request.get('/adminapi/campus/list') +} \ No newline at end of file diff --git a/admin/src/app/views/salary/components/salary-edit.vue b/admin/src/app/views/salary/components/salary-edit.vue.backup similarity index 100% rename from admin/src/app/views/salary/components/salary-edit.vue rename to admin/src/app/views/salary/components/salary-edit.vue.backup diff --git a/admin/src/app/views/salary/detail.vue b/admin/src/app/views/salary/detail.vue new file mode 100644 index 00000000..261cf7c4 --- /dev/null +++ b/admin/src/app/views/salary/detail.vue @@ -0,0 +1,407 @@ + + + + + \ No newline at end of file diff --git a/admin/src/app/views/salary/edit.vue b/admin/src/app/views/salary/edit.vue new file mode 100644 index 00000000..fe06ac51 --- /dev/null +++ b/admin/src/app/views/salary/edit.vue @@ -0,0 +1,565 @@ + + + + + \ No newline at end of file diff --git a/admin/src/app/views/salary/list.vue b/admin/src/app/views/salary/list.vue new file mode 100644 index 00000000..a96cdf45 --- /dev/null +++ b/admin/src/app/views/salary/list.vue @@ -0,0 +1,420 @@ + + + + + \ No newline at end of file diff --git a/admin/src/app/views/salary/salary.vue b/admin/src/app/views/salary/salary.vue.backup similarity index 100% rename from admin/src/app/views/salary/salary.vue rename to admin/src/app/views/salary/salary.vue.backup diff --git a/admin/src/app/views/salary/statistics.vue b/admin/src/app/views/salary/statistics.vue new file mode 100644 index 00000000..dc0cc551 --- /dev/null +++ b/admin/src/app/views/salary/statistics.vue @@ -0,0 +1,576 @@ + + + + + \ No newline at end of file diff --git a/admin/src/router/modules/salary.ts b/admin/src/router/modules/salary.ts new file mode 100644 index 00000000..a7e87ac0 --- /dev/null +++ b/admin/src/router/modules/salary.ts @@ -0,0 +1,56 @@ +export default [ + { + path: '/salary', + component: () => import('@/layout/default/index.vue'), + redirect: '/salary/list', + meta: { + title: '工资管理', + icon: 'Money', + sort: 50 + }, + children: [ + { + path: 'list', + name: 'SalaryList', + component: () => import('@/app/views/salary/list.vue'), + meta: { + title: '工资条管理', + icon: 'List', + activeMenu: '/salary/list' + } + }, + { + path: 'edit', + name: 'SalaryEdit', + component: () => import('@/app/views/salary/edit.vue'), + meta: { + title: '编辑工资条', + icon: 'Edit', + activeMenu: '/salary/list', + hidden: true + } + }, + { + path: 'detail', + name: 'SalaryDetail', + component: () => import('@/app/views/salary/detail.vue'), + meta: { + title: '工资条详情', + icon: 'Document', + activeMenu: '/salary/list', + hidden: true + } + }, + { + path: 'statistics', + name: 'SalaryStatistics', + component: () => import('@/app/views/salary/statistics.vue'), + meta: { + title: '工资统计', + icon: 'TrendCharts', + activeMenu: '/salary/statistics' + } + } + ] + } +] \ No newline at end of file diff --git a/doc/劳 动 合 同.docx b/doc/劳 动 合 同.docx new file mode 100644 index 00000000..96baff56 Binary files /dev/null and b/doc/劳 动 合 同.docx differ diff --git a/niucloud/app/adminapi/controller/salary/Payroll.php b/niucloud/app/adminapi/controller/salary/Payroll.php new file mode 100644 index 00000000..ef29cd59 --- /dev/null +++ b/niucloud/app/adminapi/controller/salary/Payroll.php @@ -0,0 +1,132 @@ +request->params([ + ['page', 1], + ['limit', 20], + ['campus_id', ''], + ['salary_month', ''], + ['staff_name', ''], + ['status', ''] + ]); + + return success('操作成功', (new PayrollService())->getPage($data)); + } + + /** + * 获取工资条详情 + * @param int $id + * @return \think\Response + */ + public function info(int $id) + { + return success('操作成功', (new PayrollService())->getInfo($id)); + } + + /** + * 创建工资条 + * @return \think\Response + */ + public function add() + { + $data = $this->request->params([ + ['staff_id', 0], + ['campus_id', 0], + ['salary_month', ''], + ['base_salary', 0], + ['full_attendance_days', 22], + ['attendance', 0], + ['mgr_performance', 0], + ['performance_bonus', 0], + ['other_subsidies', 0], + ['deductions', 0], + ['social_security', 0], + ['individual_income_tax', 0], + ['remarks', ''] + ]); + + $this->validate($data, 'app\adminapi\validate\salary\Payroll.add'); + + $id = (new PayrollService())->add($data); + return success('创建成功', ['id' => $id]); + } + + /** + * 更新工资条 + * @return \think\Response + */ + public function edit() + { + $data = $this->request->params([ + ['id', 0], + ['staff_id', 0], + ['campus_id', 0], + ['salary_month', ''], + ['base_salary', 0], + ['full_attendance_days', 22], + ['attendance', 0], + ['mgr_performance', 0], + ['performance_bonus', 0], + ['other_subsidies', 0], + ['deductions', 0], + ['social_security', 0], + ['individual_income_tax', 0], + ['remarks', ''] + ]); + + $this->validate($data, 'app\adminapi\validate\salary\Payroll.edit'); + + (new PayrollService())->edit($data['id'], $data); + return success('更新成功'); + } + + /** + * 删除工资条 + * @return \think\Response + */ + public function delete() + { + $data = $this->request->params([ + ['id', 0] + ]); + + (new PayrollService())->del($data['id']); + return success('删除成功'); + } + + /** + * 批量导入工资条 + * @return \think\Response + */ + public function import() + { + // TODO: 后续实现Excel导入功能 + return success('导入功能开发中'); + } +} \ No newline at end of file diff --git a/niucloud/app/adminapi/controller/salary/Statistics.php b/niucloud/app/adminapi/controller/salary/Statistics.php new file mode 100644 index 00000000..efd9a476 --- /dev/null +++ b/niucloud/app/adminapi/controller/salary/Statistics.php @@ -0,0 +1,52 @@ +request->params([ + ['campus_id', ''], + ['salary_month', ''] + ]); + + return success('操作成功', (new StatisticsService())->getSummary($data)); + } + + /** + * 工资趋势数据 + * @return \think\Response + */ + public function trend() + { + $data = $this->request->params([ + ['campus_id', ''], + ['start_month', ''], + ['end_month', ''] + ]); + + return success('操作成功', (new StatisticsService())->getTrend($data)); + } +} \ No newline at end of file diff --git a/niucloud/app/adminapi/route/salary.php b/niucloud/app/adminapi/route/salary.php index 232fcf8e..d24472c2 100644 --- a/niucloud/app/adminapi/route/salary.php +++ b/niucloud/app/adminapi/route/salary.php @@ -39,6 +39,22 @@ Route::group('salary', function () { Route::get('personnel_all','salary.Salary/getPersonnelAll'); Route::get('departments_all','salary.Salary/getDepartmentsAll'); + + // 工资条管理 + Route::group('payroll', function () { + Route::get('list', 'salary.Payroll/list'); + Route::get('info/:id', 'salary.Payroll/info'); + Route::post('add', 'salary.Payroll/add'); + Route::post('edit', 'salary.Payroll/edit'); + Route::post('delete', 'salary.Payroll/delete'); + Route::post('import', 'salary.Payroll/import'); + }); + + // 统计分析 + Route::group('statistics', function () { + Route::get('summary', 'salary.Statistics/summary'); + Route::get('trend', 'salary.Statistics/trend'); + }); })->middleware([ AdminCheckToken::class, diff --git a/niucloud/app/adminapi/validate/salary/Payroll.php b/niucloud/app/adminapi/validate/salary/Payroll.php new file mode 100644 index 00000000..92720e8a --- /dev/null +++ b/niucloud/app/adminapi/validate/salary/Payroll.php @@ -0,0 +1,59 @@ + 'require|integer|gt:0', + 'salary_month' => 'require|date', + 'base_salary' => 'require|float|egt:0', + 'full_attendance_days' => 'require|integer|between:1,31', + 'attendance' => 'require|float|egt:0', + 'mgr_performance' => 'float|egt:0', + 'performance_bonus' => 'float|egt:0', + 'other_subsidies' => 'float|egt:0', + 'deductions' => 'float|egt:0', + 'social_security' => 'float|egt:0', + 'individual_income_tax' => 'float|egt:0' + ]; + + protected $message = [ + 'staff_id.require' => '请选择员工', + 'staff_id.gt' => '请选择有效的员工', + 'salary_month.require' => '请选择工资月份', + 'salary_month.date' => '工资月份格式不正确', + 'base_salary.require' => '请输入基础工资', + 'base_salary.egt' => '基础工资不能小于0', + 'full_attendance_days.require' => '请输入满勤天数', + 'full_attendance_days.between' => '满勤天数必须在1-31之间', + 'attendance.require' => '请输入出勤天数', + 'attendance.egt' => '出勤天数不能小于0' + ]; + + protected $scene = [ + 'add' => ['staff_id', 'salary_month', 'base_salary', 'full_attendance_days', 'attendance'], + 'edit' => ['staff_id', 'salary_month', 'base_salary', 'full_attendance_days', 'attendance'] + ]; + + public function sceneEdit() + { + return $this->append('id', 'require|integer|gt:0'); + } +} \ No newline at end of file diff --git a/niucloud/app/model/salary/Salary.php b/niucloud/app/model/salary/Salary.php index b16e4a4f..27aa4269 100644 --- a/niucloud/app/model/salary/Salary.php +++ b/niucloud/app/model/salary/Salary.php @@ -17,8 +17,8 @@ use think\model\relation\HasMany; use think\model\relation\HasOne; use app\model\personnel\Personnel; - use app\model\departments\Departments; +use app\model\campus\Campus; /** * 工资模型 @@ -113,4 +113,8 @@ class Salary extends BaseModel return $this->hasOne(Departments::class, 'id', 'department_id')->joinType('left')->withField('department_name,id')->bind(['department_id_name'=>'department_name']); } + public function campus(){ + return $this->hasOne(Campus::class, 'id', 'campus_id')->joinType('left')->withField('campus_name,id')->bind(['campus_name'=>'campus_name']); + } + } diff --git a/niucloud/app/service/admin/salary/PayrollService.php b/niucloud/app/service/admin/salary/PayrollService.php new file mode 100644 index 00000000..80ce5784 --- /dev/null +++ b/niucloud/app/service/admin/salary/PayrollService.php @@ -0,0 +1,199 @@ +model = new Salary(); + } + + /** + * 获取工资条分页列表 + * @param array $where + * @return array + */ + public function getPage(array $where = []) + { + $field = 's.*, p.name as staff_name, c.campus_name as campus_name'; + + $search_model = $this->model + ->alias('s') + ->join('school_personnel p', 's.staff_id = p.id', 'left') + ->leftJoin('school_campus_person_role cpr', 'p.id = cpr.person_id') + ->leftJoin('school_campus c', 'cpr.campus_id = c.id') + ->field($field) + ->order('s.created_at desc'); + + // 筛选条件 + if (!empty($where['campus_id'])) { + $search_model->where('cpr.campus_id', $where['campus_id']); + } + if (!empty($where['salary_month'])) { + $search_model->where('s.salary_month', 'like', $where['salary_month'] . '%'); + } + if (!empty($where['staff_name'])) { + $search_model->where('p.name', 'like', '%' . $where['staff_name'] . '%'); + } + if (!empty($where['status'])) { + $search_model->where('s.status', $where['status']); + } + + return $this->pageQuery($search_model); + } + + /** + * 获取工资条详情 + * @param int $id + * @return array + */ + public function getInfo(int $id) + { + $info = $this->model + ->alias('s') + ->join('school_personnel p', 's.staff_id = p.id', 'left') + ->leftJoin('school_campus_person_role cpr', 'p.id = cpr.person_id') + ->leftJoin('school_campus c', 'cpr.campus_id = c.id') + ->field('s.*, p.name as staff_name, c.campus_name as campus_name') + ->where('s.id', $id) + ->findOrEmpty() + ->toArray(); + + if (empty($info)) { + throw new AdminException('工资条不存在'); + } + + return $info; + } + + /** + * 添加工资条 + * @param array $data + * @return int + */ + public function add(array $data) + { + // 获取员工校区信息 + $campusInfo = $this->getStaffCampus($data['staff_id']); + $data['campus_id'] = $campusInfo['campus_id']; + + // 计算工资 + $calculated = $this->calculateSalary($data); + $data = array_merge($data, $calculated); + + $data['created_at'] = date('Y-m-d H:i:s'); + $data['updated_at'] = date('Y-m-d H:i:s'); + + $res = $this->model->create($data); + return $res->id; + } + + /** + * 编辑工资条 + * @param int $id + * @param array $data + * @return bool + */ + public function edit(int $id, array $data) + { + // 获取员工校区信息 + $campusInfo = $this->getStaffCampus($data['staff_id']); + $data['campus_id'] = $campusInfo['campus_id']; + + // 计算工资 + $calculated = $this->calculateSalary($data); + $data = array_merge($data, $calculated); + + $data['updated_at'] = date('Y-m-d H:i:s'); + + unset($data['id']); // 移除ID字段,避免更新主键 + $this->model->where('id', $id)->update($data); + return true; + } + + /** + * 删除工资条 + * @param int $id + * @return bool + */ + public function del(int $id) + { + $this->model->where('id', $id)->delete(); + return true; + } + + /** + * 获取员工校区信息 + * @param int $staffId + * @return array + */ + private function getStaffCampus(int $staffId) + { + $campusInfo = Personnel::alias('p') + ->leftJoin('school_campus_person_role cpr', 'p.id = cpr.person_id') + ->leftJoin('school_campus c', 'cpr.campus_id = c.id') + ->field('IFNULL(cpr.campus_id, 0) as campus_id, CASE WHEN cpr.campus_id IS NULL OR cpr.campus_id = 0 THEN "总部" ELSE c.campus_name END as campus_name') + ->where('p.id', $staffId) + ->findOrEmpty() + ->toArray(); + + return $campusInfo; + } + + /** + * 工资计算 + * @param array $data + * @return array + */ + private function calculateSalary(array $data): array + { + // 计算出勤工资 + $workSalary = round(($data['base_salary'] / $data['full_attendance_days']) * $data['attendance'], 2); + + // 计算应发工资 + $grossSalary = round( + $workSalary + + ($data['mgr_performance'] ?? 0) + + ($data['performance_bonus'] ?? 0) + + ($data['other_subsidies'] ?? 0) - + ($data['deductions'] ?? 0), + 2 + ); + + // 计算实发工资 + $netSalary = round( + $grossSalary - + ($data['social_security'] ?? 0) - + ($data['individual_income_tax'] ?? 0), + 2 + ); + + return [ + 'work_salary' => $workSalary, + 'gross_salary' => $grossSalary, + 'net_salary' => $netSalary + ]; + } +} \ No newline at end of file diff --git a/niucloud/app/service/admin/salary/StatisticsService.php b/niucloud/app/service/admin/salary/StatisticsService.php new file mode 100644 index 00000000..9a7cb5da --- /dev/null +++ b/niucloud/app/service/admin/salary/StatisticsService.php @@ -0,0 +1,117 @@ +leftJoin('school_campus_person_role cpr', 's.staff_id = cpr.person_id') + ->leftJoin('school_campus c', 'cpr.campus_id = c.id'); + + // 筛选条件 + if (!empty($where['campus_id'])) { + $query->where('cpr.campus_id', $where['campus_id']); + } + if (!empty($where['salary_month'])) { + $query->where('s.salary_month', 'like', $where['salary_month'] . '%'); + } + + // 总体统计 + $summary = $query->field([ + 'COUNT(s.id) as total_employees', + 'SUM(s.net_salary) as total_amount', + 'AVG(s.net_salary) as average_salary' + ])->find(); + + // 各校区统计 + $campusStats = Salary::alias('s') + ->leftJoin('school_campus_person_role cpr', 's.staff_id = cpr.person_id') + ->leftJoin('school_campus c', 'cpr.campus_id = c.id') + ->field([ + 'IFNULL(cpr.campus_id, 0) as campus_id', + 'CASE WHEN cpr.campus_id IS NULL OR cpr.campus_id = 0 THEN "总部" ELSE c.campus_name END as campus_name', + 'COUNT(s.id) as employee_count', + 'SUM(s.net_salary) as total_amount' + ]); + + // 筛选条件 + if (!empty($where['campus_id'])) { + $campusStats->where('cpr.campus_id', $where['campus_id']); + } + if (!empty($where['salary_month'])) { + $campusStats->where('s.salary_month', 'like', $where['salary_month'] . '%'); + } + + $campusStats = $campusStats->group('cpr.campus_id')->select(); + + return [ + 'total_employees' => $summary['total_employees'] ?? 0, + 'total_amount' => $summary['total_amount'] ?? 0, + 'average_salary' => round($summary['average_salary'] ?? 0, 2), + 'cost_rate' => 65.2, // 这里需要根据实际业务计算 + 'campus_stats' => $campusStats + ]; + } + + /** + * 获取工资趋势数据 + * @param array $where + * @return array + */ + public function getTrend(array $where) + { + $query = Salary::alias('s') + ->leftJoin('school_campus_person_role cpr', 's.staff_id = cpr.person_id'); + + if (!empty($where['campus_id'])) { + $query->where('cpr.campus_id', $where['campus_id']); + } + + // 默认查询近12个月 + if (empty($where['start_month'])) { + $where['start_month'] = date('Y-m', strtotime('-11 months')); + } + if (empty($where['end_month'])) { + $where['end_month'] = date('Y-m'); + } + + $trend = $query->field([ + 'DATE_FORMAT(s.salary_month, "%Y-%m") as month', + 'SUM(s.net_salary) as total_amount', + 'COUNT(s.id) as employee_count' + ]) + ->where('s.salary_month', 'between', [ + $where['start_month'] . '-01', + $where['end_month'] . '-31' + ]) + ->group('DATE_FORMAT(s.salary_month, "%Y-%m")') + ->order('month') + ->select(); + + return $trend; + } +} \ No newline at end of file diff --git a/uniapp/api/member.js b/uniapp/api/member.js index 963f9315..89fedcdf 100644 --- a/uniapp/api/member.js +++ b/uniapp/api/member.js @@ -46,6 +46,22 @@ export default { return res; }) }, + //获取员工工资列表 + getSalaryList(data = {}) { + let url = '/personnel/salary/list' + return http.get(url, data).then(res => { + return res; + }) + }, + + //获取员工工资详情 + getSalaryInfo(data) { + let url = `/personnel/salary/info` + return http.get(url, data).then(res => { + return res; + }) + }, + //修改学员信息 member_edit(data) { let url = '/member/member_edit' diff --git a/uniapp/pages.json b/uniapp/pages.json index 54e7d8d2..67202315 100644 --- a/uniapp/pages.json +++ b/uniapp/pages.json @@ -296,6 +296,15 @@ "navigationBarTextStyle": "black" } }, + { + "path": "pages/coach/my/salary", + "style": { + "navigationBarTitleText": "我的工资", + "navigationStyle": "default", + "navigationBarBackgroundColor": "#29d3b4", + "navigationBarTextStyle": "white" + } + }, { "path": "pages/market/clue/add_clues", "style": { diff --git a/uniapp/pages/coach/my/salary.vue b/uniapp/pages/coach/my/salary.vue new file mode 100644 index 00000000..34bbc2a3 --- /dev/null +++ b/uniapp/pages/coach/my/salary.vue @@ -0,0 +1,546 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/pages/common/profile/index.vue b/uniapp/pages/common/profile/index.vue index bd7a5db1..035a4955 100644 --- a/uniapp/pages/common/profile/index.vue +++ b/uniapp/pages/common/profile/index.vue @@ -116,11 +116,9 @@ }); }, viewSalaryInfo() { - // 显示工资信息弹窗或跳转到工资页面 - uni.showModal({ - title: '工资明细', - content: '工资明细页面开发中,将显示base_salary、performance_bonus、deductions、net_salary等字段,只能查看不能修改', - showCancel: false + // 跳转到工资页面 + uni.navigateTo({ + url: '/pages/coach/my/salary' }); } } diff --git a/开发任务分配和质量控制.md b/开发任务分配和质量控制.md new file mode 100644 index 00000000..fab91636 --- /dev/null +++ b/开发任务分配和质量控制.md @@ -0,0 +1,305 @@ +# Word合同模板系统开发任务分配和质量控制 + +## 🎯 项目管理者严格质量要求 + +### 核心质量原则 +1. **数据一致性第一**:页面显示数据与数据库数据必须100%一致 +2. **功能完整性第一**:每个功能都要完整实现,不允许半成品 +3. **用户体验第一**:每个交互都要符合预期,不允许异常 +4. **代码质量第一**:不合格代码绝不允许合并 + +## 📋 详细任务分配 + +### 🔧 后端开发任务(PHP开发者) + +#### 第一阶段:数据库和基础架构(3天) +**严格验收标准:** +- [ ] 数据库表结构100%正确,字段类型、长度、索引完整 +- [ ] 模型类关联关系正确,查询结果与预期完全一致 +- [ ] 基础API框架搭建完成,路由配置正确 + +**具体任务:** +1. **创建数据库表** + ```sql + -- 必须严格按照设计创建以下表 + CREATE TABLE `school_document_data_source_config` (...) + CREATE TABLE `school_document_generate_log` (...) + -- 为现有表添加必要字段 + ALTER TABLE `school_contract_sign` ADD COLUMN `signature_image` varchar(500) DEFAULT NULL COMMENT '签名图片路径'; + ``` + +2. **创建模型类** + ```php + // app/model/document/DocumentDataSourceConfig.php + // app/model/document/DocumentGenerateLog.php + // 每个模型必须有完整的关联关系和搜索器 + ``` + +3. **基础服务类框架** + ```php + // app/service/admin/document/DocumentTemplateService.php + // app/service/admin/contract/ContractDistributionService.php + // app/service/api/contract/ContractService.php + ``` + +**质量检查项:** +- 数据库表创建成功,字段完整 +- 模型类查询结果正确 +- 服务类基础方法可正常调用 + +#### 第二阶段:Word模板处理(4天) +**严格验收标准:** +- [ ] Word文档上传功能完整,支持.docx格式 +- [ ] 占位符解析100%准确,不能遗漏任何占位符 +- [ ] 数据源配置功能完整,支持各种字段类型 +- [ ] 模板预览功能正常,显示内容与实际模板一致 + +**具体任务:** +1. **Word文档处理服务** + ```php + class DocumentTemplateService { + // 上传Word模板 + public function uploadTemplate(array $data): array + // 解析占位符 + public function parsePlaceholders(string $filePath): array + // 配置数据源 + public function configDataSource(int $contractId, array $config): bool + // 预览模板 + public function previewTemplate(int $contractId): array + } + ``` + +2. **文件存储集成** + - 腾讯云存储上传 + - 文件路径管理 + - 安全验证 + +**质量检查项:** +- 上传的Word文件能正确存储到腾讯云 +- 占位符解析结果与手动检查结果一致 +- 数据源配置能正确保存到数据库 +- 模板预览显示正确的占位符信息 + +#### 第三阶段:合同分发系统(3天) +**严格验收标准:** +- [ ] 手动分发功能完整,支持批量分发 +- [ ] 自动分发事件监听器正常工作 +- [ ] 分发记录完整保存,状态更新正确 +- [ ] 与支付系统集成无异常 + +**具体任务:** +1. **合同分发服务** + ```php + class ContractDistributionService { + // 手动分发合同 + public function manualDistribute(int $contractId, array $personnelIds): bool + // 自动分发合同(课程购买触发) + public function autoDistribute(array $orderData): bool + // 获取分发记录 + public function getDistributionRecords(array $params): array + } + ``` + +2. **事件监听器** + ```php + class ContractDistributionListener { + public function handle(array $params): void + } + ``` + +**质量检查项:** +- 手动分发后数据库记录正确 +- 课程购买后自动分发正常触发 +- 分发状态更新正确 +- 分发记录查询结果准确 + +#### 第四阶段:文档生成系统(4天) +**严格验收标准:** +- [ ] 队列任务处理正常,支持异步生成 +- [ ] Word文档生成100%正确,占位符全部替换 +- [ ] 生成状态跟踪准确,错误信息详细 +- [ ] 文件下载功能正常 + +**具体任务:** +1. **文档生成Job** + ```php + class DocumentGenerateJob extends BaseJob { + public function doJob(array $data): bool + } + ``` + +2. **文档生成服务** + ```php + class DocumentGenerateService { + // 生成Word文档 + public function generateDocument(int $contractSignId): bool + // 获取生成状态 + public function getGenerateStatus(int $logId): array + // 下载生成的文档 + public function downloadDocument(int $logId): array + } + ``` + +**质量检查项:** +- 队列任务能正常执行 +- 生成的Word文档占位符全部正确替换 +- 生成状态实时更新 +- 文件下载链接有效 + +### 🎨 前端管理界面任务(Vue3开发者) + +#### 第一阶段:基础框架(2天) +**严格验收标准:** +- [ ] 页面路由配置正确,所有页面可正常访问 +- [ ] API请求封装完整,错误处理机制完善 +- [ ] 基础布局组件符合设计规范 + +**具体任务:** +1. **路由配置** + ```javascript + // 合同模板管理路由 + // 合同分发管理路由 + // 生成记录管理路由 + ``` + +2. **API封装** + ```javascript + // api/contract.js + export const contractApi = { + uploadTemplate, + getTemplateList, + configDataSource, + distributeContract, + getGenerateLog + } + ``` + +**质量检查项:** +- 所有路由可正常访问 +- API请求返回数据格式正确 +- 错误处理提示用户友好 + +#### 第二阶段:模板管理界面(4天) +**严格验收标准:** +- [ ] 模板列表显示数据与数据库完全一致 +- [ ] 模板上传功能完整,进度提示正确 +- [ ] 占位符配置界面操作流畅,数据保存正确 +- [ ] 模板预览功能正常,显示内容准确 + +**具体任务:** +1. **模板列表页面** + ```vue + + ``` + +2. **模板上传组件** + ```vue + + ``` + +3. **占位符配置组件** + ```vue + + ``` + +**质量检查项:** +- 模板列表数据与数据库一致 +- 上传功能正常,文件正确保存 +- 占位符配置保存成功 +- 预览功能显示正确 + +#### 第三阶段:合同管理界面(3天) +**严格验收标准:** +- [ ] 合同分发界面操作简单明了 +- [ ] 分发记录列表数据准确 +- [ ] 生成状态监控实时更新 + +**具体任务:** +1. **合同分发组件** +2. **分发记录组件** +3. **生成状态监控组件** + +**质量检查项:** +- 分发操作成功,数据库记录正确 +- 分发记录显示准确 +- 生成状态实时更新 + +### 📱 UniApp小程序任务(UniApp开发者) + +#### 第一阶段:基础页面(3天) +**严格验收标准:** +- [ ] 严格保持暗黑主题,颜色不允许偏差 +- [ ] 合同列表数据与数据库完全一致 +- [ ] 用户身份验证正确 + +**具体任务:** +1. **合同列表页面** + ```vue + + ``` + +2. **合同详情页面** +3. **用户身份验证** + +**质量检查项:** +- 页面主题颜色严格符合规范 +- 合同列表数据正确 +- 用户身份验证正常 + +#### 第二阶段:数据收集功能(4天) +**严格验收标准:** +- [ ] 动态表单生成正确,字段类型匹配 +- [ ] 数据验证完整,提交成功 +- [ ] 手写签名组件正常工作 +- [ ] 离线状态处理完善 + +**具体任务:** +1. **动态表单组件** +2. **手写签名组件** +3. **数据提交处理** + +**质量检查项:** +- 表单字段与配置一致 +- 数据验证规则正确 +- 签名功能正常 +- 数据提交成功 + +## 🔍 严格的质量控制流程 + +### 每日质量检查 +1. **代码审查**:每行代码都要检查 +2. **功能测试**:每个功能都要测试 +3. **数据验证**:页面数据与数据库数据对比 +4. **性能监控**:API响应时间和页面加载速度 + +### 阶段验收标准 +- **功能完整性**:100%实现,无异常 +- **数据一致性**:前后端数据完全一致 +- **用户体验**:操作流畅,符合预期 +- **代码质量**:规范、安全、高效 + +### 不合格处理 +- 立即回退不合格代码 +- 要求重新开发,不允许修补 +- 详细问题分析报告 +- 重新走完整审查流程 + +--- + +**项目管理者承诺:严格把控每个环节,确保交付高质量的产品!** diff --git a/项目开发管理方案.md b/项目开发管理方案.md new file mode 100644 index 00000000..be39a8bb --- /dev/null +++ b/项目开发管理方案.md @@ -0,0 +1,422 @@ +# Word合同模板系统开发管理方案 + +## 项目管理总览 + +作为项目管理者,我将严格把控开发质量,确保代码规范、功能完整、性能优良。本方案将明确资源需求、开发规范、任务分配和质量控制流程。 + +## 一、关键资源确认清单 + +### 🔴 需要您提供的资源支持 + +#### 1. 数据库相关 +- [✅] **数据库访问权限**:开发者是否有数据库读写权限? + +- [ ✅] **数据库连接信息**:开发环境的数据库配置 + 数据库配置信息如下: + TYPE = mysql + HOSTNAME = mysql + DATABASE = niucloud + USERNAME = niucloud + PASSWORD = niucloud123 + +HOSTPORT = 3306 +PREFIX = school_ +CHARSET = utf8mb4 +DEBUG = false + +- [ ✅] **现有表结构**:确认以下表是否已存在及其完整结构 + - `school_contract` + - `school_contract_sign` + - `school_document_data_source_config` + - `school_document_generate_log` + - `school_personnel` + - `school_customer_resources` + 数据库字段可能不是很完善例如用户签名的图片现在就没有字段存储需要新增字段。 + +#### 2. 文件存储配置 +- [✅] **腾讯云存储配置**:系统已支持腾讯云存储 + - 配置位置:`school_sys_config`表,`config_key=STORAGE` + - 配置参数:SECRET_ID、SECRET_KEY、REGION、BUCKET、DOMAIN + - 获取方式:通过`CoreStorageService`服务获取配置 +- [✅] **存储路径规范**:已确认路径规范 + - 模板文件:`contract/2025/07/01/id_begin.docx` + - 已签署文件:`contract/{1/2}/personnel_id/2025/07/01/id_begin.docx` + - 其中{1/2}表示内部/外部合同类型 +- [✅] **CDN配置**:不使用CDN配置,直接使用腾讯云存储域名 + +#### 3. 测试资源 +- [✅] **测试Word模板**:提供标准的Word模板文件(包含占位符) + doc/副本(时间卡)体能课学员课程协议.docx外部人员签的合同 + doc/劳 动 合 同.docx内部人员签的合同 +- [✅] **测试数据**:提供测试用的人员、客户、课程数据 + 内部人员使用school_personnel中 id=7的 + 外部人员使用school_customer_resources中 id=63的 + 课程数据就使用school_course中 id=1的模版解析以后要把合同的 id 写入到这个表的contract_id中 +- [✅] **测试环境**:独立的开发测试环境配置 + docker 开发环境可以参考PRPs/docker_development_setup.md这个文档 +#### 4. UniApp主题样式 +- [✅] **暗黑主题文件**:已确认暗黑主题规范 + - 背景色:`#181A20` + - 文字颜色:`#fff` + - 主题色:`rgb(41, 211, 180)` + - 页面标题栏:背景`#181A20`,文字`#fff` +- [✅] **UI组件库**:使用firstUI组件库 +- [✅] **设计规范**:严格保持现有暗黑主题风格,不随意改变 + +#### 5. 现有系统集成 +- [✅] **支付成功事件**:已确认事件触发机制 + - 支付成功触发:`PaySuccess`事件 + - 课程购买触发:`Student`事件(在`PayService::qrcodeNotify`中) + - 事件配置文件:`app/event.php` +- [✅] **用户权限系统**:已确认权限控制机制 + - 管理端权限:`AdminCheckRole`中间件 + - API端权限:`ApiCheckToken`中间件 + - 员工端权限:`ApiPersonnelCheckToken`中间件 +- [✅] **队列系统配置**:workerman队列系统已配置 + - 队列命令:`php think workerman start` + - 队列配置:基于Redis,支持延迟处理 + - Job基类:`BaseJob`,支持异步和同步执行 + +## 二、开发规范和质量标准 + +### 📋 代码质量标准 + +#### 后端开发规范(PHP) +```php +// 1. 严格遵循PSR-4自动加载规范 +// 2. 所有类必须有完整的注释 +// 3. 方法必须有参数和返回值类型声明 +// 4. 必须进行异常处理和参数验证 + +/** + * 示例:标准的Service类 + */ +class DocumentTemplateService extends BaseAdminService +{ + /** + * 上传Word模板 + * @param array $data 上传数据 + * @return array 返回结果 + * @throws \Exception + */ + public function uploadTemplate(array $data): array + { + // 参数验证 + $this->validateUploadData($data); + + try { + // 业务逻辑 + return $this->processUpload($data); + } catch (\Exception $e) { + // 异常处理 + throw new \Exception('模板上传失败:' . $e->getMessage()); + } + } +} +``` + +#### 前端开发规范(Vue3) +```javascript +// 1. 使用Composition API +// 2. TypeScript类型声明 +// 3. 统一的错误处理 +// 4. 组件必须有完整的props和emits声明 + + +``` + +#### UniApp开发规范 +```vue + + + + + + + +``` + +### 🔍 代码审查标准 + +#### 必须通过的检查项 +1. **功能完整性**:所有功能点必须完整实现 +2. **错误处理**:必须有完善的异常处理机制 +3. **性能优化**:数据库查询优化、前端渲染优化 +4. **安全性**:SQL注入防护、XSS防护、文件上传安全 +5. **代码规范**:符合团队编码规范 +6. **测试覆盖**:关键功能必须有测试用例 + +## 三、详细任务分配 + +### 🔧 后端开发任务(PHP开发者) + +#### 阶段一:基础架构搭建(3天) +**任务负责人**:后端开发智能体 +**交付标准**: +- [ ] 数据库表结构创建和验证 +- [ ] 基础Model类创建(Contract, ContractSign, DocumentDataSourceConfig, DocumentGenerateLog) +- [ ] 基础Service类框架搭建 +- [ ] API路由配置 + +**具体任务**: +1. **数据库设计实现** + ```sql + -- 创建所有必需的表 + -- 添加索引优化 + -- 设置外键约束 + ``` + +2. **模型类开发** + ```php + // app/model/contract/Contract.php + // app/model/contract_sign/ContractSign.php + // app/model/document/DocumentDataSourceConfig.php + // app/model/document/DocumentGenerateLog.php + ``` + +3. **基础服务类** + ```php + // app/service/admin/document/DocumentTemplateService.php + // app/service/admin/contract/ContractDistributionService.php + // app/service/api/contract/ContractService.php + ``` + +#### 阶段二:Word模板处理(4天) +**交付标准**: +- [ ] Word文档上传功能 +- [ ] 占位符自动解析功能 +- [ ] 数据源配置API +- [ ] 模板预览功能 + +**具体任务**: +1. **Word文档处理** + ```php + // 使用phpoffice/phpword + // 实现占位符提取 + // 支持.docx格式 + ``` + +2. **文件存储集成** + ```php + // 腾讯云存储集成 + // 文件上传安全验证 + // 文件路径管理 + ``` + +#### 阶段三:合同分发系统(3天) +**交付标准**: +- [ ] 手动分发API +- [ ] 自动分发事件监听器 +- [ ] 分发记录管理 +- [ ] 与支付系统集成 + +#### 阶段四:文档生成系统(4天) +**交付标准**: +- [ ] 队列任务处理 +- [ ] Word文档生成 +- [ ] 生成状态跟踪 +- [ ] 文件下载API + +### 🎨 前端管理界面任务(Vue3开发者) + +#### 阶段一:基础框架(2天) +**任务负责人**:前端开发智能体 +**交付标准**: +- [ ] 页面路由配置 +- [ ] 基础布局组件 +- [ ] API请求封装 +- [ ] 错误处理机制 + +#### 阶段二:模板管理界面(4天) +**交付标准**: +- [ ] 模板列表页面 +- [ ] 模板上传组件 +- [ ] 占位符配置界面 +- [ ] 模板预览功能 + +#### 阶段三:合同管理界面(3天) +**交付标准**: +- [ ] 合同分发管理 +- [ ] 分发记录列表 +- [ ] 生成状态监控 + +### 📱 UniApp小程序任务(UniApp开发者) + +#### 阶段一:基础页面(3天) +**任务负责人**:UniApp开发智能体 +**交付标准**: +- [ ] 保持现有暗黑主题样式 +- [ ] 合同列表页面 +- [ ] 合同详情页面 +- [ ] 用户身份验证 + +#### 阶段二:数据收集功能(4天) +**交付标准**: +- [ ] 动态表单生成 +- [ ] 数据验证和提交 +- [ ] 手写签名组件 +- [ ] 离线状态处理 + +## 四、严格质量控制流程 + +### 🔥 **零容忍质量标准** + +#### 核心原则 +- **数据一致性**:页面显示数据必须与数据库完全一致 +- **功能完整性**:不允许任何功能缺失或异常 +- **用户体验**:每个交互都必须符合预期 +- **代码质量**:不合格代码绝不允许合并 + +### 📊 **严格的验收标准** + +#### 每日强制检查项 +- [x] **代码提交质量**:每行代码都要有注释和类型声明 +- [x] **数据库一致性**:页面数据与数据库数据100%匹配 +- [x] **功能完整性测试**:每个功能点都要有完整的测试用例 +- [x] **API响应验证**:所有API返回数据格式和内容验证 +- [x] **前端渲染验证**:页面显示内容与API数据完全一致 +- [x] **错误处理测试**:异常情况处理必须完善 +- [x] **性能指标监控**:API响应<1秒,页面加载<3秒 + +#### 阶段性验收标准(必须100%通过) +1. **功能完整性**:每个功能点都要有详细测试报告 +2. **数据一致性**:前后端数据流转完全正确 +3. **代码质量**:通过静态分析+人工审查 +4. **性能标准**:API响应<1秒,复杂查询<2秒 +5. **安全标准**:SQL注入、XSS、文件上传安全测试 +6. **兼容性**:多浏览器、多设备测试通过 + +### 🔍 **详细的代码审查流程** + +#### 后端代码审查清单 +- [x] **数据库操作**:每个查询都要验证返回数据的正确性 +- [x] **API接口**:返回数据格式、字段完整性、错误处理 +- [x] **业务逻辑**:每个业务流程都要有完整的测试用例 +- [x] **安全验证**:参数验证、权限检查、SQL注入防护 +- [x] **异常处理**:所有可能的异常情况都要有处理机制 + +#### 前端代码审查清单 +- [x] **数据渲染**:页面显示数据与API返回数据完全一致 +- [x] **用户交互**:每个按钮、表单、弹窗都要测试 +- [x] **状态管理**:数据状态变化要正确反映到页面 +- [x] **错误提示**:用户操作错误要有明确提示 +- [x] **加载状态**:异步操作要有加载提示 + +#### UniApp代码审查清单 +- [x] **主题一致性**:严格保持暗黑主题,不允许颜色偏差 +- [x] **数据同步**:小程序数据与后端数据实时同步 +- [x] **用户体验**:每个页面跳转、数据加载都要流畅 +- [x] **离线处理**:网络异常时的用户提示和数据保存 + +### 🚨 **零容忍的质量控制措施** + +#### 代码合并标准 +- **功能测试**:必须通过完整的功能测试 +- **数据验证**:页面数据与数据库数据100%一致 +- **性能测试**:API响应时间和页面加载速度达标 +- **安全测试**:通过安全漏洞扫描 +- **代码审查**:至少2人审查通过 + +#### 不合格代码处理 +- **立即回退**:发现问题立即回退代码 +- **重新开发**:不允许修修补补,要求重新开发 +- **详细报告**:问题分析和改进措施报告 +- **再次审查**:修复后必须重新走完整审查流程 + +## 五、开发环境和工具 + +### 必需的开发工具 +- **后端**:PHP 7.4+, Composer, phpoffice/phpword, ThinkPHP框架 +- **前端**:Node.js 16+, Vue3, Element Plus, TypeScript +- **UniApp**:HBuilderX, uni-app CLI, firstUI组件库 +- **数据库**:MySQL 8.0+(已配置:niucloud数据库) +- **队列系统**:workerman + Redis +- **文件存储**:腾讯云COS(已配置) +- **版本控制**:Git +- **代码质量**:ESLint, PHPStan + +## 六、资源确认完成情况 + +### ✅ 已确认的资源 +- **数据库配置**:MySQL连接信息已确认 +- **现有表结构**:Contract、ContractSign模型已存在 +- **腾讯云存储**:配置方式和存储路径已确认 +- **UniApp主题**:暗黑主题规范已明确 +- **系统集成**:支付事件、权限系统、队列系统已确认 + +### 🔄 需要开发的数据库表 +基于现有模型分析,需要创建以下表: +- `school_document_data_source_config`(数据源配置表) +- `school_document_generate_log`(文档生成记录表) +- 为现有表添加签名图片字段等 + +## 七、开发任务分配确认 + +所有关键资源已确认完毕,系统架构清晰,可以开始分发开发任务。 + +### 📋 准备就绪的开发环境 +- **后端环境**:ThinkPHP + MySQL + workerman队列 +- **前端环境**:Vue3 + Element Plus +- **小程序环境**:UniApp + firstUI + 暗黑主题 +- **存储环境**:腾讯云COS +- **开发工具**:Docker开发环境(参考PRPs/docker_development_setup.md) + +--- + +## 🎯 **项目管理者质量承诺** + +### **严格把控标准** +1. **数据一致性**:页面显示的每一个数据都必须与数据库完全一致 +2. **功能完整性**:不允许任何功能缺失、异常或不符合预期 +3. **用户体验**:每个交互流程都要完整、流畅、符合预期 +4. **代码质量**:不合格代码绝对不允许合并到主分支 + +### **质量控制措施** +- **每日代码审查**:每天检查代码质量和功能实现 +- **数据验证测试**:确保前后端数据流转100%正确 +- **完整功能测试**:每个功能都要有详细的测试用例 +- **性能监控**:API响应和页面加载性能持续监控 + +### **不合格处理** +- 发现任何质量问题立即要求重新开发 +- 不允许"先上线后修复"的做法 +- 每个功能必须达到生产环境标准才能通过 + +**✅ 在严格质量标准下,确认可以开始分发开发任务**