diff --git a/conf/server.conf.dev b/conf/server.conf.dev index 4f21daf..7b35bed 100644 --- a/conf/server.conf.dev +++ b/conf/server.conf.dev @@ -4,8 +4,8 @@ address = "0.0.0.0:9283" log_level = 6 [mysql] -host = "192.168.2.50" -port = 13308 +host = "14.22.113.49" +port = 9352 user = "root" pass = "ZW5aaGVuMIIBIj" db = "enterprise" diff --git a/go.mod b/go.mod index d654fba..89ac56d 100644 --- a/go.mod +++ b/go.mod @@ -75,6 +75,9 @@ require ( github.com/spf13/afero v1.11.0 // indirect github.com/spf13/pflag v1.0.5 // 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/ugorji/go/codec v1.2.12 // indirect github.com/wechatpay-apiv3/wechatpay-go v0.2.18 // indirect diff --git a/service/salary_calculator/salary_calculator_1002.go b/service/salary_calculator/salary_calculator_1002.go index 251c8e6..8c80107 100644 --- a/service/salary_calculator/salary_calculator_1002.go +++ b/service/salary_calculator/salary_calculator_1002.go @@ -6,7 +6,6 @@ import ( "enterprise/common/registry" log "github.com/sirupsen/logrus" "github.com/spf13/cast" - "strings" "time" ) @@ -30,22 +29,22 @@ func (s *SalaryCalculator1002) Calculate(salary *model.StaffSalary) { return } + fullAttendSalary := float64(0) + + //特殊情况 if salary.Month == "202502" { 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) // 1.订单 diff --git a/service/staff_salary.go b/service/staff_salary.go index 9601d5b..f5b502a 100644 --- a/service/staff_salary.go +++ b/service/staff_salary.go @@ -5,6 +5,7 @@ import ( "enterprise/common/dao" "enterprise/common/model" "enterprise/common/registry" + "fmt" log "github.com/sirupsen/logrus" "github.com/smbrave/goutil" "github.com/spf13/cast" @@ -63,7 +64,7 @@ func (s *StaffSalary) CalcSalary(salary *model.StaffSalary, month string) (*mode holiday, surplusHoliday := s.getRealVacationDay(month) realWorkDays := s.getRealWorkDay(month) approvalCheckinDay := s.getApprovalCheckinDay(s.user.CorpId, s.user.Username, month) - + fmt.Println(s.user.Username, realWorkDays, holiday, surplusHoliday) salary.HolidayDay = holiday salary.AttendDay = realWorkDays + surplusHoliday salary.Salary = cast.ToFloat64(userSalary.Base) + cast.ToFloat64(userSalary.Target)