作者 tangxvhui

bug修复

@@ -3,12 +3,12 @@ package protocol @@ -3,12 +3,12 @@ package protocol
3 //RequestAddAchievement 添加成果 3 //RequestAddAchievement 添加成果
4 type RequestAddAchievement struct { 4 type RequestAddAchievement struct {
5 ChanceData []AchievementChance `json:"chance_data"` 5 ChanceData []AchievementChance `json:"chance_data"`
6 - TypeA int `json:"type_a"` //机会一级分类 chance_type  
7 - TypeB int `json:"type_b"` //机会二级分类 6 + TypeIdA int `json:"type_id_a"` //机会一级分类 chance_type
  7 + TypeIdB int `json:"type_id_b"` //机会二级分类
8 DepartmentId int64 `json:"department_id"` //把握人的部门 8 DepartmentId int64 `json:"department_id"` //把握人的部门
9 UserCompanyId int64 `json:"user_company_id"` //把握人的id 9 UserCompanyId int64 `json:"user_company_id"` //把握人的id
10 - GraspScore int `json:"grasp_score"` //把握分  
11 - UserGraspScore int `json:"user_grasp_score"` //把握人总得分 10 + GraspScore float64 `json:"grasp_score"` //把握分
  11 + UserGraspScore float64 `json:"user_grasp_score"` //把握人总得分
12 Provider []AchievementProvider `json:"provider"` //机会提供者 12 Provider []AchievementProvider `json:"provider"` //机会提供者
13 SourceContent string `json:"source_content"` //成果描述文本 13 SourceContent string `json:"source_content"` //成果描述文本
14 Images []string `json:"image"` //图片 14 Images []string `json:"image"` //图片
@@ -9,8 +9,25 @@ import ( @@ -9,8 +9,25 @@ import (
9 ) 9 )
10 10
11 func AddAchievement(addData *protocol.RequestAddAchievement, companyid int64) error { 11 func AddAchievement(addData *protocol.RequestAddAchievement, companyid int64) error {
  12 + // var (
  13 + // achievementData *models.Achievement
  14 + // chanceList []models.AchievementChance
  15 + // providerList []models.AchievementProvider
  16 + // err error
  17 + // )
  18 + // imgData,
  19 + // //操作achievement 成果表
  20 + // achievementData = &models.Achievement{
  21 + // CompanyId: companyid,
  22 + // DepartmentId: addData.DepartmentId,
  23 + // UserCompanyId: addData.UserCompanyId,
  24 + // ChanceTypeId: addData.TypeIdA,
  25 + // AuditTemplateId: addData.TypeIdB,
  26 + // SourceContent: addData.SourceContent,
  27 + // GraspScore: addData.GraspScore,
  28 + // UserGraspScore: addData.UserGraspScore,
  29 + // }
12 30
13 - //操作achievement 成果表  
14 //操作 achievement_chance 机会来源表 31 //操作 achievement_chance 机会来源表
15 //操作achievement_provider 成果提供人表 32 //操作achievement_provider 成果提供人表
16 33
@@ -282,31 +282,32 @@ func getRangeDataRelationLsit(rankRangeId int64, rangeType int8) []protocol.Rank @@ -282,31 +282,32 @@ func getRangeDataRelationLsit(rankRangeId int64, rangeType int8) []protocol.Rank
282 } 282 }
283 switch rangeType { 283 switch rangeType {
284 case models.RANK_RANGE_TYPE_DEPARTMENT: 284 case models.RANK_RANGE_TYPE_DEPARTMENT:
285 - //员工  
286 - users, err := models.GetUserCompanyByIds(relationIds) 285 + //部门
  286 + departments, err := models.GetDepartmentByIds(relationIds)
287 if err != nil { 287 if err != nil {
288 - log.Error("获取员工数据失败") 288 + log.Error("获取部门数据失败")
289 } 289 }
290 - for i := range users { 290 + for i := range departments {
291 m := protocol.RankRangeRelation{ 291 m := protocol.RankRangeRelation{
292 - Id: users[i].Id,  
293 - Name: users[i].NickName, 292 + Id: departments[i].Id,
  293 + Name: departments[i].Name,
294 } 294 }
295 datalist = append(datalist, m) 295 datalist = append(datalist, m)
296 } 296 }
297 case models.RANK_RANGE_TYPE_EMPLAYEE: 297 case models.RANK_RANGE_TYPE_EMPLAYEE:
298 - //部门  
299 - departments, err := models.GetDepartmentByIds(relationIds) 298 + //员工
  299 + users, err := models.GetUserCompanyByIds(relationIds)
300 if err != nil { 300 if err != nil {
301 - log.Error("获取部门数据失败") 301 + log.Error("获取员工数据失败")
302 } 302 }
303 - for i := range departments { 303 + for i := range users {
304 m := protocol.RankRangeRelation{ 304 m := protocol.RankRangeRelation{
305 - Id: departments[i].Id,  
306 - Name: departments[i].Name, 305 + Id: users[i].Id,
  306 + Name: users[i].NickName,
307 } 307 }
308 datalist = append(datalist, m) 308 datalist = append(datalist, m)
309 } 309 }
  310 +
310 } 311 }
311 return datalist 312 return datalist
312 } 313 }
@@ -473,31 +474,32 @@ func GetRankRangeInfo(id int64) protocol.ResponseRankRangeInfo { @@ -473,31 +474,32 @@ func GetRankRangeInfo(id int64) protocol.ResponseRankRangeInfo {
473 } 474 }
474 switch rankRange.Type { 475 switch rankRange.Type {
475 case models.RANK_RANGE_TYPE_DEPARTMENT: 476 case models.RANK_RANGE_TYPE_DEPARTMENT:
476 - //员工  
477 - users, err := models.GetUserCompanyByIds(relationIds) 477 + //部门
  478 + departments, err := models.GetDepartmentByIds(relationIds)
478 if err != nil { 479 if err != nil {
479 - log.Error("获取员工数据失败") 480 + log.Error("获取部门数据失败")
480 } 481 }
481 - for i := range users { 482 + for i := range departments {
482 m := protocol.RankRangeRelation{ 483 m := protocol.RankRangeRelation{
483 - Id: users[i].Id,  
484 - Name: users[i].NickName, 484 + Id: departments[i].Id,
  485 + Name: departments[i].Name,
485 } 486 }
486 rspdata.Relation = append(rspdata.Relation, m) 487 rspdata.Relation = append(rspdata.Relation, m)
487 } 488 }
488 case models.RANK_RANGE_TYPE_EMPLAYEE: 489 case models.RANK_RANGE_TYPE_EMPLAYEE:
489 - //部门  
490 - departments, err := models.GetDepartmentByIds(relationIds) 490 + //员工
  491 + users, err := models.GetUserCompanyByIds(relationIds)
491 if err != nil { 492 if err != nil {
492 - log.Error("获取部门数据失败") 493 + log.Error("获取员工数据失败")
493 } 494 }
494 - for i := range departments { 495 + for i := range users {
495 m := protocol.RankRangeRelation{ 496 m := protocol.RankRangeRelation{
496 - Id: departments[i].Id,  
497 - Name: departments[i].Name, 497 + Id: users[i].Id,
  498 + Name: users[i].NickName,
498 } 499 }
499 rspdata.Relation = append(rspdata.Relation, m) 500 rspdata.Relation = append(rspdata.Relation, m)
500 } 501 }
  502 +
501 } 503 }
502 return rspdata 504 return rspdata
503 } 505 }