作者 tangxvhui

修复一些问题

@@ -174,7 +174,7 @@ func (notices *notifySms) sendSms(param *domain.LogSms) error { @@ -174,7 +174,7 @@ func (notices *notifySms) sendSms(param *domain.LogSms) error {
174 } 174 }
175 175
176 func dayZeroTime(t time.Time) time.Time { 176 func dayZeroTime(t time.Time) time.Time {
177 - y, m, d := t.UTC().Date()  
178 - t2 := time.Date(y, m, d, 0, 0, 0, 0, time.UTC) 177 + y, m, d := t.Local().Date()
  178 + t2 := time.Date(y, m, d, 0, 0, 0, 0, time.Local)
179 return t2 179 return t2
180 } 180 }
@@ -33,7 +33,11 @@ func (notices notifyStaffAssess) makeNotify(param *domain.StaffAssess) *domain.L @@ -33,7 +33,11 @@ func (notices notifyStaffAssess) makeNotify(param *domain.StaffAssess) *domain.L
33 CreatedAt: time.Now(), 33 CreatedAt: time.Now(),
34 } 34 }
35 // 每日自评 结束前30 分钟 35 // 每日自评 结束前30 分钟
36 - newSms.ExecuteAt = param.EndTime.Add(-1800 * time.Second) 36 + // newSms.ExecuteAt = param.EndTime.Add(-1800 * time.Second)
  37 + //改为 固定在截止时间 那天的 前一天晚上10
  38 + y, m, d := param.EndTime.Local().Date()
  39 + dayTime := time.Date(y, m, d, 0, 0, 0, 0, time.Local)
  40 + newSms.ExecuteAt = dayTime.Add(-2 * time.Hour)
37 return &newSms 41 return &newSms
38 } 42 }
39 43
@@ -34,7 +34,11 @@ func (notices notifySummaryEvaluation) makeNotify(param *domain.SummaryEvaluatio @@ -34,7 +34,11 @@ func (notices notifySummaryEvaluation) makeNotify(param *domain.SummaryEvaluatio
34 CreatedAt: time.Now(), 34 CreatedAt: time.Now(),
35 } 35 }
36 // 周期自评结束前4个小时, 36 // 周期自评结束前4个小时,
37 - newSms.ExecuteAt = param.EndTime.Add(-4 * time.Hour) 37 + // newSms.ExecuteAt = param.EndTime.Add(-4 * time.Hour)
  38 + //改为 固定在截止时间 那天的 前一天晚上10
  39 + y, m, d := param.EndTime.Local().Date()
  40 + dayTime := time.Date(y, m, d, 0, 0, 0, 0, time.Local)
  41 + newSms.ExecuteAt = dayTime.Add(-2 * time.Hour)
