...
|
...
|
@@ -120,16 +120,13 @@ func EditAchievement(editData *protocol.RequestEditAchievement, companyid int64) |
|
|
}
|
|
|
nowTime := time.Now()
|
|
|
achievementData.UpdateAt = nowTime
|
|
|
achievementData.DepartmentId = editData.DepartmentId
|
|
|
achievementData.UserCompanyId = editData.UserCompanyId
|
|
|
achievementData.ChanceTypeId = editData.ChanceTypeId
|
|
|
achievementData.AuditTemplateId = editData.AuditTemplateId
|
|
|
achievementData.SourceContent = editData.SourceContent
|
|
|
achievementData.GraspScore = editData.GraspScore
|
|
|
achievementData.UserGraspScore = editData.UserGraspScore
|
|
|
achievementData.UpdateAt = nowTime
|
|
|
cols := []string{
|
|
|
"UpdateAt", "DepartmentId", "UserCompanyId", "ChanceTypeId", "AuditTemplateId", "SourceContent", "GraspScore",
|
|
|
"UpdateAt", "ChanceTypeId", "AuditTemplateId", "SourceContent", "GraspScore",
|
|
|
}
|
|
|
o := orm.NewOrm()
|
|
|
o.Begin()
|
...
|
...
|
@@ -149,30 +146,13 @@ func EditAchievement(editData *protocol.RequestEditAchievement, companyid int64) |
|
|
log.Info("删除achievement_chance数据失败:%s", err)
|
|
|
return protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
//删除achievement_prover旧数据
|
|
|
_, err = o.QueryTable(&models.AchievementProvider{}).
|
|
|
Filter("achievement_id", editData.AchievementId).
|
|
|
Delete()
|
|
|
if err != nil {
|
|
|
o.Rollback()
|
|
|
log.Info("删除achievement_chance数据失败:%s", err)
|
|
|
return protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
|
|
|
err = addAchievementChance(editData.ChanceData, achievementData.Id, o)
|
|
|
if err != nil {
|
|
|
log.Error("添加achievement_chance失败:%s", err)
|
|
|
o.Rollback()
|
|
|
return protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
//操作achievement_provider 成果提供人表
|
|
|
if len(editData.Provider) > 0 {
|
|
|
err = addAchievementProvider(editData.Provider, achievementData.Id, o)
|
|
|
if err != nil {
|
|
|
log.Error("添加achievement_provider失败:%s", err)
|
|
|
o.Rollback()
|
|
|
return protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
}
|
|
|
o.Commit()
|
|
|
return nil
|
|
|
}
|
...
|
...
|
|