package com.moral.common.bean;
|
|
import com.moral.common.util.ResourceUtil;
|
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.stereotype.Component;
|
|
import javax.annotation.PostConstruct;
|
import java.util.Arrays;
|
import java.util.List;
|
import java.util.stream.Collectors;
|
|
/**
|
* 系统常量.
|
*/
|
@Component
|
public class Constants {
|
|
/** The Constant IS_DELETE_TRUE. */
|
public static final String IS_DELETE_TRUE = "1";
|
|
/** The Constant IS_DELETE_FALSE. */
|
public static final String IS_DELETE_FALSE = "0";
|
|
/** The Constant NULL_VALUE. */
|
public static final String NULL_VALUE = "N/V";
|
|
public static final String IS_USED_FALSE = "0";
|
|
public static final String IS_USED_TRUE = "1";
|
private static Integer[] specialOrgIds;
|
@PostConstruct
|
private void loadSpecialOrgIds(){
|
String orgIds = ResourceUtil.getValue("specialOrgIds");
|
if(!StringUtils.isBlank(orgIds)){
|
String [] orgIdArray = orgIds.split(",");
|
if(!ArrayUtils.isEmpty(orgIdArray)){
|
List<Integer> orgIdList = Arrays.asList(orgIdArray).stream().map(Integer::new).collect(Collectors.toList());
|
specialOrgIds = orgIdList.toArray(new Integer[orgIdList.size()]);
|
}
|
}
|
|
}
|
public static final Boolean isNotSpecialOrgId(Integer orgId) {
|
if(ArrayUtils.isEmpty(specialOrgIds)){
|
return true;
|
}
|
for(int i = 0; i < specialOrgIds.length; ++i) {
|
if (specialOrgIds[i].equals(orgId)) {
|
return false;
|
}
|
}
|
return true;
|
}
|
//device 状态
|
public static final String DEVICE_STATE_NORMAL ="0";
|
public static final String DEVICE_STATE_MILD = "1";
|
public static final String DEVICE_STATE_MIDDLE ="2";
|
public static final String DEVICE_STATE_SERIOUS ="3";
|
public static final String DEVICE_STATE_OFFLINE ="4";
|
}
|