task_worker_attendance.go 897 字节
package task

import (
	"context"
	"encoding/json"
	"fmt"
	"github.com/hibiken/asynq"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/attendance/command"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/attendance/service"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/log"
)

// 员工工时汇报
func WorkerAttendanceReport(c context.Context, t *asynq.Task) error {
	svr := service.NewAttendanceService(nil)
	cmd := &command.WorkerAttendanceReportCommand{}
	if err := json.Unmarshal(t.Payload(), cmd); err != nil {
		return err
	}
	log.Logger.Debug(fmt.Sprintf("【员工考勤记录汇报】 消费 设备:%v  用户编号:%v  时间:%v  ", cmd.Sn, cmd.UserNo, cmd.DeviceZkTeco))
	_, err := svr.WorkerAttendanceReport(cmd)
	if err != nil {
		log.Logger.Error(err.Error())
	}
	return nil
}