|
@@ -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")
|