-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### 做了什么 **一、 在数据库实体Account中发生以下变更** - 变更原有status字段名为blocked_in_cluster,表示在集群中是否为封锁状态 - 增加 state字段,列值为 "NORMAL","FROZEN","BLOCKED_BY_ADMIN"的枚举值,且通常情况新建账户时state的默认值为NORMAL - state字段的历史数据迁移遵循以下原则: 如果历史数据中的账户数据,不在白名单中且在集群中状态为封锁且余额大于当前账户封锁阈值(账户封锁阈值不存在时为租 户默认封锁阈值)--> state="BLOCKED_BY_ADMIN"; 其他情况 state="NORMAL" 请测试老师注意与 #1170 在测试时数据库变更的冲突 **二、页面账户状态优化** ![image](https://github.com/PKUHPC/SCOW/assets/43978285/1a0be1b4-f882-4cd1-a0ef-8bc0d27da3ac) ![image](https://github.com/PKUHPC/SCOW/assets/43978285/67ad6936-7960-4158-86d0-613149ce6c92) ![image](https://github.com/PKUHPC/SCOW/assets/43978285/1187e84a-2567-403d-9db6-a8c984df1474) **1. 创建账户** (1)新建账户 :余额(创建时为0)<=租户默认封锁阈值时 账户页面展示状态为欠费,反之正常 (2)导入用户时创建账户的情况 a.账户之前在集群中状态为未封锁,选择不添加入白名单,同(1) PKUHPC/scow-internal-dev#509 b.账户之前在集群中状态为封锁,选择不添加入白名单,认为已被上级手动封锁,,页面状态变为封锁 **2. 添加或移出白名单** (1)添加入白名单: 默认为解封操做,状态为正常 (2)移出白名单: 余额<=账户封锁阈值(没有设置时租户默认封锁阈值)时状态变为欠费,余额>封锁阈值为正常 ` eg.分别将正常,欠费,封锁状态的账户加入白名单时 ` ![image](https://github.com/PKUHPC/SCOW/assets/43978285/cbc31851-0577-43e2-aeed-584cc8f3b55c) ![image](https://github.com/PKUHPC/SCOW/assets/43978285/00afe9f7-69ff-435d-80fe-6ae2d85541d8) ![image](https://github.com/PKUHPC/SCOW/assets/43978285/827ea256-3a4b-4aa5-b222-9631551de525) `再依次移出白名单,原封锁状态消失,依次根据余额与阈值比较显示状态为正常或欠费` ![image](https://github.com/PKUHPC/SCOW/assets/43978285/e0d114a3-bf59-4f67-b2d0-e10e1f793662) **3.封锁解封** (1)白名单以外的账户封锁时:状态变更为封锁,支持欠费状态变更为封锁 (2)解封账户:余额<=账户封锁阈值(没有设置时租户默认封锁阈值)时状态变为欠费,余额>封锁阈值为正常 ` eg.将正常与欠费状态账户封锁 ` ![image](https://github.com/PKUHPC/SCOW/assets/43978285/0af3d993-1b24-4bd3-b45d-28f4166832b6) ![image](https://github.com/PKUHPC/SCOW/assets/43978285/1accc2bb-447c-4b80-8821-5ad3817d20a6) **4.充值和扣费** (1)充值: 封锁/正常时 充值状态不变;欠费时根据充值后状态 再次判断余额和封锁阈值,判断是否欠费 (2)扣费:已在白名单中显示正常状态的账户扣费时状态不变;不在白名单中未欠费显示正常的账户,扣费后再次判断余额和封锁阈值,判断是否欠费 ` eg.分别对欠费和封锁账户进行充值` ![image](https://github.com/PKUHPC/SCOW/assets/43978285/d2ca1212-8652-4858-bca9-9a1aab5c0b8d) ![image](https://github.com/PKUHPC/SCOW/assets/43978285/42e183b2-76c2-4cba-9b91-4c4962b2307b) ![image](https://github.com/PKUHPC/SCOW/assets/43978285/8e66e162-3413-48b7-b9a5-eab20890ce32) **5.修改封锁阈值** (1)修改账户封锁阈值 (2)修改租户下的默认封锁阈值,检查所有使用该租户默认封锁阈值的账户是否需要更新 ` eg.将租户封锁阈值由 -100修改为100 ` ![image](https://github.com/PKUHPC/SCOW/assets/43978285/6884682a-9589-4acc-b475-22549619e5b2) ![image](https://github.com/PKUHPC/SCOW/assets/43978285/5a5bb179-a099-4f19-a986-14dd2b870315) ![image](https://github.com/PKUHPC/SCOW/assets/43978285/e486ec73-01eb-438a-8ce2-563043385340) **三、修改账户导出功能** 按新增正常TAB增加正常状态导出,修改导出时状态展示列与列表一致
- Loading branch information
Showing
41 changed files
with
946 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@scow/mis-server": patch | ||
"@scow/mis-web": patch | ||
--- | ||
|
||
修改 Account 实体中原 blocked 字段名为 blocked_in_cluster ,表示在集群中是否为封锁状态 | ||
增加字段 state ,字段值为 "NORMAL" , "FROZEN" , "BLOCKED_BY_ADMIN" 的枚举值,优化页面账户显示状态为正常、封锁、欠费 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@scow/grpc-api": patch | ||
--- | ||
|
||
在 GetAccounts 接口中增加账户状态,账户显示状态,账户白名单状态的返回值,exportAccounts 接口中增加欠费,冻结的查询参数 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Migration } from '@mikro-orm/migrations'; | ||
|
||
export class Migration20240304064259 extends Migration { | ||
|
||
async up(): Promise<void> { | ||
this.addSql('alter table `account` add `state` enum(\'FROZEN\', \'BLOCKED_BY_ADMIN\', \'NORMAL\') not null comment \'FROZEN, BLOCKED_BY_ADMIN, NORMAL\';'); | ||
this.addSql('alter table `account` change `blocked` `blocked_in_cluster` tinyint(1) not null;'); | ||
|
||
this.addSql(` | ||
UPDATE account a | ||
SET a.state = | ||
CASE | ||
WHEN a.whitelist_id IS NULL AND a.blocked_in_cluster = 1 | ||
AND a.balance > COALESCE(a.block_threshold_amount, (SELECT t.default_account_block_threshold FROM tenant t WHERE a.tenant_id = t.id)) | ||
THEN 'BLOCKED_BY_ADMIN' | ||
ELSE 'NORMAL' | ||
END; | ||
`); | ||
} | ||
|
||
async down(): Promise<void> { | ||
this.addSql('alter table `account` drop column `state`;'); | ||
|
||
this.addSql('alter table `account` change `blocked_in_cluster` `blocked` tinyint(1) not null;'); | ||
} | ||
|
||
} |
Oops, something went wrong.