作者 yangfu

修改审批

@@ -132,7 +132,7 @@ type ChanceUpdateRequest struct { @@ -132,7 +132,7 @@ type ChanceUpdateRequest struct {
132 Speechs []Speech `json:"speechs"` 132 Speechs []Speech `json:"speechs"`
133 Pictures []Picture `json:"pictures"` 133 Pictures []Picture `json:"pictures"`
134 Videos []Video `json:"videos"` 134 Videos []Video `json:"videos"`
135 - RelatedDepartment int64 `json:"relatedDepartments" valid:"Required"` 135 + RelatedDepartment int64 `json:"relatedDepartments"`
136 136
137 IsPublish bool `json:"isPublish"` //是否重新发布 137 IsPublish bool `json:"isPublish"` //是否重新发布
138 } 138 }
@@ -65,10 +65,10 @@ type Comments struct { @@ -65,10 +65,10 @@ type Comments struct {
65 Content string `json:"content"` 65 Content string `json:"content"`
66 Provider *BaseUserInfo `json:"provider"` 66 Provider *BaseUserInfo `json:"provider"`
67 67
68 - ViewTotal int `json:"pageViewTotal"`  
69 - CommentTotal int `json:"commentTotal"`  
70 - ZanTotal int `json:"thumbsupTotal"`  
71 - IsZan int `json:"isThumbsUp"` //0:未点赞 1:点赞 68 + ViewTotal int `json:"pageViewTotal"`
  69 + CommentTotal int `json:"commentTotal"`
  70 + ZanTotal int `json:"thumbsupTotal"`
  71 + IsZan bool `json:"isThumbsUp"` //0:未点赞 1:点赞
72 } 72 }
73 73
74 type Thumbups struct { 74 type Thumbups struct {
@@ -43,6 +43,7 @@ var errmessge ErrorMap = map[int]string{ @@ -43,6 +43,7 @@ var errmessge ErrorMap = map[int]string{
43 5204: "评分或者公开状态不能为空", 43 5204: "评分或者公开状态不能为空",
44 5205: "机会未审核通过,不能修改评分或者公开状态", 44 5205: "机会未审核通过,不能修改评分或者公开状态",
45 5206: "未找到审批节点或者无权限", 45 5206: "未找到审批节点或者无权限",
  46 + //5207:"部门不存在",
46 47
47 //模板相关 48 //模板相关
48 5301: "机会模板不存在", 49 5301: "机会模板不存在",
@@ -513,7 +513,7 @@ func ChanceApproveProcess(header *protocol.RequestHeader, chance *models.Chance) @@ -513,7 +513,7 @@ func ChanceApproveProcess(header *protocol.RequestHeader, chance *models.Chance)
513 if item.ReviewStatus != protocol.ReviewStatusAuditging { 513 if item.ReviewStatus != protocol.ReviewStatusAuditging {
514 item.ApproveTime = process.ApproveTime.Unix() * 1000 514 item.ApproveTime = process.ApproveTime.Unix() * 1000
515 } 515 }
516 - switch item.ApproveWay { 516 + switch item.ApproveType {
517 case protocol.AuditByDepartmentor: 517 case protocol.AuditByDepartmentor:
518 break 518 break
519 case protocol.AuditByUser: 519 case protocol.AuditByUser:
@@ -448,7 +448,9 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate @@ -448,7 +448,9 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate
448 //} 448 //}
449 if _, e := models.GetAuditFlowProcessByReview(request.Id, 0, protocol.ReviewStatusWait); e == nil { 449 if _, e := models.GetAuditFlowProcessByReview(request.Id, 0, protocol.ReviewStatusWait); e == nil {
450 request.IsPublish = true 450 request.IsPublish = true
  451 + updateMap["DepartmentId"] = request.RelatedDepartment
451 } 452 }
  453 +
452 } else { 454 } else {
453 request.IsPublish = false 455 request.IsPublish = false
454 } 456 }
@@ -474,7 +476,6 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate @@ -474,7 +476,6 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate
474 updateMap["AuditTemplateConfig"] = common.AssertJson(auditConfig) 476 updateMap["AuditTemplateConfig"] = common.AssertJson(auditConfig)
475 updateMap["Content"] = request.Content 477 updateMap["Content"] = request.Content
476 updateMap["SourceContent"] = common.AssertJson(request.FormList) 478 updateMap["SourceContent"] = common.AssertJson(request.FormList)
477 - updateMap["DepartmentId"] = request.RelatedDepartment  
478 479
479 if err = utils.UpdateTableByMapWithOrmer(orm, &models.Chance{Id: chance.Id}, updateMap); err != nil { 480 if err = utils.UpdateTableByMapWithOrmer(orm, &models.Chance{Id: chance.Id}, updateMap); err != nil {
480 log.Error(err) 481 log.Error(err)
@@ -951,12 +952,27 @@ func getDepartmentors(header *protocol.RequestHeader, relatedDeparmentId int64) @@ -951,12 +952,27 @@ func getDepartmentors(header *protocol.RequestHeader, relatedDeparmentId int64)
951 log.Error(relatedDeparmentId, err) 952 log.Error(relatedDeparmentId, err)
952 return 953 return
953 } 954 }
954 - if len(departments.Managers) > 0 {  
955 - var tmpIds []int64  
956 - if err = json.Unmarshal([]byte(departments.Managers), &tmpIds); err == nil {  
957 - if len(tmpIds) > 0 {  
958 - ids = append(ids, tmpIds...) 955 + for {
  956 + if len(departments.Managers) > 0 {
  957 + var tmpIds []int64
  958 + if e := json.Unmarshal([]byte(departments.Managers), &tmpIds); e == nil {
  959 + if len(tmpIds) > 0 {
  960 + ids = append(ids, tmpIds...)
  961 + }
  962 + break
  963 + } else {
  964 + log.Error(e)
  965 + }
  966 + //break
  967 + }
  968 + if departments.ParentId != 0 {
  969 + if departments, err = models.GetDepartmentById(int(relatedDeparmentId)); err != nil {
  970 + log.Error(relatedDeparmentId, err)
  971 + err = nil
  972 + break
959 } 973 }
  974 + } else {
  975 + break
960 } 976 }
961 } 977 }
962 //部门长不存在 978 //部门长不存在
@@ -139,7 +139,8 @@ func Comments(header *protocol.RequestHeader, request *protocol.CommentsRequest) @@ -139,7 +139,8 @@ func Comments(header *protocol.RequestHeader, request *protocol.CommentsRequest)
139 return 139 return
140 } 140 }
141 rsp = &protocol.CommentsResponse{ 141 rsp = &protocol.CommentsResponse{
142 - Total: total, 142 + Total: total,
  143 + Comments: make([]*protocol.Comments, 0),
143 } 144 }
144 for i := range comments { 145 for i := range comments {
145 comment := comments[i] 146 comment := comments[i]
@@ -155,9 +156,10 @@ func Comments(header *protocol.RequestHeader, request *protocol.CommentsRequest) @@ -155,9 +156,10 @@ func Comments(header *protocol.RequestHeader, request *protocol.CommentsRequest)
155 ViewTotal: comment.ViewTotal, 156 ViewTotal: comment.ViewTotal,
156 ZanTotal: comment.ZanTotal, 157 ZanTotal: comment.ZanTotal,
157 CommentTotal: comment.CommentTotal, 158 CommentTotal: comment.CommentTotal,
  159 + IsZan: false,
158 } 160 }
159 if exists, _ = models.ExitsChanceFavorite(header.UserId, header.CompanyId, comment.Id, protocol.MarkFlagZan); exists { 161 if exists, _ = models.ExitsChanceFavorite(header.UserId, header.CompanyId, comment.Id, protocol.MarkFlagZan); exists {
160 - item.IsZan = 1 162 + item.IsZan = true
161 } 163 }
162 rsp.Comments = append(rsp.Comments, item) 164 rsp.Comments = append(rsp.Comments, item)
163 } 165 }
@@ -221,9 +223,10 @@ func CommentDetailsSingle(header *protocol.RequestHeader, request *protocol.Comm @@ -221,9 +223,10 @@ func CommentDetailsSingle(header *protocol.RequestHeader, request *protocol.Comm
221 ViewTotal: comment.ViewTotal, 223 ViewTotal: comment.ViewTotal,
222 ZanTotal: comment.ZanTotal, 224 ZanTotal: comment.ZanTotal,
223 CommentTotal: comment.CommentTotal, 225 CommentTotal: comment.CommentTotal,
  226 + IsZan: false,
224 } 227 }
225 if exists, _ = models.ExitsChanceFavorite(header.UserId, header.CompanyId, comment.Id, protocol.MarkFlagZan); exists { 228 if exists, _ = models.ExitsChanceFavorite(header.UserId, header.CompanyId, comment.Id, protocol.MarkFlagZan); exists {
226 - rsp.Comment.IsZan = 1 229 + rsp.Comment.IsZan = true
227 } 230 }
228 return 231 return
229 } 232 }