作者 yangfu

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

@@ -6,6 +6,7 @@ import ( @@ -6,6 +6,7 @@ import (
6 "opp/controllers" 6 "opp/controllers"
7 "opp/protocol" 7 "opp/protocol"
8 "opp/services/chance" 8 "opp/services/chance"
  9 + "strings"
9 ) 10 )
10 11
11 type ChanceController struct { 12 type ChanceController struct {
@@ -473,6 +474,7 @@ func (this *ChanceController) ChanceApprove() { @@ -473,6 +474,7 @@ func (this *ChanceController) ChanceApprove() {
473 log.Error(msg) 474 log.Error(msg)
474 return 475 return
475 } 476 }
  477 + request.Reason = strings.TrimSpace(request.Reason)
476 header := controllers.GetRequestHeader(this.Ctx) 478 header := controllers.GetRequestHeader(this.Ctx)
477 request.ApproveData.Reason = request.Reason 479 request.ApproveData.Reason = request.Reason
478 msg = protocol.NewReturnResponse(chance.ChanceApprove(header, request)) 480 msg = protocol.NewReturnResponse(chance.ChanceApprove(header, request))
@@ -2364,7 +2364,7 @@ func DraftSaveChance(header *protocol.RequestHeader, request *protocol.DraftSave @@ -2364,7 +2364,7 @@ func DraftSaveChance(header *protocol.RequestHeader, request *protocol.DraftSave
2364 //1.模板是否存在 2364 //1.模板是否存在
2365 if template, err = models.GetAuditTemplateById(request.AuditTemplateId); err != nil { 2365 if template, err = models.GetAuditTemplateById(request.AuditTemplateId); err != nil {
2366 log.Error("模板不存在:", request.AuditTemplateId, err) 2366 log.Error("模板不存在:", request.AuditTemplateId, err)
2367 - err = protocol.NewErrWithMessage(5302) 2367 + err = protocol.NewErrWithMessage(5301)
2368 return 2368 return
2369 } 2369 }
2370 if template.EnableStatus == protocol.InValid { 2370 if template.EnableStatus == protocol.InValid {
@@ -82,7 +82,9 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DepartmentStat @@ -82,7 +82,9 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DepartmentStat
82 log.Error(err) 82 log.Error(err)
83 return 83 return
84 } 84 }
85 - //公司部门统计 85 + //列表 = 公司一级部门 + 子部门
  86 +
  87 + //公司一级部门
86 companyDep := departmentsResponse.GetCompanyDepartment() 88 companyDep := departmentsResponse.GetCompanyDepartment()
87 if companyDep.DepartmentId > 0 { 89 if companyDep.DepartmentId > 0 {
88 var companyDepStatistic *protocol.DepartmentStatisticResponse 90 var companyDepStatistic *protocol.DepartmentStatisticResponse
@@ -91,9 +93,10 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DepartmentStat @@ -91,9 +93,10 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DepartmentStat
91 return 93 return
92 } 94 }
93 rsp.List = append(rsp.List, &companyDepStatistic.DepartmentStatistic) 95 rsp.List = append(rsp.List, &companyDepStatistic.DepartmentStatistic)
94 - rsp.Total += companyDepStatistic.DepartmentStatistic.ChanceApprovedTotal + companyDepStatistic.DepartmentStatistic.AchievementTotal 96 + rsp.Total += companyDepStatistic.DepartmentStatistic.ChanceApprovedTotal + companyDepStatistic.DepartmentStatistic.AchievementTotal + companyDepStatistic.DepartmentStatistic.ChanceReservedTotal
95 } 97 }
96 98
  99 + //子部门
97 departments := departmentsResponse.GetRootDepartments() 100 departments := departmentsResponse.GetRootDepartments()
98 iterateDepartments := func(call func(d *protocol.Department) *protocol.DepartmentStatistics) { 101 iterateDepartments := func(call func(d *protocol.Department) *protocol.DepartmentStatistics) {
99 for i := range departments { 102 for i := range departments {
@@ -105,7 +108,7 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DepartmentStat @@ -105,7 +108,7 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DepartmentStat
105 Time: department.CreateTime.Unix(), 108 Time: department.CreateTime.Unix(),
106 } 109 }
107 rsp.List = append(rsp.List, item) 110 rsp.List = append(rsp.List, item)
108 - rsp.Total += item.ChanceApprovedTotal + item.AchievementTotal 111 + rsp.Total += item.ChanceApprovedTotal + item.AchievementTotal + item.ChanceReservedTotal
109 } 112 }
110 } 113 }
111 switch request.Type { 114 switch request.Type {