作者 郑周

1.修复输出时间 为本地时间格式

@@ -185,18 +185,18 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp @@ -185,18 +185,18 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp
185 // 重新计算 185 // 重新计算
186 if task.NextSentAt == nil { 186 if task.NextSentAt == nil {
187 // 环节起始和截止本地时间 187 // 环节起始和截止本地时间
188 - startLocal := task.TimeStart.Local()  
189 - endLocal := task.TimeEnd.Local() 188 + startLocal := task.TimeStart
  189 + endLocal := task.TimeEnd
190 190
191 // 在当前时间之前,则计算下一个周期时间 191 // 在当前时间之前,则计算下一个周期时间
192 if startLocal.Before(now) { 192 if startLocal.Before(now) {
193 nextTime := utils.NextTime(nowO, startLocal, task.KpiCycle) 193 nextTime := utils.NextTime(nowO, startLocal, task.KpiCycle)
194 task.NextSentAt = &nextTime 194 task.NextSentAt = &nextTime
195 } else { 195 } else {
196 - task.NextSentAt = &startLocal 196 + task.NextSentAt = startLocal
197 } 197 }
198 // 如果超出截至时间,则周期置空 198 // 如果超出截至时间,则周期置空
199 - if task.NextSentAt.After(endLocal) { 199 + if task.NextSentAt.After(endLocal.Local()) {
200 task.NextSentAt = nil 200 task.NextSentAt = nil
201 } 201 }
202 } else { 202 } else {
@@ -468,18 +468,18 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) @@ -468,18 +468,18 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand)
468 } 468 }
469 469
470 // 环节起始和截止本地时间 470 // 环节起始和截止本地时间
471 - startLocal := node.TimeStart.Local()  
472 - endLocal := node.TimeEnd.Local() 471 + startLocal := node.TimeStart
  472 + endLocal := node.TimeEnd
