offline
This commit is contained in:
parent
5550f302bd
commit
722c724b8e
|
@ -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)
|
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)
|
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
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,6 @@ import (
|
||||||
"enterprise/service"
|
"enterprise/service"
|
||||||
"fmt"
|
"fmt"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/smbrave/goutil"
|
|
||||||
"github.com/spf13/cast"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -124,15 +122,6 @@ func (s *Staff) SyncStaffSalary(corpId int64, month string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, staff := range staffs {
|
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)
|
salary, err := dao.NewStaffSalaryDao().GetBy(corpId, staff.Id, month)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("db error :%s", err.Error())
|
log.Errorf("db error :%s", err.Error())
|
||||||
|
|
Loading…
Reference in New Issue