合并分支 'test' 到 'master'
Test 查看合并请求 !9
正在显示
9 个修改的文件
包含
112 行增加
和
9 行删除
不能预览此文件类型
| @@ -396,12 +396,15 @@ func (rs *EvaluationProjectService) List(in *command.QueryProjectCommand) (inter | @@ -396,12 +396,15 @@ func (rs *EvaluationProjectService) List(in *command.QueryProjectCommand) (inter | ||
| 396 | pmpUserIds = append(pmpUserIds, userId) | 396 | pmpUserIds = append(pmpUserIds, userId) |
| 397 | } | 397 | } |
| 398 | 398 | ||
| 399 | - // 当前时间超过截至时间显示【已结束】 | 399 | + // 如果是已启用状态时,当前时间超过截至时间显示【已结束】 |
| 400 | + if project.State == domain.ProjectStateEnable { | ||
| 400 | if now > project.EndTime.Unix() { | 401 | if now > project.EndTime.Unix() { |
| 401 | project.State = domain.ProjectStateDisable | 402 | project.State = domain.ProjectStateDisable |
| 402 | } | 403 | } |
| 403 | } | 404 | } |
| 404 | 405 | ||
| 406 | + } | ||
| 407 | + | ||
| 405 | if len(pmpUserIds) > 0 { | 408 | if len(pmpUserIds) > 0 { |
| 406 | userRepository := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext}) | 409 | userRepository := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext}) |
| 407 | _, users, _ := userRepository.Find(map[string]interface{}{"ids": pmpUserIds, "limit": len(pmpUserIds)}) | 410 | _, users, _ := userRepository.Find(map[string]interface{}{"ids": pmpUserIds, "limit": len(pmpUserIds)}) |
| @@ -2,7 +2,9 @@ package command | @@ -2,7 +2,9 @@ package command | ||
| 2 | 2 | ||
| 3 | //保存员工填写评估内容 | 3 | //保存员工填写评估内容 |
| 4 | type SaveAssessInfoCommand struct { | 4 | type SaveAssessInfoCommand struct { |
| 5 | - AssessId int `json:"assessId"` | 5 | + AssessId int `json:"assessId"` // |
| 6 | + ExecutorId int `json:"executorId"` //填写人的id | ||
| 7 | + CompanyId int `json:"companyId"` //公司id | ||
| 6 | AssessContent []AssesssContent `json:"assessContent"` | 8 | AssessContent []AssesssContent `json:"assessContent"` |
| 7 | } | 9 | } |
| 8 | 10 |
| @@ -208,11 +208,8 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) | @@ -208,11 +208,8 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) | ||
| 208 | } | 208 | } |
| 209 | } | 209 | } |
| 210 | } | 210 | } |
| 211 | - //未参与的,不算在个人的评估环节里 | ||
| 212 | - if stepItem.Status != "" { | ||
| 213 | result.StepList = append(result.StepList, stepItem) | 211 | result.StepList = append(result.StepList, stepItem) |
| 214 | } | 212 | } |
| 215 | - } | ||
| 216 | if err := transactionContext.CommitTransaction(); err != nil { | 213 | if err := transactionContext.CommitTransaction(); err != nil { |
| 217 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 214 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 218 | } | 215 | } |
| @@ -1299,7 +1296,7 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU | @@ -1299,7 +1296,7 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU | ||
| 1299 | 1296 | ||
| 1300 | switch v.Types { | 1297 | switch v.Types { |
| 1301 | case domain.AssessInviteDiffSuper: | 1298 | case domain.AssessInviteDiffSuper: |
| 1302 | - m["typs"] = "不同上级同事" | 1299 | + m["types"] = "不同上级同事" |
| 1303 | case domain.AssessInviteSameSuper: | 1300 | case domain.AssessInviteSameSuper: |
| 1304 | m["types"] = "相同上级同事" | 1301 | m["types"] = "相同上级同事" |
| 1305 | } | 1302 | } |
| @@ -1598,6 +1595,12 @@ func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.T | @@ -1598,6 +1595,12 @@ func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.T | ||
| 1598 | departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{ | 1595 | departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{ |
| 1599 | "transactionContext": transactionContext, | 1596 | "transactionContext": transactionContext, |
| 1600 | }) | 1597 | }) |
| 1598 | + // //查找员工的部门 | ||
| 1599 | + // var departmentList []*domain.Department | ||
| 1600 | + // if len(userData.DepartmentId) > 0 { | ||
| 1601 | + | ||
| 1602 | + // } | ||
| 1603 | + | ||
| 1601 | var supperUserList []*domain.User | 1604 | var supperUserList []*domain.User |
| 1602 | if len(userData.DepartmentId) > 0 { | 1605 | if len(userData.DepartmentId) > 0 { |
| 1603 | _, departmentList, err := departmentRepo.Find(map[string]interface{}{ | 1606 | _, departmentList, err := departmentRepo.Find(map[string]interface{}{ |
| @@ -1659,7 +1662,13 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma | @@ -1659,7 +1662,13 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma | ||
| 1659 | if endTimeInt < time.Now().Unix() { | 1662 | if endTimeInt < time.Now().Unix() { |
| 1660 | return nil, application.ThrowError(application.BUSINESS_ERROR, "当前环节已过截止时间,提交后无法修改内容") | 1663 | return nil, application.ThrowError(application.BUSINESS_ERROR, "当前环节已过截止时间,提交后无法修改内容") |
| 1661 | } | 1664 | } |
| 1662 | - | 1665 | + //检查执行人 |
| 1666 | + if assessData.CompanyId != param.CompanyId { | ||
| 1667 | + return nil, application.ThrowError(application.BUSINESS_ERROR, "当前用户不是评估的执行人") | ||
| 1668 | + } | ||
| 1669 | + if assessData.Executor.UserId != param.ExecutorId { | ||
| 1670 | + return nil, application.ThrowError(application.BUSINESS_ERROR, "当前用户不是评估的执行人") | ||
| 1671 | + } | ||
| 1663 | assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{ | 1672 | assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{ |
| 1664 | "transactionContext": transactionContext, | 1673 | "transactionContext": transactionContext, |
| 1665 | }) | 1674 | }) |
| @@ -1763,3 +1772,78 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA | @@ -1763,3 +1772,78 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA | ||
| 1763 | 1772 | ||
| 1764 | return tool_funs.SimpleWrapGridMap(int64(cnt), assessList), nil | 1773 | return tool_funs.SimpleWrapGridMap(int64(cnt), assessList), nil |
| 1765 | } | 1774 | } |
| 1775 | + | ||
| 1776 | +//获取员工的上级是谁 ,TODO | ||
| 1777 | +func (srv StaffAssessServeice) getStaffSuper(transactionContext application.TransactionContext, targetUser domain.User) ([]domain.User, error) { | ||
| 1778 | + departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{ | ||
| 1779 | + "transactionContext": transactionContext, | ||
| 1780 | + }) | ||
| 1781 | + userRepo := factory.CreateUserRepository(map[string]interface{}{ | ||
| 1782 | + "transactionContext": transactionContext, | ||
| 1783 | + }) | ||
| 1784 | + | ||
| 1785 | + var departmemtList []*domain.Department | ||
| 1786 | + var err error | ||
| 1787 | + if len(targetUser.DepartmentId) > 0 { | ||
| 1788 | + _, departmemtList, err = departmentRepo.Find(map[string]interface{}{ | ||
| 1789 | + "ids": targetUser.DepartmentId, | ||
| 1790 | + }) | ||
| 1791 | + if err != nil { | ||
| 1792 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的部门列表"+err.Error()) | ||
| 1793 | + } | ||
| 1794 | + } | ||
| 1795 | + if len(departmemtList) == 0 { | ||
| 1796 | + | ||
| 1797 | + } | ||
| 1798 | + //获取部门管理员 | ||
| 1799 | + var chargeUserIds []int64 | ||
| 1800 | + var targetUserAsManager *domain.Department | ||
| 1801 | +loop: | ||
| 1802 | + for _, v := range departmemtList { | ||
| 1803 | + if len(v.ChargeUserIds) == 0 { | ||
| 1804 | + continue | ||
| 1805 | + } | ||
| 1806 | + //检查员工自身是否是管理员 | ||
| 1807 | + for _, vv := range v.ChargeUserIds { | ||
| 1808 | + if vv == targetUser.Id { | ||
| 1809 | + targetUserAsManager = v | ||
| 1810 | + break loop | ||
| 1811 | + } | ||
| 1812 | + } | ||
| 1813 | + chargeUserIds = append(chargeUserIds, v.ChargeUserIds...) | ||
| 1814 | + } | ||
| 1815 | + if targetUserAsManager != nil { | ||
| 1816 | + //清空原有的管理员 | ||
| 1817 | + chargeUserIds = []int64{} | ||
| 1818 | + //员工自身是否是管理员,查找父级部门 | ||
| 1819 | + _, parentDepartment, err := departmentRepo.Find(map[string]interface{}{ | ||
| 1820 | + "id": targetUserAsManager.ParentId, | ||
| 1821 | + }) | ||
| 1822 | + if err != nil { | ||
| 1823 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工现在部门的父级"+err.Error()) | ||
| 1824 | + } | ||
| 1825 | + for _, v := range parentDepartment { | ||
| 1826 | + chargeUserIds = append(chargeUserIds, v.ChargeUserIds...) | ||
| 1827 | + } | ||
| 1828 | + } | ||
| 1829 | + | ||
| 1830 | + var chargeUserList []*domain.User | ||
| 1831 | + if len(chargeUserIds) > 0 { | ||
| 1832 | + _, chargeUserList, err = userRepo.Find(map[string]interface{}{ | ||
| 1833 | + "ids": chargeUserIds, | ||
| 1834 | + }) | ||
| 1835 | + if err != nil { | ||
| 1836 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取主管员工数据"+err.Error()) | ||
| 1837 | + } | ||
| 1838 | + } | ||
| 1839 | + if len(chargeUserList) == 0 { | ||
| 1840 | + //如果都找不到数据 | ||
| 1841 | + | ||
| 1842 | + } | ||
| 1843 | + | ||
| 1844 | + // _, chargeUserList, err := userRepo.Find(map[string]interface{}{ | ||
| 1845 | + // "ids": chargeUserIds, | ||
| 1846 | + // }) | ||
| 1847 | + | ||
| 1848 | + return nil, nil | ||
| 1849 | +} |
| @@ -27,6 +27,7 @@ const ( | @@ -27,6 +27,7 @@ const ( | ||
| 27 | type EntryItem struct { | 27 | type EntryItem struct { |
| 28 | Title string `json:"title" comment:"填写标题"` | 28 | Title string `json:"title" comment:"填写标题"` |
| 29 | HintText string `json:"hintText" comment:"文本内容提示"` | 29 | HintText string `json:"hintText" comment:"文本内容提示"` |
| 30 | + Definition string `json:"definition" comment:"定义"` | ||
| 30 | } | 31 | } |
| 31 | 32 | ||
| 32 | // NodeContent 评估内容 | 33 | // NodeContent 评估内容 |
| @@ -11,6 +11,7 @@ type PerformanceApplicationForm struct { | @@ -11,6 +11,7 @@ type PerformanceApplicationForm struct { | ||
| 11 | Weight string //权重 | 11 | Weight string //权重 |
| 12 | Standard string //标准 | 12 | Standard string //标准 |
| 13 | Task string //任务、指标 | 13 | Task string //任务、指标 |
| 14 | + Definition string //定义 | ||
| 14 | } | 15 | } |
| 15 | 16 | ||
| 16 | type PerformanceDimension struct { | 17 | type PerformanceDimension struct { |
| @@ -27,6 +28,7 @@ type PerformanceModule struct { | @@ -27,6 +28,7 @@ type PerformanceModule struct { | ||
| 27 | 28 | ||
| 28 | type PerformanceTarget struct { | 29 | type PerformanceTarget struct { |
| 29 | Task string `json:"task"` | 30 | Task string `json:"task"` |
| 31 | + Definition string `json:"definition"` | ||
| 30 | } | 32 | } |
| 31 | 33 | ||
| 32 | func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error) { | 34 | func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error) { |
| @@ -59,6 +61,10 @@ func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error) | @@ -59,6 +61,10 @@ func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error) | ||
| 59 | taskName = "填写自评反馈" | 61 | taskName = "填写自评反馈" |
| 60 | } | 62 | } |
| 61 | form.Task = taskName | 63 | form.Task = taskName |
| 64 | + //定义 | ||
| 65 | + if len(item) > 5 { | ||
| 66 | + form.Definition = strings.TrimSpace(item[5]) | ||
| 67 | + } | ||
| 62 | //权重 | 68 | //权重 |
| 63 | if len(item) > 6 && item[6] != "" { | 69 | if len(item) > 6 && item[6] != "" { |
| 64 | weightName = item[6] | 70 | weightName = item[6] |
| @@ -199,7 +205,7 @@ func getStandard(items []*PerformanceApplicationForm) (string, error) { | @@ -199,7 +205,7 @@ func getStandard(items []*PerformanceApplicationForm) (string, error) { | ||
| 199 | func getTasks(items []*PerformanceApplicationForm) ([]*PerformanceTarget, error) { | 205 | func getTasks(items []*PerformanceApplicationForm) ([]*PerformanceTarget, error) { |
| 200 | tasks := make([]*PerformanceTarget, 0) | 206 | tasks := make([]*PerformanceTarget, 0) |
| 201 | for _, item := range items { | 207 | for _, item := range items { |
| 202 | - target := &PerformanceTarget{Task: item.Task} | 208 | + target := &PerformanceTarget{Task: item.Task, Definition: item.Definition} |
| 203 | tasks = append(tasks, target) | 209 | tasks = append(tasks, target) |
| 204 | } | 210 | } |
| 205 | return tasks, nil | 211 | return tasks, nil |
| @@ -41,7 +41,10 @@ func (controller *ImportController) Import() { | @@ -41,7 +41,10 @@ func (controller *ImportController) Import() { | ||
| 41 | formType := controller.GetString("type") | 41 | formType := controller.GetString("type") |
| 42 | switch formType { | 42 | switch formType { |
| 43 | case "PerformanceDimension": | 43 | case "PerformanceDimension": |
| 44 | - dimensions, _ := domain.LoadPerformanceDimensions(rows) | 44 | + dimensions, err := domain.LoadPerformanceDimensions(rows) |
| 45 | + if err != nil { | ||
| 46 | + controller.Response(nil, application.ThrowError(application.ARG_ERROR, err.Error())) | ||
| 47 | + } | ||
| 45 | list := controller.parseTemplateNodeContent(dimensions) | 48 | list := controller.parseTemplateNodeContent(dimensions) |
| 46 | controller.Response(tool_funs.SimpleWrapGridMap(int64(len(list)), list), nil) | 49 | controller.Response(tool_funs.SimpleWrapGridMap(int64(len(list)), list), nil) |
| 47 | default: | 50 | default: |
| @@ -105,6 +108,7 @@ func (controller *ImportController) parseTemplateNodeContent(data []*domain.Perf | @@ -105,6 +108,7 @@ func (controller *ImportController) parseTemplateNodeContent(data []*domain.Perf | ||
| 105 | nc.EntryItems = append(nc.EntryItems, &domain.EntryItem{ | 108 | nc.EntryItems = append(nc.EntryItems, &domain.EntryItem{ |
| 106 | Title: target.Task, // 输入型标题 | 109 | Title: target.Task, // 输入型标题 |
| 107 | HintText: "", // 输入项提示文本 | 110 | HintText: "", // 输入项提示文本 |
| 111 | + Definition: target.Definition, //定义 | ||
| 108 | }) | 112 | }) |
| 109 | } | 113 | } |
| 110 | // 没有任何输入项时,默认1个 | 114 | // 没有任何输入项时,默认1个 |
| @@ -237,6 +237,9 @@ func (c *StaffAssessController) SaveAssessInfo() { | @@ -237,6 +237,9 @@ func (c *StaffAssessController) SaveAssessInfo() { | ||
| 237 | c.Response(nil, e) | 237 | c.Response(nil, e) |
| 238 | return | 238 | return |
| 239 | } | 239 | } |
| 240 | + userReq := middlewares.GetUser(c.Ctx) | ||
| 241 | + paramReq.ExecutorId = int(userReq.UserId) | ||
| 242 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
| 240 | data, err := srv.SaveAssessInfo(paramReq) | 243 | data, err := srv.SaveAssessInfo(paramReq) |
| 241 | c.Response(data, err) | 244 | c.Response(data, err) |
| 242 | } | 245 | } |
不能预览此文件类型
-
请 注册 或 登录 后发表评论