|
@@ -23,7 +23,7 @@ func NewPartnerInfoService(options map[string]interface{}) *PartnerInfoService { |
|
@@ -23,7 +23,7 @@ func NewPartnerInfoService(options map[string]interface{}) *PartnerInfoService { |
23
|
|
23
|
|
24
|
/**
|
24
|
/**
|
25
|
* @Author SteveChan
|
25
|
* @Author SteveChan
|
26
|
- * @Description //TODO 创建合伙人,判断编号是否重复
|
26
|
+ * @Description // 创建合伙人
|
27
|
* @Date 15:42 2020/12/29
|
27
|
* @Date 15:42 2020/12/29
|
28
|
* @Param
|
28
|
* @Param
|
29
|
* @return
|
29
|
* @return
|
|
@@ -51,6 +51,7 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
|
@@ -51,6 +51,7 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
51
|
}); err != nil {
|
51
|
}); err != nil {
|
52
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
52
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
53
|
}
|
53
|
}
|
|
|
54
|
+
|
54
|
ok, err := partnerInfoDao.PartnerAccountExist(cmd.Account, cmd.CompanyId)
|
55
|
ok, err := partnerInfoDao.PartnerAccountExist(cmd.Account, cmd.CompanyId)
|
55
|
if err != nil {
|
56
|
if err != nil {
|
56
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
57
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
@@ -59,6 +60,15 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
|
@@ -59,6 +60,15 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
59
|
return nil, lib.ThrowError(lib.BUSINESS_ERROR, "账号已存在")
|
60
|
return nil, lib.ThrowError(lib.BUSINESS_ERROR, "账号已存在")
|
60
|
}
|
61
|
}
|
61
|
|
62
|
|
|
|
63
|
+ // 编号去重
|
|
|
64
|
+ for _, partnerCategory := range cmd.PartnerCategory {
|
|
|
65
|
+ if ok, err := partnerInfoDao.PartnerCodeExist(partnerCategory.Id, partnerCategory.Code, cmd.CompanyId, 0); err != nil {
|
|
|
66
|
+ return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
67
|
+ } else if ok {
|
|
|
68
|
+ return nil, lib.ThrowError(lib.BUSINESS_ERROR, "合伙类型"+""+"编号"+partnerCategory.Code+"已存在")
|
|
|
69
|
+ }
|
|
|
70
|
+ }
|
|
|
71
|
+
|
62
|
var (
|
72
|
var (
|
63
|
partnerInfoRepository domain.PartnerInfoRepository
|
73
|
partnerInfoRepository domain.PartnerInfoRepository
|
64
|
categoryRepository domain.PartnerCategoryRepository
|
74
|
categoryRepository domain.PartnerCategoryRepository
|
|
@@ -74,6 +84,7 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
|
@@ -74,6 +84,7 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
74
|
}); err != nil {
|
84
|
}); err != nil {
|
75
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
85
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
76
|
}
|
86
|
}
|
|
|
87
|
+
|
77
|
var ids []int64
|
88
|
var ids []int64
|
78
|
for _, partnerCategory := range cmd.PartnerCategory {
|
89
|
for _, partnerCategory := range cmd.PartnerCategory {
|
79
|
ids = append(ids, partnerCategory.Id)
|
90
|
ids = append(ids, partnerCategory.Id)
|
|
@@ -85,6 +96,13 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
|
@@ -85,6 +96,13 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
85
|
e := fmt.Sprintf("获取合伙人分类数据失败:%s", err)
|
96
|
e := fmt.Sprintf("获取合伙人分类数据失败:%s", err)
|
86
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
97
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
87
|
}
|
98
|
}
|
|
|
99
|
+ for i, category := range categories {
|
|
|
100
|
+ for _, partnerCategory := range cmd.PartnerCategory {
|
|
|
101
|
+ if category.Id == partnerCategory.Id {
|
|
|
102
|
+ categories[i].Code = partnerCategory.Code
|
|
|
103
|
+ }
|
|
|
104
|
+ }
|
|
|
105
|
+ }
|
88
|
|
106
|
|
89
|
newPartnerInfo := domain.PartnerInfo{
|
107
|
newPartnerInfo := domain.PartnerInfo{
|
90
|
Partner: domain.Partner{
|
108
|
Partner: domain.Partner{
|
|
@@ -99,6 +117,7 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
|
@@ -99,6 +117,7 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
99
|
CooperateTime: cmd.CooperateTime,
|
117
|
CooperateTime: cmd.CooperateTime,
|
100
|
CompanyId: cmd.CompanyId,
|
118
|
CompanyId: cmd.CompanyId,
|
101
|
PartnerCategoryInfos: categories,
|
119
|
PartnerCategoryInfos: categories,
|
|
|
120
|
+ Remark: cmd.Remark,
|
102
|
}
|
121
|
}
|
103
|
if err = partnerInfoRepository.Save(&newPartnerInfo); err != nil {
|
122
|
if err = partnerInfoRepository.Save(&newPartnerInfo); err != nil {
|
104
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
123
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
@@ -120,7 +139,7 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
|
@@ -120,7 +139,7 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
120
|
|
139
|
|
121
|
/**
|
140
|
/**
|
122
|
* @Author SteveChan
|
141
|
* @Author SteveChan
|
123
|
- * @Description //TODO 返回合伙人,增加合伙人编号字段
|
142
|
+ * @Description // 返回合伙人,增加合伙人编号字段
|
124
|
* @Date 15:43 2020/12/29
|
143
|
* @Date 15:43 2020/12/29
|
125
|
* @Param
|
144
|
* @Param
|
126
|
* @return
|
145
|
* @return
|
|
@@ -129,6 +148,7 @@ func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerI |
|
@@ -129,6 +148,7 @@ func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerI |
129
|
var (
|
148
|
var (
|
130
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
149
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
131
|
)
|
150
|
)
|
|
|
151
|
+
|
132
|
if err = q.ValidateQuery(); err != nil {
|
152
|
if err = q.ValidateQuery(); err != nil {
|
133
|
return nil, lib.ThrowError(lib.ARG_ERROR, err.Error())
|
153
|
return nil, lib.ThrowError(lib.ARG_ERROR, err.Error())
|
134
|
}
|
154
|
}
|
|
@@ -138,17 +158,21 @@ func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerI |
|
@@ -138,17 +158,21 @@ func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerI |
138
|
defer func() {
|
158
|
defer func() {
|
139
|
transactionContext.RollbackTransaction()
|
159
|
transactionContext.RollbackTransaction()
|
140
|
}()
|
160
|
}()
|
|
|
161
|
+
|
141
|
var (
|
162
|
var (
|
142
|
PartnerInfoRepository domain.PartnerInfoRepository
|
163
|
PartnerInfoRepository domain.PartnerInfoRepository
|
143
|
categoryRepository domain.PartnerCategoryRepository
|
164
|
categoryRepository domain.PartnerCategoryRepository
|
144
|
categories []domain.PartnerCategory
|
165
|
categories []domain.PartnerCategory
|
145
|
partnerData *domain.PartnerInfo
|
166
|
partnerData *domain.PartnerInfo
|
146
|
)
|
167
|
)
|
|
|
168
|
+
|
147
|
if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
169
|
if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
148
|
"transactionContext": transactionContext,
|
170
|
"transactionContext": transactionContext,
|
149
|
}); err != nil {
|
171
|
}); err != nil {
|
150
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
172
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
151
|
}
|
173
|
}
|
|
|
174
|
+
|
|
|
175
|
+ // 获取合伙人数据
|
152
|
partnerData, err = PartnerInfoRepository.FindOne(domain.PartnerFindOneQuery{
|
176
|
partnerData, err = PartnerInfoRepository.FindOne(domain.PartnerFindOneQuery{
|
153
|
UserId: q.Id, CompanyId: q.CompanyId,
|
177
|
UserId: q.Id, CompanyId: q.CompanyId,
|
154
|
})
|
178
|
})
|
|
@@ -158,6 +182,8 @@ func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerI |
|
@@ -158,6 +182,8 @@ func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerI |
158
|
if !partnerData.IsCompany(q.CompanyId) {
|
182
|
if !partnerData.IsCompany(q.CompanyId) {
|
159
|
return nil, lib.ThrowError(lib.BUSINESS_ERROR, "企业信息异常操作")
|
183
|
return nil, lib.ThrowError(lib.BUSINESS_ERROR, "企业信息异常操作")
|
160
|
}
|
184
|
}
|
|
|
185
|
+
|
|
|
186
|
+ // 获取合伙人类别
|
161
|
if categoryRepository, err = factory.CreatePartnerCategoryRepository(map[string]interface{}{
|
187
|
if categoryRepository, err = factory.CreatePartnerCategoryRepository(map[string]interface{}{
|
162
|
"transactionContext": transactionContext,
|
188
|
"transactionContext": transactionContext,
|
163
|
}); err != nil {
|
189
|
}); err != nil {
|
|
@@ -174,17 +200,31 @@ func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerI |
|
@@ -174,17 +200,31 @@ func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerI |
174
|
if err != nil {
|
200
|
if err != nil {
|
175
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
201
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
176
|
}
|
202
|
}
|
|
|
203
|
+ for i, category := range categories {
|
|
|
204
|
+ for _, partnerCategory := range partnerData.PartnerCategoryInfos {
|
|
|
205
|
+ if category.Id == partnerCategory.Id {
|
|
|
206
|
+ categories[i].Code = partnerCategory.Code
|
|
|
207
|
+ }
|
|
|
208
|
+ }
|
|
|
209
|
+ }
|
177
|
}
|
210
|
}
|
178
|
partnerData.PartnerCategoryInfos = categories
|
211
|
partnerData.PartnerCategoryInfos = categories
|
179
|
err = transactionContext.CommitTransaction()
|
212
|
err = transactionContext.CommitTransaction()
|
180
|
return partnerData, nil
|
213
|
return partnerData, nil
|
181
|
}
|
214
|
}
|
182
|
|
215
|
|
183
|
-//UpdatePartnerInfo 更新合伙人
|
216
|
+/**
|
|
|
217
|
+ * @Author SteveChan
|
|
|
218
|
+ * @Description // 更新合伙人
|
|
|
219
|
+ * @Date 00:07 2020/12/30
|
|
|
220
|
+ * @Param
|
|
|
221
|
+ * @return
|
|
|
222
|
+ **/
|
184
|
func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.UpdatePartnerInfoCommand) (err error) {
|
223
|
func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.UpdatePartnerInfoCommand) (err error) {
|
185
|
var (
|
224
|
var (
|
186
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
225
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
187
|
)
|
226
|
)
|
|
|
227
|
+
|
188
|
if err = cmd.ValidateCommand(); err != nil {
|
228
|
if err = cmd.ValidateCommand(); err != nil {
|
189
|
return application.ThrowError(application.ARG_ERROR, err.Error())
|
229
|
return application.ThrowError(application.ARG_ERROR, err.Error())
|
190
|
}
|
230
|
}
|
|
@@ -194,32 +234,62 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.Upd |
|
@@ -194,32 +234,62 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.Upd |
194
|
defer func() {
|
234
|
defer func() {
|
195
|
transactionContext.RollbackTransaction()
|
235
|
transactionContext.RollbackTransaction()
|
196
|
}()
|
236
|
}()
|
|
|
237
|
+
|
197
|
var (
|
238
|
var (
|
198
|
partnerInfoRepository domain.PartnerInfoRepository
|
239
|
partnerInfoRepository domain.PartnerInfoRepository
|
199
|
categoryRepository domain.PartnerCategoryRepository
|
240
|
categoryRepository domain.PartnerCategoryRepository
|
200
|
- categorys []domain.PartnerCategory
|
241
|
+ categories []domain.PartnerCategory
|
|
|
242
|
+ partnerInfoDao *dao.PartnerInfoDao
|
201
|
)
|
243
|
)
|
|
|
244
|
+
|
|
|
245
|
+ if partnerInfoDao, err = factory.CreatePartnerInfoDao(map[string]interface{}{
|
|
|
246
|
+ "transactionContext": transactionContext,
|
|
|
247
|
+ }); err != nil {
|
|
|
248
|
+ return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
249
|
+ }
|
|
|
250
|
+
|
202
|
if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
251
|
if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
203
|
"transactionContext": transactionContext,
|
252
|
"transactionContext": transactionContext,
|
204
|
}); err != nil {
|
253
|
}); err != nil {
|
205
|
return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
254
|
return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
206
|
}
|
255
|
}
|
|
|
256
|
+
|
207
|
if categoryRepository, err = factory.CreatePartnerCategoryRepository(map[string]interface{}{
|
257
|
if categoryRepository, err = factory.CreatePartnerCategoryRepository(map[string]interface{}{
|
208
|
"transactionContext": transactionContext,
|
258
|
"transactionContext": transactionContext,
|
209
|
}); err != nil {
|
259
|
}); err != nil {
|
210
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
260
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
211
|
}
|
261
|
}
|
|
|
262
|
+
|
|
|
263
|
+ // 编号去重
|
|
|
264
|
+ for _, partnerCategory := range cmd.PartnerCategory {
|
|
|
265
|
+ if ok, err := partnerInfoDao.PartnerCodeExist(partnerCategory.Id, partnerCategory.Code, cmd.CompanyId, cmd.Id); err != nil {
|
|
|
266
|
+ return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
267
|
+ } else if ok {
|
|
|
268
|
+ return lib.ThrowError(lib.BUSINESS_ERROR, "编号"+partnerCategory.Code+"已存在")
|
|
|
269
|
+ }
|
|
|
270
|
+ }
|
|
|
271
|
+
|
212
|
var ids []int64
|
272
|
var ids []int64
|
213
|
for _, partnerCategory := range cmd.PartnerCategory {
|
273
|
for _, partnerCategory := range cmd.PartnerCategory {
|
214
|
ids = append(ids, partnerCategory.Id)
|
274
|
ids = append(ids, partnerCategory.Id)
|
215
|
}
|
275
|
}
|
216
|
- _, categorys, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{
|
276
|
+
|
|
|
277
|
+ _, categories, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{
|
217
|
Ids: ids,
|
278
|
Ids: ids,
|
218
|
})
|
279
|
})
|
219
|
if err != nil {
|
280
|
if err != nil {
|
220
|
e := fmt.Sprintf("获取合伙人分类数据失败:%s", err)
|
281
|
e := fmt.Sprintf("获取合伙人分类数据失败:%s", err)
|
221
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
282
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
222
|
}
|
283
|
}
|
|
|
284
|
+
|
|
|
285
|
+ for i, category := range categories {
|
|
|
286
|
+ for _, partnerCategory := range cmd.PartnerCategory {
|
|
|
287
|
+ if category.Id == partnerCategory.Id {
|
|
|
288
|
+ categories[i].Code = partnerCategory.Code
|
|
|
289
|
+ }
|
|
|
290
|
+ }
|
|
|
291
|
+ }
|
|
|
292
|
+
|
223
|
partnerInfo, err := partnerInfoRepository.FindOne(domain.PartnerFindOneQuery{
|
293
|
partnerInfo, err := partnerInfoRepository.FindOne(domain.PartnerFindOneQuery{
|
224
|
UserId: cmd.Id,
|
294
|
UserId: cmd.Id,
|
225
|
CompanyId: cmd.CompanyId,
|
295
|
CompanyId: cmd.CompanyId,
|
|
@@ -230,11 +300,14 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.Upd |
|
@@ -230,11 +300,14 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.Upd |
230
|
if !partnerInfo.IsCompany(cmd.CompanyId) {
|
300
|
if !partnerInfo.IsCompany(cmd.CompanyId) {
|
231
|
return lib.ThrowError(lib.BUSINESS_ERROR, "异常操作")
|
301
|
return lib.ThrowError(lib.BUSINESS_ERROR, "异常操作")
|
232
|
}
|
302
|
}
|
|
|
303
|
+
|
233
|
partnerInfo.Salesman = cmd.Salesman
|
304
|
partnerInfo.Salesman = cmd.Salesman
|
234
|
partnerInfo.Status = cmd.Status
|
305
|
partnerInfo.Status = cmd.Status
|
235
|
partnerInfo.RegionInfo = *cmd.RegionInfo
|
306
|
partnerInfo.RegionInfo = *cmd.RegionInfo
|
236
|
partnerInfo.CooperateTime = cmd.CooperateTime
|
307
|
partnerInfo.CooperateTime = cmd.CooperateTime
|
237
|
- partnerInfo.PartnerCategoryInfos = categorys
|
308
|
+ partnerInfo.PartnerCategoryInfos = categories
|
|
|
309
|
+ partnerInfo.Remark = cmd.Remark
|
|
|
310
|
+
|
238
|
if err = partnerInfoRepository.Save(partnerInfo); err != nil {
|
311
|
if err = partnerInfoRepository.Save(partnerInfo); err != nil {
|
239
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
312
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
240
|
}
|
313
|
}
|
|
@@ -254,7 +327,13 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.Upd |
|
@@ -254,7 +327,13 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.Upd |
254
|
return
|
327
|
return
|
255
|
}
|
328
|
}
|
256
|
|
329
|
|
257
|
-// ListPartnerInfo 合伙人列表
|
330
|
+/**
|
|
|
331
|
+ * @Author SteveChan
|
|
|
332
|
+ * @Description //合伙人列表,返回合伙人编号
|
|
|
333
|
+ * @Date 00:07 2020/12/30
|
|
|
334
|
+ * @Param
|
|
|
335
|
+ * @return
|
|
|
336
|
+ **/
|
258
|
func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQuery *query.ListPartnerInfoQuery) (int, []domain.PartnerInfo, error) {
|
337
|
func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQuery *query.ListPartnerInfoQuery) (int, []domain.PartnerInfo, error) {
|
259
|
var (
|
338
|
var (
|
260
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
339
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
@@ -318,6 +397,7 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue |
|
@@ -318,6 +397,7 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue |
318
|
var categoryInPartner []domain.PartnerCategory
|
397
|
var categoryInPartner []domain.PartnerCategory
|
319
|
for _, vv := range partnerInfos[i].PartnerCategoryInfos {
|
398
|
for _, vv := range partnerInfos[i].PartnerCategoryInfos {
|
320
|
if categoryData, ok := categoriesMap[vv.Id]; ok {
|
399
|
if categoryData, ok := categoriesMap[vv.Id]; ok {
|
|
|
400
|
+ categoryData.Code = vv.Code
|
321
|
categoryInPartner = append(categoryInPartner, categoryData)
|
401
|
categoryInPartner = append(categoryInPartner, categoryData)
|
322
|
}
|
402
|
}
|
323
|
}
|
403
|
}
|
|
@@ -350,6 +430,23 @@ func (PartnerInfoService *PartnerInfoService) RemovePartnerInfo(cmd command.Remo |
|
@@ -350,6 +430,23 @@ func (PartnerInfoService *PartnerInfoService) RemovePartnerInfo(cmd command.Remo |
350
|
transactionContext.RollbackTransaction()
|
430
|
transactionContext.RollbackTransaction()
|
351
|
}()
|
431
|
}()
|
352
|
|
432
|
|
|
|
433
|
+ var (
|
|
|
434
|
+ partnerInfoRepository domain.PartnerInfoRepository
|
|
|
435
|
+ )
|
|
|
436
|
+
|
|
|
437
|
+ if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
|
|
438
|
+ "transactionContext": transactionContext,
|
|
|
439
|
+ }); err != nil {
|
|
|
440
|
+ return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
441
|
+ }
|
|
|
442
|
+
|
|
|
443
|
+ // 判断合伙人是否有业务数据
|
|
|
444
|
+
|
|
|
445
|
+ if err = partnerInfoRepository.Remove(cmd.Id); err != nil {
|
|
|
446
|
+ return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
447
|
+ }
|
|
|
448
|
+
|
|
|
449
|
+ transactionContext.CommitTransaction()
|
353
|
return nil
|
450
|
return nil
|
354
|
}
|
451
|
}
|
355
|
|
452
|
|