Merge remote-tracking branch 'origin/test' into dev
This commit is contained in:
@@ -230,9 +230,9 @@ SELECT
|
||||
## 海外排车、出库与派送权限
|
||||
|
||||
- 国内固定入口已在海外仓业务 `lastleg-permissions.sql` 权限段之后完整内联 `iam/src/main/resources/db/phase5-delivery-permissions.sql`;测试和部署只执行固定入口,不再单独执行模块脚本。
|
||||
- 平台端固定使用排车列表/编辑/取消/转派送、出库列表/创建/取消、派送列表/退回/状态、异常订单列表/创建和客户回访列表/编辑十四项权限;列表权限包含详情及只读辅助接口,写操作保持独立授权。
|
||||
- 平台端固定使用排车列表/编辑/取消/转派送、出库列表/创建/取消、派送列表/退回/状态、异常订单列表/创建/处理和客户回访列表/编辑十五项权限;列表权限包含详情及只读辅助接口,写操作保持独立授权。
|
||||
- 客户端固定使用 `merchant:warehouse:delivery:list` 和 `merchant:warehouse:delivery:create`;客户默认管理员获得两项权限,其他客户角色不自动扩权。
|
||||
- `WAREHOUSE_OPERATOR` 获得十四项后台作业权限,`WAREHOUSE_TALLY` 只获得排车、出库、派送、异常订单和客户回访五项列表只读;国内、海外 PDA 岗位不得获得上述后台权限。
|
||||
- `WAREHOUSE_OPERATOR` 获得十五项后台作业权限,`WAREHOUSE_TALLY` 只获得排车、出库、派送、异常订单和客户回访五项列表只读;国内、海外 PDA 岗位不得获得上述后台权限。
|
||||
|
||||
## 海外排车与出库结构升级
|
||||
|
||||
|
||||
@@ -16966,6 +16966,7 @@ BEGIN
|
||||
OR (id = 5107093 AND permission_code <> 'platform:overseas-warehouse:outbound:cancel')
|
||||
OR (id = 5107070 AND permission_code <> 'platform:overseas-warehouse:exception-order:list')
|
||||
OR (id = 5107071 AND permission_code <> 'platform:overseas-warehouse:exception-order:create')
|
||||
OR (id = 5107073 AND permission_code <> 'platform:overseas-warehouse:exception-order:process')
|
||||
OR (id = 5107072 AND permission_code <> 'platform:overseas-warehouse:delivery:return')
|
||||
OR (id = 5107080 AND permission_code <> 'platform:overseas-warehouse:customer-visit:list')
|
||||
OR (id = 5107081 AND permission_code <> 'platform:overseas-warehouse:customer-visit:edit')
|
||||
@@ -16984,6 +16985,7 @@ BEGIN
|
||||
OR (permission_code = 'platform:overseas-warehouse:outbound:cancel' AND id <> 5107093)
|
||||
OR (permission_code = 'platform:overseas-warehouse:exception-order:list' AND id <> 5107070)
|
||||
OR (permission_code = 'platform:overseas-warehouse:exception-order:create' AND id <> 5107071)
|
||||
OR (permission_code = 'platform:overseas-warehouse:exception-order:process' AND id <> 5107073)
|
||||
OR (permission_code = 'platform:overseas-warehouse:delivery:return' AND id <> 5107072)
|
||||
OR (permission_code = 'platform:overseas-warehouse:customer-visit:list' AND id <> 5107080)
|
||||
OR (permission_code = 'platform:overseas-warehouse:customer-visit:edit' AND id <> 5107081)
|
||||
@@ -17008,6 +17010,7 @@ VALUES
|
||||
(5107018,0,'PLATFORM','BUTTON',5107064,'platform:overseas-warehouse:dispatch:transfer-delivery','排车转派送',NULL,'POST',718,'ACTIVE',1,0),
|
||||
(5107070,0,'PLATFORM','MENU',0,'platform:overseas-warehouse:exception-order:list','海外异常订单','/overseas-warehouse/exception-orders','GET',770,'ACTIVE',1,0),
|
||||
(5107071,0,'PLATFORM','BUTTON',5107070,'platform:overseas-warehouse:exception-order:create','新增海外异常订单',NULL,'POST',771,'ACTIVE',1,0),
|
||||
(5107073,0,'PLATFORM','BUTTON',5107070,'platform:overseas-warehouse:exception-order:process','处理海外异常订单',NULL,'POST',773,'ACTIVE',1,0),
|
||||
(5107072,0,'PLATFORM','BUTTON',5107092,'platform:overseas-warehouse:delivery:return','派送单标记退货',NULL,'POST',772,'ACTIVE',1,0),
|
||||
(5107080,0,'PLATFORM','MENU',0,'platform:overseas-warehouse:customer-visit:list','客户回访','/overseas-warehouse/customer-visits','GET',780,'ACTIVE',1,0),
|
||||
(5107081,0,'PLATFORM','BUTTON',5107080,'platform:overseas-warehouse:customer-visit:edit','保存客户回访',NULL,'PUT',781,'ACTIVE',1,0),
|
||||
@@ -17043,6 +17046,7 @@ SELECT 0, role.id, permission.id, CURRENT_TIMESTAMP(3)
|
||||
'platform:overseas-warehouse:delivery:list',
|
||||
'platform:overseas-warehouse:exception-order:list',
|
||||
'platform:overseas-warehouse:exception-order:create',
|
||||
'platform:overseas-warehouse:exception-order:process',
|
||||
'platform:overseas-warehouse:delivery:return',
|
||||
'platform:overseas-warehouse:delivery:status',
|
||||
'platform:overseas-warehouse:customer-visit:list',
|
||||
@@ -17067,6 +17071,7 @@ INSERT INTO tmp_phase5_delivery_role_permission (role_code, permission_code) VAL
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:delivery:list'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:exception-order:list'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:exception-order:create'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:exception-order:process'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:delivery:return'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:delivery:status'),
|
||||
('WAREHOUSE_OPERATOR','platform:overseas-warehouse:customer-visit:list'),
|
||||
@@ -17095,6 +17100,7 @@ WHERE role.tenant_id=0 AND role.app_code='PLATFORM'
|
||||
'platform:overseas-warehouse:delivery:list',
|
||||
'platform:overseas-warehouse:exception-order:list',
|
||||
'platform:overseas-warehouse:exception-order:create',
|
||||
'platform:overseas-warehouse:exception-order:process',
|
||||
'platform:overseas-warehouse:delivery:return',
|
||||
'platform:overseas-warehouse:delivery:status',
|
||||
'platform:overseas-warehouse:customer-visit:list',
|
||||
@@ -17142,12 +17148,13 @@ BEGIN
|
||||
'platform:overseas-warehouse:delivery:list',
|
||||
'platform:overseas-warehouse:exception-order:list',
|
||||
'platform:overseas-warehouse:exception-order:create',
|
||||
'platform:overseas-warehouse:exception-order:process',
|
||||
'platform:overseas-warehouse:delivery:return',
|
||||
'platform:overseas-warehouse:delivery:status',
|
||||
'platform:overseas-warehouse:customer-visit:list',
|
||||
'platform:overseas-warehouse:customer-visit:edit',
|
||||
'merchant:warehouse:delivery:list',
|
||||
'merchant:warehouse:delivery:create')) <> 16 THEN
|
||||
'merchant:warehouse:delivery:create')) <> 17 THEN
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='五期海外派送权限初始化失败:权限目录不完整';
|
||||
END IF;
|
||||
IF (SELECT COUNT(*) FROM iam_role_permission grant_row
|
||||
@@ -17165,10 +17172,11 @@ BEGIN
|
||||
'platform:overseas-warehouse:delivery:list',
|
||||
'platform:overseas-warehouse:exception-order:list',
|
||||
'platform:overseas-warehouse:exception-order:create',
|
||||
'platform:overseas-warehouse:exception-order:process',
|
||||
'platform:overseas-warehouse:delivery:return',
|
||||
'platform:overseas-warehouse:delivery:status',
|
||||
'platform:overseas-warehouse:customer-visit:list',
|
||||
'platform:overseas-warehouse:customer-visit:edit')) <> 14 THEN
|
||||
'platform:overseas-warehouse:customer-visit:edit')) <> 15 THEN
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='五期海外派送权限初始化失败:平台管理员授权不完整';
|
||||
END IF;
|
||||
IF EXISTS (SELECT 1 FROM iam_role role
|
||||
@@ -17189,17 +17197,18 @@ BEGIN
|
||||
'platform:overseas-warehouse:delivery:list',
|
||||
'platform:overseas-warehouse:exception-order:list',
|
||||
'platform:overseas-warehouse:exception-order:create',
|
||||
'platform:overseas-warehouse:exception-order:process',
|
||||
'platform:overseas-warehouse:delivery:return',
|
||||
'platform:overseas-warehouse:delivery:status',
|
||||
'platform:overseas-warehouse:customer-visit:list',
|
||||
'platform:overseas-warehouse:customer-visit:edit')) <> 14) THEN
|
||||
'platform:overseas-warehouse:customer-visit:edit')) <> 15) THEN
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='五期海外派送权限初始化失败:平台自定义管理员授权不完整';
|
||||
END IF;
|
||||
SELECT COALESCE(SUM(role_code='WAREHOUSE_OPERATOR'),0),
|
||||
COALESCE(SUM(role_code='WAREHOUSE_TALLY'),0)
|
||||
INTO v_warehouse_operator_permission_count, v_warehouse_tally_permission_count
|
||||
FROM tmp_phase5_delivery_role_permission;
|
||||
IF v_warehouse_operator_permission_count <> 14
|
||||
IF v_warehouse_operator_permission_count <> 15
|
||||
OR v_warehouse_tally_permission_count <> 5 THEN
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='五期海外派送权限初始化失败:仓库岗位最小权限矩阵异常';
|
||||
END IF;
|
||||
@@ -17218,6 +17227,7 @@ BEGIN
|
||||
'platform:overseas-warehouse:delivery:list',
|
||||
'platform:overseas-warehouse:exception-order:list',
|
||||
'platform:overseas-warehouse:exception-order:create',
|
||||
'platform:overseas-warehouse:exception-order:process',
|
||||
'platform:overseas-warehouse:delivery:return',
|
||||
'platform:overseas-warehouse:delivery:status',
|
||||
'platform:overseas-warehouse:customer-visit:list',
|
||||
@@ -18287,6 +18297,149 @@ DELIMITER ;
|
||||
CALL assert_terminal_drayage_schema();
|
||||
DROP PROCEDURE IF EXISTS assert_terminal_drayage_schema;
|
||||
|
||||
-- 货柜双工作台权限开始(与 iam/db/container-workspace-permissions.sql 保持一致)
|
||||
-- 国内送柜报关与国外清关提柜双工作台权限;国内沿用现有货柜权限,国外直接收敛到独立权限族。
|
||||
USE baiyue_iam;
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
DROP PROCEDURE IF EXISTS migrate_container_workspace_permissions;
|
||||
DELIMITER $$
|
||||
CREATE PROCEDURE migrate_container_workspace_permissions()
|
||||
BEGIN
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM iam_permission
|
||||
WHERE (id = 5102090 AND permission_code <> 'platform:firstleg:container:list')
|
||||
OR (id = 5102092 AND permission_code <> 'platform:firstleg:container:create')
|
||||
OR (id = 5102093 AND permission_code <> 'platform:firstleg:container:edit')
|
||||
OR (id = 5102200 AND permission_code <> 'platform:firstleg:terminal-drayage:list')
|
||||
OR (id = 5102201 AND permission_code <> 'platform:firstleg:terminal-drayage:document:edit')
|
||||
OR (id = 5102202 AND permission_code <> 'platform:firstleg:terminal-drayage:fleet:edit')
|
||||
OR (id = 5102203 AND permission_code <> 'platform:firstleg:terminal-drayage:pickup-appointment:edit')
|
||||
OR (id = 5102204 AND permission_code <> 'platform:firstleg:terminal-drayage:pickup:confirm')
|
||||
OR (id = 5102205 AND permission_code <> 'platform:firstleg:terminal-drayage:empty-return:confirm')
|
||||
) OR EXISTS (
|
||||
SELECT 1 FROM iam_permission
|
||||
WHERE (permission_code = 'platform:firstleg:container:list' AND id <> 5102090)
|
||||
OR (permission_code = 'platform:firstleg:container:create' AND id <> 5102092)
|
||||
OR (permission_code = 'platform:firstleg:container:edit' AND id <> 5102093)
|
||||
OR (permission_code = 'platform:firstleg:terminal-drayage:list' AND id <> 5102200)
|
||||
OR (permission_code = 'platform:firstleg:terminal-drayage:document:edit' AND id <> 5102201)
|
||||
OR (permission_code = 'platform:firstleg:terminal-drayage:fleet:edit' AND id <> 5102202)
|
||||
OR (permission_code = 'platform:firstleg:terminal-drayage:pickup-appointment:edit' AND id <> 5102203)
|
||||
OR (permission_code = 'platform:firstleg:terminal-drayage:pickup:confirm' AND id <> 5102204)
|
||||
OR (permission_code = 'platform:firstleg:terminal-drayage:empty-return:confirm' AND id <> 5102205)
|
||||
) THEN
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='货柜双工作台权限初始化失败:权限ID或编码冲突';
|
||||
END IF;
|
||||
|
||||
INSERT INTO iam_permission
|
||||
(id, tenant_id, app_code, permission_type, parent_id, permission_code,
|
||||
permission_name, route_path, http_method, sort_no, status, built_in, deleted)
|
||||
VALUES
|
||||
(5102090,0,'PLATFORM','MENU',5102000,'platform:firstleg:container:list',
|
||||
'国内送柜报关','/container-loading/domestic','GET',40,'ACTIVE',1,0),
|
||||
(5102092,0,'PLATFORM','BUTTON',5102090,'platform:firstleg:container:create',
|
||||
'建立国内货柜',NULL,'POST',20,'ACTIVE',1,0),
|
||||
(5102093,0,'PLATFORM','BUTTON',5102090,'platform:firstleg:container:edit',
|
||||
'维护国内货柜资料',NULL,'PUT',30,'ACTIVE',1,0),
|
||||
(5102200,0,'PLATFORM','MENU',5102000,'platform:firstleg:terminal-drayage:list',
|
||||
'国外清关提柜','/container-loading/overseas','GET',41,'ACTIVE',1,0),
|
||||
(5102201,0,'PLATFORM','BUTTON',5102200,'platform:firstleg:terminal-drayage:document:edit',
|
||||
'维护目的港清关与DO/PU',NULL,'POST',10,'ACTIVE',1,0),
|
||||
(5102202,0,'PLATFORM','BUTTON',5102200,'platform:firstleg:terminal-drayage:fleet:edit',
|
||||
'维护目的港码头车队',NULL,'POST',20,'ACTIVE',1,0),
|
||||
(5102203,0,'PLATFORM','BUTTON',5102200,'platform:firstleg:terminal-drayage:pickup-appointment:edit',
|
||||
'预约目的港提柜',NULL,'POST',30,'ACTIVE',1,0),
|
||||
(5102204,0,'PLATFORM','BUTTON',5102200,'platform:firstleg:terminal-drayage:pickup:confirm',
|
||||
'确认目的港实际提柜',NULL,'POST',40,'ACTIVE',1,0),
|
||||
(5102205,0,'PLATFORM','BUTTON',5102200,'platform:firstleg:terminal-drayage:empty-return:confirm',
|
||||
'确认目的港实际还柜',NULL,'POST',50,'ACTIVE',1,0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
permission_type=VALUES(permission_type), parent_id=VALUES(parent_id),
|
||||
permission_name=VALUES(permission_name), route_path=VALUES(route_path),
|
||||
http_method=VALUES(http_method), sort_no=VALUES(sort_no), status='ACTIVE',
|
||||
built_in=1, deleted=0;
|
||||
|
||||
-- list 已包含详情只读;旧 container:view 不再作为别名或双权限入口。
|
||||
DELETE grant_row FROM iam_role_permission grant_row
|
||||
JOIN iam_permission permission
|
||||
ON permission.id=grant_row.permission_id AND permission.tenant_id=grant_row.tenant_id
|
||||
WHERE permission.tenant_id=0
|
||||
AND permission.permission_code='platform:firstleg:container:view';
|
||||
UPDATE iam_permission
|
||||
SET status='INACTIVE', deleted=1
|
||||
WHERE tenant_id=0 AND permission_code='platform:firstleg:container:view';
|
||||
|
||||
-- 平台超级管理员和现有订单运营保持货柜全链路能力;其他角色按两个菜单独立授权。
|
||||
INSERT IGNORE INTO iam_role_permission (tenant_id, role_id, permission_id, created_at)
|
||||
SELECT 0, role.id, permission.id, CURRENT_TIMESTAMP(3)
|
||||
FROM iam_role role
|
||||
JOIN iam_permission permission
|
||||
ON permission.tenant_id=0 AND permission.app_code='PLATFORM'
|
||||
AND permission.permission_code IN (
|
||||
'platform:firstleg:container:list',
|
||||
'platform:firstleg:container:create',
|
||||
'platform:firstleg:container:edit',
|
||||
'platform:firstleg:terminal-drayage:list',
|
||||
'platform:firstleg:terminal-drayage:document:edit',
|
||||
'platform:firstleg:terminal-drayage:fleet:edit',
|
||||
'platform:firstleg:terminal-drayage:pickup-appointment:edit',
|
||||
'platform:firstleg:terminal-drayage:pickup:confirm',
|
||||
'platform:firstleg:terminal-drayage:empty-return:confirm')
|
||||
WHERE role.tenant_id=0 AND role.app_code='PLATFORM'
|
||||
AND role.role_code IN ('PLATFORM_ADMIN','ORDER_OPERATOR')
|
||||
AND role.status='ACTIVE' AND role.deleted=0
|
||||
AND permission.status='ACTIVE' AND permission.deleted=0;
|
||||
|
||||
IF (SELECT COUNT(*) FROM iam_permission
|
||||
WHERE tenant_id=0 AND app_code='PLATFORM' AND status='ACTIVE' AND deleted=0
|
||||
AND permission_code IN (
|
||||
'platform:firstleg:container:list',
|
||||
'platform:firstleg:container:create',
|
||||
'platform:firstleg:container:edit',
|
||||
'platform:firstleg:terminal-drayage:list',
|
||||
'platform:firstleg:terminal-drayage:document:edit',
|
||||
'platform:firstleg:terminal-drayage:fleet:edit',
|
||||
'platform:firstleg:terminal-drayage:pickup-appointment:edit',
|
||||
'platform:firstleg:terminal-drayage:pickup:confirm',
|
||||
'platform:firstleg:terminal-drayage:empty-return:confirm')) <> 9 THEN
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='货柜双工作台权限初始化失败:权限目录不完整';
|
||||
END IF;
|
||||
|
||||
IF (SELECT COUNT(DISTINCT CONCAT(role.role_code, ':', permission.permission_code))
|
||||
FROM iam_role_permission grant_row
|
||||
JOIN iam_role role
|
||||
ON role.id=grant_row.role_id AND role.tenant_id=grant_row.tenant_id
|
||||
JOIN iam_permission permission
|
||||
ON permission.id=grant_row.permission_id AND permission.tenant_id=grant_row.tenant_id
|
||||
WHERE role.tenant_id=0 AND role.app_code='PLATFORM'
|
||||
AND role.role_code IN ('PLATFORM_ADMIN','ORDER_OPERATOR')
|
||||
AND permission.permission_code IN (
|
||||
'platform:firstleg:container:list',
|
||||
'platform:firstleg:container:create',
|
||||
'platform:firstleg:container:edit',
|
||||
'platform:firstleg:terminal-drayage:list',
|
||||
'platform:firstleg:terminal-drayage:document:edit',
|
||||
'platform:firstleg:terminal-drayage:fleet:edit',
|
||||
'platform:firstleg:terminal-drayage:pickup-appointment:edit',
|
||||
'platform:firstleg:terminal-drayage:pickup:confirm',
|
||||
'platform:firstleg:terminal-drayage:empty-return:confirm')) <> 18 THEN
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='货柜双工作台权限初始化失败:平台默认角色授权不完整';
|
||||
END IF;
|
||||
|
||||
IF EXISTS (SELECT 1 FROM iam_permission
|
||||
WHERE tenant_id=0 AND permission_code='platform:firstleg:container:view'
|
||||
AND (status='ACTIVE' OR deleted=0)) THEN
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='货柜双工作台权限初始化失败:旧查看权限仍然有效';
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
||||
CALL migrate_container_workspace_permissions();
|
||||
DROP PROCEDURE IF EXISTS migrate_container_workspace_permissions;
|
||||
-- 货柜双工作台权限结束,恢复头程数据库上下文
|
||||
USE baiyue_firstleg;
|
||||
|
||||
CALL baiyue_firstleg.assert_unified_final_schema();
|
||||
DROP PROCEDURE IF EXISTS baiyue_firstleg.assert_unified_final_schema;
|
||||
SELECT 'PASS' AS migration_status,
|
||||
|
||||
Reference in New Issue
Block a user