2021与蓝度共同重构项目,服务端
zhanzhiqin
2022-10-19 2b9c6e86f1fb2abd7ad7f1a8d74d3fcd515da858
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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<String> 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);
    }
 
}