作者 tangxvhui

调整 个人指标导出的 数据列的排序

... ... @@ -9,14 +9,15 @@ type AssessInfoResp struct {
CycleName string `json:"cycleName"` //周期名称
EvaluationProjectId int `json:"evaluationProjectId"` //项目id
EvaluationProjectName string `json:"evaluationProjectName"` //项目名称
LinkNodeId int `json:"linkNodeId,string"`
LinkNodeName string `json:"linkNodeName"`
LinkNodeId int `json:"linkNodeId,string"` //评估环节id
LinkNodeName string `json:"linkNodeName"` //评估环节名称
BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05
EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05
Status string `json:"status"` //完成状态
TargetUserId int `json:"targetUserId,string"` //目标用户
TargetUserName string `json:"targetUserName"` //目标用户名称
CompanyId int `json:"companyId,string,"` //
CompanyId int `json:"companyId,string,"` //公司id
CompanyLogo string `json:"companyLogo,string,"` //公司logo
CompanyName string `json:"companyName"` //公司名称
SupperUser string `json:"superUser"` //目标用户的上级
DutyTime string `json:"dutyTime"` //入职时间 //
... ...
... ... @@ -12,6 +12,7 @@ type AssessSelfList struct {
type StaffInfo struct {
UserName string `json:"userName"` //员工名称
CompanyLogo string `json:"companyLogo"` //公司logo
CompanyName string `json:"companyName"` //公司名称
SupperUserName string `json:"supperUserName"` //上级名称
DutyTime string `json:"dutyTime"` //上岗时间
... ...
... ... @@ -1598,6 +1598,7 @@ func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*ada
if targetUserDesc != nil {
result.CompanyName = targetUserDesc.CompanyName
result.SupperUser = targetUserDesc.SupperUserName
result.CompanyLogo = targetUserDesc.CompanyLogo
result.DutyTime = targetUserDesc.DutyTime
}
return &result, nil
... ... @@ -1628,40 +1629,11 @@ func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.T
log.Logger.Error("获取公司信息," + err.Error())
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取公司信息,"+err.Error())
}
// departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
// "transactionContext": transactionContext,
// })
// //查找员工的部门
// var departmentList []*domain.Department
// if len(userData.DepartmentId) > 0 {
// }
// var supperUserList []*domain.User
// if len(userData.DepartmentId) > 0 {
// _, departmentList, err := departmentRepo.Find(map[string]interface{}{
// "ids": userData.DepartmentId,
// })
// if err != nil {
// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取部门信息,"+err.Error())
// }
// var chargeUserIds []int64
// for _, v := range departmentList {
// chargeUserIds = append(chargeUserIds, v.ChargeUserIds...)
// }
// if len(chargeUserIds) > 0 {
// _, supperUserList, err = userRepo.Find(map[string]interface{}{
// "ids": chargeUserIds,
// })
// if err != nil {
// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取员工上级信息,"+err.Error())
// }
// }
// }
supperUserList, _ := srv.getStaffSuper(transactionContext, *userData)
userInfo := adapter.StaffInfo{
UserName: userData.Name,
CompanyName: companyData.Name,
CompanyLogo: companyData.Logo,
SupperUserName: "",
DutyTime: userData.EntryTime,
}
... ... @@ -1822,7 +1794,7 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma
// return tool_funs.SimpleWrapGridMap(int64(cnt), assessList), nil
// }
// 获取员工的上级是谁 ,TODO
// 获取员工的上级是谁
func (srv StaffAssessServeice) getStaffSuper(transactionContext application.TransactionContext, targetUser domain.User) ([]*domain.User, error) {
departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
"transactionContext": transactionContext,
... ...
... ... @@ -14,7 +14,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log"
)
//获取我的项目周期列表
// 获取我的项目周期列表
func (srv StaffAssessServeice) SearchAssessTaskMeV2(param *query.SearchAssessMeQuery) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
... ... @@ -63,7 +63,7 @@ func (srv StaffAssessServeice) SearchAssessTaskMeV2(param *query.SearchAssessMeQ
return tool_funs.SimpleWrapGridMap(int64(cnt), listData), nil
}
//获取我的项目周期进度描述
// 获取我的项目周期进度描述
func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Query) (*adapter.AssessCycleDescResp, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
... ... @@ -218,7 +218,7 @@ func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Que
return &result, nil
}
//根据周期获取,我的自评任务添加的邀请人
// 根据周期获取,我的自评任务添加的邀请人
func (srv StaffAssessServeice) ListAssessInviteUserV2(param *query.ListInviteUserQuery) (*adapter.AssessInviteUserResp, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
... ... @@ -690,19 +690,21 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA
TargetUserName: assessData.TargetUser.UserName,
CompanyId: assessData.CompanyId,
CompanyName: "",
CompanyLogo: "",
SupperUser: "",
DutyTime: "",
AssessContent: assessContentList,
}
if staffDesc != nil {
result.CompanyName = staffDesc.CompanyName
result.CompanyLogo = staffDesc.CompanyLogo
result.SupperUser = staffDesc.SupperUserName
result.DutyTime = staffDesc.DutyTime
}
return &result, nil
}
//根据周期和日期。获取360评估的列表,员工的被其他人评估
// 根据周期和日期。获取360评估的列表,员工的被其他人评估
func (srv StaffAssessServeice) ListTargetUserInviteAssess(param *query.ListTargetAssessQuery) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
... ... @@ -744,7 +746,7 @@ func (srv StaffAssessServeice) ListTargetUserInviteAssess(param *query.ListTarge
return tool_funs.SimpleWrapGridMap(int64(cnt), resultList), nil
}
//根据周期和日期。获取上级评估的列表,员工的被其他人评估
// 根据周期和日期。获取上级评估的列表,员工的被其他人评估
func (srv StaffAssessServeice) ListTargetUserSuperAssess(param *query.ListTargetAssessQuery) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
... ...
... ... @@ -1114,16 +1114,11 @@ func (d *StaffAssessDao) SearchContentCategoryName(companyId int, cycleId int, u
staff_assess_content.category,
staff_assess_content."name" ,
staff_assess_content.weight ,
staff_assess_content.sort_by ,
t_staff_assess_1.cycle_id ,
t_staff_assess_1.cycle_name,
t_staff_assess_1.target_user_id,
t_staff_assess_1.target_user_name,
sum(
case
when staff_assess_content.value isnull then 0
when staff_assess_content.value='' then 0
ELSE 1
END) as cnt
t_staff_assess_1.target_user_name
from staff_assess_content
join t_staff_assess_1 on staff_assess_content.staff_assess_id = t_staff_assess_1.assess_id
where 1=1
... ... @@ -1133,13 +1128,9 @@ func (d *StaffAssessDao) SearchContentCategoryName(companyId int, cycleId int, u
condition = append(condition, pg.In(exportUserIds))
sqlStr += ` and t_staff_assess_1.target_user_id in(?) `
}
sqlStr += ` group by staff_assess_content.category,
staff_assess_content."name" ,
t_staff_assess_1.cycle_id ,
t_staff_assess_1.cycle_name,
staff_assess_content.weight ,
target_user_id,target_user_name
order by cnt desc,target_user_id `
sqlStr += ` group by category,"name" ,cycle_id ,cycle_name,weight ,
target_user_id,target_user_name,sort_by
order by target_user_id,sort_by `
sqlStr0 := d.useTStaffAssess(companyId, cycleId, userId, "", hrbp, 5000, 0, string(domain.AssessSelf))
sqlStr = sqlStr0 + sqlStr
tx := d.transactionContext.PgTx
... ...