移除讨论功能
This commit is contained in:
parent
d10cd352b0
commit
641266e549
|
@ -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;
|
||||
}
|
|
@ -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<RegulationEntity> {
|
|||
*/
|
||||
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<RegulationEntity> {
|
|||
*/
|
||||
Result confirmRegulation(String regulationId, RegulationConfirmDTO confirm);
|
||||
|
||||
|
||||
}
|
|
@ -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<RegulationMapper, RegulationEntity> implements RegulationService {
|
||||
|
||||
private final RegulationConfirmationService regulationConfirmationService;
|
||||
|
@ -57,24 +54,44 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
|
|||
}
|
||||
}
|
||||
|
||||
public RegulationServiceImpl(RegulationConfirmationService regulationConfirmationService, UserService userService) {
|
||||
this.regulationConfirmationService = regulationConfirmationService;
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getRegulationList(Integer page, Integer pageSize, String status, String type) {
|
||||
try {
|
||||
Page<RegulationEntity> pageParam = new Page<>(page, pageSize);
|
||||
LambdaQueryWrapper<RegulationEntity> 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<RegulationEntity> result = this.page(pageParam, wrapper);
|
||||
|
||||
// 如果是获取已发布的制度,需要添加确认状态
|
||||
if (status != null && "PUBLISHED".equals(status)) {
|
||||
String userId = cn.dev33.satoken.stp.StpUtil.getLoginIdAsString();
|
||||
java.util.List<String> 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<RegulationMapper, Regulat
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result createRegulationProposal(RegulationEntity regulation) {
|
||||
try {
|
||||
// 设置初始状态为草稿
|
||||
regulation.setRegulationId(java.util.UUID.randomUUID().toString());
|
||||
regulation.setStatus("DRAFT");
|
||||
regulation.setCreateTime(LocalDateTime.now());
|
||||
regulation.setCreateBy(cn.dev33.satoken.stp.StpUtil.getLoginIdAsString());
|
||||
regulation.setUpdateTime(LocalDateTime.now());
|
||||
regulation.setUpdateBy(cn.dev33.satoken.stp.StpUtil.getLoginIdAsString());
|
||||
regulation.setDelFlag("0");
|
||||
|
||||
// 设置创建时间和更新时间
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
regulation.setCreateTime(now);
|
||||
regulation.setUpdateTime(now);
|
||||
|
||||
// 设置创建人信息
|
||||
String userId = StpUtil.getLoginIdAsString();
|
||||
regulation.setCreateBy(userId);
|
||||
regulation.setUpdateBy(userId);
|
||||
|
||||
// 获取当前用户信息
|
||||
UserResp user = userService.detail(userId);
|
||||
if (user != null) {
|
||||
regulation.setPublisherId(userId);
|
||||
regulation.setPublisherName(user.getName());
|
||||
}
|
||||
|
||||
// 保存制度
|
||||
this.save(regulation);
|
||||
return Result.okM("制度提案创建成功");
|
||||
} catch (Exception e) {
|
||||
|
@ -124,7 +127,7 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
|
|||
}
|
||||
|
||||
regulation.setUpdateTime(LocalDateTime.now());
|
||||
regulation.setUpdateBy(StpUtil.getLoginIdAsString());
|
||||
regulation.setUpdateBy(cn.dev33.satoken.stp.StpUtil.getLoginIdAsString());
|
||||
this.updateById(regulation);
|
||||
return Result.okM("制度提案更新成功");
|
||||
} catch (Exception e) {
|
||||
|
@ -145,112 +148,50 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getRegulationDiscussions(String regulationId) {
|
||||
try {
|
||||
// 这里应该调用讨论服务获取讨论列表
|
||||
// 暂时返回模拟数据
|
||||
return Result.ok("讨论列表功能待实现");
|
||||
} catch (Exception e) {
|
||||
return Result.error("获取讨论列表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result createDiscussion(RegulationDiscussionDTO discussion) {
|
||||
try {
|
||||
// 设置讨论信息
|
||||
discussion.setId(java.util.UUID.randomUUID().toString());
|
||||
discussion.setAuthorId(StpUtil.getLoginIdAsString());
|
||||
|
||||
UserResp user = userService.detail(discussion.getAuthorId());
|
||||
if (user != null) {
|
||||
discussion.setAuthorName(user.getName());
|
||||
}
|
||||
|
||||
discussion.setCreateTime(LocalDateTime.now());
|
||||
|
||||
// 这里应该保存讨论到数据库
|
||||
// 暂时返回成功
|
||||
return Result.okM("评论发表成功");
|
||||
} catch (Exception e) {
|
||||
return Result.error("评论发表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result publishRegulation(String regulationId) {
|
||||
public Result confirmRegulation(String regulationId, RegulationConfirmDTO confirm) {
|
||||
try {
|
||||
RegulationEntity regulation = this.getById(regulationId);
|
||||
if (regulation == null) {
|
||||
return Result.error("制度不存在");
|
||||
}
|
||||
|
||||
regulation.setStatus("PUBLISHED");
|
||||
regulation.setPublishTime(LocalDateTime.now());
|
||||
regulation.setUpdateTime(LocalDateTime.now());
|
||||
regulation.setUpdateBy(StpUtil.getLoginIdAsString());
|
||||
|
||||
this.updateById(regulation);
|
||||
return Result.okM("制度发布成功");
|
||||
} catch (Exception e) {
|
||||
return Result.error("制度发布失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getPublishedRegulations(Integer page, Integer size) {
|
||||
try {
|
||||
String userId = cn.dev33.satoken.stp.StpUtil.getLoginIdAsString();
|
||||
Page<RegulationEntity> pageParam = new Page<>(page, size);
|
||||
LambdaQueryWrapper<RegulationEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(RegulationEntity::getDelFlag, "0");
|
||||
wrapper.eq(RegulationEntity::getStatus, "PUBLISHED");
|
||||
wrapper.orderByDesc(RegulationEntity::getPublishTime);
|
||||
Page<RegulationEntity> result = this.page(pageParam, wrapper);
|
||||
// 查询当前用户所有确认记录
|
||||
java.util.List<String> 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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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`
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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='制度确认';
|
||||
) 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='制度类型';
|
|
@ -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');
|
||||
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');
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue