whyclxw
2024-09-21 12c0bb25a0540d97e7c3348e31c9b25a62495390
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
package com.whyc.util;
 
import com.whyc.service.OperationLogService;
import org.springframework.stereotype.Component;
 
import javax.servlet.http.HttpServletRequest;
/**
 * 通用工具列
 */
@Component
public class CommonUtil {
 
    private static OperationLogService service;
    //将数转换成二进制字符串并统计1的个数
    public static int getIntToBinary(int switchState,int[] bit){
        int count=0;
        if(bit.length>0){
            for (int i=0;i<bit.length;i++){
                int ss=switchState&(1<<bit[i]);
                if(ss>0){
                    count++;
                }
            }
        }
        return count;
    }
 
    /**
     * 手动记录特定日志
     */
    public static void record(int type1,int type2, String msg, String msgDetail) {
        service.record(type1, type2, msg, msgDetail);
    }
 
 
 
 
}