作者 tangxvhui

任务完成后(最后一个里程碑完成时),隔日日评中的里程碑和上级辅导均要取消

@@ -493,7 +493,9 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess) @@ -493,7 +493,9 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess)
493 } 493 }
494 } 494 }
495 } 495 }
496 - taskRecordList = append(taskRecordList, &newTaskRecord) 496 + if newTaskRecord.TaskStageCheck.Id > 0 {
  497 + taskRecordList = append(taskRecordList, &newTaskRecord)
  498 + }
497 } 499 }
498 500
499 if err := transactionContext.CommitTransaction(); err != nil { 501 if err := transactionContext.CommitTransaction(); err != nil {
@@ -73,7 +73,7 @@ func (srv TaskService) CreateTask(transactionContext application.TransactionCont @@ -73,7 +73,7 @@ func (srv TaskService) CreateTask(transactionContext application.TransactionCont
73 return application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询任务失败:"+err.Error()) 73 return application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询任务失败:"+err.Error())
74 } 74 }
75 if cnt > 0 { 75 if cnt > 0 {
76 - //TODO 76 +
77 //任务已存在 77 //任务已存在
78 return nil 78 return nil
79 } 79 }
@@ -172,11 +172,11 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] @@ -172,11 +172,11 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string]
172 defer func() { 172 defer func() {
173 _ = transactionContext.RollbackTransaction() 173 _ = transactionContext.RollbackTransaction()
174 }() 174 }()
175 - if len(param.StageList) < 3 {  
176 - return map[string]interface{}{  
177 - "id": param.Id,  
178 - }, application.ThrowError(application.INTERNAL_SERVER_ERROR, "里程碑数量至少3个")  
179 - } 175 + // if len(param.StageList) < 3 {
  176 + // return map[string]interface{}{
  177 + // "id": param.Id,
  178 + // }, application.ThrowError(application.INTERNAL_SERVER_ERROR, "里程碑数量至少3个")
  179 + // }
180 if len(param.StageList) > 5 { 180 if len(param.StageList) > 5 {
181 return map[string]interface{}{ 181 return map[string]interface{}{
182 "id": param.Id, 182 "id": param.Id,
@@ -212,31 +212,15 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] @@ -212,31 +212,15 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string]
212 var relatedUser []*domain.User 212 var relatedUser []*domain.User
213 if len(relatedUserIds) > 0 { 213 if len(relatedUserIds) > 0 {
214 _, relatedUser, err = userRepo.Find(map[string]interface{}{ 214 _, relatedUser, err = userRepo.Find(map[string]interface{}{
215 - "ids": relatedUserIds, 215 + "ids": relatedUserIds,
  216 + "companyId": param.CompanyId,
216 }) 217 })
217 if err != nil { 218 if err != nil {
218 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务的相关人员"+err.Error()) 219 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务的相关人员"+err.Error())
219 } 220 }
220 } 221 }
221 - _, leaderList, err := userRepo.Find(map[string]interface{}{  
222 - "id": taskData.Leader.Id,  
223 - })  
224 - if err != nil {  
225 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询人员失败:"+err.Error())  
226 - }  
227 - if len(leaderList) == 0 {  
228 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有查询到人员")  
229 - }  
230 - leaderData := leaderList[0]  
231 - //更新相关人员  
232 - taskData.RelatedUser = []int{int(leaderData.Id)}  
233 - if leaderData.ParentId != 0 {  
234 - taskData.RelatedUser = append(taskData.RelatedUser, int(leaderData.ParentId))  
235 - } 222 + taskData.RelatedUser = []int{}
236 for _, val := range relatedUser { 223 for _, val := range relatedUser {
237 - if val.Id == leaderData.Id || val.Id == leaderData.ParentId {  
238 - continue  
239 - }  
240 taskData.RelatedUser = append(taskData.RelatedUser, int(val.Id)) 224 taskData.RelatedUser = append(taskData.RelatedUser, int(val.Id))
241 } 225 }
242 //更新任务名称 226 //更新任务名称
@@ -323,7 +307,7 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] @@ -323,7 +307,7 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string]
323 messageRepo := factory.CreateMessagePersonalRepository(map[string]interface{}{ 307 messageRepo := factory.CreateMessagePersonalRepository(map[string]interface{}{
324 "transactionContext": transactionContext, 308 "transactionContext": transactionContext,
325 }) 309 })
326 - //更具markStage 记录的里程碑数据生成通知 310 + //根据markStage 记录的里程碑数据生成通知
327 for _, val := range markStage { 311 for _, val := range markStage {
328 for _, val2 := range taskData.RelatedUser { 312 for _, val2 := range taskData.RelatedUser {
329 t1 := time.Unix(val.PlanCompletedAt, 0).Format("2006-01-02") 313 t1 := time.Unix(val.PlanCompletedAt, 0).Format("2006-01-02")
@@ -27,7 +27,7 @@ type Task struct { @@ -27,7 +27,7 @@ type Task struct {
27 Anomaly int `pg:"anomaly,use_zero"` // 异常反馈的数量 27 Anomaly int `pg:"anomaly,use_zero"` // 异常反馈的数量
28 WarnFlag int `pg:"warn_flag,use_zero"` // 里程碑异常标记 28 WarnFlag int `pg:"warn_flag,use_zero"` // 里程碑异常标记
29 CurrentStage domain.TaskStage `pg:"current_stage,type:jsonb"` // 添加type:jsonb 防止orm(可能是特性)生成sql时字段丢失 29 CurrentStage domain.TaskStage `pg:"current_stage,type:jsonb"` // 添加type:jsonb 防止orm(可能是特性)生成sql时字段丢失
30 - SortBy int `pg:"sort_by"` // 优先级排序;值越小优先级越高  
31 - EndTime int64 `pg:"end_time"` // 任务截止的时间戳,单位:秒;等于0时表示未设置时间  
32 - UseEndTime int `pg:"use_end_time"` // 是否应用任务截止的时间;默认值0:不应用,1:应用 30 + SortBy int `pg:"sort_by,use_zero"` // 优先级排序;值越小优先级越高
  31 + EndTime int64 `pg:"end_time,use_zero"` // 任务截止的时间戳,单位:秒;等于0时表示未设置时间
  32 + UseEndTime int `pg:"use_end_time,use_zero"` // 是否应用任务截止的时间;默认值0:不应用,1:应用
33 } 33 }
  1 +-- 修改task表结构
  2 +ALTER TABLE public.task
  3 + ADD sort_by int8 NOT NULL DEFAULT 0;
  4 +
  5 +ALTER TABLE public.task
  6 + ADD end_time int8 NOT NULL DEFAULT 0;
  7 +
  8 +ALTER TABLE public.task
  9 + ADD use_end_time int8 NOT NULL DEFAULT 0;
  10 +