作者 yangfu

登录修改 统一用户中心凭证过期 报错4140

... ... @@ -93,9 +93,9 @@ func (this *DepartmentStatisticsResponse) Less(i, j int) bool {
}
//待审核
if this.List[i].ChanceApprovingTotal > this.List[j].ChanceApprovingTotal {
return true
}
//if this.List[i].ChanceApprovingTotal > this.List[j].ChanceApprovingTotal {
// return true
//}
return false
}
func (this *DepartmentStatisticsResponse) Swap(i, j int) {
... ... @@ -109,7 +109,7 @@ type DepartmentStatistics struct {
ChanceApprovingTotal int `json:"chanceApprovingTotal"` //待审核的机会
AchievementTotal int `json:"achievementTotal"` //已创建的成果 (显示)
ACTotal int `json:"-"` //机会成果总数 (显示)
ACTotal int `json:"total"` //机会成果总数 (显示)
}
/*DepartmentStatistic 单部门统计*/
... ...
... ... @@ -100,13 +100,13 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DepartmentStat
switch request.Type {
case protocol.StatisticApproved:
iterateDepartments(func(d *protocol.Department) *protocol.DepartmentStatistics {
rsp := &protocol.DepartmentStatistics{}
item := &protocol.DepartmentStatistics{}
dIds := departmentsResponse.GetChildDepartmentIds(d, true)
rsp.AchievementTotal, _ = agg.AchievementDepartmentStatic(header, 0, dIds)
rsp.ChanceApprovedTotal, _ = agg.GetChancePool(header.UserId, header.CompanyId, 0, d.DepartmentId, true, 0, 0, nil)
rsp.ACTotal = rsp.AchievementTotal + rsp.ChanceApprovedTotal
rsp.ChanceApprovingTotal, _ = agg.ChanceApprovingStatistic(header, departmentsResponse.GetChildDepartmentIds(d, true))
return rsp
item.AchievementTotal, _ = agg.AchievementDepartmentStatic(header, 0, dIds)
item.ChanceApprovedTotal, _ = agg.GetChancePool(header.UserId, header.CompanyId, 0, d.DepartmentId, true, 0, 0, nil)
item.ACTotal = item.AchievementTotal + item.ChanceApprovedTotal
item.ChanceApprovingTotal, _ = agg.ChanceApprovingStatistic(header, departmentsResponse.GetChildDepartmentIds(d, true))
return item
})
break
//case protocol.StatisticApproving:
... ...
package department
import (
"gitlab.fjmaimaimai.com/mmm-go/gocomm/common"
"opp/protocol"
"sort"
"testing"
... ... @@ -33,21 +34,21 @@ func TestGetRootDepartment(t *testing.T) {
//排序
func TestSortDepartmentStastics(t *testing.T) {
s := &protocol.DepartmentStatisticsResponse{
//List:[]*protocol.DepartmentStatistics{
// {ChanceApprovedTotal:10,AchievementTotal:10,ACTotal:20},
// {ChanceApprovedTotal:10,AchievementTotal:10,ACTotal:20},
// {ChanceApprovedTotal:20,AchievementTotal:10,ACTotal:30},
// {ChanceApprovedTotal:5,AchievementTotal:10,ACTotal:15},
//},
List: []*protocol.DepartmentStatistics{
{ChanceApprovingTotal: 10},
{ChanceApprovingTotal: 10},
{ChanceApprovingTotal: 30},
{ChanceApprovingTotal: 40},
{ChanceApprovingTotal: 60},
{ChanceApprovingTotal: 50},
{ChanceApprovedTotal: 8, AchievementTotal: 12, ACTotal: 20},
{ChanceApprovedTotal: 12, AchievementTotal: 8, ACTotal: 20},
{ChanceApprovedTotal: 20, AchievementTotal: 20, ACTotal: 40},
{ChanceApprovedTotal: 5, AchievementTotal: 10, ACTotal: 15},
},
//List: []*protocol.DepartmentStatistics{
// {ChanceApprovingTotal: 10},
// {ChanceApprovingTotal: 10},
// {ChanceApprovingTotal: 30},
// {ChanceApprovingTotal: 40},
// {ChanceApprovingTotal: 60},
// {ChanceApprovingTotal: 50},
//},
}
sort.Sort(s)
//t.Log(common.AssertJson(s))
t.Log(common.AssertJson(s))
}
... ...