严智鑫
2024-10-12 acf24306aa69bb7f864e9bfa59995ccece785d30
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
package com.mes;
 
import com.mes.md.mapper.AccountMapper;
import com.mes.md.service.AccountService;
import com.mes.tools.HexConversion;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
 
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Random;
 
/**
 * @Author : yanzhixin
 * @Date: 2024/3/27 16:37
 * @Description:
 */
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = DeviceInteractionModuleApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class DeviceInteractionModuleApplicationTest {
 
    @Autowired
    AccountMapper AccountMapper;
 
    @Autowired
    AccountService accountService;
 
    @Test
    public void testFindPath() {
        //String url = getClass().getResource("").getPath();
        //log.info("完整路径:{}", Arrays.asList(url));
 
        log.info("完整路径");
    }
    @Test
    public void testByte() {
        //String url = getClass().getResource("").getPath();
        //log.info("完整路径:{}", Arrays.asList(url));
        byte[] msgs = new byte[2048];
        msgs[0]=(byte)0;
        msgs[1]=Byte.parseByte("1") ;
        int g=HexConversion.bytesToInt(msgs,0);
 
        String message = HexConversion.byteToHexString(4, msgs);
        byte font=msgs[1];
        String[] fontBit=String.format("%8s", Integer.toBinaryString((int)font)).replace(" ", "0").split("");
        byte[] bit=new byte[1];
        bit[0]=Byte.parseByte(fontBit[7]) ;
        log.info("结果:{},{}",fontBit,bit);
        //log.info("结果:{},{},{},{},{}",msgs,message,g,(msgs[0] & 0xFF),((msgs[1] & 0xFF)<<8));
    }
    @Test
    public void testFindAccount() {
        Map<String, Object> Account=accountService.selectAccount("beibo","57858555");
        if(Account.isEmpty()){
            System.out.println("成功");
        }
        log.info("{}",Account);
    }
 
 
 
}