package com.mortals.httpclient;

import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;

import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @author: zxfei
 * @date: 2022/5/18 10:35
 * @description:
 **/
public class Test {
    public static void main(String[] args) throws NoSuchAlgorithmException {
//        SM4Utils sm4 = new SM4Utils();
//        sm4.secretKey = "JeF8U9wHFOMfs2Y8";
//        sm4.hexString = false;
//        String transformation = "SM4/ECB/Padding";
//        SMCipher clipher = SMCipher.getInstance(transformation);
//        clipher.init(1, sm4.secretKey.getBytes(), sm4.iv.getBytes());
//        byte[] result = clipher.doFinal(plainText.getBytes());
//        System.out.println(Base64.encodeBase64URLSafeString(result));


        String sql = "";

        ArrayList<Map<String, String>> deviceList = new ArrayList<>();
        HashMap<String, String> map = new HashMap<>();
        map.put("排队机", "C0-FB-F9-CD-3B-A4");
        deviceList.add(map);
        map = new HashMap<>();
        map.put("评价器", "0c-cf-89-09-d1-c8");
        deviceList.add(map);
        map = new HashMap<>();
        map.put("集中显示屏", "5E-93-5B-4B-94-67");
        deviceList.add(map);
        map = new HashMap<>();
        map.put("呼叫器", "0c-cf-89-42-8e-b8");
        deviceList.add(map);
        map = new HashMap<>();
        map.put("呼叫器", "a0-9f-10-5a-aa-44");
        deviceList.add(map);
        map = new HashMap<>();
        map.put("窗口屏", "18-9F-BC-EE-E0-87");
        deviceList.add(map);
        map = new HashMap<>();
        map.put("会议室电子门牌", "2A-9A-30-3A-BD-C6");
        deviceList.add(map);
        map = new HashMap<>();
        map.put("电子门牌", "42-72-FF-54-87-8D");
        deviceList.add(map);
        map = new HashMap<>();
        map.put("信息发布屏", "30-1F-9A-62-5E-D7");
        deviceList.add(map);


        for (int i = 0; i < 300; i++) {


            int randomDeviceInt = RandomUtil.randomInt(0, deviceList.size());
            Map<String, String> deviceMap = deviceList.get(randomDeviceInt);

            deviceMap.entrySet().stream().forEach(item -> {

                String format = String.format("【设备】当前%s设备,编码%s离线，请注意！", item.getKey(), item.getValue());

                String dateStr = DateUtil.formatDateTime(RandomUtil.randomDate(DateUtil.offsetDay(new Date(),-4), DateField.HOUR, 1, 100).toJdkDate());


                String insertsql = String.format("INSERT INTO `mortals_xhx_alarm_sms_send`(`id`, `mobile`, `receiver`, `sendMess`, `sendStatus`, `sendTime`, `siteId`, `createTime`, `updateUserId`, `updateTime`) VALUES (null, '13808095770', '文浩臣', '%s', 2, '%s', 1, '%s', NULL, NULL);", format, dateStr, dateStr);

                System.out.println(insertsql);

            });


        }


    }
}
