package ss.page; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.jsp.JspException; import jakarta.servlet.jsp.PageContext; import com.google.gson.Gson; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; import ss.db.Db; import ss.db.SqlCmd; import ss.form.FormC; import ss.search.SearchC; import ss.skin.SkinC; import ss.user.UserU; import ss.WebC; import ss.log.SsLog; import ss.obj.ObjB; import ss.obj.ObjChildB; import ss.obj.ObjC; import ss.obj.ObjFuncB; import ss.obj.ObjU; public class TabU { // 增加,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin private static final Logger log4j = LogManager.getLogger(TabU.class); // 来自 TabTag.(int) doStartTag()。Lin // 增加 name(String)、pageContext(PageContext),从 TabTag 抽取出来了 -- 支持服务调用,支持小程序 // name = this.name,this = TabTag // pageContext = super.pageContext,super = TagSupport // 去掉返回值,在上层返回 public static void doTabTag(String name, PageContext pageContext) { // Db wdgdba = null; // 再去掉,移到下面用到的地方 -- 里层的 try-catch 里。Lin try { // 最外层的 try-catch,不用管 wdgdba 的关闭了(finally {})。Lin HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); // super.pageContext.。改为入口参数了。Lin // String appName = WdLoginUtil.getLoginedAppName(request); // 去掉 appName,不支持多个应用。Lin /* value 改用 Json 写法。Lin Map tabValue = ViewObjectUtil.parseTabValue(value == null ? null : value.toString()); */ /* 再改,用回 ViewObjectUtil.parseTabValue( > TabU.rdTabVal(。Lin Map tabValue = StrJson.toMap((this.val == null)? null : this.val.toString()); */ /* 再改回:val 里的内容,都用 Json 写法 -- 包括数组形式。Lin * "include_input"/"editBaseInfo,child" 改为 "{val:'include_input'}"/"{val:'editBaseInfo,child'}" * 去掉 TabU.rdTabVal( 了。Lin Map tabValue = TabU.rdTabVal((this.val == null)? null : this.val.toString()); */ /* 再去掉 StrJson.toMap(,直接用 Gson.fromJson(jsonStr, new TypeToken>() {}.getType())。Lin * 注意:rdTabVal() 不会返回 null。(返回 new HashMap<>() Map tabValue = StrJson.toMap((this.val == null)? null : this.val.toString()); */ /* 再改,拆分 val= 里的内容。Lin * val='{val:"tagState"}' 改为 name = "tagState" * val='{val:"baseInfo,child"}' 改为 name="baseInfo,child" -- 简写,不用 Json 格式 * val='{enable:"viewobject.funcMap.play.print",value:"print"}' 改为 * name="print" 和 enable="viewobject.funcMap.play.print" * val='{show:"button",dest:"env_printInfo",enable:"viewobject.funsMap.change.print",from:"print"}' 改为 * name="prt" filter="viewobject.funsMap.change.print" btn="true" dest="env_printInfo" * 合成 tabValue(Map),为了 TabU.cmptTab( 的入口参数。Lin * 属性已经拆分在 this.name、this.enable、this.show、this.dest 里了 * 再去掉 Map tabValue = new Gson().fromJson((this.val == null)? null : this.val.toString(), new TypeToken>(){}.getType()); if (tabValue == null) // 增加,TabU.rdTabVal() 不会返回 null。Lin tabValue = new HashMap<>(); */ /* 再去掉 。Lin * 再去掉 enable(String) 和 dest(String),只有 了 * enable:,值来自 tabValue = TabU.combTabVal(this.name, this.filter, this.show, this.dest); */ /* 再改,去掉 TabU.combTabVal(String name),直接写 Map.of("name", this.name)。Lin * TabTag 和 DataTag 共用,DataTag 不能调用 TabU * 调用 TabU.combTabVal( 时的 name 不会为空 * 只有一句 Map.put("name", name) 了 Map tabValue = TabU.combTabVal(this.name); */ Map tabValue = Map.of("name", name); // (this.name)。改为入口参数了。Lin /* 再改,拆分 val= 里的内容。Lin String value = tabValue.get("val"); // "value")。Lin */ /* 再去掉,直接用 this.name。Lin String value = this.name; */ /* 再改,拆分 val= 里的内容。Lin String dest = tabValue.get("dest"); */ /* 再去掉, 没有 dest 参数了。Lin String dest = this.dest; */ /* 改。-- 晕。Lin * TheTag.findViewObjectFromToken() > * TheTag.findViewObjectFromRequest(appName, request) > * ViewObjectUtil.findViewObjectFromRequest(appName, request) ViewObject viewobj = findViewObjectFromToken(); */ ObjB viewobj = ObjU.rdObjByReq(request); if (viewobj == null) throw new Exception(" wholeMap = new HashMap<>(); /* 再改,去掉 .idField(ObjFieldB),直接用新加的 ObjB.idName(String)。Lin String idName = viewobj.idField.name; // .getObjectIdField().getName().toLowerCase()。不需要 .toLowerCase()。Lin */ /* 再去掉,去掉 idName,直接用 viewobj.idName。Lin String idName = viewobj.idName; // .getObjectIdField().getName().toLowerCase()。不需要 .toLowerCase()。Lin */ ///// 改,不写 request."dxid",已有值了 -- 有问题再改。Lin // 从 Request 获取 dxid // 再,不能去掉,从草稿箱进入录入界面时,request."dxid" 没有值 String dxid; /* 改。Lin * 去掉 idName,直接用 viewobj.idName * 原 pageContext 为 super.pageContext.,改为入口参数了 dxid = (String) ExpressionEvaluatorManager.evaluate("", "${" + idName + "}", String.class, pageContext); */ dxid = (String) ExpressionEvaluatorManager.evaluate("", "${"+ viewobj.idName +"}", String.class, pageContext); /// 再增加,再从 request 里取 -- 支持小程序。Lin // 异步加载数据时,不是 JSP 的页面标签,取不到页面里的属性值 if (StringUtils.isBlank(dxid)) dxid = String.valueOf(request.getAttribute(WebC.REQ_objId)); // 一定有值,不会输出 "null" 串。Lin /// if (StringUtils.isNotBlank(dxid)) { // StringUtil.notNull()。Lin /* 再改为 "ssObjId",避免与数据表里的 对象ID 字段重名 -- 导致合并 Map 时,因 Key 同名而互相覆盖 Value。Lin request.setAttribute("dxid", dxid); */ request.setAttribute(WebC.REQ_objId, dxid); /// 再增加,写 request."ssObjName" -- 从草稿箱进入修改界面时,TabServ.wrTabStateByA() 取不到 request."ssObjName" -- 重写了小圆点的方法。Lin request.setAttribute(WebC.REQ_objName, viewobj.name); /// } ///// wholeMap.put(ObjC.WHOLE_MAP_REQUEST, request); // ViewObjectUtil.WHOLE_MAP_REQUEST。Lin /// 说明:对于 "enable:viewobject.funcMap.play.print,value:print",此判断条件成立 -- value 为 "print"。Lin /// 下一个分支条件 else if (StringUtils.isNotBlank(dest)) 不成立 -- dest 为空 /// 对于 "show:button,dest:env_printInfo,enable:viewobject.funsMap.change.print,from:print",此判断条件不成立 -- value 为空 /// 下一个分支条件 else if (StringUtils.isNotBlank(dest)) 成立 -- dest 为 "env_printInfo" /* 再去掉,在前面判断了 -- 只有 了 -- name= 不能为空。Lin if (StringUtils.isNotBlank(value)) { // StringUtil.notNull()。Lin */ /* 去掉,直接用里面的内容。Lin receiveBeanMap(wholeMap,viewobj); */ /* 再改,从草稿箱进入, 时,只有 Request."dwid" -- 没有别的 对象字段值 -- objEdit.ss.jsp。Lin * DbU.rdPoMapByReq( 只返回 Map."dwid" * TabTag 里的选项卡过滤,需要用到 dwlbm -- 调用 TabU.cmptTab( -- 。Lin if (value.startsWith("include_")) { /// * 去掉,直接用里面的内容。Lin // wholeMap.put(ViewObjectUtil.WHOLE_MAP_THISFUNCTION, findViewObjectFunctionFromRequest(viewobj, request)); /// * wholeMap.put(ObjC.WHOLE_MAP_THISFUNCTION, ObjU.rdFuncByReq(request, viewobj)); String bjid = null; if (TagC.TAB_includeInp.equals(value)) // "include_input")。Lin bjid = ObjU.rdInpPageName(viewobj, wholeMap); // 去掉 xmmc、wdgdba。Lin // else if (order.equals("include_baseInfo")) { // bjid = ViewObjectUtil.findDest_baseInfo(viewobj, appName, // wdgdba); // } else if (order.equals("include_miniInfo")) { // bjid = ViewObjectUtil.findDest_miniInfo(viewobj, appName, // wdgdba); // } if (bjid != null) { if (StringUtils.isBlank(dxid) // StringUtil.isNull()。Lin && wholeMap.get(ObjC.WHOLE_MAP_PLUGIN_KEY_MAP) != null) { // ViewObjectUtil.。Lin Map keymap = (Map) wholeMap.get(ObjC.WHOLE_MAP_PLUGIN_KEY_MAP); // "pluginkeymap"。Lin for (Entry entry : keymap.entrySet()) { super.pageContext.getOut().write(""); } } //inlcude dest ServTagB token; // UrlEntry。Lin String tokenstr = request.getParameter(ServC.REQ_token); // "token"。Lin if (tokenstr != null &&(token = TokenU.rdServTag(tokenstr)) != null){ // TokenMap.getUrl()。Lin if(token.runParmMap == null) // .getRunningCondition()。Lin token.runParmMap = new HashMap<>(); // .setRunningCondition()。Lin /// * 改。Lin // token.getRunningCondition().put(UrlEntry.RUNNING_CONDITION_INCLUDE_PAGE,bjid); /// * token.runParmMap.put(ServC.RUNNING_includePage, bjid); } /// * 改。Lin // pageContext.setAttribute(value, WebUtil.getDefaultComponetPath(bjid,appName)); /// * /// * 再分开 cmptPageFileName( 和 cmptPagePath(。Lin // super.pageContext.setAttribute(value, PageU.cmptPageFileName(bjid)); /// * super.pageContext.setAttribute(value, PageU.cmptPagePath(bjid)); } else { request.setAttribute(ServC.REQ_msg, viewobj.name +" not found "+ value); // ("msg",。Lin super.pageContext.setAttribute(value, WebC.PPATH_result); // "/wd/page/rs.jsp"。Lin } return SKIP_BODY; // 靠 finally 去关闭 wdgdba。Lin // 再,没用到 wdgdba。Lin } */ // 计算tag状态 /* 再去掉,改为 了。Lin if (TagC.TAB_state.equals(value)) // TabTag.VALUE_TAGSTATE。Lin return SKIP_BODY; // 靠 finally 去关闭 wdgdba。Lin */ /* 再去掉,移到 DataTag 了 -- + 。Lin if (TagC.TAB_miniInfo.equals(value)) { // TabTag.VALUE_PREVIEW。Lin // GeneralDBAccess gdba = null; // 去掉,用 wdgdba -- 去掉 WD 数据库了。Lin /// * 再改用 'try' with resources。Lin // try { /// * try (Db wdgdba = Db.makeConn()) { /// * 去掉,用 wdgdba -- 去掉 WD 数据库了。Lin // gdba = GeneralDBAccess.getInstance(CoreConstVars.DB_JNDI_NAME_NNDX)。Lin /// * /// * 再用 'try' with resources,移到本层的 try 里。Lin // wdgdba = Db.makeConn(); // 增加,从上面移下来 -- 对 "include_",没用到。Lin /// * /// * 改。Lin // BaseBean bean = (BaseBean) Class.forName(viewobj.getObjClass()).newInstance(); /// * /// * 再移到 else 里 -- 为了改用 Db.selPoById(。Lin // Po bean = (Po) Class.forName(viewobj.clazzName).getDeclaredConstructor().newInstance(); /// * Po bean; String id = request.getParameter(idName); /// 增加,selChgInfo 服务里,增加了 request.setAttribute(ServC.SERV_obj, 和 request.setAttribute(idName,。Lin // 为了 childChgInfo.ss.jsp 与 chgList.ss.jsp 共用 selChgInfo 服务 if (StringUtils.isBlank(id)) id = String.valueOf(request.getAttribute(idName)); /// if (StringUtils.isBlank(id)) { // StringUtil.isNull()。Lin bean = DbU.rdPoByReq(viewobj, request); // ViewObjectUtil.findBeanFromRequest()。Lin } else { /// * 再改用 Db.selPoById(。Lin // bean = (Po) Class.forName(viewobj.clazzName).getDeclaredConstructor().newInstance(); // // 移到这里 -- 为了改用 Db.selPoById(。Lin // bean.wrIdVal(Long.valueOf(id)); // .setDbObjectId()。Lin // wdgdba.doSelByPo(bean); // gdba.。去掉,用 wdgdba -- 去掉 WD 数据库了。Lin /// * /// * 再,.poName 改为 .poClazz。Lin // bean = wdgdba.selPoById(Long.valueOf(id), (Class) Class.forName(viewobj.poName)); /// * bean = wdgdba.selPoById(Long.parseLong(id), viewobj.poClazz); } List> objectList = new ArrayList<>(); /// * 去掉 gdba,去掉 WD 数据库了。Lin // objectList.add(ViewObjectUtil.getPreviewData(viewobj, bean, request, gdba, wdgdba)); /// * objectList.add(ObjU.rdMiniInfoData(viewobj, bean, request, wdgdba)); request.setAttribute("objectList", objectList); /// * 去掉 appName,不支持多个应用。Lin // * 不知哪里用到,搞明白再改??? // * 另,TabTagComper 里,有用到 pms/clip/miniInfo.jsp -- 就是此 source.jsp,复制自同目录下的 init.jsp // pageContext.setAttribute("preview_includeJsp", "/main/sheji/object/preview/" + appName + "/source.jsp"); /// * super.pageContext.setAttribute("preview_includeJsp", "/main/sheji/object/preview/source.jsp"); } catch (Exception e) { /// * 再去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin // e.printStackTrace(); /// * log4j.error("TabTag.doStartTag() 异常", e); ///// * 再改,IDEA:Empty 'finally' block。Lin // * 改用 'try' with resources -- 自动关闭 wdgdba // } finally { /// * 去掉,去掉 gdba 了。Lin // if (gdba != null) // gdba.close(); /// * ///// * } return SKIP_BODY; // 靠 finally 去关闭 wdgdba。Lin } */ /* 再抽取到 TabU.makeTokenParm(,和 DataTag 共用 -- 增加 DataTag 了。Lin * 去掉 idName,直接用 viewobj.idName * super.pageContext 改为 pageContext,改为入口参数了 Map tokenParam = new HashMap<>(); tokenParam.put(idName, dxid); tokenParam.put("dxid", dxid); tokenParam.put("dxm", viewobj.name); tokenParam.put("sqid", (String) ExpressionEvaluatorManager .evaluate("", "${sqid}", String.class, super.pageContext)); tokenParam.put("shid", (String) ExpressionEvaluatorManager .evaluate("", "${shid}", String.class, super.pageContext)); tokenParam.put("dataType", (String) ExpressionEvaluatorManager .evaluate("", "${dataType}", String.class, super.pageContext)); /// * 改,if 条件里不用再取一次。Lin // * IDEA 规范 -- Condition 'request != null' is always 'true' // if (request != null && request.getParameter(ViewObjectUtil.REQUEST_PARENT_VIEWOBJECT) != null){ // String pName=request.getParameter(ViewObjectUtil.REQUEST_PARENT_VIEWOBJECT); // tokenParam.put(ViewObjectUtil.REQUEST_PARENT_VIEWOBJECT,pName); /// * String pName = request.getParameter(WebC.REQ_pobjName); // 从 if 里移上来。Lin if (pName != null) { tokenParam.put(WebC.REQ_pobjName, pName); /// * 改。Lin // Field pf= ViewObjectUtil.getParentIdField(viewobj,pName); /// * ObjFieldB pf= ObjU.rdParentIdField(viewobj, pName); if (pf != null && request.getParameter(pf.name) != null){ tokenParam.put(pf.name,request.getParameter(pf.name)); } } */ Map tokenParam = TabU.makeTokenParm(viewobj, viewobj.idName, dxid, pageContext, request); wholeMap.put(ObjC.WHOLE_MAP_TOKEN, tokenParam); // ViewObjectUtil.WHOLE_MAP_TOKEN。Lin Map permission = new HashMap<>(); /* 再把 findJlztm(viewobj) 移到 TabU.rdJlztm(,与 DataTag 共用 -- 增加 DataTag 了。Lin * 增加 pageContext(PageContext),从 TabTag 移出来了 permission.put("jlztm", findJlztm(viewobj)); */ /* 再改,增加 jlztm(int) 了 -- 增加输出新 UI 左侧栏的 保存并提交 按钮,需要用到 jlztm。Lin permission.put("jlztm", TabU.rdJlztm(viewobj, super.pageContext)); */ permission.put("jlztm", jlztm); permission.put("request", request); /* 去掉 xmmc、wdgdba。Lin CalculateTabResult ct = ViewObjectUtil .calculateTab(appName, viewobj, tabValue, true, wholeMap, permission, wdgdba, false); */ /* 再去掉 true = isRunning(boolean),没用到,IDEA。Lin TabB ct = TabU.cmptTab(viewobj, tabValue, true, wholeMap, permission, false); // true = isRunning,false = isMobile111。Lin */ TabRunB ct = cmptTab(viewobj, tabValue, wholeMap, permission, false); // false = isMobile111。Lin /// 再增加,显示错误信息到页面 -- 点击待办,打开的办理页里,没有相应的服务授权会导致局部空白 -- 没有 miniInfo,没有 同意、退回 按钮 -- 不显示 服务名,后台有显示。Lin if (ct.noAuth) { pageContext.getResponse().getWriter().write("*** 没有服务授权 ***"); // super.pageContext.。改为入口参数了。Lin return; // return SKIP_BODY。去掉返回值,在上层返回。Lin } /// ///// 再增加,增加输出新 UI 左侧栏的 保存并提交 按钮 -- 抄自 InpServ.initInp()。Lin // 上面已经写了 wholeMap."request" 和 wholeMap."thisbeanmap" // wholeMap."thisbeanmap" 里的字段值只有 dwid、jlztm -- 不够再加 // 对 Box,新 UI 左侧栏没有 保存并提交 按钮 /* 再去掉,改为 遥控器 了 -- 遥控原来的 基本情况 选项卡里的 保存并提交 按钮。Lin if (!viewobj.isBox) { Map param = new HashMap<>(); param.put(viewobj.idName, dxid); // , objIdStr)。Lin param.put(ServC.SERV_obj, viewobj.name); // "thisViewObject",。Lin ObjFuncB fn; if (jlztm == ObjC.JLZT_inEdit) fn = viewobj.funcMap.get(ObjC.FUNC_submAddName); else fn = viewobj.funcMap.get(ObjC.FUNC_submChgName); wholeMap.put(ObjC.WHOLE_MAP_THISFUNCTION, fn); // "thisfunction"。Lin /// 再增加,不在页面混写 -- 只能从页面取 ${dataType}。Lin // 在 objEdit.ss.jsp 里写 pageContext.setAttribute("dataType","update") // 在 objChg.ss.jsp 里写 pageContext.setAttribute("dataType","change") // 在调用本方法前,把 dataType:(保存并提交) 写到 param 里 -- 不在页面转一圈 // 原 objInp.ss.jsp 里 parm="{${saveAndCommitParam},dataType:"${empty dataType?1:dataType}"}" String dataType = (String) ExpressionEvaluatorManager .evaluate("", "${dataType}", String.class, super.pageContext); param.put(ObjC.CHILD_type, dataType); /// ObjU.wrBtnParmByReq(fn, InpC.PARM_submAddPre, viewobj, param, wholeMap, request); } */ ///// if (ct.reqName != null) { /* 再改,IDEA:'ct.funcMap.size() > 0' can be replaced with '!ct.funcMap.isEmpty()'。Lin if (ct.funcMap.size() > 0) */ if (!(ct.funcAtrMap.isEmpty())) { pageContext.setAttribute(ct.reqName, ct.funcAtrMap); // super.pageContext.。改为入口参数了。Lin /// 再增加,写到 request,ServS 里会转为 json 并 writer.write( -- 支持小程序。Lin request.setAttribute(ct.reqName, ct.funcAtrMap); /// } } else { pageContext.setAttribute("tabHeight", "{minHeight:"+ ct.minHeight +",maxHeight:"+ ct.maxHeight +"}"); // super.pageContext.。改为入口参数了。Lin /// 再增加,写到 request,ServS 里会转为 json 并 writer.write( -- 支持小程序。Lin request.setAttribute("tabHeight", "{minHeight:"+ ct.minHeight +",maxHeight:"+ ct.maxHeight +"}"); /// ///// 增加,临时解决页面混写。Lin // chgChkTab.ss.jsp: ${item.param},bdlbm:,encode_shid:... // 在 TabB.tabList(List>) 的 Map 里,增加 "paramStr" // 把 "param" 转为 Json 串,并去掉左、右 "{"、"}" // 另,增加 删除二级对象的基本情况变动 功能,objChg.ss.jsp 里,也用上了 "paramStr" // 混写了 bdlbm 和 sqid -- 续传 bdlbm 和 sqid 到 InpServ.initInp() // 再增加,对变动功能( map : ct.tabList) { for (Entry e : map.entrySet()) { if ("param".equals(e.getKey())) { /// * 再改,去掉 gson.toJson(,e.getValue() 已是 Json 串。Lin // String paramStr = StringEscapeUtils.unescapeJava(gson.toJson(e.getValue())); // paramStr = paramStr.substring(2, paramStr.length() -2); // 转出来的是 "{...}"。Lin /// * String paramStr = StringEscapeUtils.unescapeJava(String.valueOf(e.getValue())); paramStr = paramStr.substring(1, paramStr.length() -1); // 转出来的是 {...}。Lin map.put("paramStr", paramStr); break; } } */ String bdlbm = (String) ExpressionEvaluatorManager .evaluate("", "${bdlbm}", String.class, pageContext); // , super.pageContext)。改为入口参数了。Lin /// 再增加,再从 request 里取 -- 支持小程序。Lin // 异步加载数据时,不是 JSP 的页面标签,取不到页面里的属性值 if (StringUtils.isBlank(bdlbm)) { Object val = request.getAttribute("bdlbm"); bdlbm = (val == null)? null : String.valueOf(val); } /// // String sqid = (String) ExpressionEvaluatorManager // .evaluate("", "${sqid}", String.class, super.pageContext); String encode_shid = (String) ExpressionEvaluatorManager .evaluate("", "${encode_shid}", String.class, pageContext); // , super.pageContext)。改为入口参数了。Lin /// 再增加,再从 request 里取 -- 支持小程序。Lin // 异步加载数据时,不是 JSP 的页面标签,取不到页面里的属性值 if (StringUtils.isBlank(encode_shid)) { Object val = request.getAttribute("encode_shid"); encode_shid = (val == null)? null : String.valueOf(val); } /// for (Map map : ct.tabList) { for (Map.Entry e : map.entrySet()) { if ("param".equals(e.getKey())) { String paramStr = ((String) e.getValue()); paramStr = StringUtils.substringBeforeLast(paramStr, "}"); if (StringUtils.isNotBlank(bdlbm)) paramStr += ",bdlbm:"+ bdlbm; // if (StringUtils.isNotBlank(sqid)) // paramStr += ",sqid:"+ sqid; if (StringUtils.isNotBlank(encode_shid)) paramStr += ",encode_shid:"+ encode_shid; paramStr += "}"; map.put("param", paramStr); break; } } /// 再增加,解决 "基本情况" 选项卡显示为 "变动"/"修改"。Lin // 对 了 -- name= 不能为空。Lin * 再去掉,只有 了 -- 移到 DataTag 了 -- 改为 了 } else if (StringUtils.isNotBlank(dest)) { // StringUtil.notNull()。Lin /// * 改。Lin // wdgdba = GeneralDBAccess.getInstance("jdbc/wd"); /// * /// * 再去掉,没用到了 -- TabU.cmptTab( 去掉 gdba 入口参数了。Lin // wdgdba = Db.makeConn(); /// * /// * 去掉 receiveBeanMap(),直接把内容移到这。Lin // receiveBeanMap(wholeMap,viewobj); /// * wholeMap.put(ObjC.WHOLE_MAP_THIS_BEAN_MAP, DbU.rdPoMapByReq(viewobj, request)); Map tokenParam = new HashMap<>(); tokenParam.put(idName, dxid); tokenParam.put("dxid", dxid); tokenParam.put("dxm", viewobj.name); tokenParam.put("sqid", (String) ExpressionEvaluatorManager .evaluate("", "${sqid}", String.class, super.pageContext)); tokenParam.put("shid", (String) ExpressionEvaluatorManager .evaluate("", "${shid}", String.class, super.pageContext)); tokenParam.put("dataType", (String) ExpressionEvaluatorManager .evaluate("", "${dataType}", String.class, super.pageContext)); Map permission = new HashMap<>(); permission.put("jlztm", findJlztm(viewobj)); permission.put("request", request); wholeMap.put(ObjC.WHOLE_MAP_TOKEN, tokenParam); // ViewObjectUtil.WHOLE_MAP_TOKEN。Lin /// * 去掉 xmmc、wdgdba。Lin // CalculateTabResult ct = ViewObjectUtil // .calculateTab(appName, viewobj, tabValue, true, wholeMap, permission, wdgdba, false); /// * /// * 再去掉 true = isRunning(boolean),没用到,IDEA。Lin // TabB ct = TabU.cmptTab(viewobj, tabValue, true, wholeMap, permission, false); // // true = isRunning,false = isMobile111。Lin /// * TabRunB ct = TabU.cmptTab(viewobj, tabValue, wholeMap, permission, false); // false = isMobile111。Lin //noinspection DataFlowIssue if (ct.reqName != null) { /// * 再改,IDEA:'ct.funcMap.size() > 0' can be replaced with '!ct.funcMap.isEmpty()'。Lin // if (ct.funcMap.size() > 0) /// * if (!(ct.funcAtrMap.isEmpty())) super.pageContext.setAttribute(ct.reqName, ct.funcAtrMap); } }else if (StringUtils.isBlank(value)) { // StringUtil.isNull()。Lin request.setAttribute("dxm", viewobj.name); request.setAttribute("dxidName", idName); /// * 改,肯定 request != null 了。Lin // if (request != null && request.getParameter(ViewObjectUtil.REQUEST_PARENT_VIEWOBJECT) != null){ /// * if (request.getParameter(WebC.REQ_pobjName) != null){ String pName = request.getParameter(WebC.REQ_pobjName); /// * 改。Lin // Field pf= ViewObjectUtil.getParentIdField(viewobj,pName); /// * ObjFieldB pf= ObjU.rdParentIdField(viewobj, pName); if (pf != null && request.getParameter(pf.name) != null){ request.setAttribute("pdxidValue", request.getParameter(pf.name)); request.setAttribute("pdxidName",pf.name); } } return SKIP_BODY; } */ /* 再改,IDEA:'catch' branch identical to 'RuntimeException' branch。Lin } catch (RuntimeException e) { e.printStackTrace(); }catch (Exception e) { e.printStackTrace(); */ } catch (Exception e) { /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin e.printStackTrace(); */ log4j.error("TabU.doTabTag( 异常", e); /* 最外层的 try-catch,不用管 wdgdba 的关闭了(finally {})。Lin * wdgdba 只有内层的 try-catch 移到 -- 用 'try' with resources } finally { if (wdgdba != null) wdgdba.close(); */ } } // === // 来自 ViewObjectUtil.(CalculateTabResult) calculateTab(String xmmc, ViewObject viewobj, // Map tabParam, // boolean isRunning, Map wholeMap, Map permissionParam, // GeneralDBAccess wdgdba, Boolean isMobile111)。Lin // 去掉 xmmc、wdgdba // 再改,拆分 val= 里的内容。Lin // val='{val:"tagState"}' 改为 name = "tagState" // val='{val:"baseInfo,child"}' 改为 name="baseInfo,child" -- 简写,不用 Json 格式 // val='{enable:"viewobject.funcMap.play.print",value:"print"}' 改为 // name="print" 和 enable="viewobject.funcMap.play.print" // 再去掉 isRunning(boolean),没用到,IDEA -- Parameter 'isRunning' is never used。Lin //!!!打开变动审核页,调用了 64 次本方法!!!Lin public static TabRunB cmptTab(ObjB viewobj, Map tabParam, Map wholeMap, Map permissionParam, Boolean isMobile111) { /* 再改,IDEA:'StringBuffer logStr' may be declared as 'StringBuilder'。Lin StringBuffer logStr = new StringBuffer(); */ StringBuilder logStr = new StringBuilder(); Gson gson = new Gson(); // 增加。Lin try { if (wholeMap == null) wholeMap = new HashMap<>(); Map tokenParam = new HashMap<>(); // 这里使 (tokenParam != null),导致 dataType 赋值有问题。Lin if (wholeMap.get(ObjC.WHOLE_MAP_TOKEN) != null) //noinspection unchecked tokenParam = (Map) wholeMap.get(ObjC.WHOLE_MAP_TOKEN); if (permissionParam == null) permissionParam = new HashMap<>(); HttpServletRequest request = (HttpServletRequest) permissionParam.get("request"); /* 改了。Lin Map thisBean = (Map) wholeMap.get(ObjConst.WHOLE_MAP_THIS_BEAN_MAP); */ //noinspection unchecked Map thisBean = (Map) wholeMap.get(ObjC.WHOLE_MAP_THIS_BEAN_MAP); // if (thisBean == null || thisBean.size() == 0) // logStr.append("thisBean not found,\r\n"); // System.out.println(thisBean); TabRunB ct = new TabRunB(); List> tabList = new LinkedList<>(); /* 再改 minHeight(Long)、maxHeight(Long) 为 int -- 一定有值。Lin Long minHeight = 0L; Long maxHeight = 0L; */ int minHeight = 0; int maxHeight = 0; /* 再改,拆分 val= 里的内容。Lin * 对 'enable:viewobject.funsMap.play.print, value:print',order 为 "print" * 对 'show:button, dest:env_printInfo, enable:viewobject.funsMap.change.print, from:print',order 为空 * 但 dest 不为空,且 get("from") 为 "print" -- 替换 "print" () { @Serial private static final long serialVersionUID = 1L; { put("viewobject", viewobj); } }, "#{" + enablestr + "}"); */ String xx = PageU.paseSymbol(Map.of("viewobject", viewobj), "#{" + enablestr + "}"); enable = "1".equals(xx) || "true".equals(xx); /* 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call。Lin logStr.append("printenable:" + enablestr + "-" + xx + ",\r\n"); */ logStr.append("printenable:").append(enablestr).append("-").append(xx).append(",\r\n"); } // String tokenParamStr = ""; // // int count = 0; // for (Map.Entry entry : tokenParam.entrySet()) { // // if (StringUtil.isNull(entry.getValue())) // continue; // // tokenParamStr += entry.getKey() + ":" + entry.getValue(); // if (count != tokenParam.size() - 1) { // tokenParamStr += ","; // } // count++; // } // if (tokenParamStr.endsWith(",")) { // tokenParamStr = tokenParamStr.substring(0, tokenParamStr.length() // - 1); // } /* 再改 width(Long) 为 int -- 一定有值。Lin Long width = 0L; */ int width = 0; String ReqName = null; if (dest != null) { try { ReqName = dest; String from = tabParam.get("name"); // ("from")。改为 temp; if (f != null && enable) { f = f.clone(); f.dest = dest; // 替换 "print" 0' can be replaced with '!tokenParam.isEmpty()' * Method invocation 'isEmpty' may produce 'NullPointerException' if (tokenParam.size() > 0) */ if (!(tokenParam.isEmpty())) /* 再去掉 StrJson.toParmStr(),直接用 gson.toJson(tokenParam)。Lin * 没有去掉左、右的 "{"、"}" temp.put("parm", (isMobile111? tokenParam : StrJson.toParmStr(tokenParam))); // 去掉 ObjU.toJsonParm(),重复了 -- 用 StrJson.toParmStr()。Lin */ temp.put("parm", (isMobile111? tokenParam : gson.toJson(tokenParam))); temp.put("name", f.name); /* 再去掉,ObjU.makeFuncMap( 里已经写了 -- 原写在 temp."name" 里 -- 新查询页。Lin temp.put("desc", f.playDesc); */ if (temp.get("width") != null) { /* 再改 width(Long) 为 int -- 一定有值。Lin if (Long.parseLong(temp.get("width").toString()) > width) { width = Long.parseLong(temp.get("width").toString()); } */ if (Integer.parseInt(temp.get("width").toString()) > width) width = Integer.parseInt(temp.get("width").toString()); } /* 再改 minHeight(Long)、maxHeight(Long) 为 int -- 一定有值。Lin if (null != temp.get("minHeight")) { // System.out.println("min:"+temp.get("minHeight")); if (Long.parseLong(temp.get("minHeight").toString()) > minHeight) { minHeight = Long.parseLong(temp.get("minHeight").toString()); } } if (null != temp.get("maxHeight")) { // System.out.println("max:"+temp.get("maxHeight")); if (Long.parseLong(temp.get("maxHeight").toString()) > maxHeight) { maxHeight = Long.parseLong(temp.get("maxHeight").toString()); } } */ if (temp.get("minHeight") != null) { if (Integer.parseInt(temp.get("minHeight").toString()) > minHeight) minHeight = Integer.parseInt(temp.get("minHeight").toString()); } if (temp.get("maxHeight") != null) { if (Integer.parseInt(temp.get("maxHeight").toString()) > maxHeight) maxHeight = Integer.parseInt(temp.get("maxHeight").toString()); } if (request != null) { if (StringUtils.isNotBlank(f.servName)) { // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin try { Integer jlztm = (permissionParam.get("jlztm") == null) ? null : (Integer) permissionParam.get("jlztm"); if (UserU.chkSauthByLogin(f.servName, f.name, jlztm, request)) { tabList.add(temp); } else { /* 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call。Lin logStr.append("no permission:"+ f.servName +",\r\n"); */ logStr.append("no permission:").append(f.servName).append(",\r\n"); } } catch (Exception e) { /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin e.printStackTrace(); */ log4j.error("TabU.cmptTab( 异常", e); } } else { tabList.add(temp); } } else { tabList.add(temp); } } } catch (Exception e) { /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin e.printStackTrace(); */ log4j.error("TabU.cmptTab( 异常", e); } } // System.out.println(111); /* 再改,IDEA:Redundant character escape '\\,' in RegExp。Lin if (order != null && order.split("\\,").length == 1) */ /* 再,先简单改(用技巧),value="printTemplates,printx" 改为 name="prtDef" 了 -- 没有 "," 了。Lin * value="changeBaseInfo,children" 等,有 "," * 另,原 value='enable:viewobject.funsMap.play.print, value:print',order="print" -- 没有 "," * value='show:button, dest:env_printInfo, enable:viewobject.funsMap.change.print, from:print',order 为空 if (order != null && order.split(",").length == 1) */ if (order != null && order.split(",").length == 1 && !(TabC.TAB_prtDef.equals(order))) // 过滤 name="prtDef"。Lin ReqName = order; if (order != null) { /* 再改,IDEA:Redundant character escape '\\,' in RegExp。Lin for (String o : order.split("\\,")) { // 导致 o 有 "{"/"}",如 "{enable:"viewobject.funcMap.play.print""。Lin */ for (String o : order.split(",")) { // 导致 o 有 "{"/"}",如 "{enable:"viewobject.funcMap.play.print""。Lin // System.out.println("finding:"+o); /// 再增加,支持变动 没有一级对象变动授权的 二级对象。Lin // cobjChg.ss.jsp 里写 // if (ObjC.FUNC_chgCobjName.equals(o)) // o = ObjC.FUNC_baseInfoName; // 转为 "baseInfo" -- 不能变动基本情况。Lin /// /* 去掉 propertyName = "name",直接用 obj.funcMap.get(name) Function f = ViewObjectUtil.findViewObjectFunction(viewobj, Function.FUNCTION_NAME, o); */ /* 再改,增加 normalParam = new HashMap<>(tokenParam); if (request != null && request.getParameter(WebC.REQ_pobjName) != null) normalParam.put(WebC.REQ_pobjName, request.getParameter(WebC.REQ_pobjName)); if (f == null) { /* "children" 改为 "child"。Lin if ("children".equals(o)) { */ if ((TabC.TAB_child).equals(o)) { // for (Map.Entry entry : // viewobj.getChildren().entrySet()) { /* 去掉 ViewChildren,把里面的变量上移到 ObjB 里。Lin List allViewChild = viewobj.getViewChildren().getAllViewChild(); for (ObjChildB vc : allViewChild) { */ for (ObjChildB vc : viewobj.childMap.values()) { // logStr.append(vc.name + vc.typeList + ","); // "chgInfo[play, bdplay],",去掉,是信息。Lin Map childParam = new HashMap<>(tokenParam); // 值班详情按只读模式打开,但值班人员是可维护的二级对象。 if (("xshZb".equals(viewobj.name) || "xyttZb".equals(viewobj.name)) && "rccy".equals(vc.name)) childParam.put(ObjC.CHILD_type, ObjC.CHILD_playChgType); if (request != null && request.getParameter(WebC.REQ_pobjName) != null) { String pName = request.getParameter(WebC.REQ_pobjName); childParam.put(WebC.REQ_pobjName, pName); if (vc.obj != null) { /* 再改 ObjU.rdParentIdField(,直接返回父亲 ID 字段名 -- 去掉 .idField(ObjFieldB),直接用新加的 .idName(String)。Lin ObjFieldB pf = ObjU.rdParentIdField(vc.obj, pName); if (pf != null && request.getParameter(pf.name) != null) { childParam.put(pf.name, request.getParameter(pf.name)); } */ String pfName = ObjU.rdPobjIdName(vc.obj, pName); //?// 去掉,改为 ssPobjId,避免与二级对象的 ID 重名 -- 家长(二级对象)、学员(一级对象),都是人员(ryid) -- 规范 request."ssPobjName"、."ssPobjId"。Lin if (pfName != null && request.getParameter(pfName) != null) childParam.put(pfName, request.getParameter(pfName)); //?// 改为 ssPobjId,避免与二级对象的 ID 重名 -- 家长(二级对象)、学员(一级对象),都是人员(ryid) -- 规范 request."ssPobjName"、."ssPobjId"。Lin } } if (vc.tgtPobjIdName != null && thisBean != null) { // String // dxid=childrenParam.get(viewobj.getObjectIdField().getName()); if (thisBean.get(vc.pobjIdName) != null && !(thisBean.get(vc.pobjIdName)).equals("null")) { String dxid = String.valueOf(thisBean.get(vc.pobjIdName)); // childParam.remove(viewobj.getObjectIdField().getName()); childParam.put(vc.tgtPobjIdName, dxid); } else { /// 这里的 "dxid" 应该不用改为 WebC.REQ_objId,thisBean 应该是对象记录的内容。Lin // 待确认??? -- 增加时,thisBean.size() = 0 childParam.put(vc.tgtPobjIdName, String.valueOf(thisBean.get("dxid"))); // , thisBean.get("dxid") + "")。Lin /// } } // visibility匹配属性 /* 再改,IDEA:'vc.filterMap.size() > 0' can be replaced with '!vc.filterMap.isEmpty()'。Lin if (vc.filterMap.size() > 0 && thisBean != null) { */ /* 再改,使用 null。Lin if (!(vc.filterMap.isEmpty()) && (thisBean != null)) { */ if ((vc.filterMap != null) && !(vc.filterMap.isEmpty()) && (thisBean != null)) { boolean allMatch = false; for (Map.Entry> ent : vc.filterMap.entrySet()) { Object v = thisBean.get(ent.getKey()); if (v != null) { allMatch = ent.getValue().contains(v.toString()); } if (!allMatch) break; } if (!allMatch) continue; } /* 再去掉,移到下面用到的地方。Lin String tabLiName;// tab 显示名 String tabLiDesc;// tab 显示名 /// * 改,去掉 findViewObjectFunction(,直接用 obj.funcMap.get(。Lin // Function search = ViewObjectUtil.findViewObjectFunction(viewobj, Function.FUNCTION_NAME, // vc.getName()); /// * ObjFuncB search = viewobj.funcMap.get(vc.name); */ if (vc.obj != null && vc.obj.isRoot && (!(vc.obj.hasMenu))) { /* 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call。Lin logStr.append("menu is false :" + vc.obj.name + "\r\n"); */ logStr.append("menu=\"false\":").append(vc.obj.name).append("\r\n"); continue; } ///// 从上面移到这。Lin String tabLiName;// tab 显示名 String tabLiDesc;// tab 显示名 /// 再增加,增加 "iconName"、"subiconName" -- 增加 个人菜单.业务名,实现 新UI 的图标体系。Lin // "iconName" 为对象图标,"subiconName" 为角图标,如 baseInfo(基本情况) String tabLiIconName; /* 再去掉,去掉 "subiconName" 了 -- 不用叠加角图标方案,用层级区分一级对象、二级对象 -- 增加 "pobj"=true 和 "cobj"=true。Lin String tabLiSubiconName = null; */ /// ObjFuncB search = viewobj.funcMap.get(vc.name); ///// /// 再增加 objB(ObjB),去掉 ObjFuncB.obj(ObjB) -- 不能反过来指定对象。Lin ObjB objB = viewobj; /// if (search == null) { if (vc.obj != null) { // 新扩展 变动,修改查找dragChange /* 再去掉,二级对象的 DDP 改为管理按钮了 -- 还是照旧的查询功能 ObjC.FUNC_searchName("search")。Lin if (ObjC.CHILD_chgType.equals(dataType) || // ViewChild.TYPE_CHANGE.。Lin ObjC.CHILD_updType.equals(dataType)) { // ViewChild.TYPE_UPDATE.。Lin /// * 去掉 ViewObjectUtil.findViewObjectFunction(,直接用 obj.funcMap.get()。Lin // * ViewObjectUtil.FN_NAME_DRAG_CHANGE > ObjC.FUNC_dragChgName("dragChange") // * qzcy.object.xml(群组成员) 用到 // search = ViewObjectUtil.findViewObjectFunction(vc.getObj(), // Function.FUNCTION_NAME, FN_NAME_DRAG_CHANGE); /// * search = vc.obj.funcMap.get(ObjC.FUNC_searchDdpName); /// 再增加 objB(ObjB),去掉 ObjFuncB.obj(ObjB) -- 不能反过来指定对象。Lin objB = vc.obj; /// } if (search == null) { */ /* 去掉 ViewObjectUtil.findViewObjectFunction(,直接用 obj.funcMap.get()。Lin * ViewObjectUtil.FN_NAME_SEARCH search = ViewObjectUtil.findViewObjectFunction(vc.getObj(), Function.FUNCTION_NAME, FN_NAME_SEARCH); */ search = vc.obj.funcMap.get(ObjC.FUNC_searchName); /// 再增加 objB(ObjB),去掉 ObjFuncB.obj(ObjB) -- 不能反过来指定对象。Lin objB = vc.obj; /// if (search == null) { /* 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call 。Lin logStr.append(viewobj.name + ".children fail:" + vc.name + ",\r\n"); */ logStr.append(viewobj.name).append(".children fail:").append(vc.name).append(",\r\n"); continue; } ///// 再增加,增加点击选项卡的 editDdp 服务的 URL 参数 ddpCobjName=、ddpSrcObjName= -- 再把 biz.qz.QzServ 抽取为底层支撑,通过实现 Ddp 接口类来区分差异。Lin /* 再去掉,改为通过 ObjFuncB.parmMap > SearchServ.searchObj() > ObjU.makeFuncMap( 传递参数到 DDP 管理按钮。Lin * 增加 DdpC.REQ_ddpSrcPobjName 参数 -- 支持二级对象的 DDP * 原通过 TabU.cmptTab( > SearchU.rdMagicData( > SearchServ.searchObj() 里的 map.put("param", gson.toJson(magicData)) 传递参数到每个管理按钮 * 不用传递 DdpC.REQ_ddpCobjName 参数,通过服务 <对象名>_editDdp 的 obj 参数传递到 DdpServ.obj -- 服务 "ss.editDdp" 归入对象 -- 需要授权 /// * 再改为 .ddpSrcObjName,值来自 SearchServ.searchObj() > ObjU.makeFuncMap( 传递参数到 DDP 管理按钮。Lin * 原通过 TabU.cmptTab( > SearchU.rdMagicData( > SearchServ.searchObj() 里的 map.put("param", gson.toJson(magicData)) 传递参数到每个管理按钮 * 不用传递 DdpC.REQ_seqObjName 参数,通过服务 <对象名>_sortSeq 的 obj 参数传递到 DdpServ.obj -- 服务 "ss.sortSeq" 归入对象,需要授权 if (vc.obj.sortable) { childParam.put(DdpC.REQ_seqObjName, vc.name); } */ ///// childParam.put(WebC.REQ_pobjName, viewobj.name); //?// 增加 ssPobjId,避免与二级对象的 ID 重名 -- 家长(二级对象)、学员(一级对象),都是人员(ryid) -- 规范 request."ssPobjName"、."ssPobjId"。Lin tabLiName = viewobj.name +"_"+ vc.obj.name +"_"+ search.name; tabLiDesc = vc.obj.playDesc; // "年级"。Lin /// 再增加,增加 "iconName"、"subiconName" -- 增加 个人菜单.业务名,实现 新UI 的图标体系。Lin // "iconName" = 二级对象图标 // 二级对象没有角图标 "subiconName" tabLiIconName = vc.obj.name; /// } else { /* 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call 。Lin logStr.append(viewobj.name + ".children fail:" + vc.name + "\r\n"); */ logStr.append(viewobj.name).append(".children fail:").append(vc.name).append("\r\n"); continue; } } else { tabLiName = viewobj.name +"_"+ search.name; tabLiDesc = search.playDesc; // "变动"。Lin /// 再增加,增加 "iconName"、"subiconName" -- 增加 个人菜单.业务名,实现 新UI 的图标体系。Lin // "iconName" = 变动图标 // 变动选项卡没有角图标 "subiconName" -- 变动图标为固定图标,不用"对象图标上叠加角图标" // 再改为用层级区分一级对象、二级对象,不用叠加角图标方案 -- 增加 "pobj"=true 和 "cobj"=true -- 变动图标 没有 "pobj" 和 "cobj",是 一级图标,是一级对象的变动 tabLiIconName = SkinC.ICON_chgName; /// } wholeMap.put(ObjC.WHOLE_MAP_THISFUNCTION, search); /* 再改为 IDEA 规范。Lin * 'if' statement has empty body * String concatenation as argument to 'StringBuilder.append()' call if ((vc.typeList).contains(ObjC.CHILD_normType)) { // ViewChild.TYPE_NORMAL。Lin } else if ((vc.typeList).contains(dataType)) { } else if (dataType == null) { } else { logStr.append(viewobj.name + ".children fail: name=" + vc.name + ",dataType=" + dataType + ",\r\n"); continue; } */ boolean editableRccyInPlay = ("xshZb".equals(viewobj.name) || "xyttZb".equals(viewobj.name)) && "rccy".equals(vc.name) && ObjC.CHILD_playType.equals(dataType); if (!(vc.typeList.contains(ObjC.CHILD_normType)) && // ViewChild.TYPE_NORMAL。Lin !(vc.typeList.contains(dataType)) && !editableRccyInPlay && (dataType != null)) { logStr.append(viewobj.name).append(".children fail: name="). append(vc.name).append(",dataType=").append(dataType).append(",\r\n"); continue; } /* 去掉死代码 -- 前面的 else 被 continue 了。Lin if (search == null) { logStr.append(viewobj.name +".children fail:"+ vc.name +",\r\n"); continue; } 去掉死代码。Lin */ /* 去掉死代码。Lin if (false && isMobile111) { // 晕死!!!Lin Map temp = new HashMap(); temp.put("service", (search.serv).split("\\.").length <= 1 ? (SsConst.APP_NAME +"."+ search.serv) : search.serv); String bjid = null; try { // Long thisid = new // BjDaoImpl().selectBjid(search.getDest(), // xmmc, wdgdba, true); // String // thisid=WebUtil.findPageIdByName(search.getDest(), // xmmc); String thisid = search.dest; bjid = thisid == null ? "1" : thisid; } catch (Exception e) { logStr.append("6666:"+ search.dest +"\r\n"); e.printStackTrace(); } if (bjid != null) { temp.put("dest", bjid); } temp.put("param", childParam); temp.put("name", tabLiName); temp.put("desc", tabLiDesc); // 先去掉,不知何用,用到再弄。Lin // String wdTabSite = vc.getWdTabSite(); // if (wdTabSite != null) // temp.put("wdTabSite", wdTabSite); // End。Lin try { if (request != null) { if (UserUtil.isShowBtn(search.serv, permissionParam.get("jlztm") != null ? (String) permissionParam.get("jlztm") : null, request, null)) { // type tabList.add(temp); } else { logStr.append("no permission:"+ search.serv +",\r\n"); } } else { tabList.add(temp); } } catch (Exception e) { e.printStackTrace(); } } else 去掉死代码。Lin */ { /* 改用 ObjTranslator。Lin * 去掉 ViewObjectManager,包括其 getInstance() * 把 ViewObjectManagerImpl.translateFunctionToMap( 移到 ObjTranslator * 去掉 translateFunctionToMap() 的入口参数 wdGdba、appName * ObjTranslator.translateFunctionToMap( 移到 ObjU,并改为 静态方法了。Lin Map temp = ViewObjectManager.getInstance() .translateFunctionToMap(search, wdgdba, xmmc, wholeMap, isMobile111); */ /* 再增加 objB(ObjB),去掉 ObjFuncB.obj(ObjB) -- 不能反过来指定对象。Lin Map temp = ObjU.makeFuncMap(search, wholeMap, isMobile111); */ Map temp = ObjU.makeFuncMap(search, objB, wholeMap, isMobile111); /* 再去掉,IDEA -- Condition 'temp == null' is always 'false'。Lin if (temp == null) { /// * 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call。Lin // logStr.append(viewobj.name + ".children fail:" + vc.name + "\r\n"); /// * logStr.append(viewobj.name).append(".children fail:").append(vc.name).append("\r\n"); continue; } */ temp.put("name", tabLiName); temp.put("desc", tabLiDesc); // "年级"、"变动"。Lin ///// 再增加,增加 "iconName"、"subiconName" -- 增加 个人菜单.业务名,实现 新UI 的图标体系。Lin // 二级对象、变动选项卡没有角图标 "subiconName" -- 变动图标为固定图标,不用"对象图标上叠加角图标" if (ObjC.FUNC_chgName.equals(search.name)) temp.put("iconName", tabLiIconName); // 变动功能固定为 icno-chg。Lin else temp.put("iconName", SkinC.ICON_objPrfx + tabLiIconName); /// 再增加,返回 "cobj"=true,是二级对象 -- 新UI 方案改为 通过层级区分 一级对象、二级对象,不用叠加角图标做法。Lin // 变动图标 没有 "pobj" 和 "cobj",是 一级图标,是一级对象的变动 temp.put("cobj", true); /// ///// /* 改。Lin temp.put("param", isMobile111 ? childParam : createParam(childParam)); */ /* 再去掉 StrJson.toParmStr(),直接用 gson.toJson(childParam)。Lin * 没有去掉左、右的 "{"、"}" temp.put("param", isMobile111? childParam : StrJson.toParmStr(childParam)); */ /* 再改,temp."param" 改为 ."parm" -- 新查询页时。Lin temp.put("param", isMobile111? childParam : gson.toJson(childParam)); */ temp.put("parm", isMobile111? childParam : gson.toJson(childParam)); // 兼容仍在使用的旧版 objInfo.jsp:旧模板读取 service、param,新模板读取 servName、parm。 temp.put("service", search.servName); temp.put("param", temp.get("parm")); /* 先去掉,不知何用,用到再弄。Lin String wdTabSite = vc.getWdTabSite(); if (wdTabSite != null) temp.put("wdTabSite", wdTabSite); */ try { if (request != null) { if (UserU.chkSauthByLogin(search.servName, null, // null = type。Lin (permissionParam.get("jlztm") == null)? null : (Integer.valueOf(String.valueOf(permissionParam.get("jlztm")))), request)) { tabList.add(temp); } else { /* 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call 。Lin logStr.append("no permission:" + search.servName + ","); */ logStr.append("no permission:").append(search.servName).append(","); } } else { tabList.add(temp); } } catch (Exception e) { /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin e.printStackTrace(); */ log4j.error("TabU.cmptTab( 异常", e); } //noinspection DuplicatedCode if (temp.get("width") != null) { /* 再改 width(Long) 为 int -- 一定有值。Lin if (Long.parseLong(temp.get("width").toString()) > width) { width = Long.parseLong(temp.get("width").toString()); } */ if (Integer.parseInt(temp.get("width").toString()) > width) width = Integer.parseInt(temp.get("width").toString()); } /* 再改 minHeight(Long)、maxHeight(Long) 为 int -- 一定有值。Lin if (null != temp.get("minHeight")) { if (Long.parseLong(temp.get("minHeight").toString()) > minHeight) { minHeight = Long.parseLong(temp.get("minHeight").toString()); } } if (null != temp.get("maxHeight")) { if (Long.parseLong(temp.get("maxHeight").toString()) > maxHeight) { maxHeight = Long.parseLong(temp.get("maxHeight").toString()); } } */ if (temp.get("minHeight") != null) { if (Integer.parseInt(temp.get("minHeight").toString()) > minHeight) minHeight = Integer.parseInt(temp.get("minHeight").toString()); } if (temp.get("maxHeight") != null) { if (Long.parseLong(temp.get("maxHeight").toString()) > maxHeight) maxHeight = Integer.parseInt(temp.get("maxHeight").toString()); } } // } } } else if ((TabC.TAB_prtDef).equals(o)) { // "printTemplates".。Lin /* 改用 ObjTranslator。Lin * 去掉 ViewObjectManager,包括其 getInstance() * 把 ViewObjectManagerImpl.translatePrintTemplates() 移到 ObjTranslator * 去掉 translatePrintTemplates() 的入口参数 wdgdba、xmmc Map printTemplates = ViewObjectManager.getInstance() .translatePrintTemplates(viewobj, wdgdba, xmmc, wholeMap, false); */ /* 再把 ObjTranslator.translatePrintTemplates( 移到这,只有这里用到。Lin Map printTemplates = (new ObjTranslator()) .translatePrintTemplates(viewobj, wholeMap, false); // false = ismobile */ Map printTemplates = translatePrintTemplates(viewobj, wholeMap, false); // false = ismobile if (printTemplates != null) { /* 再改 minHeight(Long)、maxHeight(Long) 为 int -- 一定有值。Lin if (printTemplates.get("minHeight") != null) { if (Long.parseLong(printTemplates.get("minHeight").toString()) > minHeight) minHeight = Long.parseLong(printTemplates.get("minHeight").toString()); } if (printTemplates.get("maxHeight") != null) { if (Long.parseLong(printTemplates.get("maxHeight").toString()) > maxHeight) maxHeight = Long.parseLong(printTemplates.get("maxHeight").toString()); } */ if (printTemplates.get("minHeight") != null) { if (Integer.parseInt(printTemplates.get("minHeight").toString()) > minHeight) minHeight = Integer.parseInt(printTemplates.get("minHeight").toString()); } if (printTemplates.get("maxHeight") != null) { if (Integer.parseInt(printTemplates.get("maxHeight").toString()) > maxHeight) maxHeight = Integer.parseInt(printTemplates.get("maxHeight").toString()); } if (printTemplates.get("width") != null) { /* 再改 width(Long) 为 int -- 一定有值。Lin if (Long.parseLong(printTemplates.get("width").toString()) > width) width = Long.parseLong(printTemplates.get("width").toString()); */ if (Integer.parseInt(printTemplates.get("width").toString()) > width) width = Integer.parseInt(printTemplates.get("width").toString()); } if (printTemplates.get("tabList") != null) /* 改了。Lin tabList.addAll((List) printTemplates.get("tabList")); */ //noinspection unchecked tabList.addAll((List>) printTemplates.get("tabList")); } } continue; } wholeMap.put(ObjC.WHOLE_MAP_THISFUNCTION, f); Map temp; /* 去掉死代码。Lin if (false && isMobile111) { // 这样写,条件是不可能成立的?!!!晕死。Lin temp.put("service", f.serv.split("\\.").length <= 1 ? (SsConst.APP_NAME +"."+ f.serv) : f.serv); String bjid = null; try { // Long thisid = new // BjDaoImpl().selectBjid(f.getDest(), xmmc, wdgdba, // true); String thisid = f.dest; bjid = thisid == null ? "1" : thisid.toString(); } catch (Exception e) { SsLog.print("6666:"+ f.dest); e.printStackTrace(); } if (bjid != null) { temp.put("dest", bjid); } temp.put("param", normalParam); temp.put("name", f.name); temp.put("desc", f.dispDesc); } else 去掉死代码。Lin */ { /* 改用 ObjTranslator。Lin * 去掉 ViewObjectManager,包括其 getInstance() * 把 ViewObjectManagerImpl.translateFunctionToMap( 移到 ObjTranslator * 去掉 translateFunctionToMap( 的入口参数 wdGdba、appName * ObjTranslator.translateFunctionToMap( 移到 ObjU,并改为 静态方法了。Lin temp = ViewObjectManager.getInstance().translateFunctionToMap(f, wdgdba, xmmc, wholeMap, isMobile111); */ /* 再增加 viewobj(ObjB),去掉 ObjFuncB.obj(ObjB) -- 不能反过来指定对象。Lin temp = ObjU.makeFuncMap(f, wholeMap, isMobile111); */ temp = ObjU.makeFuncMap(f, viewobj, wholeMap, isMobile111); /* 再改,IDEA:'normalParam.size() > 0' can be replaced with '!normalParam.isEmpty()'。Lin if (normalParam.size() > 0) */ if (!(normalParam.isEmpty())) /* 改。Lin * 去掉 ObjU.toJsonParm(),重复了 -- 用 StrJson.toParmStr() temp.put("param", isMobile111 ? tokenParam : createParam(tokenParam)); */ /* 再去掉 StrJson.toParmStr(),直接用 gson.toJson(normalParam)。Lin * 没有去掉左、右的 "{"、"}" temp.put("param", (isMobile111? normalParam : StrJson.toParmStr(normalParam))); */ /* 再改,temp."param" 改为 ."parm" -- 新查询页时。Lin temp.put("param", (isMobile111? normalParam : gson.toJson(normalParam))); */ temp.put("parm", (isMobile111? normalParam : gson.toJson(normalParam))); temp.put("name", f.name); /* 再去掉,ObjU.makeFuncMap( 里已经写了 -- 原写在 temp."name" 里 -- 新查询页。Lin temp.put("desc", f.playDesc); // "基本情况"、"信息"(info)。Lin */ /// 再增加,增加 "iconName"、"subiconName" -- 增加 个人菜单.业务名,实现 新UI 的图标体系。Lin // "iconName" = 对象图标(主图标) // "subiconName" = 角图标,叠加在对象图标上 if (ObjC.FUNC_baseInfoName.equals(f.name) || ObjC.FUNC_chgBaseInfoName.equals(f.name)) { temp.put("iconName", SkinC.ICON_objPrfx + viewobj.name); /* 再改为,返回 "pobj"=true,是一级对象 -- 新UI 方案改为 通过层级区分 一级对象、二级对象,不用叠加角图标做法。Lin temp.put("subiconName", SkinC.SUBICON_baseInfoName); */ temp.put("pobj", true); } /// if (temp.get("width") != null) { /* 再改 width(Long) 为 int -- 一定有值。Lin if (Long.parseLong(temp.get("width").toString()) > width) { width = Long.parseLong(temp.get("width").toString()); } */ if (Integer.parseInt(temp.get("width").toString()) > width) width = Integer.parseInt(temp.get("width").toString()); } /* 再改 minHeight(Long)、maxHeight(Long) 为 int -- 一定有值。Lin if (null != temp.get("minHeight")) { // System.out.println("min:"+temp.get("minHeight")); if (Long.parseLong(temp.get("minHeight").toString()) > minHeight) { minHeight = Long.parseLong(temp.get("minHeight").toString()); } } if (null != temp.get("maxHeight")) { // System.out.println("max:"+temp.get("maxHeight")); if (Long.parseLong(temp.get("maxHeight").toString()) > maxHeight) { maxHeight = Long.parseLong(temp.get("maxHeight").toString()); } } */ if (temp.get("minHeight") != null) { if (Integer.parseInt(temp.get("minHeight").toString()) > minHeight) minHeight = Integer.parseInt(temp.get("minHeight").toString()); } if (temp.get("maxHeight") != null) { if (Integer.parseInt(temp.get("maxHeight").toString()) > maxHeight) maxHeight = Integer.parseInt(temp.get("maxHeight").toString()); } } if (request != null) { if (StringUtils.isNotBlank(f.servName) && enable) { // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin try { Integer jlztm = (permissionParam.get("jlztm") == null) ? null : Integer.valueOf(permissionParam.get("jlztm").toString()); if (UserU.chkSauthByLogin(f.servName, f.name, jlztm, request)) { tabList.add(temp); } else { /* 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call。Lin logStr.append("no permission:" + f.servName + "\r\n"); */ logStr.append("???,no permission:").append(f.servName).append("\r\n"); /// 再增加,写错误信息到 TabRunB.noAuthMsg -- 点击待办,打开的办理页里,没有相应的服务授权会导致局部空白 -- 没有 miniInfo,没有 同意、退回 按钮。Lin // 不显示 服务名,后台有显示 ct.noAuth = true; /// } } catch (Exception e) { /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin e.printStackTrace(); */ log4j.error("TabU.cmptTab( 异常", e); } } else { tabList.add(temp); } } else { tabList.add(temp); } } } // YhUtil.isShowButton(appName, serviceName, jlztm, request) /* 再改,IDEA:'tabList.size() > 0' can be replaced with '!tabList.isEmpty()'。Lin if (tabList.size() > 0) { */ if (!(tabList.isEmpty())) { ct.funcAtrMap = tabList.get(0); ct.reqName = ReqName; } ct.width = width; ct.tabList = tabList; ct.maxHeight = maxHeight; ct.minHeight = minHeight; return ct; /* 再改,IDEA:。Lin } catch (RuntimeException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); */ } catch (Exception e) { /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin e.printStackTrace(); */ log4j.error("TabU.cmptTab( 异常", e); } finally { String l = logStr.toString(); if (StringUtils.isNotBlank(l)) { // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin SsLog.log("????????,calculateTab error:" + l); // System.out.println(l); } } return null; } // 来自 大母体的 ViewObjectManagerImpl.translatePrintTemplates()。Lin // 去掉 wdgdba、xmmc 入口参数 public static Map translatePrintTemplates(ObjB vo, Map wholeMap, boolean ismobile){ SsLog.print("translatePrintTemplates:"+ vo.name); // ("translatePrintTemplates-------------------"+。Lin SsLog.print(wholeMap.toString()); // Db gdba = null; // 移到 try 里,按 IDEA 规范 -- 'try' can use automatic resource management。Lin @SuppressWarnings("unchecked") Map beanMap = (Map) wholeMap.get(ObjC.WHOLE_MAP_THIS_BEAN_MAP); try (Db gdba = Db.makeConn()) { /* 改用默认 JNDI。Lin gdba=GeneralDBAccess.getInstance(CoreConstVars.DB_JNDI_NAME_NNDX); */ /* 再,移到 try 里,按 IDEA 规范 -- 'try' can use automatic resource management。Lin gdba = Db.makeConn(); */ List> tabList = new LinkedList<>(); //Map funsMap=vo.getFunsMap(); //Function function=funsMap.get("play"); //Field f=vo.getObjectIdField(); //修改要求0264改为去掉dymb表 // String sql="select dymb.dymbid,dymb.bgmbid,bgmb.service dymbfunction, dymb.mc dymbmc from dymb left join bgmb on dymb.bgmbid=bgmb.bgmbid where dymb.jlztm=51 and dymb.dxm='"+vo.getName()+"'"; /* 改。Lin String sql="select bgmbid,mc,service from bgmb where bgmblbm = 41 and dxm = :dxm and jlztm<>55"; */ /* 再改,jlztm<>55 改为 ObjC.JLZT_notInSusStr -- 增加了(不包括) 26(JLZT_inResChk)。Lin * 表格模板.服务名(SERV) 改为 .FWM String sql= "select BGMBID,MC,SERV from BGMB where BGMBLBM=" + FormC.FORM_prtType + " and DXM=:dxm and JLZTM<>" + ObjC.JLZT_inSus; */ String sql= "select BGMBID,MC,FWM from BGMB where BGMBLBM=" + FormC.FORM_prtType + " and DXM=:dxm and "+ ObjC.JLZT_actStr; SqlCmd sqlCmd = new SqlCmd(sql); sqlCmd.wrStrParm("dxm", vo.name); List> dymblist = gdba.doSelMapListByC(sqlCmd); /* 再改为 IDEA 规范。Lin if(dymblist.size()==0){ */ if (dymblist.isEmpty()) { SsLog.print("IIII,没找到打印模板:"+ vo.name); // ("dymb not setting:"+。Lin /* 先改为 return,有问题再弄 -- 没有模板,为什么不 return???Lin // return null; */ /* 再,不能 return,需要再处理 高级打印模板。Lin return null; */ } /* 再改,IDEA:Type may be primitive。Lin * 改为 int Long minHeight = 0L; Long maxHeight=minHeight; Long width=minHeight; */ int minHeight = 0; int maxHeight = 0; int width = 0; //表格模板,最大宽高 //*16:px改为rem /// 要改为预生成 -- 写在 表格模板 表里???Lin /* 改。Lin sql="select max(yzb+gd)*16 height,max(xzb+kd)*16 width from bgbj" +" where bgmbid in(select bgmbid from bgmb where jlztm<>55 and dxm='"+ vo.name +"')"; */ /* 再改,jlztm<>55 改为 ObjC.JLZT_notInSusStr -- 增加了(不包括) 26(JLZT_inResChk)。Lin sql = "select max(YZB+GD)*16 height,max(XZB+KD)*16 width from BGBJ"+ " where BGMBID in(select BGMBID from BGMB where JLZTM<>"+ ObjC.JLZT_inSus +" and DXM='"+ vo.name +"')"; */ sql = "select max(YZB+GD)*16 height,max(XZB+KD)*16 width from BGBJ"+ " where BGMBID in(select BGMBID from BGMB where "+ ObjC.JLZT_actStr +" and DXM='"+ vo.name +"')"; /// for (Map m : gdba.doSelMapList(sql)) { if ((m.get("width") == null) || (m.get("height") == null)) { SsLog.print("表格模板未设置!"); // ("表格模板未设置!")。Lin break; } /* 再改,IDEA:Type may be primitive。Lin * 改为 int 了 -- 转来转去,在干啥 -- 转为 Double,再转为 Long Double w=Double.parseDouble(m.get("width").toString()); Double h=Double.parseDouble(m.get("height").toString()); width=w.longValue(); maxHeight=h.longValue(); */ width = Integer.parseInt(m.get("width").toString()); maxHeight = Integer.parseInt(m.get("height").toString()); } /* 再去掉,SsListener.contextInitialized( 里的 MenuU.premakeObjRunMenu() 调用进来时,request 为 null -- 还没登录。Lin * 此时,beanMap 为空 -- 不显示就算了 SsLog.print(beanMap.toString()); */ /* 去掉,不支持多个应用。Lin WebApp app = vo.getWebapp(); */ HttpServletRequest request = (HttpServletRequest) wholeMap.get(ObjC.WHOLE_MAP_REQUEST); for (Map dymb : dymblist) { SsLog.print(dymb.toString()); /* 去掉,没用到。Lin String bgmbid=dymb.get("bgmbid").toString(); */ dymb.put("desc", dymb.get("mc").toString()); /* 再改,表格模板.服务名(SERV) 改为 .FWM。Lin String service = (dymb.get("service")==null)? null : (dymb.get("service").toString()); */ String service = (dymb.get("fwm")==null)? null : (dymb.get("fwm").toString()); if (StringUtils.isNotBlank(service)) { // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin if (UserU.chkSauthByLogin(service, null, null, request)) { // null = type、jlztm。Lin tabList.add(dymb); } else { SsLog.print("没有权限:"+service); } } else { tabList.add(dymb); } } /* 去掉 funs,直接用 (obj.funcMap).values()。Lin * 增加了 ObjB.prtFuncList List funs =vo.getFuns(); for(int i=0;i funs = vo.prtFuncList; /* 再改,IDEA:'for' loop can be replaced with enhanced 'for'。Lin for(int i = 0; i < funs.size(); i++){ */ for (ObjFuncB objFunc : funs) { // if(StrU.notNull(funs.get(i).prtNo)){ // 不用判断了,改用 ObjB.prtFuncList。Lin // boolean flag = false; // 移到下面 -- 重写。Lin /* 再改,IDEA:'for' loop can be replaced with enhanced 'for'。Lin * 重写 if (StringUtils.isNotBlank(funs.get(i).servName)) { // StrU.notNull()。Lin if(UserU.chkSauthByLogin(funs.get(i).servName, null, null, request)){ // null = type、jlztm。Lin flag = true; } } else { flag = true; } */ boolean flag = StringUtils.isBlank(objFunc.servName) || UserU.chkSauthByLogin(objFunc.servName, null, null, request); if (flag) { /* 再去掉,按 IDEA 规范 -- 'putAll()' call can be replaced with parametrized constructor call。Lin Map param = new HashMap<>(); */ Map dymb = new HashMap<>(); /* 再改,IDEA:'for' loop can be replaced with enhanced 'for'。Lin dymb.put("desc", funs.get(i).desc); dymb.put("dymbfunction", funs.get(i).name); */ /* 再改用 .playDesc。Lin dymb.put("desc", objFunc.desc); dymb.put("dymbfunction", objFunc.name); */ dymb.put("desc", objFunc.playDesc); dymb.put("dymbfunction", objFunc.name); SsLog.print(dymb.toString()); /* 再改,按 IDEA 规范 -- 'putAll()' call can be replaced with parametrized constructor call。Lin param.putAll(dymb); */ Map param = new HashMap<>(dymb); /* 再改,SsListener.contextInitialized( 里的 MenuU.premakeObjRunMenu() 调用进来时,request 为 null -- 还没登录。Lin * 此时,beanMap 为空 param.putAll(beanMap); */ if (beanMap != null) param.putAll(beanMap); /* 再改,IDEA:'for' loop can be replaced with enhanced 'for'。Lin // objFunc 和 fun 是完全一样的???Lin ObjFuncB fun = (vo.funcMap).get(funs.get(i).name); */ /* 再去掉 fun(ObjFuncB),共用 objFunc -- 与 objFunc 是完全一样的 -- 兜一圈。Lin ObjFuncB fun = vo.funcMap.get(objFunc.name); */ /* 再去掉 fun(ObjFuncB),共用 objFunc -- 与 objFunc 是完全一样的。Lin Map m = ObjU.makeFuncMap(fun, wholeMap, ismobile); */ /* 再增加 vo(ObjB),去掉 ObjFuncB.obj(ObjB) -- 不能反过来指定对象。Lin Map m = ObjU.makeFuncMap(objFunc, wholeMap, ismobile); */ Map m = ObjU.makeFuncMap(objFunc, vo, wholeMap, ismobile); // 从这移到 ObjU,并改为 静态方法。Lin /* 再去掉,IDEA -- Condition 'm != null' is always 'true'。Lin if (m != null) { */ dymb.putAll(m); /* 再去掉 StrJson.toParmStr(),直接用 new Gson().toJson(param)。Lin * 没有去掉左、右的 "{"、"}" dymb.put("param", StrJson.toParmStr(param)); // 去掉 ObjU.toJsonParm(),重复了 -- 用 StrJson.toParmStr()。Lin */ /* 再改,dymb."param" 改为 ."parm" -- 新查询页时。Lin dymb.put("param", new Gson().toJson(param)); */ dymb.put("parm", new Gson().toJson(param)); try { /* 再改,IDEA:Type may be primitive。Lin * 改为 int 了 Long pbWidth = Long.valueOf(dymb.get("width").toString()); Long pbHeight =Long.valueOf(dymb.get("height").toString()); */ int pbWidth = Integer.parseInt(dymb.get("width").toString()); int pbHeight = Integer.parseInt(dymb.get("height").toString()); if (width < pbWidth) width = pbWidth; if (maxHeight < pbHeight) maxHeight = pbHeight; } catch (Exception e) { SsLog.print("部件宽高没设置"); /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin e.printStackTrace(); */ log4j.error("TabU.translatePrintTemplates( 异常", e); } tabList.add(dymb); /* 再去掉,IDEA -- Condition 'm != null' is always 'true'。Lin } else { /// * 再去掉 fun(ObjFuncB),共用 objFunc -- 与 objFunc 是完全一样的。Lin // SsLog.print("找不到部件:" + fun.dest); /// * SsLog.print("找不到部件:" + objFunc.dest); } */ } else { /* 再改,IDEA:'for' loop can be replaced with enhanced 'for'。Lin SsLog.print("没权限:"+ funs.get(i).servName); */ SsLog.print("没权限:" + objFunc.servName); } // } // 不用判断了,改用 ObjB.prtFuncList。Lin } Map result = new HashMap<>(); result.put("maxHeight", maxHeight); result.put("minHeight", minHeight); result.put("width", width); result.put("tabList", tabList); SsLog.print(result.toString()); return result; } catch (Exception e) { /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin e.printStackTrace(); */ log4j.error("TabU.translatePrintTemplates( 异常", e); SsLog.print("dymb :"+ e.getMessage()); /* 再去掉,移到 try 里了 -- 按 IDEA 规范 -- 'try' can use automatic resource management。Lin }finally{ if(gdba!=null) gdba.close(); */ } return null; } // 来自 ViewObjectUtil.createParam()。Lin /* 去掉,重复了。用 StrJson.toParmStr()。Lin public static String makeParm(Map param) { String result = ""; // for(Map.Entry entry:param.entrySet()){ // if(entry.getValue()==null)continue; // if(StringUtil.isNull(entry.getValue().toString()))continue; // result+=entry.getKey()+":"+entry.getValue()+","; // } // if(result.endsWith(",")) // result=result.substring(0,result.length()-1); result = new Gson().toJson(param); // 去掉 StrJson.toJsonStr(),直接用 new Gson().toJson()。Lin result = result.substring(1, result.length() - 1); return result; } */ // 来自 ViewObjectUtil.(String) tabState(String v)。Lin // 判断条件 (v.indexOf("baseUpdate") > 0) 不好理解 -- v = 0) // "baseInfo")。Lin result = ObjC.CHILD_playType; // = "play"。Lin */ if (v.indexOf("baseUpdate") > 0) result = ObjC.CHILD_updType; // = "update"。Lin return result; } // 来自 ViewObjectUtil.(Map) parseTabValue(String str)。Lin // 对对象形式,改用 Json 格式 /* 去掉,再改为:val 里的内容,都用 Json 写法 -- 包括数组形式。Lin * "include_input"/"editBaseInfo,child" 改为 "{val:'include_input'}"/"{val:'editBaseInfo,child'}" public static Map rdTabVal(String str) { Map result = new HashMap<>(); if (StringUtils.isBlank(str)) // 去掉 StrU.isNull(),直接用 StringUtils.isBlank()。Lin return result; if (str.contains(":")) { /// * 改用 JSon 格式。Lin // for (String s : str.split(",")) { // result.put(s.split("\\:")[0], s.split("\\:")[1]); // } /// * return StrJson.toMap(str); } else { result.put("val", str); // ("value",。Lin } return result; } */ // 合成 tabValue(Map),为了 TabU.cmptTab( 的入口参数 // 增加,类似 rdTabVal()。Lin // 再改,拆分 val= 里的内容。Lin // val='{val:"tagState"}' 改为 name = "tagState" // val='{val:"baseInfo,child"}' 改为 name="baseInfo,child" -- 简写,不用 Json 格式 // val='{enable:"viewobject.funcMap.play.print",value:"print"}' 改为 // name="print" 和 enable="viewobject.funcMap.play.print" // val='{show:"button",dest:"env_printInfo",enable:"viewobject.funsMap.change.print",from:"print"}' 改为 // name="prt" filter="viewobject.funsMap.change.print" btn="true" dest="env_printInfo" /* 再去掉 show(String),去掉 。Lin * 再去掉 enable(String) 和 dest(String),只有 了 * enable:,值来自 combTabVal(String name, String enable, String show, String dest) { */ /* 再去掉,直接写 Map.of("name", this.name)。Lin * TabTag 和 DataTag 共用,DataTag 不能调用 TabU * 调用 TabU.combTabVal( 时的 name 不会为空 * 只有一句 Map.put("name", name) 了 public static Map combTabVal(String name) { Map result = new HashMap<>(); if (StringUtils.isBlank(name)) return result; result.put("name", name); /// * 再去掉 enable(String),值来自 。Lin // * "enable" 是笔误 // if (StringUtils.isNotBlank(show)) // result.put("enable", show); /// * /// * 再去掉 dest(String),dest(env_printInfo.jsp) 替换 from ) o).get("jlztm").toString(); } else { // Class c = o.getClass(); // // Method m = c.getMethod("getJlztm"); Object jlztmO = ObjU.rdClazzAtr("jlztm", o); // BeanUtils.getFieldValue()。Lin jlztm = (jlztmO == null) ? null : jlztmO.toString(); } } if (StringUtils.isBlank(jlztm) && obj != null) { // StringUtil.isNull()。Lin /// * 再改,IDEA:Local variable 'objName' is redundant。Lin // String objName = obj.name; // k = objName; /// * k = obj.name; if (k != null) { Object o = pageContext.getAttribute(k.toString()); if (pageContext.getRequest().getAttribute(k.toString()) != null) o = pageContext.getRequest().getAttribute(k.toString()); if (o instanceof Map) { jlztm = ((Map) o).get("jlztm").toString(); } else if (o != null) { // Class c = o.getClass(); // // Method m = c.getMethod("getJlztm"); // jlztm = String.valueOf(m.invoke(o)); Object jlztmO = ObjU.rdClazzAtr("jlztm", o); // BeanUtils.getFieldValue()。Lin jlztm = (jlztmO == null) ? null : jlztmO.toString(); } } } if (StringUtils.isBlank(jlztm)) { // StringUtil.isNull()。Lin /// * 改。Lin // BaseBean bean = (BaseBean) Class.forName(obj.getObjClass()).newInstance(); // if (bean.getFieldMap().containsKey("jlztm") == false) /// * /// * 再,.poName 改为 .poClazz。Lin // Po bean = (Po) Class.forName(obj.poName).getDeclaredConstructor().newInstance(); /// * Po bean = obj.poClazz.getDeclaredConstructor().newInstance(); if (!(bean.fieldTypeMap.containsKey("jlztm"))) return null; /// * 再改,去掉 .idField(ObjFieldB),直接用新加的 .idName(String)。Lin // String objectIdName = obj.idField.name; // .getObjectIdField().getName()。Lin /// * String objectIdName = obj.idName; // .getObjectIdField().getName()。Lin String objectIdValue = (String) ExpressionEvaluatorManager .evaluate("", "${" + objectIdName + "}", String.class, pageContext); if (StringUtils.isNotBlank(objectIdValue)) { // StringUtil.notNull()。Lin String sql = "select JLZTM from " + bean.tabName + " where " + objectIdName + "=" + objectIdValue; /// * 改。Lin // gdba = GeneralDBAccess.getInstance(CoreConstVars.DB_JNDI_NAME_NNDX); /// * gdba = Db.makeConn(); gdba.doSel(sql); // .select()。Lin if (gdba.rowNum > 0) jlztm = gdba.rdStrCol("jlztm"); // .getColumnAsString()。Lin } } } catch (Exception e) { /// * 再去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin // e.printStackTrace(); /// * log4j.error("TabU.rdJlztm( 异常", e); } finally { if (gdba != null) gdba.close(); } return jlztm; } */ // 再从 TabTag 抽取出来,和 DataTag 共用 -- 增加 DataTag 了。Lin public static Map makeTokenParm(ObjB viewobj, String idName, String dxid, PageContext pageContext, HttpServletRequest request) { Map tokenParam = new HashMap<>(); tokenParam.put(idName, dxid); /* 再改为 "ssObjName"、"ssObjId",避免与数据表里的 对象名、对象ID 字段重名 -- 导致合并 Map 时,因 Key 同名而互相覆盖 Value。Lin tokenParam.put("dxid", dxid); tokenParam.put("dxm", viewobj.name); */ tokenParam.put(WebC.REQ_objId, dxid); tokenParam.put(WebC.REQ_objName, viewobj.name); /// 再增加,增加 "kcid" 的值,续传 Request."kcid" 到 DbServ.selRefById() -- 增加