作者 tangxuhui

个人消息存储数据调整

package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
)
//发送系统消息
type SystemNoticeCommand struct {
// 接收方用户id
UserId int64 `json:"userId"`
UserBaseId int64 `json:"userBaseId" valid:"Required"`
CompanyId int64 `json:"companyId"`
OrgId int64 `json:"orgId"`
Content string `json:"content"` //消息内容
Extend map[string]interface{} `json:"extend"` //内容扩展字段
}
func (systemNoticeCommand *SystemNoticeCommand) Valid(validation *validation.Validation) {
}
func (systemNoticeCommand *SystemNoticeCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(systemNoticeCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
... ... @@ -73,6 +73,8 @@ func (noticePersonalService *NoticePersonalService) AgreeJoinCreationProject(agr
}
extendData := map[string]interface{}{
"creationProjectId": agreeJoinCreationProjectCommand.CreationProjectId,
"creationProjectName": agreeJoinCreationProjectCommand.CreationProjectName,
"creationProjectNumber": agreeJoinCreationProjectCommand.CreationProjectNumber,
}
extendStr, _ := json.Marshal(extendData)
noticePersonal := domain.NoticePersonal{
... ... @@ -226,9 +228,15 @@ func (noticePersonalService *NoticePersonalService) InformExpectedDividends(info
}
extendData := map[string]interface{}{
"creationProjectId": informExpectedDividendsCommand.CreationProjectId,
"creationProjectNumber": informExpectedDividendsCommand.CreationProjectNumber,
"creationProjectName": informExpectedDividendsCommand.CreationProjectName,
"creationContractId": informExpectedDividendsCommand.CreationContractId,
"creationContractName": informExpectedDividendsCommand.CreationContractName,
"productName": informExpectedDividendsCommand.ProductName,
"dividendsEstimateId": informExpectedDividendsCommand.DividendsEstimateId,
"dividendsAmount": informExpectedDividendsCommand.DividendsAmount,
}
extendStr, _ := json.Marshal(extendData)
noticePersonal := domain.NoticePersonal{
CreatedAt: time.Now(),
... ... @@ -320,7 +328,14 @@ func (noticePersonalService *NoticePersonalService) InformJoinCreationContract(i
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "消息体生成失败"+err.Error())
}
extendData := map[string]interface{}{}
extendData := map[string]interface{}{
"creationProjectId": informJoinCreationContractCommand.CreationProjectId,
"creationProjectName": informJoinCreationContractCommand.CreationProjectName,
"creationProjectNumber": informJoinCreationContractCommand.CreationContractNumber,
"creationContractId": informJoinCreationContractCommand.CreationContractId,
"creationContractName": informJoinCreationContractCommand.CreationContractName,
"creationContractNumber": informJoinCreationContractCommand.CreationContractNumber,
}
extendStr, _ := json.Marshal(extendData)
noticePersonal := domain.NoticePersonal{
CreatedAt: time.Now(),
... ... @@ -411,6 +426,8 @@ func (noticePersonalService *NoticePersonalService) RefuseJoinCreationProject(re
}
extendData := map[string]interface{}{
"creationProjectId": refuseJoinCreationProjectCommand.CreationProjectId,
"creationProjectName": refuseJoinCreationProjectCommand.CreationProjectName,
"creationProjectNumber": refuseJoinCreationProjectCommand.CreationProjectNumber,
}
extendStr, _ := json.Marshal(extendData)
noticePersonal := domain.NoticePersonal{
... ... @@ -505,6 +522,8 @@ func (noticePersonalService *NoticePersonalService) CreditAccountEstimate(credit
extendData := map[string]interface{}{
"creditAccountId": creditAccountEstimateCommand.CreditAccountId,
"dividendsEstimateId": creditAccountEstimateCommand.DividendsEstimateId,
"creditAccountOrderNum": creditAccountEstimateCommand.CreditAccountOrderNum,
"dividendsEstimateOrderNumber": creditAccountEstimateCommand.DividendsEstimateOrderNumber,
}
extendStr, _ := json.Marshal(extendData)
noticePersonal := domain.NoticePersonal{
... ... @@ -598,7 +617,11 @@ func (noticePersonalService *NoticePersonalService) CreditAccountPayment(creditA
}
extendData := map[string]interface{}{
"creditAccountId": creditAccountPaymentCommand.CreditAccountId,
"creditAccountOrderNum": creditAccountPaymentCommand.CreditAccountOrderNum,
"settlementAmount": creditAccountPaymentCommand.SettlementAmount,
"actuallyPaidAmount": creditAccountPaymentCommand.ActuallyPaidAmount,
}
extendStr, _ := json.Marshal(extendData)
noticePersonal := domain.NoticePersonal{
CreatedAt: time.Now(),
... ...
... ... @@ -23,7 +23,7 @@ type NoticePersonal struct {
// 业务环节
ModuleAction string
// 编号id
NoticePersonalId int64
NoticePersonalId int64 `pg:",pk"`
// 组织id
OrgId int64
// 消息对应的编码
... ...
... ... @@ -102,3 +102,8 @@ func (controller *NoticePersonalController) ReadNotice() {
data, err := noticePersonalService.ReadNotice(readNoticeCommand)
controller.Response(data, err)
}
//SystemNotice 系统消息
func (controller *NoticePersonalController) SystemNotice() {
}
... ...