package com.util;
import java.util.HashMap;
import java.util.Map;
/**
* 录入进度管理
* @author Administrator
*
*/
public class StepUtils {
private String step = "";
private Map stepComment ;
public StepUtils(){
}
public StepUtils(String s){
step = s;
if(step.length()<5){
throw new RuntimeException("位置信息错误,必须>=5位");
}
step += "00000000";
if(step.length()>20){
step = step.substring(0,20);
}
stepComment= new HashMap();
stepComment.put("0","表格封面");
stepComment.put("1","家庭成员");
stepComment.put("2","家庭住房");
stepComment.put("3","收入资产");
stepComment.put("4","住房证明");
stepComment.put("5","家庭核定");
stepComment.put("6","入户调查");
stepComment.put("7","收入证明");
stepComment.put("11","特殊家庭");
stepComment.put("15","街乡初审");
stepComment.put("16","区县公示");
stepComment.put("17","区县复审");
stepComment.put("18","市级备案");
}
public void setStep(String step){
this.step = step;
}
/**
* 测试某一位置是否完成
* @param postion
* @return
*/
public boolean test(int postion){
String a = step.substring(postion,postion+1);
int b = Integer.parseInt(a);
if(b==0){
return false;
}else{
return true;
}
}
/**
* 测试全部进度是否完成
* @return
*/
public boolean test(){
//
if(step.substring(0,5).indexOf("0")==-1 && test(5) && test(7)){
return true;
}else{
return false;
}
}
/**
* 测试街道审核是否完整
* @return
*/
public boolean testStreetAudit(){
if(test(11) && test(6) & test(15)){
return true;
}else{
return false;
}
}
/**
* 廉租系统-测试街道审核是否完整
* @return
*/
public boolean testLzStreetAudit(){
if(test(7) && test(8) && test(9)){
return true;
}else{
return false;
}
}
/**
* 廉租系统-测试街道审核是否完整,为页面显示提示信息使用。
* @return
*/
public int testLzStreetAuditStep(){
int step = 0;
if(test(7)){
step++;
}
if(test(8)){
step++;
}
if(test(9)){
step++;
}
return step;
}
/**
* 廉租表格管理是否完整
* @return
*/
public boolean testLzStreetInput(){
if(test(0) && test(1) && test(2) && test(3) && test(4) && test(5) && test(6)){
return true;
}else{
return false;
}
}
/**
* 设定某一位置进度
* @param postion
* @param value
*/
public void setValue(int postion,int value){
String start = "";
String midd = "";
String end = "";
if(postion>0){
start = step.substring(0,postion);
}
// midd = step.substring(postion,(postion+1));
midd = value+"";
if((postion+1)<step.length()){
end = step.substring(postion+1);
}
step = start+midd+end;
}
public String getValue(){
return step;
}
public String getComment(int postion){
String temp = (String)stepComment.get(postion+"");
if(temp!=null){
return temp;
}else{
return "";
}
}
}
import java.util.HashMap;
import java.util.Map;
/**
* 录入进度管理
* @author Administrator
*
*/
public class StepUtils {
private String step = "";
private Map stepComment ;
public StepUtils(){
}
public StepUtils(String s){
step = s;
if(step.length()<5){
throw new RuntimeException("位置信息错误,必须>=5位");
}
step += "00000000";
if(step.length()>20){
step = step.substring(0,20);
}
stepComment= new HashMap();
stepComment.put("0","表格封面");
stepComment.put("1","家庭成员");
stepComment.put("2","家庭住房");
stepComment.put("3","收入资产");
stepComment.put("4","住房证明");
stepComment.put("5","家庭核定");
stepComment.put("6","入户调查");
stepComment.put("7","收入证明");
stepComment.put("11","特殊家庭");
stepComment.put("15","街乡初审");
stepComment.put("16","区县公示");
stepComment.put("17","区县复审");
stepComment.put("18","市级备案");
}
public void setStep(String step){
this.step = step;
}
/**
* 测试某一位置是否完成
* @param postion
* @return
*/
public boolean test(int postion){
String a = step.substring(postion,postion+1);
int b = Integer.parseInt(a);
if(b==0){
return false;
}else{
return true;
}
}
/**
* 测试全部进度是否完成
* @return
*/
public boolean test(){
//
if(step.substring(0,5).indexOf("0")==-1 && test(5) && test(7)){
return true;
}else{
return false;
}
}
/**
* 测试街道审核是否完整
* @return
*/
public boolean testStreetAudit(){
if(test(11) && test(6) & test(15)){
return true;
}else{
return false;
}
}
/**
* 廉租系统-测试街道审核是否完整
* @return
*/
public boolean testLzStreetAudit(){
if(test(7) && test(8) && test(9)){
return true;
}else{
return false;
}
}
/**
* 廉租系统-测试街道审核是否完整,为页面显示提示信息使用。
* @return
*/
public int testLzStreetAuditStep(){
int step = 0;
if(test(7)){
step++;
}
if(test(8)){
step++;
}
if(test(9)){
step++;
}
return step;
}
/**
* 廉租表格管理是否完整
* @return
*/
public boolean testLzStreetInput(){
if(test(0) && test(1) && test(2) && test(3) && test(4) && test(5) && test(6)){
return true;
}else{
return false;
}
}
/**
* 设定某一位置进度
* @param postion
* @param value
*/
public void setValue(int postion,int value){
String start = "";
String midd = "";
String end = "";
if(postion>0){
start = step.substring(0,postion);
}
// midd = step.substring(postion,(postion+1));
midd = value+"";
if((postion+1)<step.length()){
end = step.substring(postion+1);
}
step = start+midd+end;
}
public String getValue(){
return step;
}
public String getComment(int postion){
String temp = (String)stepComment.get(postion+"");
if(temp!=null){
return temp;
}else{
return "";
}
}
}