This commit is contained in:
jiangyong27 2024-04-07 17:08:39 +08:00
parent fa553703fa
commit b2cb2cf3d7
2 changed files with 11 additions and 0 deletions

View File

@ -10,6 +10,7 @@ var (
StaffSalaryExpDiscount = "staff.salary.exp.discount" //试用期薪资折扣
StaffSalarySocialInsurence = "staff.salary.social.insurence" //社保扣除金额
StaffSalaryPerDay = "staff.salary.per.day" //按天计算的工资
StaffSalaryNotify = "staff.salary.notify" //是否发送工资单
)
var (
UserConfigStatusNormal = 1

View File

@ -28,6 +28,11 @@ func (s *Staff) SendStaffSalaryBill(month string) {
if staffSalary.BaseSalary < 0.1 {
continue
}
userConfig, err := dao.NewUserConfigDao().GetByUsername(staffSalary.Username)
if err != nil {
log.Errorf("db error :%s", err.Error())
continue
}
message := make([]string, 0)
message = append(message, fmt.Sprintf("【工资单】[%s][%s]", staffSalary.Username, month))
message = append(message, fmt.Sprintf("基本工资:%.2f", staffSalary.BaseSalary))
@ -42,6 +47,11 @@ func (s *Staff) SendStaffSalaryBill(month string) {
if err := global.SendMessage([]string{"jiangyong"}, strings.Join(message, "\n")); err != nil {
log.Errorf("send message error :%s", err.Error())
}
if userConfig != nil && cast.ToBool(userConfig.Get(model.StaffSalaryNotify)) == true {
if err := global.SendMessage([]string{"liangbin"}, strings.Join(message, "\n")); err != nil {
log.Errorf("send message error :%s", err.Error())
}
}
}
}