1.应用详情页面时间显示不对,显0-0-0 0:0:0 2.提供应用删除功能,删除前需要判断应用下面没有任何关联订单和凭证等信息
This commit is contained in:
1 parent
101140f3c2
commit
6321cde4c0
8 files changed
+117
-12
No files matched your search
@@ -25,6 +25,26 @@ public class RentalProvisioning {
|
||||
this.orders = orders;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除未使用的应用。actor 为 null 仅供已有运营权限校验的内部入口使用。
|
||||
* 与下单和凭证签发使用相同父行锁,保证检查与删除之间不会插入新关联。
|
||||
* 子记录采用锁定读,避免 MySQL REPEATABLE READ 下读取到旧快照。
|
||||
* 所有历史订单、所有状态凭证均阻止删除;不级联清理任何业务或审计记录。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteApp(long appId, Long actor) {
|
||||
Map<String, Object> app = store.get("app", appId, true);
|
||||
require(actor == null || number(app, "user_id") == actor, "应用不存在或无权访问");
|
||||
require(store.one("SELECT id FROM rent_order WHERE app_id=? LIMIT 1 FOR UPDATE", appId) == null,
|
||||
"应用存在关联订单(包括历史订单),不能删除");
|
||||
require(store.one("SELECT id FROM rent_credential WHERE owner_type='APP' AND owner_id=? LIMIT 1 FOR UPDATE", appId) == null,
|
||||
"应用存在关联凭证(包括历史或已吊销凭证),不能删除");
|
||||
require(store.execute("DELETE FROM rent_app WHERE id=?", appId) == 1, "应用删除失败");
|
||||
// 审计不是活动业务依赖,独立留存创建和删除记录,禁止级联清理。
|
||||
store.event("APP", appId, "DELETE", actor == null ? 0 : actor, "删除无订单及凭证关联的空应用");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public long create(String type, Map<String, Object> request, long actor) {
|
||||
Map<String, Object> row;
|
||||
|
||||
Reference in new issue
Block a user