config.go
5.2 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
package service
import (
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/config/query"
)
// 配置服务
type ConfigService struct {
}
// 返回任务状态列表
func (configService *ConfigService) ListTaskStatus(listTaskStatusQuery *query.ListTaskStatusQuery) (interface{}, error) {
if err := listTaskStatusQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
taskStatusMap := map[int]string{
1: "待发布",
2: "待领取",
3: "进行中",
4: "待验收",
5: "已完成",
7: "待确认",
8: "已过期",
}
var list []map[string]interface{}
for key, value := range taskStatusMap {
list = append(list, map[string]interface{}{
"id": key,
"name": value,
})
}
return map[string]interface{}{
"taskStatuses": list,
}, nil
}
// 返回任务类型列表
func (configService *ConfigService) ListTaskType(listTaskTypeQuery *query.ListTaskTypeQuery) (interface{}, error) {
if err := listTaskTypeQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
taskTypeMap := map[int]string{
1: "抢单任务",
2: "竞标任务",
3: "指派任务",
}
var list []map[string]interface{}
for key, value := range taskTypeMap {
list = append(list, map[string]interface{}{
"id": key,
"name": value,
})
}
return map[string]interface{}{
"taskTypes": list,
}, nil
}
// 返回任务性质列表
func (configService *ConfigService) ListTaskNature(listTaskNatureQuery *query.ListTaskNatureQuery) (interface{}, error) {
if err := listTaskNatureQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
taskNatureMap := map[int]string{
1: "点",
2: "线",
3: "面",
4: "链",
5: "网",
}
var list []map[string]interface{}
for key, value := range taskNatureMap {
list = append(list, map[string]interface{}{
"id": key,
"name": value,
})
}
return map[string]interface{}{
"taskNatures": list,
}, nil
}
// 返回客户价值列表
func (configService *ConfigService) ListCustomerValue(listCustomerValueQuery *query.ListCustomerValueQuery) (interface{}, error) {
if err := listCustomerValueQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
customerValueMap := map[int]string{
1: "口味",
2: "口感",
3: "色泽",
4: "卖相",
5: "包装",
6: "储存",
7: "运输",
8: "价格",
9: "应用",
10: "便利",
11: "交期",
12: "数量",
13: "账期",
14: "品质",
15: "新鲜度",
16: "推广",
17: "规格",
18: "人情关系",
19: "商务服务",
20: "售后服务",
21: "新品",
22: "品牌",
23: "合同",
}
var list []map[string]interface{}
for key, value := range customerValueMap {
list = append(list, map[string]interface{}{
"id": key,
"name": value,
})
}
return map[string]interface{}{
"customerValues": list,
}, nil
}
// 返回任务引用资源类型字典列表
func (configService *ConfigService) ListReferenceResourceType(listReferenceResourceTypeQuery *query.ListReferenceResourceTypeQuery) (interface{}, error) {
if err := listReferenceResourceTypeQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
referenceResourceTypeMap := map[int]string{
1: "问题",
//2: "机会",
}
var list []map[string]interface{}
for key, value := range referenceResourceTypeMap {
list = append(list, map[string]interface{}{
"id": key,
"name": value,
})
}
return map[string]interface{}{
"referenceResourceTypes": list,
}, nil
}
// 返回竞标时间字典列表(1全部,2已截止,3未截止)
func (configService *ConfigService) ListBidTimeMatch(listBidTimeMatchQuery *query.ListBidTimeMatchQuery) (interface{}, error) {
if err := listBidTimeMatchQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
bidTimeMatchMap := map[int]string{
1: "全部",
2: "已截止",
3: "未截止",
}
var list []map[string]interface{}
for key, value := range bidTimeMatchMap {
list = append(list, map[string]interface{}{
"id": key,
"name": value,
})
}
return map[string]interface{}{
"bidTimeMatchs": list,
}, nil
}
// 返回员工权限字典列表(1任务管理,2素币管理,3成员管理,4标签管理,5排行榜管理)
func (configService *ConfigService) ListEmployeePermission(listEmployeePermissionQuery *query.ListEmployeePermissionQuery) (interface{}, error) {
if err := listEmployeePermissionQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
employeePermissionMap := map[int]string{
1: "任务管理",
2: "素币管理",
3: "成员管理",
4: "标签管理",
5: "排行榜管理",
}
var list []map[string]interface{}
for key, value := range employeePermissionMap {
list = append(list, map[string]interface{}{
"id": key,
"name": value,
})
}
return map[string]interface{}{
"employeePermissions": list,
}, nil
}
func NewConfigService(options map[string]interface{}) *ConfigService {
newConfigService := &ConfigService{}
return newConfigService
}