作者 tangxvhui
... ... @@ -1159,16 +1159,16 @@ func (srv StaffAssessServeice) SaveSelfAssess(in *command.SaveSelfAssessCommand)
}
}
// 处理提交上来的数据
paramContentMap := map[string]domain.AssessContent{}
// 内容分类
contentCategoryMap := map[string]domain.AssessContent{}
for i, v := range in.AssessContent {
key := fmt.Sprintf("%s-%s", v.Category, v.Name)
paramContentMap[key] = in.AssessContent[i]
contentCategoryMap[key] = in.AssessContent[i]
}
// 更新的评估填写信息
for _, v := range assessContentList {
key := fmt.Sprintf("%s-%s", v.Category, v.Name)
item, ok := paramContentMap[key]
item, ok := contentCategoryMap[key]
if !ok {
continue
}
... ... @@ -1253,14 +1253,24 @@ 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
var anomalyState = domain.AnomalyState0
key := fmt.Sprintf("%s-%s", v.Category, v.Name)
if item, ok := contentCategoryMap[key]; ok {
for _, remark := range item.Remark {
trimSpace := strings.TrimLeft(remark.RemarkText, "\n") // 去掉前换行符
trimSpace = strings.TrimRight(trimSpace, "\n") // 去掉后换行符
trimSpace = strings.TrimSpace(trimSpace) // 去掉前后空格符
if !(len(trimSpace) == 0 || trimSpace == "无") { // 有一个填写项是正常即可
anomalyState = domain.AnomalyState1
break
}
}
}
if v.TaskStageId == it.TaskStageCheck.Id { // 更新里程碑状态
it.AnomalyState = anomalyState
// 更新里程碑状态
if v.TaskStageId == it.TaskStageCheck.Id {
if v.Check == domain.TaskStageUncompleted {
it.TaskStageCheck.RealCompletedAt = 0
} else {
... ... @@ -1268,7 +1278,7 @@ func (srv StaffAssessServeice) SaveSelfAssess(in *command.SaveSelfAssessCommand)
}
}
for j := range it.TaskStages {
if v.TaskStageId == it.TaskStages[j].Id { // 更新里程碑状态
if v.TaskStageId == it.TaskStages[j].Id {
if v.Check == domain.TaskStageUncompleted {
it.TaskStages[j].RealCompletedAt = 0
} else {
... ...
... ... @@ -33,6 +33,8 @@ type RemarkText struct {
}
type AssessTaskStage struct {
Category string `json:"category" comment:"分类"`
Name string `json:"name" comment:"名称"`
TaskRecordId int `json:"taskRecordId,string" comment:"任务记录ID"`
TaskStageId int `json:"taskStageId,string" comment:"里程碑ID"`
Check TaskStageCheck `json:"check" comment:"里程碑完成情况"`
... ...