1. 同步 base-version

This commit is contained in:
chenbowen
2025-09-18 00:51:31 +08:00
parent dadf77b668
commit 76dd62665f
24 changed files with 666 additions and 37 deletions

View File

@@ -16,9 +16,7 @@
<!-- 各种 module 拓展 -->
<module>yudao-module-system</module>
<module>yudao-module-infra</module>
<!-- <module>yudao-module-member</module>-->
<module>yudao-module-bpm</module>
<!-- <module>yudao-module-pay</module>-->
<module>yudao-module-report</module>
<module>yudao-module-mp</module>
<!-- <module>yudao-module-mall</module>-->

View File

@@ -0,0 +1,83 @@
/*
Yudao Database Transfer Tool
Source Server Type : MySQL
Target Server Type : DM8
Date: 2025-08-28 14:12:23
*/
-- ----------------------------
-- Table structure for system_sync_log
-- ----------------------------
CREATE TABLE system_sync_log (
id bigint NOT NULL PRIMARY KEY,
bim_request_id varchar(64) DEFAULT '' NULL,
service_name varchar(100) NOT NULL,
request_method varchar(16) DEFAULT 'POST' NOT NULL,
request_url varchar(500) NOT NULL,
client_ip varchar(50) NOT NULL,
user_agent varchar(512) DEFAULT NULL NULL,
request_time datetime NOT NULL,
response_time datetime DEFAULT NULL NULL,
duration bigint DEFAULT NULL NULL,
encrypted_request text NOT NULL,
decrypted_request text NULL,
status smallint DEFAULT 0 NOT NULL,
error_code varchar(100) DEFAULT NULL NULL,
error_message varchar(1000) DEFAULT NULL NULL,
exception_stack text NULL,
response_data text NULL,
encrypted_response text NULL,
auth_user varchar(100) DEFAULT NULL NULL,
decrypt_status smallint DEFAULT 0 NOT NULL,
signature_verify_status smallint DEFAULT 0 NOT NULL,
auth_status smallint DEFAULT 0 NOT NULL,
business_result varchar(100) DEFAULT NULL NULL,
extra text NULL,
creator varchar(64) DEFAULT '' NULL,
create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
updater varchar(64) DEFAULT '' NULL,
update_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
deleted bit DEFAULT '0' NOT NULL
);
CREATE INDEX idx_system_sync_log_01 ON system_sync_log (bim_request_id);
CREATE INDEX idx_system_sync_log_02 ON system_sync_log (service_name);
CREATE INDEX idx_system_sync_log_03 ON system_sync_log (request_time);
CREATE INDEX idx_system_sync_log_04 ON system_sync_log (status);
CREATE INDEX idx_system_sync_log_05 ON system_sync_log (client_ip);
CREATE INDEX idx_system_sync_log_06 ON system_sync_log (auth_user);
COMMENT ON COLUMN system_sync_log.id IS '日志主键';
COMMENT ON COLUMN system_sync_log.bim_request_id IS '外部请求ID';
COMMENT ON COLUMN system_sync_log.service_name IS '接口名称/服务名称';
COMMENT ON COLUMN system_sync_log.request_method IS '请求方法';
COMMENT ON COLUMN system_sync_log.request_url IS '请求URL';
COMMENT ON COLUMN system_sync_log.client_ip IS '客户端IP地址';
COMMENT ON COLUMN system_sync_log.user_agent IS '用户代理字符串';
COMMENT ON COLUMN system_sync_log.request_time IS '请求开始时间';
COMMENT ON COLUMN system_sync_log.response_time IS '请求结束时间';
COMMENT ON COLUMN system_sync_log.duration IS '请求处理耗时(毫秒)';
COMMENT ON COLUMN system_sync_log.encrypted_request IS '原始加密请求体';
COMMENT ON COLUMN system_sync_log.decrypted_request IS '解密后的请求体';
COMMENT ON COLUMN system_sync_log.status IS '响应状态 0-成功 1-解密失败 2-签名验证失败 3-认证失败 4-业务处理失败 5-系统异常';
COMMENT ON COLUMN system_sync_log.error_code IS '错误码';
COMMENT ON COLUMN system_sync_log.error_message IS '错误信息';
COMMENT ON COLUMN system_sync_log.exception_stack IS '异常堆栈';
COMMENT ON COLUMN system_sync_log.response_data IS '响应数据(加密前)';
COMMENT ON COLUMN system_sync_log.encrypted_response IS '加密后的响应数据';
COMMENT ON COLUMN system_sync_log.auth_user IS '认证用户';
COMMENT ON COLUMN system_sync_log.decrypt_status IS '解密状态 0-成功 1-失败';
COMMENT ON COLUMN system_sync_log.signature_verify_status IS '签名验证状态 0-成功 1-失败';
COMMENT ON COLUMN system_sync_log.auth_status IS '认证状态 0-成功 1-失败';
COMMENT ON COLUMN system_sync_log.business_result IS '业务处理结果';
COMMENT ON COLUMN system_sync_log.extra IS '额外信息';
COMMENT ON COLUMN system_sync_log.creator IS '创建者';
COMMENT ON COLUMN system_sync_log.create_time IS '创建时间';
COMMENT ON COLUMN system_sync_log.updater IS '更新者';
COMMENT ON COLUMN system_sync_log.update_time IS '更新时间';
COMMENT ON COLUMN system_sync_log.deleted IS '是否删除';
COMMENT ON TABLE system_sync_log IS '同步接口调用日志表';

