增加制度类型管理页面,相关方法已通过测试
This commit is contained in:
parent
641266e549
commit
72af3aa203
|
@ -1,6 +1,8 @@
|
||||||
package com.dite.znpt.domain.dto;
|
package com.dite.znpt.domain.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 制度确认DTO
|
* 制度确认DTO
|
||||||
|
@ -8,7 +10,9 @@ import lombok.Data;
|
||||||
* @date 2025/07/29
|
* @date 2025/07/29
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class RegulationConfirmDTO {
|
public class RegulationConfirmDTO {
|
||||||
|
|
||||||
private Boolean agreeTerms; // 是否同意条款
|
private Boolean agreeTerms = true; // 是否同意条款,默认为true
|
||||||
}
|
}
|
|
@ -20,7 +20,7 @@ import java.time.LocalDateTime;
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@TableName("regulation_confirmation")
|
@TableName("regulation_confirmation")
|
||||||
@ApiModel(value="RegulationConfirmationEntity对象", description="制度确认")
|
@ApiModel(value="RegulationConfirmationEntity对象", description="制度确认")
|
||||||
public class RegulationConfirmationEntity extends AuditableEntity implements Serializable {
|
public class RegulationConfirmationEntity implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -34,11 +34,6 @@ public class RegulationConfirmationEntity extends AuditableEntity implements Ser
|
||||||
@TableField("regulation_id")
|
@TableField("regulation_id")
|
||||||
private String regulationId;
|
private String regulationId;
|
||||||
|
|
||||||
@ExcelProperty("制度标题")
|
|
||||||
@ApiModelProperty("制度标题")
|
|
||||||
@TableField("regulation_title")
|
|
||||||
private String regulationTitle;
|
|
||||||
|
|
||||||
@ExcelProperty("确认人ID")
|
@ExcelProperty("确认人ID")
|
||||||
@ApiModelProperty("确认人ID")
|
@ApiModelProperty("确认人ID")
|
||||||
@TableField("confirmer_id")
|
@TableField("confirmer_id")
|
||||||
|
@ -55,7 +50,7 @@ public class RegulationConfirmationEntity extends AuditableEntity implements Ser
|
||||||
private String confirmerDept;
|
private String confirmerDept;
|
||||||
|
|
||||||
@ExcelProperty("确认状态")
|
@ExcelProperty("确认状态")
|
||||||
@ApiModelProperty("确认状态:PENDING-待确认,CONFIRMED-已确认,DECLINED-已拒绝")
|
@ApiModelProperty("确认状态:CONFIRMED-已确认")
|
||||||
@TableField("status")
|
@TableField("status")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
@ -64,31 +59,6 @@ public class RegulationConfirmationEntity extends AuditableEntity implements Ser
|
||||||
@TableField("confirm_time")
|
@TableField("confirm_time")
|
||||||
private LocalDateTime confirmTime;
|
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代表删除)")
|
@ExcelProperty("删除标志(0代表存在,1代表删除)")
|
||||||
@ApiModelProperty("删除标志(0代表存在,1代表删除)")
|
@ApiModelProperty("删除标志(0代表存在,1代表删除)")
|
||||||
@TableField("del_flag")
|
@TableField("del_flag")
|
||||||
|
|
|
@ -49,16 +49,6 @@ public class RegulationEntity extends AuditableEntity implements Serializable {
|
||||||
@TableField("status")
|
@TableField("status")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
@ExcelProperty("发布人ID")
|
|
||||||
@ApiModelProperty("发布人ID")
|
|
||||||
@TableField("publisher_id")
|
|
||||||
private String publisherId;
|
|
||||||
|
|
||||||
@ExcelProperty("发布人姓名")
|
|
||||||
@ApiModelProperty("发布人姓名")
|
|
||||||
@TableField("publisher_name")
|
|
||||||
private String publisherName;
|
|
||||||
|
|
||||||
@ExcelProperty("发布时间")
|
@ExcelProperty("发布时间")
|
||||||
@ApiModelProperty("发布时间")
|
@ApiModelProperty("发布时间")
|
||||||
@TableField("publish_time")
|
@TableField("publish_time")
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.dite.znpt.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.dite.znpt.domain.entity.RegulationConfirmationEntity;
|
import com.dite.znpt.domain.entity.RegulationConfirmationEntity;
|
||||||
import com.dite.znpt.domain.Result;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wangna
|
* @author wangna
|
||||||
|
@ -10,57 +9,6 @@ import com.dite.znpt.domain.Result;
|
||||||
* @Description: 制度确认Service接口
|
* @Description: 制度确认Service接口
|
||||||
*/
|
*/
|
||||||
public interface RegulationConfirmationService extends IService<RegulationConfirmationEntity> {
|
public interface RegulationConfirmationService extends IService<RegulationConfirmationEntity> {
|
||||||
|
// 继承自IService的方法已经足够使用
|
||||||
/**
|
// 包括:save, update, remove, list, page, lambdaQuery等
|
||||||
* 确认制度
|
|
||||||
* @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);
|
|
||||||
}
|
}
|
|
@ -29,13 +29,6 @@ public interface RegulationService extends IService<RegulationEntity> {
|
||||||
*/
|
*/
|
||||||
Result createRegulationProposal(RegulationEntity regulation);
|
Result createRegulationProposal(RegulationEntity regulation);
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新制度提案
|
|
||||||
* @param regulation 制度信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
Result updateRegulationProposal(RegulationEntity regulation);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取制度详情
|
* 获取制度详情
|
||||||
* @param regulationId 制度ID
|
* @param regulationId 制度ID
|
||||||
|
@ -46,9 +39,7 @@ public interface RegulationService extends IService<RegulationEntity> {
|
||||||
/**
|
/**
|
||||||
* 确认制度知晓
|
* 确认制度知晓
|
||||||
* @param regulationId 制度ID
|
* @param regulationId 制度ID
|
||||||
* @param confirm 确认信息
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
Result confirmRegulation(String regulationId, RegulationConfirmDTO confirm);
|
Result confirmRegulation(String regulationId);
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,19 +1,10 @@
|
||||||
package com.dite.znpt.service.impl;
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.dite.znpt.domain.Result;
|
|
||||||
import com.dite.znpt.domain.entity.RegulationConfirmationEntity;
|
import com.dite.znpt.domain.entity.RegulationConfirmationEntity;
|
||||||
import com.dite.znpt.mapper.RegulationConfirmationMapper;
|
import com.dite.znpt.mapper.RegulationConfirmationMapper;
|
||||||
import com.dite.znpt.service.RegulationConfirmationService;
|
import com.dite.znpt.service.RegulationConfirmationService;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Service;
|
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
|
* @author wangna
|
||||||
|
@ -21,164 +12,7 @@ import java.util.Map;
|
||||||
* @Description: 制度确认服务实现类
|
* @Description: 制度确认服务实现类
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class RegulationConfirmationServiceImpl extends ServiceImpl<RegulationConfirmationMapper, RegulationConfirmationEntity> implements RegulationConfirmationService {
|
public class RegulationConfirmationServiceImpl extends ServiceImpl<RegulationConfirmationMapper, RegulationConfirmationEntity> implements RegulationConfirmationService {
|
||||||
|
// 继承自ServiceImpl的方法已经足够使用
|
||||||
@Override
|
// 包括:save, update, remove, list, page, lambdaQuery等
|
||||||
@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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package com.dite.znpt.service.impl;
|
package com.dite.znpt.service.impl;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
@ -12,15 +13,10 @@ import com.dite.znpt.mapper.RegulationMapper;
|
||||||
import com.dite.znpt.service.RegulationService;
|
import com.dite.znpt.service.RegulationService;
|
||||||
import com.dite.znpt.service.RegulationConfirmationService;
|
import com.dite.znpt.service.RegulationConfirmationService;
|
||||||
import com.dite.znpt.service.UserService;
|
import com.dite.znpt.service.UserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,8 +30,10 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
|
||||||
private final RegulationConfirmationService regulationConfirmationService;
|
private final RegulationConfirmationService regulationConfirmationService;
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
|
|
||||||
@Autowired
|
public RegulationServiceImpl(RegulationConfirmationService regulationConfirmationService, UserService userService) {
|
||||||
private RegulationDraftMapper regulationDraftMapper;
|
this.regulationConfirmationService = regulationConfirmationService;
|
||||||
|
this.userService = userService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每天凌晨1点自动将公示期(10天)已到的草案变为已发布
|
* 每天凌晨1点自动将公示期(10天)已到的草案变为已发布
|
||||||
|
@ -43,20 +41,29 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
|
||||||
@Scheduled(cron = "0 0 1 * * ?")
|
@Scheduled(cron = "0 0 1 * * ?")
|
||||||
public void autoPublishDrafts() {
|
public void autoPublishDrafts() {
|
||||||
LocalDateTime tenDaysAgo = LocalDateTime.now().minusDays(10);
|
LocalDateTime tenDaysAgo = LocalDateTime.now().minusDays(10);
|
||||||
List<RegulationDraftEntity> drafts = regulationDraftMapper.selectList(
|
|
||||||
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<RegulationDraftEntity>()
|
// 查询需要自动发布的制度(状态为DRAFT且创建时间超过10天)
|
||||||
.eq(RegulationDraftEntity::getStatus, "DRAFT")
|
LambdaQueryWrapper<RegulationEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
.le(RegulationDraftEntity::getCreateTime, tenDaysAgo)
|
wrapper.eq(RegulationEntity::getStatus, "DRAFT");
|
||||||
);
|
wrapper.le(RegulationEntity::getCreateTime, tenDaysAgo);
|
||||||
for (RegulationDraftEntity draft : drafts) {
|
wrapper.eq(RegulationEntity::getDelFlag, "0");
|
||||||
|
|
||||||
|
java.util.List<RegulationEntity> drafts = this.list(wrapper);
|
||||||
|
|
||||||
|
for (RegulationEntity draft : drafts) {
|
||||||
|
// 更新制度状态和发布信息
|
||||||
draft.setStatus("PUBLISHED");
|
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() + " 个制度");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public RegulationServiceImpl(RegulationConfirmationService regulationConfirmationService, UserService userService) {
|
|
||||||
this.regulationConfirmationService = regulationConfirmationService;
|
|
||||||
this.userService = userService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -78,7 +85,7 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
|
||||||
|
|
||||||
// 如果是获取已发布的制度,需要添加确认状态
|
// 如果是获取已发布的制度,需要添加确认状态
|
||||||
if (status != null && "PUBLISHED".equals(status)) {
|
if (status != null && "PUBLISHED".equals(status)) {
|
||||||
String userId = cn.dev33.satoken.stp.StpUtil.getLoginIdAsString();
|
String userId = StpUtil.getLoginIdAsString();
|
||||||
java.util.List<String> confirmedIds = regulationConfirmationService.lambdaQuery()
|
java.util.List<String> confirmedIds = regulationConfirmationService.lambdaQuery()
|
||||||
.eq(RegulationConfirmationEntity::getConfirmerId, userId)
|
.eq(RegulationConfirmationEntity::getConfirmerId, userId)
|
||||||
.eq(RegulationConfirmationEntity::getStatus, "CONFIRMED")
|
.eq(RegulationConfirmationEntity::getStatus, "CONFIRMED")
|
||||||
|
@ -105,9 +112,12 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
|
||||||
regulation.setRegulationId(java.util.UUID.randomUUID().toString());
|
regulation.setRegulationId(java.util.UUID.randomUUID().toString());
|
||||||
regulation.setStatus("DRAFT");
|
regulation.setStatus("DRAFT");
|
||||||
regulation.setCreateTime(LocalDateTime.now());
|
regulation.setCreateTime(LocalDateTime.now());
|
||||||
regulation.setCreateBy(cn.dev33.satoken.stp.StpUtil.getLoginIdAsString());
|
|
||||||
|
UserResp user = userService.detail(StpUtil.getLoginIdAsString());
|
||||||
|
String userName = user != null ? user.getName() : StpUtil.getLoginIdAsString();
|
||||||
|
regulation.setCreateBy(userName);
|
||||||
regulation.setUpdateTime(LocalDateTime.now());
|
regulation.setUpdateTime(LocalDateTime.now());
|
||||||
regulation.setUpdateBy(cn.dev33.satoken.stp.StpUtil.getLoginIdAsString());
|
regulation.setUpdateBy(userName);
|
||||||
regulation.setDelFlag("0");
|
regulation.setDelFlag("0");
|
||||||
|
|
||||||
this.save(regulation);
|
this.save(regulation);
|
||||||
|
@ -117,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(cn.dev33.satoken.stp.StpUtil.getLoginIdAsString());
|
|
||||||
this.updateById(regulation);
|
|
||||||
return Result.okM("制度提案更新成功");
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error("制度提案更新失败:" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result getRegulationDetail(String regulationId) {
|
public Result getRegulationDetail(String regulationId) {
|
||||||
try {
|
try {
|
||||||
|
@ -150,7 +142,7 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Result confirmRegulation(String regulationId, RegulationConfirmDTO confirm) {
|
public Result confirmRegulation(String regulationId) {
|
||||||
try {
|
try {
|
||||||
RegulationEntity regulation = this.getById(regulationId);
|
RegulationEntity regulation = this.getById(regulationId);
|
||||||
if (regulation == null) {
|
if (regulation == null) {
|
||||||
|
@ -160,7 +152,7 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
|
||||||
// 检查是否已经确认过
|
// 检查是否已经确认过
|
||||||
RegulationConfirmationEntity existingConfirmation = regulationConfirmationService.lambdaQuery()
|
RegulationConfirmationEntity existingConfirmation = regulationConfirmationService.lambdaQuery()
|
||||||
.eq(RegulationConfirmationEntity::getRegulationId, regulationId)
|
.eq(RegulationConfirmationEntity::getRegulationId, regulationId)
|
||||||
.eq(RegulationConfirmationEntity::getConfirmerId, cn.dev33.satoken.stp.StpUtil.getLoginIdAsString())
|
.eq(RegulationConfirmationEntity::getConfirmerId, StpUtil.getLoginIdAsString())
|
||||||
.eq(RegulationConfirmationEntity::getDelFlag, "0")
|
.eq(RegulationConfirmationEntity::getDelFlag, "0")
|
||||||
.one();
|
.one();
|
||||||
|
|
||||||
|
@ -172,9 +164,9 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
|
||||||
RegulationConfirmationEntity confirmation = new RegulationConfirmationEntity();
|
RegulationConfirmationEntity confirmation = new RegulationConfirmationEntity();
|
||||||
confirmation.setConfirmationId(java.util.UUID.randomUUID().toString());
|
confirmation.setConfirmationId(java.util.UUID.randomUUID().toString());
|
||||||
confirmation.setRegulationId(regulationId);
|
confirmation.setRegulationId(regulationId);
|
||||||
confirmation.setConfirmerId(cn.dev33.satoken.stp.StpUtil.getLoginIdAsString());
|
confirmation.setConfirmerId(StpUtil.getLoginIdAsString());
|
||||||
|
|
||||||
UserResp user = userService.detail(cn.dev33.satoken.stp.StpUtil.getLoginIdAsString());
|
UserResp user = userService.detail(StpUtil.getLoginIdAsString());
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
confirmation.setConfirmerName(user.getName());
|
confirmation.setConfirmerName(user.getName());
|
||||||
confirmation.setConfirmerDept(user.getDeptName());
|
confirmation.setConfirmerDept(user.getDeptName());
|
||||||
|
@ -182,10 +174,6 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
|
||||||
|
|
||||||
confirmation.setStatus("CONFIRMED");
|
confirmation.setStatus("CONFIRMED");
|
||||||
confirmation.setConfirmTime(LocalDateTime.now());
|
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");
|
confirmation.setDelFlag("0");
|
||||||
|
|
||||||
regulationConfirmationService.save(confirmation);
|
regulationConfirmationService.save(confirmation);
|
||||||
|
@ -194,5 +182,4 @@ public class RegulationServiceImpl extends ServiceImpl<RegulationMapper, Regulat
|
||||||
return Result.error("制度确认失败:" + e.getMessage());
|
return Result.error("制度确认失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -22,8 +22,7 @@
|
||||||
"content": "建议优化考勤管理制度,增加弹性工作时间,提高员工工作积极性...",
|
"content": "建议优化考勤管理制度,增加弹性工作时间,提高员工工作积极性...",
|
||||||
"regulationType": "人事制度",
|
"regulationType": "人事制度",
|
||||||
"status": "VOTING",
|
"status": "VOTING",
|
||||||
"publisherId": "2",
|
"createBy": "张三",
|
||||||
"publisherName": "张三",
|
|
||||||
"publishTime": "2024-01-01T12:00:00",
|
"publishTime": "2024-01-01T12:00:00",
|
||||||
"effectiveTime": "2024-01-01T12:00:00",
|
"effectiveTime": "2024-01-01T12:00:00",
|
||||||
"expireTime": "2024-01-08T12:00:00",
|
"expireTime": "2024-01-08T12:00:00",
|
||||||
|
@ -79,8 +78,7 @@
|
||||||
"content": "建议优化考勤管理制度,增加弹性工作时间...",
|
"content": "建议优化考勤管理制度,增加弹性工作时间...",
|
||||||
"regulationType": "人事制度",
|
"regulationType": "人事制度",
|
||||||
"status": "DRAFT",
|
"status": "DRAFT",
|
||||||
"publisherId": "1",
|
"createBy": "当前用户",
|
||||||
"publisherName": "当前用户",
|
|
||||||
"publishTime": "2024-01-25T10:30:00",
|
"publishTime": "2024-01-25T10:30:00",
|
||||||
"effectiveTime": "2024-01-25T10:30:00",
|
"effectiveTime": "2024-01-25T10:30:00",
|
||||||
"expireTime": "2025-01-25T10:30:00",
|
"expireTime": "2025-01-25T10:30:00",
|
||||||
|
@ -157,8 +155,7 @@
|
||||||
"content": "建议优化考勤管理制度,增加弹性工作时间...",
|
"content": "建议优化考勤管理制度,增加弹性工作时间...",
|
||||||
"regulationType": "人事制度",
|
"regulationType": "人事制度",
|
||||||
"status": "VOTING",
|
"status": "VOTING",
|
||||||
"publisherId": "1",
|
"createBy": "张三",
|
||||||
"publisherName": "张三",
|
|
||||||
"publishTime": "2024-01-01T12:00:00",
|
"publishTime": "2024-01-01T12:00:00",
|
||||||
"effectiveTime": "2024-01-01T12:00:00",
|
"effectiveTime": "2024-01-01T12:00:00",
|
||||||
"expireTime": "2024-01-08T12:00:00",
|
"expireTime": "2024-01-08T12:00:00",
|
||||||
|
@ -298,206 +295,17 @@
|
||||||
- **URL**: `POST /api/regulation/confirm-all`
|
- **URL**: `POST /api/regulation/confirm-all`
|
||||||
- **Method**: POST
|
- **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
|
```json
|
||||||
{
|
{
|
||||||
"status": 200,
|
"status": 200,
|
||||||
"data": {
|
"data": {
|
||||||
"typeId": "type_001",
|
"success": true,
|
||||||
"typeName": "人事制度",
|
"confirmedCount": 5
|
||||||
"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`
|
1. **执行建表语句**: 运行 `regulation_tables.sql`
|
||||||
|
|
|
@ -2,6 +2,33 @@
|
||||||
-- @author wangna
|
-- @author wangna
|
||||||
-- @date 2025/07/28
|
-- @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` (
|
CREATE TABLE `regulation` (
|
||||||
`regulation_id` varchar(64) NOT NULL COMMENT '制度ID',
|
`regulation_id` varchar(64) NOT NULL COMMENT '制度ID',
|
||||||
|
@ -103,21 +130,11 @@ CREATE TABLE `regulation_proposal` (
|
||||||
CREATE TABLE `regulation_confirmation` (
|
CREATE TABLE `regulation_confirmation` (
|
||||||
`confirmation_id` varchar(64) NOT NULL COMMENT '确认ID',
|
`confirmation_id` varchar(64) NOT NULL COMMENT '确认ID',
|
||||||
`regulation_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_id` varchar(64) NOT NULL COMMENT '确认人ID',
|
||||||
`confirmer_name` varchar(100) DEFAULT NULL COMMENT '确认人姓名',
|
`confirmer_name` varchar(100) DEFAULT NULL COMMENT '确认人姓名',
|
||||||
`confirmer_dept` 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_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代表删除)',
|
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志(0代表存在,1代表删除)',
|
||||||
PRIMARY KEY (`confirmation_id`),
|
PRIMARY KEY (`confirmation_id`),
|
||||||
UNIQUE KEY `uk_confirmer_regulation` (`confirmer_id`, `regulation_id`),
|
UNIQUE KEY `uk_confirmer_regulation` (`confirmer_id`, `regulation_id`),
|
||||||
|
@ -125,30 +142,4 @@ CREATE TABLE `regulation_confirmation` (
|
||||||
KEY `idx_confirmer` (`confirmer_id`),
|
KEY `idx_confirmer` (`confirmer_id`),
|
||||||
KEY `idx_status` (`status`),
|
KEY `idx_status` (`status`),
|
||||||
KEY `idx_confirm_time` (`confirm_time`)
|
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,18 +30,6 @@ 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');
|
('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`, `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
|
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', '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_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', '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_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');
|
||||||
('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');
|
|
|
@ -37,13 +37,6 @@ public class RegulationController {
|
||||||
return regulationService.createRegulationProposal(regulation);
|
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")
|
@ApiOperation(value = "获取制度详情", httpMethod = "GET")
|
||||||
@GetMapping("/{regulationId}")
|
@GetMapping("/{regulationId}")
|
||||||
public Result getRegulationDetail(@PathVariable String regulationId) {
|
public Result getRegulationDetail(@PathVariable String regulationId) {
|
||||||
|
@ -52,8 +45,8 @@ public class RegulationController {
|
||||||
|
|
||||||
@ApiOperation(value = "确认制度知晓", httpMethod = "POST")
|
@ApiOperation(value = "确认制度知晓", httpMethod = "POST")
|
||||||
@PostMapping("/{regulationId}/confirm")
|
@PostMapping("/{regulationId}/confirm")
|
||||||
public Result confirmRegulation(@PathVariable String regulationId, @RequestBody RegulationConfirmDTO confirm) {
|
public Result confirmRegulation(@PathVariable String regulationId) {
|
||||||
return regulationService.confirmRegulation(regulationId, confirm);
|
return regulationService.confirmRegulation(regulationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue