...
|
...
|
@@ -423,6 +423,12 @@ func GenAuditFlowProcess_Submit(header *protocol.RequestHeader, chanceId int64, |
|
|
EnableStatus: 1,
|
|
|
ReviewStatus: protocol.ReviewStatusSubmit,
|
|
|
}
|
|
|
if approver, err := models.GetUsersById(header.Uid); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
} else {
|
|
|
v.UserName = approver.NickName
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
...
|
...
|
@@ -434,6 +440,8 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, templat |
|
|
ids []int64
|
|
|
groupId int64
|
|
|
company *models.Company
|
|
|
roleName string
|
|
|
approver *models.User
|
|
|
)
|
|
|
if configs, err = models.GetAuditFlowConfigsLevel(templateId, 1); err != nil {
|
|
|
if err == orm.ErrNoRows {
|
...
|
...
|
@@ -511,7 +519,8 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, templat |
|
|
return
|
|
|
}
|
|
|
case protocol.AuditByRole:
|
|
|
|
|
|
//roleName="" //TODO:角色
|
|
|
return
|
|
|
}
|
|
|
if len(userIds) == 0 { //当前步骤没有用户 默认一个空审核人
|
|
|
userIds = append(userIds, 0)
|
...
|
...
|
@@ -525,6 +534,10 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, templat |
|
|
log.Info(fmt.Sprintf("生成机会审批流-转给管理员:chance_id:%v audit_level:%v audit_user:%v -> admin:%v", chanceId, config.Level, uid, company.AdminId))
|
|
|
uid = company.AdminId
|
|
|
}
|
|
|
if approver, err = models.GetUserByUcid(uid); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
item := &models.AuditFlowProcess{
|
|
|
Id: idgen.Next(),
|
|
|
ChanceId: chanceId,
|
...
|
...
|
@@ -535,8 +548,9 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, templat |
|
|
AuditFlowType: config.AuditFlowType,
|
|
|
FlowType: config.FlowType,
|
|
|
ActionType: int(config.ActionType),
|
|
|
|
|
|
ReviewStatus: protocol.ReviewStatusAuditging,
|
|
|
RoleName: roleName,
|
|
|
UserName: approver.NickName,
|
|
|
ReviewStatus: protocol.ReviewStatusAuditging,
|
|
|
}
|
|
|
if config.Level == 1 {
|
|
|
item.IsActive = 1
|
...
|
...
|
@@ -680,15 +694,11 @@ func jsonUnmarshal(jsonData string, v interface{}) { |
|
|
//机会详情
|
|
|
func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetailRequest) (rsp *protocol.ChanceDetailResponse, err error) {
|
|
|
var (
|
|
|
chance *models.Chance
|
|
|
chanceData *models.ChanceData
|
|
|
provider *protocol.BaseUserInfo
|
|
|
chance *models.Chance
|
|
|
chanceData *models.ChanceData
|
|
|
provider *protocol.BaseUserInfo
|
|
|
approveProcess *protocol.ChanceApproveProcessResponse
|
|
|
)
|
|
|
//检查是否可见
|
|
|
if provider, err = agg.GetUserBaseInfo(chance.UserId, header.CompanyId); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
if chance, err = models.GetChanceById(request.Id); err != nil {
|
|
|
if err == orm.ErrNoRows {
|
|
|
err = protocol.NewErrWithMessage(5101)
|
...
|
...
|
@@ -697,6 +707,13 @@ func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetail |
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
//用户信息
|
|
|
if provider, err = agg.GetUserBaseInfo(chance.UserId, header.CompanyId); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
rsp = &protocol.ChanceDetailResponse{}
|
|
|
item := protocol.ChanceItem{
|
|
|
Id: chance.Id,
|
|
|
Provider: provider,
|
...
|
...
|
@@ -708,7 +725,15 @@ func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetail |
|
|
jsonUnmarshal(chanceData.Speechs, &item.Speechs)
|
|
|
jsonUnmarshal(chanceData.Videos, &item.Videos)
|
|
|
}
|
|
|
rsp = &protocol.ChanceDetailResponse{}
|
|
|
jsonUnmarshal(chance.PublishData, &rsp.PublicData)
|
|
|
rsp.ChanceDetail = item
|
|
|
if approveProcess, err = ChanceApproveProcess(header, chance); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
} else {
|
|
|
rsp.ApproveProcess = approveProcess.ApproveProcess
|
|
|
rsp.ApproveAccess = approveProcess.ApproveAccess
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
...
|
...
|
|