From af6f1303a5cb75eef2cd70f28b2c67c7c850e877 Mon Sep 17 00:00:00 2001 From: yangzhongjiao Date: Wed, 18 Mar 2026 10:52:59 +0000 Subject: [PATCH 1/2] feat: add start and end time fields to CompanyNotice model - Updated the CompanyNotice struct to include StartTime and EndTime fields for better notice management. - Modified conversion functions to handle the new fields when converting between biz and model representations. --- internal/dms/storage/convert.go | 4 ++++ internal/dms/storage/model/model.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/internal/dms/storage/convert.go b/internal/dms/storage/convert.go index 6107c528..52dc90e0 100644 --- a/internal/dms/storage/convert.go +++ b/internal/dms/storage/convert.go @@ -990,6 +990,8 @@ func convertBizCompanyNotice(b *biz.CompanyNotice) (*model.CompanyNotice, error) }, NoticeStr: b.NoticeStr, ReadUserIds: b.ReadUserIds, + StartTime: b.StartTime, + EndTime: b.EndTime, }, nil } @@ -999,6 +1001,8 @@ func convertModelCompanyNotice(m *model.CompanyNotice) (*biz.CompanyNotice, erro UID: m.UID, NoticeStr: m.NoticeStr, ReadUserIds: m.ReadUserIds, + StartTime: m.StartTime, + EndTime: m.EndTime, } return p, nil diff --git a/internal/dms/storage/model/model.go b/internal/dms/storage/model/model.go index 5a0282e4..7140805e 100644 --- a/internal/dms/storage/model/model.go +++ b/internal/dms/storage/model/model.go @@ -440,6 +440,8 @@ type CompanyNotice struct { Model NoticeStr string `gorm:"type:mediumtext;comment:'企业公告'" json:"notice_str"` ReadUserIds ReadUsers `gorm:"type:longtext" json:"read_user_ids"` + StartTime *time.Time `json:"start_time" gorm:"column:start_time;comment:'公告开始时间'"` + EndTime *time.Time `json:"end_time" gorm:"column:end_time;comment:'公告结束时间'"` } type ReadUsers []string From 35ea0df133b728a6002a6f7aadc69da83d65d39f Mon Sep 17 00:00:00 2001 From: yangzhongjiao Date: Fri, 20 Mar 2026 09:35:00 +0000 Subject: [PATCH 2/2] feat(company-notice): add CreateUserUID to CompanyNotice model and update retrieval logic - Added CreateUserUID field to the CompanyNotice struct for tracking the creator of the notice. - Updated conversion functions to include CreateUserUID when converting between biz and model representations. - Enhanced GetCompanyNotice method to retrieve and display the creator's name based on CreateUserUID. --- internal/dms/service/company_notice.go | 6 ++++++ internal/dms/storage/convert.go | 2 ++ internal/dms/storage/model/model.go | 1 + 3 files changed, 9 insertions(+) diff --git a/internal/dms/service/company_notice.go b/internal/dms/service/company_notice.go index 81b41ea8..a6ea52e2 100644 --- a/internal/dms/service/company_notice.go +++ b/internal/dms/service/company_notice.go @@ -16,6 +16,12 @@ func (d *DMSService) GetCompanyNotice(ctx context.Context, currentUserUid string } if companyNotice != nil { data.NoticeStr = companyNotice.NoticeStr + if companyNotice.CreateUserUID != "" { + users := d.UserUsecase.GetBizUserWithNameByUids(ctx, []string{companyNotice.CreateUserUID}) + if len(users) > 0 { + data.CreateUserName = users[0].Name + } + } data.StartTime = companyNotice.StartTime data.ExpireTime = companyNotice.EndTime } diff --git a/internal/dms/storage/convert.go b/internal/dms/storage/convert.go index 52dc90e0..2199833c 100644 --- a/internal/dms/storage/convert.go +++ b/internal/dms/storage/convert.go @@ -988,6 +988,7 @@ func convertBizCompanyNotice(b *biz.CompanyNotice) (*model.CompanyNotice, error) Model: model.Model{ UID: b.UID, }, + CreateUserUID: b.CreateUserUID, NoticeStr: b.NoticeStr, ReadUserIds: b.ReadUserIds, StartTime: b.StartTime, @@ -999,6 +1000,7 @@ func convertModelCompanyNotice(m *model.CompanyNotice) (*biz.CompanyNotice, erro p := &biz.CompanyNotice{ Base: convertBase(m.Model), UID: m.UID, + CreateUserUID: m.CreateUserUID, NoticeStr: m.NoticeStr, ReadUserIds: m.ReadUserIds, StartTime: m.StartTime, diff --git a/internal/dms/storage/model/model.go b/internal/dms/storage/model/model.go index 7140805e..422c7756 100644 --- a/internal/dms/storage/model/model.go +++ b/internal/dms/storage/model/model.go @@ -438,6 +438,7 @@ type BasicConfig struct { type CompanyNotice struct { Model + CreateUserUID string `json:"create_user_uid" gorm:"column:create_user_uid;size:32;comment:'创建人uid'"` NoticeStr string `gorm:"type:mediumtext;comment:'企业公告'" json:"notice_str"` ReadUserIds ReadUsers `gorm:"type:longtext" json:"read_user_ids"` StartTime *time.Time `json:"start_time" gorm:"column:start_time;comment:'公告开始时间'"`