From 641266e549668778e87ed401add79eb6374d33c6 Mon Sep 17 00:00:00 2001 From: wangna0328 <3402195679@qq.com> Date: Wed, 30 Jul 2025 09:24:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E8=AE=A8=E8=AE=BA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/dto/RegulationDiscussionDTO.java | 20 -- .../dite/znpt/service/RegulationService.java | 31 -- .../service/impl/RegulationServiceImpl.java | 177 ++++------ doc/regulation_api_test.md | 306 ++++++++++++------ doc/regulation_module_readme.md | 15 +- doc/regulation_tables.sql | 28 +- doc/regulation_test_data.sql | 18 +- .../web/controller/RegulationController.java | 40 +-- 8 files changed, 327 insertions(+), 308 deletions(-) delete mode 100644 core/src/main/java/com/dite/znpt/domain/dto/RegulationDiscussionDTO.java diff --git a/core/src/main/java/com/dite/znpt/domain/dto/RegulationDiscussionDTO.java b/core/src/main/java/com/dite/znpt/domain/dto/RegulationDiscussionDTO.java deleted file mode 100644 index 7eead61..0000000 --- a/core/src/main/java/com/dite/znpt/domain/dto/RegulationDiscussionDTO.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.dite.znpt.domain.dto; - -import lombok.Data; -import java.time.LocalDateTime; - -/** - * 制度讨论DTO - * @author wangna - * @date 2025/07/29 - */ -@Data -public class RegulationDiscussionDTO { - - private String id; - private String regulationId; - private String authorId; - private String authorName; - private String content; - private LocalDateTime createTime; -} \ No newline at end of file diff --git a/core/src/main/java/com/dite/znpt/service/RegulationService.java b/core/src/main/java/com/dite/znpt/service/RegulationService.java index dc22557..5ad0ae0 100644 --- a/core/src/main/java/com/dite/znpt/service/RegulationService.java +++ b/core/src/main/java/com/dite/znpt/service/RegulationService.java @@ -3,7 +3,6 @@ package com.dite.znpt.service; import com.baomidou.mybatisplus.extension.service.IService; import com.dite.znpt.domain.entity.RegulationEntity; import com.dite.znpt.domain.Result; -import com.dite.znpt.domain.dto.RegulationDiscussionDTO; import com.dite.znpt.domain.dto.RegulationConfirmDTO; /** @@ -44,35 +43,6 @@ public interface RegulationService extends IService { */ Result getRegulationDetail(String regulationId); - /** - * 获取讨论列表 - * @param regulationId 制度ID - * @return 结果 - */ - Result getRegulationDiscussions(String regulationId); - - /** - * 创建讨论 - * @param discussion 讨论信息 - * @return 结果 - */ - Result createDiscussion(RegulationDiscussionDTO discussion); - - /** - * 发布制度 - * @param regulationId 制度ID - * @return 结果 - */ - Result publishRegulation(String regulationId); - - /** - * 获取已发布制度列表 - * @param page 页码 - * @param size 页大小 - * @return 结果 - */ - Result getPublishedRegulations(Integer page, Integer size); - /** * 确认制度知晓 * @param regulationId 制度ID @@ -81,5 +51,4 @@ public interface RegulationService extends IService { */ Result confirmRegulation(String regulationId, RegulationConfirmDTO confirm); - } \ No newline at end of file diff --git a/core/src/main/java/com/dite/znpt/service/impl/RegulationServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/RegulationServiceImpl.java index 836bb5f..868576a 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/RegulationServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/RegulationServiceImpl.java @@ -1,22 +1,21 @@ package com.dite.znpt.service.impl; -import cn.dev33.satoken.stp.StpUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.dite.znpt.domain.Result; import com.dite.znpt.domain.entity.RegulationEntity; import com.dite.znpt.domain.entity.RegulationConfirmationEntity; -import com.dite.znpt.domain.dto.RegulationDiscussionDTO; import com.dite.znpt.domain.dto.RegulationConfirmDTO; import com.dite.znpt.domain.vo.UserResp; import com.dite.znpt.mapper.RegulationMapper; -import com.dite.znpt.service.RegulationConfirmationService; import com.dite.znpt.service.RegulationService; +import com.dite.znpt.service.RegulationConfirmationService; import com.dite.znpt.service.UserService; -import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; + import com.dite.znpt.mapper.RegulationDraftMapper; import com.dite.znpt.domain.entity.RegulationDraftEntity; import org.springframework.scheduling.annotation.Scheduled; @@ -24,14 +23,12 @@ import org.springframework.beans.factory.annotation.Autowired; import java.util.List; import java.time.LocalDateTime; - /** * @author wangna * @date 2025/07/29 - * @Description: 制度规范仓库服务实现类 + * @Description: 制度规范仓库Service实现类 */ @Service -@RequiredArgsConstructor public class RegulationServiceImpl extends ServiceImpl implements RegulationService { private final RegulationConfirmationService regulationConfirmationService; @@ -57,24 +54,44 @@ public class RegulationServiceImpl extends ServiceImpl pageParam = new Page<>(page, pageSize); LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(RegulationEntity::getDelFlag, "0"); if (status != null && !status.isEmpty()) { wrapper.eq(RegulationEntity::getStatus, status); } - if (type != null && !type.isEmpty()) { wrapper.eq(RegulationEntity::getRegulationType, type); } - + wrapper.eq(RegulationEntity::getDelFlag, "0"); wrapper.orderByDesc(RegulationEntity::getCreateTime); Page result = this.page(pageParam, wrapper); + + // 如果是获取已发布的制度,需要添加确认状态 + if (status != null && "PUBLISHED".equals(status)) { + String userId = cn.dev33.satoken.stp.StpUtil.getLoginIdAsString(); + java.util.List confirmedIds = regulationConfirmationService.lambdaQuery() + .eq(RegulationConfirmationEntity::getConfirmerId, userId) + .eq(RegulationConfirmationEntity::getStatus, "CONFIRMED") + .eq(RegulationConfirmationEntity::getDelFlag, "0") + .list() + .stream() + .map(RegulationConfirmationEntity::getRegulationId) + .toList(); + for (RegulationEntity reg : result.getRecords()) { + reg.setConfirmStatus(confirmedIds.contains(reg.getRegulationId()) ? "confirmed" : "pending"); + } + } + return Result.ok(result); } catch (Exception e) { return Result.error("获取制度列表失败:" + e.getMessage()); @@ -85,28 +102,14 @@ public class RegulationServiceImpl extends ServiceImpl pageParam = new Page<>(page, size); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(RegulationEntity::getDelFlag, "0"); - wrapper.eq(RegulationEntity::getStatus, "PUBLISHED"); - wrapper.orderByDesc(RegulationEntity::getPublishTime); - Page result = this.page(pageParam, wrapper); - // 查询当前用户所有确认记录 - java.util.List confirmedIds = regulationConfirmationService.lambdaQuery() - .eq(RegulationConfirmationEntity::getConfirmerId, userId) - .eq(RegulationConfirmationEntity::getStatus, "CONFIRMED") + // 检查是否已经确认过 + RegulationConfirmationEntity existingConfirmation = regulationConfirmationService.lambdaQuery() + .eq(RegulationConfirmationEntity::getRegulationId, regulationId) + .eq(RegulationConfirmationEntity::getConfirmerId, cn.dev33.satoken.stp.StpUtil.getLoginIdAsString()) .eq(RegulationConfirmationEntity::getDelFlag, "0") - .list() - .stream() - .map(RegulationConfirmationEntity::getRegulationId) - .toList(); - for (RegulationEntity reg : result.getRecords()) { - reg.setConfirmStatus(confirmedIds.contains(reg.getRegulationId()) ? "confirmed" : "pending"); - } - return Result.ok(result); - } catch (Exception e) { - return Result.error("获取已发布制度列表失败:" + e.getMessage()); - } - } - - @Override - @Transactional(rollbackFor = Exception.class) - public Result confirmRegulation(String regulationId, RegulationConfirmDTO confirm) { - try { - if (!confirm.getAgreeTerms()) { - return Result.error("必须同意条款才能确认"); + .one(); + + if (existingConfirmation != null) { + return Result.error("您已经确认过该制度"); } - String userId = StpUtil.getLoginIdAsString(); - UserResp user = userService.detail(userId); - + // 创建确认记录 RegulationConfirmationEntity confirmation = new RegulationConfirmationEntity(); + confirmation.setConfirmationId(java.util.UUID.randomUUID().toString()); confirmation.setRegulationId(regulationId); - confirmation.setConfirmerId(userId); - confirmation.setConfirmerName(user != null ? user.getName() : null); - confirmation.setConfirmerDept(user != null ? user.getDeptName() : null); + confirmation.setConfirmerId(cn.dev33.satoken.stp.StpUtil.getLoginIdAsString()); + + UserResp user = userService.detail(cn.dev33.satoken.stp.StpUtil.getLoginIdAsString()); + if (user != null) { + confirmation.setConfirmerName(user.getName()); + confirmation.setConfirmerDept(user.getDeptName()); + } + confirmation.setStatus("CONFIRMED"); confirmation.setConfirmTime(LocalDateTime.now()); + confirmation.setCreateTime(LocalDateTime.now()); + confirmation.setCreateBy(cn.dev33.satoken.stp.StpUtil.getLoginIdAsString()); + confirmation.setUpdateTime(LocalDateTime.now()); + confirmation.setUpdateBy(cn.dev33.satoken.stp.StpUtil.getLoginIdAsString()); confirmation.setDelFlag("0"); - return regulationConfirmationService.confirmRegulation(confirmation); + regulationConfirmationService.save(confirmation); + return Result.okM("制度确认成功"); } catch (Exception e) { - return Result.error("确认制度失败:" + e.getMessage()); + return Result.error("制度确认失败:" + e.getMessage()); } } diff --git a/doc/regulation_api_test.md b/doc/regulation_api_test.md index e3dd50f..d91afe6 100644 --- a/doc/regulation_api_test.md +++ b/doc/regulation_api_test.md @@ -180,66 +180,7 @@ } ``` -## 6. 获取讨论列表 - -### 请求信息 -- **URL**: `GET /api/regulation/{regulationId}/discussions` -- **Method**: GET - -### 响应格式 -```json -{ - "status": 200, - "data": [ - { - "id": "1", - "regulationId": "reg001", - "authorId": "2", - "authorName": "李四", - "content": "这个提案很有建设性,建议增加一些具体的实施细则。", - "createTime": "2024-01-01 11:00:00" - }, - { - "id": "2", - "regulationId": "reg001", - "authorId": "3", - "authorName": "王五", - "content": "同意这个提案,但需要考虑实施成本。", - "createTime": "2024-01-01 14:30:00" - } - ] -} -``` - -## 7. 发表评论 - -### 请求信息 -- **URL**: `POST /api/regulation/{regulationId}/discussions` -- **Content-Type**: `application/json` - -### 请求参数 -```json -{ - "content": "这个提案很有建设性,建议增加一些具体的实施细则。" -} -``` - -### 响应格式 -```json -{ - "status": 200, - "data": { - "id": "3", - "regulationId": "reg001", - "authorId": "1", - "authorName": "当前用户", - "content": "这个提案很有建设性,建议增加一些具体的实施细则。", - "createTime": "2024-01-25 10:30:00" - } -} -``` - -## 8. 提交投票 +## 6. 提交投票 ### 请求信息 - **URL**: `POST /api/regulation/{regulationId}/vote` @@ -263,7 +204,7 @@ } ``` -## 9. 获取投票结果 +## 7. 获取投票结果 ### 请求信息 - **URL**: `GET /api/regulation/{regulationId}/vote-result` @@ -284,7 +225,7 @@ } ``` -## 10. 发布制度 +## 8. 发布制度 ### 请求信息 - **URL**: `POST /api/regulation/{regulationId}/publish` @@ -294,21 +235,19 @@ ```json { "status": 200, - "data": { - "success": true - } + "message": "制度发布成功" } ``` -## 11. 获取已发布制度列表 +## 9. 获取已发布制度列表 ### 请求信息 - **URL**: `GET /api/regulation/published?page=1&size=10` - **Method**: GET ### 请求参数 -- `page`: 页码(必填) -- `size`: 页大小(必填) +- `page`: 页码(默认1) +- `size`: 页大小(默认10) ### 响应格式 ```json @@ -317,36 +256,22 @@ "data": { "records": [ { - "regulationId": "reg002", - "title": "财务报销流程简化提案", - "content": "建议简化财务报销流程,提高工作效率...", - "regulationType": "财务制度", + "regulationId": "reg001", + "title": "员工考勤管理制度", + "content": "规范员工考勤管理...", "status": "PUBLISHED", - "publisherId": "2", - "publisherName": "李四", - "publishTime": "2024-01-15T14:30:00", - "effectiveTime": "2024-01-15T14:30:00", - "expireTime": "2024-12-31T23:59:59", - "scope": "财务部门及相关员工", - "level": "HIGH", - "version": "1.0", - "remark": "已获得财务部门支持", - "createBy": "admin", - "updateBy": "admin", - "createTime": "2024-01-15 14:30:00", - "updateTime": "2024-01-15 14:30:00", - "confirmStatus": "pending" // pending: 待确认, confirmed: 已确认 + "publishTime": "2024-01-01T12:00:00", + "confirmStatus": "pending" } ], - "total": 2, + "total": 1, "size": 10, - "current": 1, - "pages": 1 + "current": 1 } } ``` -## 12. 确认制度知晓 +## 10. 确认制度知晓 ### 请求信息 - **URL**: `POST /api/regulation/{regulationId}/confirm` @@ -355,7 +280,7 @@ ### 请求参数 ```json { - "agreeTerms": true + "confirmComment": "已阅读并同意遵守该制度" } ``` @@ -363,29 +288,216 @@ ```json { "status": 200, - "data": { - "success": true - } + "message": "制度确认成功" } ``` -## 13. 批量确认制度 +## 11. 批量确认制度 ### 请求信息 - **URL**: `POST /api/regulation/confirm-all` - **Method**: POST +### 响应格式 +```json +{ + "status": 200, + "message": "批量确认成功" +} +``` + +--- + +# 制度类型管理API + +## 1. 获取制度类型列表 + +### 请求信息 +- **URL**: `GET /api/regulation-type?parentId=type_001` +- **Method**: GET + +### 请求参数 +- `parentId`: 父类型ID(可选) + +### 响应格式 +```json +{ + "status": 200, + "data": [ + { + "typeId": "type_005", + "typeName": "考勤管理", + "typeCode": "ATTENDANCE", + "description": "员工考勤相关制度", + "parentId": "type_001", + "level": 2, + "sortOrder": 1, + "isEnabled": "1", + "icon": "clock-circle", + "color": "#1890ff", + "remark": "考勤管理子类型", + "createTime": "2024-01-01 10:00:00", + "updateTime": "2024-01-01 10:00:00" + } + ] +} +``` + +## 2. 获取制度类型树 + +### 请求信息 +- **URL**: `GET /api/regulation-type/tree` +- **Method**: GET + +### 响应格式 +```json +{ + "status": 200, + "data": [ + { + "typeId": "type_001", + "typeName": "人事制度", + "typeCode": "HR", + "description": "人力资源管理相关制度", + "parentId": null, + "level": 1, + "sortOrder": 1, + "isEnabled": "1", + "icon": "user", + "color": "#1890ff", + "children": [ + { + "typeId": "type_005", + "typeName": "考勤管理", + "typeCode": "ATTENDANCE", + "description": "员工考勤相关制度", + "parentId": "type_001", + "level": 2, + "sortOrder": 1, + "isEnabled": "1", + "icon": "clock-circle", + "color": "#1890ff" + } + ] + } + ] +} +``` + +## 3. 创建制度类型 + +### 请求信息 +- **URL**: `POST /api/regulation-type` +- **Content-Type**: `application/json` + +### 请求参数 +```json +{ + "typeName": "新制度类型", + "typeCode": "NEW_TYPE", + "description": "新制度类型描述", + "parentId": "type_001", + "level": 2, + "sortOrder": 3, + "isEnabled": "1", + "icon": "star", + "color": "#f5222d", + "remark": "新制度类型备注" +} +``` + +### 响应格式 +```json +{ + "status": 200, + "message": "制度类型创建成功" +} +``` + +## 4. 更新制度类型 + +### 请求信息 +- **URL**: `PUT /api/regulation-type/type_001` +- **Content-Type**: `application/json` + +### 请求参数 +```json +{ + "typeName": "更新后的制度类型", + "typeCode": "UPDATED_TYPE", + "description": "更新后的描述", + "icon": "star", + "color": "#f5222d" +} +``` + +### 响应格式 +```json +{ + "status": 200, + "message": "制度类型更新成功" +} +``` + +## 5. 删除制度类型 + +### 请求信息 +- **URL**: `DELETE /api/regulation-type/type_001` +- **Method**: DELETE + +### 响应格式 +```json +{ + "status": 200, + "message": "制度类型删除成功" +} +``` + +## 6. 获取制度类型详情 + +### 请求信息 +- **URL**: `GET /api/regulation-type/type_001` +- **Method**: GET + ### 响应格式 ```json { "status": 200, "data": { - "success": true, - "confirmedCount": 5 + "typeId": "type_001", + "typeName": "人事制度", + "typeCode": "HR", + "description": "人力资源管理相关制度", + "parentId": null, + "level": 1, + "sortOrder": 1, + "isEnabled": "1", + "icon": "user", + "color": "#1890ff", + "remark": "人事管理相关制度", + "createTime": "2024-01-01 10:00:00", + "updateTime": "2024-01-01 10:00:00" } } ``` +## 7. 启用/禁用制度类型 + +### 请求信息 +- **URL**: `PUT /api/regulation-type/type_001/status?isEnabled=0` +- **Method**: PUT + +### 请求参数 +- `isEnabled`: 是否启用(1-启用,0-禁用) + +### 响应格式 +```json +{ + "status": 200, + "message": "制度类型禁用成功" +} +``` + ## 测试步骤 1. **执行建表语句**: 运行 `regulation_tables.sql` diff --git a/doc/regulation_module_readme.md b/doc/regulation_module_readme.md index 3fe0bf3..496356f 100644 --- a/doc/regulation_module_readme.md +++ b/doc/regulation_module_readme.md @@ -2,7 +2,7 @@ ## 概述 -制度模块是一个完整的企业制度管理系统,包含制度规范仓库、制度草案、个人制度提案等功能,支持讨论、投票、发布等完整的制度管理流程。 +制度模块是一个完整的企业制度管理系统,包含制度规范仓库、制度草案、个人制度提案等功能,支持投票、发布等完整的制度管理流程。 ## 功能模块 @@ -29,7 +29,7 @@ ### 2. 制度草案 (RegulationDraftEntity) -**功能描述:** 制度草案管理,包含讨论、投票、发布过程 +**功能描述:** 制度草案管理,包含投票、发布过程 **主要功能:** - 草案创建和编辑 @@ -48,22 +48,19 @@ ### 3. 制度提案 (RegulationProposalEntity) -**功能描述:** 个人制度提案,支持小组讨论 +**功能描述:** 个人制度提案,支持审核和转为草案 **主要功能:** - 提案提交 -- 讨论组管理 -- 讨论结果统计 - 提案审核 - 提案转为草案 **核心字段:** - `proposal_id`: 提案ID - `proposer_id`: 提案人ID -- `discussion_group_id`: 讨论组ID -- `discussion_status`: 讨论状态 -- `support_count`: 支持人数 -- `oppose_count`: 反对人数 +- `status`: 提案状态 +- `reviewer_id`: 审核人ID +- `converted_draft_id`: 转为草案ID ### 4. 制度投票 (RegulationVoteEntity) diff --git a/doc/regulation_tables.sql b/doc/regulation_tables.sql index dbce1b9..053dfcf 100644 --- a/doc/regulation_tables.sql +++ b/doc/regulation_tables.sql @@ -125,4 +125,30 @@ CREATE TABLE `regulation_confirmation` ( KEY `idx_confirmer` (`confirmer_id`), KEY `idx_status` (`status`), KEY `idx_confirm_time` (`confirm_time`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='制度确认'; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='制度确认'; + +-- 制度类型表 +CREATE TABLE `regulation_type` ( + `type_id` varchar(64) NOT NULL COMMENT '类型ID', + `type_name` varchar(100) NOT NULL COMMENT '类型名称', + `type_code` varchar(50) NOT NULL COMMENT '类型编码', + `description` text COMMENT '类型描述', + `parent_id` varchar(64) DEFAULT NULL COMMENT '父类型ID', + `level` int DEFAULT 1 COMMENT '层级(1-一级,2-二级,3-三级)', + `sort_order` int DEFAULT 0 COMMENT '排序号', + `is_enabled` char(1) DEFAULT '1' COMMENT '是否启用(0-禁用,1-启用)', + `icon` varchar(100) DEFAULT NULL COMMENT '图标', + `color` varchar(20) DEFAULT NULL COMMENT '颜色', + `remark` text COMMENT '备注', + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人', + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在,1代表删除)', + PRIMARY KEY (`type_id`), + UNIQUE KEY `uk_type_code` (`type_code`), + KEY `idx_parent_id` (`parent_id`), + KEY `idx_level` (`level`), + KEY `idx_sort_order` (`sort_order`), + KEY `idx_is_enabled` (`is_enabled`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='制度类型'; \ No newline at end of file diff --git a/doc/regulation_test_data.sql b/doc/regulation_test_data.sql index ad9567e..80fed49 100644 --- a/doc/regulation_test_data.sql +++ b/doc/regulation_test_data.sql @@ -30,6 +30,18 @@ INSERT INTO `regulation_proposal` (`proposal_id`, `regulation_id`, `title`, `des ('proposal_002', 'reg006', '数据安全管理制度', '为保护公司数据安全,防止数据泄露,需要制定数据安全管理制度...', '安全制度', 'PENDING', '2', '张三', '技术部', '1', '管理员', 'PENDING', NULL, NULL, 'HIGH', 'admin', '2024-01-28 09:00:00', 'admin', '2024-01-28 09:00:00', '数据安全管理提案', '0'); -- 插入制度确认数据 -INSERT INTO `regulation_confirmation` (`confirmation_id`, `regulation_id`, `confirmer_id`, `confirmer_name`, `confirmer_dept`, `status`, `confirm_time`, `confirm_comment`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`, `del_flag`) VALUES -('confirm_001', 'reg002', '2', '张三', '技术部', 'CONFIRMED', '2024-01-16 10:00:00', '已阅读并确认知晓', 'admin', '2024-01-16 10:00:00', 'admin', '2024-01-16 10:00:00', '财务报销制度确认', '0'), -('confirm_002', 'reg002', '3', '李四', '财务部', 'CONFIRMED', '2024-01-21 15:00:00', '已阅读并确认知晓', 'admin', '2024-01-21 15:00:00', 'admin', '2024-01-21 15:00:00', '财务报销制度确认', '0'); \ No newline at end of file +INSERT INTO `regulation_confirmation` (`confirmation_id`, `regulation_id`, `regulation_title`, `confirmer_id`, `confirmer_name`, `confirmer_dept`, `status`, `confirm_time`, `confirm_comment`, `read_duration`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`, `del_flag`) VALUES +('confirm_001', 'reg001', '员工考勤管理制度', '2', '李四', '技术部', 'CONFIRMED', '2024-01-02 10:00:00', '已阅读并同意遵守该制度', 120, 'admin', '2024-01-02 10:00:00', 'admin', '2024-01-02 10:00:00', '员工考勤制度确认', '0'), +('confirm_002', 'reg001', '员工考勤管理制度', '3', '王五', '人事部', 'CONFIRMED', '2024-01-02 14:30:00', '已确认知晓', 90, 'admin', '2024-01-02 14:30:00', 'admin', '2024-01-02 14:30:00', '员工考勤制度确认', '0'), +('confirm_003', 'reg002', '财务报销流程简化提案', '1', '张三', '财务部', 'PENDING', NULL, NULL, 0, 'admin', '2024-01-15 15:00:00', 'admin', '2024-01-15 15:00:00', '财务制度确认', '0'); + +-- 插入制度类型数据 +INSERT INTO `regulation_type` (`type_id`, `type_name`, `type_code`, `description`, `parent_id`, `level`, `sort_order`, `is_enabled`, `icon`, `color`, `remark`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`) VALUES +('type_001', '人事制度', 'HR', '人力资源管理相关制度', NULL, 1, 1, '1', 'user', '#1890ff', '人事管理相关制度', 'admin', '2024-01-01 10:00:00', 'admin', '2024-01-01 10:00:00', '人事制度类型', '0'), +('type_002', '财务制度', 'FINANCE', '财务管理相关制度', NULL, 1, 2, '1', 'dollar', '#52c41a', '财务管理相关制度', 'admin', '2024-01-01 10:00:00', 'admin', '2024-01-01 10:00:00', '财务制度类型', '0'), +('type_003', '安全制度', 'SAFETY', '安全管理相关制度', NULL, 1, 3, '1', 'shield', '#faad14', '安全管理相关制度', 'admin', '2024-01-01 10:00:00', 'admin', '2024-01-01 10:00:00', '安全制度类型', '0'), +('type_004', '设备制度', 'EQUIPMENT', '设备管理相关制度', NULL, 1, 4, '1', 'tool', '#722ed1', '设备管理相关制度', 'admin', '2024-01-01 10:00:00', 'admin', '2024-01-01 10:00:00', '设备制度类型', '0'), +('type_005', '考勤管理', 'ATTENDANCE', '员工考勤相关制度', 'type_001', 2, 1, '1', 'clock-circle', '#1890ff', '考勤管理子类型', 'admin', '2024-01-01 10:00:00', 'admin', '2024-01-01 10:00:00', '考勤管理子类型', '0'), +('type_006', '薪酬管理', 'SALARY', '员工薪酬相关制度', 'type_001', 2, 2, '1', 'wallet', '#1890ff', '薪酬管理子类型', 'admin', '2024-01-01 10:00:00', 'admin', '2024-01-01 10:00:00', '薪酬管理子类型', '0'), +('type_007', '报销管理', 'EXPENSE', '费用报销相关制度', 'type_002', 2, 1, '1', 'file-text', '#52c41a', '报销管理子类型', 'admin', '2024-01-01 10:00:00', 'admin', '2024-01-01 10:00:00', '报销管理子类型', '0'), +('type_008', '预算管理', 'BUDGET', '预算管理相关制度', 'type_002', 2, 2, '1', 'calculator', '#52c41a', '预算管理子类型', 'admin', '2024-01-01 10:00:00', 'admin', '2024-01-01 10:00:00', '预算管理子类型', '0'); \ No newline at end of file diff --git a/web/src/main/java/com/dite/znpt/web/controller/RegulationController.java b/web/src/main/java/com/dite/znpt/web/controller/RegulationController.java index be4074d..aa7cfcd 100644 --- a/web/src/main/java/com/dite/znpt/web/controller/RegulationController.java +++ b/web/src/main/java/com/dite/znpt/web/controller/RegulationController.java @@ -2,7 +2,6 @@ package com.dite.znpt.web.controller; import com.dite.znpt.domain.Result; import com.dite.znpt.domain.entity.RegulationEntity; -import com.dite.znpt.domain.dto.RegulationDiscussionDTO; import com.dite.znpt.domain.dto.RegulationConfirmDTO; import com.dite.znpt.service.RegulationService; import io.swagger.annotations.Api; @@ -10,7 +9,12 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -@Api(tags = "制度规范") +/** + * @author wangna + * @date 2025/07/29 + * @Description: 制度规范仓库Controller + */ +@Api(tags = "制度管理") @RestController @RequestMapping("/regulation") public class RegulationController { @@ -20,8 +24,11 @@ public class RegulationController { @ApiOperation(value = "获取制度列表", httpMethod = "GET") @GetMapping - public Result getRegulationList(@RequestParam int page, @RequestParam int size) { - return regulationService.getRegulationList(page, size, null, null); + public Result getRegulationList(@RequestParam(defaultValue = "1") int page, + @RequestParam(defaultValue = "10") int size, + @RequestParam(required = false) String status, + @RequestParam(required = false) String type) { + return regulationService.getRegulationList(page, size, status, type); } @ApiOperation(value = "创建制度提案", httpMethod = "POST") @@ -43,31 +50,6 @@ public class RegulationController { return regulationService.getRegulationDetail(regulationId); } - @ApiOperation(value = "获取讨论列表", httpMethod = "GET") - @GetMapping("/{regulationId}/discussions") - public Result getRegulationDiscussions(@PathVariable String regulationId) { - return regulationService.getRegulationDiscussions(regulationId); - } - - @ApiOperation(value = "发表评论", httpMethod = "POST") - @PostMapping("/{regulationId}/discussions") - public Result createDiscussion(@PathVariable String regulationId, @RequestBody RegulationDiscussionDTO discussion) { - discussion.setRegulationId(regulationId); - return regulationService.createDiscussion(discussion); - } - - @ApiOperation(value = "发布制度", httpMethod = "POST") - @PostMapping("/{regulationId}/publish") - public Result publishRegulation(@PathVariable String regulationId) { - return regulationService.publishRegulation(regulationId); - } - - @ApiOperation(value = "获取已发布制度列表", httpMethod = "GET") - @GetMapping("/published") - public Result getPublishedRegulations(@RequestParam int page, @RequestParam int size) { - return regulationService.getPublishedRegulations(page, size); - } - @ApiOperation(value = "确认制度知晓", httpMethod = "POST") @PostMapping("/{regulationId}/confirm") public Result confirmRegulation(@PathVariable String regulationId, @RequestBody RegulationConfirmDTO confirm) {