作者 Your Name

Merge branch 'dev' into test

1 -{"D:\\workspaceGo\\src\\allied-creation-basic\\pkg\\port\\beego":1630467905783651600}  
  1 +{"D:\\workspaceGo\\src\\allied-creation-basic\\pkg\\port\\beego":1631502497675932200}
@@ -19,6 +19,11 @@ import ( @@ -19,6 +19,11 @@ import (
19 type NoticePersonalService struct { 19 type NoticePersonalService struct {
20 } 20 }
21 21
  22 +func NewNoticePersonalService(options map[string]interface{}) *NoticePersonalService {
  23 + newNoticePersonalService := &NoticePersonalService{}
  24 + return newNoticePersonalService
  25 +}
  26 +
22 // 设置消息:共创申请审核通过 27 // 设置消息:共创申请审核通过
23 func (noticePersonalService *NoticePersonalService) AgreeJoinCreationProject(agreeJoinCreationProjectCommand *command.AgreeJoinCreationProjectCommand) (interface{}, error) { 28 func (noticePersonalService *NoticePersonalService) AgreeJoinCreationProject(agreeJoinCreationProjectCommand *command.AgreeJoinCreationProjectCommand) (interface{}, error) {
24 if err := agreeJoinCreationProjectCommand.ValidateCommand(); err != nil { 29 if err := agreeJoinCreationProjectCommand.ValidateCommand(); err != nil {
@@ -701,7 +706,53 @@ func (noticePersonalService *NoticePersonalService) ReadNotice(readNoticeCommand @@ -701,7 +706,53 @@ func (noticePersonalService *NoticePersonalService) ReadNotice(readNoticeCommand
701 } 706 }
702 return readNoticeCommand, nil 707 return readNoticeCommand, nil
703 } 708 }
704 -func NewNoticePersonalService(options map[string]interface{}) *NoticePersonalService {  
705 - newNoticePersonalService := &NoticePersonalService{}  
706 - return newNoticePersonalService 709 +
  710 +//通用消息接口
  711 +func (noticePersonalService *NoticePersonalService) CommonNotice(systemNoticeCommand *command.SystemNoticeCommand) (interface{}, error) {
  712 + if err := systemNoticeCommand.ValidateCommand(); err != nil {
  713 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  714 + }
  715 + transactionContext, err := factory.CreateTransactionContext(nil)
  716 + if err != nil {
  717 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  718 + }
  719 + if err := transactionContext.StartTransaction(); err != nil {
  720 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  721 + }
  722 + defer func() {
  723 + _ = transactionContext.RollbackTransaction()
  724 + }()
  725 + // 个人消息存储初始化
  726 + extendStr, _ := json.Marshal(systemNoticeCommand.Extend)
  727 + noticePersonal := domain.NoticePersonal{
  728 + CreatedAt: time.Now(),
  729 + UpdatedAt: time.Now(),
  730 + Extend: string(extendStr),
  731 + CompanyId: systemNoticeCommand.CompanyId,
  732 + Content: systemNoticeCommand.Content,
  733 + IsRead: domain.NoticePersonalIsNotRead,
  734 + Module: domain.Module00,
  735 + ModuleAction: domain.Action00_01,
  736 + UserBaseId: systemNoticeCommand.UserBaseId,
  737 + OrgId: systemNoticeCommand.OrgId,
  738 + UserId: systemNoticeCommand.UserId,
  739 + }
  740 + var noticePersonalRepository domain.NoticePersonalRepository
  741 + if value, err := factory.CreateNoticePersonalRepository(map[string]interface{}{
  742 + "transactionContext": transactionContext,
  743 + }); err != nil {
  744 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  745 + } else {
  746 + noticePersonalRepository = value
  747 + }
  748 +
  749 + _, err = noticePersonalRepository.Save(&noticePersonal)
  750 + if err != nil {
  751 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  752 + }
  753 +
  754 + if err := transactionContext.CommitTransaction(); err != nil {
  755 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  756 + }
  757 + return systemNoticeCommand, nil
707 } 758 }
@@ -17,6 +17,8 @@ func (controller *NoticePersonalController) GetNoticePersonalList() { @@ -17,6 +17,8 @@ func (controller *NoticePersonalController) GetNoticePersonalList() {
17 err := controller.Unmarshal(getNoticePersonalListQuery) 17 err := controller.Unmarshal(getNoticePersonalListQuery)
18 if err != nil { 18 if err != nil {
19 log.Logger.Debug("json err:" + err.Error()) 19 log.Logger.Debug("json err:" + err.Error())
  20 + controller.Response(nil, err)
  21 + return
20 } 22 }
21 cnt, list, err := noticePersonalService.GetNoticePersonalList(getNoticePersonalListQuery) 23 cnt, list, err := noticePersonalService.GetNoticePersonalList(getNoticePersonalListQuery)
22 data := map[string]interface{}{ 24 data := map[string]interface{}{
@@ -32,6 +34,8 @@ func (controller *NoticePersonalController) AgreeJoinCreationProject() { @@ -32,6 +34,8 @@ func (controller *NoticePersonalController) AgreeJoinCreationProject() {
32 err := controller.Unmarshal(agreeJoinCreationProjectCommand) 34 err := controller.Unmarshal(agreeJoinCreationProjectCommand)
33 if err != nil { 35 if err != nil {
34 log.Logger.Debug("json err:" + err.Error()) 36 log.Logger.Debug("json err:" + err.Error())
  37 + controller.Response(nil, err)
  38 + return
35 } 39 }
36 data, err := noticePersonalService.AgreeJoinCreationProject(agreeJoinCreationProjectCommand) 40 data, err := noticePersonalService.AgreeJoinCreationProject(agreeJoinCreationProjectCommand)
37 controller.Response(data, err) 41 controller.Response(data, err)
@@ -43,6 +47,8 @@ func (controller *NoticePersonalController) InformExpectedDividends() { @@ -43,6 +47,8 @@ func (controller *NoticePersonalController) InformExpectedDividends() {
43 err := controller.Unmarshal(informExpectedDividendsCommand) 47 err := controller.Unmarshal(informExpectedDividendsCommand)
44 if err != nil { 48 if err != nil {
45 log.Logger.Debug("json err:" + err.Error()) 49 log.Logger.Debug("json err:" + err.Error())
  50 + controller.Response(nil, err)
  51 + return
46 } 52 }
47 data, err := noticePersonalService.InformExpectedDividends(informExpectedDividendsCommand) 53 data, err := noticePersonalService.InformExpectedDividends(informExpectedDividendsCommand)
48 controller.Response(data, err) 54 controller.Response(data, err)
@@ -54,6 +60,8 @@ func (controller *NoticePersonalController) RefuseJoinCreationProject() { @@ -54,6 +60,8 @@ func (controller *NoticePersonalController) RefuseJoinCreationProject() {
54 err := controller.Unmarshal(refuseJoinCreationProjectCommand) 60 err := controller.Unmarshal(refuseJoinCreationProjectCommand)
55 if err != nil { 61 if err != nil {
56 log.Logger.Debug("json err:" + err.Error()) 62 log.Logger.Debug("json err:" + err.Error())
  63 + controller.Response(nil, err)
  64 + return
57 } 65 }
58 data, err := noticePersonalService.RefuseJoinCreationProject(refuseJoinCreationProjectCommand) 66 data, err := noticePersonalService.RefuseJoinCreationProject(refuseJoinCreationProjectCommand)
59 controller.Response(data, err) 67 controller.Response(data, err)
@@ -65,6 +73,8 @@ func (controller *NoticePersonalController) InformJoinCreationContract() { @@ -65,6 +73,8 @@ func (controller *NoticePersonalController) InformJoinCreationContract() {
65 err := controller.Unmarshal(informJoinCreationContractCommand) 73 err := controller.Unmarshal(informJoinCreationContractCommand)
66 if err != nil { 74 if err != nil {
67 log.Logger.Debug("json err:" + err.Error()) 75 log.Logger.Debug("json err:" + err.Error())
  76 + controller.Response(nil, err)
  77 + return
68 } 78 }
69 data, err := noticePersonalService.InformJoinCreationContract(informJoinCreationContractCommand) 79 data, err := noticePersonalService.InformJoinCreationContract(informJoinCreationContractCommand)
70 controller.Response(data, err) 80 controller.Response(data, err)
@@ -76,6 +86,8 @@ func (controller *NoticePersonalController) CreditAccountEstimate() { @@ -76,6 +86,8 @@ func (controller *NoticePersonalController) CreditAccountEstimate() {
76 err := controller.Unmarshal(creditAccountEstimateCommand) 86 err := controller.Unmarshal(creditAccountEstimateCommand)
77 if err != nil { 87 if err != nil {
78 log.Logger.Debug("json err:" + err.Error()) 88 log.Logger.Debug("json err:" + err.Error())
  89 + controller.Response(nil, err)
  90 + return
79 } 91 }
80 data, err := noticePersonalService.CreditAccountEstimate(creditAccountEstimateCommand) 92 data, err := noticePersonalService.CreditAccountEstimate(creditAccountEstimateCommand)
81 controller.Response(data, err) 93 controller.Response(data, err)
@@ -87,6 +99,8 @@ func (controller *NoticePersonalController) CreditAccountPayment() { @@ -87,6 +99,8 @@ func (controller *NoticePersonalController) CreditAccountPayment() {
87 err := controller.Unmarshal(creditAccountPaymentCommand) 99 err := controller.Unmarshal(creditAccountPaymentCommand)
88 if err != nil { 100 if err != nil {
89 log.Logger.Debug("json err:" + err.Error()) 101 log.Logger.Debug("json err:" + err.Error())
  102 + controller.Response(nil, err)
  103 + return
90 } 104 }
91 data, err := noticePersonalService.CreditAccountPayment(creditAccountPaymentCommand) 105 data, err := noticePersonalService.CreditAccountPayment(creditAccountPaymentCommand)
92 controller.Response(data, err) 106 controller.Response(data, err)
@@ -98,6 +112,8 @@ func (controller *NoticePersonalController) ReadNotice() { @@ -98,6 +112,8 @@ func (controller *NoticePersonalController) ReadNotice() {
98 err := controller.Unmarshal(readNoticeCommand) 112 err := controller.Unmarshal(readNoticeCommand)
99 if err != nil { 113 if err != nil {
100 log.Logger.Debug("json err:" + err.Error()) 114 log.Logger.Debug("json err:" + err.Error())
  115 + controller.Response(nil, err)
  116 + return
101 } 117 }
102 data, err := noticePersonalService.ReadNotice(readNoticeCommand) 118 data, err := noticePersonalService.ReadNotice(readNoticeCommand)
103 controller.Response(data, err) 119 controller.Response(data, err)
@@ -105,5 +121,14 @@ func (controller *NoticePersonalController) ReadNotice() { @@ -105,5 +121,14 @@ func (controller *NoticePersonalController) ReadNotice() {
105 121
106 //SystemNotice 系统消息 122 //SystemNotice 系统消息
107 func (controller *NoticePersonalController) SystemNotice() { 123 func (controller *NoticePersonalController) SystemNotice() {
108 - 124 + noticePersonalService := service.NewNoticePersonalService(nil)
  125 + systemNoticeCommand := &command.SystemNoticeCommand{}
  126 + err := controller.Unmarshal(systemNoticeCommand)
  127 + if err != nil {
  128 + log.Logger.Debug("json err:" + err.Error())
  129 + controller.Response(nil, err)
  130 + return
  131 + }
  132 + data, err := noticePersonalService.CommonNotice(systemNoticeCommand)
  133 + controller.Response(data, err)
109 } 134 }
@@ -14,4 +14,5 @@ func init() { @@ -14,4 +14,5 @@ func init() {
14 web.Router("/notice-personal/inform-join-creation-contract", &controllers.NoticePersonalController{}, "Post:InformJoinCreationContract") 14 web.Router("/notice-personal/inform-join-creation-contract", &controllers.NoticePersonalController{}, "Post:InformJoinCreationContract")
15 web.Router("/notice-personal/credit-account/dividends-estimate", &controllers.NoticePersonalController{}, "Post:CreditAccountEstimate") 15 web.Router("/notice-personal/credit-account/dividends-estimate", &controllers.NoticePersonalController{}, "Post:CreditAccountEstimate")
16 web.Router("/notice-personal/notice-personal/credit-account/payment", &controllers.NoticePersonalController{}, "Post:CreditAccountPayment") 16 web.Router("/notice-personal/notice-personal/credit-account/payment", &controllers.NoticePersonalController{}, "Post:CreditAccountPayment")
  17 + web.Router("/notice-personal/system-notice", &controllers.NoticePersonalController{}, "Post:SystemNotice")
17 } 18 }