作者 yangfu

修改审批

... ... @@ -132,7 +132,7 @@ type ChanceUpdateRequest struct {
Speechs []Speech `json:"speechs"`
Pictures []Picture `json:"pictures"`
Videos []Video `json:"videos"`
RelatedDepartment int64 `json:"relatedDepartments" valid:"Required"`
RelatedDepartment int64 `json:"relatedDepartments"`
IsPublish bool `json:"isPublish"` //是否重新发布
}
... ...
... ... @@ -65,10 +65,10 @@ type Comments struct {
Content string `json:"content"`
Provider *BaseUserInfo `json:"provider"`
ViewTotal int `json:"pageViewTotal"`
CommentTotal int `json:"commentTotal"`
ZanTotal int `json:"thumbsupTotal"`
IsZan int `json:"isThumbsUp"` //0:未点赞 1:点赞
ViewTotal int `json:"pageViewTotal"`
CommentTotal int `json:"commentTotal"`
ZanTotal int `json:"thumbsupTotal"`
IsZan bool `json:"isThumbsUp"` //0:未点赞 1:点赞
}
type Thumbups struct {
... ...
... ... @@ -43,6 +43,7 @@ var errmessge ErrorMap = map[int]string{
5204: "评分或者公开状态不能为空",
5205: "机会未审核通过,不能修改评分或者公开状态",
5206: "未找到审批节点或者无权限",
//5207:"部门不存在",
//模板相关
5301: "机会模板不存在",
... ...
... ... @@ -513,7 +513,7 @@ func ChanceApproveProcess(header *protocol.RequestHeader, chance *models.Chance)
if item.ReviewStatus != protocol.ReviewStatusAuditging {
item.ApproveTime = process.ApproveTime.Unix() * 1000
}
switch item.ApproveWay {
switch item.ApproveType {
case protocol.AuditByDepartmentor:
break
case protocol.AuditByUser:
... ...
... ... @@ -448,7 +448,9 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate
//}
if _, e := models.GetAuditFlowProcessByReview(request.Id, 0, protocol.ReviewStatusWait); e == nil {
request.IsPublish = true
updateMap["DepartmentId"] = request.RelatedDepartment
}
} else {
request.IsPublish = false
}
... ... @@ -474,7 +476,6 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate
updateMap["AuditTemplateConfig"] = common.AssertJson(auditConfig)
updateMap["Content"] = request.Content
updateMap["SourceContent"] = common.AssertJson(request.FormList)
updateMap["DepartmentId"] = request.RelatedDepartment
if err = utils.UpdateTableByMapWithOrmer(orm, &models.Chance{Id: chance.Id}, updateMap); err != nil {
log.Error(err)
... ... @@ -951,12 +952,27 @@ func getDepartmentors(header *protocol.RequestHeader, relatedDeparmentId int64)
log.Error(relatedDeparmentId, err)
return
}
if len(departments.Managers) > 0 {
var tmpIds []int64
if err = json.Unmarshal([]byte(departments.Managers), &tmpIds); err == nil {
if len(tmpIds) > 0 {
ids = append(ids, tmpIds...)
for {
if len(departments.Managers) > 0 {
var tmpIds []int64
if e := json.Unmarshal([]byte(departments.Managers), &tmpIds); e == nil {
if len(tmpIds) > 0 {
ids = append(ids, tmpIds...)
}
break
} else {
log.Error(e)
}
//break
}
if departments.ParentId != 0 {
if departments, err = models.GetDepartmentById(int(relatedDeparmentId)); err != nil {
log.Error(relatedDeparmentId, err)
err = nil
break
}
} else {
break
}
}
//部门长不存在
... ...
... ... @@ -139,7 +139,8 @@ func Comments(header *protocol.RequestHeader, request *protocol.CommentsRequest)
return
}
rsp = &protocol.CommentsResponse{
Total: total,
Total: total,
Comments: make([]*protocol.Comments, 0),
}
for i := range comments {
comment := comments[i]
... ... @@ -155,9 +156,10 @@ func Comments(header *protocol.RequestHeader, request *protocol.CommentsRequest)
ViewTotal: comment.ViewTotal,
ZanTotal: comment.ZanTotal,
CommentTotal: comment.CommentTotal,
IsZan: false,
}
if exists, _ = models.ExitsChanceFavorite(header.UserId, header.CompanyId, comment.Id, protocol.MarkFlagZan); exists {
item.IsZan = 1
item.IsZan = true
}
rsp.Comments = append(rsp.Comments, item)
}
... ... @@ -221,9 +223,10 @@ func CommentDetailsSingle(header *protocol.RequestHeader, request *protocol.Comm
ViewTotal: comment.ViewTotal,
ZanTotal: comment.ZanTotal,
CommentTotal: comment.CommentTotal,
IsZan: false,
}
if exists, _ = models.ExitsChanceFavorite(header.UserId, header.CompanyId, comment.Id, protocol.MarkFlagZan); exists {
rsp.Comment.IsZan = 1
rsp.Comment.IsZan = true
}
return
}
... ...