作者 tangxvhui

修复一些问题

... ... @@ -174,7 +174,7 @@ func (notices *notifySms) sendSms(param *domain.LogSms) error {
}
func dayZeroTime(t time.Time) time.Time {
y, m, d := t.UTC().Date()
t2 := time.Date(y, m, d, 0, 0, 0, 0, time.UTC)
y, m, d := t.Local().Date()
t2 := time.Date(y, m, d, 0, 0, 0, 0, time.Local)
return t2
}
... ...
... ... @@ -33,7 +33,11 @@ func (notices notifyStaffAssess) makeNotify(param *domain.StaffAssess) *domain.L
CreatedAt: time.Now(),
}
// 每日自评 结束前30 分钟
newSms.ExecuteAt = param.EndTime.Add(-1800 * time.Second)
// newSms.ExecuteAt = param.EndTime.Add(-1800 * time.Second)
//改为 固定在截止时间 那天的 前一天晚上10
y, m, d := param.EndTime.Local().Date()
dayTime := time.Date(y, m, d, 0, 0, 0, 0, time.Local)
newSms.ExecuteAt = dayTime.Add(-2 * time.Hour)
return &newSms
}
... ...
... ... @@ -34,7 +34,11 @@ func (notices notifySummaryEvaluation) makeNotify(param *domain.SummaryEvaluatio
CreatedAt: time.Now(),
}
// 周期自评结束前4个小时,
newSms.ExecuteAt = param.EndTime.Add(-4 * time.Hour)
// newSms.ExecuteAt = param.EndTime.Add(-4 * time.Hour)
//改为 固定在截止时间 那天的 前一天晚上10
y, m, d := param.EndTime.Local().Date()
dayTime := time.Date(y, m, d, 0, 0, 0, 0, time.Local)
newSms.ExecuteAt = dayTime.Add(-2 * time.Hour)
return &newSms
}
... ...
... ... @@ -25,17 +25,26 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationSuper(param *command.Que
defer func() {
_ = transactionContext.RollbackTransaction()
}()
//判断是否是hrbp
flagHrbp, err := roleService.GetHRBP(transactionContext, param.CompanyId, param.UserId)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if flagHrbp != 1 {
return nil, application.ThrowError(application.TRANSACTION_ERROR, "没有操作权限")
return nil, application.ThrowError(application.BUSINESS_ERROR, "暂无数据")
}
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
//判断是否是上级
userRepo := factory.CreateUserRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
userRepo := factory.CreateUserRepository(map[string]interface{}{
_, parentUser, _ := userRepo.Find(map[string]interface{}{
"parentId": param.UserId,
"limit": 1,
})
if len(parentUser) == 0 {
return nil, application.ThrowError(application.BUSINESS_ERROR, "暂无数据")
}
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
positionRepo := factory.CreatePositionRepository(map[string]interface{}{
... ...
... ... @@ -1458,7 +1458,6 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command
// 获取周期综合评估下,周期评估列表
func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.QueryEvaluationList) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -1469,19 +1468,30 @@ func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.Query
defer func() {
_ = transactionContext.RollbackTransaction()
}()
//判断是否是hrbp
flagHrbp, err := roleService.GetHRBP(transactionContext, param.CompanyId, param.UserId)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if flagHrbp != 1 {
return map[string]interface{}{}, nil
return tool_funs.SimpleWrapGridMap(0, []string{}), nil
}
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
//判断是否是上级
userRepo := factory.CreateUserRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
userRepo := factory.CreateUserRepository(map[string]interface{}{
_, parentUser, _ := userRepo.Find(map[string]interface{}{
"parentId": param.UserId,
"limit": 1,
})
if len(parentUser) == 0 {
return tool_funs.SimpleWrapGridMap(0, []string{}), nil
}
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
positionRepo := factory.CreatePositionRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
... ...
... ... @@ -39,10 +39,11 @@ type RatingCodeNumber struct {
type EvaluationType int //综合评估类型
const (
EvaluationSelf EvaluationType = 1 //自评
Evaluation360 EvaluationType = 2 //360评估
EvaluationSuper EvaluationType = 3 //上级评估
EvaluationHrbp EvaluationType = 4 //人资评估
EvaluationSelf EvaluationType = 1 //自评
Evaluation360 EvaluationType = 2 //360评估
EvaluationSuper EvaluationType = 3 //上级评估
EvaluationHrbp EvaluationType = 4 //人资评估
EvaluationFinish EvaluationType = 5 //评估考核结果 TODO
)
// 评估的填写状态
... ...
... ... @@ -141,6 +141,10 @@ func (repo *UserRepository) Find(queryOptions map[string]interface{}) (int, []*d
query.Where("name in(?)", pg.In(v))
}
if v, ok := queryOptions["parentId"]; ok {
query.Where("parent_id=?", v)
}
if v, ok := queryOptions["offset"]; ok {
if value, ok := v.(int); ok {
query.Offset(value)
... ...