From c5270599b3e1f65c5097c5b17e91578d41d92988 Mon Sep 17 00:00:00 2001 From: jiangyong27 Date: Fri, 14 Mar 2025 15:07:27 +0800 Subject: [PATCH] salary --- common/config/error.go | 1 + conf/corp/1000.json | 1 + conf/corp/1002.json | 1 + server/service/staff_salary.go | 4 ++++ 4 files changed, 7 insertions(+) diff --git a/common/config/error.go b/common/config/error.go index cc0ad6c..fff5002 100644 --- a/common/config/error.go +++ b/common/config/error.go @@ -17,4 +17,5 @@ var ( ErrTokenInvaild = errors.T(403, "TOKEN无效") //客户端有特殊逻辑勿动,跳转登录页 ErrNoToken = errors.T(404, "没有TOKEN") //客户端有特殊逻辑勿动,跳转登录页 ErrNoPerm = errors.T(405, "没有权限") + ErrTimeExceed = errors.T(2000, "超出时间范围") ) diff --git a/conf/corp/1000.json b/conf/corp/1000.json index 79a6913..7980af0 100644 --- a/conf/corp/1000.json +++ b/conf/corp/1000.json @@ -1,4 +1,5 @@ { + "salary_latest": 9, "staff_config": [ { "name": "目标绩效", diff --git a/conf/corp/1002.json b/conf/corp/1002.json index a4426d5..2a45f65 100644 --- a/conf/corp/1002.json +++ b/conf/corp/1002.json @@ -1,4 +1,5 @@ { + "salary_latest": 14, "staff_config": [ { "name": "目标绩效", diff --git a/server/service/staff_salary.go b/server/service/staff_salary.go index ab9286c..bbd5036 100644 --- a/server/service/staff_salary.go +++ b/server/service/staff_salary.go @@ -65,6 +65,10 @@ func (s *StaffSalary) List(sess *session.AdminSession, req *api.ListSalaryReq) ( func (s *StaffSalary) Create(sess *session.AdminSession, req *api.CreateSalaryReq) { users, _, err := dao.NewStaffUserDao().Query(1, -1, sess.GetCorpId(), 0, req.Username, "", "", "") session.CheckDBError(err) + salaryLast := cast.ToInt(config.GetCorpConfig(sess.GetCorpId(), "salary_latest", 31)) + if time.Now().Day() >= salaryLast || cast.ToInt(req.Month) != cast.ToInt(time.Now().AddDate(0, -1, 0).Format("200601")) { + panic(config.ErrTimeExceed.New().Append(fmt.Sprintf("salaryLast=%d", salaryLast))) + } for _, user := range users { //离职的且离职时间不在当月的不在计算工资