作者 tangxvhui

bug修复

... ... @@ -3,12 +3,12 @@ package protocol
//RequestAddAchievement 添加成果
type RequestAddAchievement struct {
ChanceData []AchievementChance `json:"chance_data"`
TypeA int `json:"type_a"` //机会一级分类 chance_type
TypeB int `json:"type_b"` //机会二级分类
TypeIdA int `json:"type_id_a"` //机会一级分类 chance_type
TypeIdB int `json:"type_id_b"` //机会二级分类
DepartmentId int64 `json:"department_id"` //把握人的部门
UserCompanyId int64 `json:"user_company_id"` //把握人的id
GraspScore int `json:"grasp_score"` //把握分
UserGraspScore int `json:"user_grasp_score"` //把握人总得分
GraspScore float64 `json:"grasp_score"` //把握分
UserGraspScore float64 `json:"user_grasp_score"` //把握人总得分
Provider []AchievementProvider `json:"provider"` //机会提供者
SourceContent string `json:"source_content"` //成果描述文本
Images []string `json:"image"` //图片
... ...
... ... @@ -9,8 +9,25 @@ import (
)
func AddAchievement(addData *protocol.RequestAddAchievement, companyid int64) error {
// var (
// achievementData *models.Achievement
// chanceList []models.AchievementChance
// providerList []models.AchievementProvider
// err error
// )
// imgData,
// //操作achievement 成果表
// achievementData = &models.Achievement{
// CompanyId: companyid,
// DepartmentId: addData.DepartmentId,
// UserCompanyId: addData.UserCompanyId,
// ChanceTypeId: addData.TypeIdA,
// AuditTemplateId: addData.TypeIdB,
// SourceContent: addData.SourceContent,
// GraspScore: addData.GraspScore,
// UserGraspScore: addData.UserGraspScore,
// }
//操作achievement 成果表
//操作 achievement_chance 机会来源表
//操作achievement_provider 成果提供人表
... ...
... ... @@ -282,31 +282,32 @@ func getRangeDataRelationLsit(rankRangeId int64, rangeType int8) []protocol.Rank
}
switch rangeType {
case models.RANK_RANGE_TYPE_DEPARTMENT:
//员工
users, err := models.GetUserCompanyByIds(relationIds)
//部门
departments, err := models.GetDepartmentByIds(relationIds)
if err != nil {
log.Error("获取员工数据失败")
log.Error("获取部门数据失败")
}
for i := range users {
for i := range departments {
m := protocol.RankRangeRelation{
Id: users[i].Id,
Name: users[i].NickName,
Id: departments[i].Id,
Name: departments[i].Name,
}
datalist = append(datalist, m)
}
case models.RANK_RANGE_TYPE_EMPLAYEE:
//部门
departments, err := models.GetDepartmentByIds(relationIds)
//员工
users, err := models.GetUserCompanyByIds(relationIds)
if err != nil {
log.Error("获取部门数据失败")
log.Error("获取员工数据失败")
}
for i := range departments {
for i := range users {
m := protocol.RankRangeRelation{
Id: departments[i].Id,
Name: departments[i].Name,
Id: users[i].Id,
Name: users[i].NickName,
}
datalist = append(datalist, m)
}
}
return datalist
}
... ... @@ -473,31 +474,32 @@ func GetRankRangeInfo(id int64) protocol.ResponseRankRangeInfo {
}
switch rankRange.Type {
case models.RANK_RANGE_TYPE_DEPARTMENT:
//员工
users, err := models.GetUserCompanyByIds(relationIds)
//部门
departments, err := models.GetDepartmentByIds(relationIds)
if err != nil {
log.Error("获取员工数据失败")
log.Error("获取部门数据失败")
}
for i := range users {
for i := range departments {
m := protocol.RankRangeRelation{
Id: users[i].Id,
Name: users[i].NickName,
Id: departments[i].Id,
Name: departments[i].Name,
}
rspdata.Relation = append(rspdata.Relation, m)
}
case models.RANK_RANGE_TYPE_EMPLAYEE:
//部门
departments, err := models.GetDepartmentByIds(relationIds)
//员工
users, err := models.GetUserCompanyByIds(relationIds)
if err != nil {
log.Error("获取部门数据失败")
log.Error("获取员工数据失败")
}
for i := range departments {
for i := range users {
m := protocol.RankRangeRelation{
Id: departments[i].Id,
Name: departments[i].Name,
Id: users[i].Id,
Name: users[i].NickName,
}
rspdata.Relation = append(rspdata.Relation, m)
}
}
return rspdata
}
... ...