作者 yangfu

修改 1.审核(理由空的情况) 2.部门统计机会总数

... ... @@ -6,6 +6,7 @@ import (
"opp/controllers"
"opp/protocol"
"opp/services/chance"
"strings"
)
type ChanceController struct {
... ... @@ -473,6 +474,7 @@ func (this *ChanceController) ChanceApprove() {
log.Error(msg)
return
}
request.Reason = strings.TrimSpace(request.Reason)
header := controllers.GetRequestHeader(this.Ctx)
request.ApproveData.Reason = request.Reason
msg = protocol.NewReturnResponse(chance.ChanceApprove(header, request))
... ...
... ... @@ -2364,7 +2364,7 @@ func DraftSaveChance(header *protocol.RequestHeader, request *protocol.DraftSave
//1.模板是否存在
if template, err = models.GetAuditTemplateById(request.AuditTemplateId); err != nil {
log.Error("模板不存在:", request.AuditTemplateId, err)
err = protocol.NewErrWithMessage(5302)
err = protocol.NewErrWithMessage(5301)
return
}
if template.EnableStatus == protocol.InValid {
... ...
... ... @@ -82,7 +82,9 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DepartmentStat
log.Error(err)
return
}
//公司部门统计
//列表 = 公司一级部门 + 子部门
//公司一级部门
companyDep := departmentsResponse.GetCompanyDepartment()
if companyDep.DepartmentId > 0 {
var companyDepStatistic *protocol.DepartmentStatisticResponse
... ... @@ -91,9 +93,10 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DepartmentStat
return
}
rsp.List = append(rsp.List, &companyDepStatistic.DepartmentStatistic)
rsp.Total += companyDepStatistic.DepartmentStatistic.ChanceApprovedTotal + companyDepStatistic.DepartmentStatistic.AchievementTotal
rsp.Total += companyDepStatistic.DepartmentStatistic.ChanceApprovedTotal + companyDepStatistic.DepartmentStatistic.AchievementTotal + companyDepStatistic.DepartmentStatistic.ChanceReservedTotal
}
//子部门
departments := departmentsResponse.GetRootDepartments()
iterateDepartments := func(call func(d *protocol.Department) *protocol.DepartmentStatistics) {
for i := range departments {
... ... @@ -105,7 +108,7 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DepartmentStat
Time: department.CreateTime.Unix(),
}
rsp.List = append(rsp.List, item)
rsp.Total += item.ChanceApprovedTotal + item.AchievementTotal
rsp.Total += item.ChanceApprovedTotal + item.AchievementTotal + item.ChanceReservedTotal
}
}
switch request.Type {
... ...