正在显示
16 个修改的文件
包含
575 行增加
和
19 行删除
@@ -17,7 +17,7 @@ func NewCommonService(options map[string]interface{}) *CommonService { | @@ -17,7 +17,7 @@ func NewCommonService(options map[string]interface{}) *CommonService { | ||
17 | 17 | ||
18 | //GetDictionaryByCode 根据code获取字典数据 | 18 | //GetDictionaryByCode 根据code获取字典数据 |
19 | func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDictionaryByCodeQuery) (interface{}, error) { | 19 | func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDictionaryByCodeQuery) (interface{}, error) { |
20 | - creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic() | 20 | + creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(0, 0, 0) |
21 | result, err := creationBasicGateway.GetDictionarysByCode(allied_creation_basic.ReqGetDictionaryByCode{ | 21 | result, err := creationBasicGateway.GetDictionarysByCode(allied_creation_basic.ReqGetDictionaryByCode{ |
22 | DictCode: getDictionaryQuery.DictCode, | 22 | DictCode: getDictionaryQuery.DictCode, |
23 | }) | 23 | }) |
@@ -7,6 +7,7 @@ import ( | @@ -7,6 +7,7 @@ import ( | ||
7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | 7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" |
8 | ) | 8 | ) |
9 | 9 | ||
10 | +//更新自定义菜单 | ||
10 | type MenuUpdateCommand struct { | 11 | type MenuUpdateCommand struct { |
11 | //操作人 | 12 | //操作人 |
12 | Operator domain.Operator `json:"-"` | 13 | Operator domain.Operator `json:"-"` |
@@ -7,6 +7,7 @@ import ( | @@ -7,6 +7,7 @@ import ( | ||
7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | 7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" |
8 | ) | 8 | ) |
9 | 9 | ||
10 | +//获取自定义菜单列表 | ||
10 | type MenuListQuery struct { | 11 | type MenuListQuery struct { |
11 | //操作人 | 12 | //操作人 |
12 | Operator domain.Operator `json:"-"` | 13 | Operator domain.Operator `json:"-"` |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + | ||
6 | + "github.com/beego/beego/v2/core/validation" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
8 | +) | ||
9 | + | ||
10 | +type NoticeSettingAddCommand struct { | ||
11 | + //操作人 | ||
12 | + Operator domain.Operator `json:"-"` | ||
13 | + // 消息对应的业务模块 | ||
14 | + Module string `json:"module" valid:"Required"` | ||
15 | + // 业务环节 | ||
16 | + ModuleAction string `json:"moduleAction" valid:"Required"` | ||
17 | + // 是否推送 【是:1】【否:2】 | ||
18 | + IsPush int `json:"isPush" valid:"Required"` | ||
19 | + // 内容模板 | ||
20 | + Content string `json:"content" valid:"Required"` | ||
21 | +} | ||
22 | + | ||
23 | +func (noticeSettingUpdateQuery *NoticeSettingAddCommand) Valid(validation *validation.Validation) { | ||
24 | + | ||
25 | +} | ||
26 | + | ||
27 | +func (noticeSettingUpdateQuery *NoticeSettingAddCommand) ValidateCommand() error { | ||
28 | + valid := validation.Validation{} | ||
29 | + b, err := valid.Valid(noticeSettingUpdateQuery) | ||
30 | + if err != nil { | ||
31 | + return err | ||
32 | + } | ||
33 | + if !b { | ||
34 | + for _, validErr := range valid.Errors { | ||
35 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
36 | + } | ||
37 | + } | ||
38 | + return nil | ||
39 | +} |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + | ||
6 | + "github.com/beego/beego/v2/core/validation" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
8 | +) | ||
9 | + | ||
10 | +type NoticeSettingUpdateCommand struct { | ||
11 | + //操作人 | ||
12 | + Operator domain.Operator `json:"-"` | ||
13 | + // id | ||
14 | + NoticeSettingId string `json:"noticeSetting"` | ||
15 | + // 消息对应的业务模块 | ||
16 | + Module string `json:"module" valid:"Required"` | ||
17 | + // 业务环节 | ||
18 | + ModuleAction string `json:"moduleAction" valid:"Required"` | ||
19 | + // 是否推送 【是:1】【否:2】 | ||
20 | + IsPush int `json:"isPush" valid:"Required"` | ||
21 | + // 内容模板 | ||
22 | + Content string `json:"content" valid:"Required"` | ||
23 | +} | ||
24 | + | ||
25 | +func (noticeSettingUpdateQuery *NoticeSettingUpdateCommand) Valid(validation *validation.Validation) { | ||
26 | + | ||
27 | +} | ||
28 | + | ||
29 | +func (noticeSettingUpdateQuery *NoticeSettingUpdateCommand) ValidateCommand() error { | ||
30 | + valid := validation.Validation{} | ||
31 | + b, err := valid.Valid(noticeSettingUpdateQuery) | ||
32 | + if err != nil { | ||
33 | + return err | ||
34 | + } | ||
35 | + if !b { | ||
36 | + for _, validErr := range valid.Errors { | ||
37 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
38 | + } | ||
39 | + } | ||
40 | + return nil | ||
41 | +} |
1 | +package query | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + | ||
6 | + "github.com/beego/beego/v2/core/validation" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
8 | +) | ||
9 | + | ||
10 | +type NoticeSettingListQuery struct { | ||
11 | + //操作人 | ||
12 | + Operator domain.Operator `json:"-"` | ||
13 | + // 查询偏离量 | ||
14 | + PageNumber int `json:"pageNumber" valid:"Required"` | ||
15 | + // 查询限制 | ||
16 | + PageSize int `json:"pageSize" valid:"Required"` | ||
17 | +} | ||
18 | + | ||
19 | +func (noticeSettingListCommand *NoticeSettingListQuery) Valid(validation *validation.Validation) { | ||
20 | + | ||
21 | +} | ||
22 | + | ||
23 | +func (noticeSettingListCommand *NoticeSettingListQuery) ValidateQuery() error { | ||
24 | + valid := validation.Validation{} | ||
25 | + b, err := valid.Valid(noticeSettingListCommand) | ||
26 | + if err != nil { | ||
27 | + return err | ||
28 | + } | ||
29 | + if !b { | ||
30 | + for _, validErr := range valid.Errors { | ||
31 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
32 | + } | ||
33 | + } | ||
34 | + return nil | ||
35 | +} |
1 | +package query | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + | ||
6 | + "github.com/beego/beego/v2/core/validation" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
8 | +) | ||
9 | + | ||
10 | +type NoticeSettingProfileQuery struct { | ||
11 | + //操作人 | ||
12 | + Operator domain.Operator `json:"-"` | ||
13 | +} | ||
14 | + | ||
15 | +func (noticeSettingProfileQuery *NoticeSettingProfileQuery) Valid(validation *validation.Validation) { | ||
16 | + | ||
17 | +} | ||
18 | + | ||
19 | +func (noticeSettingProfileQuery *NoticeSettingProfileQuery) ValidateQuery() error { | ||
20 | + valid := validation.Validation{} | ||
21 | + b, err := valid.Valid(noticeSettingProfileQuery) | ||
22 | + if err != nil { | ||
23 | + return err | ||
24 | + } | ||
25 | + if !b { | ||
26 | + for _, validErr := range valid.Errors { | ||
27 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
28 | + } | ||
29 | + } | ||
30 | + return nil | ||
31 | +} |
1 | +package service | ||
2 | + | ||
3 | +import ( | ||
4 | + "strconv" | ||
5 | + | ||
6 | + "github.com/linmadan/egglib-go/core/application" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/command" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/query" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic" | ||
10 | +) | ||
11 | + | ||
12 | +// 推送消息配置 | ||
13 | +type NoticeSettingService struct { | ||
14 | +} | ||
15 | + | ||
16 | +//NoticeSettingList 推送消息配置列表 | ||
17 | +func (noticeSettingService *NoticeSettingService) NoticeSettingList(noticeSettingListQuery *query.NoticeSettingListQuery) (int64, interface{}, error) { | ||
18 | + if err := noticeSettingListQuery.ValidateQuery(); err != nil { | ||
19 | + return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
20 | + } | ||
21 | + creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic( | ||
22 | + noticeSettingListQuery.Operator.CompanyId, | ||
23 | + noticeSettingListQuery.Operator.OrgId, | ||
24 | + noticeSettingListQuery.Operator.UserId) | ||
25 | + result, err := creationBasicGateway.NoticeSettingSearch(allied_creation_basic.ReqNoticeSettingSearch{ | ||
26 | + PageIndex: noticeSettingListQuery.PageNumber, | ||
27 | + PageSize: noticeSettingListQuery.PageSize, | ||
28 | + CompanyId: noticeSettingListQuery.Operator.CompanyId, | ||
29 | + }) | ||
30 | + if err != nil { | ||
31 | + return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
32 | + } | ||
33 | + | ||
34 | + return result.Count, result.NoticeSettings, nil | ||
35 | +} | ||
36 | + | ||
37 | +//NoticeSettingProfile 推送消息配置需求的参数候选项 | ||
38 | +func (noticeSettingService *NoticeSettingService) NoticeSettingProfile(noticeSettingProfileQuery *query.NoticeSettingProfileQuery) (interface{}, error) { | ||
39 | + if err := noticeSettingProfileQuery.ValidateQuery(); err != nil { | ||
40 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
41 | + } | ||
42 | + | ||
43 | + return nil, nil | ||
44 | +} | ||
45 | + | ||
46 | +// NoticeSettingUpdate 更新配置 | ||
47 | +func (noticeSettingService *NoticeSettingService) NoticeSettingUpdate(noticeSettingUpdateCommand *command.NoticeSettingUpdateCommand) (interface{}, error) { | ||
48 | + if err := noticeSettingUpdateCommand.ValidateCommand(); err != nil { | ||
49 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
50 | + } | ||
51 | + creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic( | ||
52 | + noticeSettingUpdateCommand.Operator.CompanyId, | ||
53 | + noticeSettingUpdateCommand.Operator.OrgId, | ||
54 | + noticeSettingUpdateCommand.Operator.UserId) | ||
55 | + | ||
56 | + noticeSettingID, _ := strconv.Atoi(noticeSettingUpdateCommand.NoticeSettingId) | ||
57 | + _, err := creationBasicGateway.NoticeSettingUpdate(allied_creation_basic.ReqNoticeSettingUpdate{ | ||
58 | + NoticeSettingID: noticeSettingID, | ||
59 | + CompanyID: int(noticeSettingUpdateCommand.Operator.CompanyId), | ||
60 | + Content: noticeSettingUpdateCommand.Content, | ||
61 | + IsPush: noticeSettingUpdateCommand.IsPush, | ||
62 | + Module: noticeSettingUpdateCommand.Module, | ||
63 | + ModuleAction: noticeSettingUpdateCommand.ModuleAction, | ||
64 | + OrganizationID: int(noticeSettingUpdateCommand.Operator.OrgId), | ||
65 | + }) | ||
66 | + if err != nil { | ||
67 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
68 | + } | ||
69 | + return noticeSettingUpdateCommand, nil | ||
70 | +} | ||
71 | + | ||
72 | +// NoticeSettingUpdate 添加配置 | ||
73 | +func (noticeSettingService *NoticeSettingService) NoticeSettingAdd(noticeSettingAddCommand *command.NoticeSettingAddCommand) (interface{}, error) { | ||
74 | + if err := noticeSettingAddCommand.ValidateCommand(); err != nil { | ||
75 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
76 | + } | ||
77 | + creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic( | ||
78 | + noticeSettingAddCommand.Operator.CompanyId, | ||
79 | + noticeSettingAddCommand.Operator.OrgId, | ||
80 | + noticeSettingAddCommand.Operator.UserId) | ||
81 | + result, err := creationBasicGateway.NoticeSettingAdd(allied_creation_basic.ReqNoticeSettingAdd{ | ||
82 | + CompanyID: int(noticeSettingAddCommand.Operator.CompanyId), | ||
83 | + Content: noticeSettingAddCommand.Content, | ||
84 | + IsPush: noticeSettingAddCommand.IsPush, | ||
85 | + Module: noticeSettingAddCommand.Module, | ||
86 | + ModuleAction: noticeSettingAddCommand.ModuleAction, | ||
87 | + OrganizationID: int(noticeSettingAddCommand.Operator.OrgId), | ||
88 | + }) | ||
89 | + if err != nil { | ||
90 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
91 | + } | ||
92 | + data := struct { | ||
93 | + NoticeSettingId int `json:"noticeSettingId"` | ||
94 | + command.NoticeSettingAddCommand | ||
95 | + }{ | ||
96 | + NoticeSettingId: result.NoticeSettingID, | ||
97 | + NoticeSettingAddCommand: *noticeSettingAddCommand, | ||
98 | + } | ||
99 | + return data, nil | ||
100 | +} | ||
101 | + | ||
102 | +func NewNoticeSettingService(options map[string]interface{}) *NoticeSettingService { | ||
103 | + newNoticeSettingService := &NoticeSettingService{} | ||
104 | + return newNoticeSettingService | ||
105 | +} |
@@ -13,14 +13,16 @@ type HttplibAlliedCreationBasic struct { | @@ -13,14 +13,16 @@ type HttplibAlliedCreationBasic struct { | ||
13 | baseUrL string | 13 | baseUrL string |
14 | } | 14 | } |
15 | 15 | ||
16 | -var alliedCreationBasicClient = &HttplibAlliedCreationBasic{ | 16 | +func NewHttplibAlliedCreationBasic(companyId int64, orgId int64, userId int64) *HttplibAlliedCreationBasic { |
17 | + return &HttplibAlliedCreationBasic{ | ||
17 | BaseServiceGateway: service_gateway.BaseServiceGateway{ | 18 | BaseServiceGateway: service_gateway.BaseServiceGateway{ |
18 | ConnectTimeout: 100 * time.Second, | 19 | ConnectTimeout: 100 * time.Second, |
19 | ReadWriteTimeout: 30 * time.Second, | 20 | ReadWriteTimeout: 30 * time.Second, |
21 | + CompanyId: companyId, | ||
22 | + OrgId: orgId, | ||
23 | + UserId: userId, | ||
20 | }, | 24 | }, |
21 | - baseUrL: constant.ALLIED_CREATION_BASIC_HOST, | ||
22 | -} | 25 | + baseUrL: constant.ALLIED_CREATION_USER_HOST, |
26 | + } | ||
23 | 27 | ||
24 | -func NewHttplibAlliedCreationBasic() *HttplibAlliedCreationBasic { | ||
25 | - return alliedCreationBasicClient | ||
26 | } | 28 | } |
1 | +package allied_creation_basic | ||
2 | + | ||
3 | +import ( | ||
4 | + "encoding/json" | ||
5 | + "fmt" | ||
6 | + "strconv" | ||
7 | + | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log" | ||
10 | +) | ||
11 | + | ||
12 | +// NoticeSettingUpdate 更新消息模板 | ||
13 | +func (gateway HttplibAlliedCreationBasic) NoticeSettingUpdate(param ReqNoticeSettingUpdate) (*DataNoticeSettingUpdate, error) { | ||
14 | + url := gateway.baseUrL + "/notice-setting" | ||
15 | + method := "PUT" | ||
16 | + req := gateway.CreateRequest(url, method) | ||
17 | + log.Logger.Debug("向基础模块请求数据:更新消息模板。", map[string]interface{}{ | ||
18 | + "api": method + ":" + url, | ||
19 | + "param": param, | ||
20 | + }) | ||
21 | + req, err := req.JSONBody(param) | ||
22 | + if err != nil { | ||
23 | + return nil, fmt.Errorf("请求更新消息模板失败:%w", err) | ||
24 | + } | ||
25 | + | ||
26 | + byteResult, err := req.Bytes() | ||
27 | + if err != nil { | ||
28 | + return nil, fmt.Errorf("获取更新消息模板失败:%w", err) | ||
29 | + } | ||
30 | + log.Logger.Debug("获取基础模块请求数据:更新消息模板。", map[string]interface{}{ | ||
31 | + "result": string(byteResult), | ||
32 | + }) | ||
33 | + var result service_gateway.GatewayResponse | ||
34 | + err = json.Unmarshal(byteResult, &result) | ||
35 | + if err != nil { | ||
36 | + return nil, fmt.Errorf("解析更新消息模板:%w", err) | ||
37 | + } | ||
38 | + var data DataNoticeSettingUpdate | ||
39 | + err = gateway.GetResponseData(result, &data) | ||
40 | + return &data, err | ||
41 | +} | ||
42 | + | ||
43 | +// NoticeSettingAdd 添加化消息模板 | ||
44 | +func (gateway HttplibAlliedCreationBasic) NoticeSettingAdd(param ReqNoticeSettingAdd) (*DataNoticeSettingAdd, error) { | ||
45 | + url := gateway.baseUrL + "/notice-setting" | ||
46 | + method := "POST" | ||
47 | + req := gateway.CreateRequest(url, method) | ||
48 | + log.Logger.Debug("向基础模块请求数据:添加化消息模板。", map[string]interface{}{ | ||
49 | + "api": method + ":" + url, | ||
50 | + "param": param, | ||
51 | + }) | ||
52 | + req, err := req.JSONBody(param) | ||
53 | + if err != nil { | ||
54 | + return nil, fmt.Errorf("请求添加化消息模板失败:%w", err) | ||
55 | + } | ||
56 | + | ||
57 | + byteResult, err := req.Bytes() | ||
58 | + if err != nil { | ||
59 | + return nil, fmt.Errorf("获取添加化消息模板失败:%w", err) | ||
60 | + } | ||
61 | + log.Logger.Debug("获取基础模块请求数据:添加化消息模板。", map[string]interface{}{ | ||
62 | + "result": string(byteResult), | ||
63 | + }) | ||
64 | + var result service_gateway.GatewayResponse | ||
65 | + err = json.Unmarshal(byteResult, &result) | ||
66 | + if err != nil { | ||
67 | + return nil, fmt.Errorf("解析添加化消息模板:%w", err) | ||
68 | + } | ||
69 | + var data DataNoticeSettingAdd | ||
70 | + err = gateway.GetResponseData(result, &data) | ||
71 | + return &data, err | ||
72 | +} | ||
73 | + | ||
74 | +// NoticeSettingGet 返回编排消息通知内容 | ||
75 | +func (gateway HttplibAlliedCreationBasic) NoticeSettingGet(param ReqNoticeSettingGet) (*DataNoticeSettingGet, error) { | ||
76 | + url := gateway.baseUrL + "/notice-setting/" + strconv.Itoa(param.SettingId) | ||
77 | + method := "GET" | ||
78 | + req := gateway.CreateRequest(url, method) | ||
79 | + log.Logger.Debug("向基础模块请求数据:返回编排消息通知内容。", map[string]interface{}{ | ||
80 | + "api": method + ":" + url, | ||
81 | + "param": param, | ||
82 | + }) | ||
83 | + req, err := req.JSONBody(param) | ||
84 | + if err != nil { | ||
85 | + return nil, fmt.Errorf("请求返回编排消息通知内容失败:%w", err) | ||
86 | + } | ||
87 | + | ||
88 | + byteResult, err := req.Bytes() | ||
89 | + if err != nil { | ||
90 | + return nil, fmt.Errorf("获取返回编排消息通知内容失败:%w", err) | ||
91 | + } | ||
92 | + log.Logger.Debug("获取基础模块请求数据:返回编排消息通知内容。", map[string]interface{}{ | ||
93 | + "result": string(byteResult), | ||
94 | + }) | ||
95 | + var result service_gateway.GatewayResponse | ||
96 | + err = json.Unmarshal(byteResult, &result) | ||
97 | + if err != nil { | ||
98 | + return nil, fmt.Errorf("解析返回编排消息通知内容:%w", err) | ||
99 | + } | ||
100 | + var data DataNoticeSettingGet | ||
101 | + err = gateway.GetResponseData(result, &data) | ||
102 | + return &data, err | ||
103 | +} | ||
104 | + | ||
105 | +// NoticeSettingSearch 返回编排消息通知内容列表 | ||
106 | +func (gateway HttplibAlliedCreationBasic) NoticeSettingSearch(param ReqNoticeSettingSearch) (*DataNoticeSettingSearch, error) { | ||
107 | + url := gateway.baseUrL + "/notice-setting/search" | ||
108 | + method := "POST" | ||
109 | + req := gateway.CreateRequest(url, method) | ||
110 | + log.Logger.Debug("向基础模块请求数据:返回编排消息通知内容列表。", map[string]interface{}{ | ||
111 | + "api": method + ":" + url, | ||
112 | + "param": param, | ||
113 | + }) | ||
114 | + req, err := req.JSONBody(param) | ||
115 | + if err != nil { | ||
116 | + return nil, fmt.Errorf("请求返回编排消息通知内容列表失败:%w", err) | ||
117 | + } | ||
118 | + | ||
119 | + byteResult, err := req.Bytes() | ||
120 | + if err != nil { | ||
121 | + return nil, fmt.Errorf("获取返回编排消息通知内容列表失败:%w", err) | ||
122 | + } | ||
123 | + log.Logger.Debug("获取基础模块请求数据:返回编排消息通知内容列表。", map[string]interface{}{ | ||
124 | + "result": string(byteResult), | ||
125 | + }) | ||
126 | + var result service_gateway.GatewayResponse | ||
127 | + err = json.Unmarshal(byteResult, &result) | ||
128 | + if err != nil { | ||
129 | + return nil, fmt.Errorf("解析返回编排消息通知内容列表:%w", err) | ||
130 | + } | ||
131 | + var data DataNoticeSettingSearch | ||
132 | + err = gateway.GetResponseData(result, &data) | ||
133 | + return &data, err | ||
134 | +} |
1 | -package allied_creation_basic | ||
2 | - | ||
3 | -import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
4 | - | ||
5 | -//ReqGetDictionarysByCode 根据code获取字典数据 | ||
6 | -type ReqGetDictionaryByCode struct { | ||
7 | - DictCode []string `json:"dictCode"` | ||
8 | -} | ||
9 | - | ||
10 | -//DataGetDictionarysByCode 根据code获取字典数据 | ||
11 | -type DataGetDictionaryByCode struct { | ||
12 | - Dictionarys []domain.Dictionary `json:"dictionarys"` | ||
13 | -} |
1 | +package allied_creation_basic | ||
2 | + | ||
3 | +//ReqGetDictionarysByCode 根据code获取字典数据 | ||
4 | +type ReqGetDictionaryByCode struct { | ||
5 | + DictCode []string `json:"dictCode"` | ||
6 | +} | ||
7 | + | ||
8 | +//DataGetDictionarysByCode 根据code获取字典数据 | ||
9 | +type DataGetDictionaryByCode struct { | ||
10 | + Dictionarys []struct { | ||
11 | + // 字典编号 主键 | ||
12 | + DictionaryId int64 `json:"dictionaryId"` | ||
13 | + // 字典编码 | ||
14 | + DictCode string `json:"dictCode"` | ||
15 | + // 字典名称 | ||
16 | + DictName string `json:"dictName"` | ||
17 | + // 备注信息 | ||
18 | + Describe string `json:"describe"` | ||
19 | + // 字典值列表 | ||
20 | + DictItems []struct { | ||
21 | + // 项编码 | ||
22 | + ItemCode string `json:"itemCode"` | ||
23 | + // 项标签 | ||
24 | + ItemLabel string `json:"itemLabel"` | ||
25 | + // 值 | ||
26 | + ItemValue string `json:"itemValue"` | ||
27 | + // 是否可见【1:不可以】【2:可以】 | ||
28 | + IsShow int `json:"isShow"` | ||
29 | + // 显示序号 | ||
30 | + Sort int `json:"sort"` | ||
31 | + } `json:"dictItems"` | ||
32 | + } `json:"dictionarys"` | ||
33 | +} |
1 | +package allied_creation_basic | ||
2 | + | ||
3 | +//更新消息模板 | ||
4 | +type ( | ||
5 | + ReqNoticeSettingUpdate struct { | ||
6 | + NoticeSettingID int `json:"noticeSettingId"` | ||
7 | + CompanyID int `json:"companyId"` | ||
8 | + Content string `json:"content"` | ||
9 | + IsPush int `json:"isPush"` | ||
10 | + Module string `json:"module"` | ||
11 | + ModuleAction string `json:"moduleAction"` | ||
12 | + OrganizationID int `json:"organizationId"` | ||
13 | + } | ||
14 | + | ||
15 | + DataNoticeSettingUpdate struct { | ||
16 | + NoticeSettingID int `json:"noticeSettingId"` | ||
17 | + CompanyID int `json:"companyId"` | ||
18 | + Content string `json:"content"` | ||
19 | + IsPush int `json:"isPush"` | ||
20 | + Module string `json:"module"` | ||
21 | + ModuleAction string `json:"moduleAction"` | ||
22 | + OrganizationID int `json:"organizationId"` | ||
23 | + } | ||
24 | +) | ||
25 | + | ||
26 | +//添加化消息模板 | ||
27 | +type ( | ||
28 | + ReqNoticeSettingAdd struct { | ||
29 | + CompanyID int `json:"companyId"` | ||
30 | + Content string `json:"content"` | ||
31 | + IsPush int `json:"isPush"` | ||
32 | + Module string `json:"module"` | ||
33 | + ModuleAction string `json:"moduleAction"` | ||
34 | + OrganizationID int `json:"organizationId"` | ||
35 | + } | ||
36 | + | ||
37 | + DataNoticeSettingAdd struct { | ||
38 | + CompanyID int `json:"companyId"` | ||
39 | + Content string `json:"content"` | ||
40 | + IsPush int `json:"isPush"` | ||
41 | + Module string `json:"module"` | ||
42 | + ModuleAction string `json:"moduleAction"` | ||
43 | + NoticeSettingID int `json:"noticeSettingId"` | ||
44 | + OrganizationID int `json:"organizationId"` | ||
45 | + } | ||
46 | +) | ||
47 | + | ||
48 | +//返回编排消息通知内容 | ||
49 | +type ( | ||
50 | + ReqNoticeSettingGet struct { | ||
51 | + SettingId int `json:"settingId"` | ||
52 | + } | ||
53 | + | ||
54 | + DataNoticeSettingGet struct { | ||
55 | + CompanyID int `json:"companyId"` | ||
56 | + Content string `json:"content"` | ||
57 | + IsPush int `json:"isPush"` | ||
58 | + Module string `json:"module"` | ||
59 | + ModuleAction string `json:"moduleAction"` | ||
60 | + NoticeSettingID int `json:"noticeSettingId"` | ||
61 | + OrganizationID int `json:"organizationId"` | ||
62 | + SysCode string `json:"sysCode"` | ||
63 | + } | ||
64 | +) | ||
65 | + | ||
66 | +//返回编排消息通知内容列表 | ||
67 | +type ( | ||
68 | + ReqNoticeSettingSearch struct { | ||
69 | + PageIndex int `json:"pageIndex"` | ||
70 | + PageSize int `json:"pageSize"` | ||
71 | + CompanyId int64 `json:"companyId"` | ||
72 | + } | ||
73 | + | ||
74 | + DataNoticeSettingSearch struct { | ||
75 | + Count int64 `json:"count"` | ||
76 | + NoticeSettings []struct { | ||
77 | + CompanyID int `json:"companyId"` | ||
78 | + Content string `json:"content"` | ||
79 | + IsPush int `json:"isPush"` | ||
80 | + Module string `json:"module"` | ||
81 | + ModuleAction string `json:"moduleAction"` | ||
82 | + NoticeSettingID int `json:"noticeSettingId"` | ||
83 | + OrganizationID int `json:"organizationId"` | ||
84 | + SysCode string `json:"sysCode"` | ||
85 | + } `json:"noticeSettings"` | ||
86 | + } | ||
87 | +) |
@@ -4,6 +4,7 @@ package allied_creation_user | @@ -4,6 +4,7 @@ package allied_creation_user | ||
4 | type ( | 4 | type ( |
5 | ReqFavoriteMenusUpdate struct { | 5 | ReqFavoriteMenusUpdate struct { |
6 | UserId int64 `json:"userId"` | 6 | UserId int64 `json:"userId"` |
7 | + FavoriteMenus []string `json:"favoriteMenus"` | ||
7 | } | 8 | } |
8 | 9 | ||
9 | DataFavoriteMenusUpdate struct { | 10 | DataFavoriteMenusUpdate struct { |
@@ -28,5 +29,6 @@ type ( | @@ -28,5 +29,6 @@ type ( | ||
28 | } | 29 | } |
29 | 30 | ||
30 | DataFavoriteMenusGet struct { | 31 | DataFavoriteMenusGet struct { |
32 | + FavoriteMenus []string `json:"favoriteMenus"` | ||
31 | } | 33 | } |
32 | ) | 34 | ) |
1 | +package web_client | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/command" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/query" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/service" | ||
7 | +) | ||
8 | + | ||
9 | +type NoticeSettingController struct { | ||
10 | + baseController | ||
11 | +} | ||
12 | + | ||
13 | +func (controller *NoticeSettingController) NoticeSettingList() { | ||
14 | + noticeSettingService := service.NewNoticeSettingService(nil) | ||
15 | + noticeSettingListQuery := &query.NoticeSettingListQuery{} | ||
16 | + controller.Unmarshal(noticeSettingListQuery) | ||
17 | + noticeSettingListQuery.Operator = controller.GetOperator() | ||
18 | + cnt, data, err := noticeSettingService.NoticeSettingList(noticeSettingListQuery) | ||
19 | + controller.returnPageListData(cnt, data, err, noticeSettingListQuery.PageNumber) | ||
20 | +} | ||
21 | + | ||
22 | +func (controller *NoticeSettingController) NoticeSettingProfile() { | ||
23 | + noticeSettingService := service.NewNoticeSettingService(nil) | ||
24 | + noticeSettingProfileQuery := &query.NoticeSettingProfileQuery{} | ||
25 | + noticeSettingProfileQuery.Operator = controller.GetOperator() | ||
26 | + data, err := noticeSettingService.NoticeSettingProfile(noticeSettingProfileQuery) | ||
27 | + controller.Response(data, err) | ||
28 | +} | ||
29 | + | ||
30 | +func (controller *NoticeSettingController) NoticeSettingUpdate() { | ||
31 | + noticeSettingService := service.NewNoticeSettingService(nil) | ||
32 | + noticeSettingUpdateCommand := &command.NoticeSettingUpdateCommand{} | ||
33 | + controller.Unmarshal(noticeSettingUpdateCommand) | ||
34 | + noticeSettingUpdateCommand.Operator = controller.GetOperator() | ||
35 | + data, err := noticeSettingService.NoticeSettingUpdate(noticeSettingUpdateCommand) | ||
36 | + controller.Response(data, err) | ||
37 | +} | ||
38 | + | ||
39 | +func (controller *NoticeSettingController) NoticeSettingAdd() { | ||
40 | + noticeSettingService := service.NewNoticeSettingService(nil) | ||
41 | + noticeSettingAddCommand := &command.NoticeSettingAddCommand{} | ||
42 | + controller.Unmarshal(noticeSettingAddCommand) | ||
43 | + noticeSettingAddCommand.Operator = controller.GetOperator() | ||
44 | + data, err := noticeSettingService.NoticeSettingAdd(noticeSettingAddCommand) | ||
45 | + controller.Response(data, err) | ||
46 | +} |
1 | +package routers | ||
2 | + | ||
3 | +import ( | ||
4 | + "github.com/beego/beego/v2/server/web" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client" | ||
6 | +) | ||
7 | + | ||
8 | +func init() { | ||
9 | + web.Router("/v1/web/notice-setting/search", &web_client.NoticeSettingController{}, "Post:NoticeSettingList") | ||
10 | + web.Router("/v1/web/notice-setting/profile", &web_client.NoticeSettingController{}, "Get:NoticeSettingProfile") | ||
11 | + web.Router("/v1/web/notice-setting/", &web_client.NoticeSettingController{}, "Put:NoticeSettingUpdate") | ||
12 | +} |
-
请 注册 或 登录 后发表评论