package com.jpsoft.shinestar;

import com.jpsoft.shinestar.modules.base.service.CanteenDiningRecordService;
import com.jpsoft.shinestar.modules.base.service.PersonDeviceLogService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.text.SimpleDateFormat;
import java.util.Date;

@RunWith(SpringRunner.class)
@SpringBootTest
public class CanteenDiningTest {
    @Autowired
    private CanteenDiningRecordService canteenDiningRecordService;

    @Autowired
    private PersonDeviceLogService personDeviceLogService;

    @Test
    public void testPunchIn(){
        try {
            String deviceNo = "210235TN1L3212001989";
            Long personId = 47619L;
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
            Date recordTime = sdf.parse("2021-06-01 12:05:01");

            Boolean result = canteenDiningRecordService.punchIn(deviceNo, personId, recordTime);
        }
        catch (Exception ex){
            ex.printStackTrace();
        }
    }
}
