package com.basic.x01.securityCheck;
|
|
public class SecurityCheckUtil {
|
public final static int CHECK_WAY_PHOTO = 1;
|
public final static int CHECK_WAY_VIDEO = 2;
|
|
public final static String[] checkWays=new String[]{
|
CHECK_WAY_PHOTO+"", "拍照",
|
CHECK_WAY_VIDEO+"", "视频"
|
};
|
|
public final static int CHECK_TIME_DAY = 1;
|
public final static int CHECK_TIME_WEEK = 7;
|
public final static int CHECK_TIME_MONTH = 30;
|
public final static int CHECK_TIME_SEASON = 91;
|
public final static int CHECK_TIME_HALF_YEAR = 182;
|
public final static int CHECK_TIME_YEAR = 365;
|
|
public final static String[] CHECK_TIME_STRING = new String[]{
|
CHECK_TIME_DAY+"", "每天",
|
CHECK_TIME_WEEK+"", "每周",
|
CHECK_TIME_MONTH+"", "每月",
|
CHECK_TIME_SEASON+"", "每季度",
|
CHECK_TIME_HALF_YEAR+"", "每半年",
|
CHECK_TIME_YEAR+"", "每年",
|
};
|
|
public final static String getSelectBoxHtml(String time){
|
if(time==null){
|
time = "";
|
}
|
time = "/" + time + "/";
|
|
StringBuffer s = new StringBuffer("<select class=\"security-check-flow-time\">");
|
for(int i=0; i<CHECK_TIME_STRING.length; i=i+2){
|
String val=CHECK_TIME_STRING[i];
|
String txt=CHECK_TIME_STRING[i+1];
|
|
s.append("<option value=\"").append(val).append("\"");
|
if(val.equals(time)){
|
s.append(" selected=\"selected\"");
|
}
|
s.append(">").append(txt).append("</option>");
|
}
|
|
s.append("</select>");
|
|
return s.toString();
|
}
|
|
public static String getCheckWayHtml4Edit(String checkWay){
|
if(checkWay==null){
|
checkWay="";
|
}
|
checkWay="/"+checkWay+"/";
|
|
StringBuffer s = new StringBuffer();
|
for(int i=0; i<checkWays.length; i=i+2){
|
String val=checkWays[i];
|
String txt=checkWays[i+1];
|
|
s.append("<label for=\"security-item-check-way-")
|
.append(val).append("\"><input type=\"checkbox\" ")
|
.append("name=\"security-item-check-way\" ");
|
if(checkWay.contains("/"+val+"/")){
|
s.append("checked=\"checked\" ");
|
}
|
s.append("id=\"security-item-check-way-").append(val)
|
.append("\" value=\"").append(val).append("\"/>")
|
.append(txt).append("</label>");
|
}
|
|
return s.toString();
|
}
|
|
public static String getCheckWayText4Display(String checkWay){
|
if(checkWay==null){
|
checkWay="";
|
}
|
checkWay="/"+checkWay+"/";
|
|
StringBuffer s = new StringBuffer();
|
for(int i=0; i<checkWays.length; i=i+2){
|
String val=checkWays[i];
|
String txt=checkWays[i+1];
|
|
if(checkWay.contains("/"+val+"/")){
|
s.append("/").append(txt);
|
}
|
}
|
if(s.toString().length()>0){
|
s.deleteCharAt(0);
|
}
|
|
return s.toString();
|
}
|
|
public static boolean isCheckWay(String checkWay, int val){
|
if(checkWay==null){
|
checkWay="";
|
}
|
checkWay="/"+checkWay+"/";
|
return checkWay.contains("/"+val+"/");
|
}
|
}
|