正在显示
1 个修改的文件
包含
15 行增加
和
1 行删除
@@ -411,7 +411,7 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue | @@ -411,7 +411,7 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue | ||
411 | 411 | ||
412 | /** | 412 | /** |
413 | * @Author SteveChan | 413 | * @Author SteveChan |
414 | - * @Description //TODO 移除合伙人 | 414 | + * @Description // 移除合伙人 |
415 | * @Date 16:40 2020/12/29 | 415 | * @Date 16:40 2020/12/29 |
416 | * @Param | 416 | * @Param |
417 | * @return | 417 | * @return |
@@ -432,6 +432,8 @@ func (PartnerInfoService *PartnerInfoService) RemovePartnerInfo(cmd command.Remo | @@ -432,6 +432,8 @@ func (PartnerInfoService *PartnerInfoService) RemovePartnerInfo(cmd command.Remo | ||
432 | 432 | ||
433 | var ( | 433 | var ( |
434 | partnerInfoRepository domain.PartnerInfoRepository | 434 | partnerInfoRepository domain.PartnerInfoRepository |
435 | + orderBaseRepository domain.OrderBaseRepository | ||
436 | + orders []domain.OrderBase | ||
435 | ) | 437 | ) |
436 | 438 | ||
437 | if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{ | 439 | if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{ |
@@ -440,7 +442,19 @@ func (PartnerInfoService *PartnerInfoService) RemovePartnerInfo(cmd command.Remo | @@ -440,7 +442,19 @@ func (PartnerInfoService *PartnerInfoService) RemovePartnerInfo(cmd command.Remo | ||
440 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | 442 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) |
441 | } | 443 | } |
442 | 444 | ||
445 | + if orderBaseRepository, err = factory.CreateOrderBaseRepository(map[string]interface{}{ | ||
446 | + "transactionContext": transactionContext, | ||
447 | + }); err != nil { | ||
448 | + return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | ||
449 | + } | ||
450 | + | ||
443 | // 判断合伙人是否有业务数据 | 451 | // 判断合伙人是否有业务数据 |
452 | + orders, _, err = orderBaseRepository.Find(domain.OrderBaseFindQuery{ | ||
453 | + PartnerId: cmd.Id, | ||
454 | + }) | ||
455 | + if len(orders) > 0 { | ||
456 | + return lib.ThrowError(lib.BUSINESS_ERROR, "该合伙人有业务数据,不可删除!") | ||
457 | + } | ||
444 | 458 | ||
445 | if err = partnerInfoRepository.Remove(cmd.Id); err != nil { | 459 | if err = partnerInfoRepository.Remove(cmd.Id); err != nil { |
446 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | 460 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) |
-
请 注册 或 登录 后发表评论