作者 郑周

1.任务记录 新增反馈内容字段

... ... @@ -1283,12 +1283,15 @@ func (srv StaffAssessServeice) SaveSelfAssess(in *command.SaveSelfAssessCommand)
for i := range taskRecords {
it := taskRecords[i]
if v, ok := recordMap[it.Id]; ok {
it.AssistLevel = v.AssistLevel // 更新上级辅导情况
it.AssistContent = v.AssistContent // 更新上级辅导内容
it.AssistLevel = v.AssistLevel // 更新上级辅导情况
it.AssistContent = v.AssistContent // 更新上级辅导内容
it.RemarkContent = make([]domain.RemarkText, 0) // 更新填写反馈内容
var anomalyState = domain.AnomalyState0
key := fmt.Sprintf("%s-%s", v.Category, v.Name)
if item, ok := contentCategoryMap[key]; ok {
it.RemarkContent = append(it.RemarkContent, item.Remark...)
for _, remark := range item.Remark {
trimSpace := strings.TrimLeft(remark.RemarkText, "\n") // 去掉前换行符
trimSpace = strings.TrimRight(trimSpace, "\n") // 去掉后换行符
... ...
package adapter
import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
type TaskRecordAdapter struct {
Id int `json:"id,string" ` //comment:"记录ID"
StaffAssessId int `json:"staffAssessId,string" ` //comment:"每日评估的ID"
TaskId int `json:"taskId,string" ` //comment:"任务ID"
TaskCategory string `json:"taskCategory" ` //comment:"任务类别"
TaskName string `json:"taskName" ` //comment:"任务名称"
TaskAlias string `json:"taskAlias" ` //comment:"任务别名"
TaskLeader string `json:"taskLeader"` //comment:"任务负责人"
AssistContent string `json:"assistContent" ` //comment:"反馈内容"
TaskStageCheck TaskStage `json:"taskStageCheck" ` //comment:"提交的里程碑"
CreatedAt string `json:"createdAt" ` //格式2006-01-02comment:"创建时间"
AnomalyState int `json:"anomalyState"` //
Id int `json:"id,string" ` //comment:"记录ID"
StaffAssessId int `json:"staffAssessId,string" ` //comment:"每日评估的ID"
TaskId int `json:"taskId,string" ` //comment:"任务ID"
TaskCategory string `json:"taskCategory" ` //comment:"任务类别"
TaskName string `json:"taskName" ` //comment:"任务名称"
TaskAlias string `json:"taskAlias" ` //comment:"任务别名"
TaskLeader string `json:"taskLeader"` //comment:"任务负责人"
RemarkContent []domain.RemarkText `json:"remarkContent" ` //comment:"任务填写反馈"
AssistLevel int `json:"assistLevel"` //comment:"上级辅导情况"
AssistContent string `json:"assistContent" ` //comment:"上级辅导内容"
TaskStageCheck TaskStage `json:"taskStageCheck" ` //comment:"提交的里程碑"
CreatedAt string `json:"createdAt" ` //格式2006-01-02comment:"创建时间"
AnomalyState int `json:"anomalyState"` //
}
... ...
... ... @@ -801,12 +801,10 @@ func (srv TaskService) ListTaskRecord(param *command.ListTaskRecordCommand) (map
defer func() {
_ = transactionContext.RollbackTransaction()
}()
taskRecordRepo := factory.CreateTaskRecordRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
taskRecordRepo := factory.CreateTaskRecordRepository(map[string]interface{}{"transactionContext": transactionContext})
//assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
// "transactionContext": transactionContext,
//})
cnt, taskRecordList, err := taskRecordRepo.Find(map[string]interface{}{
"companyId": param.CompanyId,
"taskId": param.TaskId,
... ... @@ -814,6 +812,9 @@ func (srv TaskService) ListTaskRecord(param *command.ListTaskRecordCommand) (map
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务反馈数据"+err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
resultList := []adapter.TaskRecordAdapter{}
nowDay := time.Now().Format("2006-01-02")
... ... @@ -831,7 +832,9 @@ func (srv TaskService) ListTaskRecord(param *command.ListTaskRecordCommand) (map
TaskName: val.TaskName,
TaskAlias: val.TaskAlias,
TaskLeader: val.TaskLeader.Name,
AssistContent: "",
RemarkContent: val.RemarkContent, // 填写反馈内容
AssistLevel: val.AssistLevel, // 上级辅助等级
AssistContent: val.AssistContent, // 上级辅助内容
AnomalyState: val.AnomalyState,
TaskStageCheck: adapter.TaskStage{
Id: val.Id,
... ... @@ -852,24 +855,24 @@ func (srv TaskService) ListTaskRecord(param *command.ListTaskRecordCommand) (map
t2 := time.Unix(val.TaskStageCheck.RealCompletedAt, 0).Local().Format("2006-01-02")
item.TaskStageCheck.RealCompletedAt = t2
}
_, contentList, err := assessContentRepo.Find(map[string]interface{}{
"staffAssessId": val.StaffAssessId,
"category": val.TaskCategory,
"name": val.TaskName,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估反馈数据"+err.Error())
}
if len(contentList) > 0 {
for _, val2 := range contentList[0].Remark {
item.AssistContent += val2.RemarkText + "\n"
}
}
//_, contentList, err := assessContentRepo.Find(map[string]interface{}{
// "staffAssessId": val.StaffAssessId,
// "category": val.TaskCategory,
// "name": val.TaskName,
//})
//if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估反馈数据"+err.Error())
//}
//if len(contentList) > 0 {
// for _, val2 := range contentList[0].Remark {
// item.AssistContent += val2.RemarkText + "\n"
// }
//}
resultList = append(resultList, item)
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
//if err := transactionContext.CommitTransaction(); err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
//}
result := tool_funs.SimpleWrapGridMap(int64(cnt), resultList)
return result, nil
}
... ...
... ... @@ -19,22 +19,23 @@ const (
// TaskRecord 任务反馈情况记录
type TaskRecord struct {
Id int `json:"id,string" comment:"记录ID"`
CompanyId int `json:"companyId,string" comment:"公司ID"`
StaffAssessId int `json:"staffAssessId,string" comment:"每日评估的ID"`
TaskId int `json:"taskId,string" comment:"任务ID"`
TaskCategory string `json:"taskCategory" comment:"任务类别"`
TaskName string `json:"taskName" comment:"任务名称"`
TaskAlias string `json:"taskAlias" comment:"任务别名"`
TaskLeader TaskLeader `json:"taskLeader" comment:"任务负责人"`
AssistLevel int `json:"assistLevel" comment:"上级辅导情况"`
AssistContent string `json:"assistContent" comment:"上级辅导内容"`
AnomalyState int `json:"anomalyState" comment:"异常是否反馈状态(-1初始状态、0异常、1正常)"`
TaskStages []TaskStage `json:"taskStages" comment:"里程碑列表"`
TaskStageCheck TaskStage `json:"taskStageCheck" comment:"提交的里程碑"`
CreatedAt time.Time `json:"createdAt" comment:"创建时间"`
UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"`
DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
Id int `json:"id,string" comment:"记录ID"`
CompanyId int `json:"companyId,string" comment:"公司ID"`
StaffAssessId int `json:"staffAssessId,string" comment:"每日评估的ID"`
TaskId int `json:"taskId,string" comment:"任务ID"`
TaskCategory string `json:"taskCategory" comment:"任务类别"`
TaskName string `json:"taskName" comment:"任务名称"`
TaskAlias string `json:"taskAlias" comment:"任务别名"`
TaskLeader TaskLeader `json:"taskLeader" comment:"任务负责人"`
AssistLevel int `json:"assistLevel" comment:"上级辅导情况"`
AssistContent string `json:"assistContent" comment:"上级辅导内容"`
RemarkContent []RemarkText `json:"remarkContent" comment:"填写反馈"`
AnomalyState int `json:"anomalyState" comment:"异常是否反馈状态(-1初始状态、0异常、1正常)"`
TaskStages []TaskStage `json:"taskStages" comment:"里程碑列表"`
TaskStageCheck TaskStage `json:"taskStageCheck" comment:"提交的里程碑"`
CreatedAt time.Time `json:"createdAt" comment:"创建时间"`
UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"`
DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
}
type TaskRecordRepository interface {
... ...
... ... @@ -7,21 +7,22 @@ import (
// 任务阶段
type TaskRecord struct {
tableName struct{} `comment:"评估项目" pg:"task_record"`
Id int `comment:"ID" pg:"pk:id"`
CompanyId int `comment:"公司ID"`
StaffAssessId int `comment:"每日评估的ID"`
TaskId int `comment:"任务ID"`
TaskCategory string `comment:"任务类别"`
TaskName string `comment:"任务名称"`
TaskAlias string `comment:"任务别名"`
TaskLeader domain.TaskLeader `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:"创建时间"`
UpdatedAt time.Time `comment:"更新时间"`
DeletedAt *time.Time `comment:"删除时间"`
tableName struct{} `comment:"评估项目" pg:"task_record"`
Id int `comment:"ID" pg:"pk:id"`
CompanyId int `comment:"公司ID"`
StaffAssessId int `comment:"每日评估的ID"`
TaskId int `comment:"任务ID"`
TaskCategory string `comment:"任务类别"`
TaskName string `comment:"任务名称"`
TaskAlias string `comment:"任务别名"`
TaskLeader domain.TaskLeader `comment:"任务负责人"`
AssistLevel int `comment:"上级辅导情况" pg:",use_zero"`
AssistContent string `comment:"上级辅导内容"`
RemarkContent []domain.RemarkText `comment:"填写反馈进度"`
AnomalyState int `comment:"异常反馈状态" pg:",use_zero"`
TaskStages []domain.TaskStage `comment:"里程碑列表"`
TaskStageCheck domain.TaskStage `comment:"提交的里程碑"`
CreatedAt time.Time `comment:"创建时间"`
UpdatedAt time.Time `comment:"更新时间"`
DeletedAt *time.Time `comment:"删除时间"`
}
... ...
... ... @@ -32,6 +32,7 @@ func (repo *TaskRecordRepository) TransformToDomain(m *models.TaskRecord) domain
TaskLeader: m.TaskLeader,
AssistLevel: m.AssistLevel,
AssistContent: m.AssistContent,
RemarkContent: m.RemarkContent,
AnomalyState: m.AnomalyState,
TaskStages: m.TaskStages,
TaskStageCheck: m.TaskStageCheck,
... ... @@ -53,6 +54,7 @@ func (repo *TaskRecordRepository) TransformToModel(d *domain.TaskRecord) models.
TaskLeader: d.TaskLeader,
AssistLevel: d.AssistLevel,
AssistContent: d.AssistContent,
RemarkContent: d.RemarkContent,
AnomalyState: d.AnomalyState,
TaskStages: d.TaskStages,
TaskStageCheck: d.TaskStageCheck,
... ...
-- 增加任务记录字段-填写反馈进度
ALTER TABLE public.task_record
ADD remark_content jsonb NULL;
COMMENT ON COLUMN public.task_record.remark_content IS '填写反馈进度';
... ...