...
|
...
|
@@ -21,7 +21,13 @@ func NewPartnerInfoService(options map[string]interface{}) *PartnerInfoService { |
|
|
return newPartnerInfoService
|
|
|
}
|
|
|
|
|
|
// CreatePartnerInfo 创建合伙人
|
|
|
/**
|
|
|
* @Author SteveChan
|
|
|
* @Description // 创建合伙人
|
|
|
* @Date 15:42 2020/12/29
|
|
|
* @Param
|
|
|
* @return
|
|
|
**/
|
|
|
func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.CreatePartnerInfoCommand) (data *domain.PartnerInfo, err error) {
|
|
|
var (
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
...
|
...
|
@@ -35,16 +41,21 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
//检查账号是否存在
|
|
|
var (
|
|
|
partnerinfoDao *dao.PartnerInfoDao
|
|
|
partnerInfoDao *dao.PartnerInfoDao
|
|
|
partnerInfoRepository domain.PartnerInfoRepository
|
|
|
categoryRepository domain.PartnerCategoryRepository
|
|
|
categories []domain.PartnerCategory
|
|
|
)
|
|
|
if partnerinfoDao, err = factory.CreatePartnerInfoDao(map[string]interface{}{
|
|
|
if partnerInfoDao, err = factory.CreatePartnerInfoDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
ok, err := partnerinfoDao.PartnerAccountExist(cmd.Account, cmd.CompanyId)
|
|
|
|
|
|
ok, err := partnerInfoDao.PartnerAccountExist(cmd.Account, cmd.CompanyId)
|
|
|
if err != nil {
|
|
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -52,11 +63,6 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
|
|
return nil, lib.ThrowError(lib.BUSINESS_ERROR, "账号已存在")
|
|
|
}
|
|
|
|
|
|
var (
|
|
|
partnerInfoRepository domain.PartnerInfoRepository
|
|
|
categoryRepository domain.PartnerCategoryRepository
|
|
|
categorys []domain.PartnerCategory
|
|
|
)
|
|
|
if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
...
|
...
|
@@ -67,13 +73,60 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
|
|
}); err != nil {
|
|
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
_, categorys, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{
|
|
|
Ids: cmd.PartnerCategory,
|
|
|
|
|
|
// 获取所有合伙人类型
|
|
|
var categoryMap = make(map[int64]string)
|
|
|
_, categories, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{
|
|
|
Ids: []int64{},
|
|
|
})
|
|
|
if err != nil {
|
|
|
e := fmt.Sprintf("获取合伙人分类数据失败:%s", err)
|
|
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
|
|
}
|
|
|
if len(categories) > 0 {
|
|
|
for _, category := range categories {
|
|
|
categoryMap[category.Id] = category.Name
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// id去重
|
|
|
num := make(map[int64]bool)
|
|
|
for _, partnerCategory := range cmd.PartnerCategory {
|
|
|
if !num[partnerCategory.Id] {
|
|
|
num[partnerCategory.Id] = true
|
|
|
} else {
|
|
|
return nil, lib.ThrowError(lib.BUSINESS_ERROR, "合伙类型不能重复")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 编号去重
|
|
|
for _, partnerCategory := range cmd.PartnerCategory {
|
|
|
if ok, err := partnerInfoDao.PartnerCodeExist(partnerCategory.Id, partnerCategory.Code, cmd.CompanyId, 0); err != nil {
|
|
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
} else if ok {
|
|
|
return nil, lib.ThrowError(lib.BUSINESS_ERROR, categoryMap[partnerCategory.Id]+"编号"+partnerCategory.Code+"已存在")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var ids []int64
|
|
|
for _, partnerCategory := range cmd.PartnerCategory {
|
|
|
ids = append(ids, partnerCategory.Id)
|
|
|
}
|
|
|
_, categories, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{
|
|
|
Ids: ids,
|
|
|
})
|
|
|
if err != nil {
|
|
|
e := fmt.Sprintf("获取合伙人分类数据失败:%s", err)
|
|
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
|
|
}
|
|
|
for i, category := range categories {
|
|
|
for _, partnerCategory := range cmd.PartnerCategory {
|
|
|
if category.Id == partnerCategory.Id {
|
|
|
categories[i].Code = partnerCategory.Code
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
newPartnerInfo := domain.PartnerInfo{
|
|
|
Partner: domain.Partner{
|
|
|
Account: cmd.Account,
|
...
|
...
|
@@ -86,7 +139,8 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
|
|
Salesman: cmd.Salesman,
|
|
|
CooperateTime: cmd.CooperateTime,
|
|
|
CompanyId: cmd.CompanyId,
|
|
|
PartnerCategoryInfos: categorys,
|
|
|
PartnerCategoryInfos: categories,
|
|
|
Remark: cmd.Remark,
|
|
|
}
|
|
|
if err = partnerInfoRepository.Save(&newPartnerInfo); err != nil {
|
|
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
@@ -106,11 +160,18 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre |
|
|
return &newPartnerInfo, nil
|
|
|
}
|
|
|
|
|
|
// GetPartnerInfo 返回合伙人
|
|
|
/**
|
|
|
* @Author SteveChan
|
|
|
* @Description // 返回合伙人,增加合伙人编号字段
|
|
|
* @Date 15:43 2020/12/29
|
|
|
* @Param
|
|
|
* @return
|
|
|
**/
|
|
|
func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerInfoQuery) (data *domain.PartnerInfo, err error) {
|
|
|
var (
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
)
|
|
|
|
|
|
if err = q.ValidateQuery(); err != nil {
|
|
|
return nil, lib.ThrowError(lib.ARG_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -120,17 +181,21 @@ func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerI |
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
var (
|
|
|
PartnerInfoRepository domain.PartnerInfoRepository
|
|
|
categoryRepository domain.PartnerCategoryRepository
|
|
|
categorys []domain.PartnerCategory
|
|
|
categories []domain.PartnerCategory
|
|
|
partnerData *domain.PartnerInfo
|
|
|
)
|
|
|
|
|
|
if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// 获取合伙人数据
|
|
|
partnerData, err = PartnerInfoRepository.FindOne(domain.PartnerFindOneQuery{
|
|
|
UserId: q.Id, CompanyId: q.CompanyId,
|
|
|
})
|
...
|
...
|
@@ -140,33 +205,49 @@ func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerI |
|
|
if !partnerData.IsCompany(q.CompanyId) {
|
|
|
return nil, lib.ThrowError(lib.BUSINESS_ERROR, "企业信息异常操作")
|
|
|
}
|
|
|
|
|
|
// 获取合伙人类别
|
|
|
if categoryRepository, err = factory.CreatePartnerCategoryRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
categoryIds := []int64{}
|
|
|
var categoryIds []int64
|
|
|
for _, v := range partnerData.PartnerCategoryInfos {
|
|
|
categoryIds = append(categoryIds, v.Id)
|
|
|
}
|
|
|
if len(categoryIds) > 0 {
|
|
|
_, categorys, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{
|
|
|
_, categories, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{
|
|
|
Ids: categoryIds,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
for i, category := range categories {
|
|
|
for _, partnerCategory := range partnerData.PartnerCategoryInfos {
|
|
|
if category.Id == partnerCategory.Id {
|
|
|
categories[i].Code = partnerCategory.Code
|
|
|
}
|
|
|
}
|
|
|
partnerData.PartnerCategoryInfos = categorys
|
|
|
}
|
|
|
}
|
|
|
partnerData.PartnerCategoryInfos = categories
|
|
|
err = transactionContext.CommitTransaction()
|
|
|
return partnerData, nil
|
|
|
}
|
|
|
|
|
|
//UpdatePartnerInfo 更新合伙人
|
|
|
/**
|
|
|
* @Author SteveChan
|
|
|
* @Description // 更新合伙人
|
|
|
* @Date 00:07 2020/12/30
|
|
|
* @Param
|
|
|
* @return
|
|
|
**/
|
|
|
func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.UpdatePartnerInfoCommand) (err error) {
|
|
|
var (
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
)
|
|
|
|
|
|
if err = cmd.ValidateCommand(); err != nil {
|
|
|
return application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -176,30 +257,90 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.Upd |
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
var (
|
|
|
partnerInfoRepository domain.PartnerInfoRepository
|
|
|
categoryRepository domain.PartnerCategoryRepository
|
|
|
categorys []domain.PartnerCategory
|
|
|
categories []domain.PartnerCategory
|
|
|
partnerInfoDao *dao.PartnerInfoDao
|
|
|
)
|
|
|
|
|
|
if partnerInfoDao, err = factory.CreatePartnerInfoDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
if categoryRepository, err = factory.CreatePartnerCategoryRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
_, categorys, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{
|
|
|
Ids: cmd.PartnerCategory,
|
|
|
|
|
|
// 获取合伙人类型
|
|
|
var categoryMap = make(map[int64]string)
|
|
|
_, categories, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{
|
|
|
Ids: []int64{},
|
|
|
})
|
|
|
if err != nil {
|
|
|
e := fmt.Sprintf("获取合伙人分类数据失败:%s", err)
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
|
|
}
|
|
|
if len(categories) > 0 {
|
|
|
for _, category := range categories {
|
|
|
categoryMap[category.Id] = category.Name
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// id去重
|
|
|
num := make(map[int64]bool)
|
|
|
for _, partnerCategory := range cmd.PartnerCategory {
|
|
|
if !num[partnerCategory.Id] {
|
|
|
num[partnerCategory.Id] = true
|
|
|
} else {
|
|
|
return lib.ThrowError(lib.BUSINESS_ERROR, "合伙类型不能重复")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 编号去重
|
|
|
for _, partnerCategory := range cmd.PartnerCategory {
|
|
|
if ok, err := partnerInfoDao.PartnerCodeExist(partnerCategory.Id, partnerCategory.Code, cmd.CompanyId, cmd.Id); err != nil {
|
|
|
return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
} else if ok {
|
|
|
return lib.ThrowError(lib.BUSINESS_ERROR, categoryMap[partnerCategory.Id]+"编号"+partnerCategory.Code+"已存在")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var ids []int64
|
|
|
for _, partnerCategory := range cmd.PartnerCategory {
|
|
|
ids = append(ids, partnerCategory.Id)
|
|
|
}
|
|
|
|
|
|
_, categories, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{
|
|
|
Ids: ids,
|
|
|
})
|
|
|
if err != nil {
|
|
|
e := fmt.Sprintf("获取合伙人分类数据失败:%s", err)
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
|
|
}
|
|
|
|
|
|
for i, category := range categories {
|
|
|
for _, partnerCategory := range cmd.PartnerCategory {
|
|
|
if category.Id == partnerCategory.Id {
|
|
|
categories[i].Code = partnerCategory.Code
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
partnerInfo, err := partnerInfoRepository.FindOne(domain.PartnerFindOneQuery{
|
|
|
UserId: cmd.Id, CompanyId: cmd.CompanyId,
|
|
|
UserId: cmd.Id,
|
|
|
CompanyId: cmd.CompanyId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
@@ -207,11 +348,15 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.Upd |
|
|
if !partnerInfo.IsCompany(cmd.CompanyId) {
|
|
|
return lib.ThrowError(lib.BUSINESS_ERROR, "异常操作")
|
|
|
}
|
|
|
|
|
|
partnerInfo.Partner.PartnerName = cmd.PartnerName
|
|
|
partnerInfo.Salesman = cmd.Salesman
|
|
|
partnerInfo.Status = cmd.Status
|
|
|
partnerInfo.RegionInfo = *cmd.RegionInfo
|
|
|
partnerInfo.CooperateTime = cmd.CooperateTime
|
|
|
partnerInfo.PartnerCategoryInfos = categorys
|
|
|
partnerInfo.PartnerCategoryInfos = categories
|
|
|
partnerInfo.Remark = cmd.Remark
|
|
|
|
|
|
if err = partnerInfoRepository.Save(partnerInfo); err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -231,7 +376,13 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.Upd |
|
|
return
|
|
|
}
|
|
|
|
|
|
// ListPartnerInfo 合伙人列表
|
|
|
/**
|
|
|
* @Author SteveChan
|
|
|
* @Description //合伙人列表,返回合伙人编号
|
|
|
* @Date 00:07 2020/12/30
|
|
|
* @Param
|
|
|
* @return
|
|
|
**/
|
|
|
func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQuery *query.ListPartnerInfoQuery) (int, []domain.PartnerInfo, error) {
|
|
|
var (
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
...
|
...
|
@@ -246,14 +397,13 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue |
|
|
return 0, nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
|
|
|
transactionContext.RollbackTransaction()
|
|
|
|
|
|
}()
|
|
|
|
|
|
var (
|
|
|
partnerInfoRepository domain.PartnerInfoRepository
|
|
|
categoryRepository domain.PartnerCategoryRepository
|
|
|
categorys []domain.PartnerCategory
|
|
|
categories []domain.PartnerCategory
|
|
|
)
|
|
|
if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
...
|
...
|
@@ -271,8 +421,8 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue |
|
|
PartnerName: listPartnerInfoQuery.PartnerName,
|
|
|
CompanyId: listPartnerInfoQuery.CompanyId,
|
|
|
}
|
|
|
if listPartnerInfoQuery.Partnertype > 0 {
|
|
|
queryOption.PartnerCategory = []int{listPartnerInfoQuery.Partnertype}
|
|
|
if listPartnerInfoQuery.PartnerType > 0 {
|
|
|
queryOption.PartnerCategory = []int{listPartnerInfoQuery.PartnerType}
|
|
|
}
|
|
|
// RegionInfo
|
|
|
if len(listPartnerInfoQuery.RegionInfo) > 0 {
|
...
|
...
|
@@ -284,18 +434,19 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue |
|
|
if count, err = partnerInfoRepository.CountAll(queryOption); err != nil {
|
|
|
return 0, nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
_, categorys, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{})
|
|
|
_, categories, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{})
|
|
|
if err != nil {
|
|
|
return count, partnerInfos, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
categorysMap := make(map[int64]domain.PartnerCategory)
|
|
|
for i := range categorys {
|
|
|
categorysMap[categorys[i].Id] = categorys[i]
|
|
|
categoriesMap := make(map[int64]domain.PartnerCategory)
|
|
|
for i := range categories {
|
|
|
categoriesMap[categories[i].Id] = categories[i]
|
|
|
}
|
|
|
for i := range partnerInfos {
|
|
|
categoryInPartner := []domain.PartnerCategory{}
|
|
|
var categoryInPartner []domain.PartnerCategory
|
|
|
for _, vv := range partnerInfos[i].PartnerCategoryInfos {
|
|
|
if categoryData, ok := categorysMap[vv.Id]; ok {
|
|
|
if categoryData, ok := categoriesMap[vv.Id]; ok {
|
|
|
categoryData.Code = vv.Code
|
|
|
categoryInPartner = append(categoryInPartner, categoryData)
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -307,6 +458,61 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue |
|
|
return count, partnerInfos, nil
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @Author SteveChan
|
|
|
* @Description // 移除合伙人
|
|
|
* @Date 16:40 2020/12/29
|
|
|
* @Param
|
|
|
* @return
|
|
|
**/
|
|
|
func (PartnerInfoService *PartnerInfoService) RemovePartnerInfo(cmd command.RemovePartnerInfoCommand) (err error) {
|
|
|
var (
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
)
|
|
|
if err = cmd.ValidateCommand(); err != nil {
|
|
|
return application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
|
|
if err = transactionContext.StartTransaction(); err != nil {
|
|
|
return err
|
|
|
}
|
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
var (
|
|
|
partnerInfoRepository domain.PartnerInfoRepository
|
|
|
orderBaseRepository domain.OrderBaseRepository
|
|
|
orders []domain.OrderBase
|
|
|
)
|
|
|
|
|
|
if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
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())
|
|
|
}
|
|
|
|
|
|
transactionContext.CommitTransaction()
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
func (PartnerInfoService *PartnerInfoService) UpdateStatus(cmd command.StatusPartnerInfoCommand) (err error) {
|
|
|
if len(cmd.Ids) == 0 {
|
|
|
return nil
|
...
|
...
|
@@ -324,14 +530,14 @@ func (PartnerInfoService *PartnerInfoService) UpdateStatus(cmd command.StatusPar |
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
var (
|
|
|
partnerinfoDao *dao.PartnerInfoDao
|
|
|
partnerInfoDao *dao.PartnerInfoDao
|
|
|
)
|
|
|
if partnerinfoDao, err = factory.CreatePartnerInfoDao(map[string]interface{}{
|
|
|
if partnerInfoDao, err = factory.CreatePartnerInfoDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
err = partnerinfoDao.UpdatePartnerStatus(cmd.Ids, cmd.CompanyId, cmd.Status)
|
|
|
err = partnerInfoDao.UpdatePartnerStatus(cmd.Ids, cmd.CompanyId, cmd.Status)
|
|
|
if err != nil {
|
|
|
e := fmt.Sprintf("更新合伙人(id=%v)的数据失败;%s", cmd.Ids, err)
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
...
|
...
|
|