作者 郑周

Merge branch 'dev-zhengzhou' into test

@@ -1159,16 +1159,16 @@ func (srv StaffAssessServeice) SaveSelfAssess(in *command.SaveSelfAssessCommand) @@ -1159,16 +1159,16 @@ func (srv StaffAssessServeice) SaveSelfAssess(in *command.SaveSelfAssessCommand)
1159 } 1159 }
1160 } 1160 }
1161 1161
1162 - // 处理提交上来的数据  
1163 - paramContentMap := map[string]domain.AssessContent{} 1162 + // 内容分类
  1163 + contentCategoryMap := map[string]domain.AssessContent{}
1164 for i, v := range in.AssessContent { 1164 for i, v := range in.AssessContent {
1165 key := fmt.Sprintf("%s-%s", v.Category, v.Name) 1165 key := fmt.Sprintf("%s-%s", v.Category, v.Name)
1166 - paramContentMap[key] = in.AssessContent[i] 1166 + contentCategoryMap[key] = in.AssessContent[i]
1167 } 1167 }
1168 // 更新的评估填写信息 1168 // 更新的评估填写信息
1169 for _, v := range assessContentList { 1169 for _, v := range assessContentList {
1170 key := fmt.Sprintf("%s-%s", v.Category, v.Name) 1170 key := fmt.Sprintf("%s-%s", v.Category, v.Name)
1171 - item, ok := paramContentMap[key] 1171 + item, ok := contentCategoryMap[key]
1172 if !ok { 1172 if !ok {
1173 continue 1173 continue
1174 } 1174 }
@@ -1253,14 +1253,24 @@ func (srv StaffAssessServeice) SaveSelfAssess(in *command.SaveSelfAssessCommand) @@ -1253,14 +1253,24 @@ func (srv StaffAssessServeice) SaveSelfAssess(in *command.SaveSelfAssessCommand)
1253 if v, ok := recordMap[it.Id]; ok { 1253 if v, ok := recordMap[it.Id]; ok {
1254 it.AssistLevel = v.AssistLevel // 更新上级辅导情况 1254 it.AssistLevel = v.AssistLevel // 更新上级辅导情况
1255 it.AssistContent = v.AssistContent // 更新上级辅导内容 1255 it.AssistContent = v.AssistContent // 更新上级辅导内容
1256 - // 去掉前后空格进行判断  
1257 - trimSpace := strings.TrimSpace(v.AssistContent)  
1258 - if len(trimSpace) == 0 || trimSpace == "无" {  
1259 - it.AnomalyState = domain.AnomalyState0  
1260 - } else {  
1261 - it.AnomalyState = domain.AnomalyState1 1256 +
  1257 + var anomalyState = domain.AnomalyState0
  1258 + key := fmt.Sprintf("%s-%s", v.Category, v.Name)
  1259 + if item, ok := contentCategoryMap[key]; ok {
  1260 + for _, remark := range item.Remark {
  1261 + trimSpace := strings.TrimLeft(remark.RemarkText, "\n") // 去掉前换行符
  1262 + trimSpace = strings.TrimRight(trimSpace, "\n") // 去掉后换行符
  1263 + trimSpace = strings.TrimSpace(trimSpace) // 去掉前后空格符
  1264 + if !(len(trimSpace) == 0 || trimSpace == "无") { // 有一个填写项是正常即可
  1265 + anomalyState = domain.AnomalyState1
  1266 + break
  1267 + }
  1268 + }
1262 } 1269 }
1263 - if v.TaskStageId == it.TaskStageCheck.Id { // 更新里程碑状态 1270 + it.AnomalyState = anomalyState
  1271 +
  1272 + // 更新里程碑状态
  1273 + if v.TaskStageId == it.TaskStageCheck.Id {
1264 if v.Check == domain.TaskStageUncompleted { 1274 if v.Check == domain.TaskStageUncompleted {
1265 it.TaskStageCheck.RealCompletedAt = 0 1275 it.TaskStageCheck.RealCompletedAt = 0
1266 } else { 1276 } else {
@@ -1268,7 +1278,7 @@ func (srv StaffAssessServeice) SaveSelfAssess(in *command.SaveSelfAssessCommand) @@ -1268,7 +1278,7 @@ func (srv StaffAssessServeice) SaveSelfAssess(in *command.SaveSelfAssessCommand)
1268 } 1278 }
1269 } 1279 }
1270 for j := range it.TaskStages { 1280 for j := range it.TaskStages {
1271 - if v.TaskStageId == it.TaskStages[j].Id { // 更新里程碑状态 1281 + if v.TaskStageId == it.TaskStages[j].Id {
1272 if v.Check == domain.TaskStageUncompleted { 1282 if v.Check == domain.TaskStageUncompleted {
1273 it.TaskStages[j].RealCompletedAt = 0 1283 it.TaskStages[j].RealCompletedAt = 0
1274 } else { 1284 } else {
@@ -33,6 +33,8 @@ type RemarkText struct { @@ -33,6 +33,8 @@ type RemarkText struct {
33 } 33 }
34 34
35 type AssessTaskStage struct { 35 type AssessTaskStage struct {
  36 + Category string `json:"category" comment:"分类"`
  37 + Name string `json:"name" comment:"名称"`
36 TaskRecordId int `json:"taskRecordId,string" comment:"任务记录ID"` 38 TaskRecordId int `json:"taskRecordId,string" comment:"任务记录ID"`
37 TaskStageId int `json:"taskStageId,string" comment:"里程碑ID"` 39 TaskStageId int `json:"taskStageId,string" comment:"里程碑ID"`
38 Check TaskStageCheck `json:"check" comment:"里程碑完成情况"` 40 Check TaskStageCheck `json:"check" comment:"里程碑完成情况"`