refactor(project): 重构权限常量定义并移除需求进度聚合功能
- 将产品和项目查询权限码统一提取到常量类中 - 移除需求进度聚合计算的相关实现代码 - 更新权限验证注解使用新的常量定义 - 清理相关的单元测试代码 - 更新错误码注释说明
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package com.njcn.rdms.module.system.api.notify;
|
||||
|
||||
import com.njcn.rdms.framework.common.pojo.CommonResult;
|
||||
import com.njcn.rdms.module.system.api.notify.dto.NotifySingleSendReqDTO;
|
||||
import com.njcn.rdms.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 站内信发送 API(跨模块统一入口契约)。
|
||||
*
|
||||
* <p>业务方(如 project)经此发送站内信,不依赖 system-boot 内部发送实现。
|
||||
* userType 在能力层固定 ADMIN,不暴露给业务方。</p>
|
||||
*
|
||||
* @author hongawen
|
||||
*/
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务 - 站内信发送") // 对 NotifySendService 的封装,供其它模块统一入口调用
|
||||
public interface NotifyMessageSendApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/notify-message-send";
|
||||
|
||||
@PostMapping(PREFIX + "/send-single")
|
||||
@Operation(summary = "发送单条站内信")
|
||||
CommonResult<Long> sendSingleNotify(@Valid @RequestBody NotifySingleSendReqDTO reqDTO);
|
||||
|
||||
/**
|
||||
* 便捷方法:发送单条站内信给管理后台用户(userType 固定 ADMIN,由实现层处理)。
|
||||
*
|
||||
* @param userId 接收用户编号
|
||||
* @param templateCode 模板编码(场景标识,发送前模板必须已配置)
|
||||
* @param templateParams 模板参数
|
||||
*/
|
||||
default void sendSingleNotifyToAdmin(Long userId, String templateCode, Map<String, Object> templateParams) {
|
||||
sendSingleNotify(new NotifySingleSendReqDTO().setUserId(userId)
|
||||
.setTemplateCode(templateCode).setTemplateParams(templateParams)).checkError();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.rdms.module.system.api.notify.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 发送单条站内信 Request DTO(跨模块统一入口入参)。
|
||||
*
|
||||
* @author hongawen
|
||||
*/
|
||||
@Schema(description = "RPC 服务 - 发送单条站内信 Request DTO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class NotifySingleSendReqDTO {
|
||||
|
||||
@Schema(description = "接收用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "接收用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "站内信模板编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "task_assigned")
|
||||
@NotNull(message = "模板编码不能为空")
|
||||
private String templateCode;
|
||||
|
||||
@Schema(description = "模板参数(占位符 -> 值)", example = "{\"taskName\":\"联调\"}")
|
||||
private Map<String, Object> templateParams;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user