作者 tangxuhui

添加 系统消息

{"D:\\workspaceGo\\src\\allied-creation-basic\\pkg\\port\\beego":1630467905783651600}
\ No newline at end of file
{"D:\\workspaceGo\\src\\allied-creation-basic\\pkg\\port\\beego":1631502497675932200}
\ No newline at end of file
... ...
... ... @@ -19,6 +19,11 @@ import (
type NoticePersonalService struct {
}
func NewNoticePersonalService(options map[string]interface{}) *NoticePersonalService {
newNoticePersonalService := &NoticePersonalService{}
return newNoticePersonalService
}
// 设置消息:共创申请审核通过
func (noticePersonalService *NoticePersonalService) AgreeJoinCreationProject(agreeJoinCreationProjectCommand *command.AgreeJoinCreationProjectCommand) (interface{}, error) {
if err := agreeJoinCreationProjectCommand.ValidateCommand(); err != nil {
... ... @@ -701,7 +706,53 @@ func (noticePersonalService *NoticePersonalService) ReadNotice(readNoticeCommand
}
return readNoticeCommand, nil
}
func NewNoticePersonalService(options map[string]interface{}) *NoticePersonalService {
newNoticePersonalService := &NoticePersonalService{}
return newNoticePersonalService
//通用消息接口
func (noticePersonalService *NoticePersonalService) CommonNotice(systemNoticeCommand *command.SystemNoticeCommand) (interface{}, error) {
if err := systemNoticeCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
// 个人消息存储初始化
extendStr, _ := json.Marshal(systemNoticeCommand.Extend)
noticePersonal := domain.NoticePersonal{
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
Extend: string(extendStr),
CompanyId: systemNoticeCommand.CompanyId,
Content: systemNoticeCommand.Content,
IsRead: domain.NoticePersonalIsNotRead,
Module: domain.Module00,
ModuleAction: domain.Action00_01,
UserBaseId: systemNoticeCommand.UserBaseId,
OrgId: systemNoticeCommand.OrgId,
UserId: systemNoticeCommand.UserId,
}
var noticePersonalRepository domain.NoticePersonalRepository
if value, err := factory.CreateNoticePersonalRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
noticePersonalRepository = value
}
_, err = noticePersonalRepository.Save(&noticePersonal)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return systemNoticeCommand, nil
}
... ...
... ... @@ -17,6 +17,8 @@ func (controller *NoticePersonalController) GetNoticePersonalList() {
err := controller.Unmarshal(getNoticePersonalListQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
controller.Response(nil, err)
return
}
cnt, list, err := noticePersonalService.GetNoticePersonalList(getNoticePersonalListQuery)
data := map[string]interface{}{
... ... @@ -32,6 +34,8 @@ func (controller *NoticePersonalController) AgreeJoinCreationProject() {
err := controller.Unmarshal(agreeJoinCreationProjectCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
controller.Response(nil, err)
return
}
data, err := noticePersonalService.AgreeJoinCreationProject(agreeJoinCreationProjectCommand)
controller.Response(data, err)
... ... @@ -43,6 +47,8 @@ func (controller *NoticePersonalController) InformExpectedDividends() {
err := controller.Unmarshal(informExpectedDividendsCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
controller.Response(nil, err)
return
}
data, err := noticePersonalService.InformExpectedDividends(informExpectedDividendsCommand)
controller.Response(data, err)
... ... @@ -54,6 +60,8 @@ func (controller *NoticePersonalController) RefuseJoinCreationProject() {
err := controller.Unmarshal(refuseJoinCreationProjectCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
controller.Response(nil, err)
return
}
data, err := noticePersonalService.RefuseJoinCreationProject(refuseJoinCreationProjectCommand)
controller.Response(data, err)
... ... @@ -65,6 +73,8 @@ func (controller *NoticePersonalController) InformJoinCreationContract() {
err := controller.Unmarshal(informJoinCreationContractCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
controller.Response(nil, err)
return
}
data, err := noticePersonalService.InformJoinCreationContract(informJoinCreationContractCommand)
controller.Response(data, err)
... ... @@ -76,6 +86,8 @@ func (controller *NoticePersonalController) CreditAccountEstimate() {
err := controller.Unmarshal(creditAccountEstimateCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
controller.Response(nil, err)
return
}
data, err := noticePersonalService.CreditAccountEstimate(creditAccountEstimateCommand)
controller.Response(data, err)
... ... @@ -87,6 +99,8 @@ func (controller *NoticePersonalController) CreditAccountPayment() {
err := controller.Unmarshal(creditAccountPaymentCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
controller.Response(nil, err)
return
}
data, err := noticePersonalService.CreditAccountPayment(creditAccountPaymentCommand)
controller.Response(data, err)
... ... @@ -98,6 +112,8 @@ func (controller *NoticePersonalController) ReadNotice() {
err := controller.Unmarshal(readNoticeCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
controller.Response(nil, err)
return
}
data, err := noticePersonalService.ReadNotice(readNoticeCommand)
controller.Response(data, err)
... ... @@ -105,5 +121,14 @@ func (controller *NoticePersonalController) ReadNotice() {
//SystemNotice 系统消息
func (controller *NoticePersonalController) SystemNotice() {
noticePersonalService := service.NewNoticePersonalService(nil)
systemNoticeCommand := &command.SystemNoticeCommand{}
err := controller.Unmarshal(systemNoticeCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
controller.Response(nil, err)
return
}
data, err := noticePersonalService.CommonNotice(systemNoticeCommand)
controller.Response(data, err)
}
... ...
... ... @@ -14,4 +14,5 @@ func init() {
web.Router("/notice-personal/inform-join-creation-contract", &controllers.NoticePersonalController{}, "Post:InformJoinCreationContract")
web.Router("/notice-personal/credit-account/dividends-estimate", &controllers.NoticePersonalController{}, "Post:CreditAccountEstimate")
web.Router("/notice-personal/notice-personal/credit-account/payment", &controllers.NoticePersonalController{}, "Post:CreditAccountPayment")
web.Router("/notice-personal/system-notice", &controllers.NoticePersonalController{}, "Post:SystemNotice")
}
... ...