package com.jjt.inventory;

import com.jjt.JjtApplication;
import com.jjt.inventory.service.ITwinCalcHourBpOutService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

/**
 * 印花机
 */
@SpringBootTest(classes = JjtApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("devp")
public class BpOutTest {
    @Resource
    ITwinCalcHourBpOutService bpOutService;

    @Test
    public void hour() {
        String st = "2025-06-14";
        String ed = "2025-06-14";
        LocalDate localDate = LocalDate.parse(st);
        LocalDate endDate = LocalDate.parse(ed);
        LocalDateTime start = LocalDateTime.of(localDate, LocalTime.MIN).plusHours(17);
        bpOutService.calc(start, start.plusHours(1));
//        LocalDateTime end = LocalDateTime.of(endDate.plusDays(1), LocalTime.MIN).plusHours(6);
//        LocalDateTime curr = LocalDateTime.now();
//        if (end.isAfter(curr)) {
//            end = curr.minusHours(1);
//        }
//        do {
//            int i = start.getHour();
//            System.err.println(start.toLocalDate().toString() + "\t" + i);
//            bpOutService.calc(start, start.plusHours(1));
//            start = start.plusHours(1);
//        } while (!start.isAfter(end));
//        bpOutService.hour();
    }

    public static void main(String[] args) {
        String v = "299.000";
        System.out.println(new BigDecimal(v).intValue());
    }
}
