...
|
...
|
@@ -236,12 +236,17 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit |
|
|
auditConfig *protocol.AuditConfig
|
|
|
auditFlows []*models.AuditFlowProcess
|
|
|
suplusApprove SuplusApprove
|
|
|
chanceType *models.ChanceType
|
|
|
)
|
|
|
//1.模板是否存在
|
|
|
if template, err = models.GetAuditTemplateById(request.AuditTemplateId); err != nil {
|
|
|
log.Error("模板不存在:", request.AuditTemplateId, err)
|
|
|
return
|
|
|
}
|
|
|
if chanceType, err = models.GetChanceTypeById(template.ChanceTypeId); err != nil {
|
|
|
log.Error("一级分类不存在:", request.AuditTemplateId, err)
|
|
|
return
|
|
|
}
|
|
|
auditConfig = &protocol.AuditConfig{NoApprover: template.NoApprover}
|
|
|
orm := orm.NewOrm()
|
|
|
orm.Begin()
|
...
|
...
|
@@ -284,6 +289,8 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit |
|
|
return
|
|
|
}
|
|
|
for i := 0; i < len(auditFlows); i++ {
|
|
|
auditFlows[i].ApproveMessage = fmt.Sprintf(protocol.MessageApproving, chanceType.Name)
|
|
|
//auditFlows[i].TemplateId = int(template.Id)
|
|
|
if _, err = orm.Insert(auditFlows[i]); err != nil {
|
|
|
log.Error(err)
|
|
|
orm.Rollback()
|
...
|
...
|
@@ -660,6 +667,7 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, templat |
|
|
RoleName: roleName,
|
|
|
UserName: approver.NickName,
|
|
|
ReviewStatus: protocol.ReviewStatusAuditging,
|
|
|
TemplateId: int(templateId),
|
|
|
}
|
|
|
if config.Level == 1 {
|
|
|
item.IsActive = 1
|
...
|
...
|
@@ -799,7 +807,7 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove |
|
|
provider *protocol.BaseUserInfo
|
|
|
)
|
|
|
rsp = &protocol.MyApproveChanceResponse{}
|
|
|
if total, err = models.GetChanceMyChance(header.UserId, header.CompanyId, []int8{request.ReviewStatus}, request.LastId, request.PageSize, &myChances); err != nil {
|
|
|
if total, err = models.GetChanceMyApproveChance(header.UserId, header.CompanyId, []int8{request.ReviewStatus}, request.LastId, request.PageSize, &myChances); err != nil {
|
|
|
if err == orm.ErrNoRows {
|
|
|
err = nil
|
|
|
return
|
...
|
...
|
@@ -807,30 +815,47 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove |
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
if provider, err = agg.GetUserBaseInfo(header.UserId, header.CompanyId); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
rsp = &protocol.MyApproveChanceResponse{Total: total}
|
|
|
for i := 0; i < len(myChances); i++ {
|
|
|
chance := myChances[i]
|
|
|
commItem := protocol.CommonListItem{}
|
|
|
item := protocol.ChanceItem{
|
|
|
Id: chance.Id,
|
|
|
Provider: provider,
|
|
|
//CreateTime: chance.CreateTime.Unix() * 1000,
|
|
|
if len(chance.SourceContent) == 0 { //机会删除
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
} else if chance.ChanceEnableStatus == 0 { //机会关闭
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusClose
|
|
|
} else {
|
|
|
if provider, err = agg.GetUserBaseInfo(header.UserId, header.CompanyId); err != nil {
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
log.Error(err)
|
|
|
//return
|
|
|
} else {
|
|
|
item := protocol.ChanceItem{
|
|
|
Id: chance.Id,
|
|
|
Provider: provider,
|
|
|
//CreateTime: chance.CreateTime.Unix() * 1000,
|
|
|
}
|
|
|
jsonUnmarshal(chance.SourceContent, &item.FormList)
|
|
|
jsonUnmarshal(chance.Images, &item.Pictures)
|
|
|
jsonUnmarshal(chance.Voices, &item.Speechs)
|
|
|
jsonUnmarshal(chance.Videos, &item.Videos)
|
|
|
commItem.Chance = item
|
|
|
}
|
|
|
}
|
|
|
jsonUnmarshal(chance.SourceContent, &item.FormList)
|
|
|
jsonUnmarshal(chance.Images, &item.Pictures)
|
|
|
jsonUnmarshal(chance.Voices, &item.Speechs)
|
|
|
jsonUnmarshal(chance.Videos, &item.Videos)
|
|
|
|
|
|
{
|
|
|
commItem.Chance = item
|
|
|
commItem.Approve = protocol.Approve{
|
|
|
ProcessId: chance.Id,
|
|
|
//Provider:provider,
|
|
|
CreateTime: chance.ProcessCreateTime.Unix() * 1000,
|
|
|
ApproveTime: chance.ApproveTime.Unix() * 1000,
|
|
|
}
|
|
|
//审核完有审核数据
|
|
|
if request.ReviewStatus == protocol.ReviewStatusAuditging {
|
|
|
commItem.Message = chance.ApproveMessage
|
|
|
}
|
|
|
if request.ReviewStatus == protocol.ReviewStatusPass {
|
|
|
jsonUnmarshal(chance.ApproveData, &commItem.ApproveData)
|
|
|
}
|
|
|
rsp.List = append(rsp.List, commItem)
|
|
|
}
|
|
|
|
|
|
return
|
|
|
}
|
|
|
|
...
|
...
|
|