473 473
474 // 在当前时间之前,则计算下一个周期时间 474 // 在当前时间之前,则计算下一个周期时间
475 if startLocal.Before(now) { 475 if startLocal.Before(now) {
476 nextTime := utils.NextTime(nowO, startLocal, node.KpiCycle) 476 nextTime := utils.NextTime(nowO, startLocal, node.KpiCycle)
477 task.NextSentAt = &nextTime 477 task.NextSentAt = &nextTime
478 } else { 478 } else {
479 - task.NextSentAt = &startLocal 479 + task.NextSentAt = startLocal
480 } 480 }
481 // 如果超出截至时间,则周期置空 481 // 如果超出截至时间,则周期置空
482 - if task.NextSentAt.After(endLocal) { 482 + if task.NextSentAt.After(endLocal.Local()) {
483 task.NextSentAt = nil 483 task.NextSentAt = nil
484 } 484 }
485 485
@@ -87,7 +87,7 @@ func (rs *NodeTaskService) SendEvaluationNode() error { @@ -87,7 +87,7 @@ func (rs *NodeTaskService) SendEvaluationNode() error {
87 maxTime := task.TimeEnd.Local() 87 maxTime := task.TimeEnd.Local()
88 88
89 // 当前周起始时间和截止时间 89 // 当前周起始时间和截止时间
90 - var cycleTimeStart = task.NextSentAt.Local() 90 + var cycleTimeStart = task.NextSentAt
91 var cycleTimeEnd time.Time 91 var cycleTimeEnd time.Time
92 92
93 // 下个周期起始时间 93 // 下个周期起始时间
@@ -17,11 +17,6 @@ const ( @@ -17,11 +17,6 @@ const (
17 LinkNodeAllAssessment int = 3 // 环节-360°评估 17 LinkNodeAllAssessment int = 3 // 环节-360°评估
18 LinkNodeSuperiorAssessment int = 4 // 环节-上级评估 18 LinkNodeSuperiorAssessment int = 4 // 环节-上级评估
19 LinkNodeViewResult int = 5 // 环节-绩效结果查看 19 LinkNodeViewResult int = 5 // 环节-绩效结果查看
20 -  
21 - //LinkNodeAssessment int = 1 // 环节-评估(自评、360°评估、上级评估)  
22 - //LinkNodeAllInvite int = 2 // 环节-360°邀请  
23 - //LinkNodeViewResult int = 3 // 环节-绩效结果查看  
24 -  
25 ) 20 )
26 21
27 type EntryItem struct { 22 type EntryItem struct {
@@ -42,17 +37,7 @@ type NodeContent struct { @@ -42,17 +37,7 @@ type NodeContent struct {
42 EntryItems []*EntryItem `json:"entryItems" comment:"填写项"` 37 EntryItems []*EntryItem `json:"entryItems" comment:"填写项"`
43 } 38 }
44 39
45 -//// NodeAllInvite 360°邀请  
46 -//type NodeAllInvite struct {  
47 -// ParentDifferentIds []string `json:"parentDifferentIds" comment:"不同上级同事ID"`  
48 -// ParentSameIds []string `json:"parentSameIds" comment:"相同上级同事ID"`  
49 -//}  
50 -  
51 -//// NodeKpiResult 绩效结果查看  
52 -//type NodeKpiResult struct {  
53 -//}  
54 -  
55 -// 评估流程、环节 40 +// LinkNode 评估流程、环节
56 type LinkNode struct { 41 type LinkNode struct {
57 Id int64 `json:"id,string" comment:"环节ID"` 42 Id int64 `json:"id,string" comment:"环节ID"`
58 Type int `json:"type" comment:"环节类型"` 43 Type int `json:"type" comment:"环节类型"`
@@ -64,7 +49,7 @@ type LinkNode struct { @@ -64,7 +49,7 @@ type LinkNode struct {
64 KpiCycle int `json:"kpiCycle" comment:"考核周期(1日、2周、3月)"` 49 KpiCycle int `json:"kpiCycle" comment:"考核周期(1日、2周、3月)"`
65 } 50 }
66 51
67 -// 评估模板 52 +// EvaluationTemplate 评估模板
68 type EvaluationTemplate struct { 53 type EvaluationTemplate struct {
69 Id int64 `json:"id,string" comment:"ID"` 54 Id int64 `json:"id,string" comment:"ID"`
70 Name string `json:"name" comment:"名称"` 55 Name string `json:"name" comment:"名称"`
@@ -78,14 +63,6 @@ type EvaluationTemplate struct { @@ -78,14 +63,6 @@ type EvaluationTemplate struct {
78 DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` 63 DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
79 } 64 }
80 65
81 -//type EvaluationLink struct {  
82 -// NodeSelfAssessment *LinkNode `json:"nodeSelfAssessment" comment:"填写反馈自评"`  
83 -// NodeAllInvite *LinkNode `json:"nodeAllInvite" comment:"360°邀请"`  
84 -// NodeAllAssessment *LinkNode `json:"nodeAllAssessment" comment:"360°评估"`  
85 -// NodeSuperiorAssessment *LinkNode `json:"nodeSuperiorAssessment" comment:"上级评估"`  
86 -// NodeViewResult *LinkNode `json:"nodeViewResult" comment:"绩效结果查看"`  
87 -//}  
88 -  
89 type EvaluationTemplateRepository interface { 66 type EvaluationTemplateRepository interface {
90 Insert(template *EvaluationTemplate) (*EvaluationTemplate, error) 67 Insert(template *EvaluationTemplate) (*EvaluationTemplate, error)
91 Remove(template *EvaluationTemplate) (*EvaluationTemplate, error) 68 Remove(template *EvaluationTemplate) (*EvaluationTemplate, error)
@@ -30,8 +30,8 @@ func (repo *EvaluationCycleRepository) TransformToDomain(m *models.EvaluationCyc @@ -30,8 +30,8 @@ func (repo *EvaluationCycleRepository) TransformToDomain(m *models.EvaluationCyc
30 CompanyId: m.CompanyId, 30 CompanyId: m.CompanyId,
31 CreatorId: m.CreatorId, 31 CreatorId: m.CreatorId,
32 KpiCycle: m.KpiCycle, 32 KpiCycle: m.KpiCycle,
33 - CreatedAt: m.CreatedAt,  
34 - UpdatedAt: m.UpdatedAt, 33 + CreatedAt: m.CreatedAt.Local(),
  34 + UpdatedAt: m.UpdatedAt.Local(),
35 DeletedAt: m.DeletedAt, 35 DeletedAt: m.DeletedAt,
36 } 36 }
37 } 37 }
@@ -27,8 +27,8 @@ func (repo *EvaluationCycleTemplateRepository) TransformToDomain(m *models.Evalu @@ -27,8 +27,8 @@ func (repo *EvaluationCycleTemplateRepository) TransformToDomain(m *models.Evalu
27 TemplateCreatedAt: m.TemplateCreatedAt, 27 TemplateCreatedAt: m.TemplateCreatedAt,
28 Template: m.Template, 28 Template: m.Template,
29 CycleId: m.CycleId, 29 CycleId: m.CycleId,
30 - CreatedAt: m.CreatedAt,  
31 - UpdatedAt: m.UpdatedAt, 30 + CreatedAt: m.CreatedAt.Local(),
  31 + UpdatedAt: m.UpdatedAt.Local(),
32 DeletedAt: m.DeletedAt, 32 DeletedAt: m.DeletedAt,
33 } 33 }
34 } 34 }
@@ -36,8 +36,8 @@ func (repo *EvaluationProjectRepository) TransformToDomain(m *models.EvaluationP @@ -36,8 +36,8 @@ func (repo *EvaluationProjectRepository) TransformToDomain(m *models.EvaluationP
36 Template: m.Template, 36 Template: m.Template,
37 BeginTime: m.BeginTime, 37 BeginTime: m.BeginTime,
38 EndTime: m.EndTime, 38 EndTime: m.EndTime,
39 - CreatedAt: m.CreatedAt,  
40 - UpdatedAt: m.UpdatedAt, 39 + CreatedAt: m.CreatedAt.Local(),
  40 + UpdatedAt: m.UpdatedAt.Local(),
41 DeletedAt: m.DeletedAt, 41 DeletedAt: m.DeletedAt,
42 } 42 }
43 } 43 }
@@ -31,8 +31,8 @@ func (repo *EvaluationRuleRepository) TransformToDomain(m *models.EvaluationRule @@ -31,8 +31,8 @@ func (repo *EvaluationRuleRepository) TransformToDomain(m *models.EvaluationRule
31 SysType: m.SysType, 31 SysType: m.SysType,
32 Rating: m.Rating, 32 Rating: m.Rating,
33 Score: m.Score, 33 Score: m.Score,
34 - CreatedAt: m.CreatedAt,  
35 - UpdatedAt: m.UpdatedAt, 34 + CreatedAt: m.CreatedAt.Local(), // PG库为UTC需要转成本地时间
  35 + UpdatedAt: m.UpdatedAt.Local(),
36 DeletedAt: m.DeletedAt, 36 DeletedAt: m.DeletedAt,
37 } 37 }
38 } 38 }
@@ -29,8 +29,8 @@ func (repo *EvaluationTemplateRepository) TransformToDomain(m *models.Evaluation @@ -29,8 +29,8 @@ func (repo *EvaluationTemplateRepository) TransformToDomain(m *models.Evaluation
29 CreatorId: m.CreatorId, 29 CreatorId: m.CreatorId,
30 State: m.State, 30 State: m.State,
31 LinkNodes: m.LinkNodes, 31 LinkNodes: m.LinkNodes,
32 - CreatedAt: m.CreatedAt,  
33 - UpdatedAt: m.UpdatedAt, 32 + CreatedAt: m.CreatedAt.Local(),
  33 + UpdatedAt: m.UpdatedAt.Local(),
34 DeletedAt: m.DeletedAt, 34 DeletedAt: m.DeletedAt,
35 } 35 }
36 } 36 }
@@ -21,6 +21,9 @@ func NewNodeTaskRepository(transactionContext *pgTransaction.TransactionContext) @@ -21,6 +21,9 @@ func NewNodeTaskRepository(transactionContext *pgTransaction.TransactionContext)
21 } 21 }
22 22
23 func (repo *NodeTaskRepository) TransformToDomain(m *models.NodeTask) domain.NodeTask { 23 func (repo *NodeTaskRepository) TransformToDomain(m *models.NodeTask) domain.NodeTask {
  24 + timeStart := m.TimeStart.Local()
  25 + timeEnd := m.TimeEnd.Local()
  26 + nextSentAt := m.NextSentAt.Local()
24 return domain.NodeTask{ 27 return domain.NodeTask{
25 Id: m.Id, 28 Id: m.Id,
26 CompanyId: m.CompanyId, 29 CompanyId: m.CompanyId,
@@ -31,12 +34,12 @@ func (repo *NodeTaskRepository) TransformToDomain(m *models.NodeTask) domain.Nod @@ -31,12 +34,12 @@ func (repo *NodeTaskRepository) TransformToDomain(m *models.NodeTask) domain.Nod
31 NodeName: m.NodeName, 34 NodeName: m.NodeName,
32 NodeDescribe: m.NodeDescribe, 35 NodeDescribe: m.NodeDescribe,
33 NodeSort: m.NodeSort, 36 NodeSort: m.NodeSort,
34 - TimeStart: m.TimeStart,  
35 - TimeEnd: m.TimeEnd, 37 + TimeStart: &timeStart,
  38 + TimeEnd: &timeEnd,
36 KpiCycle: m.KpiCycle, 39 KpiCycle: m.KpiCycle,
37 - NextSentAt: m.NextSentAt,  
38 - CreatedAt: m.CreatedAt,  
39 - UpdatedAt: m.UpdatedAt, 40 + NextSentAt: &nextSentAt,
  41 + CreatedAt: m.CreatedAt.Local(),
  42 + UpdatedAt: m.UpdatedAt.Local(),
40 DeletedAt: m.DeletedAt, 43 DeletedAt: m.DeletedAt,
41 } 44 }
42 } 45 }
@@ -27,8 +27,8 @@ func (repo *RoleRepository) TransformToDomain(m *models.Role) domain.Role { @@ -27,8 +27,8 @@ func (repo *RoleRepository) TransformToDomain(m *models.Role) domain.Role {
27 Type: m.Type, 27 Type: m.Type,
28 Description: m.Description, 28 Description: m.Description,
29 CompanyId: m.CompanyId, 29 CompanyId: m.CompanyId,
30 - CreatedAt: m.CreatedAt,  
31 - UpdatedAt: m.UpdatedAt, 30 + CreatedAt: m.CreatedAt.Local(),
  31 + UpdatedAt: m.UpdatedAt.Local(),
32 DeletedAt: m.DeletedAt, 32 DeletedAt: m.DeletedAt,
33 } 33 }
34 } 34 }
@@ -26,8 +26,8 @@ func (repo *RoleUserRepository) TransformToDomain(m *models.RoleUser) domain.Rol @@ -26,8 +26,8 @@ func (repo *RoleUserRepository) TransformToDomain(m *models.RoleUser) domain.Rol
26 RoleId: m.RoleId, 26 RoleId: m.RoleId,
27 UserId: m.UserId, 27 UserId: m.UserId,
28 CompanyId: m.CompanyId, 28 CompanyId: m.CompanyId,
29 - CreatedAt: m.CreatedAt,  
30 - UpdatedAt: m.UpdatedAt, 29 + CreatedAt: m.CreatedAt.Local(),
  30 + UpdatedAt: m.UpdatedAt.Local(),
31 DeletedAt: m.DeletedAt, 31 DeletedAt: m.DeletedAt,
32 } 32 }
33 } 33 }
@@ -37,7 +37,7 @@ func ValidateCommand(commandType interface{}) error { @@ -37,7 +37,7 @@ func ValidateCommand(commandType interface{}) error {
37 } 37 }
38 38
39 // NextTime 0点时刻为标准计算 39 // NextTime 0点时刻为标准计算
40 -func NextTime(now0 time.Time, start time.Time, kpiCycle int) time.Time { 40 +func NextTime(now0 time.Time, start *time.Time, kpiCycle int) time.Time {
41 year, month, day := start.Date() 41 year, month, day := start.Date()
42 // 起始时间0点时刻 42 // 起始时间0点时刻
43 start0 := time.Date(year, month, day, 0, 0, 0, 0, time.Local) 43 start0 := time.Date(year, month, day, 0, 0, 0, 0, time.Local)
@@ -141,7 +141,7 @@ func SubMonth(t1, t2 time.Time) (month int) { @@ -141,7 +141,7 @@ func SubMonth(t1, t2 time.Time) (month int) {
141 } 141 }
142 142
143 // NextTimeInc 0点时刻为标准计算 143 // NextTimeInc 0点时刻为标准计算
144 -func NextTimeInc(start time.Time, kpiCycle int) time.Time { 144 +func NextTimeInc(start *time.Time, kpiCycle int) time.Time {
145 year, month, day := start.Date() 145 year, month, day := start.Date()
146 // 起始时间0点时刻 146 // 起始时间0点时刻
147 start0 := time.Date(year, month, day, 0, 0, 0, 0, time.Local) 147 start0 := time.Date(year, month, day, 0, 0, 0, 0, time.Local)