...
|
...
|
@@ -27,6 +27,12 @@ func dayEndTime(t time.Time) time.Time { |
|
|
return t2
|
|
|
}
|
|
|
|
|
|
func dayZeroTime(t time.Time) time.Time {
|
|
|
y, m, d := t.Local().Date()
|
|
|
t2 := time.Date(y, m, d, 0, 0, 0, 0, time.Local)
|
|
|
return t2
|
|
|
}
|
|
|
|
|
|
func (srv TaskService) CreateTaskTest(param *command.CreateTaskCommand) error {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
...
|
...
|
@@ -108,7 +114,7 @@ func (srv TaskService) CreateTask(transactionContext application.TransactionCont |
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "创建任务失败:"+err.Error())
|
|
|
}
|
|
|
|
|
|
nowEndTime := dayEndTime(nowTime)
|
|
|
nowEndTime := dayZeroTime(nowTime)
|
|
|
|
|
|
newTaskStage := []*domain.TaskStage{
|
|
|
{
|
...
|
...
|
@@ -590,7 +596,7 @@ func (t TaskService) CancelAttention(param *command.CancelAttentionCommand) erro |
|
|
}
|
|
|
|
|
|
// 员工绩效-任务管理-列表
|
|
|
func (t TaskService) ListTask2(param command.SearchTaskCommand) (map[string]interface{}, error) {
|
|
|
func (t TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]interface{}, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -606,7 +612,7 @@ func (t TaskService) ListTask2(param command.SearchTaskCommand) (map[string]inte |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的角色信息"+err.Error())
|
|
|
}
|
|
|
if hrbpFlag == domain.RoleTypeSystem {
|
|
|
listData, err := t.ListTask2ForHrbp(param)
|
|
|
listData, err := t.listTask2ForHrbp(param)
|
|
|
return listData, err
|
|
|
}
|
|
|
var limit = 20
|
...
|
...
|
@@ -693,7 +699,7 @@ func (t TaskService) ListTask2(param command.SearchTaskCommand) (map[string]inte |
|
|
}
|
|
|
|
|
|
// 以hrbp角色权限获取任务列表
|
|
|
func (t TaskService) ListTask2ForHrbp(param command.SearchTaskCommand) (map[string]interface{}, error) {
|
|
|
func (t TaskService) listTask2ForHrbp(param *command.SearchTaskCommand) (map[string]interface{}, error) {
|
|
|
var limit = 20
|
|
|
var offset = 0
|
|
|
if param.PageSize > 0 {
|
...
|
...
|
@@ -786,7 +792,45 @@ func (t TaskService) ListTask2ForHrbp(param command.SearchTaskCommand) (map[stri |
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// 更新任务里程碑的状态
|
|
|
func (t TaskService) UpdateTaskStageStatus(param command.UpdateTaskStageStatusCommand) {
|
|
|
// ReplyTaskStage 根据每日的任务反馈 ,更新任务里程碑
|
|
|
func (t TaskService) ReplyTaskStage(transactionContext application.TransactionContext, param []*domain.TaskRecord) error {
|
|
|
taskRepo := factory.CreateTaskRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
taskStageRepo := factory.CreateTaskStageRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
var taskList []*domain.Task
|
|
|
var taskStages []*domain.TaskStage
|
|
|
for _, val := range param {
|
|
|
taskData, err := taskRepo.FindOne(map[string]interface{}{"id": val.TaskId})
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "找不到任务数据"+err.Error())
|
|
|
}
|
|
|
|
|
|
if !(len(val.AssistContent) == 0 || val.AssistContent == "无") {
|
|
|
taskData.Anomaly = 0
|
|
|
}
|
|
|
taskList = append(taskList, taskData)
|
|
|
_, stageList, err := taskStageRepo.Find(map[string]interface{}{"ids": []int{val.TaskStageCheck.Id}})
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "找不到任务里程碑数据"+err.Error())
|
|
|
}
|
|
|
if len(stageList) > 0 {
|
|
|
stageList[0].Status = val.TaskStageCheck.Status
|
|
|
stageList[0].RealCompletedAt = val.TaskStageCheck.RealCompletedAt
|
|
|
taskStages = append(taskStages, stageList[0])
|
|
|
}
|
|
|
}
|
|
|
err := taskStageRepo.Save(taskStages)
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存任务里程碑数据"+err.Error())
|
|
|
}
|
|
|
for _, val := range taskList {
|
|
|
err = taskRepo.Save(val)
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存任务数据"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
return nil
|
|
|
} |
...
|
...
|
|