task_work_time_static.go 906 字节
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 WorkshopWorkTimeRecordStatics(c context.Context, t *asynq.Task) error {
	svr := service.NewAttendanceService(nil)
	cmd := &command.WorkshopWorkTimeRecordStaticsCommand{}
	if err := json.Unmarshal(t.Payload(), cmd); err != nil {
		return err
	}
	log.Logger.Debug(fmt.Sprintf("【考勤记录统计】 消费 记录ID:%v  时间:%v", cmd.ProductAttendanceId, cmd.WorkTimeBefore))
	_, err := svr.WorkshopWorkTimeRecordStatics(cmd)
	if err != nil {
		log.Logger.Error(err.Error())
	}
	return nil
}