求助:一堆的if else 嵌套
private Map versionCheck(Map mapParam) {
Map msg = new HashMap();
if(!"".equals(PMSUtil.isNull(mapParam.get("IS_INTERNET")))){
String checkVersion =SystemGlobals.getProperty("IS_CHECK");
if("1".equals(checkVersion)){
String versions =SystemGlobals.getProperty("VERSION");
String version =PMSUtil.isNull(mapParam.get("VERSION"));
String taxRegisterNo=PMSUtil.isNull(mapParam.get(""));
String whiteList =SystemGlobals.getProperty("NO_CHECK_TAX_REGISTER_NO");
if((","+whiteList+",").indexOf((","+taxRegisterNo+","))==-1){
if((","+versions+",").indexOf(","+version+",")==-1){//找不到
msg.put("RESULT", "0001");
msg.put("MSG", "FAILD");
}else{
msg.put("RESULT", ""0000"");
}
}else{
msg.put("RESULT", ""0000"");
}
}else{
msg.put("RESULT", ""0000"");
}
}else{
msg.put("RESULT", ""0000"");
}
return msg;
}
不要用 PMSUtil 了,直接上 org.apache.commons.lang.StringUtils
private Map versionCheck(Map mapParam) {
Map msg = new HashMap();
msg.put("RESULT", "0000");
String isInternet = (String) mapParam.get("IS_INTERNET");
if (StringUtils.isBlank(isInternet)) {
return msg;
}
String isCheck = SystemGlobals.getProperty("IS_CHECK");
if (!StringUtils.equals(isCheck, "1")) {
return msg;
}
String globalVersions = SystemGlobals.getProperty("VERSION");
String currentVersion = (String) mapParam.get("VERSION");
if (!StringUtils.contains("," + globalVersions + ",", "," + currentVersion + ",")) {
return msg;
}
String whiteList = SystemGlobals.getProperty("NO_CHECK_TAX_REGISTER_NO");
String taxRegisterNo = (String) mapParam.get("");
if (!StringUtils.contains("," + whiteList + ",", "," + taxRegisterNo + ",")) {
msg.put("RESULT", "0001");
msg.put("MSG", "FAILD");
return msg;
}
return Collections.emptyMap();
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。