作者 tangxuhui

个人消息存储数据调整

  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/beego/beego/v2/core/validation"
  7 +)
  8 +
  9 +//发送系统消息
  10 +type SystemNoticeCommand struct {
  11 + // 接收方用户id
  12 + UserId int64 `json:"userId"`
  13 + UserBaseId int64 `json:"userBaseId" valid:"Required"`
  14 + CompanyId int64 `json:"companyId"`
  15 + OrgId int64 `json:"orgId"`
  16 + Content string `json:"content"` //消息内容
  17 + Extend map[string]interface{} `json:"extend"` //内容扩展字段
  18 +}
  19 +
  20 +func (systemNoticeCommand *SystemNoticeCommand) Valid(validation *validation.Validation) {
  21 +
  22 +}
  23 +
  24 +func (systemNoticeCommand *SystemNoticeCommand) ValidateCommand() error {
  25 + valid := validation.Validation{}
  26 + b, err := valid.Valid(systemNoticeCommand)
  27 + if err != nil {
  28 + return err
  29 + }
  30 + if !b {
  31 + for _, validErr := range valid.Errors {
  32 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  33 + }
  34 + }
  35 + return nil
  36 +}
@@ -72,7 +72,9 @@ func (noticePersonalService *NoticePersonalService) AgreeJoinCreationProject(agr @@ -72,7 +72,9 @@ func (noticePersonalService *NoticePersonalService) AgreeJoinCreationProject(agr
72 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "消息体生成失败"+err.Error()) 72 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "消息体生成失败"+err.Error())
73 } 73 }
74 extendData := map[string]interface{}{ 74 extendData := map[string]interface{}{
75 - "creationProjectId": agreeJoinCreationProjectCommand.CreationProjectId, 75 + "creationProjectId": agreeJoinCreationProjectCommand.CreationProjectId,
  76 + "creationProjectName": agreeJoinCreationProjectCommand.CreationProjectName,
  77 + "creationProjectNumber": agreeJoinCreationProjectCommand.CreationProjectNumber,
76 } 78 }
77 extendStr, _ := json.Marshal(extendData) 79 extendStr, _ := json.Marshal(extendData)
78 noticePersonal := domain.NoticePersonal{ 80 noticePersonal := domain.NoticePersonal{
@@ -225,10 +227,16 @@ func (noticePersonalService *NoticePersonalService) InformExpectedDividends(info @@ -225,10 +227,16 @@ func (noticePersonalService *NoticePersonalService) InformExpectedDividends(info
225 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "消息体生成失败"+err.Error()) 227 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "消息体生成失败"+err.Error())
226 } 228 }
227 extendData := map[string]interface{}{ 229 extendData := map[string]interface{}{
228 - "creationProjectId": informExpectedDividendsCommand.CreationProjectId,  
229 - "creationContractId": informExpectedDividendsCommand.CreationContractId,  
230 - "dividendsEstimateId": informExpectedDividendsCommand.DividendsEstimateId, 230 + "creationProjectId": informExpectedDividendsCommand.CreationProjectId,
  231 + "creationProjectNumber": informExpectedDividendsCommand.CreationProjectNumber,
  232 + "creationProjectName": informExpectedDividendsCommand.CreationProjectName,
  233 + "creationContractId": informExpectedDividendsCommand.CreationContractId,
  234 + "creationContractName": informExpectedDividendsCommand.CreationContractName,
  235 + "productName": informExpectedDividendsCommand.ProductName,
  236 + "dividendsEstimateId": informExpectedDividendsCommand.DividendsEstimateId,
  237 + "dividendsAmount": informExpectedDividendsCommand.DividendsAmount,
231 } 238 }
  239 +
