...
|
...
|
@@ -73,6 +73,7 @@ func (srv TaskService) ListTaskAnomaly1(param *command.ListTaskAnomalyCommand) ( |
|
|
TaskAlias: val.TaskAlias,
|
|
|
TaskEndTime: int64(val.TaskEndTime),
|
|
|
TaskSortBy: val.TaskSortBy,
|
|
|
CreatedAt: val.CreatedAt.Local().Format("2006-01-02"),
|
|
|
RecordBegin: val.RecordBegin,
|
|
|
MarkA: "",
|
|
|
MarkB: "",
|
...
|
...
|
@@ -202,6 +203,7 @@ func (srv TaskService) ListTaskAnomaly2(param *command.ListTaskAnomalyCommand) ( |
|
|
TaskEndTime: int64(val.TaskEndTime),
|
|
|
TaskSortBy: val.TaskSortBy,
|
|
|
RecordBegin: val.RecordBegin,
|
|
|
CreatedAt: val.CreatedAt.Local().Format("2006-01-02"),
|
|
|
MarkA: "",
|
|
|
MarkB: "",
|
|
|
MarkC: "",
|
...
|
...
|
@@ -327,6 +329,7 @@ func (srv TaskService) ListTaskAnomaly3(param *command.ListTaskAnomalyCommand) ( |
|
|
TaskEndTime: int64(val.TaskEndTime),
|
|
|
TaskSortBy: val.TaskSortBy,
|
|
|
RecordBegin: val.RecordBegin,
|
|
|
CreatedAt: val.CreatedAt.Local().Format("2006-01-02"),
|
|
|
MarkA: "",
|
|
|
MarkB: "",
|
|
|
MarkC: "",
|
...
|
...
|
@@ -392,6 +395,12 @@ func (srv TaskService) ListTaskAnomaly3(param *command.ListTaskAnomalyCommand) ( |
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// 异常详情
|
|
|
// func (srv TaskService) TaskAnomalyInfo() error {
|
|
|
|
|
|
// return nil
|
|
|
// }
|
|
|
|
|
|
func (srv TaskService) UserSelect(param *command.UserSelectCommand) []adapter.UserItem {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
...
|
...
|
@@ -449,10 +458,10 @@ func (srv TaskService) UserSelect(param *command.UserSelectCommand) []adapter.Us |
|
|
func (srv TaskService) MarkTaskAnomaly(param *command.MarkTaskAnomalyCommand) (map[string]string, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return map[string]string{}, nil
|
|
|
return map[string]string{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.StartTransaction(); err != nil {
|
|
|
return map[string]string{}, nil
|
|
|
return map[string]string{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
...
|
...
|
@@ -460,21 +469,42 @@ func (srv TaskService) MarkTaskAnomaly(param *command.MarkTaskAnomalyCommand) (m |
|
|
taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
_, anomalyList, err := taskAnomalyRepo.Find(map[string]interface{}{"id": param.Id, "limit": 1})
|
|
|
taskRepo := factory.CreateTaskRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
_, anomalyList, err := taskAnomalyRepo.Find(map[string]interface{}{"id": param.Id, "companyId": param.CompanyId, "limit": 1})
|
|
|
if err != nil {
|
|
|
|
|
|
return map[string]string{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(anomalyList) == 0 {
|
|
|
return map[string]string{}, nil
|
|
|
}
|
|
|
_ = anomalyList
|
|
|
//MarkType= "a" 去更新,对应里程碑异常
|
|
|
//检查最新的异常记录,进行标记
|
|
|
//检查是否有任务相关连的每日评估
|
|
|
if param.MarkType == "a" {
|
|
|
|
|
|
anomalyData := anomalyList[0]
|
|
|
|
|
|
switch param.MarkType {
|
|
|
case "a":
|
|
|
anomalyData.MarkA()
|
|
|
case "b":
|
|
|
anomalyData.MarkB()
|
|
|
case "c":
|
|
|
anomalyData.MarkC()
|
|
|
case "d":
|
|
|
anomalyData.MarkD()
|
|
|
}
|
|
|
err = taskAnomalyRepo.Save(anomalyData)
|
|
|
if err != nil {
|
|
|
return map[string]string{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
// 或者 MarkType= "b" 去反馈,对应反馈异常
|
|
|
//MarkTYpe="c" //
|
|
|
//MarkType = "d"
|
|
|
//检查最新的异常记录,进行标记
|
|
|
if !(param.MarkType == "a" || param.MarkType == "b") {
|
|
|
return map[string]string{}, nil
|
|
|
}
|
|
|
|
|
|
taskId := anomalyData.TaskId
|
|
|
taskRepo.Find(map[string]interface{}{
|
|
|
"id": taskId,
|
|
|
})
|
|
|
//检查是否有任务相关连的最新每日评估
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return map[string]string{}, nil
|
...
|
...
|
|