From 722c724b8e91db2c449f5c7df76e3514f0545ec6 Mon Sep 17 00:00:00 2001 From: jiangyong Date: Sat, 15 Mar 2025 00:13:13 +0800 Subject: [PATCH] offline --- service/staff_salary.go | 4 ++-- worker/staff.go | 11 ----------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/service/staff_salary.go b/service/staff_salary.go index 2ce9214..9956cd7 100644 --- a/service/staff_salary.go +++ b/service/staff_salary.go @@ -40,8 +40,8 @@ func (s *StaffSalary) CalcSalary(salary *model.StaffSalary, month string) (*mode isEntryMonth := goutil.If(cast.ToInt(entryTime.Format("200601")) == cast.ToInt(month), true, false) isLeaveMonth := goutil.If(cast.ToInt(leaveTime.Format("200601")) == cast.ToInt(month), true, false) - //入职之前的工资不计算 - if cast.ToInt(month) < cast.ToInt(entryTime.Format("200601")) { + //入职之前或离职之后的工资不计算 + if cast.ToInt(month) < cast.ToInt(entryTime.Format("200601")) || cast.ToInt(month) > cast.ToInt(leaveTime.Format("200601")) { return nil, nil } diff --git a/worker/staff.go b/worker/staff.go index d2cb0f6..c2828b5 100644 --- a/worker/staff.go +++ b/worker/staff.go @@ -7,8 +7,6 @@ import ( "enterprise/service" "fmt" log "github.com/sirupsen/logrus" - "github.com/smbrave/goutil" - "github.com/spf13/cast" "strings" "time" ) @@ -124,15 +122,6 @@ func (s *Staff) SyncStaffSalary(corpId int64, month string) { return } for _, staff := range staffs { - // 已离职的员工不处理 - if staff.LeaveDate != "" { - leaveTime, _ := time.ParseInLocation("2006-01-02", staff.LeaveDate, time.Local) - isLeaveMonth := goutil.If(cast.ToInt(leaveTime.Format("200601")) == cast.ToInt(month), true, false) - if !isLeaveMonth { - continue - } - } - salary, err := dao.NewStaffSalaryDao().GetBy(corpId, staff.Id, month) if err != nil { log.Errorf("db error :%s", err.Error())