...
|
...
|
@@ -358,6 +358,7 @@ func (cooperationModeService *CooperationModeService) UpdateCooperationMode(upda |
|
|
} else {
|
|
|
cooperationModeRepository = value
|
|
|
}
|
|
|
|
|
|
// 共创模式DAO初始化
|
|
|
var cooperationModeDao *dao.CooperationModeDao
|
|
|
if value, err := factory.CreateCooperationModeDao(map[string]interface{}{
|
...
|
...
|
@@ -367,23 +368,27 @@ func (cooperationModeService *CooperationModeService) UpdateCooperationMode(upda |
|
|
} else {
|
|
|
cooperationModeDao = value
|
|
|
}
|
|
|
|
|
|
cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeId": updateCooperationModeCommand.CooperationModeId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创模式不存在")
|
|
|
}
|
|
|
if cooperationMode == nil {
|
|
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(updateCooperationModeCommand.CooperationModeId, 10)))
|
|
|
}
|
|
|
|
|
|
// 校验共创模式名称唯一性
|
|
|
if cooperationMode.CooperationModeName != updateCooperationModeCommand.CooperationModeName {
|
|
|
nameAvailable, _ := cooperationModeDao.CheckModeNameAvailable(map[string]interface{}{
|
|
|
"companyId": updateCooperationModeCommand.CompanyId,
|
|
|
"orgId": updateCooperationModeCommand.OrgId,
|
|
|
"cooperationModeName": updateCooperationModeCommand.CooperationModeName,
|
|
|
})
|
|
|
if !nameAvailable {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "模式名称已存在")
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "模式名称已存在")
|
|
|
}
|
|
|
|
|
|
cooperationMode, err := cooperationModeRepository.FindOne(map[string]interface{}{"cooperationModeId": updateCooperationModeCommand.CooperationModeId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创模式不存在")
|
|
|
}
|
|
|
if cooperationMode == nil {
|
|
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(updateCooperationModeCommand.CooperationModeId, 10)))
|
|
|
}
|
|
|
|
|
|
if err := cooperationMode.Update(tool_funs.SimpleStructToMap(updateCooperationModeCommand)); err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
|