...
|
...
|
@@ -1607,11 +1607,10 @@ func ChancePool(header *protocol.RequestHeader, request *protocol.ChancePoolRequ |
|
|
//我审核的机会
|
|
|
func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApproveChanceRequest) (rsp *protocol.MyApproveChanceResponse, err error) {
|
|
|
var (
|
|
|
myChances []protocol.ChanceApproveItemOrm
|
|
|
total int
|
|
|
provider *protocol.BaseUserInfo
|
|
|
chance *models.Chance
|
|
|
ormItems []protocol.ChanceApproveItemOrm
|
|
|
chance *models.Chance
|
|
|
)
|
|
|
rsp = &protocol.MyApproveChanceResponse{List: make([]protocol.CommonListItem, 0)}
|
|
|
if request.LastId > 0 {
|
|
|
if chance, err = models.GetChanceById(request.LastId); err != nil {
|
|
|
log.Error("审批不存在", request.LastId, err)
|
...
|
...
|
@@ -1620,7 +1619,7 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove |
|
|
request.LastId = chance.UpdateAt.Unix()
|
|
|
}
|
|
|
if request.ReviewStatus == protocol.ReviewStatusAuditging {
|
|
|
if total, err = models.GetChanceMyApproveChanceEnable(header.UserId, header.CompanyId, []int8{request.ReviewStatus}, request.LastId, request.PageSize, &myChances); err != nil {
|
|
|
if rsp.Total, err = models.GetChanceMyApproveChanceEnable(header.UserId, header.CompanyId, []int8{request.ReviewStatus}, request.LastId, request.PageSize, &ormItems); err != nil {
|
|
|
if err == orm.ErrNoRows {
|
|
|
err = nil
|
|
|
return
|
...
|
...
|
@@ -1629,7 +1628,7 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove |
|
|
return
|
|
|
}
|
|
|
} else {
|
|
|
if total, err = models.GetChanceMyApproveChance(header.UserId, header.CompanyId, []int8{request.ReviewStatus}, request.LastId, request.PageSize, &myChances); err != nil {
|
|
|
if rsp.Total, err = models.GetChanceMyApproveChance(header.UserId, header.CompanyId, []int8{request.ReviewStatus}, request.LastId, request.PageSize, &ormItems); err != nil {
|
|
|
if err == orm.ErrNoRows {
|
|
|
err = nil
|
|
|
return
|
...
|
...
|
@@ -1638,65 +1637,39 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove |
|
|
return
|
|
|
}
|
|
|
}
|
|
|
rsp = &protocol.MyApproveChanceResponse{Total: total}
|
|
|
for i := 0; i < len(myChances); i++ {
|
|
|
chance := myChances[i]
|
|
|
for i := 0; i < len(ormItems); i++ {
|
|
|
ormItem := ormItems[i]
|
|
|
commItem := protocol.CommonListItem{}
|
|
|
commItem.ReviewStatus = chance.ReviewStatus
|
|
|
if len(chance.SourceContent) == 0 || chance.ChanceEnableStatus == 0 { //机会删除
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
}
|
|
|
if chance.Status == models.ChanceStatusClose {
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusClose
|
|
|
}
|
|
|
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)
|
|
|
err = nil
|
|
|
} else {
|
|
|
item := protocol.ChanceItem{
|
|
|
Id: chance.ChanceId,
|
|
|
Provider: provider,
|
|
|
CreateTime: chance.CreateTime.Unix() * 1000,
|
|
|
UpdateTime: chance.UpdateTime.Unix() * 1000,
|
|
|
ApproveTime: chance.ChanceApproveTime.Unix() * 1000,
|
|
|
}
|
|
|
if item.ApproveTime < 0 {
|
|
|
item.ApproveTime = chance.UpdateTime.Unix() * 1000
|
|
|
}
|
|
|
jsonUnmarshal(chance.SourceContent, &item.FormList)
|
|
|
item.FormList = clearEmptyForm(item.FormList)
|
|
|
jsonUnmarshal(chance.Images, &item.Pictures)
|
|
|
jsonUnmarshal(chance.Voices, &item.Speechs)
|
|
|
jsonUnmarshal(chance.Videos, &item.Videos)
|
|
|
commItem.Chance = item
|
|
|
}
|
|
|
}
|
|
|
commItem.Chance, commItem.ChanceStatus = agg.SetChanceItem(header, ormItem.CommChanceItemOrm)
|
|
|
commItem.ReviewStatus = ormItem.ReviewStatus
|
|
|
|
|
|
//审核流数据
|
|
|
approve := protocol.Approve{
|
|
|
ProcessId: chance.Id,
|
|
|
CreateTime: chance.ProcessCreateTime.Unix() * 1000,
|
|
|
ProcessId: ormItem.Id,
|
|
|
CreateTime: ormItem.ProcessCreateTime.Unix() * 1000,
|
|
|
}
|
|
|
//审核过的才有审核时间
|
|
|
//审核过的机会 有审核时间
|
|
|
if request.ReviewStatus != protocol.ReviewStatusAuditging {
|
|
|
approve.ApproveTime = chance.ApproveTime.Unix() * 1000
|
|
|
approve.ApproveTime = ormItem.ApproveTime.Unix() * 1000
|
|
|
if approve.ApproveTime < 0 {
|
|
|
approve.ApproveTime = chance.ChanceApproveTime.Unix() * 1000
|
|
|
approve.ApproveTime = ormItem.ChanceApproveTime.Unix() * 1000
|
|
|
}
|
|
|
}
|
|
|
commItem.Approve = approve
|
|
|
//审核完有审核数据
|
|
|
|
|
|
//审核中 有审核消息
|
|
|
if request.ReviewStatus == protocol.ReviewStatusAuditging {
|
|
|
commItem.Message = chance.ApproveMessage
|
|
|
commItem.Message = ormItem.ApproveMessage
|
|
|
}
|
|
|
//审核通过有审核评分数据
|
|
|
if request.ReviewStatus == protocol.ReviewStatusPass {
|
|
|
var approveData *protocol.ApproveData
|
|
|
jsonUnmarshal(chance.ApproveData, &approveData)
|
|
|
jsonUnmarshal(ormItem.ApproveData, &approveData)
|
|
|
if approveData != nil {
|
|
|
commItem.Score = approveData.Score
|
|
|
}
|
|
|
}
|
|
|
commItem.SelfCheckResult = protocol.NewSelfChecks(chance.SelfChecks).Static()
|
|
|
commItem.SelfCheckResult = protocol.NewSelfChecks(ormItem.SelfChecks).Static() //自查统计数据
|
|
|
rsp.List = append(rsp.List, commItem)
|
|
|
}
|
|
|
return
|
...
|
...
|
|