Merge branch 'test' into dev-tangxvhui
正在显示
7 个修改的文件
包含
35 行增加
和
15 行删除
@@ -525,7 +525,9 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) | @@ -525,7 +525,9 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) | ||
525 | if project.State == domain.ProjectStateEnable { | 525 | if project.State == domain.ProjectStateEnable { |
526 | return nil, application.ThrowError(application.BUSINESS_ERROR, "项目已启动") | 526 | return nil, application.ThrowError(application.BUSINESS_ERROR, "项目已启动") |
527 | } | 527 | } |
528 | - | 528 | + if project.State == domain.ProjectStatePause { |
529 | + return nil, application.ThrowError(application.BUSINESS_ERROR, "项目暂停中,先进行恢复") | ||
530 | + } | ||
529 | // 周期内的所有项目,已启用的员工不能重复被评估 | 531 | // 周期内的所有项目,已启用的员工不能重复被评估 |
530 | _, projects, err := projectRepository.Find(map[string]interface{}{"companyId": project.CompanyId, "cycleId": project.CycleId}, "template") | 532 | _, projects, err := projectRepository.Find(map[string]interface{}{"companyId": project.CompanyId, "cycleId": project.CycleId}, "template") |
531 | if err != nil { | 533 | if err != nil { |
@@ -625,7 +627,7 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) | @@ -625,7 +627,7 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) | ||
625 | task.NextSentAt = nil | 627 | task.NextSentAt = nil |
626 | } | 628 | } |
627 | 629 | ||
628 | - task, err := taskRepository.Insert(task) | 630 | + _, err := taskRepository.Insert(task) |
629 | if err != nil { | 631 | if err != nil { |
630 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 632 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
631 | } | 633 | } |
@@ -871,6 +873,17 @@ func (rs *EvaluationProjectService) CheckRecipients(in *command.CheckRecipientCo | @@ -871,6 +873,17 @@ func (rs *EvaluationProjectService) CheckRecipients(in *command.CheckRecipientCo | ||
871 | } | 873 | } |
872 | 874 | ||
873 | func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContext application.TransactionContext, project *domain.EvaluationProject) error { | 875 | func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContext application.TransactionContext, project *domain.EvaluationProject) error { |
876 | + itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{ | ||
877 | + "transactionContext": transactionContext, | ||
878 | + }) | ||
879 | + var err error | ||
880 | + cnt, _, err := itemUsedRepo.Find(map[string]interface{}{"projectId": project.Id}) | ||
881 | + if err != nil { | ||
882 | + return application.ThrowError(application.TRANSACTION_ERROR, "检查评估选项"+err.Error()) | ||
883 | + } | ||
884 | + if cnt > 0 { | ||
885 | + return nil | ||
886 | + } | ||
874 | var itemUsedList []*domain.EvaluationItemUsed | 887 | var itemUsedList []*domain.EvaluationItemUsed |
875 | nowTime := time.Now() | 888 | nowTime := time.Now() |
876 | for _, v := range project.Template.LinkNodes { | 889 | for _, v := range project.Template.LinkNodes { |
@@ -901,10 +914,8 @@ func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContex | @@ -901,10 +914,8 @@ func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContex | ||
901 | itemUsedList = append(itemUsedList, &item) | 914 | itemUsedList = append(itemUsedList, &item) |
902 | } | 915 | } |
903 | } | 916 | } |
904 | - itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{ | ||
905 | - "transactionContext": transactionContext, | ||
906 | - }) | ||
907 | - err := itemUsedRepo.BatchInsert(itemUsedList) | 917 | + |
918 | + err = itemUsedRepo.BatchInsert(itemUsedList) | ||
908 | if err != nil { | 919 | if err != nil { |
909 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 920 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
910 | } | 921 | } |
@@ -138,8 +138,9 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G | @@ -138,8 +138,9 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G | ||
138 | return resp, nil | 138 | return resp, nil |
139 | } | 139 | } |
140 | userDao := dao.NewUserDao(map[string]interface{}{"transactionContext": transactionContext}) | 140 | userDao := dao.NewUserDao(map[string]interface{}{"transactionContext": transactionContext}) |
141 | - // 针对任务负责人 | 141 | + |
142 | taskDao := dao.NewTaskDao(map[string]interface{}{"transactionContext": transactionContext}) | 142 | taskDao := dao.NewTaskDao(map[string]interface{}{"transactionContext": transactionContext}) |
143 | + // 我作为任务负责人的提醒 | ||
143 | leaderIds := []string{strconv.Itoa(param.UserId)} | 144 | leaderIds := []string{strconv.Itoa(param.UserId)} |
144 | taskStageList, err := taskDao.TaskStageAnomaly(leaderIds) | 145 | taskStageList, err := taskDao.TaskStageAnomaly(leaderIds) |
145 | if err != nil { | 146 | if err != nil { |
@@ -155,7 +156,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G | @@ -155,7 +156,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G | ||
155 | childUserId = append(childUserId, strconv.Itoa(val.Id)) | 156 | childUserId = append(childUserId, strconv.Itoa(val.Id)) |
156 | } | 157 | } |
157 | } | 158 | } |
158 | - // 针对上级 | 159 | + // 作为上级,我的下级员工的异常里程碑 |
159 | var taskStageList2 []dao.TaskStageData | 160 | var taskStageList2 []dao.TaskStageData |
160 | if len(childUserId) == 0 { | 161 | if len(childUserId) == 0 { |
161 | taskStageList2, err = taskDao.TaskStageAnomaly(childUserId) | 162 | taskStageList2, err = taskDao.TaskStageAnomaly(childUserId) |
@@ -169,7 +170,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G | @@ -169,7 +170,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G | ||
169 | childUserId = append(childUserId, strconv.Itoa(val.Id)) | 170 | childUserId = append(childUserId, strconv.Itoa(val.Id)) |
170 | } | 171 | } |
171 | } | 172 | } |
172 | - // 针对上上级 | 173 | + // 作为上级, 我的下下级员工的异常里程碑 |
173 | var taskStageList3 []dao.TaskStageData | 174 | var taskStageList3 []dao.TaskStageData |
174 | if len(childUserId) == 0 { | 175 | if len(childUserId) == 0 { |
175 | taskStageList3, err = taskDao.TaskStageAnomaly(childUserId2) | 176 | taskStageList3, err = taskDao.TaskStageAnomaly(childUserId2) |
@@ -431,8 +431,6 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess) | @@ -431,8 +431,6 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess) | ||
431 | if err != nil { | 431 | if err != nil { |
432 | return nil, application.ThrowError(application.ARG_ERROR, "获取项目EvaluationProject信息"+err.Error()) | 432 | return nil, application.ThrowError(application.ARG_ERROR, "获取项目EvaluationProject信息"+err.Error()) |
433 | } | 433 | } |
434 | - | ||
435 | - // projectData.PrincipalId | ||
436 | userIdstr := strconv.Itoa(staffAssess.Executor.UserId) | 434 | userIdstr := strconv.Itoa(staffAssess.Executor.UserId) |
437 | if projectData.PrincipalId != userIdstr { | 435 | if projectData.PrincipalId != userIdstr { |
438 | return nil, nil | 436 | return nil, nil |
@@ -454,6 +452,7 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess) | @@ -454,6 +452,7 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess) | ||
454 | _, taskList, err := taskRepo.Find(map[string]interface{}{ | 452 | _, taskList, err := taskRepo.Find(map[string]interface{}{ |
455 | "name": val.Name, | 453 | "name": val.Name, |
456 | "leaderId": projectData.PrincipalId, | 454 | "leaderId": projectData.PrincipalId, |
455 | + "status": domain.TaskRunning, | ||
457 | }) | 456 | }) |
458 | if err != nil { | 457 | if err != nil { |
459 | return nil, application.ThrowError(application.ARG_ERROR, "获取评估项指标任务task信息"+err.Error()) | 458 | return nil, application.ThrowError(application.ARG_ERROR, "获取评估项指标任务task信息"+err.Error()) |
@@ -699,14 +699,17 @@ func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]i | @@ -699,14 +699,17 @@ func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]i | ||
699 | taskDao := dao.NewTaskDao(map[string]interface{}{ | 699 | taskDao := dao.NewTaskDao(map[string]interface{}{ |
700 | "transactionContext": transactionContext, | 700 | "transactionContext": transactionContext, |
701 | }) | 701 | }) |
702 | + //任务列表数据 | ||
702 | tasklistData, err := taskDao.ListTaskStageNotHrbp(condition) | 703 | tasklistData, err := taskDao.ListTaskStageNotHrbp(condition) |
703 | if err != nil { | 704 | if err != nil { |
704 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务列表"+err.Error()) | 705 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务列表"+err.Error()) |
705 | } | 706 | } |
707 | + //查到的任务数据总数 | ||
706 | taskCount, err := taskDao.CountTaskStageNotHrbp(condition) | 708 | taskCount, err := taskDao.CountTaskStageNotHrbp(condition) |
707 | if err != nil { | 709 | if err != nil { |
708 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务总数"+err.Error()) | 710 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务总数"+err.Error()) |
709 | } | 711 | } |
712 | + // | ||
710 | taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyNotHrbp(condition) | 713 | taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyNotHrbp(condition) |
711 | if err != nil { | 714 | if err != nil { |
712 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error()) | 715 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error()) |
@@ -125,7 +125,7 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage | @@ -125,7 +125,7 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage | ||
125 | join t_task_1 on task.id=t_task_1.id | 125 | join t_task_1 on task.id=t_task_1.id |
126 | join task_stage on task.id =task_stage.task_id | 126 | join task_stage on task.id =task_stage.task_id |
127 | where 1=1 and task.company_id=? | 127 | where 1=1 and task.company_id=? |
128 | - order by diff_time,task."level",task.created_at | 128 | + order by diff_time,task."level",task.created_at desc |
129 | ), | 129 | ), |
130 | -- 按任务数据分页获取 | 130 | -- 按任务数据分页获取 |
131 | t_task_page as ( | 131 | t_task_page as ( |
@@ -234,7 +234,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage, | @@ -234,7 +234,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage, | ||
234 | from task | 234 | from task |
235 | join task_stage on task.id =task_stage.task_id | 235 | join task_stage on task.id =task_stage.task_id |
236 | where 1=1 and task.company_id=? | 236 | where 1=1 and task.company_id=? |
237 | - order by diff_time,task."level",task.created_at | 237 | + order by diff_time,task."level",task.created_at desc |
238 | ), | 238 | ), |
239 | -- 按任务数据分页获取 | 239 | -- 按任务数据分页获取 |
240 | t_task_page as ( | 240 | t_task_page as ( |
@@ -274,7 +274,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage, | @@ -274,7 +274,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage, | ||
274 | } | 274 | } |
275 | if param.SearchWord != "" { | 275 | if param.SearchWord != "" { |
276 | condition = append(condition, param.SearchWord, param.SearchWord) | 276 | condition = append(condition, param.SearchWord, param.SearchWord) |
277 | - whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)` | 277 | + whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?) ` |
278 | } | 278 | } |
279 | condition = append(condition, param.Limit, param.Offset) | 279 | condition = append(condition, param.Limit, param.Offset) |
280 | sqlStr := fmt.Sprintf(withSql, whereSql) | 280 | sqlStr := fmt.Sprintf(withSql, whereSql) |
@@ -374,6 +374,9 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err | @@ -374,6 +374,9 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err | ||
374 | } | 374 | } |
375 | 375 | ||
376 | func (d *TaskDao) IncreaseAnomaly(id []int, incr int) error { | 376 | func (d *TaskDao) IncreaseAnomaly(id []int, incr int) error { |
377 | + if len(id) == 0 { | ||
378 | + return nil | ||
379 | + } | ||
377 | sqlStr := `update task set anomaly=task.anomaly+? | 380 | sqlStr := `update task set anomaly=task.anomaly+? |
378 | where id in(?)` | 381 | where id in(?)` |
379 | tx := d.transactionContext.PgTx | 382 | tx := d.transactionContext.PgTx |
@@ -132,6 +132,9 @@ func (repo *TaskRepository) Find(queryOptions map[string]interface{}) (int, []*d | @@ -132,6 +132,9 @@ func (repo *TaskRepository) Find(queryOptions map[string]interface{}) (int, []*d | ||
132 | if val, ok := queryOptions["aliasOrLeader"]; ok { | 132 | if val, ok := queryOptions["aliasOrLeader"]; ok { |
133 | query.Where(`task.alias like ? or task.leader->>'name' like ?`, val, val) | 133 | query.Where(`task.alias like ? or task.leader->>'name' like ?`, val, val) |
134 | } | 134 | } |
135 | + if val, ok := queryOptions["status"]; ok { | ||
136 | + query.Where("task.status=?", val) | ||
137 | + } | ||
135 | query.Order("id desc") | 138 | query.Order("id desc") |
136 | count, err := query.SelectAndCount() | 139 | count, err := query.SelectAndCount() |
137 | if err != nil { | 140 | if err != nil { |
@@ -13,7 +13,7 @@ func init() { | @@ -13,7 +13,7 @@ func init() { | ||
13 | web.NSBefore(filters.AllowCors(), middlewares.CheckAdminToken()), | 13 | web.NSBefore(filters.AllowCors(), middlewares.CheckAdminToken()), |
14 | web.NSCtrlPost("/info", (*controllers.TaskController).GetTaskInfo), | 14 | web.NSCtrlPost("/info", (*controllers.TaskController).GetTaskInfo), |
15 | web.NSCtrlPut("/", (*controllers.TaskController).UpdateTask), | 15 | web.NSCtrlPut("/", (*controllers.TaskController).UpdateTask), |
16 | - web.NSCtrlPost("/delete", (*controllers.TaskController).DeleteTask), | 16 | + web.NSCtrlPut("/delete", (*controllers.TaskController).DeleteTask), |
17 | web.NSCtrlPost("/run", (*controllers.TaskController).RunTask), | 17 | web.NSCtrlPost("/run", (*controllers.TaskController).RunTask), |
18 | web.NSCtrlPost("/stop", (*controllers.TaskController).StopTask), | 18 | web.NSCtrlPost("/stop", (*controllers.TaskController).StopTask), |
19 | web.NSCtrlPost("/list", (*controllers.TaskController).ListTask), | 19 | web.NSCtrlPost("/list", (*controllers.TaskController).ListTask), |
-
请 注册 或 登录 后发表评论