feat(手机号资产关联): AUG26-009 手机号—资产关联、十项上限与后台解绑
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m2s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m2s
- 新增成对迁移 000223(tb_phone_asset_association,含有效关系部分唯一索引与 down 守卫)与 000224(解绑导入任务表),不回填历史 - H5:need_bind_phone 三支判定(开关关闭完全短路);已有主号幂等建联;十项上限按手机号 advisory 串行化(含换绑到全新号的并发场景);换绑原子迁移与冲突整单回滚;不写遗留列 - 后台:关联列表、单项/批量解绑、CSV 导入解绑(B1–B16),超管/平台 gate + 资产数据范围复核,三态统一文案 - 读侧:卡/设备列表与详情按页一次 IN 聚合;两类导出补「关联手机号」列并保留历史表头反解兼容 - 脱敏:关联审计走独立动作/资源只写脱敏手机号;访问日志手机号类字段脱敏 - 同步主 Spec openspec/specs/phone-asset-association 并归档 AUG26-009,补齐 requirement-evidence 与入口矩阵,context-health 通过
This commit is contained in:
@@ -42,6 +42,7 @@ type Service struct {
|
||||
assetIdentifierStore *postgres.AssetIdentifierStore
|
||||
enterpriseDeviceAuthStore *postgres.EnterpriseDeviceAuthorizationStore
|
||||
enterpriseStore *postgres.EnterpriseStore
|
||||
associationStore *postgres.PhoneAssetAssociationStore
|
||||
packageExpiryQuery *packageexpiry.Query
|
||||
observationSeriesEvents cardObservationApp.SeriesEventWriter
|
||||
observationSeries cardObservationApp.BestEffortSeriesDispatcher
|
||||
@@ -59,6 +60,11 @@ func (s *Service) SetObservationSeriesDispatcher(dispatcher cardObservationApp.B
|
||||
s.observationSeries = dispatcher
|
||||
}
|
||||
|
||||
// SetPhoneAssetAssociationStore 注入手机号—资产关联 store(用于列表响应回填关联手机号)
|
||||
func (s *Service) SetPhoneAssetAssociationStore(store *postgres.PhoneAssetAssociationStore) {
|
||||
s.associationStore = store
|
||||
}
|
||||
|
||||
type deviceControlObservationSnapshot struct {
|
||||
SourceCardID uint
|
||||
TargetCardID uint
|
||||
@@ -260,6 +266,14 @@ func (s *Service) List(ctx context.Context, req *dto.ListDeviceRequest) (*dto.Li
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 关联手机号按当页资产集合一次 IN 批量聚合后装配,禁止逐资产查询形成 N+1。
|
||||
if s.associationStore == nil {
|
||||
return nil, errors.New(errors.CodeInternalError, "手机号资产关联查询未初始化")
|
||||
}
|
||||
associatedPhones, err := s.associationStore.ListValidByAssets(ctx, constants.AssetTypeDevice, deviceIDs)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(errors.CodeInternalError, err, "查询设备关联手机号失败")
|
||||
}
|
||||
|
||||
shopMap := s.loadShopData(ctx, devices)
|
||||
seriesMap := s.loadSeriesNames(ctx, devices)
|
||||
@@ -294,6 +308,7 @@ func (s *Service) List(ctx context.Context, req *dto.ListDeviceRequest) (*dto.Li
|
||||
for _, device := range devices {
|
||||
item := s.toDeviceResponse(device, shopMap, seriesMap, bindingCounts, activationStatuses)
|
||||
item.PackageExpiryEstimate = expiryEstimates[device.ID]
|
||||
item.AssociatedPhones = associatedPhones[device.ID]
|
||||
if eid, ok := deviceEnterpriseMap[device.ID]; ok {
|
||||
item.AuthorizedEnterpriseID = &eid
|
||||
item.AuthorizedEnterpriseName = enterpriseNameMap[eid]
|
||||
|
||||
Reference in New Issue
Block a user