作者 tangxvhui
... ... @@ -185,18 +185,18 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp
// 重新计算
if task.NextSentAt == nil {
// 环节起始和截止本地时间
startLocal := task.TimeStart.Local()
endLocal := task.TimeEnd.Local()
startLocal := task.TimeStart
endLocal := task.TimeEnd
// 在当前时间之前,则计算下一个周期时间
if startLocal.Before(now) {
nextTime := utils.NextTime(nowO, startLocal, task.KpiCycle)
task.NextSentAt = &nextTime
} else {
task.NextSentAt = &startLocal
task.NextSentAt = startLocal
}
// 如果超出截至时间,则周期置空
if task.NextSentAt.After(endLocal) {
if task.NextSentAt.After(endLocal.Local()) {
task.NextSentAt = nil
}
} else {
... ... @@ -468,18 +468,18 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand)
}
// 环节起始和截止本地时间
startLocal := node.TimeStart.Local()
endLocal := node.TimeEnd.Local()
startLocal := node.TimeStart
endLocal := node.TimeEnd
// 在当前时间之前,则计算下一个周期时间
if startLocal.Before(now) {
nextTime := utils.NextTime(nowO, startLocal, node.KpiCycle)
task.NextSentAt = &nextTime
} else {
task.NextSentAt = &startLocal
task.NextSentAt = startLocal
}
// 如果超出截至时间,则周期置空
if task.NextSentAt.After(endLocal) {
if task.NextSentAt.After(endLocal.Local()) {
task.NextSentAt = nil
}
... ...
... ... @@ -87,7 +87,7 @@ func (rs *NodeTaskService) SendEvaluationNode() error {
maxTime := task.TimeEnd.Local()
// 当前周起始时间和截止时间
var cycleTimeStart = task.NextSentAt.Local()
var cycleTimeStart = task.NextSentAt
var cycleTimeEnd time.Time
// 下个周期起始时间
... ...
... ... @@ -17,11 +17,6 @@ const (
LinkNodeAllAssessment int = 3 // 环节-360°评估
LinkNodeSuperiorAssessment int = 4 // 环节-上级评估
LinkNodeViewResult int = 5 // 环节-绩效结果查看
//LinkNodeAssessment int = 1 // 环节-评估(自评、360°评估、上级评估)
//LinkNodeAllInvite int = 2 // 环节-360°邀请
//LinkNodeViewResult int = 3 // 环节-绩效结果查看
)
type EntryItem struct {
... ... @@ -42,17 +37,7 @@ type NodeContent struct {
EntryItems []*EntryItem `json:"entryItems" comment:"填写项"`
}
//// NodeAllInvite 360°邀请
//type NodeAllInvite struct {
// ParentDifferentIds []string `json:"parentDifferentIds" comment:"不同上级同事ID"`
// ParentSameIds []string `json:"parentSameIds" comment:"相同上级同事ID"`
//}
//// NodeKpiResult 绩效结果查看
//type NodeKpiResult struct {
//}
// 评估流程、环节
// LinkNode 评估流程、环节
type LinkNode struct {
Id int64 `json:"id,string" comment:"环节ID"`
Type int `json:"type" comment:"环节类型"`
... ... @@ -64,7 +49,7 @@ type LinkNode struct {
KpiCycle int `json:"kpiCycle" comment:"考核周期(1日、2周、3月)"`
}
// 评估模板
// EvaluationTemplate 评估模板
type EvaluationTemplate struct {
Id int64 `json:"id,string" comment:"ID"`
Name string `json:"name" comment:"名称"`
... ... @@ -78,14 +63,6 @@ type EvaluationTemplate struct {
DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
}
//type EvaluationLink struct {
// NodeSelfAssessment *LinkNode `json:"nodeSelfAssessment" comment:"填写反馈自评"`
// NodeAllInvite *LinkNode `json:"nodeAllInvite" comment:"360°邀请"`
// NodeAllAssessment *LinkNode `json:"nodeAllAssessment" comment:"360°评估"`
// NodeSuperiorAssessment *LinkNode `json:"nodeSuperiorAssessment" comment:"上级评估"`
// NodeViewResult *LinkNode `json:"nodeViewResult" comment:"绩效结果查看"`
//}
type EvaluationTemplateRepository interface {
Insert(template *EvaluationTemplate) (*EvaluationTemplate, error)
Remove(template *EvaluationTemplate) (*EvaluationTemplate, error)
... ...
... ... @@ -30,8 +30,8 @@ func (repo *EvaluationCycleRepository) TransformToDomain(m *models.EvaluationCyc
CompanyId: m.CompanyId,
CreatorId: m.CreatorId,
KpiCycle: m.KpiCycle,
CreatedAt: m.CreatedAt,
UpdatedAt: m.UpdatedAt,
CreatedAt: m.CreatedAt.Local(),
UpdatedAt: m.UpdatedAt.Local(),
DeletedAt: m.DeletedAt,
}
}
... ...
... ... @@ -27,8 +27,8 @@ func (repo *EvaluationCycleTemplateRepository) TransformToDomain(m *models.Evalu
TemplateCreatedAt: m.TemplateCreatedAt,
Template: m.Template,
CycleId: m.CycleId,
CreatedAt: m.CreatedAt,
UpdatedAt: m.UpdatedAt,
CreatedAt: m.CreatedAt.Local(),
UpdatedAt: m.UpdatedAt.Local(),
DeletedAt: m.DeletedAt,
}
}
... ...
... ... @@ -36,8 +36,8 @@ func (repo *EvaluationProjectRepository) TransformToDomain(m *models.EvaluationP
Template: m.Template,
BeginTime: m.BeginTime,
EndTime: m.EndTime,
CreatedAt: m.CreatedAt,
UpdatedAt: m.UpdatedAt,
CreatedAt: m.CreatedAt.Local(),
UpdatedAt: m.UpdatedAt.Local(),
DeletedAt: m.DeletedAt,
}
}
... ...
... ... @@ -31,8 +31,8 @@ func (repo *EvaluationRuleRepository) TransformToDomain(m *models.EvaluationRule
SysType: m.SysType,
Rating: m.Rating,
Score: m.Score,
CreatedAt: m.CreatedAt,
UpdatedAt: m.UpdatedAt,
CreatedAt: m.CreatedAt.Local(), // PG库为UTC需要转成本地时间
UpdatedAt: m.UpdatedAt.Local(),
DeletedAt: m.DeletedAt,
}
}
... ...
... ... @@ -29,8 +29,8 @@ func (repo *EvaluationTemplateRepository) TransformToDomain(m *models.Evaluation
CreatorId: m.CreatorId,
State: m.State,
LinkNodes: m.LinkNodes,
CreatedAt: m.CreatedAt,
UpdatedAt: m.UpdatedAt,
CreatedAt: m.CreatedAt.Local(),
UpdatedAt: m.UpdatedAt.Local(),
DeletedAt: m.DeletedAt,
}
}
... ...
... ... @@ -21,6 +21,9 @@ func NewNodeTaskRepository(transactionContext *pgTransaction.TransactionContext)
}
func (repo *NodeTaskRepository) TransformToDomain(m *models.NodeTask) domain.NodeTask {
timeStart := m.TimeStart.Local()
timeEnd := m.TimeEnd.Local()
nextSentAt := m.NextSentAt.Local()
return domain.NodeTask{
Id: m.Id,
CompanyId: m.CompanyId,
... ... @@ -31,12 +34,12 @@ func (repo *NodeTaskRepository) TransformToDomain(m *models.NodeTask) domain.Nod
NodeName: m.NodeName,
NodeDescribe: m.NodeDescribe,
NodeSort: m.NodeSort,
TimeStart: m.TimeStart,
TimeEnd: m.TimeEnd,
TimeStart: &timeStart,
TimeEnd: &timeEnd,
KpiCycle: m.KpiCycle,
NextSentAt: m.NextSentAt,
CreatedAt: m.CreatedAt,
UpdatedAt: m.UpdatedAt,
NextSentAt: &nextSentAt,
CreatedAt: m.CreatedAt.Local(),
UpdatedAt: m.UpdatedAt.Local(),
DeletedAt: m.DeletedAt,
}
}
... ...
... ... @@ -27,8 +27,8 @@ func (repo *RoleRepository) TransformToDomain(m *models.Role) domain.Role {
Type: m.Type,
Description: m.Description,
CompanyId: m.CompanyId,
CreatedAt: m.CreatedAt,
UpdatedAt: m.UpdatedAt,
CreatedAt: m.CreatedAt.Local(),
UpdatedAt: m.UpdatedAt.Local(),
DeletedAt: m.DeletedAt,
}
}
... ...
... ... @@ -26,8 +26,8 @@ func (repo *RoleUserRepository) TransformToDomain(m *models.RoleUser) domain.Rol
RoleId: m.RoleId,
UserId: m.UserId,
CompanyId: m.CompanyId,
CreatedAt: m.CreatedAt,
UpdatedAt: m.UpdatedAt,
CreatedAt: m.CreatedAt.Local(),
UpdatedAt: m.UpdatedAt.Local(),
DeletedAt: m.DeletedAt,
}
}
... ...
... ... @@ -37,7 +37,7 @@ func ValidateCommand(commandType interface{}) error {
}
// NextTime 0点时刻为标准计算
func NextTime(now0 time.Time, start time.Time, kpiCycle int) time.Time {
func NextTime(now0 time.Time, start *time.Time, kpiCycle int) time.Time {
year, month, day := start.Date()
// 起始时间0点时刻
start0 := time.Date(year, month, day, 0, 0, 0, 0, time.Local)
... ... @@ -141,7 +141,7 @@ func SubMonth(t1, t2 time.Time) (month int) {
}
// NextTimeInc 0点时刻为标准计算
func NextTimeInc(start time.Time, kpiCycle int) time.Time {
func NextTimeInc(start *time.Time, kpiCycle int) time.Time {
year, month, day := start.Date()
// 起始时间0点时刻
start0 := time.Date(year, month, day, 0, 0, 0, 0, time.Local)
... ...