作者 郑周

1. 任务,增加 “无” 异常状态

... ... @@ -3,6 +3,7 @@ package service
import (
"fmt"
"strconv"
"strings"
"time"
service "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role"
... ... @@ -1252,6 +1253,13 @@ func (srv StaffAssessServeice) SaveSelfAssess(in *command.SaveSelfAssessCommand)
if v, ok := recordMap[it.Id]; ok {
it.AssistLevel = v.AssistLevel // 更新上级辅导情况
it.AssistContent = v.AssistContent // 更新上级辅导内容
// 去掉前后空格进行判断
trimSpace := strings.TrimSpace(v.AssistContent)
if len(trimSpace) == 0 || trimSpace == "无" {
it.AnomalyState = domain.AnomalyState0
} else {
it.AnomalyState = domain.AnomalyState1
}
if v.TaskStageId == it.TaskStageCheck.Id { // 更新里程碑状态
if v.Check == domain.TaskStageUncompleted {
it.TaskStageCheck.RealCompletedAt = 0
... ...
... ... @@ -822,8 +822,7 @@ func (srv TaskService) ReplyTaskStage(transactionContext application.Transaction
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "找不到任务数据"+err.Error())
}
if !(len(val.AssistContent) == 0 || val.AssistContent == "无") {
if val.AnomalyState == domain.AnomalyState1 {
taskData.Anomaly = 0
}
taskList = append(taskList, taskData)
... ...
... ... @@ -9,6 +9,11 @@ const (
AssistLevel4 int = 4 // 已辅导-辅导对里程碑作用很好
)
const (
AnomalyState0 int = 0 // 异常
AnomalyState1 int = 1 // 正常
)
// TaskRecord 任务反馈情况记录
type TaskRecord struct {
Id int `json:"id,string" comment:"记录ID"`
... ... @@ -21,6 +26,7 @@ type TaskRecord struct {
TaskLeader TaskLeader `json:"taskLeader" comment:"任务负责人"`
AssistLevel int `json:"assistLevel" comment:"上级辅导情况"`
AssistContent string `json:"assistContent" comment:"上级辅导内容"`
AnomalyState int `json:"anomalyState" comment:"异常反馈状态(0异常、1正常)"`
TaskStages []TaskStage `json:"taskStages" comment:"里程碑列表"`
TaskStageCheck TaskStage `json:"taskStageCheck" comment:"提交的里程碑"`
CreatedAt time.Time `json:"createdAt" comment:"创建时间"`
... ...
... ... @@ -16,8 +16,9 @@ type TaskRecord struct {
TaskName string `comment:"任务名称"`
TaskAlias string `comment:"任务别名"`
TaskLeader domain.TaskLeader `comment:"任务负责人"`
AssistLevel int `comment:"上级辅导情况"`
AssistLevel int `comment:"上级辅导情况" pg:",use_zero"`
AssistContent string `comment:"上级辅导内容"`
AnomalyState int `comment:"异常反馈状态" pg:",use_zero"`
TaskStages []domain.TaskStage `comment:"里程碑列表"`
TaskStageCheck domain.TaskStage `comment:"提交的里程碑"`
CreatedAt time.Time `comment:"创建时间"`
... ...
... ... @@ -32,6 +32,7 @@ func (repo *TaskRecordRepository) TransformToDomain(m *models.TaskRecord) domain
TaskLeader: m.TaskLeader,
AssistLevel: m.AssistLevel,
AssistContent: m.AssistContent,
AnomalyState: m.AnomalyState,
TaskStages: m.TaskStages,
TaskStageCheck: m.TaskStageCheck,
CreatedAt: m.CreatedAt.Local(),
... ... @@ -52,6 +53,7 @@ func (repo *TaskRecordRepository) TransformToModel(d *domain.TaskRecord) models.
TaskLeader: d.TaskLeader,
AssistLevel: d.AssistLevel,
AssistContent: d.AssistContent,
AnomalyState: d.AnomalyState,
TaskStages: d.TaskStages,
TaskStageCheck: d.TaskStageCheck,
CreatedAt: d.CreatedAt,
... ...