View File

@@ -0,0 +1,39 @@
-- 在线文档管理功能菜单数据DM 格式)
-- 说明:达梦脚本使用与 patch.sql 相同的精简列形式,省略布尔列与时间列,使用默认值。
-- 清理旧数据,保持可重复执行
DELETE FROM system_menu WHERE id IN (6000,6001,6002,600101,600102,600103,600104,600105,600106,600107,600108,600109,600110);
-- 顶级目录(父级假定已存在 id=2 的“基础设施/Infra”或同级目录
INSERT INTO system_menu (
id, name, permission, type, sort, parent_id,
path, icon, component, status, component_name
) VALUES (
6000, '在线文档', '', 1, 15, 2,
'doc', 'fa:file-text-o', '', 0, NULL
);
-- 文档管理主页面
INSERT INTO system_menu (
id, name, permission, type, sort, parent_id,
path, icon, component, status, component_name
) VALUES (
6001, '文档管理', 'infra:doc:query', 2, 1, 6000,
'doc-file', 'fa:file-text', 'infra/doc/index', 0, 'DocFile'
);
-- 按钮权限(操作项)
INSERT INTO system_menu (
id, name, permission, type, sort, parent_id,
path, icon, component, status
) VALUES
(600101,'文档查询','infra:doc:query',3,1,6001,'','','',0),
(600102,'文档创建','infra:doc:create',3,2,6001,'','','',0),
(600103,'文档更新','infra:doc:update',3,3,6001,'','','',0),
(600104,'文档删除','infra:doc:delete',3,4,6001,'','','',0),
(600105,'文档导出','infra:doc:export',3,5,6001,'','','',0),
(600106,'文档上传','infra:doc:upload',3,6,6001,'','','',0),
(600107,'文档编辑','infra:doc:edit',3,7,6001,'','','',0),
(600108,'文档预览','infra:doc:preview',3,8,6001,'','','',0),
(600109,'文档下载','infra:doc:download',3,9,6001,'','','',0),
(600110,'权限管理','infra:doc:permission',3,10,6001,'','','',0);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,42 @@
-- ================================================
-- 用户来源类型功能 - 数据库表结构修改脚本
-- 创建时间: 2025-09-16
-- 作者: ZT
-- 功能描述: 为 system_users 表添加 user_source 字段,用于区分用户来源
-- ================================================
-- 为 system_users 表添加 user_source 字段
ALTER TABLE system_users
ADD user_source TINYINT DEFAULT 1;
-- 添加字段注释
COMMENT ON COLUMN system_users.user_source IS '用户来源: 1-外部用户, 2-同步用户';
-- 数据迁移将所有现有用户设置为同步用户类型为2
UPDATE system_users
SET user_source = 2
WHERE user_source IS NULL OR user_source = 1;
COMMIT;
-- ================================================
-- 部门来源类型功能 - 数据库表结构修改脚本
-- 创建时间: 2025-09-16
-- 作者: ZT
-- 功能描述: 为 system_dept 表添加 dept_source 字段,用于区分部门来源
-- ================================================
-- 1. 为 system_dept 表添加 dept_source 字段
ALTER TABLE system_dept
ADD dept_source TINYINT DEFAULT 1;
-- 2. 添加字段注释
COMMENT ON COLUMN system_dept.dept_source IS '部门来源: 1-外部部门, 2-同步部门';
-- 3. 数据迁移将所有现有部门设置为同步部门类型为2
UPDATE system_dept
SET dept_source = 2
WHERE dept_source IS NULL OR dept_source = 1;
COMMIT;

View File

@@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
/**
@@ -44,6 +45,21 @@ public class BeanUtils {
return list;
}
public static <S, T> Set<T> toBean(Set<S> source, Class<T> targetType) {
if (source == null) {
return null;
}
return CollectionUtils.convertSet(source, s -> toBean(s, targetType));
}
public static <S, T> Set<T> toBean(Set<S> source, Class<T> targetType, Consumer<T> peek) {
Set<T> set = toBean(source, targetType);
if (set != null) {
set.forEach(peek);
}
return set;
}
public static <S, T> PageResult<T> toBean(PageResult<S> source, Class<T> targetType) {
return toBean(source, targetType, null);
}

View File

@@ -20,8 +20,6 @@ import java.lang.reflect.Field;
import java.time.LocalDateTime;
import java.util.*;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.USER_NOT_SET_DEPT;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
/**
@@ -160,10 +158,11 @@ public class DefaultDBFieldHandler implements MetaObjectHandler {
Set<Long> postIds = new HashSet<>(JSONUtil.parseArray(
loginUser.getInfo().getOrDefault(LoginUser.INFO_KEY_POST_IDS, "[]")
).toList(Long.class));
// 阻碍部分场景的使用,不强制校验
// 如果 visitCompanyId 不存在,不能进行业务办理
if (Objects.isNull(visitCompanyId) || Objects.isNull(visitDeptId)) {
throw exception(USER_NOT_SET_DEPT);
}
// if (Objects.isNull(visitCompanyId) || Objects.isNull(visitDeptId)) {
// throw exception(USER_NOT_SET_DEPT);
// }
businessBaseDO.setCompanyId(visitCompanyId);
businessBaseDO.setCompanyName(loginUser.getVisitCompanyName());
businessBaseDO.setDeptId(visitDeptId);

View File

@@ -1,8 +1,9 @@
package cn.iocoder.yudao.module.bpm.api.event;
import cn.hutool.core.util.StrUtil;
import org.springframework.context.ApplicationListener;
import java.util.List;
/**
* {@link BpmProcessInstanceStatusEvent} 的监听器
*
@@ -13,15 +14,15 @@ public abstract class BpmProcessInstanceStatusEventListener
@Override
public final void onApplicationEvent(BpmProcessInstanceStatusEvent event) {
if (!StrUtil.equals(event.getProcessDefinitionKey(), getProcessDefinitionKey())) {
return;
if (getProcessDefinitionKey().contains(event.getProcessDefinitionKey())){
onEvent(event);
}
}
/**
* @return 返回监听的流程定义 Key
*/
protected abstract String getProcessDefinitionKey();
protected abstract List<String> getProcessDefinitionKey();
/**
* 处理事件

View File

@@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.bpm.service.oa.BpmOALeaveServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* OA 请假单的结果的监听器实现类
*
@@ -19,8 +21,8 @@ public class BpmOALeaveStatusListener extends BpmProcessInstanceStatusEventListe
private BpmOALeaveService leaveService;
@Override
protected String getProcessDefinitionKey() {
return BpmOALeaveServiceImpl.PROCESS_KEY;
protected List<String> getProcessDefinitionKey() {
return List.of(BpmOALeaveServiceImpl.PROCESS_KEY);
}
@Override

View File

@@ -34,9 +34,9 @@ public interface DeptApi {
@Operation(summary = "删除部门")
CommonResult<Boolean> deleteDept(@RequestParam("id") Long id);
@GetMapping(PREFIX + "/list-all")
@PostMapping(PREFIX + "/list-all")
@Operation(summary = "获得部门列表")
CommonResult<List<DeptDetailRespDTO>> getDeptList(@RequestParam DeptListReqDTO reqVO);
CommonResult<List<DeptDetailRespDTO>> getDeptList(@RequestBody DeptListReqDTO reqVO);
@GetMapping(PREFIX + "/simple-list")
@Operation(summary = "获得部门精简信息列表")
@@ -77,4 +77,9 @@ public interface DeptApi {
@Parameter(name = "id", description = "部门编号", example = "1024", required = true)
CommonResult<List<DeptRespDTO>> getChildDeptList(@RequestParam("id") Long id);
@GetMapping(PREFIX + "/company-dept-info")
@Operation(summary = "获得指定用户的公司部门信息")
@Parameter(name = "userId", description = "用户编号", example = "1", required = true)
CommonResult<Set<CompanyDeptInfoRespDTO>> getCompanyDeptInfoListByUserId(@RequestParam("userId") Long userId);
}

Some files were not shown because too many files have changed in this diff Show More