38 return &newSms 42 return &newSms
39 } 43 }
40 44
@@ -25,17 +25,26 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationSuper(param *command.Que @@ -25,17 +25,26 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationSuper(param *command.Que
25 defer func() { 25 defer func() {
26 _ = transactionContext.RollbackTransaction() 26 _ = transactionContext.RollbackTransaction()
27 }() 27 }()
  28 + //判断是否是hrbp
28 flagHrbp, err := roleService.GetHRBP(transactionContext, param.CompanyId, param.UserId) 29 flagHrbp, err := roleService.GetHRBP(transactionContext, param.CompanyId, param.UserId)
29 if err != nil { 30 if err != nil {
30 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 31 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
31 } 32 }
32 if flagHrbp != 1 { 33 if flagHrbp != 1 {
33 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "没有操作权限") 34 + return nil, application.ThrowError(application.BUSINESS_ERROR, "暂无数据")
34 } 35 }
35 - evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{ 36 + //判断是否是上级
  37 + userRepo := factory.CreateUserRepository(map[string]interface{}{
36 "transactionContext": transactionContext, 38 "transactionContext": transactionContext,
37 }) 39 })
38 - userRepo := factory.CreateUserRepository(map[string]interface{}{ 40 + _, parentUser, _ := userRepo.Find(map[string]interface{}{
  41 + "parentId": param.UserId,
  42 + "limit": 1,
  43 + })
  44 + if len(parentUser) == 0 {
  45 + return nil, application.ThrowError(application.BUSINESS_ERROR, "暂无数据")
  46 + }
  47 + evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
39 "transactionContext": transactionContext, 48 "transactionContext": transactionContext,
40 }) 49 })
41 positionRepo := factory.CreatePositionRepository(map[string]interface{}{ 50 positionRepo := factory.CreatePositionRepository(map[string]interface{}{
@@ -1458,7 +1458,6 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command @@ -1458,7 +1458,6 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command
1458 1458
1459 // 获取周期综合评估下,周期评估列表 1459 // 获取周期综合评估下,周期评估列表
1460 func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.QueryEvaluationList) (map[string]interface{}, error) { 1460 func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.QueryEvaluationList) (map[string]interface{}, error) {
1461 -  
1462 transactionContext, err := factory.CreateTransactionContext(nil) 1461 transactionContext, err := factory.CreateTransactionContext(nil)
1463 if err != nil { 1462 if err != nil {
1464 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 1463 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -1469,19 +1468,30 @@ func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.Query @@ -1469,19 +1468,30 @@ func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.Query
1469 defer func() { 1468 defer func() {
1470 _ = transactionContext.RollbackTransaction() 1469 _ = transactionContext.RollbackTransaction()
1471 }() 1470 }()
  1471 + //判断是否是hrbp
1472 flagHrbp, err := roleService.GetHRBP(transactionContext, param.CompanyId, param.UserId) 1472 flagHrbp, err := roleService.GetHRBP(transactionContext, param.CompanyId, param.UserId)
1473 if err != nil { 1473 if err != nil {
1474 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1474 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1475 } 1475 }
1476 if flagHrbp != 1 { 1476 if flagHrbp != 1 {
1477 - return map[string]interface{}{}, nil 1477 + return tool_funs.SimpleWrapGridMap(0, []string{}), nil
1478 } 1478 }
1479 - evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{ 1479 + //判断是否是上级
  1480 + userRepo := factory.CreateUserRepository(map[string]interface{}{
1480 "transactionContext": transactionContext, 1481 "transactionContext": transactionContext,
1481 }) 1482 })
1482 - userRepo := factory.CreateUserRepository(map[string]interface{}{ 1483 +
  1484 + _, parentUser, _ := userRepo.Find(map[string]interface{}{
  1485 + "parentId": param.UserId,
  1486 + "limit": 1,
  1487 + })
  1488 + if len(parentUser) == 0 {
  1489 + return tool_funs.SimpleWrapGridMap(0, []string{}), nil
  1490 + }
  1491 + evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
1483 "transactionContext": transactionContext, 1492 "transactionContext": transactionContext,
1484 }) 1493 })
  1494 +
1485 positionRepo := factory.CreatePositionRepository(map[string]interface{}{ 1495 positionRepo := factory.CreatePositionRepository(map[string]interface{}{
1486 "transactionContext": transactionContext, 1496 "transactionContext": transactionContext,
1487 }) 1497 })
@@ -43,6 +43,7 @@ const ( @@ -43,6 +43,7 @@ const (
43 Evaluation360 EvaluationType = 2 //360评估 43 Evaluation360 EvaluationType = 2 //360评估
44 EvaluationSuper EvaluationType = 3 //上级评估 44 EvaluationSuper EvaluationType = 3 //上级评估
45 EvaluationHrbp EvaluationType = 4 //人资评估 45 EvaluationHrbp EvaluationType = 4 //人资评估
  46 + EvaluationFinish EvaluationType = 5 //评估考核结果 TODO
46 ) 47 )
47 48
48 // 评估的填写状态 49 // 评估的填写状态
@@ -141,6 +141,10 @@ func (repo *UserRepository) Find(queryOptions map[string]interface{}) (int, []*d @@ -141,6 +141,10 @@ func (repo *UserRepository) Find(queryOptions map[string]interface{}) (int, []*d
141 query.Where("name in(?)", pg.In(v)) 141 query.Where("name in(?)", pg.In(v))
142 } 142 }
143 143
  144 + if v, ok := queryOptions["parentId"]; ok {
  145 + query.Where("parent_id=?", v)
  146 + }
  147 +
144 if v, ok := queryOptions["offset"]; ok { 148 if v, ok := queryOptions["offset"]; ok {
145 if value, ok := v.(int); ok { 149 if value, ok := v.(int); ok {
146 query.Offset(value) 150 query.Offset(value)