This commit is contained in:
jiangyong27 2025-03-11 09:45:32 +08:00
parent ce00a2bc89
commit 65228e00d2
4 changed files with 19 additions and 16 deletions

View File

@ -4,8 +4,8 @@ address = "0.0.0.0:9283"
log_level = 6 log_level = 6
[mysql] [mysql]
host = "192.168.2.50" host = "14.22.113.49"
port = 13308 port = 9352
user = "root" user = "root"
pass = "ZW5aaGVuMIIBIj" pass = "ZW5aaGVuMIIBIj"
db = "enterprise" db = "enterprise"

3
go.mod
View File

@ -75,6 +75,9 @@ require (
github.com/spf13/afero v1.11.0 // indirect github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect
github.com/tidwall/gjson v1.17.1 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect github.com/ugorji/go/codec v1.2.12 // indirect
github.com/wechatpay-apiv3/wechatpay-go v0.2.18 // indirect github.com/wechatpay-apiv3/wechatpay-go v0.2.18 // indirect

View File

@ -6,7 +6,6 @@ import (
"enterprise/common/registry" "enterprise/common/registry"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/spf13/cast" "github.com/spf13/cast"
"strings"
"time" "time"
) )
@ -30,22 +29,22 @@ func (s *SalaryCalculator1002) Calculate(salary *model.StaffSalary) {
return return
} }
fullAttendSalary := float64(0)
//特殊情况
if salary.Month == "202502" { if salary.Month == "202502" {
salary.ShouldDay = 21 salary.ShouldDay = 21
if salary.Username == "luoyi" {
salary.AttendDay = float64(salary.ShouldDay - 5)
} else if strings.ToLower(salary.Username) == "wangyan" {
salary.AttendDay = float64(salary.ShouldDay) - 5.6
} else if strings.ToLower(salary.Username) == "zhouhong" {
salary.AttendDay = float64(salary.ShouldDay) - 5.6
} else if strings.ToLower(salary.Username) == "chenmin" {
salary.AttendDay = 19
} else if strings.ToLower(salary.Username) == "xushiyu" {
salary.AttendDay = 7
}
} }
salary.AttendSalary = cast.ToFloat64(userSlary.Base) * (salary.AttendDay / float64(salary.ShouldDay)) if salary.AttendDay == float64(salary.ShouldDay) {
fullAttendSalary = 500
}
//特殊情况
if salary.Month == "202502" && (salary.Username == "luoyi" || salary.Username == "zhouhong" || salary.Username == "wangyan") {
fullAttendSalary = 500
}
salary.AttendSalary = (cast.ToFloat64(userSlary.Base)-500)*(salary.AttendDay/float64(salary.ShouldDay)) + fullAttendSalary
salary.TargetSalary = cast.ToFloat64(userSlary.Target) salary.TargetSalary = cast.ToFloat64(userSlary.Target)
// 1.订单 // 1.订单

View File

@ -5,6 +5,7 @@ import (
"enterprise/common/dao" "enterprise/common/dao"
"enterprise/common/model" "enterprise/common/model"
"enterprise/common/registry" "enterprise/common/registry"
"fmt"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/smbrave/goutil" "github.com/smbrave/goutil"
"github.com/spf13/cast" "github.com/spf13/cast"
@ -63,7 +64,7 @@ func (s *StaffSalary) CalcSalary(salary *model.StaffSalary, month string) (*mode
holiday, surplusHoliday := s.getRealVacationDay(month) holiday, surplusHoliday := s.getRealVacationDay(month)
realWorkDays := s.getRealWorkDay(month) realWorkDays := s.getRealWorkDay(month)
approvalCheckinDay := s.getApprovalCheckinDay(s.user.CorpId, s.user.Username, month) approvalCheckinDay := s.getApprovalCheckinDay(s.user.CorpId, s.user.Username, month)
fmt.Println(s.user.Username, realWorkDays, holiday, surplusHoliday)
salary.HolidayDay = holiday salary.HolidayDay = holiday
salary.AttendDay = realWorkDays + surplusHoliday salary.AttendDay = realWorkDays + surplusHoliday
salary.Salary = cast.ToFloat64(userSalary.Base) + cast.ToFloat64(userSalary.Target) salary.Salary = cast.ToFloat64(userSalary.Base) + cast.ToFloat64(userSalary.Target)