作者 庄敏学

合并分支 'test' 到 'master'

Test



查看合并请求 !9
不能预览此文件类型
... ... @@ -396,10 +396,13 @@ func (rs *EvaluationProjectService) List(in *command.QueryProjectCommand) (inter
pmpUserIds = append(pmpUserIds, userId)
}
// 当前时间超过截至时间显示【已结束】
if now > project.EndTime.Unix() {
project.State = domain.ProjectStateDisable
// 如果是已启用状态时,当前时间超过截至时间显示【已结束】
if project.State == domain.ProjectStateEnable {
if now > project.EndTime.Unix() {
project.State = domain.ProjectStateDisable
}
}
}
if len(pmpUserIds) > 0 {
... ...
... ... @@ -2,7 +2,9 @@ package command
//保存员工填写评估内容
type SaveAssessInfoCommand struct {
AssessId int `json:"assessId"`
AssessId int `json:"assessId"` //
ExecutorId int `json:"executorId"` //填写人的id
CompanyId int `json:"companyId"` //公司id
AssessContent []AssesssContent `json:"assessContent"`
}
... ...
... ... @@ -208,10 +208,7 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery)
}
}
}
//未参与的,不算在个人的评估环节里
if stepItem.Status != "" {
result.StepList = append(result.StepList, stepItem)
}
result.StepList = append(result.StepList, stepItem)
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -1299,7 +1296,7 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU
switch v.Types {
case domain.AssessInviteDiffSuper:
m["typs"] = "不同上级同事"
m["types"] = "不同上级同事"
case domain.AssessInviteSameSuper:
m["types"] = "相同上级同事"
}
... ... @@ -1598,6 +1595,12 @@ func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.T
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{}{
... ... @@ -1659,7 +1662,13 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma
if endTimeInt < time.Now().Unix() {
return nil, application.ThrowError(application.BUSINESS_ERROR, "当前环节已过截止时间,提交后无法修改内容")
}
//检查执行人
if assessData.CompanyId != param.CompanyId {
return nil, application.ThrowError(application.BUSINESS_ERROR, "当前用户不是评估的执行人")
}
if assessData.Executor.UserId != param.ExecutorId {
return nil, application.ThrowError(application.BUSINESS_ERROR, "当前用户不是评估的执行人")
}
assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
... ... @@ -1763,3 +1772,78 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA
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,
})
userRepo := factory.CreateUserRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
var departmemtList []*domain.Department
var err error
if len(targetUser.DepartmentId) > 0 {
_, departmemtList, err = departmentRepo.Find(map[string]interface{}{
"ids": targetUser.DepartmentId,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的部门列表"+err.Error())
}
}
if len(departmemtList) == 0 {
}
//获取部门管理员
var chargeUserIds []int64
var targetUserAsManager *domain.Department
loop:
for _, v := range departmemtList {
if len(v.ChargeUserIds) == 0 {
continue
}
//检查员工自身是否是管理员
for _, vv := range v.ChargeUserIds {
if vv == targetUser.Id {
targetUserAsManager = v
break loop
}
}
chargeUserIds = append(chargeUserIds, v.ChargeUserIds...)
}
if targetUserAsManager != nil {
//清空原有的管理员
chargeUserIds = []int64{}
//员工自身是否是管理员,查找父级部门
_, parentDepartment, err := departmentRepo.Find(map[string]interface{}{
"id": targetUserAsManager.ParentId,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工现在部门的父级"+err.Error())
}
for _, v := range parentDepartment {
chargeUserIds = append(chargeUserIds, v.ChargeUserIds...)
}
}
var chargeUserList []*domain.User
if len(chargeUserIds) > 0 {
_, chargeUserList, err = userRepo.Find(map[string]interface{}{
"ids": chargeUserIds,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取主管员工数据"+err.Error())
}
}
if len(chargeUserList) == 0 {
//如果都找不到数据
}
// _, chargeUserList, err := userRepo.Find(map[string]interface{}{
// "ids": chargeUserIds,
// })
return nil, nil
}
... ...
... ... @@ -25,8 +25,9 @@ const (
)
type EntryItem struct {
Title string `json:"title" comment:"填写标题"`
HintText string `json:"hintText" comment:"文本内容提示"`
Title string `json:"title" comment:"填写标题"`
HintText string `json:"hintText" comment:"文本内容提示"`
Definition string `json:"definition" comment:"定义"`
}
// NodeContent 评估内容
... ...
... ... @@ -11,6 +11,7 @@ type PerformanceApplicationForm struct {
Weight string //权重
Standard string //标准
Task string //任务、指标
Definition string //定义
}
type PerformanceDimension struct {
... ... @@ -26,7 +27,8 @@ type PerformanceModule struct {
}
type PerformanceTarget struct {
Task string `json:"task"`
Task string `json:"task"`
Definition string `json:"definition"`
}
func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error) {
... ... @@ -59,6 +61,10 @@ func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error)
taskName = "填写自评反馈"
}
form.Task = taskName
//定义
if len(item) > 5 {
form.Definition = strings.TrimSpace(item[5])
}
//权重
if len(item) > 6 && item[6] != "" {
weightName = item[6]
... ... @@ -199,7 +205,7 @@ func getStandard(items []*PerformanceApplicationForm) (string, error) {
func getTasks(items []*PerformanceApplicationForm) ([]*PerformanceTarget, error) {
tasks := make([]*PerformanceTarget, 0)
for _, item := range items {
target := &PerformanceTarget{Task: item.Task}
target := &PerformanceTarget{Task: item.Task, Definition: item.Definition}
tasks = append(tasks, target)
}
return tasks, nil
... ...
... ... @@ -41,7 +41,10 @@ func (controller *ImportController) Import() {
formType := controller.GetString("type")
switch formType {
case "PerformanceDimension":
dimensions, _ := domain.LoadPerformanceDimensions(rows)
dimensions, err := domain.LoadPerformanceDimensions(rows)
if err != nil {
controller.Response(nil, application.ThrowError(application.ARG_ERROR, err.Error()))
}
list := controller.parseTemplateNodeContent(dimensions)
controller.Response(tool_funs.SimpleWrapGridMap(int64(len(list)), list), nil)
default:
... ... @@ -103,8 +106,9 @@ func (controller *ImportController) parseTemplateNodeContent(data []*domain.Perf
for i3 := range module.Target {
target := module.Target[i3]
nc.EntryItems = append(nc.EntryItems, &domain.EntryItem{
Title: target.Task, // 输入型标题
HintText: "", // 输入项提示文本
Title: target.Task, // 输入型标题
HintText: "", // 输入项提示文本
Definition: target.Definition, //定义
})
}
// 没有任何输入项时,默认1个
... ...
... ... @@ -237,6 +237,9 @@ func (c *StaffAssessController) SaveAssessInfo() {
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.ExecutorId = int(userReq.UserId)
paramReq.CompanyId = int(userReq.CompanyId)
data, err := srv.SaveAssessInfo(paramReq)
c.Response(data, err)
}
... ...