232 extendStr, _ := json.Marshal(extendData) 240 extendStr, _ := json.Marshal(extendData)
233 noticePersonal := domain.NoticePersonal{ 241 noticePersonal := domain.NoticePersonal{
234 CreatedAt: time.Now(), 242 CreatedAt: time.Now(),
@@ -320,7 +328,14 @@ func (noticePersonalService *NoticePersonalService) InformJoinCreationContract(i @@ -320,7 +328,14 @@ func (noticePersonalService *NoticePersonalService) InformJoinCreationContract(i
320 if err != nil { 328 if err != nil {
321 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "消息体生成失败"+err.Error()) 329 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "消息体生成失败"+err.Error())
322 } 330 }
323 - extendData := map[string]interface{}{} 331 + extendData := map[string]interface{}{
  332 + "creationProjectId": informJoinCreationContractCommand.CreationProjectId,
  333 + "creationProjectName": informJoinCreationContractCommand.CreationProjectName,
  334 + "creationProjectNumber": informJoinCreationContractCommand.CreationContractNumber,
  335 + "creationContractId": informJoinCreationContractCommand.CreationContractId,
  336 + "creationContractName": informJoinCreationContractCommand.CreationContractName,
  337 + "creationContractNumber": informJoinCreationContractCommand.CreationContractNumber,
  338 + }
324 extendStr, _ := json.Marshal(extendData) 339 extendStr, _ := json.Marshal(extendData)
325 noticePersonal := domain.NoticePersonal{ 340 noticePersonal := domain.NoticePersonal{
326 CreatedAt: time.Now(), 341 CreatedAt: time.Now(),
@@ -410,7 +425,9 @@ func (noticePersonalService *NoticePersonalService) RefuseJoinCreationProject(re @@ -410,7 +425,9 @@ func (noticePersonalService *NoticePersonalService) RefuseJoinCreationProject(re
410 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "消息体生成失败"+err.Error()) 425 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "消息体生成失败"+err.Error())
411 } 426 }
412 extendData := map[string]interface{}{ 427 extendData := map[string]interface{}{
413 - "creationProjectId": refuseJoinCreationProjectCommand.CreationProjectId, 428 + "creationProjectId": refuseJoinCreationProjectCommand.CreationProjectId,
  429 + "creationProjectName": refuseJoinCreationProjectCommand.CreationProjectName,
  430 + "creationProjectNumber": refuseJoinCreationProjectCommand.CreationProjectNumber,
414 } 431 }
415 extendStr, _ := json.Marshal(extendData) 432 extendStr, _ := json.Marshal(extendData)
416 noticePersonal := domain.NoticePersonal{ 433 noticePersonal := domain.NoticePersonal{
@@ -503,8 +520,10 @@ func (noticePersonalService *NoticePersonalService) CreditAccountEstimate(credit @@ -503,8 +520,10 @@ func (noticePersonalService *NoticePersonalService) CreditAccountEstimate(credit
503 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "消息体生成失败"+err.Error()) 520 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "消息体生成失败"+err.Error())
504 } 521 }
505 extendData := map[string]interface{}{ 522 extendData := map[string]interface{}{
506 - "creditAccountId": creditAccountEstimateCommand.CreditAccountId,  
507 - "dividendsEstimateId": creditAccountEstimateCommand.DividendsEstimateId, 523 + "creditAccountId": creditAccountEstimateCommand.CreditAccountId,
  524 + "dividendsEstimateId": creditAccountEstimateCommand.DividendsEstimateId,
  525 + "creditAccountOrderNum": creditAccountEstimateCommand.CreditAccountOrderNum,
  526 + "dividendsEstimateOrderNumber": creditAccountEstimateCommand.DividendsEstimateOrderNumber,
508 } 527 }
509 extendStr, _ := json.Marshal(extendData) 528 extendStr, _ := json.Marshal(extendData)
510 noticePersonal := domain.NoticePersonal{ 529 noticePersonal := domain.NoticePersonal{
@@ -597,8 +616,12 @@ func (noticePersonalService *NoticePersonalService) CreditAccountPayment(creditA @@ -597,8 +616,12 @@ func (noticePersonalService *NoticePersonalService) CreditAccountPayment(creditA
597 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "消息体生成失败"+err.Error()) 616 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "消息体生成失败"+err.Error())
598 } 617 }
599 extendData := map[string]interface{}{ 618 extendData := map[string]interface{}{
600 - "creditAccountId": creditAccountPaymentCommand.CreditAccountId, 619 + "creditAccountId": creditAccountPaymentCommand.CreditAccountId,
  620 + "creditAccountOrderNum": creditAccountPaymentCommand.CreditAccountOrderNum,
  621 + "settlementAmount": creditAccountPaymentCommand.SettlementAmount,
  622 + "actuallyPaidAmount": creditAccountPaymentCommand.ActuallyPaidAmount,
601 } 623 }
  624 +
602 extendStr, _ := json.Marshal(extendData) 625 extendStr, _ := json.Marshal(extendData)
603 noticePersonal := domain.NoticePersonal{ 626 noticePersonal := domain.NoticePersonal{
604 CreatedAt: time.Now(), 627 CreatedAt: time.Now(),
@@ -23,7 +23,7 @@ type NoticePersonal struct { @@ -23,7 +23,7 @@ type NoticePersonal struct {
23 // 业务环节 23 // 业务环节
24 ModuleAction string 24 ModuleAction string
25 // 编号id 25 // 编号id
26 - NoticePersonalId int64 26 + NoticePersonalId int64 `pg:",pk"`
27 // 组织id 27 // 组织id
28 OrgId int64 28 OrgId int64
29 // 消息对应的编码 29 // 消息对应的编码
@@ -102,3 +102,8 @@ func (controller *NoticePersonalController) ReadNotice() { @@ -102,3 +102,8 @@ func (controller *NoticePersonalController) ReadNotice() {
102 data, err := noticePersonalService.ReadNotice(readNoticeCommand) 102 data, err := noticePersonalService.ReadNotice(readNoticeCommand)
103 controller.Response(data, err) 103 controller.Response(data, err)
104 } 104 }
  105 +
  106 +//SystemNotice 系统消息
  107 +func (controller *NoticePersonalController) SystemNotice() {
  108 +
  109 +}