求助:一堆的ifelse嵌套privateMapversionCheck(MapmapParam){Mapmsg=newHashMap();if(!"".equals(PMSUtil.isNull(mapParam.get("IS_INTERNET")))){StringcheckVersion=SystemGlobals.getProperty("IS_CHECK");if("1".equals(checkVersion)){Stringversions=SystemGlobals.getProperty("VERSION");Stringversion=PMSUtil.isNull(mapParam.get("VERSION"));StringtaxRegisterNo=PMSUtil.isNull(mapParam.get(""));StringwhiteList=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"");}returnmsg;}
2 回答
BIG阳
TA贡献1859条经验 获得超6个赞
1.整体可简化为:if(){if(){if(){if(){msg.put("RESULT","0001");msg.put("MSG","FAILD");returnmsg;}}}}msg.put("RESULT","0000");returnmsg;2.str.indexOf(s)==-1可简化为!str.contains(s)3.使用2之后,最里层的两个if语句:if(c1){if(c2){...}}可以写成:if(c1&&c2){...}
添加回答
举报
0/150
提交
取消