正在显示
3 个修改的文件
包含
29 行增加
和
0 行删除
@@ -7,6 +7,7 @@ import ( | @@ -7,6 +7,7 @@ import ( | ||
7 | "github.com/linmadan/egglib-go/core/application" | 7 | "github.com/linmadan/egglib-go/core/application" |
8 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" | 8 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" |
9 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | 9 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" |
10 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao" | ||
10 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils/xtime" | 11 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils/xtime" |
11 | ) | 12 | ) |
12 | 13 | ||
@@ -21,6 +22,16 @@ func checkTaskRecordV3(param *domain.TaskRecord) error { | @@ -21,6 +22,16 @@ func checkTaskRecordV3(param *domain.TaskRecord) error { | ||
21 | defer func() { | 22 | defer func() { |
22 | _ = transactionContext.RollbackTransaction() | 23 | _ = transactionContext.RollbackTransaction() |
23 | }() | 24 | }() |
25 | + evaluationProjectDao := dao.NewEvaluationProjectDao(map[string]interface{}{ | ||
26 | + "transactionContext": transactionContext, | ||
27 | + }) | ||
28 | + exist, err := evaluationProjectDao.ExistRelationProject(param.StaffAssessId) | ||
29 | + if err != nil { | ||
30 | + return fmt.Errorf("检查项目evaluationProject数据失败:%s", err) | ||
31 | + } | ||
32 | + if !exist { | ||
33 | + return nil | ||
34 | + } | ||
24 | taskRepo := factory.CreateTaskRepository(map[string]interface{}{ | 35 | taskRepo := factory.CreateTaskRepository(map[string]interface{}{ |
25 | "transactionContext": transactionContext, | 36 | "transactionContext": transactionContext, |
26 | }) | 37 | }) |
1 | package dao | 1 | package dao |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "github.com/go-pg/pg/v10" | ||
4 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" | 5 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" |
5 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | 6 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" |
6 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models" | 7 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models" |
@@ -28,3 +29,17 @@ func (d *EvaluationProjectDao) UpdateSummaryState(id int64, status domain.Projec | @@ -28,3 +29,17 @@ func (d *EvaluationProjectDao) UpdateSummaryState(id int64, status domain.Projec | ||
28 | Update() | 29 | Update() |
29 | return err | 30 | return err |
30 | } | 31 | } |
32 | + | ||
33 | +// 检查每日评估是否存在关联的(EvaluationProject)项目数据 | ||
34 | +func (d *EvaluationProjectDao) ExistRelationProject(staffAssessId int) (bool, error) { | ||
35 | + sqlStr := `select count(*) from evaluation_project | ||
36 | + where id=any ( | ||
37 | + select staff_assess.evaluation_project_id | ||
38 | + from staff_assess where id=? | ||
39 | + ) | ||
40 | + and evaluation_project.deleted_at isnull ` | ||
41 | + tx := d.transactionContext.PgTx | ||
42 | + result := 0 | ||
43 | + _, err := tx.QueryOne(pg.Scan(&result), sqlStr, staffAssessId) | ||
44 | + return result > 0, err | ||
45 | +} |
@@ -45,6 +45,9 @@ func (repo *TaskRecordRepository) TransformToDomain(m *models.TaskRecord) domain | @@ -45,6 +45,9 @@ func (repo *TaskRecordRepository) TransformToDomain(m *models.TaskRecord) domain | ||
45 | } | 45 | } |
46 | 46 | ||
47 | func (repo *TaskRecordRepository) TransformToModel(d *domain.TaskRecord) models.TaskRecord { | 47 | func (repo *TaskRecordRepository) TransformToModel(d *domain.TaskRecord) models.TaskRecord { |
48 | + if len(d.RemarkContent) == 0 { | ||
49 | + d.RemarkContent = make([]domain.RemarkText, 0) | ||
50 | + } | ||
48 | return models.TaskRecord{ | 51 | return models.TaskRecord{ |
49 | Id: d.Id, | 52 | Id: d.Id, |
50 | CompanyId: d.CompanyId, | 53 | CompanyId: d.CompanyId, |
-
请 注册 或 登录 后发表评论