This commit is contained in:
2026-03-21 16:53:49 +08:00
parent 7d1ad3e58c
commit 01ccc9f4b3
30 changed files with 54 additions and 441 deletions

View File

@@ -3,6 +3,7 @@ package com.njcn.rdms.module.system.api.config;
import com.njcn.rdms.framework.common.pojo.CommonResult;
import com.njcn.rdms.module.system.dal.dataobject.config.ConfigDO;
import com.njcn.rdms.module.system.service.config.ConfigService;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@@ -11,6 +12,7 @@ import static com.njcn.rdms.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
@Hidden
public class ConfigApiImpl implements ConfigApi {
@Resource

View File

@@ -5,6 +5,7 @@ import com.njcn.rdms.framework.common.util.object.BeanUtils;
import com.njcn.rdms.module.system.api.dept.dto.DeptRespDTO;
import com.njcn.rdms.module.system.dal.dataobject.dept.DeptDO;
import com.njcn.rdms.module.system.service.dept.DeptService;
import io.swagger.v3.oas.annotations.Hidden;
import org.springframework.context.annotation.Bean;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@@ -17,6 +18,7 @@ import static com.njcn.rdms.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
@Hidden
public class DeptApiImpl implements DeptApi {
@Resource

View File

@@ -5,6 +5,7 @@ import com.njcn.rdms.framework.common.util.object.BeanUtils;
import com.njcn.rdms.module.system.api.dept.dto.PostRespDTO;
import com.njcn.rdms.module.system.dal.dataobject.dept.PostDO;
import com.njcn.rdms.module.system.service.dept.PostService;
import io.swagger.v3.oas.annotations.Hidden;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@@ -16,6 +17,7 @@ import static com.njcn.rdms.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
@Hidden
public class PostApiImpl implements PostApi {
@Resource

View File

@@ -5,6 +5,7 @@ import com.njcn.rdms.framework.common.util.object.BeanUtils;
import com.njcn.rdms.framework.common.biz.system.dict.dto.DictDataRespDTO;
import com.njcn.rdms.module.system.dal.dataobject.dict.DictDataDO;
import com.njcn.rdms.module.system.service.dict.DictDataService;
import io.swagger.v3.oas.annotations.Hidden;
import org.springframework.context.annotation.Primary;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@@ -18,6 +19,7 @@ import static com.njcn.rdms.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
@Primary // 由于 DictDataCommonApi 的存在,必须声明为 @Primary Bean
@Hidden
public class DictDataApiImpl implements DictDataApi {
@Resource

View File

@@ -1,30 +0,0 @@
package com.njcn.rdms.module.system.api.file;
import com.njcn.rdms.framework.common.pojo.CommonResult;
import com.njcn.rdms.module.system.api.file.dto.FileCreateReqDTO;
import com.njcn.rdms.module.system.service.file.FileService;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import static com.njcn.rdms.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
public class FileApiImpl implements FileApi {
@Resource
private FileService fileService;
@Override
public CommonResult<String> createFile(FileCreateReqDTO createReqDTO) {
return success(fileService.createFile(createReqDTO.getContent(), createReqDTO.getName(),
createReqDTO.getDirectory(), createReqDTO.getType()));
}
@Override
public CommonResult<String> presignGetUrl(String url, Integer expirationSeconds) {
return success(fileService.presignGetUrl(url, expirationSeconds));
}
}

View File

@@ -4,6 +4,7 @@ import com.njcn.rdms.framework.common.biz.system.logger.ApiAccessLogCommonApi;
import com.njcn.rdms.framework.common.biz.system.logger.dto.ApiAccessLogCreateReqDTO;
import com.njcn.rdms.framework.common.pojo.CommonResult;
import com.njcn.rdms.module.system.service.logger.ApiAccessLogService;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@@ -12,6 +13,7 @@ import static com.njcn.rdms.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
@Hidden
public class ApiAccessLogApiImpl implements ApiAccessLogCommonApi {
@Resource

View File

@@ -4,6 +4,7 @@ import com.njcn.rdms.framework.common.biz.system.logger.ApiErrorLogCommonApi;
import com.njcn.rdms.framework.common.biz.system.logger.dto.ApiErrorLogCreateReqDTO;
import com.njcn.rdms.framework.common.pojo.CommonResult;
import com.njcn.rdms.module.system.service.logger.ApiErrorLogService;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@@ -12,6 +13,7 @@ import static com.njcn.rdms.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
@Hidden
public class ApiErrorLogApiImpl implements ApiErrorLogCommonApi {
@Resource

View File

@@ -1,26 +0,0 @@
package com.njcn.rdms.module.system.api.logger;
import com.njcn.rdms.framework.common.pojo.CommonResult;
import com.njcn.rdms.module.system.api.logger.dto.LoginLogCreateReqDTO;
import com.njcn.rdms.module.system.service.logger.LoginLogService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import static com.njcn.rdms.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
public class LoginLogApiImpl implements LoginLogApi {
@Resource
private LoginLogService loginLogService;
@Override
public CommonResult<Boolean> createLoginLog(LoginLogCreateReqDTO reqDTO) {
loginLogService.createLoginLog(reqDTO);
return success(true);
}
}

View File

@@ -8,6 +8,7 @@ import com.njcn.rdms.module.system.api.logger.dto.OperateLogPageReqDTO;
import com.njcn.rdms.module.system.api.logger.dto.OperateLogRespDTO;
import com.njcn.rdms.module.system.dal.dataobject.logger.OperateLogDO;
import com.njcn.rdms.module.system.service.logger.OperateLogService;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Primary;
import org.springframework.validation.annotation.Validated;
@@ -18,6 +19,7 @@ import static com.njcn.rdms.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
@Primary // 由于 OperateLogCommonApi 的存在,必须声明为 @Primary Bean
@Hidden
public class OperateLogApiImpl implements OperateLogApi {
@Resource

View File

@@ -1,32 +0,0 @@
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.NotifySendSingleToUserReqDTO;
import com.njcn.rdms.module.system.service.notify.NotifySendService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import static com.njcn.rdms.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
public class NotifyMessageSendApiImpl implements NotifyMessageSendApi {
@Resource
private NotifySendService notifySendService;
@Override
public CommonResult<Long> sendSingleMessageToAdmin(NotifySendSingleToUserReqDTO reqDTO) {
return success(notifySendService.sendSingleNotifyToAdmin(reqDTO.getUserId(),
reqDTO.getTemplateCode(), reqDTO.getTemplateParams()));
}
@Override
public CommonResult<Long> sendSingleMessageToMember(NotifySendSingleToUserReqDTO reqDTO) {
return success(notifySendService.sendSingleNotifyToMember(reqDTO.getUserId(),
reqDTO.getTemplateCode(), reqDTO.getTemplateParams()));
}
}

View File

@@ -8,6 +8,7 @@ import com.njcn.rdms.framework.common.pojo.CommonResult;
import com.njcn.rdms.framework.common.util.object.BeanUtils;
import com.njcn.rdms.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
import com.njcn.rdms.module.system.service.oauth2.OAuth2TokenService;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@@ -16,6 +17,7 @@ import static com.njcn.rdms.framework.common.pojo.CommonResult.success;
@RestController
@Validated
@Hidden
public class OAuth2TokenApiImpl implements OAuth2TokenCommonApi {
@Resource

View File

@@ -2,6 +2,7 @@ package com.njcn.rdms.module.system.api.permission;
import com.njcn.rdms.framework.common.pojo.CommonResult;
import com.njcn.rdms.module.system.service.permission.PermissionService;
import io.swagger.v3.oas.annotations.Hidden;
import org.springframework.context.annotation.Primary;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@@ -15,6 +16,7 @@ import static com.njcn.rdms.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
@Primary // 由于 PermissionCommonApi 的存在,必须声明为 @Primary Bean
@Hidden
public class PermissionApiImpl implements PermissionApi {
@Resource

View File

@@ -1,25 +0,0 @@
package com.njcn.rdms.module.system.api.permission;
import com.njcn.rdms.framework.common.pojo.CommonResult;
import com.njcn.rdms.module.system.service.permission.RoleService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import java.util.Collection;
import static com.njcn.rdms.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
public class RoleApiImpl implements RoleApi {
@Resource
private RoleService roleService;
@Override
public CommonResult<Boolean> validRoleList(Collection<Long> ids) {
roleService.validateRoleList(ids);
return success(true);
}
}

View File

@@ -5,6 +5,7 @@ import com.njcn.rdms.framework.common.util.object.BeanUtils;
import com.njcn.rdms.module.system.api.user.dto.AdminUserRespDTO;
import com.njcn.rdms.module.system.dal.dataobject.user.AdminUserDO;
import com.njcn.rdms.module.system.service.user.AdminUserService;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@@ -16,6 +17,7 @@ import static com.njcn.rdms.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
@Hidden
public class AdminUserApiImpl implements AdminUserApi {
@Resource

View File

@@ -1,9 +1,11 @@
package com.njcn.rdms.module.system.api.websocket;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.collection.CollUtil;
import com.njcn.rdms.framework.common.pojo.CommonResult;
import com.njcn.rdms.framework.common.enums.UserTypeEnum;
import com.njcn.rdms.framework.websocket.core.sender.WebSocketMessageSender;
import com.njcn.rdms.module.system.api.websocket.dto.WebSocketSendReqDTO;
import com.njcn.rdms.module.system.api.websocket.dto.WebSocketSendToUsersReqDTO;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@@ -12,22 +14,20 @@ import static com.njcn.rdms.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
@Hidden
public class WebSocketSenderApiImpl implements WebSocketSenderApi {
private static final Integer SYSTEM_USER_TYPE = UserTypeEnum.ADMIN.getValue();
@Resource
private WebSocketMessageSender webSocketMessageSender;
@Override
public CommonResult<Boolean> send(WebSocketSendReqDTO message) {
if (StrUtil.isNotEmpty(message.getSessionId())) {
webSocketMessageSender.send(message.getSessionId(),
message.getMessageType(), message.getMessageContent());
} else if (message.getUserType() != null && message.getUserId() != null) {
webSocketMessageSender.send(message.getUserType(), message.getUserId(),
message.getMessageType(), message.getMessageContent());
} else if (message.getUserType() != null) {
webSocketMessageSender.send(message.getUserType(),
message.getMessageType(), message.getMessageContent());
public CommonResult<Boolean> sendToUsers(WebSocketSendToUsersReqDTO message) {
if (CollUtil.isNotEmpty(message.getUserIds())) {
message.getUserIds().stream().distinct().forEach(userId ->
webSocketMessageSender.send(SYSTEM_USER_TYPE, userId,
message.getMessageType(), message.getMessageContent()));
}
return success(true);
}

View File

@@ -1,16 +1,16 @@
package com.njcn.rdms.module.system.controller.admin.notice;
import cn.hutool.core.lang.Assert;
import com.njcn.rdms.framework.common.enums.UserTypeEnum;
import com.njcn.rdms.framework.common.pojo.CommonResult;
import com.njcn.rdms.framework.common.pojo.PageResult;
import com.njcn.rdms.framework.common.util.object.BeanUtils;
import com.njcn.rdms.module.system.api.websocket.WebSocketSenderApi;
import com.njcn.rdms.module.system.controller.admin.notice.vo.NoticePageReqVO;
import com.njcn.rdms.module.system.controller.admin.notice.vo.NoticeRespVO;
import com.njcn.rdms.module.system.controller.admin.notice.vo.NoticeSaveReqVO;
import com.njcn.rdms.module.system.dal.dataobject.notice.NoticeDO;
import com.njcn.rdms.module.system.service.notice.NoticeService;
import com.njcn.rdms.framework.common.enums.UserTypeEnum;
import com.njcn.rdms.framework.websocket.core.sender.WebSocketMessageSender;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -34,7 +34,7 @@ public class NoticeController {
private NoticeService noticeService;
@Resource
private WebSocketSenderApi webSocketSenderApi;
private WebSocketMessageSender webSocketMessageSender;
@PostMapping("/create")
@Operation(summary = "创建通知公告")
@@ -95,7 +95,7 @@ public class NoticeController {
NoticeDO notice = noticeService.getNotice(id);
Assert.notNull(notice, "公告不能为空");
// 通过 websocket 推送给在线的用户
webSocketSenderApi.sendObject(UserTypeEnum.ADMIN.getValue(), "notice-push", notice);
webSocketMessageSender.sendObject(UserTypeEnum.ADMIN.getValue(), "notice-push", notice);
return success(true);
}

View File

@@ -1,12 +1,11 @@
package com.njcn.rdms.module.system.framework.rpc.config;
import com.njcn.rdms.module.system.api.config.ConfigApi;
import com.njcn.rdms.module.system.api.file.FileApi;
import com.njcn.rdms.module.system.api.websocket.WebSocketSenderApi;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Configuration;
@Configuration(value = "systemRpcConfiguration", proxyBeanMethods = false)
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, ConfigApi.class})
@EnableFeignClients(clients = {WebSocketSenderApi.class, ConfigApi.class})
public class RpcConfiguration {
}

View File

@@ -11,7 +11,6 @@ import com.njcn.rdms.framework.common.util.monitor.TracerUtils;
import com.njcn.rdms.framework.common.util.object.BeanUtils;
import com.njcn.rdms.framework.common.util.servlet.ServletUtils;
import com.njcn.rdms.framework.common.util.validation.ValidationUtils;
import com.njcn.rdms.module.system.api.logger.dto.LoginLogCreateReqDTO;
import com.njcn.rdms.module.system.controller.admin.auth.vo.AuthLoginReqVO;
import com.njcn.rdms.module.system.controller.admin.auth.vo.AuthLoginRespVO;
import com.njcn.rdms.module.system.controller.admin.auth.vo.AuthRegisterReqVO;
@@ -22,6 +21,7 @@ import com.njcn.rdms.module.system.enums.logger.LoginLogTypeEnum;
import com.njcn.rdms.module.system.enums.logger.LoginResultEnum;
import com.njcn.rdms.module.system.enums.oauth2.OAuth2ClientConstants;
import com.njcn.rdms.module.system.service.logger.LoginLogService;
import com.njcn.rdms.module.system.service.logger.dto.LoginLogCreateReqDTO;
import com.njcn.rdms.module.system.service.member.MemberService;
import com.njcn.rdms.module.system.service.oauth2.OAuth2TokenService;
import com.njcn.rdms.module.system.service.user.AdminUserService;

View File

@@ -1,7 +1,7 @@
package com.njcn.rdms.module.system.service.logger;
import com.njcn.rdms.framework.common.pojo.PageResult;
import com.njcn.rdms.module.system.api.logger.dto.LoginLogCreateReqDTO;
import com.njcn.rdms.module.system.service.logger.dto.LoginLogCreateReqDTO;
import com.njcn.rdms.module.system.controller.admin.logger.vo.loginlog.LoginLogPageReqVO;
import com.njcn.rdms.module.system.dal.dataobject.logger.LoginLogDO;

View File

@@ -2,7 +2,7 @@ package com.njcn.rdms.module.system.service.logger;
import com.njcn.rdms.framework.common.pojo.PageResult;
import com.njcn.rdms.framework.common.util.object.BeanUtils;
import com.njcn.rdms.module.system.api.logger.dto.LoginLogCreateReqDTO;
import com.njcn.rdms.module.system.service.logger.dto.LoginLogCreateReqDTO;
import com.njcn.rdms.module.system.controller.admin.logger.vo.loginlog.LoginLogPageReqVO;
import com.njcn.rdms.module.system.dal.dataobject.logger.LoginLogDO;
import com.njcn.rdms.module.system.dal.mysql.logger.LoginLogMapper;