This commit is contained in:
jiangyong 2025-03-15 00:13:13 +08:00
parent 5550f302bd
commit 722c724b8e
2 changed files with 2 additions and 13 deletions

View File

@ -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
}

View File

@ -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())