notice_setting_param.go
7.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
package domain
import "errors"
//NoticeModule 消息模块
type NoticeModule struct {
ModuleCode string `json:"moduleCode"`
ModuleName string `json:"moduleName"`
}
//NoticeModuleAction 业务环节
type NoticeModuleAction struct {
ModuleCode string `json:"moduleCode"`
ActionCode string `json:"actionCode"`
ActionName string `json:"actionName"`
}
// 编排消息需要的变量
type NoticeSettingParam struct {
// 变量的代码标识
ParamCode string `json:"paramCode"`
// 变量名称描述
ParamName string `json:"paramName"`
// 业务环节
ModuleAction string `json:"moduleAction"`
// 消息对应的业务模块
Module string `json:"module"`
}
//GetNoticeModuleList 获取消息模块列表
func GetNoticeModuleList() []NoticeModule {
return noticeModuleList
}
//GetNoticeModuleActionList 获取业务环节列表
func GetNoticeModuleActionList() []NoticeModuleAction {
return noticeModuleActionList
}
//GetNoticeSettingParamList 获取变量列表
func GetNoticeSettingParamList(actionCode string) []NoticeSettingParam {
if len(actionCode) == 0 {
return noticeSettingParamList
}
var list []NoticeSettingParam
for i := range noticeSettingParamList {
if noticeSettingParamList[i].ModuleAction == actionCode {
list = append(list, noticeSettingParamList[i])
}
}
return list
}
//ValidNoticeModule 校验NoticeModule编码
func ValidNoticeModule(code string) bool {
for i := range noticeModuleList {
if noticeModuleList[i].ModuleCode == code {
return true
}
}
return false
}
//ValidNoticeModuleAction 校验NoticeModuleAction编码
func ValidNoticeModuleAction(moduleCode string, actioncode string) bool {
for i := range noticeModuleActionList {
if (noticeModuleActionList[i].ActionCode == actioncode) &&
(noticeModuleActionList[i].ModuleCode == moduleCode) {
return true
}
}
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" //天联共创-共创确认
Action01_04 = "action01_04" //天联共创-分红预算消息
Action01_05 = "action01_05" //天联共创-账期结算消息
Action01_06 = "action01_06" //天联共创-支付消息
)
//业务环节变量
const (
Param01_01_01 = "param01_01_01" //共创申请通过-共创项目编号
Param01_01_02 = "param01_01_02" //共创申请通过-共创项目名称
Param01_02_01 = "param01_02_01" //共创申请拒绝-共创项目编号
Param01_02_02 = "param01_02_02" //共创申请拒绝-共创项目名称
Param01_03_01 = "param01_03_01" //共创确认-共创项目编号
Param01_03_02 = "param01_03_02" //共创确认-共创项目名称
Param01_03_03 = "param01_03_03" //共创确认-项目合约编号
Param01_03_04 = "param01_03_04" //共创确认-项目合约名称
Param01_04_01 = "param01_04_01" //分红预算消息-共创项目编号
Param01_04_02 = "param01_04_02" //分红预算消息-共创项目名称
Param01_04_03 = "param01_04_03" //分红预算消息-项目合约编号
Param01_04_04 = "param01_04_04" //分红预算消息-项目合约名称
Param01_04_05 = "param01_04_05" //分红预算消息-订单产品信息
Param01_04_06 = "param01_04_06" //分红预算消息-分红金额
Param01_05_01 = "param01_05_01" //账期结算消息-账期结算单号
Param01_05_02 = "param01_05_02" //账期结算消息-结算金额
Param01_05_03 = "param01_05_03" //账期结算消息-分红预算单号
Param01_06_01 = "param01_06_01" //支付消息-账期结算单号
Param01_06_02 = "param01_06_02" //支付消息-结算金额
Param01_06_03 = "param01_06_03" //支付消息-实付金额
)
//noticeModuleList 模块列表
var noticeModuleList = []NoticeModule{
{ModuleCode: Module01, ModuleName: "天联共创"},
}
//noticeModuleActionList 业务环节列表
var noticeModuleActionList = []NoticeModuleAction{
{ModuleCode: Module00, ActionCode: Action00_01, ActionName: "系统消息"},
{ModuleCode: Module01, ActionCode: Action01_01, ActionName: "共创申请通过"},
{ModuleCode: Module01, ActionCode: Action01_02, ActionName: "共创申请拒绝"},
{ModuleCode: Module01, ActionCode: Action01_03, ActionName: "共创确认"},
{ModuleCode: Module01, ActionCode: Action01_04, ActionName: "分红预算消息"},
{ModuleCode: Module01, ActionCode: Action01_05, ActionName: "账期结算消息"},
{ModuleCode: Module01, ActionCode: Action01_06, ActionName: "支付消息"},
}
//noticeSettingParamList 业务变量列表
var noticeSettingParamList = []NoticeSettingParam{
{Module: Module01, ModuleAction: Action01_01, ParamCode: Param01_01_01, ParamName: "共创项目编号"},
{Module: Module01, ModuleAction: Action01_01, ParamCode: Param01_01_02, ParamName: "共创项目名称"},
{Module: Module01, ModuleAction: Action01_02, ParamCode: Param01_02_01, ParamName: "共创项目编号"},
{Module: Module01, ModuleAction: Action01_02, ParamCode: Param01_02_02, ParamName: "共创项目名称"},
{Module: Module01, ModuleAction: Action01_03, ParamCode: Param01_03_01, ParamName: "共创项目编号"},
{Module: Module01, ModuleAction: Action01_03, ParamCode: Param01_03_02, ParamName: "共创项目名称"},
{Module: Module01, ModuleAction: Action01_03, ParamCode: Param01_03_03, ParamName: "项目合约编号"},
{Module: Module01, ModuleAction: Action01_03, ParamCode: Param01_03_04, ParamName: "项目合约名称"},
{Module: Module01, ModuleAction: Action01_04, ParamCode: Param01_04_01, ParamName: "共创项目编号"},
{Module: Module01, ModuleAction: Action01_04, ParamCode: Param01_04_02, ParamName: "共创项目名称"},
{Module: Module01, ModuleAction: Action01_04, ParamCode: Param01_04_03, ParamName: "项目合约编号"},
{Module: Module01, ModuleAction: Action01_04, ParamCode: Param01_04_04, ParamName: "项目合约名称"},
{Module: Module01, ModuleAction: Action01_04, ParamCode: Param01_04_05, ParamName: "订单产品信息"},
{Module: Module01, ModuleAction: Action01_04, ParamCode: Param01_04_06, ParamName: "分红金额"},
{ModuleAction: Module01, Module: Action01_05, ParamCode: Param01_05_01, ParamName: "账期结算单号"},
{ModuleAction: Module01, Module: Action01_05, ParamCode: Param01_05_02, ParamName: "结算金额"},
{ModuleAction: Module01, Module: Action01_05, ParamCode: Param01_05_03, ParamName: "分红预算单号"},
{ModuleAction: Module01, Module: Action01_06, ParamCode: Param01_06_01, ParamName: "账期结算单号"},
{ModuleAction: Module01, Module: Action01_06, ParamCode: Param01_06_02, ParamName: "结算金额"},
{ModuleAction: Module01, Module: Action01_06, ParamCode: Param01_06_03, ParamName: "实付金额"},
}