作者 tangxuhui

更新

package dto
type NoticeSettingItem struct {
CompanyID int `json:"companyId,string"`
Content string `json:"content"`
IsPush int `json:"isPush"`
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
NoticeSettingID int `json:"noticeSettingId,string"`
OrgID int `json:"orgId,string"`
}
... ...
... ... @@ -11,7 +11,7 @@ type NoticeSettingListQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 查询偏离量
PageNumber int `json:"pageNumber" valid:"Required"`
PageNumber int `json:"pageNumber"`
// 查询限制
PageSize int `json:"pageSize" valid:"Required"`
}
... ...
... ... @@ -5,6 +5,7 @@ import (
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
)
... ... @@ -29,8 +30,20 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingList(noticeSettin
if err != nil {
return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return result.Count, result.NoticeSettings, nil
dataList := []dto.NoticeSettingItem{}
for _, v := range result.List {
item := dto.NoticeSettingItem{
CompanyID: v.CompanyID,
Content: v.Content,
IsPush: v.IsPush,
Module: v.Module,
ModuleAction: v.ModuleAction,
NoticeSettingID: v.NoticeSettingID,
OrgID: v.OrgID,
}
dataList = append(dataList, item)
}
return result.Count, dataList, nil
}
//NoticeSettingProfile 推送消息配置需求的参数候选项
... ... @@ -62,7 +75,7 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingUpdate(noticeSett
IsPush: noticeSettingUpdateCommand.IsPush,
Module: noticeSettingUpdateCommand.Module,
ModuleAction: noticeSettingUpdateCommand.ModuleAction,
OrganizationID: int(noticeSettingUpdateCommand.Operator.OrgId),
OrgId: int(noticeSettingUpdateCommand.Operator.OrgId),
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ... @@ -79,18 +92,18 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingAdd(noticeSetting
noticeSettingAddCommand.Operator,
)
result, err := creationBasicGateway.NoticeSettingAdd(allied_creation_basic.ReqNoticeSettingAdd{
CompanyID: int(noticeSettingAddCommand.Operator.CompanyId),
Content: noticeSettingAddCommand.Content,
IsPush: noticeSettingAddCommand.IsPush,
Module: noticeSettingAddCommand.Module,
ModuleAction: noticeSettingAddCommand.ModuleAction,
OrganizationID: int(noticeSettingAddCommand.Operator.OrgId),
CompanyID: int(noticeSettingAddCommand.Operator.CompanyId),
Content: noticeSettingAddCommand.Content,
IsPush: noticeSettingAddCommand.IsPush,
Module: noticeSettingAddCommand.Module,
ModuleAction: noticeSettingAddCommand.ModuleAction,
OrgId: int(noticeSettingAddCommand.Operator.OrgId),
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
data := struct {
NoticeSettingId int `json:"noticeSettingId"`
NoticeSettingId int `json:"noticeSettingId,string"`
command.NoticeSettingAddCommand
}{
NoticeSettingId: result.NoticeSettingID,
... ... @@ -115,7 +128,16 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingGet(noticeSetting
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return result, nil
data := dto.NoticeSettingItem{
CompanyID: result.CompanyID,
Content: result.Content,
IsPush: result.IsPush,
Module: result.Module,
ModuleAction: result.ModuleAction,
NoticeSettingID: result.NoticeSettingID,
OrgID: result.OrgID,
}
return data, nil
}
func NewNoticeSettingService(options map[string]interface{}) *NoticeSettingService {
... ...
... ... @@ -12,7 +12,7 @@ var LOG_LEVEL = "debug"
var HTTP_PORT int = 8083
//天联共创基础模块
var ALLIED_CREATION_BASIC_HOST = "http://allied-creation-basic-dev.fjmaimaimai.com"
var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080" //"http://allied-creation-basic-dev.fjmaimaimai.com"
//天联共创用户模块
var ALLIED_CREATION_USER_HOST = "http://localhost:8081" //"http://allied-creation-user-dev.fjmaimaimai.com"
... ...
... ... @@ -11,7 +11,7 @@ import (
// NoticeSettingUpdate 更新消息模板
func (gateway HttplibAlliedCreationBasic) NoticeSettingUpdate(param ReqNoticeSettingUpdate) (*DataNoticeSettingUpdate, error) {
url := gateway.baseUrL + "/notice-setting" + strconv.Itoa(param.NoticeSettingID)
url := gateway.baseUrL + "/notice-setting/" + strconv.Itoa(param.NoticeSettingID)
method := "PUT"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:更新消息模板。", map[string]interface{}{
... ...
... ... @@ -9,7 +9,7 @@ type (
IsPush int `json:"isPush"`
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
OrganizationID int `json:"organizationId"`
OrgId int `json:"orgId"`
}
DataNoticeSettingUpdate struct {
... ... @@ -19,19 +19,19 @@ type (
IsPush int `json:"isPush"`
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
OrganizationID int `json:"organizationId"`
OrgId int `json:"orgId"`
}
)
//添加化消息模板
type (
ReqNoticeSettingAdd struct {
CompanyID int `json:"companyId"`
Content string `json:"content"`
IsPush int `json:"isPush"`
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
OrganizationID int `json:"organizationId"`
CompanyID int `json:"companyId"`
Content string `json:"content"`
IsPush int `json:"isPush"`
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
OrgId int `json:"orgId"`
}
DataNoticeSettingAdd struct {
... ... @@ -41,7 +41,7 @@ type (
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
NoticeSettingID int `json:"noticeSettingId"`
OrganizationID int `json:"organizationId"`
OrgId int `json:"orgId"`
}
)
... ... @@ -58,7 +58,7 @@ type (
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
NoticeSettingID int `json:"noticeSettingId"`
OrganizationID int `json:"organizationId"`
OrgID int `json:"orgId"`
}
)
... ... @@ -71,17 +71,16 @@ type (
}
DataNoticeSettingSearch struct {
Count int64 `json:"count"`
NoticeSettings []struct {
Count int64 `json:"count"`
List []struct {
CompanyID int `json:"companyId"`
Content string `json:"content"`
IsPush int `json:"isPush"`
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
NoticeSettingID int `json:"noticeSettingId"`
OrganizationID int `json:"organizationId"`
SysCode string `json:"sysCode"`
} `json:"noticeSettings"`
OrgID int `json:"orgId"`
} `json:"list"`
}
)
... ... @@ -95,8 +94,8 @@ type (
Name string `json:"name"`
} `json:"moduleList"`
ModuleActionList []struct {
ModuleCode string `json:"module_code"`
ActionCode string `json:"action_Code"`
ModuleCode string `json:"moduleCode"`
ActionCode string `json:"actionCode"`
Name string `json:"name"`
} `json:"moduleActionList"`
ParamList []struct {
... ...
... ... @@ -10,4 +10,5 @@ func init() {
web.Router("/v1/web/notice-setting/profile/get", &web_client.NoticeSettingController{}, "Get:NoticeSettingProfile")
web.Router("/v1/web/notice-setting/:settingId", &web_client.NoticeSettingController{}, "Get:NoticeSettingGet")
web.Router("/v1/web/notice-setting/:settingId", &web_client.NoticeSettingController{}, "Put:NoticeSettingUpdate")
web.Router("/v1/web/notice-setting", &web_client.NoticeSettingController{}, "Post:NoticeSettingAdd")
}
... ...