officate date

This commit is contained in:
jiangyong27 2024-12-03 12:45:34 +08:00
parent f98b33685c
commit ed6aaf394a
1 changed files with 28 additions and 13 deletions

View File

@ -33,16 +33,16 @@ func (s *Staff) MontorWorkAge() {
} }
entryDate, _ := time.ParseInLocation("2006-01-02", staff.EntryDate, time.Local) entryDate, _ := time.ParseInLocation("2006-01-02", staff.EntryDate, time.Local)
spanMonth := (nowDate.Year()-entryDate.Year())*12 + int(nowDate.Month()) - int(entryDate.Month()) OfficialDate, _ := time.ParseInLocation("2006-01-02", staff.OfficialDate, time.Local)
log.Infof("staff[%s] entryDate[%s] spanMonth[%.1f]", staff.Username, staff.EntryDate, float64(spanMonth)/12.0) entryMonth := (nowDate.Year()-entryDate.Year())*12 + int(nowDate.Month()) - int(entryDate.Month())
if nowDate.Day() != entryDate.Day() || spanMonth%6 != 0 { officelDay := (OfficialDate.Unix() - nowDate.Unix()) / 86400
continue log.Infof("staff[%s] entryDate[%s] spanMonth[%.1f]", staff.Username, staff.EntryDate, float64(entryMonth)/12.0)
} if nowDate.Day() == 1 && entryMonth%6 == 0 {
message := make([]string, 0) message := make([]string, 0)
message = append(message, fmt.Sprintf("【员工半年提醒】[%s]", staff.Realname)) message = append(message, fmt.Sprintf("【员工半年提醒】[%s]", staff.Realname))
message = append(message, fmt.Sprintf("入职时间:%s", staff.EntryDate)) message = append(message, fmt.Sprintf("入职时间:%s", staff.EntryDate))
message = append(message, fmt.Sprintf("入职年限:%.1f", float64(spanMonth)/12)) message = append(message, fmt.Sprintf("入职年限:%.1f", float64(entryMonth)/12))
message = append(message, fmt.Sprintf("基本工资:%s", staff.BaseSalary)) message = append(message, fmt.Sprintf("基本工资:%s", staff.BaseSalary))
message = append(message, fmt.Sprintf("绩效工资:%s", staff.PerfSalary)) message = append(message, fmt.Sprintf("绩效工资:%s", staff.PerfSalary))
message = append(message, fmt.Sprintf("身份证号:%s", staff.Idno)) message = append(message, fmt.Sprintf("身份证号:%s", staff.Idno))
@ -50,6 +50,21 @@ func (s *Staff) MontorWorkAge() {
if err := global.SendMessage([]string{"jiangyong"}, strings.Join(message, "\n")); err != nil { if err := global.SendMessage([]string{"jiangyong"}, strings.Join(message, "\n")); err != nil {
log.Errorf("send message error :%s", err.Error()) log.Errorf("send message error :%s", err.Error())
} }
}
if officelDay <= 30 && officelDay%7 == 0 {
message := make([]string, 0)
message = append(message, fmt.Sprintf("【员工转账提醒】[%s]", staff.Realname))
message = append(message, fmt.Sprintf("入职时间:%s", staff.EntryDate))
message = append(message, fmt.Sprintf("转正时间:%s", staff.OfficialDate))
message = append(message, fmt.Sprintf("基本工资:%s", staff.BaseSalary))
message = append(message, fmt.Sprintf("绩效工资:%s", staff.PerfSalary))
message = append(message, fmt.Sprintf("身份证号:%s", staff.Idno))
if err := global.SendMessage([]string{"jiangyong"}, strings.Join(message, "\n")); err != nil {
log.Errorf("send message error :%s", err.Error())
}
}
} }
} }