Compare commits
2 Commits
d10cd352b0
...
72af3aa203
Author | SHA1 | Date |
---|---|---|
|
72af3aa203 | |
|
641266e549 |
|
@ -1,6 +1,8 @@
|
|||
package com.dite.znpt.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
/**
|
||||
* 制度确认DTO
|
||||
|
@ -8,7 +10,9 @@ import lombok.Data;
|
|||
* @date 2025/07/29
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RegulationConfirmDTO {
|
||||
|
||||
private Boolean agreeTerms; // 是否同意条款
|
||||
private Boolean agreeTerms = true; // 是否同意条款,默认为true
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -20,7 +20,7 @@ import java.time.LocalDateTime;
|
|||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("regulation_confirmation")
|
||||
@ApiModel(value="RegulationConfirmationEntity对象", description="制度确认")
|
||||
public class RegulationConfirmationEntity extends AuditableEntity implements Serializable {
|
||||
public class RegulationConfirmationEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -34,11 +34,6 @@ public class RegulationConfirmationEntity extends AuditableEntity implements Ser
|
|||
@TableField("regulation_id")
|
||||
private String regulationId;
|
||||
|
||||
@ExcelProperty("制度标题")
|
||||
@ApiModelProperty("制度标题")
|
||||
@TableField("regulation_title")
|
||||
private String regulationTitle;
|
||||
|
||||
@ExcelProperty("确认人ID")
|
||||
@ApiModelProperty("确认人ID")
|
||||
@TableField("confirmer_id")
|
||||
|
@ -55,7 +50,7 @@ public class RegulationConfirmationEntity extends AuditableEntity implements Ser
|
|||
private String confirmerDept;
|
||||
|
||||
@ExcelProperty("确认状态")
|
||||
@ApiModelProperty("确认状态:PENDING-待确认,CONFIRMED-已确认,DECLINED-已拒绝")
|
||||
@ApiModelProperty("确认状态:CONFIRMED-已确认")
|
||||
@TableField("status")
|
||||
private String status;
|
||||
|
||||
|
@ -64,31 +59,6 @@ public class RegulationConfirmationEntity extends AuditableEntity implements Ser
|
|||
@TableField("confirm_time")
|
||||
private LocalDateTime confirmTime;
|
||||
|
||||
@ExcelProperty("确认意见")
|
||||
@ApiModelProperty("确认意见")
|
||||
@TableField("confirm_comment")
|
||||
private String confirmComment;
|
||||
|
||||
@ExcelProperty("阅读时长(秒)")
|
||||
@ApiModelProperty("阅读时长(秒)")
|
||||
@TableField("read_duration")
|
||||
private Integer readDuration;
|
||||
|
||||
@ExcelProperty("IP地址")
|
||||
@ApiModelProperty("IP地址")
|
||||
@TableField("ip_address")
|
||||
private String ipAddress;
|
||||
|
||||
@ExcelProperty("用户代理")
|
||||
@ApiModelProperty("用户代理")
|
||||
@TableField("user_agent")
|
||||
private String userAgent;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
@ApiModelProperty("备注")
|
||||
@TableField("remark")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("删除标志(0代表存在,1代表删除)")
|
||||
@ApiModelProperty("删除标志(0代表存在,1代表删除)")
|
||||
@TableField("del_flag")
|
||||
|
|
|
@ -49,16 +49,6 @@ public class RegulationEntity extends AuditableEntity implements Serializable {
|
|||
@TableField("status")
|
||||
private String status;
|
||||
|
||||
@ExcelProperty("发布人ID")
|
||||
@ApiModelProperty("发布人ID")
|
||||
@TableField("publisher_id")
|
||||
private String publisherId;
|
||||
|
||||
@ExcelProperty("发布人姓名")
|
||||
@ApiModelProperty("发布人姓名")
|
||||
@TableField("publisher_name")
|
||||
private String publisherName;
|
||||
|
||||
@ExcelProperty("发布时间")
|
||||
@ApiModelProperty("发布时间")
|
||||
@TableField("publish_time")
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.dite.znpt.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.entity.RegulationConfirmationEntity;
|
||||
import com.dite.znpt.domain.Result;
|
||||
|
||||
/**
|
||||
* @author wangna
|
||||
|
@ -10,57 +9,6 @@ import com.dite.znpt.domain.Result;
|
|||
* @Description: 制度确认Service接口
|
||||
*/
|
||||
public interface RegulationConfirmationService extends IService<RegulationConfirmationEntity> {
|
||||
|
||||
/**
|
||||
* 确认制度
|
||||
* @param confirmation 确认信息
|
||||
* @return 结果
|
||||
*/
|
||||
Result confirmRegulation(RegulationConfirmationEntity confirmation);
|
||||
|
||||
/**
|
||||
* 获取确认记录
|
||||
* @param regulationId 制度ID
|
||||
* @return 结果
|
||||
*/
|
||||
Result getConfirmationRecords(String regulationId);
|
||||
|
||||
/**
|
||||
* 获取用户确认记录
|
||||
* @param confirmerId 确认人ID
|
||||
* @param regulationId 制度ID
|
||||
* @return 结果
|
||||
*/
|
||||
Result getUserConfirmationRecord(String confirmerId, String regulationId);
|
||||
|
||||
/**
|
||||
* 取消确认
|
||||
* @param confirmationId 确认ID
|
||||
* @return 结果
|
||||
*/
|
||||
Result cancelConfirmation(String confirmationId);
|
||||
|
||||
/**
|
||||
* 获取确认统计
|
||||
* @param regulationId 制度ID
|
||||
* @return 结果
|
||||
*/
|
||||
Result getConfirmationStatistics(String regulationId);
|
||||
|
||||
/**
|
||||
* 批量创建确认任务
|
||||
* @param regulationId 制度ID
|
||||
* @param userIds 用户ID列表
|
||||
* @return 结果
|
||||
*/
|
||||
Result createConfirmationTasks(String regulationId, String[] userIds);
|
||||
|
||||
/**
|
||||
* 获取待确认列表
|
||||
* @param confirmerId 确认人ID
|
||||
* @param page 页码
|
||||
* @param pageSize 页大小
|
||||
* @return 结果
|
||||
*/
|
||||
Result getPendingConfirmations(String confirmerId, Integer page, Integer pageSize);
|
||||
// 继承自IService的方法已经足够使用
|
||||
// 包括:save, update, remove, list, page, lambdaQuery等
|
||||
}
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -30,13 +29,6 @@ public interface RegulationService extends IService<RegulationEntity> {
|
|||
*/
|
||||
Result createRegulationProposal(RegulationEntity regulation);
|
||||
|
||||
/**
|
||||
* 更新制度提案
|
||||
* @param regulation 制度信息
|
||||
* @return 结果
|
||||
*/
|
||||
Result updateRegulationProposal(RegulationEntity regulation);
|
||||
|
||||
/**
|
||||
* 获取制度详情
|
||||
* @param regulationId 制度ID
|
||||
|
@ -44,42 +36,10 @@ 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
|
||||
* @param confirm 确认信息
|
||||
* @return 结果
|
||||
*/
|
||||
Result confirmRegulation(String regulationId, RegulationConfirmDTO confirm);
|
||||
|
||||
|
||||
Result confirmRegulation(String regulationId);
|
||||
}
|
|
@ -1,19 +1,10 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
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.RegulationConfirmationEntity;
|
||||
import com.dite.znpt.mapper.RegulationConfirmationMapper;
|
||||
import com.dite.znpt.service.RegulationConfirmationService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author wangna
|
||||
|
@ -21,164 +12,7 @@ import java.util.Map;
|
|||
* @Description: 制度确认服务实现类
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RegulationConfirmationServiceImpl extends ServiceImpl<RegulationConfirmationMapper, RegulationConfirmationEntity> implements RegulationConfirmationService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result confirmRegulation(RegulationConfirmationEntity confirmation) {
|
||||
try {
|
||||
// 检查是否已经确认
|
||||
LambdaQueryWrapper<RegulationConfirmationEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(RegulationConfirmationEntity::getConfirmerId, confirmation.getConfirmerId())
|
||||
.eq(RegulationConfirmationEntity::getRegulationId, confirmation.getRegulationId())
|
||||
.eq(RegulationConfirmationEntity::getDelFlag, "0");
|
||||
|
||||
RegulationConfirmationEntity existingConfirmation = this.getOne(wrapper);
|
||||
if (existingConfirmation != null) {
|
||||
return Result.error("您已经确认过该制度");
|
||||
}
|
||||
|
||||
confirmation.setConfirmTime(LocalDateTime.now());
|
||||
confirmation.setDelFlag("0");
|
||||
this.save(confirmation);
|
||||
return Result.ok("制度确认成功");
|
||||
} catch (Exception e) {
|
||||
return Result.error("制度确认失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getConfirmationRecords(String regulationId) {
|
||||
try {
|
||||
LambdaQueryWrapper<RegulationConfirmationEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(RegulationConfirmationEntity::getRegulationId, regulationId)
|
||||
.eq(RegulationConfirmationEntity::getDelFlag, "0")
|
||||
.orderByDesc(RegulationConfirmationEntity::getConfirmTime);
|
||||
|
||||
List<RegulationConfirmationEntity> confirmations = this.list(wrapper);
|
||||
return Result.ok(confirmations);
|
||||
} catch (Exception e) {
|
||||
return Result.error("获取确认记录失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getUserConfirmationRecord(String confirmerId, String regulationId) {
|
||||
try {
|
||||
LambdaQueryWrapper<RegulationConfirmationEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(RegulationConfirmationEntity::getConfirmerId, confirmerId)
|
||||
.eq(RegulationConfirmationEntity::getRegulationId, regulationId)
|
||||
.eq(RegulationConfirmationEntity::getDelFlag, "0");
|
||||
|
||||
RegulationConfirmationEntity confirmation = this.getOne(wrapper);
|
||||
return Result.ok(confirmation);
|
||||
} catch (Exception e) {
|
||||
return Result.error("获取用户确认记录失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result cancelConfirmation(String confirmationId) {
|
||||
try {
|
||||
RegulationConfirmationEntity confirmation = this.getById(confirmationId);
|
||||
if (confirmation == null) {
|
||||
return Result.error("确认记录不存在");
|
||||
}
|
||||
|
||||
confirmation.setDelFlag("1");
|
||||
this.updateById(confirmation);
|
||||
return Result.ok("确认取消成功");
|
||||
} catch (Exception e) {
|
||||
return Result.error("确认取消失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getConfirmationStatistics(String regulationId) {
|
||||
try {
|
||||
LambdaQueryWrapper<RegulationConfirmationEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(RegulationConfirmationEntity::getRegulationId, regulationId)
|
||||
.eq(RegulationConfirmationEntity::getDelFlag, "0");
|
||||
|
||||
List<RegulationConfirmationEntity> confirmations = this.list(wrapper);
|
||||
|
||||
int confirmedCount = 0;
|
||||
int declinedCount = 0;
|
||||
int pendingCount = 0;
|
||||
|
||||
for (RegulationConfirmationEntity confirmation : confirmations) {
|
||||
switch (confirmation.getStatus()) {
|
||||
case "CONFIRMED":
|
||||
confirmedCount++;
|
||||
break;
|
||||
case "DECLINED":
|
||||
declinedCount++;
|
||||
break;
|
||||
case "PENDING":
|
||||
pendingCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int totalConfirmations = confirmedCount + declinedCount + pendingCount;
|
||||
double confirmRate = totalConfirmations > 0 ? (double) confirmedCount / totalConfirmations * 100 : 0;
|
||||
|
||||
return Result.okM(Map.of(
|
||||
"regulationId", regulationId,
|
||||
"totalConfirmations", totalConfirmations,
|
||||
"confirmedCount", confirmedCount,
|
||||
"declinedCount", declinedCount,
|
||||
"pendingCount", pendingCount,
|
||||
"confirmRate", confirmRate
|
||||
), "确认统计");
|
||||
} catch (Exception e) {
|
||||
return Result.error("获取确认统计失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result createConfirmationTasks(String regulationId, String[] userIds) {
|
||||
try {
|
||||
for (String userId : userIds) {
|
||||
// 检查是否已经存在确认任务
|
||||
LambdaQueryWrapper<RegulationConfirmationEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(RegulationConfirmationEntity::getConfirmerId, userId)
|
||||
.eq(RegulationConfirmationEntity::getRegulationId, regulationId)
|
||||
.eq(RegulationConfirmationEntity::getDelFlag, "0");
|
||||
|
||||
RegulationConfirmationEntity existingTask = this.getOne(wrapper);
|
||||
if (existingTask == null) {
|
||||
RegulationConfirmationEntity task = new RegulationConfirmationEntity();
|
||||
task.setRegulationId(regulationId);
|
||||
task.setConfirmerId(userId);
|
||||
task.setStatus("PENDING");
|
||||
task.setDelFlag("0");
|
||||
this.save(task);
|
||||
}
|
||||
}
|
||||
return Result.okM("确认任务创建成功");
|
||||
} catch (Exception e) {
|
||||
return Result.error("确认任务创建失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getPendingConfirmations(String confirmerId, Integer page, Integer pageSize) {
|
||||
try {
|
||||
Page<RegulationConfirmationEntity> pageParam = new Page<>(page, pageSize);
|
||||
LambdaQueryWrapper<RegulationConfirmationEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(RegulationConfirmationEntity::getConfirmerId, confirmerId)
|
||||
.eq(RegulationConfirmationEntity::getStatus, "PENDING")
|
||||
.eq(RegulationConfirmationEntity::getDelFlag, "0")
|
||||
.orderByDesc(RegulationConfirmationEntity::getCreateTime);
|
||||
|
||||
Page<RegulationConfirmationEntity> result = this.page(pageParam, wrapper);
|
||||
return Result.ok(result);
|
||||
} catch (Exception e) {
|
||||
return Result.error("获取待确认列表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
// 继承自ServiceImpl的方法已经足够使用
|
||||
// 包括:save, update, remove, list, page, lambdaQuery等
|
||||
}
|
|
@ -7,38 +7,33 @@ 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.scheduling.annotation.Scheduled;
|
||||
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;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.util.List;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
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;
|
||||
private final UserService userService;
|
||||
|
||||
@Autowired
|
||||
private RegulationDraftMapper regulationDraftMapper;
|
||||
public RegulationServiceImpl(RegulationConfirmationService regulationConfirmationService, UserService userService) {
|
||||
this.regulationConfirmationService = regulationConfirmationService;
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 每天凌晨1点自动将公示期(10天)已到的草案变为已发布
|
||||
|
@ -46,14 +41,28 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
|
|||
@Scheduled(cron = "0 0 1 * * ?")
|
||||
public void autoPublishDrafts() {
|
||||
LocalDateTime tenDaysAgo = LocalDateTime.now().minusDays(10);
|
||||
List<RegulationDraftEntity> drafts = regulationDraftMapper.selectList(
|
||||
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<RegulationDraftEntity>()
|
||||
.eq(RegulationDraftEntity::getStatus, "DRAFT")
|
||||
.le(RegulationDraftEntity::getCreateTime, tenDaysAgo)
|
||||
);
|
||||
for (RegulationDraftEntity draft : drafts) {
|
||||
|
||||
// 查询需要自动发布的制度(状态为DRAFT且创建时间超过10天)
|
||||
LambdaQueryWrapper<RegulationEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(RegulationEntity::getStatus, "DRAFT");
|
||||
wrapper.le(RegulationEntity::getCreateTime, tenDaysAgo);
|
||||
wrapper.eq(RegulationEntity::getDelFlag, "0");
|
||||
|
||||
java.util.List<RegulationEntity> drafts = this.list(wrapper);
|
||||
|
||||
for (RegulationEntity draft : drafts) {
|
||||
// 更新制度状态和发布信息
|
||||
draft.setStatus("PUBLISHED");
|
||||
regulationDraftMapper.updateById(draft);
|
||||
draft.setPublishTime(LocalDateTime.now());
|
||||
draft.setEffectiveTime(LocalDateTime.now()); // 设置生效时间为当前时间
|
||||
draft.setUpdateTime(LocalDateTime.now());
|
||||
draft.setUpdateBy("系统自动发布");
|
||||
|
||||
this.updateById(draft);
|
||||
}
|
||||
|
||||
if (!drafts.isEmpty()) {
|
||||
System.out.println("自动发布完成,共发布 " + drafts.size() + " 个制度");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,19 +71,34 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
|
|||
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 = 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 +109,17 @@ 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());
|
||||
|
||||
UserResp user = userService.detail(StpUtil.getLoginIdAsString());
|
||||
String userName = user != null ? user.getName() : StpUtil.getLoginIdAsString();
|
||||
regulation.setCreateBy(userName);
|
||||
regulation.setUpdateTime(LocalDateTime.now());
|
||||
regulation.setUpdateBy(userName);
|
||||
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) {
|
||||
|
@ -114,24 +127,6 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result updateRegulationProposal(RegulationEntity regulation) {
|
||||
try {
|
||||
RegulationEntity existing = this.getById(regulation.getRegulationId());
|
||||
if (existing == null) {
|
||||
return Result.error("制度不存在");
|
||||
}
|
||||
|
||||
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 getRegulationDetail(String regulationId) {
|
||||
try {
|
||||
|
@ -145,113 +140,46 @@ 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) {
|
||||
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, 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(StpUtil.getLoginIdAsString());
|
||||
|
||||
UserResp user = userService.detail(StpUtil.getLoginIdAsString());
|
||||
if (user != null) {
|
||||
confirmation.setConfirmerName(user.getName());
|
||||
confirmation.setConfirmerDept(user.getDeptName());
|
||||
}
|
||||
|
||||
confirmation.setStatus("CONFIRMED");
|
||||
confirmation.setConfirmTime(LocalDateTime.now());
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -22,8 +22,7 @@
|
|||
"content": "建议优化考勤管理制度,增加弹性工作时间,提高员工工作积极性...",
|
||||
"regulationType": "人事制度",
|
||||
"status": "VOTING",
|
||||
"publisherId": "2",
|
||||
"publisherName": "张三",
|
||||
"createBy": "张三",
|
||||
"publishTime": "2024-01-01T12:00:00",
|
||||
"effectiveTime": "2024-01-01T12:00:00",
|
||||
"expireTime": "2024-01-08T12:00:00",
|
||||
|
@ -79,8 +78,7 @@
|
|||
"content": "建议优化考勤管理制度,增加弹性工作时间...",
|
||||
"regulationType": "人事制度",
|
||||
"status": "DRAFT",
|
||||
"publisherId": "1",
|
||||
"publisherName": "当前用户",
|
||||
"createBy": "当前用户",
|
||||
"publishTime": "2024-01-25T10:30:00",
|
||||
"effectiveTime": "2024-01-25T10:30:00",
|
||||
"expireTime": "2025-01-25T10:30:00",
|
||||
|
@ -157,8 +155,7 @@
|
|||
"content": "建议优化考勤管理制度,增加弹性工作时间...",
|
||||
"regulationType": "人事制度",
|
||||
"status": "VOTING",
|
||||
"publisherId": "1",
|
||||
"publisherName": "张三",
|
||||
"createBy": "张三",
|
||||
"publishTime": "2024-01-01T12:00:00",
|
||||
"effectiveTime": "2024-01-01T12:00:00",
|
||||
"expireTime": "2024-01-08T12:00:00",
|
||||
|
@ -180,66 +177,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 +201,7 @@
|
|||
}
|
||||
```
|
||||
|
||||
## 9. 获取投票结果
|
||||
## 7. 获取投票结果
|
||||
|
||||
### 请求信息
|
||||
- **URL**: `GET /api/regulation/{regulationId}/vote-result`
|
||||
|
@ -284,7 +222,7 @@
|
|||
}
|
||||
```
|
||||
|
||||
## 10. 发布制度
|
||||
## 8. 发布制度
|
||||
|
||||
### 请求信息
|
||||
- **URL**: `POST /api/regulation/{regulationId}/publish`
|
||||
|
@ -294,21 +232,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 +253,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 +277,7 @@
|
|||
### 请求参数
|
||||
```json
|
||||
{
|
||||
"agreeTerms": true
|
||||
"confirmComment": "已阅读并同意遵守该制度"
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -363,13 +285,11 @@
|
|||
```json
|
||||
{
|
||||
"status": 200,
|
||||
"data": {
|
||||
"success": true
|
||||
}
|
||||
"message": "制度确认成功"
|
||||
}
|
||||
```
|
||||
|
||||
## 13. 批量确认制度
|
||||
## 11. 批量确认制度
|
||||
|
||||
### 请求信息
|
||||
- **URL**: `POST /api/regulation/confirm-all`
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -2,6 +2,33 @@
|
|||
-- @author wangna
|
||||
-- @date 2025/07/28
|
||||
|
||||
-- 制度类型表
|
||||
CREATE TABLE `regulation_type` (
|
||||
`type_id` varchar(64) NOT NULL COMMENT '类型ID',
|
||||
`type_name` varchar(100) NOT NULL COMMENT '类型名称',
|
||||
`sort_order` int DEFAULT 0 COMMENT '排序顺序',
|
||||
`is_enabled` char(1) DEFAULT '1' COMMENT '是否启用(1-启用,0-禁用)',
|
||||
`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_name` (`type_name`),
|
||||
KEY `idx_sort_order` (`sort_order`),
|
||||
KEY `idx_is_enabled` (`is_enabled`),
|
||||
KEY `idx_create_time` (`create_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='制度类型';
|
||||
|
||||
-- 插入制度类型测试数据
|
||||
INSERT INTO `regulation_type` (`type_id`, `type_name`, `sort_order`, `is_enabled`, `remark`, `create_by`, `create_time`, `update_by`, `update_time`, `del_flag`) VALUES
|
||||
('type_001', '人事制度', 1, '1', '人力资源管理相关制度', 'admin', '2024-01-01 10:00:00', 'admin', '2024-01-01 10:00:00', '0'),
|
||||
('type_002', '财务制度', 2, '1', '财务管理相关制度', 'admin', '2024-01-01 10:00:00', 'admin', '2024-01-01 10:00:00', '0'),
|
||||
('type_003', '安全制度', 3, '1', '安全管理相关制度', 'admin', '2024-01-01 10:00:00', 'admin', '2024-01-01 10:00:00', '0'),
|
||||
('type_004', '设备制度', 4, '1', '设备管理相关制度', 'admin', '2024-01-01 10:00:00', 'admin', '2024-01-01 10:00:00', '0'),
|
||||
('type_005', '行政制度', 5, '1', '行政管理相关制度', 'admin', '2024-01-01 10:00:00', 'admin', '2024-01-01 10:00:00', '0');
|
||||
|
||||
-- 制度规范仓库表
|
||||
CREATE TABLE `regulation` (
|
||||
`regulation_id` varchar(64) NOT NULL COMMENT '制度ID',
|
||||
|
@ -103,21 +130,11 @@ CREATE TABLE `regulation_proposal` (
|
|||
CREATE TABLE `regulation_confirmation` (
|
||||
`confirmation_id` varchar(64) NOT NULL COMMENT '确认ID',
|
||||
`regulation_id` varchar(64) NOT NULL COMMENT '制度ID',
|
||||
`regulation_title` varchar(255) DEFAULT NULL COMMENT '制度标题',
|
||||
`confirmer_id` varchar(64) NOT NULL COMMENT '确认人ID',
|
||||
`confirmer_name` varchar(100) DEFAULT NULL COMMENT '确认人姓名',
|
||||
`confirmer_dept` varchar(100) DEFAULT NULL COMMENT '确认人部门',
|
||||
`status` varchar(20) DEFAULT 'PENDING' COMMENT '确认状态:PENDING-待确认,CONFIRMED-已确认,DECLINED-已拒绝',
|
||||
`status` varchar(20) DEFAULT 'CONFIRMED' COMMENT '确认状态:CONFIRMED-已确认',
|
||||
`confirm_time` datetime DEFAULT NULL COMMENT '确认时间',
|
||||
`confirm_comment` text COMMENT '确认意见',
|
||||
`read_duration` int DEFAULT 0 COMMENT '阅读时长(秒)',
|
||||
`ip_address` varchar(50) DEFAULT NULL COMMENT 'IP地址',
|
||||
`user_agent` varchar(500) 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 (`confirmation_id`),
|
||||
UNIQUE KEY `uk_confirmer_regulation` (`confirmer_id`, `regulation_id`),
|
||||
|
|
|
@ -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")
|
||||
|
@ -30,48 +37,16 @@ public class RegulationController {
|
|||
return regulationService.createRegulationProposal(regulation);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新制度提案", httpMethod = "PUT")
|
||||
@PutMapping("/proposal/{regulationId}")
|
||||
public Result updateRegulationProposal(@PathVariable String regulationId, @RequestBody RegulationEntity regulation) {
|
||||
regulation.setRegulationId(regulationId);
|
||||
return regulationService.updateRegulationProposal(regulation);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取制度详情", httpMethod = "GET")
|
||||
@GetMapping("/{regulationId}")
|
||||
public Result getRegulationDetail(@PathVariable String regulationId) {
|
||||
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) {
|
||||
return regulationService.confirmRegulation(regulationId, confirm);
|
||||
public Result confirmRegulation(@PathVariable String regulationId) {
|
||||
return regulationService.confirmRegulation(regulationId);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue