...
|
...
|
@@ -411,7 +411,7 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue |
|
|
|
|
|
/**
|
|
|
* @Author SteveChan
|
|
|
* @Description //TODO 移除合伙人
|
|
|
* @Description // 移除合伙人
|
|
|
* @Date 16:40 2020/12/29
|
|
|
* @Param
|
|
|
* @return
|
...
|
...
|
@@ -432,6 +432,8 @@ func (PartnerInfoService *PartnerInfoService) RemovePartnerInfo(cmd command.Remo |
|
|
|
|
|
var (
|
|
|
partnerInfoRepository domain.PartnerInfoRepository
|
|
|
orderBaseRepository domain.OrderBaseRepository
|
|
|
orders []domain.OrderBase
|
|
|
)
|
|
|
|
|
|
if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
...
|
...
|
@@ -440,7 +442,19 @@ func (PartnerInfoService *PartnerInfoService) RemovePartnerInfo(cmd command.Remo |
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
if orderBaseRepository, err = factory.CreateOrderBaseRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// 判断合伙人是否有业务数据
|
|
|
orders, _, err = orderBaseRepository.Find(domain.OrderBaseFindQuery{
|
|
|
PartnerId: cmd.Id,
|
|
|
})
|
|
|
if len(orders) > 0 {
|
|
|
return lib.ThrowError(lib.BUSINESS_ERROR, "该合伙人有业务数据,不可删除!")
|
|
|
}
|
|
|
|
|
|
if err = partnerInfoRepository.Remove(cmd.Id); err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
|