...
|
...
|
@@ -373,6 +373,7 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit |
|
|
ReviewStatus: protocol.ReviewStatusAuditging,
|
|
|
DepartmentId: request.RelatedDepartment,
|
|
|
Code: fmt.Sprintf("%v%v", chanceType.Code, template.Code),
|
|
|
Status: models.ChanceStatusOpen,
|
|
|
}
|
|
|
//生成提交记录
|
|
|
if _, err = orm.Insert(GenAuditFlowProcess_Submit(header.UserId, chance.Id, template.Id, protocol.ReviewStatusSubmit)); err != nil {
|
...
|
...
|
@@ -536,7 +537,7 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate |
|
|
log.Info(fmt.Sprintf("机会编辑 is_publish:%v chance.review_status:%v 是否是本人:%v", request.IsPublish, chance.ReviewStatus, chance.UserId == header.UserId))
|
|
|
}
|
|
|
//1.需要验证角色权限 2是否是审核人 3.是否是本人
|
|
|
if chance.ReviewStatus != protocol.ReviewStatusPass { //chance.UserId != header.UserId
|
|
|
if chance.ReviewStatus != protocol.ReviewStatusPass && chance.UserId != header.UserId { //chance.UserId != header.UserId
|
|
|
err = protocol.NewErrWithMessage(5206)
|
|
|
log.Error(fmt.Sprintf("user:%v 无权限操作机会 chance:%v", header.UserId, chance.Id))
|
|
|
return
|
...
|
...
|
@@ -1305,6 +1306,9 @@ func MySubmitChance(header *protocol.RequestHeader, request *protocol.MySubmitCh |
|
|
jsonUnmarshal(chance.Videos, &item.Videos)
|
|
|
commItem.Chance = item
|
|
|
}
|
|
|
if chance.Status == models.ChanceStatusClose {
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusClose
|
|
|
}
|
|
|
commItem.ReviewStatus = chance.ReviewStatus
|
|
|
if request.ReviewStatus == protocol.ReviewStatusPass {
|
|
|
var approveData protocol.ApproveData
|
...
|
...
|
@@ -1410,11 +1414,13 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove |
|
|
chance := myChances[i]
|
|
|
commItem := protocol.CommonListItem{}
|
|
|
commItem.ReviewStatus = chance.ReviewStatus
|
|
|
if len(chance.SourceContent) == 0 { //机会删除
|
|
|
if len(chance.SourceContent) == 0 || chance.ChanceEnableStatus == 0 { //机会删除
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
} else if chance.ChanceEnableStatus == 0 { //机会关闭
|
|
|
}
|
|
|
if chance.Status == models.ChanceStatusClose {
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusClose
|
|
|
} else {
|
|
|
}
|
|
|
if chance.ChanceUserId > 0 {
|
|
|
if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil {
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
log.Error(chance.ChanceUserId, header.CompanyId, err)
|
...
|
...
|
@@ -1491,11 +1497,14 @@ func MyCollectChance(header *protocol.RequestHeader, request *protocol.MyCollect |
|
|
commItem := &protocol.CommonListItem{}
|
|
|
commItem.ReviewStatus = chance.ReviewStatus
|
|
|
commItem.ChanceId = chance.ChanceId
|
|
|
if len(chance.SourceContent) == 0 { //机会删除
|
|
|
if len(chance.SourceContent) == 0 || chance.ChanceEnableStatus == 0 { //机会删除
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
} else if chance.ChanceEnableStatus == 0 { //机会关闭
|
|
|
}
|
|
|
if chance.Status == models.ChanceStatusClose { //机会关闭
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusClose
|
|
|
} else {
|
|
|
}
|
|
|
|
|
|
if chance.ChanceUserId > 0 {
|
|
|
if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil {
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
log.Error(err)
|
...
|
...
|
@@ -1515,6 +1524,7 @@ func MyCollectChance(header *protocol.RequestHeader, request *protocol.MyCollect |
|
|
commItem.Chance = item
|
|
|
}
|
|
|
}
|
|
|
|
|
|
commItem.ReviewStatus = chance.ReviewStatus
|
|
|
{
|
|
|
var chanceData = protocol.ChanceData{
|
...
|
...
|
@@ -1565,11 +1575,13 @@ func MyThumbUpChance(header *protocol.RequestHeader, request *protocol.MyThumbUp |
|
|
commItem := &protocol.CommonListItem{}
|
|
|
commItem.ReviewStatus = chance.ReviewStatus
|
|
|
commItem.ChanceId = chance.ChanceId
|
|
|
if len(chance.SourceContent) == 0 { //机会删除
|
|
|
if len(chance.SourceContent) == 0 || chance.ChanceEnableStatus == 0 { //机会删除
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
} else if chance.ChanceEnableStatus == 0 { //机会关闭
|
|
|
}
|
|
|
if chance.Status == models.ChanceStatusClose { //机会关闭
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusClose
|
|
|
} else {
|
|
|
}
|
|
|
if chance.ChanceUserId > 0 {
|
|
|
if provider, err = agg.GetUserBaseInfo(chance.ChanceUserId, header.CompanyId); err != nil {
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
log.Error(err)
|
...
|
...
|
@@ -1921,6 +1933,13 @@ func Permission(header *protocol.RequestHeader, request *protocol.PermissionRequ |
|
|
}
|
|
|
//判断机会权限
|
|
|
if request.ChanceId > 0 {
|
|
|
if chance.Status == models.ChanceStatusClose || chance.EnableStatus == 0 { //机会关闭 / 删除
|
|
|
rsp.EditChance = 0
|
|
|
rsp.EditPublicStatus = 0
|
|
|
rsp.EditScore = 0
|
|
|
log.Debug(fmt.Sprintf("用户:%v chance_id:%v 机会关闭/删除 无权限", header.UserId, chance.Id))
|
|
|
return
|
|
|
}
|
|
|
if chance, err = models.GetChanceById(request.ChanceId); err != nil {
|
|
|
err = protocol.NewErrWithMessage(5101)
|
|
|
return
|
...
|
...
|
@@ -1928,13 +1947,16 @@ func Permission(header *protocol.RequestHeader, request *protocol.PermissionRequ |
|
|
//本人
|
|
|
if chance.UserId == header.UserId {
|
|
|
//审核通过 或者 已经被人审核过 就不能编辑了
|
|
|
if len(chance.ApproveData) > 0 || chance.ReviewStatus == protocol.ReviewStatusPass {
|
|
|
if len(chance.ApproveData) > 0 && chance.ReviewStatus == protocol.ReviewStatusAuditging { //审批中 且有人审批 本人不可编辑
|
|
|
rsp.EditChance = 0
|
|
|
} else if chance.ReviewStatus == protocol.ReviewStatusAuditging { //未有人审核过
|
|
|
rsp.EditChance = 1
|
|
|
rsp.EditPublicStatus = 0
|
|
|
rsp.EditScore = 0
|
|
|
}
|
|
|
if chance.ReviewStatus == protocol.ReviewStatusPass {
|
|
|
rsp.EditScore = 1
|
|
|
}
|
|
|
return
|
|
|
} else {
|
|
|
if chance.ReviewStatus == protocol.ReviewStatusReturn { //退回的机会不可编辑
|
...
|
...
|
|