作者 tangxuhui

添加消息字段 msg_type,新增消息类型

... ... @@ -74,6 +74,10 @@ func (noticePersonalService *NoticePersonalService) AgreeJoinCreationProject(agr
extendData := map[string]interface{}{
"creationProjectId": agreeJoinCreationProjectCommand.CreationProjectId,
}
noticeAction, err := domain.GetNoticeModuleAction(domain.Module01, domain.Action01_01)
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
extendStr, _ := json.Marshal(extendData)
noticePersonal := domain.NoticePersonal{
CreatedAt: time.Now(),
... ... @@ -82,11 +86,12 @@ func (noticePersonalService *NoticePersonalService) AgreeJoinCreationProject(agr
CompanyId: agreeJoinCreationProjectCommand.CompanyId,
Content: tplResult.String(),
IsRead: domain.NoticePersonalIsNotRead,
Module: domain.Action01_01,
Module: domain.Module01,
ModuleAction: domain.Action01_01,
UserBaseId: agreeJoinCreationProjectCommand.UserBaseId,
OrgId: agreeJoinCreationProjectCommand.OrgId,
UserId: agreeJoinCreationProjectCommand.UserId,
MsgType: noticeAction.MsgType,
}
var noticePersonalRepository domain.NoticePersonalRepository
if value, err := factory.CreateNoticePersonalRepository(map[string]interface{}{
... ... @@ -225,6 +230,10 @@ func (noticePersonalService *NoticePersonalService) InformExpectedDividends(info
"creationContractId": informExpectedDividendsCommand.CreationContractId,
"dividendsEstimateId": informExpectedDividendsCommand.DividendsEstimateId,
}
noticeAction, err := domain.GetNoticeModuleAction(domain.Module01, domain.Action01_01)
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
extendStr, _ := json.Marshal(extendData)
noticePersonal := domain.NoticePersonal{
CreatedAt: time.Now(),
... ... @@ -238,6 +247,7 @@ func (noticePersonalService *NoticePersonalService) InformExpectedDividends(info
UserBaseId: informExpectedDividendsCommand.UserBaseId,
OrgId: informExpectedDividendsCommand.OrgId,
UserId: informExpectedDividendsCommand.UserId,
MsgType: noticeAction.MsgType,
}
var noticePersonalRepository domain.NoticePersonalRepository
if value, err := factory.CreateNoticePersonalRepository(map[string]interface{}{
... ... @@ -318,6 +328,10 @@ func (noticePersonalService *NoticePersonalService) InformJoinCreationContract(i
}
extendData := map[string]interface{}{}
extendStr, _ := json.Marshal(extendData)
noticeAction, err := domain.GetNoticeModuleAction(domain.Module01, domain.Action01_01)
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
noticePersonal := domain.NoticePersonal{
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
... ... @@ -330,6 +344,7 @@ func (noticePersonalService *NoticePersonalService) InformJoinCreationContract(i
UserBaseId: informJoinCreationContractCommand.UserBaseId,
OrgId: informJoinCreationContractCommand.OrgId,
UserId: informJoinCreationContractCommand.UserId,
MsgType: noticeAction.MsgType,
}
var noticePersonalRepository domain.NoticePersonalRepository
if value, err := factory.CreateNoticePersonalRepository(map[string]interface{}{
... ... @@ -409,6 +424,10 @@ func (noticePersonalService *NoticePersonalService) RefuseJoinCreationProject(re
"creationProjectId": refuseJoinCreationProjectCommand.CreationProjectId,
}
extendStr, _ := json.Marshal(extendData)
noticeAction, err := domain.GetNoticeModuleAction(domain.Module01, domain.Action01_01)
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
noticePersonal := domain.NoticePersonal{
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
... ... @@ -421,6 +440,7 @@ func (noticePersonalService *NoticePersonalService) RefuseJoinCreationProject(re
UserBaseId: refuseJoinCreationProjectCommand.UserBaseId,
OrgId: refuseJoinCreationProjectCommand.OrgId,
UserId: refuseJoinCreationProjectCommand.UserId,
MsgType: noticeAction.MsgType,
}
var noticePersonalRepository domain.NoticePersonalRepository
if value, err := factory.CreateNoticePersonalRepository(map[string]interface{}{
... ... @@ -503,6 +523,10 @@ func (noticePersonalService *NoticePersonalService) CreditAccountEstimate(credit
"dividendsEstimateId": creditAccountEstimateCommand.DividendsEstimateId,
}
extendStr, _ := json.Marshal(extendData)
noticeAction, err := domain.GetNoticeModuleAction(domain.Module01, domain.Action01_01)
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
noticePersonal := domain.NoticePersonal{
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
... ... @@ -515,6 +539,7 @@ func (noticePersonalService *NoticePersonalService) CreditAccountEstimate(credit
UserBaseId: creditAccountEstimateCommand.UserBaseId,
OrgId: creditAccountEstimateCommand.OrgId,
UserId: creditAccountEstimateCommand.UserId,
MsgType: noticeAction.MsgType,
}
var noticePersonalRepository domain.NoticePersonalRepository
if value, err := factory.CreateNoticePersonalRepository(map[string]interface{}{
... ... @@ -596,6 +621,10 @@ func (noticePersonalService *NoticePersonalService) CreditAccountPayment(creditA
"creditAccountId": creditAccountPaymentCommand.CreditAccountId,
}
extendStr, _ := json.Marshal(extendData)
noticeAction, err := domain.GetNoticeModuleAction(domain.Module01, domain.Action01_01)
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
noticePersonal := domain.NoticePersonal{
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
... ... @@ -608,6 +637,7 @@ func (noticePersonalService *NoticePersonalService) CreditAccountPayment(creditA
UserBaseId: creditAccountPaymentCommand.UserBaseId,
OrgId: creditAccountPaymentCommand.OrgId,
UserId: creditAccountPaymentCommand.UserId,
MsgType: noticeAction.MsgType,
}
var noticePersonalRepository domain.NoticePersonalRepository
if value, err := factory.CreateNoticePersonalRepository(map[string]interface{}{
... ... @@ -628,7 +658,7 @@ func (noticePersonalService *NoticePersonalService) CreditAccountPayment(creditA
return noticePersonal, nil
}
// 设置消息:账期结算消息-分红预算
// 读取消息
func (noticePersonalService *NoticePersonalService) ReadNotice(readNoticeCommand *command.ReadNoticeCommand) (interface{}, error) {
if err := readNoticeCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ...
... ... @@ -35,6 +35,8 @@ type NoticePersonal struct {
OrgId int64 `json:"orgId"`
// 接收方用户id
UserId int64 `json:"userId"`
//app端使用
MsgType int `json:"msg_type"`
}
type NoticePersonalRepository interface {
... ...
package domain
import "errors"
//NoticeModule 消息模块
type NoticeModule struct {
ModuleCode string `json:"Code"`
... ... @@ -11,6 +13,7 @@ type NoticeModuleAction struct {
ModuleCode string `json:"module_code"`
ActionCode string `json:"action_Code"`
Name string `json:"name"`
MsgType int `json:"msgType"`
}
// 编排消息需要的变量
... ... @@ -70,13 +73,25 @@ func ValidNoticeModuleAction(moduleCode string, actioncode string) bool {
return false
}
func GetNoticeModuleAction(moduleCode string, actioncode string) (NoticeModuleAction, error) {
for i := range noticeModuleActionList {
if (noticeModuleActionList[i].ActionCode == actioncode) &&
(noticeModuleActionList[i].ModuleCode == moduleCode) {
return noticeModuleActionList[i], nil
}
}
return NoticeModuleAction{}, errors.New("未找到对应的消息动作")
}
//业务模块
const (
Module00 = "module00" // 系统消息
Module01 = "module01" // 天联共创
)
//业务环节
const (
Action00_01 = "action00_01" //系统消息
Action01_01 = "action01_01" //天联共创-共创申请审核通过
Action01_02 = "action01_02" //天联共创-共创申请审核拒绝
Action01_03 = "action01_03" //天联共创-共创确认
... ... @@ -121,12 +136,13 @@ var noticeModuleList = []NoticeModule{
//noticeModuleActionList 业务环节列表
var noticeModuleActionList = []NoticeModuleAction{
{ModuleCode: Module01, ActionCode: Action01_01, Name: "共创申请通过"},
{ModuleCode: Module01, ActionCode: Action01_02, Name: "共创申请拒绝"},
{ModuleCode: Module01, ActionCode: Action01_03, Name: "共创确认"},
{ModuleCode: Module01, ActionCode: Action01_04, Name: "分红预算消息"},
{ModuleCode: Module01, ActionCode: Action01_05, Name: "账期结算消息"},
{ModuleCode: Module01, ActionCode: Action01_06, Name: "支付消息"},
{ModuleCode: Module00, ActionCode: Action00_01, Name: "系统消息", MsgType: 0},
{ModuleCode: Module01, ActionCode: Action01_01, Name: "共创申请通过", MsgType: 0},
{ModuleCode: Module01, ActionCode: Action01_02, Name: "共创申请拒绝", MsgType: 0},
{ModuleCode: Module01, ActionCode: Action01_03, Name: "共创确认", MsgType: 0},
{ModuleCode: Module01, ActionCode: Action01_04, Name: "分红预算消息", MsgType: 0},
{ModuleCode: Module01, ActionCode: Action01_05, Name: "账期结算消息", MsgType: 0},
{ModuleCode: Module01, ActionCode: Action01_06, Name: "支付消息", MsgType: 0},
}
//noticeSettingParamList 业务变量列表
... ...