作者 tangxvhui

调整异常详情输出详情

... ... @@ -4,4 +4,5 @@ package command
type GetTaskAnomalyCommand struct {
Id int `json:"id,string"`
CompanyId int `json:"-"`
UserId int `json:"-"`
}
... ...
... ... @@ -829,6 +829,12 @@ func (srv TaskService) TaskAnomalyInfo(param *command.GetTaskAnomalyCommand) (*a
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
userDao := dao.NewUserDao(map[string]interface{}{"transactionContext": transactionContext})
// 获取员工全部子集
childUser, err := userDao.AllChildUser(param.UserId)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取下级员工"+err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, nil
}
... ... @@ -877,16 +883,55 @@ func (srv TaskService) TaskAnomalyInfo(param *command.GetTaskAnomalyCommand) (*a
TaskEndTime: taskData.EndTime,
TaskSortBy: int(taskData.SortBy),
RecordBegin: anomalyData.RecordBegin,
CreatedAt: anomalyData.CreatedAt.Local().Format("066-017"),
MarkA: anomalyData.Marks["a"],
MarkB: anomalyData.Marks["b"],
MarkC: anomalyData.Marks["c"],
MarkD: anomalyData.Marks["d"],
CreatedAt: anomalyData.CreatedAt.Local().Format("2006-01-02"),
MarkA: "",
MarkB: "",
MarkC: "",
MarkD: "",
AnomalyDesc: "",
AnomalyDesc2: map[string]string{
"": "",
},
}
// 设置操作标记
{
isChildUser := false
for _, child := range childUser {
if int64(child.Id) == taskData.Leader.Id {
isChildUser = true
break
}
}
switch anomalyData.Category {
case domain.AnomalyCategoryType1:
// 里程碑异常
if param.UserId == int(taskData.Leader.Id) {
// 去更新
result.MarkA = anomalyData.Marks["a"]
// 找上级
result.MarkC = anomalyData.Marks["c"]
} else if isChildUser {
// 去辅导
result.MarkD = anomalyData.Marks["d"]
}
case domain.AnomalyCategoryType2:
if param.UserId == int(taskData.Leader.Id) {
// 去反馈
result.MarkB = anomalyData.Marks["b"]
} else if isChildUser {
// 去辅导
result.MarkD = anomalyData.Marks["d"]
}
case domain.AnomalyCategoryType3:
if param.UserId == int(taskData.Leader.Id) {
//空
} else if isChildUser {
// 去辅导
result.MarkD = anomalyData.Marks["d"]
}
}
}
noticeWho := []string{}
for _, val2 := range anomalyData.NoticeWho {
if name, ok := val2["name"]; ok {
... ...
... ... @@ -383,6 +383,7 @@ func (c *TaskController) TaskAnomalyInfo() {
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
userReq.UserId = userReq.UserId
resp, err := srv.TaskAnomalyInfo(paramReq)
c.Response(resp, err)
}
... ... @@ -399,6 +400,7 @@ func (c *TaskController) TaskAnomalyMarkByTask() {
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.UserId = int(userReq.UserId)
resp, err := srv.MarkTaskAnomalyByTask(paramReq)
c.Response(resp, err)
... ...