作者 tangxuhui

数据结构调整

... ... @@ -14,14 +14,14 @@ type GetNoticePersonalListQuery struct {
// 每页限制数量 默认20
PageIndex int64 `json:"pageIndex"`
// 是否是已读
IsRead int64 `json:"isRead"`
CompanyId int64 `json:"companyId"`
OrgId int64 `json:"orgId"`
IsRead int64 `json:"isRead"`
UserBaseId int64 `json:"userBaseId"`
CompanyId int64 `json:"companyId"`
OrgId int64 `json:"orgId"`
}
func (getNoticePersonalListQuery *GetNoticePersonalListQuery) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (getNoticePersonalListQuery *GetNoticePersonalListQuery) ValidateQuery() error {
... ...
... ... @@ -74,10 +74,6 @@ 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(),
... ... @@ -91,7 +87,6 @@ func (noticePersonalService *NoticePersonalService) AgreeJoinCreationProject(agr
UserBaseId: agreeJoinCreationProjectCommand.UserBaseId,
OrgId: agreeJoinCreationProjectCommand.OrgId,
UserId: agreeJoinCreationProjectCommand.UserId,
MsgType: noticeAction.MsgType,
}
var noticePersonalRepository domain.NoticePersonalRepository
if value, err := factory.CreateNoticePersonalRepository(map[string]interface{}{
... ... @@ -153,6 +148,9 @@ func (noticePersonalService *NoticePersonalService) GetNoticePersonalList(getNot
if getNoticePersonalListQuery.IsRead > 0 {
queryOption["isRead"] = getNoticePersonalListQuery.IsRead
}
if getNoticePersonalListQuery.UserBaseId > 0 {
queryOption["userBaseId"] = getNoticePersonalListQuery.UserBaseId
}
cnt, noticeList, err := noticePersonalRepository.Find(queryOption)
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -160,6 +158,7 @@ func (noticePersonalService *NoticePersonalService) GetNoticePersonalList(getNot
if err := transactionContext.CommitTransaction(); err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return cnt, noticeList, nil
}
... ... @@ -230,10 +229,6 @@ 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(),
... ... @@ -247,7 +242,6 @@ 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{}{
... ... @@ -328,10 +322,6 @@ 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(),
... ... @@ -344,7 +334,6 @@ 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{}{
... ... @@ -424,10 +413,6 @@ 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(),
... ... @@ -440,7 +425,6 @@ 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{}{
... ... @@ -523,10 +507,6 @@ 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(),
... ... @@ -539,7 +519,6 @@ 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{}{
... ... @@ -621,10 +600,6 @@ 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(),
... ... @@ -637,7 +612,6 @@ 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{}{
... ...
... ... @@ -35,8 +35,6 @@ type NoticePersonal struct {
OrgId int64 `json:"orgId"`
// 接收方用户id
UserId int64 `json:"userId"`
//app端使用
MsgType int `json:"msg_type"`
}
type NoticePersonalRepository interface {
... ...
... ... @@ -10,10 +10,9 @@ type NoticeModule struct {
//NoticeModuleAction 业务环节
type NoticeModuleAction struct {
ModuleCode string `json:"module_code"`
ActionCode string `json:"action_Code"`
ModuleCode string `json:"moduleCode"`
ActionCode string `json:"actionCode"`
Name string `json:"name"`
MsgType int `json:"msgType"`
}
// 编排消息需要的变量
... ... @@ -136,13 +135,13 @@ var noticeModuleList = []NoticeModule{
//noticeModuleActionList 业务环节列表
var noticeModuleActionList = []NoticeModuleAction{
{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},
{ModuleCode: Module00, ActionCode: Action00_01, Name: "系统消息"},
{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: "支付消息"},
}
//noticeSettingParamList 业务变量列表
... ...
... ... @@ -156,6 +156,7 @@ func (repository *NoticePersonalRepository) Find(queryOptions map[string]interfa
query.SetWhereByQueryOption("notice_personal.org_id", "orgId")
query.SetWhereByQueryOption("notice_personal.company_id", "companyId")
query.SetWhereByQueryOption("notice_personal.is_read", "isRead")
query.SetWhereByQueryOption("notice_personal.user_base_id", "userBaseId")
if count, err := query.SelectAndCount(); err != nil {
return 0, noticePersonals, err
} else {
... ...
... ... @@ -4,6 +4,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/noticePersonal/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/noticePersonal/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/noticePersonal/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/log"
)
type NoticePersonalController struct {
... ... @@ -13,6 +14,10 @@ type NoticePersonalController struct {
func (controller *NoticePersonalController) GetNoticePersonalList() {
noticePersonalService := service.NewNoticePersonalService(nil)
getNoticePersonalListQuery := &query.GetNoticePersonalListQuery{}
err := controller.Unmarshal(getNoticePersonalListQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
cnt, list, err := noticePersonalService.GetNoticePersonalList(getNoticePersonalListQuery)
data := map[string]interface{}{
"count": cnt,
... ... @@ -24,7 +29,10 @@ func (controller *NoticePersonalController) GetNoticePersonalList() {
func (controller *NoticePersonalController) AgreeJoinCreationProject() {
noticePersonalService := service.NewNoticePersonalService(nil)
agreeJoinCreationProjectCommand := &command.AgreeJoinCreationProjectCommand{}
controller.Unmarshal(agreeJoinCreationProjectCommand)
err := controller.Unmarshal(agreeJoinCreationProjectCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
data, err := noticePersonalService.AgreeJoinCreationProject(agreeJoinCreationProjectCommand)
controller.Response(data, err)
}
... ... @@ -32,7 +40,10 @@ func (controller *NoticePersonalController) AgreeJoinCreationProject() {
func (controller *NoticePersonalController) InformExpectedDividends() {
noticePersonalService := service.NewNoticePersonalService(nil)
informExpectedDividendsCommand := &command.InformExpectedDividendsCommand{}
controller.Unmarshal(informExpectedDividendsCommand)
err := controller.Unmarshal(informExpectedDividendsCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
data, err := noticePersonalService.InformExpectedDividends(informExpectedDividendsCommand)
controller.Response(data, err)
}
... ... @@ -40,7 +51,10 @@ func (controller *NoticePersonalController) InformExpectedDividends() {
func (controller *NoticePersonalController) RefuseJoinCreationProject() {
noticePersonalService := service.NewNoticePersonalService(nil)
refuseJoinCreationProjectCommand := &command.RefuseJoinCreationProjectCommand{}
controller.Unmarshal(refuseJoinCreationProjectCommand)
err := controller.Unmarshal(refuseJoinCreationProjectCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
data, err := noticePersonalService.RefuseJoinCreationProject(refuseJoinCreationProjectCommand)
controller.Response(data, err)
}
... ... @@ -48,7 +62,10 @@ func (controller *NoticePersonalController) RefuseJoinCreationProject() {
func (controller *NoticePersonalController) InformJoinCreationContract() {
noticePersonalService := service.NewNoticePersonalService(nil)
informJoinCreationContractCommand := &command.InformJoinCreationContractCommand{}
controller.Unmarshal(informJoinCreationContractCommand)
err := controller.Unmarshal(informJoinCreationContractCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
data, err := noticePersonalService.InformJoinCreationContract(informJoinCreationContractCommand)
controller.Response(data, err)
}
... ... @@ -56,7 +73,10 @@ func (controller *NoticePersonalController) InformJoinCreationContract() {
func (controller *NoticePersonalController) CreditAccountEstimate() {
noticePersonalService := service.NewNoticePersonalService(nil)
creditAccountEstimateCommand := &command.CreditAccountEstimateCommand{}
controller.Unmarshal(creditAccountEstimateCommand)
err := controller.Unmarshal(creditAccountEstimateCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
data, err := noticePersonalService.CreditAccountEstimate(creditAccountEstimateCommand)
controller.Response(data, err)
}
... ... @@ -64,7 +84,10 @@ func (controller *NoticePersonalController) CreditAccountEstimate() {
func (controller *NoticePersonalController) CreditAccountPayment() {
noticePersonalService := service.NewNoticePersonalService(nil)
creditAccountPaymentCommand := &command.CreditAccountPaymentCommand{}
controller.Unmarshal(creditAccountPaymentCommand)
err := controller.Unmarshal(creditAccountPaymentCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
data, err := noticePersonalService.CreditAccountPayment(creditAccountPaymentCommand)
controller.Response(data, err)
}
... ... @@ -72,7 +95,10 @@ func (controller *NoticePersonalController) CreditAccountPayment() {
func (controller *NoticePersonalController) ReadNotice() {
noticePersonalService := service.NewNoticePersonalService(nil)
readNoticeCommand := &command.ReadNoticeCommand{}
controller.Unmarshal(readNoticeCommand)
err := controller.Unmarshal(readNoticeCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
data, err := noticePersonalService.ReadNotice(readNoticeCommand)
controller.Response(data, err)
}
... ...
... ... @@ -6,7 +6,7 @@ import (
)
func init() {
web.Router("/notice-personal/", &controllers.NoticePersonalController{}, "Post:GetNoticePersonalList")
web.Router("/notice-personal/search", &controllers.NoticePersonalController{}, "Post:GetNoticePersonalList")
web.Router("/notice-personal/read", &controllers.NoticePersonalController{}, "Post:ReadNotice")
web.Router("/notice-personal/agree-join-creation-project", &controllers.NoticePersonalController{}, "Post:AgreeJoinCreationProject")
web.Router("/notice-personal/inform-expected-dividends", &controllers.NoticePersonalController{}, "Post:InformExpectedDividends")
... ...