package com.sandu.ximon.admin; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.crypto.SecureUtil; import com.sandu.ximon.admin.service.PoleService; import org.junit.jupiter.api.Test; import org.quartz.*; import org.quartz.impl.StdSchedulerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.crypto.password.PasswordEncoder; import java.math.BigDecimal; import java.util.List; @SpringBootTest class AdminApplicationTests { @Autowired private PasswordEncoder passwordEncoder; @Autowired private PoleService poleService; @Test void contextLoads() { //ae8b5aa26a3ae31612eec1d1f6ffbce9 String encode = SecureUtil.md5("66666"); String encode2 = passwordEncoder.encode(encode); System.out.println(encode); System.out.println(encode2); } @Test void poleService() { List strings = poleService.listDeviceCodeByIds(CollectionUtil.toList(1L, 6L)); System.out.println(strings); } @Test void jisuan() { BigDecimal value1 = new BigDecimal("1"); BigDecimal value2 = new BigDecimal("10"); String value; Double subtract = value1.subtract(value2).doubleValue(); System.out.println(subtract); if (subtract > 0) { System.out.println("大于0 " + subtract); } else { System.out.println("小于0 " + subtract); } int i = Integer.valueOf((int) (subtract * 100)) / 100; int y = Integer.valueOf((int) (subtract * 100)) % 100; System.out.println(i); System.out.println(y); if (subtract > 0) { value = hex10To16(i) + hex10To16(y); System.out.println("-------------"); System.out.println(hex10To16(i)); System.out.println(hex10To16(y)); System.out.println(value); } else { value = hex10To16(-i + 128) + hex10To16(-y); System.out.println("+++++++++++"); System.out.println(hex10To16(-i + 128)); System.out.println(hex10To16(-y)); System.out.println(value); } System.out.println("...................................."); int z = Integer.valueOf((int) (subtract * 10)); System.out.println(z); if (subtract > 0) { value = hex10To16(z); System.out.println(value); } else { value = hex10To16(-z + 32768); System.out.println(value); } System.out.println("...................................."); int x = Integer.valueOf((int) (subtract * 100)); System.out.println(z); if (subtract > 0) { value = hex10To16(x); System.out.println(value); } else { value = hex10To16(-x + 32768); System.out.println(value); } System.out.println("...................................."); int a = Integer.valueOf((int) (subtract * 100) / 100); System.out.println(z); if (subtract > 0) { value = hex10To16(a); System.out.println(value); } else { value = hex10To16(-a + 32768); System.out.println(value); } } public static void main(String[] args) { String hex = "sssssssss"; System.out.println(hex.substring(6)); System.out.println(hex.substring(6).length() % 8); } private static String hex10To16(int value) { return String.format("%02X", value); } }