feat: secret application.yaml #6
@@ -18,6 +18,7 @@ class Response<T> {
|
||||
- 除特别标注(公开)外,接口需在请求头携带 `Authorization: Bearer <token>`
|
||||
- 下文路径均省略 `/api` 前缀,`data` 仅给出 `T` 的声明
|
||||
- 部分 `/test` 接口的返回值不遵循上述格式
|
||||
- 前端类示例使用 **TypeScript** 类定义
|
||||
|
||||
## 接口总览
|
||||
|
||||
|
||||
@@ -17,15 +17,10 @@
|
||||
- /reset
|
||||
- /departments
|
||||
- /email
|
||||
- /evaluation-records
|
||||
- /finance
|
||||
- /items
|
||||
- /memos
|
||||
- /personnel
|
||||
- /project-groups
|
||||
- /proof-images
|
||||
- /usages
|
||||
- /users
|
||||
|
||||
## 预计完成的 API 列表
|
||||
|
||||
@@ -51,24 +46,6 @@
|
||||
|
||||
---
|
||||
|
||||
### 2. **人员管理 (Personnel)**
|
||||
|
||||
| 端点 | 方法 | 功能说明 |
|
||||
|---------------------------------|---------------------|----------------------------------|
|
||||
| `personnel/` | GET/POST/PUT/DELETE | 人员信息 CRUD 操作 |
|
||||
| `personnel/statistics/` | GET | 获取人员统计信息(按部门和职位) |
|
||||
| `personnel/{id}/set_inactive/` | POST | 设置人员为已卸任状态 |
|
||||
| `personnel/{id}/set_active/` | POST | 设置人员为在职状态 |
|
||||
| `personnel/{id}/` | DELETE | 删除人员(发送邮件通知) |
|
||||
| `personnel/check_expired/` | POST | 检查并更新已到期的人员状态 |
|
||||
| `project-groups/` | GET/POST/PUT/DELETE | 项目组 CRUD 操作 |
|
||||
| `project-groups/by_department/` | GET | 按部门获取项目组 |
|
||||
| `project-groups/{id}/` | DELETE | 删除项目组(发送邮件通知) |
|
||||
|
||||
**搜索/过滤字段**: `name`, `student_id`, `phone`, `email`, `grade_major`
|
||||
|
||||
---
|
||||
|
||||
### 3. **财务管理 (Finance)**
|
||||
|
||||
| 端点 | 方法 | 功能说明 |
|
||||
@@ -95,41 +72,7 @@
|
||||
|
||||
---
|
||||
|
||||
### 5. **备忘录 (Memo)**
|
||||
|
||||
| 端点 | 方法 | 功能说明 |
|
||||
|----------------------------|---------------------|------------------|
|
||||
| `memos/` | GET/POST/PUT/DELETE | 备忘录 CRUD 操作 |
|
||||
| `memos/{id}/upload_image/` | POST | 上传备忘录图片 |
|
||||
| `memos/{id}/delete_image/` | DELETE | 删除备忘录图片 |
|
||||
|
||||
**搜索字段**: `title`, `content`
|
||||
**默认排序**: 按更新时间倒序
|
||||
|
||||
---
|
||||
|
||||
### 6. **考评系统 (Evaluation)**
|
||||
|
||||
| 端点 | 方法 | 功能说明 |
|
||||
|-----------------------------------------|---------------------|--------------------------------------------|
|
||||
| `evaluation-records/` | GET/POST/PUT/DELETE | 考评记录 CRUD 操作 |
|
||||
| `evaluation-records/personnel-summary/` | GET | 获取人员考评汇总(按人员、部门、年级分组) |
|
||||
| `evaluation-records/personnel-records/` | GET | 获取某个人员的所有考评记录 |
|
||||
| `evaluation-records/delete-personnel/` | DELETE | 删除某个人员的所有考评记录 |
|
||||
| `evaluation-records/export/` | GET | 导出考评记录为 Excel(每个人一个表格) |
|
||||
| `evaluation-records/download-template/` | GET | 下载人员导入样表 |
|
||||
| `evaluation-records/import/` | POST | 导入考评记录(支持 Excel/CSV) |
|
||||
|
||||
**功能**:
|
||||
|
||||
- 支持批量导入和导出
|
||||
- 样表格式:只需部门、年级、姓名(初始分39分)
|
||||
- 完整格式:包含详细的加分/扣分记录
|
||||
- 所有操作发送邮件通知
|
||||
|
||||
---
|
||||
|
||||
### 7. **认证相关**
|
||||
### 5. **认证相关**
|
||||
|
||||
这是原先的 Django REST Framework JWT 认证端点,主要用于获取和刷新 JWT 令牌。
|
||||
现在改用 `/api/v1/auth/` 端点来处理登录、注册、重置密码等操作。
|
||||
@@ -154,33 +97,24 @@ Authorization: Bearer <token>
|
||||
|
||||
[schema.sql](./schema.sql)
|
||||
|
||||
- users (系统用户/认证信息)
|
||||
- users/account (系统用户/认证信息)
|
||||
- departments (组织/部门)
|
||||
- parent_id -> departments.id (自关联父级)
|
||||
- personnel (人员信息)
|
||||
- user_id -> users.id
|
||||
- department_id -> departments.id
|
||||
- categories (物品类别)
|
||||
- parent_id -> categories.id (自关联父级)
|
||||
- items (物品基本信息)
|
||||
- category_id -> categories.id
|
||||
- created_by -> personnel.id
|
||||
- created_by -> account.id
|
||||
- item_transactions (物品出入库流水)
|
||||
- item_id -> items.id (ON DELETE CASCADE)
|
||||
- operator_id -> personnel.id
|
||||
- operator_id -> account.id
|
||||
- borrow_records (借用/归还记录)
|
||||
- item_id -> items.id (ON DELETE CASCADE)
|
||||
- borrower_id -> personnel.id (ON DELETE CASCADE)
|
||||
- approver_id -> personnel.id
|
||||
- memos (备忘/备注)
|
||||
- author_id -> personnel.id
|
||||
- related_item_id -> items.id
|
||||
- borrower (借入人,字符串)
|
||||
- approver (借出/审批人,字符串)
|
||||
- finance_records (财务相关记录)
|
||||
- related_item_id -> items.id
|
||||
- recorded_by -> personnel.id
|
||||
- recorded_by -> account.id
|
||||
- email_notices (邮件通知规则/历史)
|
||||
- evaluations (物品/服务评价)
|
||||
- related_item_id -> items.id
|
||||
- evaluator_id -> personnel.id
|
||||
- attachments (文件附件存储索引表)
|
||||
- uploaded_by -> personnel.id
|
||||
- uploaded_by -> account.id
|
||||
|
||||
+12
-66
@@ -30,26 +30,6 @@ CREATE TABLE departments
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='组织/部门';
|
||||
|
||||
-- 人员表(可映射到 Django 的 profile)
|
||||
DROP TABLE IF EXISTS personnel;
|
||||
CREATE TABLE personnel
|
||||
(
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id BIGINT UNSIGNED, -- 关联 account 表(可为空)
|
||||
employee_no VARCHAR(64) UNIQUE,
|
||||
name VARCHAR(100) NOT NULL,
|
||||
department_id BIGINT UNSIGNED,
|
||||
phone VARCHAR(50),
|
||||
email VARCHAR(254),
|
||||
role VARCHAR(100),
|
||||
is_active TINYINT(1) NOT NULL DEFAULT 1,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_personnel_user FOREIGN KEY (user_id) REFERENCES account (id) ON DELETE SET NULL,
|
||||
CONSTRAINT fk_personnel_department FOREIGN KEY (department_id) REFERENCES departments (id) ON DELETE SET NULL
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='人员信息';
|
||||
|
||||
-- 物品类别
|
||||
DROP TABLE IF EXISTS categories;
|
||||
CREATE TABLE categories
|
||||
@@ -84,11 +64,11 @@ CREATE TABLE items
|
||||
status VARCHAR(50) DEFAULT 'normal', -- 如 normal/disabled/lost/repair
|
||||
description TEXT,
|
||||
image_path VARCHAR(500),
|
||||
created_by BIGINT UNSIGNED,
|
||||
created_by BIGINT UNSIGNED, -- 关联 account.id
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_items_category FOREIGN KEY (category_id) REFERENCES categories (id) ON DELETE SET NULL,
|
||||
CONSTRAINT fk_items_creator FOREIGN KEY (created_by) REFERENCES personnel (id) ON DELETE SET NULL,
|
||||
CONSTRAINT fk_items_creator FOREIGN KEY (created_by) REFERENCES account (id) ON DELETE SET NULL,
|
||||
INDEX (name),
|
||||
INDEX (code)
|
||||
) ENGINE = InnoDB
|
||||
@@ -105,11 +85,11 @@ CREATE TABLE item_transactions
|
||||
from_location VARCHAR(200),
|
||||
to_location VARCHAR(200),
|
||||
related_id BIGINT UNSIGNED, -- 可关联采购单/借用记录/调拨单 id
|
||||
operator_id BIGINT UNSIGNED, -- personnel 操作者
|
||||
operator_id BIGINT UNSIGNED, -- 关联 account.id(操作者)
|
||||
note TEXT,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_trans_item FOREIGN KEY (item_id) REFERENCES items (id) ON DELETE CASCADE,
|
||||
CONSTRAINT fk_trans_operator FOREIGN KEY (operator_id) REFERENCES personnel (id) ON DELETE SET NULL,
|
||||
CONSTRAINT fk_trans_operator FOREIGN KEY (operator_id) REFERENCES account (id) ON DELETE SET NULL,
|
||||
INDEX (item_id),
|
||||
INDEX (trans_type)
|
||||
) ENGINE = InnoDB
|
||||
@@ -121,41 +101,22 @@ CREATE TABLE borrow_records
|
||||
(
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
item_id BIGINT UNSIGNED NOT NULL,
|
||||
borrower_id BIGINT UNSIGNED NOT NULL, -- personnel id
|
||||
borrower VARCHAR(100) NOT NULL, -- 借入人(姓名,字符串)
|
||||
quantity INT NOT NULL DEFAULT 1,
|
||||
borrow_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
due_date DATETIME DEFAULT NULL,
|
||||
return_date DATETIME DEFAULT NULL,
|
||||
status ENUM ('BORROWED','RETURNED','OVERDUE','CANCELED') NOT NULL DEFAULT 'BORROWED',
|
||||
approver_id BIGINT UNSIGNED DEFAULT NULL,
|
||||
approver VARCHAR(100) DEFAULT NULL, -- 借出/审批人(姓名,字符串)
|
||||
note TEXT,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_borrow_item FOREIGN KEY (item_id) REFERENCES items (id) ON DELETE CASCADE,
|
||||
CONSTRAINT fk_borrow_borrower FOREIGN KEY (borrower_id) REFERENCES personnel (id) ON DELETE CASCADE,
|
||||
CONSTRAINT fk_borrow_approver FOREIGN KEY (approver_id) REFERENCES personnel (id) ON DELETE SET NULL,
|
||||
INDEX (borrower_id),
|
||||
INDEX (borrower),
|
||||
INDEX (status)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='借用/归还记录';
|
||||
|
||||
-- 备忘/便签
|
||||
DROP TABLE IF EXISTS memos;
|
||||
CREATE TABLE memos
|
||||
(
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
content TEXT,
|
||||
author_id BIGINT UNSIGNED,
|
||||
related_item_id BIGINT UNSIGNED,
|
||||
is_public TINYINT(1) NOT NULL DEFAULT 0,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_memo_author FOREIGN KEY (author_id) REFERENCES personnel (id) ON DELETE SET NULL,
|
||||
CONSTRAINT fk_memo_item FOREIGN KEY (related_item_id) REFERENCES items (id) ON DELETE SET NULL
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='备忘/备注';
|
||||
|
||||
-- 财务记录(采购/报销等)
|
||||
DROP TABLE IF EXISTS finance_records;
|
||||
CREATE TABLE finance_records
|
||||
@@ -168,11 +129,11 @@ CREATE TABLE finance_records
|
||||
currency VARCHAR(10) DEFAULT 'CNY',
|
||||
vendor VARCHAR(200),
|
||||
occurred_at DATETIME,
|
||||
recorded_by BIGINT UNSIGNED,
|
||||
recorded_by BIGINT UNSIGNED, -- 关联 account.id(记录人)
|
||||
note TEXT,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_finance_item FOREIGN KEY (related_item_id) REFERENCES items (id) ON DELETE SET NULL,
|
||||
CONSTRAINT fk_finance_user FOREIGN KEY (recorded_by) REFERENCES personnel (id) ON DELETE SET NULL,
|
||||
CONSTRAINT fk_finance_user FOREIGN KEY (recorded_by) REFERENCES account (id) ON DELETE SET NULL,
|
||||
INDEX (record_no)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='财务相关记录';
|
||||
@@ -194,35 +155,20 @@ CREATE TABLE email_notices
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='邮件通知规则/历史';
|
||||
|
||||
-- 评价/反馈(evaluation 模块对应)
|
||||
DROP TABLE IF EXISTS evaluations;
|
||||
CREATE TABLE evaluations
|
||||
(
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
related_item_id BIGINT UNSIGNED,
|
||||
evaluator_id BIGINT UNSIGNED,
|
||||
score TINYINT UNSIGNED, -- 1-5
|
||||
comment TEXT,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_evaluation_item FOREIGN KEY (related_item_id) REFERENCES items (id) ON DELETE SET NULL,
|
||||
CONSTRAINT fk_evaluation_user FOREIGN KEY (evaluator_id) REFERENCES personnel (id) ON DELETE SET NULL
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='物品/服务评价';
|
||||
|
||||
-- 附件表(文件存储路径)
|
||||
DROP TABLE IF EXISTS attachments;
|
||||
CREATE TABLE attachments
|
||||
(
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
related_table VARCHAR(100), -- 指示关联表,如 'items','memos'
|
||||
related_table VARCHAR(100), -- 指示关联表,如 'items'
|
||||
related_id BIGINT UNSIGNED, -- 关联记录 ID
|
||||
file_name VARCHAR(300),
|
||||
file_path VARCHAR(1000),
|
||||
file_size BIGINT UNSIGNED,
|
||||
content_type VARCHAR(200),
|
||||
uploaded_by BIGINT UNSIGNED,
|
||||
uploaded_by BIGINT UNSIGNED, -- 关联 account.id(上传者)
|
||||
uploaded_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_attachments_user FOREIGN KEY (uploaded_by) REFERENCES personnel (id) ON DELETE SET NULL,
|
||||
CONSTRAINT fk_attachments_user FOREIGN KEY (uploaded_by) REFERENCES account (id) ON DELETE SET NULL,
|
||||
INDEX (related_table, related_id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='文件附件存储索引表';
|
||||
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
package club.itstudio.itmanager.controller.v1
|
||||
|
||||
import club.itstudio.itmanager.utils.Const
|
||||
import org.springframework.validation.annotation.Validated
|
||||
import org.springframework.web.bind.annotation.*
|
||||
import reactor.core.publisher.Mono
|
||||
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/evaluation-records")
|
||||
class EvaluationRecordsController {
|
||||
|
||||
// evaluation-records/ GET/POST/PUT/DELETE 考评记录 CRUD 操作
|
||||
@GetMapping("", "/")
|
||||
fun getRecords(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
@PostMapping("", "/")
|
||||
fun createRecord(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
@PutMapping("", "/")
|
||||
fun updateRecord(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
@DeleteMapping("", "/")
|
||||
fun deleteRecord(@RequestParam(required = false) id: String?): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
// evaluation-records/personnel-summary/ GET 获取人员考评汇总
|
||||
@GetMapping("/personnel-summary", "/personnel-summary/")
|
||||
fun getPersonnelSummary(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
// evaluation-records/personnel-records/ GET 获取某个人员的所有考评记录
|
||||
@GetMapping("/personnel-records", "/personnel-records/")
|
||||
fun getPersonnelRecords(@RequestParam(required = false) personId: String?): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
// evaluation-records/delete-personnel/ DELETE 删除某个人员的所有考评记录
|
||||
@DeleteMapping("/delete-personnel", "/delete-personnel/")
|
||||
fun deletePersonnelRecords(@RequestParam(required = false) personId: String?): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
// evaluation-records/export/ GET 导出考评记录为 Excel
|
||||
@GetMapping("/export", "/export/")
|
||||
fun exportRecords(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
// evaluation-records/download-template/ GET 下载人员导入样表
|
||||
@GetMapping("/download-template", "/download-template/")
|
||||
fun downloadTemplate(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
// evaluation-records/import/ POST 导入考评记录
|
||||
@PostMapping("/import", "/import/")
|
||||
fun importRecords(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package club.itstudio.itmanager.controller.v1
|
||||
|
||||
import club.itstudio.itmanager.utils.Const
|
||||
import org.springframework.validation.annotation.Validated
|
||||
import org.springframework.web.bind.annotation.*
|
||||
import reactor.core.publisher.Mono
|
||||
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/memos")
|
||||
class MemosController {
|
||||
|
||||
// memos/ GET/POST/PUT/DELETE 备忘录 CRUD 操作
|
||||
@GetMapping("", "/")
|
||||
fun getMemos(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
@PostMapping("", "/")
|
||||
fun createMemo(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
@PutMapping("", "/")
|
||||
fun updateMemo(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
@DeleteMapping("", "/")
|
||||
fun deleteMemo(@RequestParam(required = false) id: String?): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
// memos/{id}/upload_image/ POST 上传备忘录图片
|
||||
@PostMapping("/{id}/upload_image", "/{id}/upload_image/")
|
||||
fun uploadImage(@PathVariable("id") id: String): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
// memos/{id}/delete_image/ DELETE 删除备忘录图片
|
||||
@DeleteMapping("/{id}/delete_image", "/{id}/delete_image/")
|
||||
fun deleteImage(@PathVariable("id") id: String): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
}
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
package club.itstudio.itmanager.controller.v1
|
||||
|
||||
import club.itstudio.itmanager.utils.Const
|
||||
import org.springframework.validation.annotation.Validated
|
||||
import org.springframework.web.bind.annotation.*
|
||||
import reactor.core.publisher.Mono
|
||||
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/personnel")
|
||||
class PersonnelController {
|
||||
|
||||
// personnel/ GET/POST/PUT/DELETE 人员信息 CRUD 操作
|
||||
@GetMapping("", "/")
|
||||
fun getPersonnel(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
@PostMapping("", "/")
|
||||
fun createPersonnel(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
@PutMapping("", "/")
|
||||
fun updatePersonnel(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
@DeleteMapping("", "/")
|
||||
fun deletePersonnel(@RequestParam(required = false) id: String?): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
// personnel/statistics/ GET 获取人员统计信息(按部门和职位)
|
||||
@GetMapping("/statistics", "/statistics/")
|
||||
fun getStatistics(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
// personnel/{id}/set_inactive/ POST 设置人员为已卸任状态
|
||||
@PostMapping("/{id}/set_inactive", "/{id}/set_inactive/")
|
||||
fun setInactive(@PathVariable("id") id: String): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
// personnel/{id}/set_active/ POST 设置人员为在职状态
|
||||
@PostMapping("/{id}/set_active", "/{id}/set_active/")
|
||||
fun setActive(@PathVariable("id") id: String): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
// personnel/{id}/ DELETE 删除人员(发送邮件通知)
|
||||
@DeleteMapping("/{id}", "/{id}/")
|
||||
fun deleteById(@PathVariable("id") id: String): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
// personnel/check_expired/ POST 检查并更新已到期的人员状态
|
||||
@PostMapping("/check_expired", "/check_expired/")
|
||||
fun checkExpired(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package club.itstudio.itmanager.controller.v1
|
||||
|
||||
import club.itstudio.itmanager.utils.Const
|
||||
import org.springframework.validation.annotation.Validated
|
||||
import org.springframework.web.bind.annotation.*
|
||||
import reactor.core.publisher.Mono
|
||||
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/project-groups")
|
||||
class ProjectGroupsController {
|
||||
|
||||
// project-groups/ GET/POST/PUT/DELETE 项目组 CRUD 操作
|
||||
@GetMapping("", "/")
|
||||
fun getProjectGroups(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
@PostMapping("", "/")
|
||||
fun createProjectGroup(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
@PutMapping("", "/")
|
||||
fun updateProjectGroup(): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
@DeleteMapping("", "/")
|
||||
fun deleteProjectGroup(@RequestParam(required = false) id: String?): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
// project-groups/by_department/ GET 按部门获取项目组
|
||||
@GetMapping("/by_department", "/by_department/")
|
||||
fun getByDepartment(@RequestParam(required = false) departmentId: String?): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
|
||||
// project-groups/{id}/ DELETE 删除项目组(发送邮件通知)
|
||||
@DeleteMapping("/{id}", "/{id}/")
|
||||
fun deleteById(@PathVariable("id") id: String): Mono<String> = Const.INTERNAL_ERROR_MONO
|
||||
}
|
||||
@@ -13,13 +13,13 @@ data class BorrowRecord(
|
||||
@TableId(type = IdType.AUTO)
|
||||
val id: Long? = null,
|
||||
val itemId: Long = 0,
|
||||
val borrowerId: Long = 0,
|
||||
val borrower: String = "",
|
||||
val quantity: Int = 1,
|
||||
val borrowDate: LocalDateTime? = null,
|
||||
val dueDate: LocalDateTime? = null,
|
||||
val returnDate: LocalDateTime? = null,
|
||||
val status: String = "BORROWED", // BORROWED / RETURNED / OVERDUE / CANCELED
|
||||
val approverId: Long? = null,
|
||||
val approver: String? = null,
|
||||
val note: String? = null,
|
||||
val createdAt: LocalDateTime? = null,
|
||||
val updatedAt: LocalDateTime? = null
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package club.itstudio.itmanager.entity.dto
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType
|
||||
import com.baomidou.mybatisplus.annotation.TableId
|
||||
import com.baomidou.mybatisplus.annotation.TableName
|
||||
import club.itstudio.itmanager.entity.DataCopy
|
||||
import kotlinx.datetime.LocalDateTime
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@TableName("evaluations")
|
||||
data class Evaluation(
|
||||
@TableId(type = IdType.AUTO)
|
||||
val id: Long? = null,
|
||||
val relatedItemId: Long? = null,
|
||||
val evaluatorId: Long? = null,
|
||||
val score: Short? = null, // 1-5
|
||||
val comment: String? = null,
|
||||
val createdAt: LocalDateTime? = null
|
||||
) : DataCopy
|
||||
@@ -1,22 +0,0 @@
|
||||
package club.itstudio.itmanager.entity.dto
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType
|
||||
import com.baomidou.mybatisplus.annotation.TableId
|
||||
import com.baomidou.mybatisplus.annotation.TableName
|
||||
import club.itstudio.itmanager.entity.DataCopy
|
||||
import kotlinx.datetime.LocalDateTime
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@TableName("memos")
|
||||
data class Memo(
|
||||
@TableId(type = IdType.AUTO)
|
||||
val id: Long? = null,
|
||||
val title: String? = null,
|
||||
val content: String? = null,
|
||||
val authorId: Long? = null,
|
||||
val relatedItemId: Long? = null,
|
||||
val isPublic: Boolean = false,
|
||||
val createdAt: LocalDateTime? = null,
|
||||
val updatedAt: LocalDateTime? = null
|
||||
) : DataCopy
|
||||
@@ -1,25 +0,0 @@
|
||||
package club.itstudio.itmanager.entity.dto
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType
|
||||
import com.baomidou.mybatisplus.annotation.TableId
|
||||
import com.baomidou.mybatisplus.annotation.TableName
|
||||
import club.itstudio.itmanager.entity.DataCopy
|
||||
import kotlinx.datetime.LocalDateTime
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@TableName("personnel")
|
||||
data class Personnel(
|
||||
@TableId(type = IdType.AUTO)
|
||||
val id: Long? = null,
|
||||
val userId: Long? = null,
|
||||
val employeeNo: String? = null,
|
||||
val name: String = "",
|
||||
val departmentId: Long? = null,
|
||||
val phone: String? = null,
|
||||
val email: String? = null,
|
||||
val role: String? = null,
|
||||
val isActive: Boolean = true,
|
||||
val createdAt: LocalDateTime? = null,
|
||||
val updatedAt: LocalDateTime? = null
|
||||
) : DataCopy
|
||||
@@ -1,8 +0,0 @@
|
||||
package club.itstudio.itmanager.mapper
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import club.itstudio.itmanager.entity.dto.Evaluation
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
|
||||
@Mapper
|
||||
interface EvaluationMapper : BaseMapper<Evaluation>
|
||||
@@ -1,8 +0,0 @@
|
||||
package club.itstudio.itmanager.mapper
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import club.itstudio.itmanager.entity.dto.Memo
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
|
||||
@Mapper
|
||||
interface MemoMapper : BaseMapper<Memo>
|
||||
@@ -1,8 +0,0 @@
|
||||
package club.itstudio.itmanager.mapper
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||
import club.itstudio.itmanager.entity.dto.Personnel
|
||||
import org.apache.ibatis.annotations.Mapper
|
||||
|
||||
@Mapper
|
||||
interface PersonnelMapper : BaseMapper<Personnel>
|
||||
@@ -7,7 +7,7 @@ import reactor.core.publisher.Mono
|
||||
interface BorrowRecordService : IService<BorrowRecord> {
|
||||
fun getBorrowRecordById(id: Long): Mono<BorrowRecord>
|
||||
fun listByItem(itemId: Long): Mono<List<BorrowRecord>>
|
||||
fun listByBorrower(borrowerId: Long): Mono<List<BorrowRecord>>
|
||||
fun listByBorrower(borrower: String): Mono<List<BorrowRecord>>
|
||||
fun listByStatus(status: String): Mono<List<BorrowRecord>>
|
||||
fun listOverdueRecords(): Mono<List<BorrowRecord>>
|
||||
fun createBorrowRecord(record: BorrowRecord): Mono<Boolean>
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package club.itstudio.itmanager.service
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import club.itstudio.itmanager.entity.dto.Evaluation
|
||||
import reactor.core.publisher.Mono
|
||||
|
||||
interface EvaluationService : IService<Evaluation> {
|
||||
fun getEvaluationById(id: Long): Mono<Evaluation>
|
||||
fun listByEvaluator(evaluatorId: Long): Mono<List<Evaluation>>
|
||||
fun listByRelatedItem(itemId: Long): Mono<List<Evaluation>>
|
||||
fun listByScore(score: Short): Mono<List<Evaluation>>
|
||||
fun createEvaluation(evaluation: Evaluation): Mono<Boolean>
|
||||
fun updateEvaluation(evaluation: Evaluation): Mono<Boolean>
|
||||
fun deleteEvaluation(id: Long): Mono<Boolean>
|
||||
fun deleteByEvaluator(evaluatorId: Long): Mono<Boolean>
|
||||
fun exportAllEvaluations(): Mono<List<Evaluation>>
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package club.itstudio.itmanager.service
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import club.itstudio.itmanager.entity.dto.Memo
|
||||
import reactor.core.publisher.Mono
|
||||
|
||||
interface MemoService : IService<Memo> {
|
||||
fun getMemoById(id: Long): Mono<Memo>
|
||||
fun searchMemos(keyword: String?): Mono<List<Memo>>
|
||||
fun listByAuthor(authorId: Long): Mono<List<Memo>>
|
||||
fun listByRelatedItem(itemId: Long): Mono<List<Memo>>
|
||||
fun listPublicMemos(): Mono<List<Memo>>
|
||||
fun createMemo(memo: Memo): Mono<Boolean>
|
||||
fun updateMemo(memo: Memo): Mono<Boolean>
|
||||
fun deleteMemo(id: Long): Mono<Boolean>
|
||||
fun exportAllMemos(): Mono<List<Memo>>
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package club.itstudio.itmanager.service
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService
|
||||
import club.itstudio.itmanager.entity.dto.Personnel
|
||||
import reactor.core.publisher.Mono
|
||||
|
||||
interface PersonnelService : IService<Personnel> {
|
||||
fun getPersonnelById(id: Long): Mono<Personnel>
|
||||
fun searchPersonnel(keyword: String?): Mono<List<Personnel>>
|
||||
fun listByDepartment(departmentId: Long): Mono<List<Personnel>>
|
||||
fun listByRole(role: String): Mono<List<Personnel>>
|
||||
fun createPersonnel(personnel: Personnel): Mono<Boolean>
|
||||
fun updatePersonnel(personnel: Personnel): Mono<Boolean>
|
||||
fun deletePersonnel(id: Long): Mono<Boolean>
|
||||
fun setActive(id: Long, active: Boolean): Mono<Boolean>
|
||||
fun exportAllPersonnel(): Mono<List<Personnel>>
|
||||
}
|
||||
+3
-3
@@ -30,10 +30,10 @@ class BorrowRecordServiceImpl : ServiceImpl<BorrowRecordMapper, BorrowRecord>(),
|
||||
ktQuery().eq(BorrowRecord::itemId, itemId).list()
|
||||
}
|
||||
|
||||
override fun listByBorrower(borrowerId: Long): Mono<List<BorrowRecord>> =
|
||||
override fun listByBorrower(borrower: String): Mono<List<BorrowRecord>> =
|
||||
blockingCall {
|
||||
logger.info("Searching borrow records by borrower id")
|
||||
ktQuery().eq(BorrowRecord::borrowerId, borrowerId).list()
|
||||
logger.info("Searching borrow records by borrower")
|
||||
ktQuery().eq(BorrowRecord::borrower, borrower).list()
|
||||
}
|
||||
|
||||
override fun listByStatus(status: String): Mono<List<BorrowRecord>> =
|
||||
|
||||
-74
@@ -1,74 +0,0 @@
|
||||
package club.itstudio.itmanager.service.impl
|
||||
|
||||
import club.itstudio.itmanager.entity.dto.Evaluation
|
||||
import club.itstudio.itmanager.mapper.EvaluationMapper
|
||||
import club.itstudio.itmanager.service.EvaluationService
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Service
|
||||
import reactor.core.publisher.Mono
|
||||
import reactor.core.scheduler.Schedulers
|
||||
import java.util.NoSuchElementException
|
||||
|
||||
@Service
|
||||
class EvaluationServiceImpl : ServiceImpl<EvaluationMapper, Evaluation>(), EvaluationService {
|
||||
|
||||
private val logger = LoggerFactory.getLogger(this::class.java)
|
||||
|
||||
private fun <T : Any> blockingCall(block: () -> T?): Mono<T> =
|
||||
Mono.fromCallable(block).subscribeOn(Schedulers.boundedElastic())
|
||||
|
||||
override fun getEvaluationById(id: Long): Mono<Evaluation> =
|
||||
blockingCall {
|
||||
logger.info("Searching evaluation by id")
|
||||
ktQuery().eq(Evaluation::id, id).one()
|
||||
}.switchIfEmpty(Mono.error(NoSuchElementException("Evaluation not found")))
|
||||
|
||||
override fun listByEvaluator(evaluatorId: Long): Mono<List<Evaluation>> =
|
||||
blockingCall {
|
||||
logger.info("Searching evaluations by evaluator id")
|
||||
ktQuery().eq(Evaluation::evaluatorId, evaluatorId).list()
|
||||
}
|
||||
|
||||
override fun listByRelatedItem(itemId: Long): Mono<List<Evaluation>> =
|
||||
blockingCall {
|
||||
logger.info("Searching evaluations by related item id")
|
||||
ktQuery().eq(Evaluation::relatedItemId, itemId).list()
|
||||
}
|
||||
|
||||
override fun listByScore(score: Short): Mono<List<Evaluation>> =
|
||||
blockingCall {
|
||||
logger.info("Searching evaluations by score")
|
||||
ktQuery().eq(Evaluation::score, score).list()
|
||||
}
|
||||
|
||||
override fun createEvaluation(evaluation: Evaluation): Mono<Boolean> =
|
||||
blockingCall {
|
||||
logger.info("Creating evaluation")
|
||||
save(evaluation)
|
||||
}
|
||||
|
||||
override fun updateEvaluation(evaluation: Evaluation): Mono<Boolean> =
|
||||
blockingCall {
|
||||
logger.info("Updating evaluation")
|
||||
updateById(evaluation)
|
||||
}
|
||||
|
||||
override fun deleteEvaluation(id: Long): Mono<Boolean> =
|
||||
blockingCall {
|
||||
logger.info("Deleting evaluation by id")
|
||||
removeById(id)
|
||||
}
|
||||
|
||||
override fun deleteByEvaluator(evaluatorId: Long): Mono<Boolean> =
|
||||
blockingCall {
|
||||
logger.info("Deleting evaluations by evaluator id")
|
||||
remove(ktQuery().eq(Evaluation::evaluatorId, evaluatorId))
|
||||
}
|
||||
|
||||
override fun exportAllEvaluations(): Mono<List<Evaluation>> =
|
||||
blockingCall {
|
||||
logger.info("Exporting all evaluations")
|
||||
list()
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package club.itstudio.itmanager.service.impl
|
||||
|
||||
import club.itstudio.itmanager.entity.dto.Memo
|
||||
import club.itstudio.itmanager.mapper.MemoMapper
|
||||
import club.itstudio.itmanager.service.MemoService
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Service
|
||||
import reactor.core.publisher.Mono
|
||||
import reactor.core.scheduler.Schedulers
|
||||
import java.util.NoSuchElementException
|
||||
|
||||
@Service
|
||||
class MemoServiceImpl : ServiceImpl<MemoMapper, Memo>(), MemoService {
|
||||
|
||||
private val logger = LoggerFactory.getLogger(this::class.java)
|
||||
|
||||
private fun <T : Any> blockingCall(block: () -> T?): Mono<T> =
|
||||
Mono.fromCallable(block).subscribeOn(Schedulers.boundedElastic())
|
||||
|
||||
override fun getMemoById(id: Long): Mono<Memo> =
|
||||
blockingCall {
|
||||
logger.info("Searching memo by id")
|
||||
ktQuery().eq(Memo::id, id).one()
|
||||
}.switchIfEmpty(Mono.error(NoSuchElementException("Memo not found")))
|
||||
|
||||
override fun searchMemos(keyword: String?): Mono<List<Memo>> =
|
||||
blockingCall {
|
||||
logger.info("Searching memos with keyword")
|
||||
if (keyword.isNullOrBlank()) {
|
||||
list()
|
||||
} else {
|
||||
ktQuery().and {
|
||||
it.like(Memo::title, keyword).or().like(Memo::content, keyword)
|
||||
}.list()
|
||||
}
|
||||
}
|
||||
|
||||
override fun listByAuthor(authorId: Long): Mono<List<Memo>> =
|
||||
blockingCall {
|
||||
logger.info("Searching memos by author id")
|
||||
ktQuery().eq(Memo::authorId, authorId).list()
|
||||
}
|
||||
|
||||
override fun listByRelatedItem(itemId: Long): Mono<List<Memo>> =
|
||||
blockingCall {
|
||||
logger.info("Searching memos by related item id")
|
||||
ktQuery().eq(Memo::relatedItemId, itemId).list()
|
||||
}
|
||||
|
||||
override fun listPublicMemos(): Mono<List<Memo>> =
|
||||
blockingCall {
|
||||
logger.info("Listing public memos")
|
||||
ktQuery().eq(Memo::isPublic, true).list()
|
||||
}
|
||||
|
||||
override fun createMemo(memo: Memo): Mono<Boolean> =
|
||||
blockingCall {
|
||||
logger.info("Creating memo")
|
||||
save(memo)
|
||||
}
|
||||
|
||||
override fun updateMemo(memo: Memo): Mono<Boolean> =
|
||||
blockingCall {
|
||||
logger.info("Updating memo")
|
||||
updateById(memo)
|
||||
}
|
||||
|
||||
override fun deleteMemo(id: Long): Mono<Boolean> =
|
||||
blockingCall {
|
||||
logger.info("Deleting memo by id")
|
||||
removeById(id)
|
||||
}
|
||||
|
||||
override fun exportAllMemos(): Mono<List<Memo>> =
|
||||
blockingCall {
|
||||
logger.info("Exporting all memos")
|
||||
list()
|
||||
}
|
||||
}
|
||||
-83
@@ -1,83 +0,0 @@
|
||||
package club.itstudio.itmanager.service.impl
|
||||
|
||||
import club.itstudio.itmanager.entity.dto.Personnel
|
||||
import club.itstudio.itmanager.mapper.PersonnelMapper
|
||||
import club.itstudio.itmanager.service.PersonnelService
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Service
|
||||
import reactor.core.publisher.Mono
|
||||
import reactor.core.scheduler.Schedulers
|
||||
import java.util.NoSuchElementException
|
||||
|
||||
@Service
|
||||
class PersonnelServiceImpl : ServiceImpl<PersonnelMapper, Personnel>(), PersonnelService {
|
||||
|
||||
private val logger = LoggerFactory.getLogger(this::class.java)
|
||||
|
||||
private fun <T : Any> blockingCall(block: () -> T?): Mono<T> =
|
||||
Mono.fromCallable(block).subscribeOn(Schedulers.boundedElastic())
|
||||
|
||||
override fun getPersonnelById(id: Long): Mono<Personnel> =
|
||||
blockingCall {
|
||||
logger.info("Searching personnel by id")
|
||||
ktQuery().eq(Personnel::id, id).one()
|
||||
}.switchIfEmpty(Mono.error(NoSuchElementException("Personnel not found")))
|
||||
|
||||
override fun searchPersonnel(keyword: String?): Mono<List<Personnel>> =
|
||||
blockingCall {
|
||||
logger.info("Searching personnel with keyword")
|
||||
if (keyword.isNullOrBlank()) {
|
||||
list()
|
||||
} else {
|
||||
ktQuery().and {
|
||||
it.like(Personnel::name, keyword)
|
||||
.or().like(Personnel::employeeNo, keyword)
|
||||
.or().like(Personnel::phone, keyword)
|
||||
.or().like(Personnel::email, keyword)
|
||||
}.list()
|
||||
}
|
||||
}
|
||||
|
||||
override fun listByDepartment(departmentId: Long): Mono<List<Personnel>> =
|
||||
blockingCall {
|
||||
logger.info("Searching personnel by department id")
|
||||
ktQuery().eq(Personnel::departmentId, departmentId).list()
|
||||
}
|
||||
|
||||
override fun listByRole(role: String): Mono<List<Personnel>> =
|
||||
blockingCall {
|
||||
logger.info("Searching personnel by role")
|
||||
ktQuery().eq(Personnel::role, role).list()
|
||||
}
|
||||
|
||||
override fun createPersonnel(personnel: Personnel): Mono<Boolean> =
|
||||
blockingCall {
|
||||
logger.info("Creating personnel")
|
||||
save(personnel)
|
||||
}
|
||||
|
||||
override fun updatePersonnel(personnel: Personnel): Mono<Boolean> =
|
||||
blockingCall {
|
||||
logger.info("Updating personnel")
|
||||
updateById(personnel)
|
||||
}
|
||||
|
||||
override fun deletePersonnel(id: Long): Mono<Boolean> =
|
||||
blockingCall {
|
||||
logger.info("Deleting personnel by id")
|
||||
removeById(id)
|
||||
}
|
||||
|
||||
override fun setActive(id: Long, active: Boolean): Mono<Boolean> =
|
||||
blockingCall {
|
||||
logger.info("Setting personnel active status")
|
||||
ktUpdate().eq(Personnel::id, id).set(Personnel::isActive, active).update()
|
||||
}
|
||||
|
||||
override fun exportAllPersonnel(): Mono<List<Personnel>> =
|
||||
blockingCall {
|
||||
logger.info("Exporting all personnel")
|
||||
list()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user