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);
|
}
|
|
|
|
|
}
|