作者 郑周

1. 命名优化

@@ -74,7 +74,7 @@ func (rs *PermissionService) Update(in *command.UpdatePermissionCommand) (interf @@ -74,7 +74,7 @@ func (rs *PermissionService) Update(in *command.UpdatePermissionCommand) (interf
74 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "截止时间:[查看我的绩效]不能小于[上级评估]") 74 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "截止时间:[查看我的绩效]不能小于[上级评估]")
75 } 75 }
76 permission.OptConfirmPerf = in.OptConfirmPerf 76 permission.OptConfirmPerf = in.OptConfirmPerf
77 - permission.CycleDeadLine = in.CycleDeadLine 77 + permission.CycleDeadline = in.CycleDeadLine
78 } 78 }
79 79
80 permission, err = permissionRepository.Insert(permission) 80 permission, err = permissionRepository.Insert(permission)
@@ -88,6 +88,8 @@ func (rs *PermissionService) Update(in *command.UpdatePermissionCommand) (interf @@ -88,6 +88,8 @@ func (rs *PermissionService) Update(in *command.UpdatePermissionCommand) (interf
88 } 88 }
89 89
90 func (rs *PermissionService) Get(in *command.GetPermissionCommand) (*domain.Permission, error) { 90 func (rs *PermissionService) Get(in *command.GetPermissionCommand) (*domain.Permission, error) {
  91 + in.CompanyId = 8
  92 +
91 transactionContext, err := factory.ValidateStartTransaction(in) 93 transactionContext, err := factory.ValidateStartTransaction(in)
92 if err != nil { 94 if err != nil {
93 return nil, err 95 return nil, err
@@ -110,7 +112,7 @@ func (rs *PermissionService) Get(in *command.GetPermissionCommand) (*domain.Perm @@ -110,7 +112,7 @@ func (rs *PermissionService) Get(in *command.GetPermissionCommand) (*domain.Perm
110 OptHrScore: domain.PermissionOff, 112 OptHrScore: domain.PermissionOff,
111 OptEvalScore: domain.PermissionOff, 113 OptEvalScore: domain.PermissionOff,
112 OptConfirmPerf: domain.PermissionOff, 114 OptConfirmPerf: domain.PermissionOff,
113 - CycleDeadLine: rs.defaultCycleDeadline(), 115 + CycleDeadline: rs.defaultCycleDeadline(),
114 } 116 }
115 permission, err = permissionRepository.Insert(value) 117 permission, err = permissionRepository.Insert(value)
116 if err != nil { 118 if err != nil {
@@ -132,9 +134,9 @@ func (rs *PermissionService) Get(in *command.GetPermissionCommand) (*domain.Perm @@ -132,9 +134,9 @@ func (rs *PermissionService) Get(in *command.GetPermissionCommand) (*domain.Perm
132 isChange = true 134 isChange = true
133 permission.OptConfirmPerf = domain.PermissionOff 135 permission.OptConfirmPerf = domain.PermissionOff
134 } 136 }
135 - if permission.CycleDeadLine == nil { 137 + if permission.CycleDeadline == nil {
136 isChange = true 138 isChange = true
137 - permission.CycleDeadLine = rs.defaultCycleDeadline() 139 + permission.CycleDeadline = rs.defaultCycleDeadline()
138 } 140 }
139 if isChange { 141 if isChange {
140 permission, err = permissionRepository.Insert(permission) 142 permission, err = permissionRepository.Insert(permission)
@@ -169,26 +169,26 @@ func (se *summaryEvaluationPublisher) sendSummaryEvaluationV2( @@ -169,26 +169,26 @@ func (se *summaryEvaluationPublisher) sendSummaryEvaluationV2(
169 beginTimeSelf := *cycleData.TimeEnd // 169 beginTimeSelf := *cycleData.TimeEnd //
170 beginDay := dayEndTime(beginTimeSelf) 170 beginDay := dayEndTime(beginTimeSelf)
171 //修改 周期结束时间那天的第二天开始计算 171 //修改 周期结束时间那天的第二天开始计算
172 - endTimeSelf := beginDay.Add(time.Duration(permissioData.CycleDeadLine.AssessmentSelf.Hour) * time.Hour).  
173 - Add(time.Duration(permissioData.CycleDeadLine.AssessmentSelf.Minute) * time.Minute) 172 + endTimeSelf := beginDay.Add(time.Duration(permissioData.CycleDeadline.AssessmentSelf.Hour) * time.Hour).
  173 + Add(time.Duration(permissioData.CycleDeadline.AssessmentSelf.Minute) * time.Minute)
174 //人资、360评估的时间范围 174 //人资、360评估的时间范围
175 beginTime360 := endTimeSelf 175 beginTime360 := endTimeSelf
176 - endTime360 := beginDay.Add(time.Duration(permissioData.CycleDeadLine.AssessmentAll.Hour) * time.Hour).  
177 - Add(time.Duration(permissioData.CycleDeadLine.AssessmentAll.Minute) * time.Minute) 176 + endTime360 := beginDay.Add(time.Duration(permissioData.CycleDeadline.AssessmentAll.Hour) * time.Hour).
  177 + Add(time.Duration(permissioData.CycleDeadline.AssessmentAll.Minute) * time.Minute)
178 //人资评估的时间范围 178 //人资评估的时间范围
179 beginTimeHr := endTimeSelf 179 beginTimeHr := endTimeSelf
180 - endTimeHr := beginDay.Add(time.Duration(permissioData.CycleDeadLine.AssessmentHr.Hour) * time.Hour).  
181 - Add(time.Duration(permissioData.CycleDeadLine.AssessmentHr.Minute) * time.Minute) 180 + endTimeHr := beginDay.Add(time.Duration(permissioData.CycleDeadline.AssessmentHr.Hour) * time.Hour).
  181 + Add(time.Duration(permissioData.CycleDeadline.AssessmentHr.Minute) * time.Minute)
182 182
183 //上级评估的是时间范围 183 //上级评估的是时间范围
184 beginTimeSuper := endTimeHr 184 beginTimeSuper := endTimeHr
185 - endTimeSuper := beginDay.Add(time.Duration(permissioData.CycleDeadLine.AssessmentSuperior.Hour) * time.Hour).  
186 - Add(time.Duration(permissioData.CycleDeadLine.AssessmentSuperior.Minute) * time.Minute) 185 + endTimeSuper := beginDay.Add(time.Duration(permissioData.CycleDeadline.AssessmentSuperior.Hour) * time.Hour).
  186 + Add(time.Duration(permissioData.CycleDeadline.AssessmentSuperior.Minute) * time.Minute)
187 187
188 //考核结果的时间范围 188 //考核结果的时间范围
189 beginTimeFinish := endTimeSuper 189 beginTimeFinish := endTimeSuper
190 - endTimeFinish := beginDay.Add(time.Duration(permissioData.CycleDeadLine.ViewMyPerf.Hour) * time.Hour).  
191 - Add(time.Duration(permissioData.CycleDeadLine.ViewMyPerf.Minute) * time.Minute) 190 + endTimeFinish := beginDay.Add(time.Duration(permissioData.CycleDeadline.ViewMyPerf.Hour) * time.Hour).
  191 + Add(time.Duration(permissioData.CycleDeadline.ViewMyPerf.Minute) * time.Minute)
192 // 创建周期评估任务 192 // 创建周期评估任务
193 var newEvaluationList []domain.SummaryEvaluation 193 var newEvaluationList []domain.SummaryEvaluation
194 evaluationTemp := domain.SummaryEvaluation{ 194 evaluationTemp := domain.SummaryEvaluation{
@@ -13,7 +13,7 @@ type Permission struct { @@ -13,7 +13,7 @@ type Permission struct {
13 OptHrScore int `json:"optHrScore" comment:"上级是否可以修改人资综评分数"` 13 OptHrScore int `json:"optHrScore" comment:"上级是否可以修改人资综评分数"`
14 OptEvalScore int `json:"optEvalScore" comment:"上级是否可以修改360°综评分数"` 14 OptEvalScore int `json:"optEvalScore" comment:"上级是否可以修改360°综评分数"`
15 OptConfirmPerf int `json:"optConfirmPerf " comment:"是否需要员工确认绩效"` 15 OptConfirmPerf int `json:"optConfirmPerf " comment:"是否需要员工确认绩效"`
16 - CycleDeadLine *CycleDeadline `json:"cycleDeadline" comment:"周期评估各业务截止时间"` 16 + CycleDeadline *CycleDeadline `json:"cycleDeadline" comment:"周期评估各业务截止时间"`
17 CreatedAt time.Time `json:"createdAt" comment:"创建时间"` 17 CreatedAt time.Time `json:"createdAt" comment:"创建时间"`
18 UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"` 18 UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"`
19 DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` 19 DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
@@ -12,7 +12,7 @@ type Permission struct { @@ -12,7 +12,7 @@ type Permission struct {
12 OptHrScore int `comment:"上级是否可以修改人资综评分数"` 12 OptHrScore int `comment:"上级是否可以修改人资综评分数"`
13 OptEvalScore int `comment:"上级是否可以修改360°综评分数"` 13 OptEvalScore int `comment:"上级是否可以修改360°综评分数"`
14 OptConfirmPerf int `comment:"是否需要员工确认绩效"` 14 OptConfirmPerf int `comment:"是否需要员工确认绩效"`
15 - CycleDeadLine *domain.CycleDeadline `comment:"周期评估各业务截止时间"` 15 + CycleDeadline *domain.CycleDeadline `comment:"周期评估各业务截止时间"`
16 CreatedAt time.Time `comment:"创建时间"` 16 CreatedAt time.Time `comment:"创建时间"`
17 UpdatedAt time.Time `comment:"更新时间"` 17 UpdatedAt time.Time `comment:"更新时间"`
18 DeletedAt *time.Time `comment:"删除时间"` 18 DeletedAt *time.Time `comment:"删除时间"`
@@ -27,7 +27,7 @@ func (repo *PermissionRepository) TransformToDomain(m *models.Permission) domain @@ -27,7 +27,7 @@ func (repo *PermissionRepository) TransformToDomain(m *models.Permission) domain
27 OptHrScore: m.OptHrScore, 27 OptHrScore: m.OptHrScore,
28 OptEvalScore: m.OptEvalScore, 28 OptEvalScore: m.OptEvalScore,
29 OptConfirmPerf: m.OptConfirmPerf, 29 OptConfirmPerf: m.OptConfirmPerf,
30 - CycleDeadLine: m.CycleDeadLine, 30 + CycleDeadline: m.CycleDeadline,
31 CreatedAt: m.CreatedAt.Local(), 31 CreatedAt: m.CreatedAt.Local(),
32 UpdatedAt: m.UpdatedAt.Local(), 32 UpdatedAt: m.UpdatedAt.Local(),
33 DeletedAt: m.DeletedAt, 33 DeletedAt: m.DeletedAt,
@@ -41,7 +41,7 @@ func (repo *PermissionRepository) TransformToModel(d *domain.Permission) models. @@ -41,7 +41,7 @@ func (repo *PermissionRepository) TransformToModel(d *domain.Permission) models.
41 OptHrScore: d.OptHrScore, 41 OptHrScore: d.OptHrScore,
42 OptEvalScore: d.OptEvalScore, 42 OptEvalScore: d.OptEvalScore,
43 OptConfirmPerf: d.OptConfirmPerf, 43 OptConfirmPerf: d.OptConfirmPerf,
44 - CycleDeadLine: d.CycleDeadLine, 44 + CycleDeadline: d.CycleDeadline,
45 CreatedAt: d.CreatedAt, 45 CreatedAt: d.CreatedAt,
46 UpdatedAt: d.UpdatedAt, 46 UpdatedAt: d.UpdatedAt,
47 DeletedAt: d.DeletedAt, 47 DeletedAt: d.DeletedAt,