package com.jwipc.portal;

import cn.hutool.core.lang.Pair;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.Mode;
import cn.hutool.crypto.Padding;
import cn.hutool.crypto.symmetric.AES;
import com.jwipc.spe.model.po.MaterialBatchQualifiedPO;
import com.jwipc.spe.service.IMaterialBatchQualifiedService;
import com.jwipc.supplier.service.IAvlItemService;
import com.jwipc.test.BaseTest;
import com.jwipc.util.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p> </p>
 *
 * @author ZhangJie
 * @version 1.0
 * @since JDK 1.8
 */
@Slf4j
public class SupplierTest extends BaseTest {
    @Autowired
    private IMaterialBatchQualifiedService materialBatchQualifiedService;

    @Test
    public void test() {
        final Pair<LocalDateTime, LocalDateTime> startAndEndDate = DateUtils.getStartAndEndDate(2024, 4);
        final List<MaterialBatchQualifiedPO> mesData = materialBatchQualifiedService.getMesData(
                startAndEndDate.getKey(), startAndEndDate.getValue(), 4);
        log.info("mesData: {}", mesData);
    }

    @Autowired
    private IAvlItemService avlItemService;

    @Test
    public void test1() {
        AES aes = new AES(Mode.CBC, Padding.PKCS5Padding, "0CoJUm6Qyw8W8jud".getBytes(),
                "0102030405060708".getBytes());
        String encryptHex = aes.encryptHex(String.valueOf(239));
        final String format = StrUtil.format("/pc/supplier/supplierChange/page/lookup?id={}&type=1",
                encryptHex);
        System.out.printf(format);
    }

}
