...
|
...
|
@@ -52,7 +52,7 @@ func Departments(header *protocol.RequestHeader, request *protocol.DepartmentsRe |
|
|
//遍历部门
|
|
|
func walkDepartment(to *protocol.Department, dfrom *models.Department) (err error) {
|
|
|
var newD *protocol.Department = &protocol.Department{
|
|
|
DepartmentId: dfrom.Id,
|
|
|
DepartmentId: int(dfrom.Id),
|
|
|
Name: dfrom.Name,
|
|
|
CreateTime: dfrom.CreateAt,
|
|
|
Departments: []*protocol.Department{},
|
...
|
...
|
@@ -63,7 +63,7 @@ func walkDepartment(to *protocol.Department, dfrom *models.Department) (err erro |
|
|
return
|
|
|
}
|
|
|
}
|
|
|
if to.DepartmentId == dfrom.ParentId {
|
|
|
if to.DepartmentId == int(dfrom.ParentId) {
|
|
|
to.Departments = append(to.Departments, newD)
|
|
|
}
|
|
|
for i := range to.Departments {
|
...
|
...
|
@@ -86,7 +86,7 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DepartmentStat |
|
|
companyDep := departmentsResponse.GetCompanyDepartment()
|
|
|
if companyDep.DepartmentId > 0 {
|
|
|
var companyDepStatistic *protocol.DepartmentStatisticResponse
|
|
|
if companyDepStatistic, err = DepartmentStatistic(header, &protocol.DepartmentStatisticRequest{DepartmentId: companyDep.DepartmentId}); err != nil {
|
|
|
if companyDepStatistic, err = DepartmentStatistic(header, &protocol.DepartmentStatisticRequest{DepartmentId: int64(companyDep.DepartmentId)}); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
...
|
...
|
@@ -155,7 +155,7 @@ func DepartmentStatistic(header *protocol.RequestHeader, request *protocol.Depar |
|
|
}
|
|
|
departmentStatistic := protocol.DepartmentStatistics{}
|
|
|
departmentStatistic.Dep = protocol.Dep{
|
|
|
Id: deparment.Id,
|
|
|
Id: int(deparment.Id),
|
|
|
Name: deparment.Name,
|
|
|
}
|
|
|
if dIds, err = agg.GetDepartmentIds(header.CompanyId, request.DepartmentId, false); err != nil {
|
...
|
...
|
@@ -163,7 +163,7 @@ func DepartmentStatistic(header *protocol.RequestHeader, request *protocol.Depar |
|
|
return
|
|
|
}
|
|
|
departmentStatistic.AchievementTotal, _ = agg.AchievementDepartmentStatic(header, 0, dIds)
|
|
|
departmentStatistic.ChanceApprovedTotal, _ = agg.GetChancePool(header.UserId, header.CompanyId, 0, request.DepartmentId, false, 0, 0, nil)
|
|
|
departmentStatistic.ChanceApprovedTotal, _ = agg.GetChancePool(header.UserId, header.CompanyId, 0, int(request.DepartmentId), false, 0, 0, nil)
|
|
|
departmentStatistic.ACTotal = departmentStatistic.AchievementTotal + departmentStatistic.ChanceApprovedTotal
|
|
|
departmentStatistic.ChanceApprovingTotal, _ = agg.ChanceApprovingStatistic(header, dIds)
|
|
|
rsp.DepartmentStatistic = departmentStatistic
|
...
|
...
|
|