正在显示
7 个修改的文件
包含
58 行增加
和
66 行删除
不能预览此文件类型
@@ -20,38 +20,38 @@ type SyncDataCompanyService struct { | @@ -20,38 +20,38 @@ type SyncDataCompanyService struct { | ||
20 | // // add:添加,edit:编辑,setCompanyCharge:更改公司主管,changeAdmin换管理员 | 20 | // // add:添加,edit:编辑,setCompanyCharge:更改公司主管,changeAdmin换管理员 |
21 | // Action string `json:"action"` | 21 | // Action string `json:"action"` |
22 | // // 具体的对象JSON数据 | 22 | // // 具体的对象JSON数据 |
23 | -// Datas json.RawMessage `json:"data"` | 23 | +// Data json.RawMessage `json:"data"` |
24 | // } | 24 | // } |
25 | 25 | ||
26 | -//从BusinessAdmins 接收消息,变更公司数据 | 26 | +// 从BusinessAdmins 接收消息,变更公司数据 |
27 | func (c SyncDataCompanyService) FromBusinessAdmin(param *domain.MessageBody) error { | 27 | func (c SyncDataCompanyService) FromBusinessAdmin(param *domain.MessageBody) error { |
28 | action := param.Module + "/" + param.Action | 28 | action := param.Module + "/" + param.Action |
29 | var err error | 29 | var err error |
30 | switch action { | 30 | switch action { |
31 | case "company/add": | 31 | case "company/add": |
32 | var param1 command.SaveCompanyCommand | 32 | var param1 command.SaveCompanyCommand |
33 | - err = json.Unmarshal(param.Datas, ¶m1) | 33 | + err = json.Unmarshal(param.Data, ¶m1) |
34 | if err != nil { | 34 | if err != nil { |
35 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 35 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
36 | } | 36 | } |
37 | err = c.addCompany(¶m1) | 37 | err = c.addCompany(¶m1) |
38 | case "company/edit": | 38 | case "company/edit": |
39 | var param2 command.SaveCompanyCommand | 39 | var param2 command.SaveCompanyCommand |
40 | - err = json.Unmarshal(param.Datas, ¶m2) | 40 | + err = json.Unmarshal(param.Data, ¶m2) |
41 | if err != nil { | 41 | if err != nil { |
42 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 42 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
43 | } | 43 | } |
44 | err = c.editCompany(¶m2) | 44 | err = c.editCompany(¶m2) |
45 | case "company/setCompanyCharge": | 45 | case "company/setCompanyCharge": |
46 | var param3 command.SetCompanyCharge | 46 | var param3 command.SetCompanyCharge |
47 | - err = json.Unmarshal(param.Datas, ¶m3) | 47 | + err = json.Unmarshal(param.Data, ¶m3) |
48 | if err != nil { | 48 | if err != nil { |
49 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 49 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
50 | } | 50 | } |
51 | err = c.setCompanyCharge(¶m3) | 51 | err = c.setCompanyCharge(¶m3) |
52 | case "company/changeAdmin": | 52 | case "company/changeAdmin": |
53 | var param3 command.ChangeAdminCommand | 53 | var param3 command.ChangeAdminCommand |
54 | - err = json.Unmarshal(param.Datas, ¶m3) | 54 | + err = json.Unmarshal(param.Data, ¶m3) |
55 | if err != nil { | 55 | if err != nil { |
56 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 56 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
57 | } | 57 | } |
@@ -63,9 +63,9 @@ func (c SyncDataCompanyService) FromBusinessAdmin(param *domain.MessageBody) err | @@ -63,9 +63,9 @@ func (c SyncDataCompanyService) FromBusinessAdmin(param *domain.MessageBody) err | ||
63 | return err | 63 | return err |
64 | } | 64 | } |
65 | 65 | ||
66 | -//addCompany | ||
67 | -//从BusinessAdmins 接收消息 添加公司 | ||
68 | -//module="company" action="add" | 66 | +// addCompany |
67 | +// 从BusinessAdmins 接收消息 添加公司 | ||
68 | +// module="company" action="add" | ||
69 | func (c SyncDataCompanyService) addCompany(param *command.SaveCompanyCommand) error { | 69 | func (c SyncDataCompanyService) addCompany(param *command.SaveCompanyCommand) error { |
70 | transactionContext, err := factory.CreateTransactionContext(nil) | 70 | transactionContext, err := factory.CreateTransactionContext(nil) |
71 | if err != nil { | 71 | if err != nil { |
@@ -121,9 +121,9 @@ func (c SyncDataCompanyService) addCompany(param *command.SaveCompanyCommand) er | @@ -121,9 +121,9 @@ func (c SyncDataCompanyService) addCompany(param *command.SaveCompanyCommand) er | ||
121 | return nil | 121 | return nil |
122 | } | 122 | } |
123 | 123 | ||
124 | -//editCompany | ||
125 | -//从BusinessAdmins 接收消息 更新公司 | ||
126 | -//module="company" action="edit" | 124 | +// editCompany |
125 | +// 从BusinessAdmins 接收消息 更新公司 | ||
126 | +// module="company" action="edit" | ||
127 | func (c SyncDataCompanyService) editCompany(param *command.SaveCompanyCommand) error { | 127 | func (c SyncDataCompanyService) editCompany(param *command.SaveCompanyCommand) error { |
128 | transactionContext, err := factory.CreateTransactionContext(nil) | 128 | transactionContext, err := factory.CreateTransactionContext(nil) |
129 | if err != nil { | 129 | if err != nil { |
@@ -218,7 +218,7 @@ func (c SyncDataCompanyService) editCompany(param *command.SaveCompanyCommand) e | @@ -218,7 +218,7 @@ func (c SyncDataCompanyService) editCompany(param *command.SaveCompanyCommand) e | ||
218 | return nil | 218 | return nil |
219 | } | 219 | } |
220 | 220 | ||
221 | -//module="company" action="setCompanyCharge" | 221 | +// module="company" action="setCompanyCharge" |
222 | func (srv SyncDataCompanyService) setCompanyCharge(param *command.SetCompanyCharge) error { | 222 | func (srv SyncDataCompanyService) setCompanyCharge(param *command.SetCompanyCharge) error { |
223 | transactionContext, err := factory.CreateTransactionContext(nil) | 223 | transactionContext, err := factory.CreateTransactionContext(nil) |
224 | if err != nil { | 224 | if err != nil { |
@@ -257,9 +257,9 @@ func (srv SyncDataCompanyService) setCompanyCharge(param *command.SetCompanyChar | @@ -257,9 +257,9 @@ func (srv SyncDataCompanyService) setCompanyCharge(param *command.SetCompanyChar | ||
257 | return nil | 257 | return nil |
258 | } | 258 | } |
259 | 259 | ||
260 | -//changeAdmin | ||
261 | -//从BusinessAdmins 接收消息 变更主管 | ||
262 | -//module="company" action="changeAdmin" | 260 | +// changeAdmin |
261 | +// 从BusinessAdmins 接收消息 变更主管 | ||
262 | +// module="company" action="changeAdmin" | ||
263 | func (srv SyncDataCompanyService) changeAdmin(param *command.ChangeAdminCommand) error { | 263 | func (srv SyncDataCompanyService) changeAdmin(param *command.ChangeAdminCommand) error { |
264 | transactionContext, err := factory.CreateTransactionContext(nil) | 264 | transactionContext, err := factory.CreateTransactionContext(nil) |
265 | if err != nil { | 265 | if err != nil { |
@@ -18,7 +18,7 @@ type SyncDataDepartmentService struct{} | @@ -18,7 +18,7 @@ type SyncDataDepartmentService struct{} | ||
18 | // // add:添加,edit:编辑,batchDelete:批量删除,import:导入部门 | 18 | // // add:添加,edit:编辑,batchDelete:批量删除,import:导入部门 |
19 | // Action string `json:"action"` | 19 | // Action string `json:"action"` |
20 | // // 具体的对象JSON数据 | 20 | // // 具体的对象JSON数据 |
21 | -// Datas json.RawMessage `json:"data"` | 21 | +// Data json.RawMessage `json:"data"` |
22 | // } | 22 | // } |
23 | 23 | ||
24 | func (srv SyncDataDepartmentService) FromBusinessAdmin(param *domain.MessageBody) error { | 24 | func (srv SyncDataDepartmentService) FromBusinessAdmin(param *domain.MessageBody) error { |
@@ -27,28 +27,28 @@ func (srv SyncDataDepartmentService) FromBusinessAdmin(param *domain.MessageBody | @@ -27,28 +27,28 @@ func (srv SyncDataDepartmentService) FromBusinessAdmin(param *domain.MessageBody | ||
27 | switch action { | 27 | switch action { |
28 | case "department/add": | 28 | case "department/add": |
29 | var param1 command.AddDepartmentCommand | 29 | var param1 command.AddDepartmentCommand |
30 | - err = json.Unmarshal(param.Datas, ¶m1) | 30 | + err = json.Unmarshal(param.Data, ¶m1) |
31 | if err != nil { | 31 | if err != nil { |
32 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 32 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
33 | } | 33 | } |
34 | err = srv.addDepartment(¶m1) | 34 | err = srv.addDepartment(¶m1) |
35 | case "department/edit": | 35 | case "department/edit": |
36 | var param1 command.EditDepartmentCommand | 36 | var param1 command.EditDepartmentCommand |
37 | - err = json.Unmarshal(param.Datas, ¶m1) | 37 | + err = json.Unmarshal(param.Data, ¶m1) |
38 | if err != nil { | 38 | if err != nil { |
39 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 39 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
40 | } | 40 | } |
41 | err = srv.editDepartment(¶m1) | 41 | err = srv.editDepartment(¶m1) |
42 | case "department/batchDelete": | 42 | case "department/batchDelete": |
43 | var param1 command.BatchDeleteCommand | 43 | var param1 command.BatchDeleteCommand |
44 | - err = json.Unmarshal(param.Datas, ¶m1) | 44 | + err = json.Unmarshal(param.Data, ¶m1) |
45 | if err != nil { | 45 | if err != nil { |
46 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 46 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
47 | } | 47 | } |
48 | err = srv.batchDeleteDepartment(¶m1) | 48 | err = srv.batchDeleteDepartment(¶m1) |
49 | case "department/import": | 49 | case "department/import": |
50 | var param1 []command.ImportDepartmentCommand | 50 | var param1 []command.ImportDepartmentCommand |
51 | - err = json.Unmarshal(param.Datas, ¶m1) | 51 | + err = json.Unmarshal(param.Data, ¶m1) |
52 | if err != nil { | 52 | if err != nil { |
53 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 53 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
54 | } | 54 | } |
@@ -57,9 +57,9 @@ func (srv SyncDataDepartmentService) FromBusinessAdmin(param *domain.MessageBody | @@ -57,9 +57,9 @@ func (srv SyncDataDepartmentService) FromBusinessAdmin(param *domain.MessageBody | ||
57 | return err | 57 | return err |
58 | } | 58 | } |
59 | 59 | ||
60 | -//AddDepartment | ||
61 | -//从BusinessAdmins 接收消息 添加部门 | ||
62 | -//module="department" action="add" | 60 | +// AddDepartment |
61 | +// 从BusinessAdmins 接收消息 添加部门 | ||
62 | +// module="department" action="add" | ||
63 | func (srv SyncDataDepartmentService) addDepartment(param *command.AddDepartmentCommand) error { | 63 | func (srv SyncDataDepartmentService) addDepartment(param *command.AddDepartmentCommand) error { |
64 | transactionContext, err := factory.CreateTransactionContext(nil) | 64 | transactionContext, err := factory.CreateTransactionContext(nil) |
65 | if err != nil { | 65 | if err != nil { |
@@ -99,9 +99,9 @@ func (srv SyncDataDepartmentService) addDepartment(param *command.AddDepartmentC | @@ -99,9 +99,9 @@ func (srv SyncDataDepartmentService) addDepartment(param *command.AddDepartmentC | ||
99 | return nil | 99 | return nil |
100 | } | 100 | } |
101 | 101 | ||
102 | -//EditDepartment | ||
103 | -//从BusinessAdmins 接收消息 编辑部门 | ||
104 | -//module="department" action="edit" | 102 | +// EditDepartment |
103 | +// 从BusinessAdmins 接收消息 编辑部门 | ||
104 | +// module="department" action="edit" | ||
105 | func (srv SyncDataDepartmentService) editDepartment(param *command.EditDepartmentCommand) error { | 105 | func (srv SyncDataDepartmentService) editDepartment(param *command.EditDepartmentCommand) error { |
106 | transactionContext, err := factory.CreateTransactionContext(nil) | 106 | transactionContext, err := factory.CreateTransactionContext(nil) |
107 | if err != nil { | 107 | if err != nil { |
@@ -158,9 +158,9 @@ func (srv SyncDataDepartmentService) editDepartment(param *command.EditDepartmen | @@ -158,9 +158,9 @@ func (srv SyncDataDepartmentService) editDepartment(param *command.EditDepartmen | ||
158 | return nil | 158 | return nil |
159 | } | 159 | } |
160 | 160 | ||
161 | -//batchDelete | ||
162 | -//从BusinessAdmins 接收消息 删除部门 | ||
163 | -//module="department" action="batchDelete" | 161 | +// batchDelete |
162 | +// 从BusinessAdmins 接收消息 删除部门 | ||
163 | +// module="department" action="batchDelete" | ||
164 | func (srv SyncDataDepartmentService) batchDeleteDepartment(param *command.BatchDeleteCommand) error { | 164 | func (srv SyncDataDepartmentService) batchDeleteDepartment(param *command.BatchDeleteCommand) error { |
165 | if len(param.Ids) == 0 { | 165 | if len(param.Ids) == 0 { |
166 | return nil | 166 | return nil |
@@ -188,9 +188,9 @@ func (srv SyncDataDepartmentService) batchDeleteDepartment(param *command.BatchD | @@ -188,9 +188,9 @@ func (srv SyncDataDepartmentService) batchDeleteDepartment(param *command.BatchD | ||
188 | return nil | 188 | return nil |
189 | } | 189 | } |
190 | 190 | ||
191 | -//importDepartment | ||
192 | -//从BusinessAdmins 接收消息 导入部门数据 | ||
193 | -//module="department" action="import" | 191 | +// importDepartment |
192 | +// 从BusinessAdmins 接收消息 导入部门数据 | ||
193 | +// module="department" action="import" | ||
194 | func (srv SyncDataDepartmentService) importDepartment(param []command.ImportDepartmentCommand) error { | 194 | func (srv SyncDataDepartmentService) importDepartment(param []command.ImportDepartmentCommand) error { |
195 | transactionContext, err := factory.CreateTransactionContext(nil) | 195 | transactionContext, err := factory.CreateTransactionContext(nil) |
196 | if err != nil { | 196 | if err != nil { |
@@ -20,7 +20,7 @@ type SyncDataUserService struct{} | @@ -20,7 +20,7 @@ type SyncDataUserService struct{} | ||
20 | // // add:添加,edit:编辑,batchDelete:批量删除,batchForbid:批量禁用用户,batchRemove:批量更改用户部门,import:导入用户 | 20 | // // add:添加,edit:编辑,batchDelete:批量删除,batchForbid:批量禁用用户,batchRemove:批量更改用户部门,import:导入用户 |
21 | // Action string `json:"action"` | 21 | // Action string `json:"action"` |
22 | // // 具体的对象JSON数据 | 22 | // // 具体的对象JSON数据 |
23 | -// Datas json.RawMessage `json:"data"` | 23 | +// Data json.RawMessage `json:"data"` |
24 | // } | 24 | // } |
25 | 25 | ||
26 | func (srv SyncDataUserService) FromBusinessAdmin(param *domain.MessageBody) error { | 26 | func (srv SyncDataUserService) FromBusinessAdmin(param *domain.MessageBody) error { |
@@ -29,35 +29,35 @@ func (srv SyncDataUserService) FromBusinessAdmin(param *domain.MessageBody) erro | @@ -29,35 +29,35 @@ func (srv SyncDataUserService) FromBusinessAdmin(param *domain.MessageBody) erro | ||
29 | switch action { | 29 | switch action { |
30 | case "employee/add": | 30 | case "employee/add": |
31 | var param1 command.SaveUserCommand | 31 | var param1 command.SaveUserCommand |
32 | - err = json.Unmarshal(param.Datas, ¶m1) | 32 | + err = json.Unmarshal(param.Data, ¶m1) |
33 | if err != nil { | 33 | if err != nil { |
34 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 34 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
35 | } | 35 | } |
36 | err = srv.AddUser(¶m1) | 36 | err = srv.AddUser(¶m1) |
37 | case "employee/edit": | 37 | case "employee/edit": |
38 | var param2 command.SaveUserCommand | 38 | var param2 command.SaveUserCommand |
39 | - err = json.Unmarshal(param.Datas, ¶m2) | 39 | + err = json.Unmarshal(param.Data, ¶m2) |
40 | if err != nil { | 40 | if err != nil { |
41 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 41 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
42 | } | 42 | } |
43 | err = srv.UpdateUser(¶m2) | 43 | err = srv.UpdateUser(¶m2) |
44 | case "employee/batchDelete": | 44 | case "employee/batchDelete": |
45 | var param3 command.BatchDeleteCommand | 45 | var param3 command.BatchDeleteCommand |
46 | - err = json.Unmarshal(param.Datas, ¶m3) | 46 | + err = json.Unmarshal(param.Data, ¶m3) |
47 | if err != nil { | 47 | if err != nil { |
48 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 48 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
49 | } | 49 | } |
50 | err = srv.batchDelete(¶m3) | 50 | err = srv.batchDelete(¶m3) |
51 | - case "company/batchForbid": | 51 | + case "employee/batchForbid": |
52 | var param4 command.BatchForbidCommand | 52 | var param4 command.BatchForbidCommand |
53 | - err = json.Unmarshal(param.Datas, ¶m4) | 53 | + err = json.Unmarshal(param.Data, ¶m4) |
54 | if err != nil { | 54 | if err != nil { |
55 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 55 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
56 | } | 56 | } |
57 | err = srv.batchForbid(¶m4) | 57 | err = srv.batchForbid(¶m4) |
58 | - case "company/import": | 58 | + case "employee/import": |
59 | var param4 command.ImportUserCommand | 59 | var param4 command.ImportUserCommand |
60 | - err = json.Unmarshal(param.Datas, ¶m4) | 60 | + err = json.Unmarshal(param.Data, ¶m4) |
61 | if err != nil { | 61 | if err != nil { |
62 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 62 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
63 | } | 63 | } |
@@ -69,9 +69,9 @@ func (srv SyncDataUserService) FromBusinessAdmin(param *domain.MessageBody) erro | @@ -69,9 +69,9 @@ func (srv SyncDataUserService) FromBusinessAdmin(param *domain.MessageBody) erro | ||
69 | return err | 69 | return err |
70 | } | 70 | } |
71 | 71 | ||
72 | -//AddUser | ||
73 | -//从BusinessAdmins 接收消息 添加用户 | ||
74 | -//module="employee" action="add" | 72 | +// AddUser |
73 | +// 从BusinessAdmins 接收消息 添加用户 | ||
74 | +// module="employee" action="add" | ||
75 | func (srv SyncDataUserService) AddUser(param *command.SaveUserCommand) error { | 75 | func (srv SyncDataUserService) AddUser(param *command.SaveUserCommand) error { |
76 | transactionContext, err := factory.CreateTransactionContext(nil) | 76 | transactionContext, err := factory.CreateTransactionContext(nil) |
77 | if err != nil { | 77 | if err != nil { |
@@ -114,9 +114,9 @@ func (srv SyncDataUserService) AddUser(param *command.SaveUserCommand) error { | @@ -114,9 +114,9 @@ func (srv SyncDataUserService) AddUser(param *command.SaveUserCommand) error { | ||
114 | return nil | 114 | return nil |
115 | } | 115 | } |
116 | 116 | ||
117 | -//UpdateUser | ||
118 | -//从BusinessAdmins 接收消息 更新用户 | ||
119 | -//module="employee" action="edit" | 117 | +// UpdateUser |
118 | +// 从BusinessAdmins 接收消息 更新用户 | ||
119 | +// module="employee" action="edit" | ||
120 | func (srv SyncDataUserService) UpdateUser(param *command.SaveUserCommand) error { | 120 | func (srv SyncDataUserService) UpdateUser(param *command.SaveUserCommand) error { |
121 | transactionContext, err := factory.CreateTransactionContext(nil) | 121 | transactionContext, err := factory.CreateTransactionContext(nil) |
122 | if err != nil { | 122 | if err != nil { |
@@ -174,9 +174,9 @@ func (srv SyncDataUserService) UpdateUser(param *command.SaveUserCommand) error | @@ -174,9 +174,9 @@ func (srv SyncDataUserService) UpdateUser(param *command.SaveUserCommand) error | ||
174 | return nil | 174 | return nil |
175 | } | 175 | } |
176 | 176 | ||
177 | -//batchDelete | ||
178 | -//从BusinessAdmins 接收消息 删除用户 | ||
179 | -//module="employee" action="batchDelete" | 177 | +// batchDelete |
178 | +// 从BusinessAdmins 接收消息 删除用户 | ||
179 | +// module="employee" action="batchDelete" | ||
180 | func (srv SyncDataUserService) batchDelete(param *command.BatchDeleteCommand) error { | 180 | func (srv SyncDataUserService) batchDelete(param *command.BatchDeleteCommand) error { |
181 | if len(param.Uids) == 0 { | 181 | if len(param.Uids) == 0 { |
182 | return nil | 182 | return nil |
@@ -205,9 +205,9 @@ func (srv SyncDataUserService) batchDelete(param *command.BatchDeleteCommand) er | @@ -205,9 +205,9 @@ func (srv SyncDataUserService) batchDelete(param *command.BatchDeleteCommand) er | ||
205 | return nil | 205 | return nil |
206 | } | 206 | } |
207 | 207 | ||
208 | -//batchForbid | ||
209 | -//从BusinessAdmins 接收消息 禁用,启用用户 | ||
210 | -//module="employee" action="batchForbid" | 208 | +// batchForbid |
209 | +// 从BusinessAdmins 接收消息 禁用,启用用户 | ||
210 | +// module="employee" action="batchForbid" | ||
211 | func (srv SyncDataUserService) batchForbid(param *command.BatchForbidCommand) error { | 211 | func (srv SyncDataUserService) batchForbid(param *command.BatchForbidCommand) error { |
212 | if len(param.Uids) == 0 { | 212 | if len(param.Uids) == 0 { |
213 | return nil | 213 | return nil |
@@ -245,9 +245,9 @@ func (srv SyncDataUserService) batchForbid(param *command.BatchForbidCommand) er | @@ -245,9 +245,9 @@ func (srv SyncDataUserService) batchForbid(param *command.BatchForbidCommand) er | ||
245 | return nil | 245 | return nil |
246 | } | 246 | } |
247 | 247 | ||
248 | -//importUser | ||
249 | -//从BusinessAdmins 接收消息 导入用户数据 | ||
250 | -//module="employee" action="import" | 248 | +// importUser |
249 | +// 从BusinessAdmins 接收消息 导入用户数据 | ||
250 | +// module="employee" action="import" | ||
251 | func (srv SyncDataUserService) importUser(param *command.ImportUserCommand) error { | 251 | func (srv SyncDataUserService) importUser(param *command.ImportUserCommand) error { |
252 | transactionContext, err := factory.CreateTransactionContext(nil) | 252 | transactionContext, err := factory.CreateTransactionContext(nil) |
253 | if err != nil { | 253 | if err != nil { |
@@ -16,7 +16,7 @@ type ReceivedMessage struct { | @@ -16,7 +16,7 @@ type ReceivedMessage struct { | ||
16 | type MessageBody struct { | 16 | type MessageBody struct { |
17 | Module string `json:"module"` | 17 | Module string `json:"module"` |
18 | Action string `json:"action"` | 18 | Action string `json:"action"` |
19 | - Datas json.RawMessage `json:"datas"` // 具体的对象JSON数据 | 19 | + Data json.RawMessage `json:"data"` // 具体的对象JSON数据 |
20 | } | 20 | } |
21 | 21 | ||
22 | type ReceivedMessageRepository interface { | 22 | type ReceivedMessageRepository interface { |
@@ -15,13 +15,12 @@ import ( | @@ -15,13 +15,12 @@ import ( | ||
15 | 15 | ||
16 | func SyncDataBusinessAdmin(msgData *sarama.ConsumerMessage) error { | 16 | func SyncDataBusinessAdmin(msgData *sarama.ConsumerMessage) error { |
17 | var receivedMsg domain.ReceivedMessage | 17 | var receivedMsg domain.ReceivedMessage |
18 | - | ||
19 | - log.Logger.Debug(string(msgData.Value)) | ||
20 | err := json.Unmarshal(msgData.Value, &receivedMsg) | 18 | err := json.Unmarshal(msgData.Value, &receivedMsg) |
21 | if err != nil { | 19 | if err != nil { |
22 | log.Logger.Error("解析ReceivedMessage 失败" + err.Error()) | 20 | log.Logger.Error("解析ReceivedMessage 失败" + err.Error()) |
23 | return err | 21 | return err |
24 | } | 22 | } |
23 | + log.Logger.Debug("解析message:", map[string]interface{}{"data": receivedMsg}) | ||
25 | transactionContext, err := factory.CreateTransactionContext(nil) | 24 | transactionContext, err := factory.CreateTransactionContext(nil) |
26 | if err != nil { | 25 | if err != nil { |
27 | return err | 26 | return err |
@@ -23,10 +23,3 @@ func Run() { | @@ -23,10 +23,3 @@ func Run() { | ||
23 | err := saramaConsumer.StartConsume(host, constant.KAFKA_GROUP_ID, messageHandlerMap, log.Logger) | 23 | err := saramaConsumer.StartConsume(host, constant.KAFKA_GROUP_ID, messageHandlerMap, log.Logger) |
24 | log.Logger.Error(err.Error()) | 24 | log.Logger.Error(err.Error()) |
25 | } | 25 | } |
26 | - | ||
27 | -func Demo(message *sarama.ConsumerMessage) error { | ||
28 | - k := string(message.Key) | ||
29 | - v := string(message.Value) | ||
30 | - log.Logger.Debug("message===>" + k + ":" + v) | ||
31 | - return nil | ||
32 | -} |
-
请 注册 或 登录 后发表评论